diff options
author | Oleksandr Suvorov <oleksandr.suvorov@toradex.com> | 2021-05-24 18:36:11 +0300 |
---|---|---|
committer | Oleksandr Suvorov <oleksandr.suvorov@toradex.com> | 2021-05-26 13:08:54 +0300 |
commit | ade2658a366b2748860c223dc3d6f243d59e9358 (patch) | |
tree | decd10c90edd5f861135a717ca7a28ebe3b854ae /board | |
parent | cdc62735486bba86d8749431e69dff67f6f09a85 (diff) |
colibri-imx7: full support of tezi-recovery image
The recovery image needs to support both Colibri-iMX7 NAND and
Colibri-iMX7 eMMC modules. Forward port the solution for this
from u-boot 2016.11, originally developed by
Stefan Agner <stefan.agner@toradex.com>.
Related-to: TEI-775
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
Diffstat (limited to 'board')
-rw-r--r-- | board/toradex/colibri_imx7/Kconfig | 13 | ||||
-rw-r--r-- | board/toradex/colibri_imx7/colibri_imx7.c | 28 |
2 files changed, 36 insertions, 5 deletions
diff --git a/board/toradex/colibri_imx7/Kconfig b/board/toradex/colibri_imx7/Kconfig index d33ec63523..c50d4b5c8c 100644 --- a/board/toradex/colibri_imx7/Kconfig +++ b/board/toradex/colibri_imx7/Kconfig @@ -2,6 +2,7 @@ if TARGET_COLIBRI_IMX7 choice prompt "Colibri iMX7S/D variant" + optional config TARGET_COLIBRI_IMX7_NAND bool "Support Colibri iMX7 Solo 256MB/Dual 512MB (raw NAND) modules" @@ -25,9 +26,6 @@ config SYS_BOARD config SYS_VENDOR default "toradex" -config SYS_CONFIG_NAME - default "colibri_imx7" - config COLIBRI_IMX7_EXT_PHYCLK bool "External oscillator for Ethernet PHY clock provided" help @@ -41,8 +39,14 @@ config TDX_CFG_BLOCK config TDX_CFG_BLOCK_2ND_ETHADDR default y +config SYS_CONFIG_NAME + default "colibri_imx7_tezi_recovery" if (!TARGET_COLIBRI_IMX7_NAND && !TARGET_COLIBRI_IMX7_EMMC) + if TARGET_COLIBRI_IMX7_NAND +config SYS_CONFIG_NAME + default "colibri_imx7" + config TDX_HAVE_NAND default y @@ -56,6 +60,9 @@ endif if TARGET_COLIBRI_IMX7_EMMC +config SYS_CONFIG_NAME + default "colibri_imx7" + config TDX_HAVE_MMC default y 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"); |