diff mbox

[U-Boot,2/3] arm: baltos: active mPCIe slot

Message ID 1480593138-31105-2-git-send-email-yegorslists@googlemail.com
State Accepted
Commit dcf7f6f1cc05ed52eda02c8cf39afea785f639c6
Delegated to: Tom Rini
Headers show

Commit Message

Yegor Yefremov Dec. 1, 2016, 11:52 a.m. UTC
From: Yegor Yefremov <yegorslists@googlemail.com>

Baltos devices provide a mPCIe slot, whose power is turned off by
default. This patch activates mPCIe slot in U-Boot, so that for example
GSM modem can be already available in user space.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
---
 board/vscom/baltos/board.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

Comments

Tom Rini Dec. 1, 2016, 3:35 p.m. UTC | #1
On Thu, Dec 01, 2016 at 12:52:17PM +0100, yegorslists@googlemail.com wrote:

> From: Yegor Yefremov <yegorslists@googlemail.com>
> 
> Baltos devices provide a mPCIe slot, whose power is turned off by
> default. This patch activates mPCIe slot in U-Boot, so that for example
> GSM modem can be already available in user space.
> 
> Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>

Reviewed-by: Tom Rini <trini@konsulko.com>
diff mbox

Patch

diff --git a/board/vscom/baltos/board.c b/board/vscom/baltos/board.c
index dbf79a5..d3b1f15 100644
--- a/board/vscom/baltos/board.c
+++ b/board/vscom/baltos/board.c
@@ -39,6 +39,7 @@  DECLARE_GLOBAL_DATA_PTR;
 /* GPIO that controls power to DDR on EVM-SK */
 #define GPIO_DDR_VTT_EN		7
 #define DIP_S1			44
+#define MPCIE_SW		100
 
 static struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE;
 
@@ -330,6 +331,11 @@  int ft_board_setup(void *blob, bd_t *bd)
 	return 0;
 }
 
+static struct module_pin_mux pcie_sw_pin_mux[] = {
+	{OFFSET(mii1_rxdv), (MODE(7) | PULLUDEN )},     /* GPIO3_4 */
+	{-1},
+};
+
 static struct module_pin_mux dip_pin_mux[] = {
 	{OFFSET(gpmc_ad12), (MODE(7) | RXACTIVE )},	/* GPIO1_12 */
 	{OFFSET(gpmc_ad13), (MODE(7)  | RXACTIVE )},	/* GPIO1_13 */
@@ -355,6 +361,18 @@  int board_late_init(void)
 			baltos_set_console();
 		}
 	}
+
+	/* turn power for the mPCIe slot */
+	configure_module_pin_mux(pcie_sw_pin_mux);
+	if (gpio_request(MPCIE_SW, "mpcie_sw")) {
+		printf("failed to export GPIO %d\n", MPCIE_SW);
+		return -ENODEV;
+	}
+	if (gpio_direction_output(MPCIE_SW, 1)) {
+		printf("failed to set GPIO %d direction\n", MPCIE_SW);
+		return -ENODEV;
+	}
+
 	setenv("board_name", model);
 #endif