diff options
Diffstat (limited to 'board/toradex/colibri_imx7/colibri_imx7.c')
-rw-r--r-- | board/toradex/colibri_imx7/colibri_imx7.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/board/toradex/colibri_imx7/colibri_imx7.c b/board/toradex/colibri_imx7/colibri_imx7.c index ec61498c7c..8117db2f09 100644 --- a/board/toradex/colibri_imx7/colibri_imx7.c +++ b/board/toradex/colibri_imx7/colibri_imx7.c @@ -50,7 +50,12 @@ DECLARE_GLOBAL_DATA_PTR; #define NAND_PAD_READY0_CTRL (PAD_CTL_DSE_3P3V_49OHM | PAD_CTL_PUS_PU5KOHM) +#define FLASH_DETECTION_CTRL (PAD_CTL_HYS | PAD_CTL_PUE) + #define USB_CDET_GPIO IMX_GPIO_NR(7, 14) +#define FLASH_DET_GPIO IMX_GPIO_NR(6, 11) + +static bool is_emmc; int dram_init(void) { @@ -72,6 +77,10 @@ static iomux_v3_cfg_t const usb_cdet_pads[] = { }; #endif +static iomux_v3_cfg_t const flash_detection_pads[] = { + MX7D_PAD_SD3_RESET_B__GPIO6_IO11 | MUX_PAD_CTRL(FLASH_DETECTION_CTRL), +}; + #ifdef CONFIG_TARGET_COLIBRI_IMX7_NAND static iomux_v3_cfg_t const gpmi_pads[] = { MX7D_PAD_SD3_DATA0__NAND_DATA00 | MUX_PAD_CTRL(NAND_PAD_CTRL), @@ -182,6 +191,16 @@ int board_init(void) /* address of boot parameters */ gd->bd->bi_boot_params = PHYS_SDRAM + 0x100; + /* + * Enable GPIO on NAND_WE_B/eMMC_RST with 100k pull-down. eMMC_RST + * is pulled high with 4.7k for eMMC devices. This allows to reliably + * detect eMMC/NAND flash + */ + imx_iomux_v3_setup_multiple_pads(flash_detection_pads, ARRAY_SIZE(flash_detection_pads)); + gpio_request(FLASH_DET_GPIO, "flash-detection-gpio"); + is_emmc = gpio_get_value(FLASH_DET_GPIO); + gpio_free(FLASH_DET_GPIO); + #ifdef CONFIG_FEC_MXC setup_fec(); #endif @@ -309,8 +328,10 @@ int ft_board_setup(void *blob, bd_t *bd) }; /* Update partition nodes using info from mtdparts env var */ - puts(" Updating MTD partitions...\n"); - fdt_fixup_mtdparts(blob, nodes, ARRAY_SIZE(nodes)); + if (!is_emmc) { + puts(" Updating MTD partitions...\n"); + fdt_fixup_mtdparts(blob, nodes, ARRAY_SIZE(nodes)); + } #endif return ft_common_board_setup(blob, bd); @@ -361,6 +382,9 @@ int board_late_init(void) setup_lcd(); #endif + if (is_emmc) + env_set("variant", "-emmc"); + #ifdef CONFIG_CMD_USB_SDP if (is_boot_from_usb()) { printf("Serial Downloader recovery mode, using sdp command\n"); |