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 <tharvey@gateworks.com>
This commit is contained in:
Tim Harvey 2016-05-24 11:03:59 -07:00 committed by Stefano Babic
parent 385575bcb6
commit 34b080b79c
3 changed files with 33 additions and 2 deletions

View File

@ -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 */

View File

@ -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];

View File

@ -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