MLK-21852 imx: Update runtime SD/MMC boot env device and env variables
authorYe Li <ye.li@nxp.com>
Fri, 10 May 2019 06:48:16 +0000 (23:48 -0700)
committerYe Li <ye.li@nxp.com>
Fri, 24 May 2019 11:28:50 +0000 (04:28 -0700)
Since we enabled MMC alias, the USDHC index in u-boot is the usdhc port.
So we don't need to convert them for kernel and u-boot env device.

Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 8fd6e14f5c1598684bc08a7917f89cd94e988d8f)

22 files changed:
arch/arm/mach-imx/imx8/cpu.c
arch/arm/mach-imx/mmc_env.c
arch/arm/mach-imx/mx6/soc.c
arch/arm/mach-imx/mx7ulp/soc.c
board/freescale/imx8mm_evk/imx8mm_evk.c
board/freescale/imx8mm_val/imx8mm_val.c
board/freescale/imx8mq_arm2/imx8mq_arm2.c
board/freescale/imx8mq_evk/imx8mq_evk.c
board/freescale/imx8qm_arm2/imx8qm_arm2.c
board/freescale/imx8qm_mek/imx8qm_mek.c
board/freescale/imx8qxp_arm2/imx8qxp_arm2.c
board/freescale/imx8qxp_mek/imx8qxp_mek.c
board/freescale/mx6sabreauto/mx6sabreauto.c
board/freescale/mx6sabresd/mx6sabresd.c
board/freescale/mx6slevk/mx6slevk.c
board/freescale/mx6sllevk/mx6sllevk.c
board/freescale/mx6sxsabreauto/mx6sxsabreauto.c
board/freescale/mx6sxsabresd/mx6sxsabresd.c
board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c
board/freescale/mx6ullevk/mx6ullevk.c
board/freescale/mx7dsabresd/mx7dsabresd.c
board/freescale/mx7ulp_evk/mx7ulp_evk.c

index ced3f4c..9683751 100644 (file)
@@ -570,7 +570,7 @@ void get_board_serial(struct tag_serialnr *serialnr)
 #ifdef CONFIG_ENV_IS_IN_MMC
 __weak int board_mmc_get_env_dev(int devno)
 {
-       return CONFIG_SYS_MMC_ENV_DEV;
+       return devno;
 }
 
 int mmc_get_env_dev(void)
index 9c822f7..9c1d3cd 100644 (file)
@@ -11,7 +11,7 @@
 
 __weak int board_mmc_get_env_dev(int devno)
 {
-       return CONFIG_SYS_MMC_ENV_DEV;
+       return devno;
 }
 
 int mmc_get_env_dev(void)
index 59e25c0..f0dd46d 100644 (file)
@@ -639,7 +639,7 @@ int arch_cpu_init(void)
 #ifdef CONFIG_ENV_IS_IN_MMC
 __weak int board_mmc_get_env_dev(int devno)
 {
-       return CONFIG_SYS_MMC_ENV_DEV;
+       return devno;
 }
 
 static int mmc_get_boot_dev(void)
index eecb1b1..2c9707c 100644 (file)
@@ -313,7 +313,7 @@ void arch_preboot_os(void)
 #ifdef CONFIG_ENV_IS_IN_MMC
 __weak int board_mmc_get_env_dev(int devno)
 {
-       return CONFIG_SYS_MMC_ENV_DEV;
+       return devno;
 }
 
 int mmc_get_env_dev(void)
index cf552ce..ac32227 100644 (file)
@@ -354,12 +354,6 @@ int board_init(void)
        return 0;
 }
 
-int board_mmc_get_env_dev(int devno)
-{
-       return devno;
-}
-
-
 #ifdef CONFIG_VIDEO_MXS
 
 #define ADV7535_MAIN 0x3d
@@ -656,5 +650,9 @@ size_t display_count = ARRAY_SIZE(displays);
 
 int board_late_init(void)
 {
+#ifdef CONFIG_ENV_IS_IN_MMC
+       board_late_mmc_env_init();
+#endif
+
        return 0;
 }
index 90f74cb..b45c5a6 100644 (file)
@@ -409,13 +409,11 @@ int board_init(void)
        return 0;
 }
 
-int board_mmc_get_env_dev(int devno)
-{
-       return devno;
-}
-
-
 int board_late_init(void)
 {
+#ifdef CONFIG_ENV_IS_IN_MMC
+       board_late_mmc_env_init();
+#endif
+
        return 0;
 }
index 303e22c..e5b9646 100644 (file)
@@ -271,11 +271,6 @@ int board_init(void)
        return 0;
 }
 
-int board_mmc_get_env_dev(int devno)
-{
-       return devno;
-}
-
 int board_late_init(void)
 {
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
@@ -287,6 +282,10 @@ int board_late_init(void)
        env_set("board_rev", "iMX8MQ");
 #endif
 
+#ifdef CONFIG_ENV_IS_IN_MMC
+       board_late_mmc_env_init();
+#endif
+
        return 0;
 }
 
index 25a2d50..4a7d6e2 100644 (file)
@@ -275,11 +275,6 @@ int board_init(void)
        return 0;
 }
 
-int board_mmc_get_env_dev(int devno)
-{
-       return devno;
-}
-
 int board_late_init(void)
 {
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
@@ -287,6 +282,10 @@ int board_late_init(void)
        env_set("board_rev", "iMX8MQ");
 #endif
 
+#ifdef CONFIG_ENV_IS_IN_MMC
+       board_late_mmc_env_init();
+#endif
+
        return 0;
 }
 
index 3bca6a6..c31e422 100644 (file)
@@ -599,11 +599,6 @@ int ft_board_setup(void *blob, bd_t *bd)
 }
 #endif
 
-int board_mmc_get_env_dev(int devno)
-{
-       return devno;
-}
-
 int board_late_init(void)
 {
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
@@ -616,6 +611,10 @@ int board_late_init(void)
        env_set("sec_boot", "yes");
 #endif
 
+#ifdef CONFIG_ENV_IS_IN_MMC
+       board_late_mmc_env_init();
+#endif
+
        return 0;
 }
 
index 4846510..2bd39a1 100644 (file)
@@ -474,11 +474,6 @@ int ft_board_setup(void *blob, bd_t *bd)
 }
 #endif
 
-int board_mmc_get_env_dev(int devno)
-{
-       return devno;
-}
-
 int board_late_init(void)
 {
        char *fdt_file;
@@ -504,6 +499,9 @@ int board_late_init(void)
                        env_set("fdt_file", "fsl-imx8qm-mek.dtb");
        }
 
+#ifdef CONFIG_ENV_IS_IN_MMC
+       board_late_mmc_env_init();
+#endif
        return 0;
 }
 
index e8b3d4a..ccde354 100644 (file)
@@ -608,10 +608,6 @@ int ft_board_setup(void *blob, bd_t *bd)
 }
 #endif
 
-int board_mmc_get_env_dev(int devno)
-{
-       return devno;
-}
 
 int board_late_init(void)
 {
@@ -625,6 +621,10 @@ int board_late_init(void)
        env_set("sec_boot", "yes");
 #endif
 
+#ifdef CONFIG_ENV_IS_IN_MMC
+       board_late_mmc_env_init();
+#endif
+
        return 0;
 }
 
index 2678278..c992fc4 100644 (file)
@@ -489,11 +489,6 @@ int ft_board_setup(void *blob, bd_t *bd)
 }
 #endif
 
-int board_mmc_get_env_dev(int devno)
-{
-       return devno;
-}
-
 int board_late_init(void)
 {
        char *fdt_file;
@@ -519,6 +514,10 @@ int board_late_init(void)
                        env_set("fdt_file", "fsl-imx8qxp-mek.dtb");
        }
 
+#ifdef CONFIG_ENV_IS_IN_MMC
+       board_late_mmc_env_init();
+#endif
+
        return 0;
 }
 
index c4c1a98..2b3d6d9 100644 (file)
@@ -915,6 +915,10 @@ int board_late_init(void)
                env_set("board_rev", "MX6DL");
 #endif
 
+#ifdef CONFIG_ENV_IS_IN_MMC
+       board_late_mmc_env_init();
+#endif
+
        return 0;
 }
 
index 26376f7..97ea458 100644 (file)
@@ -1276,6 +1276,10 @@ int board_late_init(void)
                env_set("board_rev", "MX6DL");
 #endif
 
+#ifdef CONFIG_ENV_IS_IN_MMC
+       board_late_mmc_env_init();
+#endif
+
        return 0;
 }
 
index 2796e1e..eca593b 100644 (file)
@@ -242,11 +242,6 @@ static void setup_iomux_fec(void)
        udelay(15000);
 }
 
-int board_mmc_get_env_dev(int devno)
-{
-       return devno;
-}
-
 #ifdef CONFIG_SYS_I2C
 #define PC     MUX_PAD_CTRL(I2C_PAD_CTRL)
 /* I2C1 for PMIC */
index 65046f4..9a1a2ae 100644 (file)
@@ -448,14 +448,4 @@ int checkboard(void)
        puts("Board: MX6SLL EVK\n");
 
        return 0;
-}
-
-int board_mmc_get_env_dev(int devno)
-{
-       return devno;
-}
-
-int mmc_map_to_kernel_blk(int devno)
-{
-       return devno;
-}
+}
\ No newline at end of file
index 66271fe..d3c7124 100644 (file)
@@ -263,20 +263,6 @@ int board_early_init_f(void)
        return 0;
 }
 
-int board_mmc_get_env_dev(int devno)
-{
-       /*
-        * need subtract 2 to map to the mmc device id
-        * see the comments in board_mmc_init function
-        */
-       return devno - 2;
-}
-
-int mmc_map_to_kernel_blk(int devno)
-{
-       return devno + 2;
-}
-
 #ifdef CONFIG_VIDEO_MXS
 static iomux_v3_cfg_t const lvds_ctrl_pads[] = {
        /* Use GPIO for Brightness adjustment, duty cycle = period */
index 37fb6c7..78b7779 100644 (file)
@@ -581,16 +581,6 @@ static struct fsl_esdhc_cfg usdhc_cfg[3] = {
 #define USDHC3_PWR_GPIO        IMX_GPIO_NR(2, 11)
 #define USDHC4_CD_GPIO IMX_GPIO_NR(6, 21)
 
-int board_mmc_get_env_dev(int devno)
-{
-       return devno - 1;
-}
-
-int mmc_map_to_kernel_blk(int dev_no)
-{
-       return dev_no + 1;
-}
-
 int board_mmc_getcd(struct mmc *mmc)
 {
        struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
index adb631b..f7c7689 100644 (file)
@@ -250,22 +250,6 @@ static struct fsl_esdhc_cfg usdhc_cfg[2] = {
 #define USDHC2_CD_GPIO IMX_GPIO_NR(4, 5)
 #define USDHC2_PWR_GPIO        IMX_GPIO_NR(4, 10)
 
-int board_mmc_get_env_dev(int devno)
-{
-       if (devno == 1 && mx6_esdhc_fused(USDHC1_BASE_ADDR))
-               devno = 0;
-
-       return devno;
-}
-
-int mmc_map_to_kernel_blk(int devno)
-{
-       if (devno == 0 && mx6_esdhc_fused(USDHC1_BASE_ADDR))
-               devno = 1;
-
-       return devno;
-}
-
 int board_mmc_getcd(struct mmc *mmc)
 {
        struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
index 0ddac9c..3b0a8ad 100644 (file)
@@ -252,16 +252,6 @@ int board_phy_config(struct phy_device *phydev)
 }
 #endif
 
-int board_mmc_get_env_dev(int devno)
-{
-       return devno;
-}
-
-int mmc_map_to_kernel_blk(int devno)
-{
-       return devno;
-}
-
 #ifdef CONFIG_VIDEO_MXS
 static iomux_v3_cfg_t const lcd_pads[] = {
        MX6_PAD_LCD_CLK__LCDIF_CLK | MUX_PAD_CTRL(LCD_PAD_CTRL),
index 0131fb8..b3212c2 100644 (file)
@@ -253,22 +253,6 @@ static void setup_iomux_uart(void)
        imx_iomux_v3_setup_multiple_pads(uart1_pads, ARRAY_SIZE(uart1_pads));
 }
 
-int board_mmc_get_env_dev(int devno)
-{
-       if (devno == 2)
-               devno--;
-
-       return devno;
-}
-
-int mmc_map_to_kernel_blk(int dev_no)
-{
-       if (dev_no == 1)
-               dev_no++;
-
-       return dev_no;
-}
-
 #ifdef CONFIG_FEC_MXC
 static int setup_fec(int fec_id)
 {
index bc827ec..4a53793 100644 (file)
@@ -212,11 +212,6 @@ int board_init(void)
        return 0;
 }
 
-int board_mmc_get_env_dev(int devno)
-{
-       return devno;
-}
-
 int board_late_init(void)
 {
        env_set("tee", "no");