From 34b080b79ccb59e144619179b4cd57a2f146f8d3 Mon Sep 17 00:00:00 2001 From: Tim Harvey Date: Tue, 24 May 2016 11:03:59 -0700 Subject: [PATCH] imx: ventana: add fdt fixup to enable UHS-I support on selected boards UHS-I support is available on Ventana boards with micro-SD sockets depending on the board revision. For backwards compatibility to not break users who have old bootloaders and newer kernels the device-tree on boards with microSD disables UHS-I support by default by defining the no-1-8-v property in the esdhc controller node. For models/revisions that support switchable 1.8V/3.3V I/O which is detectable by the presence of a pull-down on the SD3_VSELECT pin we remove that property to enable support in the kernel. Additionally we add SD3_VSELECT to the pinmux for clarity (even though U-Boot does not currently support UHS-I modes requiring 1.8V I/O). Signed-off-by: Tim Harvey --- board/gateworks/gw_ventana/common.c | 7 +++++++ board/gateworks/gw_ventana/common.h | 2 ++ board/gateworks/gw_ventana/gw_ventana.c | 26 ++++++++++++++++++++++++-- 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/board/gateworks/gw_ventana/common.c b/board/gateworks/gw_ventana/common.c index 2c3ac93..929dde9 100644 --- a/board/gateworks/gw_ventana/common.c +++ b/board/gateworks/gw_ventana/common.c @@ -134,6 +134,8 @@ void setup_ventana_i2c(void) static iomux_v3_cfg_t const gw_gpio_pads[] = { /* RS232_EN# */ IOMUX_PADS(PAD_SD4_DAT3__GPIO2_IO11 | DIO_PAD_CFG), + /* SD3_VSELECT */ + IOMUX_PADS(PAD_NANDF_CS1__GPIO6_IO14 | DIO_PAD_CFG), }; /* prototype */ @@ -766,6 +768,11 @@ void setup_iomux_gpio(int board, struct ventana_board_info *info) gpio_request(gpio_cfg[board].wdis, "wlan_dis"); gpio_direction_output(gpio_cfg[board].wdis, 1); } + + /* sense vselect pin to see if we support uhs-i */ + gpio_request(GP_SD3_VSELECT, "sd3_vselect"); + gpio_direction_input(GP_SD3_VSELECT); + gpio_cfg[board].usd_vsel = !gpio_get_value(GP_SD3_VSELECT); } /* setup GPIO pinmux and default configuration per baseboard and env */ diff --git a/board/gateworks/gw_ventana/common.h b/board/gateworks/gw_ventana/common.h index 58ad5ff..d037767 100644 --- a/board/gateworks/gw_ventana/common.h +++ b/board/gateworks/gw_ventana/common.h @@ -17,6 +17,7 @@ #define GP_SD3_CD IMX_GPIO_NR(7, 0) #define GP_RS232_EN IMX_GPIO_NR(2, 11) #define GP_MSATA_SEL IMX_GPIO_NR(2, 8) +#define GP_SD3_VSELECT IMX_GPIO_NR(6, 14) #define UART_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE | \ PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED | \ @@ -77,6 +78,7 @@ struct ventana { int usb_sel; int wdis; int msata_en; + bool usd_vsel; }; extern struct ventana gpio_cfg[GW_UNKNOWN]; diff --git a/board/gateworks/gw_ventana/gw_ventana.c b/board/gateworks/gw_ventana/gw_ventana.c index 15e4bf1..82313e8 100644 --- a/board/gateworks/gw_ventana/gw_ventana.c +++ b/board/gateworks/gw_ventana/gw_ventana.c @@ -60,8 +60,7 @@ static iomux_v3_cfg_t const usdhc3_pads[] = { IOMUX_PADS(PAD_SD3_DAT1__SD3_DATA1 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), IOMUX_PADS(PAD_SD3_DAT2__SD3_DATA2 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), IOMUX_PADS(PAD_SD3_DAT3__SD3_DATA3 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), - /* CD */ - IOMUX_PADS(PAD_SD3_DAT5__GPIO7_IO00 | MUX_PAD_CTRL(IRQ_PAD_CTRL)), + IOMUX_PADS(PAD_SD3_DAT5__GPIO7_IO00 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), }; /* ENET */ @@ -792,6 +791,17 @@ static inline void ft_enable_path(void *blob, const char *path) } } +/* remove a property of a node if the node is found */ +static inline void ft_delprop_path(void *blob, const char *path, + const char *name) +{ + int i = fdt_path_offset(blob, path); + if (i) { + debug("removing %s/%s\n", path, name); + fdt_delprop(blob, i, name); + } +} + /* * called prior to booting kernel or by 'fdt boardsetup' command * @@ -895,6 +905,11 @@ int ft_board_setup(void *blob, bd_t *bd) range[1] = cpu_to_fdt32(23); } } + + /* these have broken usd_vsel */ + if (strstr((const char *)info->model, "SP318-B") || + strstr((const char *)info->model, "SP331-B")) + gpio_cfg[board_type].usd_vsel = 0; } /* @@ -954,6 +969,13 @@ int ft_board_setup(void *blob, bd_t *bd) } } + /* remove no-1-8-v if UHS-I support is present */ + if (gpio_cfg[board_type].usd_vsel) { + debug("Enabling UHS-I support\n"); + ft_delprop_path(blob, "/soc/aips-bus@02100000/usdhc@02198000", + "no-1-8-v"); + } + /* * Peripheral Config: * remove nodes by alias path if EEPROM config tells us the -- 2.7.4