diff mbox series

Convert CONFIG_SYS_MMC_ENV_DEV et al to Kconfig

Message ID 20200724211447.3137-1-trini@konsulko.com
State Accepted
Delegated to: Tom Rini
Headers show
Series Convert CONFIG_SYS_MMC_ENV_DEV et al to Kconfig | expand

Commit Message

Tom Rini July 24, 2020, 9:14 p.m. UTC
This converts the following to Kconfig:
   CONFIG_SYS_MMC_ENV_DEV
   CONFIG_SYS_MMC_ENV_PART

Cc: Priyanka Jain <priyanka.jain@nxp.com>
Cc: Madalin Bucur <madalin.bucur@oss.nxp.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
---
Due to some non-environment usage of the variables, cc'ing a few folks.
---
 configs/am335x_boneblack_vboot_defconfig  |  1 +
 configs/am335x_shc_defconfig              |  1 +
 configs/am335x_shc_ict_defconfig          |  1 +
 configs/am335x_sl50_defconfig             |  2 ++
 configs/am57xx_evm_defconfig              |  1 +
 configs/am57xx_hs_evm_defconfig           |  1 +
 configs/am57xx_hs_evm_usb_defconfig       |  1 +
 configs/am65x_evm_a53_defconfig           |  1 +
 configs/am65x_hs_evm_a53_defconfig        |  1 +
 configs/apalis-imx8qm_defconfig           |  1 +
 configs/apalis-tk1_defconfig              |  1 +
 configs/apalis_imx6_defconfig             |  1 +
 configs/apalis_t30_defconfig              |  1 +
 configs/bcm11130_defconfig                |  1 -
 configs/beaver_defconfig                  |  1 +
 configs/brppt1_mmc_defconfig              |  2 ++
 configs/brxre1_defconfig                  |  2 ++
 configs/cardhu_defconfig                  |  1 +
 configs/cei-tk1-som_defconfig             |  1 +
 configs/colibri-imx8qxp_defconfig         |  1 +
 configs/colibri_imx6_defconfig            |  1 +
 configs/colibri_imx7_emmc_defconfig       |  1 +
 configs/colibri_t30_defconfig             |  1 +
 configs/dalmore_defconfig                 |  1 +
 configs/deneb_defconfig                   |  1 +
 configs/dra7xx_evm_defconfig              |  1 +
 configs/dra7xx_hs_evm_defconfig           |  1 +
 configs/dra7xx_hs_evm_usb_defconfig       |  1 +
 configs/dragonboard410c_defconfig         |  1 +
 configs/e2220-1170_defconfig              |  1 +
 configs/evb-rk3328_defconfig              |  1 +
 configs/ficus-rk3399_defconfig            |  1 +
 configs/giedi_defconfig                   |  1 +
 configs/gwventana_emmc_defconfig          |  1 +
 configs/gwventana_gw5904_defconfig        |  1 +
 configs/hikey_defconfig                   |  1 +
 configs/imx6dl_mamoj_defconfig            |  1 +
 configs/imx8mm_beacon_defconfig           |  1 +
 configs/imx8mm_evk_defconfig              |  1 +
 configs/imx8mp_evk_defconfig              |  1 +
 configs/imx8mq_evk_defconfig              |  1 +
 configs/imx8mq_phanbell_defconfig         |  1 +
 configs/imx8qm_mek_defconfig              |  1 +
 configs/imx8qm_rom7720_a1_4G_defconfig    |  1 +
 configs/imx8qxp_mek_defconfig             |  1 +
 configs/j721e_evm_a72_defconfig           |  1 +
 configs/j721e_hs_evm_a72_defconfig        |  1 +
 configs/j721e_hs_evm_r5_defconfig         |  1 +
 configs/jetson-tk1_defconfig              |  1 +
 configs/kp_imx6q_tpc_defconfig            |  1 +
 configs/mx6dlarm2_defconfig               |  1 +
 configs/mx6dlarm2_lpddr2_defconfig        |  1 +
 configs/mx6qarm2_defconfig                |  1 +
 configs/mx6qarm2_lpddr2_defconfig         |  1 +
 configs/mx6sabresd_defconfig              |  1 +
 configs/mx6slevk_defconfig                |  1 +
 configs/mx6slevk_spl_defconfig            |  1 +
 configs/mx6sxsabresd_defconfig            |  1 +
 configs/mx6ul_14x14_evk_defconfig         |  1 +
 configs/mx6ul_9x9_evk_defconfig           |  1 +
 configs/mx6ull_14x14_evk_defconfig        |  1 +
 configs/mx6ull_14x14_evk_plugin_defconfig |  1 +
 configs/mx6ulz_14x14_evk_defconfig        |  1 +
 configs/nyan-big_defconfig                |  1 +
 configs/omap4_sdp4430_defconfig           |  1 +
 configs/omap5_uevm_defconfig              |  1 +
 configs/opos6uldev_defconfig              |  1 +
 configs/p2371-0000_defconfig              |  1 +
 configs/p2371-2180_defconfig              |  1 +
 configs/p2571_defconfig                   |  1 +
 configs/p2771-0000-000_defconfig          |  1 +
 configs/p2771-0000-500_defconfig          |  1 +
 configs/paz00_defconfig                   |  1 +
 configs/phycore-rk3288_defconfig          |  1 +
 configs/pico-imx8mq_defconfig             |  1 +
 configs/puma-rk3399_defconfig             |  1 +
 configs/r8a77990_ebisu_defconfig          |  2 ++
 configs/r8a77995_draak_defconfig          |  1 +
 configs/rcar3_salvator-x_defconfig        |  2 ++
 configs/rcar3_ulcb_defconfig              |  2 ++
 configs/riotboard_defconfig               |  1 +
 configs/riotboard_spl_defconfig           |  1 +
 configs/roc-cc-rk3328_defconfig           |  1 +
 configs/rock-pi-e-rk3328_defconfig        |  1 +
 configs/rock64-rk3328_defconfig           |  1 +
 configs/rock960-rk3399_defconfig          |  1 +
 configs/seaboard_defconfig                |  1 +
 configs/sei510_defconfig                  |  2 ++
 configs/sei610_defconfig                  |  2 ++
 configs/somlabs_visionsom_6ull_defconfig  |  1 +
 configs/tbs2910_defconfig                 |  2 ++
 configs/tec-ng_defconfig                  |  1 +
 configs/tinker-rk3288_defconfig           |  1 +
 configs/tinker-s-rk3288_defconfig         |  1 +
 configs/venice2_defconfig                 |  1 +
 configs/ventana_defconfig                 |  1 +
 configs/verdin-imx8mm_defconfig           |  1 +
 configs/vining_2000_defconfig             |  1 +
 configs/vyasa-rk3288_defconfig            |  1 +
 configs/xpress_defconfig                  |  1 +
 configs/xpress_spl_defconfig              |  1 +
 configs/zc5202_defconfig                  |  2 ++
 configs/zc5601_defconfig                  |  2 ++
 env/Kconfig                               | 19 +++++++++++++++++++
 include/configs/P1010RDB.h                |  1 -
 include/configs/P2041RDB.h                |  1 -
 include/configs/T102xRDB.h                |  5 -----
 include/configs/T104xRDB.h                |  2 --
 include/configs/T208xQDS.h                |  5 -----
 include/configs/T208xRDB.h                |  5 -----
 include/configs/T4240RDB.h                |  5 -----
 include/configs/UCP1020.h                 |  4 ----
 include/configs/am335x_evm.h              |  2 --
 include/configs/am335x_shc.h              |  5 -----
 include/configs/am335x_sl50.h             |  5 -----
 include/configs/am57xx_evm.h              |  2 --
 include/configs/am65x_evm.h               |  4 ----
 include/configs/apalis-imx8.h             |  2 --
 include/configs/apalis-tk1.h              |  2 --
 include/configs/apalis_imx6.h             |  2 --
 include/configs/apalis_t30.h              |  2 --
 include/configs/apx4devkit.h              |  3 ---
 include/configs/at91-sama5_common.h       |  5 -----
 include/configs/at91sam9260ek.h           |  1 -
 include/configs/at91sam9n12ek.h           |  1 -
 include/configs/bcm23550_w1d.h            |  1 -
 include/configs/bcm28155_ap.h             |  1 -
 include/configs/bcm7260.h                 |  2 --
 include/configs/beaver.h                  |  2 --
 include/configs/brppt1.h                  |  4 ----
 include/configs/brxre1.h                  |  2 --
 include/configs/capricorn-common.h        |  2 --
 include/configs/cardhu.h                  |  2 --
 include/configs/cei-tk1-som.h             |  2 --
 include/configs/cgtqmx6eval.h             |  4 ----
 include/configs/chiliboard.h              |  2 --
 include/configs/ci20.h                    |  1 -
 include/configs/clearfog.h                |  1 -
 include/configs/colibri-imx8x.h           |  2 --
 include/configs/colibri_imx6.h            |  2 --
 include/configs/colibri_imx7.h            |  2 --
 include/configs/colibri_t30.h             |  2 --
 include/configs/controlcenterd.h          |  1 -
 include/configs/corenet_ds.h              |  1 -
 include/configs/cyrus.h                   |  1 -
 include/configs/dalmore.h                 |  2 --
 include/configs/dart_6ul.h                |  2 --
 include/configs/dh_imx6.h                 |  1 -
 include/configs/dra7xx_evm.h              |  1 -
 include/configs/draak.h                   |  2 --
 include/configs/dragonboard410c.h         |  3 ---
 include/configs/e2220-1170.h              |  2 --
 include/configs/ebisu.h                   |  2 --
 include/configs/edison.h                  |  2 --
 include/configs/el6x_common.h             |  5 -----
 include/configs/elgin_rv1108.h            |  2 --
 include/configs/embestmx6boards.h         |  1 -
 include/configs/evb_px30.h                |  2 --
 include/configs/evb_px5.h                 |  2 --
 include/configs/evb_rk3128.h              |  2 --
 include/configs/evb_rk3229.h              |  2 --
 include/configs/evb_rk3288.h              |  2 --
 include/configs/evb_rk3308.h              |  1 -
 include/configs/evb_rk3328.h              |  2 --
 include/configs/evb_rk3399.h              |  4 ----
 include/configs/exynos5-common.h          |  2 --
 include/configs/firefly-rk3288.h          |  2 --
 include/configs/firefly_rk3308.h          |  1 -
 include/configs/gru.h                     |  2 --
 include/configs/gw_ventana.h              |  4 ----
 include/configs/helios4.h                 |  1 -
 include/configs/hikey.h                   |  2 --
 include/configs/imx6-engicam.h            |  3 ---
 include/configs/imx6dl-mamoj.h            |  1 -
 include/configs/imx8mm_beacon.h           |  1 -
 include/configs/imx8mm_evk.h              |  1 -
 include/configs/imx8mn_evk.h              |  1 -
 include/configs/imx8mp_evk.h              |  1 -
 include/configs/imx8mq_evk.h              |  1 -
 include/configs/imx8mq_phanbell.h         |  1 -
 include/configs/imx8qm_mek.h              |  2 --
 include/configs/imx8qm_rom7720.h          |  3 ---
 include/configs/imx8qxp_mek.h             |  2 --
 include/configs/imxrt1020-evk.h           |  2 --
 include/configs/imxrt1050-evk.h           |  2 --
 include/configs/j721e_evm.h               |  4 ----
 include/configs/jetson-tk1.h              |  2 --
 include/configs/kp_imx53.h                |  1 -
 include/configs/kp_imx6q_tpc.h            |  2 --
 include/configs/kylin_rk3036.h            |  2 --
 include/configs/lion_rk3368.h             |  1 -
 include/configs/liteboard.h               |  2 --
 include/configs/ls1021aiot.h              |  4 ----
 include/configs/ls1021aqds.h              |  4 ----
 include/configs/ls1021atsn.h              |  4 ----
 include/configs/ls1021atwr.h              |  4 ----
 include/configs/ls1028a_common.h          |  1 -
 include/configs/ls1043aqds.h              |  9 ---------
 include/configs/ls1043ardb.h              |  9 ---------
 include/configs/ls1046afrwy.h             |  1 -
 include/configs/ls1046aqds.h              |  1 -
 include/configs/ls1046ardb.h              |  1 -
 include/configs/ls1088aqds.h              |  7 -------
 include/configs/ls1088ardb.h              |  2 --
 include/configs/ls2080aqds.h              |  6 ------
 include/configs/ls2080ardb.h              |  3 ---
 include/configs/lx2160a_common.h          |  2 --
 include/configs/meerkat96.h               |  2 --
 include/configs/meson64_android.h         |  3 ---
 include/configs/miqi_rk3288.h             |  2 --
 include/configs/mt7622.h                  |  2 --
 include/configs/mt7623.h                  |  2 --
 include/configs/mt8512.h                  |  1 -
 include/configs/mt8518.h                  |  1 -
 include/configs/mvebu_armada-8k.h         |  1 -
 include/configs/mx23_olinuxino.h          |  3 ---
 include/configs/mx23evk.h                 |  3 ---
 include/configs/mx25pdk.h                 |  1 -
 include/configs/mx28evk.h                 |  3 ---
 include/configs/mx51evk.h                 |  1 -
 include/configs/mx53ard.h                 |  1 -
 include/configs/mx53cx9020.h              |  1 -
 include/configs/mx53evk.h                 |  1 -
 include/configs/mx53loco.h                |  1 -
 include/configs/mx53ppd.h                 |  1 -
 include/configs/mx53smd.h                 |  1 -
 include/configs/mx6cuboxi.h               |  1 -
 include/configs/mx6qarm2.h                |  1 -
 include/configs/mx6sabreauto.h            |  3 ---
 include/configs/mx6sabresd.h              |  3 ---
 include/configs/mx6slevk.h                |  3 ---
 include/configs/mx6sllevk.h               |  2 --
 include/configs/mx6sxsabreauto.h          |  3 ---
 include/configs/mx6sxsabresd.h            |  3 ---
 include/configs/mx6ul_14x14_evk.h         |  2 --
 include/configs/mx6ullevk.h               |  2 --
 include/configs/mx7dsabresd.h             |  3 ---
 include/configs/mx7ulp_com.h              |  1 -
 include/configs/mx7ulp_evk.h              |  2 --
 include/configs/nitrogen6x.h              |  4 ----
 include/configs/novena.h                  |  3 ---
 include/configs/nyan-big.h                |  2 --
 include/configs/odroid.h                  |  1 -
 include/configs/odroid_go2.h              |  2 --
 include/configs/omap4_sdp4430.h           |  1 -
 include/configs/omap5_uevm.h              |  1 -
 include/configs/opos6uldev.h              |  2 --
 include/configs/origen.h                  |  1 -
 include/configs/p1_p2_rdb_pc.h            |  1 -
 include/configs/p2371-0000.h              |  2 --
 include/configs/p2371-2180.h              |  2 --
 include/configs/p2571.h                   |  2 --
 include/configs/p2771-0000.h              |  2 --
 include/configs/paz00.h                   |  2 --
 include/configs/pcl063_ull.h              |  2 --
 include/configs/pcm052.h                  |  3 ---
 include/configs/phycore_am335x_r2.h       |  1 -
 include/configs/phycore_rk3288.h          |  2 --
 include/configs/pico-imx6.h               |  1 -
 include/configs/pico-imx6ul.h             |  4 ----
 include/configs/pico-imx7d.h              |  3 ---
 include/configs/pico-imx8mq.h             |  1 -
 include/configs/platinum.h                |  1 -
 include/configs/poplar.h                  |  3 ---
 include/configs/popmetal_rk3288.h         |  2 --
 include/configs/puma_rk3399.h             |  4 ----
 include/configs/rock.h                    |  2 --
 include/configs/rock2.h                   |  2 --
 include/configs/rock960_rk3399.h          |  2 --
 include/configs/s32v234evb.h              |  2 --
 include/configs/s5p_goni.h                |  1 -
 include/configs/s5pc210_universal.h       |  2 --
 include/configs/salvator-x.h              |  2 --
 include/configs/sc_sps_1.h                |  3 ---
 include/configs/seaboard.h                |  2 --
 include/configs/secomx6quq7.h             |  1 -
 include/configs/sheep_rk3368.h            |  1 -
 include/configs/sksimx6.h                 |  1 -
 include/configs/smdkv310.h                |  1 -
 include/configs/socfpga_common.h          |  3 ---
 include/configs/socfpga_soc64_common.h    |  1 -
 include/configs/somlabs_visionsom_6ull.h  |  2 --
 include/configs/sunxi-common.h            |  2 --
 include/configs/tbs2910.h                 |  2 --
 include/configs/tec-ng.h                  |  2 --
 include/configs/tinker_rk3288.h           |  2 --
 include/configs/titanium.h                |  1 -
 include/configs/tqma6.h                   |  2 --
 include/configs/trats.h                   |  2 --
 include/configs/trats2.h                  |  2 --
 include/configs/ts4600.h                  |  3 ---
 include/configs/ts4800.h                  |  2 --
 include/configs/udoo.h                    |  2 --
 include/configs/udoo_neo.h                |  1 -
 include/configs/ulcb.h                    |  2 --
 include/configs/uniphier.h                |  3 ---
 include/configs/usbarmory.h               |  1 -
 include/configs/venice2.h                 |  2 --
 include/configs/ventana.h                 |  2 --
 include/configs/verdin-imx8mm.h           |  2 --
 include/configs/vf610twr.h                |  4 ----
 include/configs/vining_2000.h             |  2 --
 include/configs/vyasa-rk3288.h            |  2 --
 include/configs/wandboard.h               |  2 --
 include/configs/warp.h                    |  2 --
 include/configs/warp7.h                   |  3 ---
 include/configs/xpress.h                  |  2 --
 scripts/config_whitelist.txt              |  2 --
 308 files changed, 132 insertions(+), 448 deletions(-)

Comments

Rasmus Villemoes Aug. 5, 2020, 8:47 a.m. UTC | #1
On 24/07/2020 23.14, Tom Rini wrote:
> This converts the following to Kconfig:
>    CONFIG_SYS_MMC_ENV_DEV
>    CONFIG_SYS_MMC_ENV_PART

Yes, please! That's the only thing preventing us from running a vanilla
upstream U-Boot on a number of our boards where we have the defconfig
out of tree - we currently have a single patch touching a few config
headers.

> Cc: Priyanka Jain <priyanka.jain@nxp.com>
> Cc: Madalin Bucur <madalin.bucur@oss.nxp.com>
> Signed-off-by: Tom Rini <trini@konsulko.com>
> ---
> Due to some non-environment usage of the variables, cc'ing a few folks.

Yes, and those are the reason I didn't already send a patch.

> diff --git a/env/Kconfig b/env/Kconfig
> index 38e7fadbb93a..2eb2fe48da3d 100644
> --- a/env/Kconfig
> +++ b/env/Kconfig
> @@ -567,6 +567,25 @@ config SYS_RELOC_GD_ENV_ADDR
>  	  Relocate the early env_addr pointer so we know it is not inside
>  	  the binary. Some systems need this and for the rest, it doesn't hurt.
>  
> +config SYS_MMC_ENV_DEV
> +	int "mmc device number"
> +	depends on ENV_IS_IN_MMC || ENV_IS_IN_FAT || SYS_LS_PPA_FW_IN_MMC || \
> +		CMD_MVEBU_BUBT || FMAN_ENET || QE

Slight yuck. But I suppose that those (ab)uses of CONFIG_SYS_MMC_ENV_DEV
can grow their own proper config symbols piecemeal and then get removed
from that list, rather than having to wean off all of them before
SYS_MMC_ENV_* can get converted.

Why is ENV_IS_IN_FAT in that list? That has its own already-existing
ENV_FAT_DEVICE_AND_PART.

And a more general question: What does the SYS_ prefix mean? Some config
symbols have it, but I can't find any pattern to it. (I don't mean it
should be changed with this patch, but I'm curious if there is any
tribal knowledge here that I should be aware of.)

Rasmus
Stefan Roese Aug. 5, 2020, 9:07 a.m. UTC | #2
Hi Rasmus,

On 05.08.20 10:47, Rasmus Villemoes wrote:
> On 24/07/2020 23.14, Tom Rini wrote:
>> This converts the following to Kconfig:
>>     CONFIG_SYS_MMC_ENV_DEV
>>     CONFIG_SYS_MMC_ENV_PART
> 
> Yes, please! That's the only thing preventing us from running a vanilla
> upstream U-Boot on a number of our boards where we have the defconfig
> out of tree - we currently have a single patch touching a few config
> headers.
> 
>> Cc: Priyanka Jain <priyanka.jain@nxp.com>
>> Cc: Madalin Bucur <madalin.bucur@oss.nxp.com>
>> Signed-off-by: Tom Rini <trini@konsulko.com>
>> ---
>> Due to some non-environment usage of the variables, cc'ing a few folks.
> 
> Yes, and those are the reason I didn't already send a patch.
> 
>> diff --git a/env/Kconfig b/env/Kconfig
>> index 38e7fadbb93a..2eb2fe48da3d 100644
>> --- a/env/Kconfig
>> +++ b/env/Kconfig
>> @@ -567,6 +567,25 @@ config SYS_RELOC_GD_ENV_ADDR
>>   	  Relocate the early env_addr pointer so we know it is not inside
>>   	  the binary. Some systems need this and for the rest, it doesn't hurt.
>>   
>> +config SYS_MMC_ENV_DEV
>> +	int "mmc device number"
>> +	depends on ENV_IS_IN_MMC || ENV_IS_IN_FAT || SYS_LS_PPA_FW_IN_MMC || \
>> +		CMD_MVEBU_BUBT || FMAN_ENET || QE
> 
> Slight yuck. But I suppose that those (ab)uses of CONFIG_SYS_MMC_ENV_DEV
> can grow their own proper config symbols piecemeal and then get removed
> from that list, rather than having to wean off all of them before
> SYS_MMC_ENV_* can get converted.
> 
> Why is ENV_IS_IN_FAT in that list? That has its own already-existing
> ENV_FAT_DEVICE_AND_PART.
> 
> And a more general question: What does the SYS_ prefix mean? Some config
> symbols have it, but I can't find any pattern to it. (I don't mean it
> should be changed with this patch, but I'm curious if there is any
> tribal knowledge here that I should be aware of.)

The SYS_ prefix dates back quite some time, most likely nearly to the
beginning of U-Boot or more precise PPCBoot then. Here an extract
from the README:

* Configuration _OPTIONS_:
   These are selectable by the user and have names beginning with
   "CONFIG_".

* Configuration _SETTINGS_:
   These depend on the hardware etc. and should not be meddled with if
   you don't know what you're doing; they have names beginning with
   "CONFIG_SYS_".

Its most likely outdated by now, as this naming convention has not
been followed in the last years, AFAICT.

Thanks,
Stefan
Tom Rini Aug. 5, 2020, 12:51 p.m. UTC | #3
On Wed, Aug 05, 2020 at 11:07:15AM +0200, Stefan Roese wrote:
> Hi Rasmus,
> 
> On 05.08.20 10:47, Rasmus Villemoes wrote:
> > On 24/07/2020 23.14, Tom Rini wrote:
> > > This converts the following to Kconfig:
> > >     CONFIG_SYS_MMC_ENV_DEV
> > >     CONFIG_SYS_MMC_ENV_PART
> > 
> > Yes, please! That's the only thing preventing us from running a vanilla
> > upstream U-Boot on a number of our boards where we have the defconfig
> > out of tree - we currently have a single patch touching a few config
> > headers.
> > 
> > > Cc: Priyanka Jain <priyanka.jain@nxp.com>
> > > Cc: Madalin Bucur <madalin.bucur@oss.nxp.com>
> > > Signed-off-by: Tom Rini <trini@konsulko.com>
> > > ---
> > > Due to some non-environment usage of the variables, cc'ing a few folks.
> > 
> > Yes, and those are the reason I didn't already send a patch.
> > 
> > > diff --git a/env/Kconfig b/env/Kconfig
> > > index 38e7fadbb93a..2eb2fe48da3d 100644
> > > --- a/env/Kconfig
> > > +++ b/env/Kconfig
> > > @@ -567,6 +567,25 @@ config SYS_RELOC_GD_ENV_ADDR
> > >   	  Relocate the early env_addr pointer so we know it is not inside
> > >   	  the binary. Some systems need this and for the rest, it doesn't hurt.
> > > +config SYS_MMC_ENV_DEV
> > > +	int "mmc device number"
> > > +	depends on ENV_IS_IN_MMC || ENV_IS_IN_FAT || SYS_LS_PPA_FW_IN_MMC || \
> > > +		CMD_MVEBU_BUBT || FMAN_ENET || QE
> > 
> > Slight yuck. But I suppose that those (ab)uses of CONFIG_SYS_MMC_ENV_DEV
> > can grow their own proper config symbols piecemeal and then get removed
> > from that list, rather than having to wean off all of them before
> > SYS_MMC_ENV_* can get converted.
> > 
> > Why is ENV_IS_IN_FAT in that list? That has its own already-existing
> > ENV_FAT_DEVICE_AND_PART.

ENV_IS_IN_FAT is in the list because with 6731bef6966e ("env/fat.c:
allow loading from a FAT partition on the MMC boot device") we can pick
up the device dynamically and hard-code the partition.  But that in turn
means needing a default device.  This even gets expanded to cover ext4
here:
http://patchwork.ozlabs.org/project/uboot/patch/20200804090547.2175076-2-dwmw2@infradead.org/

> > And a more general question: What does the SYS_ prefix mean? Some config
> > symbols have it, but I can't find any pattern to it. (I don't mean it
> > should be changed with this patch, but I'm curious if there is any
> > tribal knowledge here that I should be aware of.)
> 
> The SYS_ prefix dates back quite some time, most likely nearly to the
> beginning of U-Boot or more precise PPCBoot then. Here an extract
> from the README:
> 
> * Configuration _OPTIONS_:
>   These are selectable by the user and have names beginning with
>   "CONFIG_".
> 
> * Configuration _SETTINGS_:
>   These depend on the hardware etc. and should not be meddled with if
>   you don't know what you're doing; they have names beginning with
>   "CONFIG_SYS_".
> 
> Its most likely outdated by now, as this naming convention has not
> been followed in the last years, AFAICT.

Thanks for explaining.
David Woodhouse Aug. 5, 2020, 1:04 p.m. UTC | #4
On 5 August 2020 13:51:43 BST, Tom Rini <trini@konsulko.com> wrote:
>On Wed, Aug 05, 2020 at 11:07:15AM +0200, Stefan Roese wrote:
>> Hi Rasmus,
>> 
>> On 05.08.20 10:47, Rasmus Villemoes wrote:
>> > On 24/07/2020 23.14, Tom Rini wrote:
>> > > This converts the following to Kconfig:
>> > >     CONFIG_SYS_MMC_ENV_DEV
>> > >     CONFIG_SYS_MMC_ENV_PART
>> > 
>> > Yes, please! That's the only thing preventing us from running a
>vanilla
>> > upstream U-Boot on a number of our boards where we have the
>defconfig
>> > out of tree - we currently have a single patch touching a few
>config
>> > headers.
>> > 
>> > > Cc: Priyanka Jain <priyanka.jain@nxp.com>
>> > > Cc: Madalin Bucur <madalin.bucur@oss.nxp.com>
>> > > Signed-off-by: Tom Rini <trini@konsulko.com>
>> > > ---
>> > > Due to some non-environment usage of the variables, cc'ing a few
>folks.
>> > 
>> > Yes, and those are the reason I didn't already send a patch.
>> > 
>> > > diff --git a/env/Kconfig b/env/Kconfig
>> > > index 38e7fadbb93a..2eb2fe48da3d 100644
>> > > --- a/env/Kconfig
>> > > +++ b/env/Kconfig
>> > > @@ -567,6 +567,25 @@ config SYS_RELOC_GD_ENV_ADDR
>> > >   	  Relocate the early env_addr pointer so we know it is not
>inside
>> > >   	  the binary. Some systems need this and for the rest, it
>doesn't hurt.
>> > > +config SYS_MMC_ENV_DEV
>> > > +	int "mmc device number"
>> > > +	depends on ENV_IS_IN_MMC || ENV_IS_IN_FAT ||
>SYS_LS_PPA_FW_IN_MMC || \
>> > > +		CMD_MVEBU_BUBT || FMAN_ENET || QE
>> > 
>> > Slight yuck. But I suppose that those (ab)uses of
>CONFIG_SYS_MMC_ENV_DEV
>> > can grow their own proper config symbols piecemeal and then get
>removed
>> > from that list, rather than having to wean off all of them before
>> > SYS_MMC_ENV_* can get converted.
>> > 
>> > Why is ENV_IS_IN_FAT in that list? That has its own
>already-existing
>> > ENV_FAT_DEVICE_AND_PART.
>
>ENV_IS_IN_FAT is in the list because with 6731bef6966e ("env/fat.c:
>allow loading from a FAT partition on the MMC boot device") we can pick
>up the device dynamically and hard-code the partition.  But that in
>turn
>means needing a default device.  This even gets expanded to cover ext4
>here:
>http://patchwork.ozlabs.org/project/uboot/patch/20200804090547.2175076-2-dwmw2@infradead.org/


FAT and ext4 don't need to grow their own config symbols because they already *have* them. The only reason they're involved here is because of the case where they explicitly want to *abdicate* responsibility and let platform code determine the device to use, not hard-coded config. Like the MT7623 platforms where the preloader tells U-Boot if it was actually loaded from the internal eMMC or external SD card.

If someone is setting up the ENV_FAT_DEVICE_AND_PART to start with a colon and thus abdicate the device part, but then that decision is only coming from a hard-coded SYS_MMC_ENV_DEV option, then they're probably somewhat confused.
Tom Rini Aug. 5, 2020, 1:14 p.m. UTC | #5
On Wed, Aug 05, 2020 at 02:04:02PM +0100, David Woodhouse wrote:
> 
> 
> On 5 August 2020 13:51:43 BST, Tom Rini <trini@konsulko.com> wrote:
> >On Wed, Aug 05, 2020 at 11:07:15AM +0200, Stefan Roese wrote:
> >> Hi Rasmus,
> >> 
> >> On 05.08.20 10:47, Rasmus Villemoes wrote:
> >> > On 24/07/2020 23.14, Tom Rini wrote:
> >> > > This converts the following to Kconfig:
> >> > >     CONFIG_SYS_MMC_ENV_DEV
> >> > >     CONFIG_SYS_MMC_ENV_PART
> >> > 
> >> > Yes, please! That's the only thing preventing us from running a
> >vanilla
> >> > upstream U-Boot on a number of our boards where we have the
> >defconfig
> >> > out of tree - we currently have a single patch touching a few
> >config
> >> > headers.
> >> > 
> >> > > Cc: Priyanka Jain <priyanka.jain@nxp.com>
> >> > > Cc: Madalin Bucur <madalin.bucur@oss.nxp.com>
> >> > > Signed-off-by: Tom Rini <trini@konsulko.com>
> >> > > ---
> >> > > Due to some non-environment usage of the variables, cc'ing a few
> >folks.
> >> > 
> >> > Yes, and those are the reason I didn't already send a patch.
> >> > 
> >> > > diff --git a/env/Kconfig b/env/Kconfig
> >> > > index 38e7fadbb93a..2eb2fe48da3d 100644
> >> > > --- a/env/Kconfig
> >> > > +++ b/env/Kconfig
> >> > > @@ -567,6 +567,25 @@ config SYS_RELOC_GD_ENV_ADDR
> >> > >   	  Relocate the early env_addr pointer so we know it is not
> >inside
> >> > >   	  the binary. Some systems need this and for the rest, it
> >doesn't hurt.
> >> > > +config SYS_MMC_ENV_DEV
> >> > > +	int "mmc device number"
> >> > > +	depends on ENV_IS_IN_MMC || ENV_IS_IN_FAT ||
> >SYS_LS_PPA_FW_IN_MMC || \
> >> > > +		CMD_MVEBU_BUBT || FMAN_ENET || QE
> >> > 
> >> > Slight yuck. But I suppose that those (ab)uses of
> >CONFIG_SYS_MMC_ENV_DEV
> >> > can grow their own proper config symbols piecemeal and then get
> >removed
> >> > from that list, rather than having to wean off all of them before
> >> > SYS_MMC_ENV_* can get converted.
> >> > 
> >> > Why is ENV_IS_IN_FAT in that list? That has its own
> >already-existing
> >> > ENV_FAT_DEVICE_AND_PART.
> >
> >ENV_IS_IN_FAT is in the list because with 6731bef6966e ("env/fat.c:
> >allow loading from a FAT partition on the MMC boot device") we can pick
> >up the device dynamically and hard-code the partition.  But that in
> >turn
> >means needing a default device.  This even gets expanded to cover ext4
> >here:
> >http://patchwork.ozlabs.org/project/uboot/patch/20200804090547.2175076-2-dwmw2@infradead.org/
> 
> 
> FAT and ext4 don't need to grow their own config symbols because they already *have* them. The only reason they're involved here is because of the case where they explicitly want to *abdicate* responsibility and let platform code determine the device to use, not hard-coded config. Like the MT7623 platforms where the preloader tells U-Boot if it was actually loaded from the internal eMMC or external SD card.
> 
> If someone is setting up the ENV_FAT_DEVICE_AND_PART to start with a colon and thus abdicate the device part, but then that decision is only coming from a hard-coded SYS_MMC_ENV_DEV option, then they're probably somewhat confused.

Right, but the default mmc_get_env_dev() you added uses
CONFIG_SYS_MMC_ENV_DEV.
David Woodhouse Aug. 5, 2020, 1:18 p.m. UTC | #6
On 5 August 2020 14:14:58 BST, Tom Rini <trini@konsulko.com> wrote:
>On Wed, Aug 05, 2020 at 02:04:02PM +0100, David Woodhouse wrote:
>> 
>> 
>> On 5 August 2020 13:51:43 BST, Tom Rini <trini@konsulko.com> wrote:
>> >On Wed, Aug 05, 2020 at 11:07:15AM +0200, Stefan Roese wrote:
>> >> Hi Rasmus,
>> >> 
>> >> On 05.08.20 10:47, Rasmus Villemoes wrote:
>> >> > On 24/07/2020 23.14, Tom Rini wrote:
>> >> > > This converts the following to Kconfig:
>> >> > >     CONFIG_SYS_MMC_ENV_DEV
>> >> > >     CONFIG_SYS_MMC_ENV_PART
>> >> > 
>> >> > Yes, please! That's the only thing preventing us from running a
>> >vanilla
>> >> > upstream U-Boot on a number of our boards where we have the
>> >defconfig
>> >> > out of tree - we currently have a single patch touching a few
>> >config
>> >> > headers.
>> >> > 
>> >> > > Cc: Priyanka Jain <priyanka.jain@nxp.com>
>> >> > > Cc: Madalin Bucur <madalin.bucur@oss.nxp.com>
>> >> > > Signed-off-by: Tom Rini <trini@konsulko.com>
>> >> > > ---
>> >> > > Due to some non-environment usage of the variables, cc'ing a
>few
>> >folks.
>> >> > 
>> >> > Yes, and those are the reason I didn't already send a patch.
>> >> > 
>> >> > > diff --git a/env/Kconfig b/env/Kconfig
>> >> > > index 38e7fadbb93a..2eb2fe48da3d 100644
>> >> > > --- a/env/Kconfig
>> >> > > +++ b/env/Kconfig
>> >> > > @@ -567,6 +567,25 @@ config SYS_RELOC_GD_ENV_ADDR
>> >> > >   	  Relocate the early env_addr pointer so we know it is not
>> >inside
>> >> > >   	  the binary. Some systems need this and for the rest, it
>> >doesn't hurt.
>> >> > > +config SYS_MMC_ENV_DEV
>> >> > > +	int "mmc device number"
>> >> > > +	depends on ENV_IS_IN_MMC || ENV_IS_IN_FAT ||
>> >SYS_LS_PPA_FW_IN_MMC || \
>> >> > > +		CMD_MVEBU_BUBT || FMAN_ENET || QE
>> >> > 
>> >> > Slight yuck. But I suppose that those (ab)uses of
>> >CONFIG_SYS_MMC_ENV_DEV
>> >> > can grow their own proper config symbols piecemeal and then get
>> >removed
>> >> > from that list, rather than having to wean off all of them
>before
>> >> > SYS_MMC_ENV_* can get converted.
>> >> > 
>> >> > Why is ENV_IS_IN_FAT in that list? That has its own
>> >already-existing
>> >> > ENV_FAT_DEVICE_AND_PART.
>> >
>> >ENV_IS_IN_FAT is in the list because with 6731bef6966e ("env/fat.c:
>> >allow loading from a FAT partition on the MMC boot device") we can
>pick
>> >up the device dynamically and hard-code the partition.  But that in
>> >turn
>> >means needing a default device.  This even gets expanded to cover
>ext4
>> >here:
>>
>>http://patchwork.ozlabs.org/project/uboot/patch/20200804090547.2175076-2-dwmw2@infradead.org/
>> 
>> 
>> FAT and ext4 don't need to grow their own config symbols because they
>already *have* them. The only reason they're involved here is because
>of the case where they explicitly want to *abdicate* responsibility and
>let platform code determine the device to use, not hard-coded config.
>Like the MT7623 platforms where the preloader tells U-Boot if it was
>actually loaded from the internal eMMC or external SD card.
>> 
>> If someone is setting up the ENV_FAT_DEVICE_AND_PART to start with a
>colon and thus abdicate the device part, but then that decision is only
>coming from a hard-coded SYS_MMC_ENV_DEV option, then they're probably
>somewhat confused.
>
>Right, but the default mmc_get_env_dev() you added uses
>CONFIG_SYS_MMC_ENV_DEV.

Sure. But any time that default actually gets invoked, the config is entirely pointless and meets that "probably somewhat confused" definition above.
David Woodhouse Aug. 5, 2020, 1:22 p.m. UTC | #7
On 5 August 2020 14:14:58 BST, Tom Rini <trini@konsulko.com> wrote:
>On Wed, Aug 05, 2020 at 02:04:02PM +0100, David Woodhouse wrote:
>> 
>> 
>> On 5 August 2020 13:51:43 BST, Tom Rini <trini@konsulko.com> wrote:
>> >On Wed, Aug 05, 2020 at 11:07:15AM +0200, Stefan Roese wrote:
>> >> Hi Rasmus,
>> >> 
>> >> On 05.08.20 10:47, Rasmus Villemoes wrote:
>> >> > On 24/07/2020 23.14, Tom Rini wrote:
>> >> > > This converts the following to Kconfig:
>> >> > >     CONFIG_SYS_MMC_ENV_DEV
>> >> > >     CONFIG_SYS_MMC_ENV_PART
>> >> > 
>> >> > Yes, please! That's the only thing preventing us from running a
>> >vanilla
>> >> > upstream U-Boot on a number of our boards where we have the
>> >defconfig
>> >> > out of tree - we currently have a single patch touching a few
>> >config
>> >> > headers.
>> >> > 
>> >> > > Cc: Priyanka Jain <priyanka.jain@nxp.com>
>> >> > > Cc: Madalin Bucur <madalin.bucur@oss.nxp.com>
>> >> > > Signed-off-by: Tom Rini <trini@konsulko.com>
>> >> > > ---
>> >> > > Due to some non-environment usage of the variables, cc'ing a
>few
>> >folks.
>> >> > 
>> >> > Yes, and those are the reason I didn't already send a patch.
>> >> > 
>> >> > > diff --git a/env/Kconfig b/env/Kconfig
>> >> > > index 38e7fadbb93a..2eb2fe48da3d 100644
>> >> > > --- a/env/Kconfig
>> >> > > +++ b/env/Kconfig
>> >> > > @@ -567,6 +567,25 @@ config SYS_RELOC_GD_ENV_ADDR
>> >> > >   	  Relocate the early env_addr pointer so we know it is not
>> >inside
>> >> > >   	  the binary. Some systems need this and for the rest, it
>> >doesn't hurt.
>> >> > > +config SYS_MMC_ENV_DEV
>> >> > > +	int "mmc device number"
>> >> > > +	depends on ENV_IS_IN_MMC || ENV_IS_IN_FAT ||
>> >SYS_LS_PPA_FW_IN_MMC || \
>> >> > > +		CMD_MVEBU_BUBT || FMAN_ENET || QE
>> >> > 
>> >> > Slight yuck. But I suppose that those (ab)uses of
>> >CONFIG_SYS_MMC_ENV_DEV
>> >> > can grow their own proper config symbols piecemeal and then get
>> >removed
>> >> > from that list, rather than having to wean off all of them
>before
>> >> > SYS_MMC_ENV_* can get converted.
>> >> > 
>> >> > Why is ENV_IS_IN_FAT in that list? That has its own
>> >already-existing
>> >> > ENV_FAT_DEVICE_AND_PART.
>> >
>> >ENV_IS_IN_FAT is in the list because with 6731bef6966e ("env/fat.c:
>> >allow loading from a FAT partition on the MMC boot device") we can
>pick
>> >up the device dynamically and hard-code the partition.  But that in
>> >turn
>> >means needing a default device.  This even gets expanded to cover
>ext4
>> >here:
>>
>>http://patchwork.ozlabs.org/project/uboot/patch/20200804090547.2175076-2-dwmw2@infradead.org/
>> 
>> 
>> FAT and ext4 don't need to grow their own config symbols because they
>already *have* them. The only reason they're involved here is because
>of the case where they explicitly want to *abdicate* responsibility and
>let platform code determine the device to use, not hard-coded config.
>Like the MT7623 platforms where the preloader tells U-Boot if it was
>actually loaded from the internal eMMC or external SD card.
>> 
>> If someone is setting up the ENV_FAT_DEVICE_AND_PART to start with a
>colon and thus abdicate the device part, but then that decision is only
>coming from a hard-coded SYS_MMC_ENV_DEV option, then they're probably
>somewhat confused.
>
>Right, but the default mmc_get_env_dev() you added uses
>CONFIG_SYS_MMC_ENV_DEV.

Perhaps I could revamp the FAT/ext4 patches so that they don't use the default weak function, and if you use the "get it at runtime" behaviour on any build which doesn't actually have a real platform mmc_get_env_dev() function, the build fails.  That would be sane, but might involve a separate explicit config option instead of just "the DEVICE_AND_PART option starts with a colon".
Tom Rini Aug. 5, 2020, 2:52 p.m. UTC | #8
On Wed, Aug 05, 2020 at 02:22:35PM +0100, David Woodhouse wrote:

> On 5 August 2020 14:14:58 BST, Tom Rini <trini@konsulko.com> wrote:
> >On Wed, Aug 05, 2020 at 02:04:02PM +0100, David Woodhouse wrote:
> >> 
> >> 
> >> On 5 August 2020 13:51:43 BST, Tom Rini <trini@konsulko.com> wrote:
> >> >On Wed, Aug 05, 2020 at 11:07:15AM +0200, Stefan Roese wrote:
> >> >> Hi Rasmus,
> >> >> 
> >> >> On 05.08.20 10:47, Rasmus Villemoes wrote:
> >> >> > On 24/07/2020 23.14, Tom Rini wrote:
> >> >> > > This converts the following to Kconfig:
> >> >> > >     CONFIG_SYS_MMC_ENV_DEV
> >> >> > >     CONFIG_SYS_MMC_ENV_PART
> >> >> > 
> >> >> > Yes, please! That's the only thing preventing us from running a
> >> >vanilla
> >> >> > upstream U-Boot on a number of our boards where we have the
> >> >defconfig
> >> >> > out of tree - we currently have a single patch touching a few
> >> >config
> >> >> > headers.
> >> >> > 
> >> >> > > Cc: Priyanka Jain <priyanka.jain@nxp.com>
> >> >> > > Cc: Madalin Bucur <madalin.bucur@oss.nxp.com>
> >> >> > > Signed-off-by: Tom Rini <trini@konsulko.com>
> >> >> > > ---
> >> >> > > Due to some non-environment usage of the variables, cc'ing a
> >few
> >> >folks.
> >> >> > 
> >> >> > Yes, and those are the reason I didn't already send a patch.
> >> >> > 
> >> >> > > diff --git a/env/Kconfig b/env/Kconfig
> >> >> > > index 38e7fadbb93a..2eb2fe48da3d 100644
> >> >> > > --- a/env/Kconfig
> >> >> > > +++ b/env/Kconfig
> >> >> > > @@ -567,6 +567,25 @@ config SYS_RELOC_GD_ENV_ADDR
> >> >> > >   	  Relocate the early env_addr pointer so we know it is not
> >> >inside
> >> >> > >   	  the binary. Some systems need this and for the rest, it
> >> >doesn't hurt.
> >> >> > > +config SYS_MMC_ENV_DEV
> >> >> > > +	int "mmc device number"
> >> >> > > +	depends on ENV_IS_IN_MMC || ENV_IS_IN_FAT ||
> >> >SYS_LS_PPA_FW_IN_MMC || \
> >> >> > > +		CMD_MVEBU_BUBT || FMAN_ENET || QE
> >> >> > 
> >> >> > Slight yuck. But I suppose that those (ab)uses of
> >> >CONFIG_SYS_MMC_ENV_DEV
> >> >> > can grow their own proper config symbols piecemeal and then get
> >> >removed
> >> >> > from that list, rather than having to wean off all of them
> >before
> >> >> > SYS_MMC_ENV_* can get converted.
> >> >> > 
> >> >> > Why is ENV_IS_IN_FAT in that list? That has its own
> >> >already-existing
> >> >> > ENV_FAT_DEVICE_AND_PART.
> >> >
> >> >ENV_IS_IN_FAT is in the list because with 6731bef6966e ("env/fat.c:
> >> >allow loading from a FAT partition on the MMC boot device") we can
> >pick
> >> >up the device dynamically and hard-code the partition.  But that in
> >> >turn
> >> >means needing a default device.  This even gets expanded to cover
> >ext4
> >> >here:
> >>
> >>http://patchwork.ozlabs.org/project/uboot/patch/20200804090547.2175076-2-dwmw2@infradead.org/
> >> 
> >> 
> >> FAT and ext4 don't need to grow their own config symbols because they
> >already *have* them. The only reason they're involved here is because
> >of the case where they explicitly want to *abdicate* responsibility and
> >let platform code determine the device to use, not hard-coded config.
> >Like the MT7623 platforms where the preloader tells U-Boot if it was
> >actually loaded from the internal eMMC or external SD card.
> >> 
> >> If someone is setting up the ENV_FAT_DEVICE_AND_PART to start with a
> >colon and thus abdicate the device part, but then that decision is only
> >coming from a hard-coded SYS_MMC_ENV_DEV option, then they're probably
> >somewhat confused.
> >
> >Right, but the default mmc_get_env_dev() you added uses
> >CONFIG_SYS_MMC_ENV_DEV.
> 
> Perhaps I could revamp the FAT/ext4 patches so that they don't use the default weak function, and if you use the "get it at runtime" behaviour on any build which doesn't actually have a real platform mmc_get_env_dev() function, the build fails.  That would be sane, but might involve a separate explicit config option instead of just "the DEVICE_AND_PART option starts with a colon".

That sounds like a good idea, thanks!
Tom Rini Aug. 8, 2020, 10:22 p.m. UTC | #9
On Fri, Jul 24, 2020 at 05:14:47PM -0400, Tom Rini wrote:

> This converts the following to Kconfig:
>    CONFIG_SYS_MMC_ENV_DEV
>    CONFIG_SYS_MMC_ENV_PART
> 
> Cc: Priyanka Jain <priyanka.jain@nxp.com>
> Cc: Madalin Bucur <madalin.bucur@oss.nxp.com>
> Signed-off-by: Tom Rini <trini@konsulko.com>

Applied to u-boot/master, thanks!
David Woodhouse Aug. 14, 2020, 2:02 p.m. UTC | #10
On Wed, 2020-08-05 at 10:52 -0400, Tom Rini wrote:
> 
> > >> FAT and ext4 don't need to grow their own config symbols because they
> > >already *have* them. The only reason they're involved here is because
> > >of the case where they explicitly want to *abdicate* responsibility and
> > >let platform code determine the device to use, not hard-coded config.
> > >Like the MT7623 platforms where the preloader tells U-Boot if it was
> > >actually loaded from the internal eMMC or external SD card.
> > >> 
> > >> If someone is setting up the ENV_FAT_DEVICE_AND_PART to start with a
> > >colon and thus abdicate the device part, but then that decision is only
> > >coming from a hard-coded SYS_MMC_ENV_DEV option, then they're probably
> > >somewhat confused.
> > >
> > >Right, but the default mmc_get_env_dev() you added uses
> > >CONFIG_SYS_MMC_ENV_DEV.
> > 
> > Perhaps I could revamp the FAT/ext4 patches so that they don't use
> the default weak function, and if you use the "get it at runtime"
> behaviour on any build which doesn't actually have a real platform
> mmc_get_env_dev() function, the build fails.  That would be sane, but
> might involve a separate explicit config option instead of just "the
> DEVICE_AND_PART option starts with a colon".
> 
> That sounds like a good idea, thanks!


Hm. I took a quick look at this. Forgetting my ext4 patch for the
moment and looking just at what's in HEAD...

The initial naïve approach is to rip out the weak implementation of
mmc_get_env_dev() from env/fat.c and trust the compiler spot that this
is tautologically false because the strings are constants:

		part_str = CONFIG_ENV_FAT_DEVICE_AND_PART;
		if (!strcmp(CONFIG_ENV_FAT_INTERFACE, "mmc") &&
                    part_str[0] == ':') {

Sadly, GCC doesn't seem to be clever enough for that.

So the actual code for env_fat_device_and_part() would need some extra
compile-time conditional.

It would be possible to make platforms with their own 'real'
mmc_get_env_dev() function select a config symbol called something like
(imaginatively) PLATFORM_HAS_MMC_GET_ENV_DEV, and then the code in
env_fat_device_and_part() could be conditional on that as well as
CONFIG_MMC as it is at the moment.

On the whole though, it seems like overkill just to "forbid" a mildly
pointless combination of config options. And in fact, perhaps it isn't
even that pointless.

I wrote the "find environment FAT partition using mmc_get_env_dev()"
support for OpenWrt, specifically on the mt7623 platforms where it is
indeed a runtime choice. But it's actually quite sensible for OpenWrt
just to have a consistent partition layout across multiple devices, set
CONFIG_ENV_FAT_DEVICE_AND_PART to ":2" on *all* of those platforms, and
then *only* CONFIG_SYS_MMC_ENV_DEV needs to vary in a platform-specific 
manner.

I think the best option is probably to consolidate and move the weak
mmc_get_env_dev() into drivers/mmc/mmc.c and let env/{fat,ext4,mmc}.c
use it from there.

Yes, some people might be able to set CONFIG_ENV_FAT_DEVICE_AND_PART to
something starting with a colon, deferring the device number to a hard-
coded CONFIG_SYS_MMC_ENV_DEV — which at *runtime* is kind of redundant.
But that isn't actually all that insane anyway. We don't *need* to
forbid it.
Tom Rini Aug. 14, 2020, 7:52 p.m. UTC | #11
On Fri, Aug 14, 2020 at 03:02:25PM +0100, David Woodhouse wrote:
> On Wed, 2020-08-05 at 10:52 -0400, Tom Rini wrote:
> > 
> > > >> FAT and ext4 don't need to grow their own config symbols because they
> > > >already *have* them. The only reason they're involved here is because
> > > >of the case where they explicitly want to *abdicate* responsibility and
> > > >let platform code determine the device to use, not hard-coded config.
> > > >Like the MT7623 platforms where the preloader tells U-Boot if it was
> > > >actually loaded from the internal eMMC or external SD card.
> > > >> 
> > > >> If someone is setting up the ENV_FAT_DEVICE_AND_PART to start with a
> > > >colon and thus abdicate the device part, but then that decision is only
> > > >coming from a hard-coded SYS_MMC_ENV_DEV option, then they're probably
> > > >somewhat confused.
> > > >
> > > >Right, but the default mmc_get_env_dev() you added uses
> > > >CONFIG_SYS_MMC_ENV_DEV.
> > > 
> > > Perhaps I could revamp the FAT/ext4 patches so that they don't use
> > the default weak function, and if you use the "get it at runtime"
> > behaviour on any build which doesn't actually have a real platform
> > mmc_get_env_dev() function, the build fails.  That would be sane, but
> > might involve a separate explicit config option instead of just "the
> > DEVICE_AND_PART option starts with a colon".
> > 
> > That sounds like a good idea, thanks!
> 
> 
> Hm. I took a quick look at this. Forgetting my ext4 patch for the
> moment and looking just at what's in HEAD...
> 
> The initial naïve approach is to rip out the weak implementation of
> mmc_get_env_dev() from env/fat.c and trust the compiler spot that this
> is tautologically false because the strings are constants:
> 
> 		part_str = CONFIG_ENV_FAT_DEVICE_AND_PART;
> 		if (!strcmp(CONFIG_ENV_FAT_INTERFACE, "mmc") &&
>                     part_str[0] == ':') {
> 
> Sadly, GCC doesn't seem to be clever enough for that.
> 
> So the actual code for env_fat_device_and_part() would need some extra
> compile-time conditional.
> 
> It would be possible to make platforms with their own 'real'
> mmc_get_env_dev() function select a config symbol called something like
> (imaginatively) PLATFORM_HAS_MMC_GET_ENV_DEV, and then the code in
> env_fat_device_and_part() could be conditional on that as well as
> CONFIG_MMC as it is at the moment.
> 
> On the whole though, it seems like overkill just to "forbid" a mildly
> pointless combination of config options. And in fact, perhaps it isn't
> even that pointless.
> 
> I wrote the "find environment FAT partition using mmc_get_env_dev()"
> support for OpenWrt, specifically on the mt7623 platforms where it is
> indeed a runtime choice. But it's actually quite sensible for OpenWrt
> just to have a consistent partition layout across multiple devices, set
> CONFIG_ENV_FAT_DEVICE_AND_PART to ":2" on *all* of those platforms, and
> then *only* CONFIG_SYS_MMC_ENV_DEV needs to vary in a platform-specific 
> manner.
> 
> I think the best option is probably to consolidate and move the weak
> mmc_get_env_dev() into drivers/mmc/mmc.c and let env/{fat,ext4,mmc}.c
> use it from there.
> 
> Yes, some people might be able to set CONFIG_ENV_FAT_DEVICE_AND_PART to
> something starting with a colon, deferring the device number to a hard-
> coded CONFIG_SYS_MMC_ENV_DEV — which at *runtime* is kind of redundant.
> But that isn't actually all that insane anyway. We don't *need* to
> forbid it.

Sounds like a good plan to me!
diff mbox series

Patch

diff --git a/configs/am335x_boneblack_vboot_defconfig b/configs/am335x_boneblack_vboot_defconfig
index b161b3bbc3cf..6812d63ccc02 100644
--- a/configs/am335x_boneblack_vboot_defconfig
+++ b/configs/am335x_boneblack_vboot_defconfig
@@ -35,6 +35,7 @@  CONFIG_DEFAULT_DEVICE_TREE="am335x-boneblack"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=1
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 # CONFIG_SPL_BLK is not set
 CONFIG_BOOTCOUNT_LIMIT=y
diff --git a/configs/am335x_shc_defconfig b/configs/am335x_shc_defconfig
index 6401375250b7..deaaa3bd8b5b 100644
--- a/configs/am335x_shc_defconfig
+++ b/configs/am335x_shc_defconfig
@@ -47,6 +47,7 @@  CONFIG_DEFAULT_DEVICE_TREE="am335x-shc"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=1
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_DM_MMC=y
 CONFIG_MMC_OMAP_HS=y
diff --git a/configs/am335x_shc_ict_defconfig b/configs/am335x_shc_ict_defconfig
index fea34a34242f..39670f9c488b 100644
--- a/configs/am335x_shc_ict_defconfig
+++ b/configs/am335x_shc_ict_defconfig
@@ -48,6 +48,7 @@  CONFIG_DEFAULT_DEVICE_TREE="am335x-shc"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=1
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_DM_MMC=y
 CONFIG_MMC_OMAP_HS=y
diff --git a/configs/am335x_sl50_defconfig b/configs/am335x_sl50_defconfig
index 5ba7b917e96c..f894862a8b6d 100644
--- a/configs/am335x_sl50_defconfig
+++ b/configs/am335x_sl50_defconfig
@@ -45,6 +45,8 @@  CONFIG_DEFAULT_DEVICE_TREE="am335x-sl50"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=1
+CONFIG_SYS_MMC_ENV_PART=2
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_DM_MMC=y
diff --git a/configs/am57xx_evm_defconfig b/configs/am57xx_evm_defconfig
index dce50dc4be6c..05d77eae496f 100644
--- a/configs/am57xx_evm_defconfig
+++ b/configs/am57xx_evm_defconfig
@@ -52,6 +52,7 @@  CONFIG_OF_LIST="am57xx-beagle-x15 am57xx-beagle-x15-revb1 am57xx-beagle-x15-revc
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=1
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_DM=y
 CONFIG_SPL_DM=y
diff --git a/configs/am57xx_hs_evm_defconfig b/configs/am57xx_hs_evm_defconfig
index 081a48f03807..fe2a58d40c7f 100644
--- a/configs/am57xx_hs_evm_defconfig
+++ b/configs/am57xx_hs_evm_defconfig
@@ -53,6 +53,7 @@  CONFIG_OF_LIST="am57xx-beagle-x15 am57xx-beagle-x15-revb1 am57xx-beagle-x15-revc
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=1
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_DM=y
 CONFIG_SPL_DM=y
diff --git a/configs/am57xx_hs_evm_usb_defconfig b/configs/am57xx_hs_evm_usb_defconfig
index 2ecc990683e8..daf08d915f9b 100644
--- a/configs/am57xx_hs_evm_usb_defconfig
+++ b/configs/am57xx_hs_evm_usb_defconfig
@@ -59,6 +59,7 @@  CONFIG_OF_LIST="am57xx-beagle-x15 am57xx-beagle-x15-revb1 am57xx-beagle-x15-revc
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=1
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_DM=y
 CONFIG_SPL_DM=y
diff --git a/configs/am65x_evm_a53_defconfig b/configs/am65x_evm_a53_defconfig
index 918ff4de0c1f..8e0a49d4fefe 100644
--- a/configs/am65x_evm_a53_defconfig
+++ b/configs/am65x_evm_a53_defconfig
@@ -66,6 +66,7 @@  CONFIG_SPL_MULTI_DTB_FIT_NO_COMPRESSION=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_PART=1
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_DM=y
 CONFIG_SPL_DM=y
diff --git a/configs/am65x_hs_evm_a53_defconfig b/configs/am65x_hs_evm_a53_defconfig
index bc3da74509ea..87f28cc64d1d 100644
--- a/configs/am65x_hs_evm_a53_defconfig
+++ b/configs/am65x_hs_evm_a53_defconfig
@@ -69,6 +69,7 @@  CONFIG_SPL_MULTI_DTB_FIT_NO_COMPRESSION=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_PART=1
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_DM=y
 CONFIG_SPL_DM=y
diff --git a/configs/apalis-imx8qm_defconfig b/configs/apalis-imx8qm_defconfig
index 289d644edb03..606489d54006 100644
--- a/configs/apalis-imx8qm_defconfig
+++ b/configs/apalis-imx8qm_defconfig
@@ -33,6 +33,7 @@  CONFIG_CMD_EXT4_WRITE=y
 CONFIG_DEFAULT_DEVICE_TREE="fsl-imx8qm-apalis"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_PART=1
 CONFIG_IP_DEFRAG=y
 CONFIG_TFTP_BLOCKSIZE=4096
 CONFIG_CLK_IMX8=y
diff --git a/configs/apalis-tk1_defconfig b/configs/apalis-tk1_defconfig
index 9301dcb12ac1..dca15235be58 100644
--- a/configs/apalis-tk1_defconfig
+++ b/configs/apalis-tk1_defconfig
@@ -34,6 +34,7 @@  CONFIG_CMD_EXT4_WRITE=y
 CONFIG_OF_LIVE=y
 CONFIG_DEFAULT_DEVICE_TREE="tegra124-apalis"
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_PART=1
 CONFIG_IP_DEFRAG=y
 CONFIG_TFTP_BLOCKSIZE=16352
 CONFIG_SPL_DM=y
diff --git a/configs/apalis_imx6_defconfig b/configs/apalis_imx6_defconfig
index 2fce8888b5e2..f15c4141c35a 100644
--- a/configs/apalis_imx6_defconfig
+++ b/configs/apalis_imx6_defconfig
@@ -60,6 +60,7 @@  CONFIG_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="imx6-apalis"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_PART=1
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_IP_DEFRAG=y
 CONFIG_TFTP_BLOCKSIZE=4096
diff --git a/configs/apalis_t30_defconfig b/configs/apalis_t30_defconfig
index 133f0abed1c0..307ec72d7f21 100644
--- a/configs/apalis_t30_defconfig
+++ b/configs/apalis_t30_defconfig
@@ -29,6 +29,7 @@  CONFIG_CMD_EXT4_WRITE=y
 CONFIG_OF_LIVE=y
 CONFIG_DEFAULT_DEVICE_TREE="tegra30-apalis"
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_PART=1
 CONFIG_IP_DEFRAG=y
 CONFIG_TFTP_BLOCKSIZE=16352
 CONFIG_SPL_DM=y
diff --git a/configs/bcm11130_defconfig b/configs/bcm11130_defconfig
index 8510cc272f96..f04fcf59d5f7 100644
--- a/configs/bcm11130_defconfig
+++ b/configs/bcm11130_defconfig
@@ -4,7 +4,6 @@  CONFIG_SYS_TEXT_BASE=0xae000000
 CONFIG_ENV_SIZE=0x1000
 CONFIG_ENV_OFFSET=0x2340000
 CONFIG_NR_DRAM_BANKS=1
-CONFIG_SYS_EXTRA_OPTIONS="SYS_MMC_ENV_DEV=0"
 CONFIG_MISC_INIT_R=y
 CONFIG_VERSION_VARIABLE=y
 # CONFIG_DISPLAY_CPUINFO is not set
diff --git a/configs/beaver_defconfig b/configs/beaver_defconfig
index c266bf2ef638..b3a90ee493d3 100644
--- a/configs/beaver_defconfig
+++ b/configs/beaver_defconfig
@@ -28,6 +28,7 @@  CONFIG_CMD_EXT4_WRITE=y
 CONFIG_OF_LIVE=y
 CONFIG_DEFAULT_DEVICE_TREE="tegra30-beaver"
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_PART=2
 CONFIG_SPL_DM=y
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
diff --git a/configs/brppt1_mmc_defconfig b/configs/brppt1_mmc_defconfig
index 09370b7ed055..99fd4bb95478 100644
--- a/configs/brppt1_mmc_defconfig
+++ b/configs/brppt1_mmc_defconfig
@@ -69,6 +69,8 @@  CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clocks clock-names interrupt
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=1
+CONFIG_SYS_MMC_ENV_PART=2
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_DM=y
 CONFIG_SPL_DM=y
diff --git a/configs/brxre1_defconfig b/configs/brxre1_defconfig
index 456e4507c8c6..f2709fdf7f6e 100644
--- a/configs/brxre1_defconfig
+++ b/configs/brxre1_defconfig
@@ -68,6 +68,8 @@  CONFIG_OF_SPL_REMOVE_PROPS=""
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=1
+CONFIG_SYS_MMC_ENV_PART=2
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_NETCONSOLE=y
 CONFIG_DM=y
diff --git a/configs/cardhu_defconfig b/configs/cardhu_defconfig
index 8a4603d080fc..059c6a35860a 100644
--- a/configs/cardhu_defconfig
+++ b/configs/cardhu_defconfig
@@ -25,6 +25,7 @@  CONFIG_CMD_EXT4_WRITE=y
 # CONFIG_SPL_EFI_PARTITION is not set
 CONFIG_DEFAULT_DEVICE_TREE="tegra30-cardhu"
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_PART=2
 CONFIG_SPL_DM=y
 CONFIG_SYS_I2C_TEGRA=y
 CONFIG_SF_DEFAULT_MODE=0
diff --git a/configs/cei-tk1-som_defconfig b/configs/cei-tk1-som_defconfig
index 7f8430acdee8..57ee61ae36b7 100644
--- a/configs/cei-tk1-som_defconfig
+++ b/configs/cei-tk1-som_defconfig
@@ -27,6 +27,7 @@  CONFIG_CMD_EXT4_WRITE=y
 # CONFIG_SPL_EFI_PARTITION is not set
 CONFIG_DEFAULT_DEVICE_TREE="tegra124-cei-tk1-som"
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_PART=2
 CONFIG_SPL_DM=y
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
diff --git a/configs/colibri-imx8qxp_defconfig b/configs/colibri-imx8qxp_defconfig
index 57b48e35b450..d70946b84a4f 100644
--- a/configs/colibri-imx8qxp_defconfig
+++ b/configs/colibri-imx8qxp_defconfig
@@ -31,6 +31,7 @@  CONFIG_CMD_EXT4_WRITE=y
 CONFIG_DEFAULT_DEVICE_TREE="fsl-imx8qxp-colibri"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_PART=1
 CONFIG_IP_DEFRAG=y
 CONFIG_TFTP_BLOCKSIZE=4096
 CONFIG_CLK_IMX8=y
diff --git a/configs/colibri_imx6_defconfig b/configs/colibri_imx6_defconfig
index 388082ae6b75..1d6497142149 100644
--- a/configs/colibri_imx6_defconfig
+++ b/configs/colibri_imx6_defconfig
@@ -60,6 +60,7 @@  CONFIG_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="imx6-colibri"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_PART=1
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_IP_DEFRAG=y
 CONFIG_TFTP_BLOCKSIZE=16352
diff --git a/configs/colibri_imx7_emmc_defconfig b/configs/colibri_imx7_emmc_defconfig
index 7538f7cff483..763585739d92 100644
--- a/configs/colibri_imx7_emmc_defconfig
+++ b/configs/colibri_imx7_emmc_defconfig
@@ -45,6 +45,7 @@  CONFIG_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="imx7-colibri-emmc"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_PART=1
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_IP_DEFRAG=y
 CONFIG_TFTP_BLOCKSIZE=16352
diff --git a/configs/colibri_t30_defconfig b/configs/colibri_t30_defconfig
index 67bba304a93f..1513bdbfbe95 100644
--- a/configs/colibri_t30_defconfig
+++ b/configs/colibri_t30_defconfig
@@ -28,6 +28,7 @@  CONFIG_CMD_EXT4_WRITE=y
 CONFIG_OF_LIVE=y
 CONFIG_DEFAULT_DEVICE_TREE="tegra30-colibri"
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_PART=1
 CONFIG_IP_DEFRAG=y
 CONFIG_TFTP_BLOCKSIZE=16352
 CONFIG_SPL_DM=y
diff --git a/configs/dalmore_defconfig b/configs/dalmore_defconfig
index 99537d8ab580..7de54a99ef3e 100644
--- a/configs/dalmore_defconfig
+++ b/configs/dalmore_defconfig
@@ -27,6 +27,7 @@  CONFIG_CMD_EXT4_WRITE=y
 CONFIG_DEFAULT_DEVICE_TREE="tegra114-dalmore"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_PART=2
 CONFIG_SPL_DM=y
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
diff --git a/configs/deneb_defconfig b/configs/deneb_defconfig
index 178148d2babb..407e08bd3cd0 100644
--- a/configs/deneb_defconfig
+++ b/configs/deneb_defconfig
@@ -60,6 +60,7 @@  CONFIG_SPL_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="imx8-deneb"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
+CONFIG_SYS_MMC_ENV_PART=2
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_SPL_DM=y
diff --git a/configs/dra7xx_evm_defconfig b/configs/dra7xx_evm_defconfig
index 12f08ae6f938..86dd686f37de 100644
--- a/configs/dra7xx_evm_defconfig
+++ b/configs/dra7xx_evm_defconfig
@@ -53,6 +53,7 @@  CONFIG_OF_SPL_REMOVE_PROPS="clocks clock-names interrupt-parent"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=1
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_DM=y
 CONFIG_SPL_DM=y
diff --git a/configs/dra7xx_hs_evm_defconfig b/configs/dra7xx_hs_evm_defconfig
index e15f62eded98..3d461d8a159f 100644
--- a/configs/dra7xx_hs_evm_defconfig
+++ b/configs/dra7xx_hs_evm_defconfig
@@ -55,6 +55,7 @@  CONFIG_OF_SPL_REMOVE_PROPS="clocks clock-names interrupt-parent"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=1
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_DM=y
 CONFIG_SPL_DM=y
diff --git a/configs/dra7xx_hs_evm_usb_defconfig b/configs/dra7xx_hs_evm_usb_defconfig
index 4178473ddf26..6be4b966c073 100644
--- a/configs/dra7xx_hs_evm_usb_defconfig
+++ b/configs/dra7xx_hs_evm_usb_defconfig
@@ -55,6 +55,7 @@  CONFIG_OF_SPL_REMOVE_PROPS="clocks clock-names interrupt-parent"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=1
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_DM=y
 CONFIG_SPL_DM=y
diff --git a/configs/dragonboard410c_defconfig b/configs/dragonboard410c_defconfig
index d4a276ce1461..96071fd7218a 100644
--- a/configs/dragonboard410c_defconfig
+++ b/configs/dragonboard410c_defconfig
@@ -25,6 +25,7 @@  CONFIG_CMD_TIMER=y
 CONFIG_DEFAULT_DEVICE_TREE="dragonboard410c"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_PART=2
 CONFIG_CLK=y
 CONFIG_USB_FUNCTION_FASTBOOT=y
 CONFIG_FASTBOOT_BUF_ADDR=0x91000000
diff --git a/configs/e2220-1170_defconfig b/configs/e2220-1170_defconfig
index da418de4cde3..79bec4133755 100644
--- a/configs/e2220-1170_defconfig
+++ b/configs/e2220-1170_defconfig
@@ -23,6 +23,7 @@  CONFIG_BOOTP_PREFER_SERVERIP=y
 CONFIG_CMD_EXT4_WRITE=y
 CONFIG_DEFAULT_DEVICE_TREE="tegra210-e2220-1170"
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_PART=2
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
 CONFIG_DFU_SF=y
diff --git a/configs/evb-rk3328_defconfig b/configs/evb-rk3328_defconfig
index 7667bb037b3d..c357ca7258f2 100644
--- a/configs/evb-rk3328_defconfig
+++ b/configs/evb-rk3328_defconfig
@@ -41,6 +41,7 @@  CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent
 CONFIG_TPL_OF_PLATDATA=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=1
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_TPL_DM=y
 CONFIG_REGMAP=y
diff --git a/configs/ficus-rk3399_defconfig b/configs/ficus-rk3399_defconfig
index c0fc168ff483..74f0dfff4954 100644
--- a/configs/ficus-rk3399_defconfig
+++ b/configs/ficus-rk3399_defconfig
@@ -24,6 +24,7 @@  CONFIG_DEFAULT_DEVICE_TREE="rk3399-ficus"
 CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=1
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_SYS_I2C_ROCKCHIP=y
diff --git a/configs/giedi_defconfig b/configs/giedi_defconfig
index e53d2e5aef7e..af4d2225cb7d 100644
--- a/configs/giedi_defconfig
+++ b/configs/giedi_defconfig
@@ -60,6 +60,7 @@  CONFIG_SPL_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="imx8-giedi"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
+CONFIG_SYS_MMC_ENV_PART=2
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_SPL_DM=y
diff --git a/configs/gwventana_emmc_defconfig b/configs/gwventana_emmc_defconfig
index fc2504eefeeb..fa38c46e64c2 100644
--- a/configs/gwventana_emmc_defconfig
+++ b/configs/gwventana_emmc_defconfig
@@ -65,6 +65,7 @@  CONFIG_CMD_UBI=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_PART=1
 CONFIG_DM=y
 CONFIG_DWC_AHSATA=y
 CONFIG_SUPPORT_EMMC_RPMB=y
diff --git a/configs/gwventana_gw5904_defconfig b/configs/gwventana_gw5904_defconfig
index 6c6f62728c34..62dcf663c6b0 100644
--- a/configs/gwventana_gw5904_defconfig
+++ b/configs/gwventana_gw5904_defconfig
@@ -65,6 +65,7 @@  CONFIG_CMD_UBI=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_PART=1
 CONFIG_DM=y
 CONFIG_DWC_AHSATA=y
 CONFIG_SUPPORT_EMMC_RPMB=y
diff --git a/configs/hikey_defconfig b/configs/hikey_defconfig
index b58829468b1d..458f793aeb98 100644
--- a/configs/hikey_defconfig
+++ b/configs/hikey_defconfig
@@ -20,6 +20,7 @@  CONFIG_CMD_CACHE=y
 CONFIG_DEFAULT_DEVICE_TREE="hi6220-hikey"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_PART=2
 CONFIG_DM_MMC=y
 CONFIG_MMC_DW=y
 CONFIG_MMC_DW_K3=y
diff --git a/configs/imx6dl_mamoj_defconfig b/configs/imx6dl_mamoj_defconfig
index 649314ee2ed8..e5963d5c3814 100644
--- a/configs/imx6dl_mamoj_defconfig
+++ b/configs/imx6dl_mamoj_defconfig
@@ -30,6 +30,7 @@  CONFIG_CMD_EXT4_WRITE=y
 CONFIG_DEFAULT_DEVICE_TREE="imx6dl-mamoj"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=2
 CONFIG_DFU_MMC=y
 CONFIG_USB_FUNCTION_FASTBOOT=y
 CONFIG_FASTBOOT_BUF_ADDR=0x12000000
diff --git a/configs/imx8mm_beacon_defconfig b/configs/imx8mm_beacon_defconfig
index fb34632d31d3..918abee7fec7 100644
--- a/configs/imx8mm_beacon_defconfig
+++ b/configs/imx8mm_beacon_defconfig
@@ -55,6 +55,7 @@  CONFIG_SPL_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="imx8mm-beacon-kit"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=1
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_SPL_DM=y
diff --git a/configs/imx8mm_evk_defconfig b/configs/imx8mm_evk_defconfig
index d4db74dcbd12..62781529405c 100644
--- a/configs/imx8mm_evk_defconfig
+++ b/configs/imx8mm_evk_defconfig
@@ -53,6 +53,7 @@  CONFIG_SPL_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="imx8mm-evk"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=1
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_SPL_DM=y
 CONFIG_SPL_CLK_COMPOSITE_CCF=y
diff --git a/configs/imx8mp_evk_defconfig b/configs/imx8mp_evk_defconfig
index f49116c9c556..c28561b7ac2e 100644
--- a/configs/imx8mp_evk_defconfig
+++ b/configs/imx8mp_evk_defconfig
@@ -55,6 +55,7 @@  CONFIG_SPL_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="imx8mp-evk"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=1
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_SPL_DM=y
 CONFIG_CLK_COMPOSITE_CCF=y
diff --git a/configs/imx8mq_evk_defconfig b/configs/imx8mq_evk_defconfig
index 6ff02e7b91e7..6a85b93fc44a 100644
--- a/configs/imx8mq_evk_defconfig
+++ b/configs/imx8mq_evk_defconfig
@@ -40,6 +40,7 @@  CONFIG_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="imx8mq-evk"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=1
 CONFIG_SAVED_DRAM_TIMING_BASE=0x40000000
 CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_MXC=y
diff --git a/configs/imx8mq_phanbell_defconfig b/configs/imx8mq_phanbell_defconfig
index 6f8938acbab9..e16d50d6cd92 100644
--- a/configs/imx8mq_phanbell_defconfig
+++ b/configs/imx8mq_phanbell_defconfig
@@ -41,6 +41,7 @@  CONFIG_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="imx8mq-phanbell"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=1
 CONFIG_SAVED_DRAM_TIMING_BASE=0x40000000
 CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_MXC=y
diff --git a/configs/imx8qm_mek_defconfig b/configs/imx8qm_mek_defconfig
index 181e265040de..4aea2656bb01 100644
--- a/configs/imx8qm_mek_defconfig
+++ b/configs/imx8qm_mek_defconfig
@@ -48,6 +48,7 @@  CONFIG_SPL_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="fsl-imx8qm-mek"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=1
 CONFIG_SPL_DM=y
 CONFIG_SPL_CLK=y
 CONFIG_CLK_IMX8=y
diff --git a/configs/imx8qm_rom7720_a1_4G_defconfig b/configs/imx8qm_rom7720_a1_4G_defconfig
index 8af2b239d6e8..bcd494047932 100644
--- a/configs/imx8qm_rom7720_a1_4G_defconfig
+++ b/configs/imx8qm_rom7720_a1_4G_defconfig
@@ -44,6 +44,7 @@  CONFIG_SPL_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="imx8qm-rom7720-a1"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=2
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_SPL_DM=y
 CONFIG_SPL_CLK=y
diff --git a/configs/imx8qxp_mek_defconfig b/configs/imx8qxp_mek_defconfig
index ae40766d80d6..0a956dc03c68 100644
--- a/configs/imx8qxp_mek_defconfig
+++ b/configs/imx8qxp_mek_defconfig
@@ -48,6 +48,7 @@  CONFIG_SPL_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="fsl-imx8qxp-mek"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=1
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_SPL_DM=y
 CONFIG_SPL_CLK=y
diff --git a/configs/j721e_evm_a72_defconfig b/configs/j721e_evm_a72_defconfig
index 09a73e590dc7..75e06600d2cf 100644
--- a/configs/j721e_evm_a72_defconfig
+++ b/configs/j721e_evm_a72_defconfig
@@ -77,6 +77,7 @@  CONFIG_SPL_MULTI_DTB_FIT_NO_COMPRESSION=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_PART=1
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_DM=y
 CONFIG_SPL_DM=y
diff --git a/configs/j721e_hs_evm_a72_defconfig b/configs/j721e_hs_evm_a72_defconfig
index 9b5bc6cf54c8..e45186a0c360 100644
--- a/configs/j721e_hs_evm_a72_defconfig
+++ b/configs/j721e_hs_evm_a72_defconfig
@@ -70,6 +70,7 @@  CONFIG_SPL_MULTI_DTB_FIT_NO_COMPRESSION=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_PART=1
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_DM=y
 CONFIG_SPL_DM=y
diff --git a/configs/j721e_hs_evm_r5_defconfig b/configs/j721e_hs_evm_r5_defconfig
index 1aa899e63c09..46a11f6c7c77 100644
--- a/configs/j721e_hs_evm_r5_defconfig
+++ b/configs/j721e_hs_evm_r5_defconfig
@@ -59,6 +59,7 @@  CONFIG_SPL_OF_CONTROL=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_PART=1
 CONFIG_DM=y
 CONFIG_SPL_DM=y
 CONFIG_SPL_DM_SEQ_ALIAS=y
diff --git a/configs/jetson-tk1_defconfig b/configs/jetson-tk1_defconfig
index cf276c5c968d..1d4ad6ec97c8 100644
--- a/configs/jetson-tk1_defconfig
+++ b/configs/jetson-tk1_defconfig
@@ -28,6 +28,7 @@  CONFIG_CMD_EXT4_WRITE=y
 CONFIG_OF_LIVE=y
 CONFIG_DEFAULT_DEVICE_TREE="tegra124-jetson-tk1"
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_PART=2
 CONFIG_SPL_DM=y
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
diff --git a/configs/kp_imx6q_tpc_defconfig b/configs/kp_imx6q_tpc_defconfig
index 65ff04614040..5ea2d2ff4747 100644
--- a/configs/kp_imx6q_tpc_defconfig
+++ b/configs/kp_imx6q_tpc_defconfig
@@ -48,6 +48,7 @@  CONFIG_OF_SPL_REMOVE_PROPS="interrupt-parent assigned-clocks assigned-clock-rate
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=1
 # CONFIG_BLOCK_CACHE is not set
 CONFIG_SPL_CLK_IMX6Q=y
 CONFIG_CLK_IMX6Q=y
diff --git a/configs/mx6dlarm2_defconfig b/configs/mx6dlarm2_defconfig
index a9142bcd2474..ae64436c7db7 100644
--- a/configs/mx6dlarm2_defconfig
+++ b/configs/mx6dlarm2_defconfig
@@ -28,6 +28,7 @@  CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=1
 CONFIG_FSL_USDHC=y
 CONFIG_MII=y
 CONFIG_MXC_UART=y
diff --git a/configs/mx6dlarm2_lpddr2_defconfig b/configs/mx6dlarm2_lpddr2_defconfig
index 3d26926b926b..31c0b2ea0649 100644
--- a/configs/mx6dlarm2_lpddr2_defconfig
+++ b/configs/mx6dlarm2_lpddr2_defconfig
@@ -28,6 +28,7 @@  CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=1
 CONFIG_FSL_USDHC=y
 CONFIG_MII=y
 CONFIG_MXC_UART=y
diff --git a/configs/mx6qarm2_defconfig b/configs/mx6qarm2_defconfig
index 38677a914075..2635dd5048a8 100644
--- a/configs/mx6qarm2_defconfig
+++ b/configs/mx6qarm2_defconfig
@@ -28,6 +28,7 @@  CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=1
 CONFIG_FSL_USDHC=y
 CONFIG_MII=y
 CONFIG_MXC_UART=y
diff --git a/configs/mx6qarm2_lpddr2_defconfig b/configs/mx6qarm2_lpddr2_defconfig
index 6a3194642315..234aaec4792f 100644
--- a/configs/mx6qarm2_lpddr2_defconfig
+++ b/configs/mx6qarm2_lpddr2_defconfig
@@ -28,6 +28,7 @@  CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=1
 CONFIG_FSL_USDHC=y
 CONFIG_MII=y
 CONFIG_MXC_UART=y
diff --git a/configs/mx6sabresd_defconfig b/configs/mx6sabresd_defconfig
index c03e0b54f552..8efda366120d 100644
--- a/configs/mx6sabresd_defconfig
+++ b/configs/mx6sabresd_defconfig
@@ -66,6 +66,7 @@  CONFIG_SPL_OF_LIST="imx6dl-sabresd imx6q-sabresd imx6qp-sabresd"
 CONFIG_SPL_MULTI_DTB_FIT_NO_COMPRESSION=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=1
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_USB_FUNCTION_FASTBOOT=y
 CONFIG_FASTBOOT_BUF_ADDR=0x12000000
diff --git a/configs/mx6slevk_defconfig b/configs/mx6slevk_defconfig
index 91dcef10df0d..64b49d033f13 100644
--- a/configs/mx6slevk_defconfig
+++ b/configs/mx6slevk_defconfig
@@ -33,6 +33,7 @@  CONFIG_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="imx6sl-evk"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=1
 CONFIG_DM=y
 CONFIG_DM_I2C=y
 CONFIG_DM_MMC=y
diff --git a/configs/mx6slevk_spl_defconfig b/configs/mx6slevk_spl_defconfig
index edea036267d4..90febee8f605 100644
--- a/configs/mx6slevk_spl_defconfig
+++ b/configs/mx6slevk_spl_defconfig
@@ -42,6 +42,7 @@  CONFIG_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="imx6sl-evk"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=1
 CONFIG_DM=y
 CONFIG_DM_I2C=y
 CONFIG_DM_MMC=y
diff --git a/configs/mx6sxsabresd_defconfig b/configs/mx6sxsabresd_defconfig
index 994b038cf8f7..2f9a029fb809 100644
--- a/configs/mx6sxsabresd_defconfig
+++ b/configs/mx6sxsabresd_defconfig
@@ -37,6 +37,7 @@  CONFIG_CMD_FS_GENERIC=y
 CONFIG_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="imx6sx-sdb"
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=2
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_DM_I2C=y
 CONFIG_DM_MMC=y
diff --git a/configs/mx6ul_14x14_evk_defconfig b/configs/mx6ul_14x14_evk_defconfig
index 0a9bead33b91..1b53af185ca3 100644
--- a/configs/mx6ul_14x14_evk_defconfig
+++ b/configs/mx6ul_14x14_evk_defconfig
@@ -50,6 +50,7 @@  CONFIG_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="imx6ul-14x14-evk"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=1
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_USB_FUNCTION_FASTBOOT=y
 CONFIG_DM_74X164=y
diff --git a/configs/mx6ul_9x9_evk_defconfig b/configs/mx6ul_9x9_evk_defconfig
index 7b723d817793..c27d099c9131 100644
--- a/configs/mx6ul_9x9_evk_defconfig
+++ b/configs/mx6ul_9x9_evk_defconfig
@@ -45,6 +45,7 @@  CONFIG_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="imx6ul-9x9-evk"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=1
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_DM_I2C=y
 CONFIG_DM_MMC=y
diff --git a/configs/mx6ull_14x14_evk_defconfig b/configs/mx6ull_14x14_evk_defconfig
index 7c77cbb90c9e..141c1cd357fd 100644
--- a/configs/mx6ull_14x14_evk_defconfig
+++ b/configs/mx6ull_14x14_evk_defconfig
@@ -30,6 +30,7 @@  CONFIG_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="imx6ull-14x14-evk"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=1
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_DM_74X164=y
 CONFIG_DM_I2C=y
diff --git a/configs/mx6ull_14x14_evk_plugin_defconfig b/configs/mx6ull_14x14_evk_plugin_defconfig
index e96402df65bd..85acc40507b0 100644
--- a/configs/mx6ull_14x14_evk_plugin_defconfig
+++ b/configs/mx6ull_14x14_evk_plugin_defconfig
@@ -31,6 +31,7 @@  CONFIG_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="imx6ull-14x14-evk"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=1
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_DM_74X164=y
 CONFIG_DM_I2C=y
diff --git a/configs/mx6ulz_14x14_evk_defconfig b/configs/mx6ulz_14x14_evk_defconfig
index 9bb2e257c269..242484ea4a64 100644
--- a/configs/mx6ulz_14x14_evk_defconfig
+++ b/configs/mx6ulz_14x14_evk_defconfig
@@ -28,6 +28,7 @@  CONFIG_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="imx6ulz-14x14-evk"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=1
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 # CONFIG_NET is not set
 CONFIG_DM_74X164=y
diff --git a/configs/nyan-big_defconfig b/configs/nyan-big_defconfig
index 02c80264af5d..0c463fb8bf30 100644
--- a/configs/nyan-big_defconfig
+++ b/configs/nyan-big_defconfig
@@ -46,6 +46,7 @@  CONFIG_CMD_EXT4_WRITE=y
 CONFIG_OF_LIVE=y
 CONFIG_DEFAULT_DEVICE_TREE="tegra124-nyan-big"
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_PART=2
 CONFIG_SPL_DM=y
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
diff --git a/configs/omap4_sdp4430_defconfig b/configs/omap4_sdp4430_defconfig
index 0ed6b0cb36d8..b51a5fdaf67c 100644
--- a/configs/omap4_sdp4430_defconfig
+++ b/configs/omap4_sdp4430_defconfig
@@ -29,6 +29,7 @@  CONFIG_OF_CONTROL=y
 CONFIG_SPL_PARTITION_UUIDS=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=1
 CONFIG_DM=y
 CONFIG_DM_MMC=y
 CONFIG_MMC_OMAP_HS=y
diff --git a/configs/omap5_uevm_defconfig b/configs/omap5_uevm_defconfig
index 317c4848d3db..23643d27f73e 100644
--- a/configs/omap5_uevm_defconfig
+++ b/configs/omap5_uevm_defconfig
@@ -29,6 +29,7 @@  CONFIG_OF_CONTROL=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=1
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_DM=y
 CONFIG_DM_MMC=y
diff --git a/configs/opos6uldev_defconfig b/configs/opos6uldev_defconfig
index 116a697a1b6b..d304c0b90117 100644
--- a/configs/opos6uldev_defconfig
+++ b/configs/opos6uldev_defconfig
@@ -66,6 +66,7 @@  CONFIG_DEFAULT_DEVICE_TREE="imx6ul-opos6uldev"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_PART=1
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_REGMAP=y
 CONFIG_SYSCON=y
diff --git a/configs/p2371-0000_defconfig b/configs/p2371-0000_defconfig
index d8d28ed6ea28..9d6abaa3348d 100644
--- a/configs/p2371-0000_defconfig
+++ b/configs/p2371-0000_defconfig
@@ -24,6 +24,7 @@  CONFIG_BOOTP_PREFER_SERVERIP=y
 CONFIG_CMD_EXT4_WRITE=y
 CONFIG_DEFAULT_DEVICE_TREE="tegra210-p2371-0000"
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_PART=2
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
 CONFIG_DFU_SF=y
diff --git a/configs/p2371-2180_defconfig b/configs/p2371-2180_defconfig
index ec4c5909ac94..42db19df4e58 100644
--- a/configs/p2371-2180_defconfig
+++ b/configs/p2371-2180_defconfig
@@ -27,6 +27,7 @@  CONFIG_CMD_EXT4_WRITE=y
 CONFIG_OF_LIVE=y
 CONFIG_DEFAULT_DEVICE_TREE="tegra210-p2371-2180"
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_PART=2
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
 CONFIG_DFU_SF=y
diff --git a/configs/p2571_defconfig b/configs/p2571_defconfig
index 95188a142a8b..077d5964ac1c 100644
--- a/configs/p2571_defconfig
+++ b/configs/p2571_defconfig
@@ -24,6 +24,7 @@  CONFIG_BOOTP_PREFER_SERVERIP=y
 CONFIG_CMD_EXT4_WRITE=y
 CONFIG_DEFAULT_DEVICE_TREE="tegra210-p2571"
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_PART=2
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
 CONFIG_DFU_SF=y
diff --git a/configs/p2771-0000-000_defconfig b/configs/p2771-0000-000_defconfig
index befa46a4cdaa..5614d456f9c9 100644
--- a/configs/p2771-0000-000_defconfig
+++ b/configs/p2771-0000-000_defconfig
@@ -23,6 +23,7 @@  CONFIG_BOOTP_PREFER_SERVERIP=y
 CONFIG_CMD_EXT4_WRITE=y
 CONFIG_DEFAULT_DEVICE_TREE="tegra186-p2771-0000-000"
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_PART=2
 CONFIG_SYS_I2C_TEGRA=y
 CONFIG_TEGRA186_BPMP_I2C=y
 CONFIG_DWC_ETH_QOS=y
diff --git a/configs/p2771-0000-500_defconfig b/configs/p2771-0000-500_defconfig
index 71cde4e41d3c..8c187f330076 100644
--- a/configs/p2771-0000-500_defconfig
+++ b/configs/p2771-0000-500_defconfig
@@ -23,6 +23,7 @@  CONFIG_BOOTP_PREFER_SERVERIP=y
 CONFIG_CMD_EXT4_WRITE=y
 CONFIG_DEFAULT_DEVICE_TREE="tegra186-p2771-0000-500"
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_PART=2
 CONFIG_SYS_I2C_TEGRA=y
 CONFIG_TEGRA186_BPMP_I2C=y
 CONFIG_DWC_ETH_QOS=y
diff --git a/configs/paz00_defconfig b/configs/paz00_defconfig
index 5054bf65ab3f..491eedb67053 100644
--- a/configs/paz00_defconfig
+++ b/configs/paz00_defconfig
@@ -24,6 +24,7 @@  CONFIG_CMD_EXT4_WRITE=y
 CONFIG_DEFAULT_DEVICE_TREE="tegra20-paz00"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_PART=2
 CONFIG_SPL_DM=y
 CONFIG_DM_PMIC=y
 CONFIG_DM_REGULATOR=y
diff --git a/configs/phycore-rk3288_defconfig b/configs/phycore-rk3288_defconfig
index 05ceaedb85a2..17447c69e6d0 100644
--- a/configs/phycore-rk3288_defconfig
+++ b/configs/phycore-rk3288_defconfig
@@ -39,6 +39,7 @@  CONFIG_DEFAULT_DEVICE_TREE="rk3288-phycore-rdk"
 CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=1
 CONFIG_REGMAP=y
 CONFIG_SPL_REGMAP=y
 CONFIG_SYSCON=y
diff --git a/configs/pico-imx8mq_defconfig b/configs/pico-imx8mq_defconfig
index ab031e198b4b..f2c9a6916d14 100644
--- a/configs/pico-imx8mq_defconfig
+++ b/configs/pico-imx8mq_defconfig
@@ -39,6 +39,7 @@  CONFIG_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="imx8mq-pico-pi"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=1
 CONFIG_SAVED_DRAM_TIMING_BASE=0x40000000
 CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_MXC=y
diff --git a/configs/puma-rk3399_defconfig b/configs/puma-rk3399_defconfig
index 3c5a1dc29996..632cfdefdc48 100644
--- a/configs/puma-rk3399_defconfig
+++ b/configs/puma-rk3399_defconfig
@@ -42,6 +42,7 @@  CONFIG_OF_LIVE=y
 CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=1
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_SYS_I2C_ROCKCHIP=y
 CONFIG_MISC=y
diff --git a/configs/r8a77990_ebisu_defconfig b/configs/r8a77990_ebisu_defconfig
index 5cd8eb527b3e..83da30f79478 100644
--- a/configs/r8a77990_ebisu_defconfig
+++ b/configs/r8a77990_ebisu_defconfig
@@ -34,6 +34,8 @@  CONFIG_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="r8a77990-ebisu-u-boot"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=2
+CONFIG_SYS_MMC_ENV_PART=2
 CONFIG_REGMAP=y
 CONFIG_SYSCON=y
 CONFIG_CLK=y
diff --git a/configs/r8a77995_draak_defconfig b/configs/r8a77995_draak_defconfig
index b1a48af8a76b..1b62c2b4df85 100644
--- a/configs/r8a77995_draak_defconfig
+++ b/configs/r8a77995_draak_defconfig
@@ -34,6 +34,7 @@  CONFIG_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="r8a77995-draak-u-boot"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_PART=2
 CONFIG_REGMAP=y
 CONFIG_SYSCON=y
 CONFIG_CLK=y
diff --git a/configs/rcar3_salvator-x_defconfig b/configs/rcar3_salvator-x_defconfig
index 2ba3a11a2744..726fdc975efc 100644
--- a/configs/rcar3_salvator-x_defconfig
+++ b/configs/rcar3_salvator-x_defconfig
@@ -37,6 +37,8 @@  CONFIG_MULTI_DTB_FIT_LZO=y
 CONFIG_MULTI_DTB_FIT_USER_DEFINED_AREA=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=1
+CONFIG_SYS_MMC_ENV_PART=2
 CONFIG_REGMAP=y
 CONFIG_SYSCON=y
 CONFIG_CLK=y
diff --git a/configs/rcar3_ulcb_defconfig b/configs/rcar3_ulcb_defconfig
index 718fcdb5607b..475491fbb7a2 100644
--- a/configs/rcar3_ulcb_defconfig
+++ b/configs/rcar3_ulcb_defconfig
@@ -37,6 +37,8 @@  CONFIG_MULTI_DTB_FIT_LZO=y
 CONFIG_MULTI_DTB_FIT_USER_DEFINED_AREA=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=1
+CONFIG_SYS_MMC_ENV_PART=2
 CONFIG_REGMAP=y
 CONFIG_SYSCON=y
 CONFIG_CLK=y
diff --git a/configs/riotboard_defconfig b/configs/riotboard_defconfig
index 4d8cd54ee9df..4a63a2a53775 100644
--- a/configs/riotboard_defconfig
+++ b/configs/riotboard_defconfig
@@ -22,6 +22,7 @@  CONFIG_CMD_CACHE=y
 CONFIG_CMD_EXT4_WRITE=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=2
 CONFIG_DM=y
 CONFIG_SUPPORT_EMMC_BOOT=y
 CONFIG_FSL_USDHC=y
diff --git a/configs/riotboard_spl_defconfig b/configs/riotboard_spl_defconfig
index 8e9aaf3a1317..2e8584825876 100644
--- a/configs/riotboard_spl_defconfig
+++ b/configs/riotboard_spl_defconfig
@@ -32,6 +32,7 @@  CONFIG_CMD_CACHE=y
 CONFIG_CMD_EXT4_WRITE=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=2
 CONFIG_DM=y
 CONFIG_SUPPORT_EMMC_BOOT=y
 CONFIG_FSL_USDHC=y
diff --git a/configs/roc-cc-rk3328_defconfig b/configs/roc-cc-rk3328_defconfig
index 933a1c6967d4..8a02f11d6e65 100644
--- a/configs/roc-cc-rk3328_defconfig
+++ b/configs/roc-cc-rk3328_defconfig
@@ -43,6 +43,7 @@  CONFIG_OF_SPL_REMOVE_PROPS="clock-names interrupt-parent assigned-clocks assigne
 CONFIG_TPL_OF_PLATDATA=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=1
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_TPL_DM=y
 CONFIG_REGMAP=y
diff --git a/configs/rock-pi-e-rk3328_defconfig b/configs/rock-pi-e-rk3328_defconfig
index e0941225a377..193621244451 100644
--- a/configs/rock-pi-e-rk3328_defconfig
+++ b/configs/rock-pi-e-rk3328_defconfig
@@ -45,6 +45,7 @@  CONFIG_OF_SPL_REMOVE_PROPS="clock-names interrupt-parent assigned-clocks assigne
 CONFIG_TPL_OF_PLATDATA=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=1
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_TPL_DM=y
 CONFIG_REGMAP=y
diff --git a/configs/rock64-rk3328_defconfig b/configs/rock64-rk3328_defconfig
index 0a51e51a0c96..aeb7a2570a6c 100644
--- a/configs/rock64-rk3328_defconfig
+++ b/configs/rock64-rk3328_defconfig
@@ -43,6 +43,7 @@  CONFIG_OF_SPL_REMOVE_PROPS="clock-names interrupt-parent assigned-clocks assigne
 CONFIG_TPL_OF_PLATDATA=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=1
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_TPL_DM=y
 CONFIG_REGMAP=y
diff --git a/configs/rock960-rk3399_defconfig b/configs/rock960-rk3399_defconfig
index 59a85c78a14b..83256458afa7 100644
--- a/configs/rock960-rk3399_defconfig
+++ b/configs/rock960-rk3399_defconfig
@@ -30,6 +30,7 @@  CONFIG_DEFAULT_DEVICE_TREE="rk3399-rock960"
 CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=1
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_SYS_I2C_ROCKCHIP=y
 CONFIG_MMC_DW=y
diff --git a/configs/seaboard_defconfig b/configs/seaboard_defconfig
index 54506329c288..6496a3f7911c 100644
--- a/configs/seaboard_defconfig
+++ b/configs/seaboard_defconfig
@@ -28,6 +28,7 @@  CONFIG_CMD_EXT4_WRITE=y
 CONFIG_DEFAULT_DEVICE_TREE="tegra20-seaboard"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_PART=2
 CONFIG_SPL_DM=y
 CONFIG_SYS_I2C_TEGRA=y
 CONFIG_TEGRA_KEYBOARD=y
diff --git a/configs/sei510_defconfig b/configs/sei510_defconfig
index 70aa93d9ca07..65773d1fb93f 100644
--- a/configs/sei510_defconfig
+++ b/configs/sei510_defconfig
@@ -34,6 +34,8 @@  CONFIG_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="meson-g12a-sei510"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=2
+CONFIG_SYS_MMC_ENV_PART=1
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_USB_FUNCTION_FASTBOOT=y
 CONFIG_FASTBOOT_BUF_ADDR=0x6000000
diff --git a/configs/sei610_defconfig b/configs/sei610_defconfig
index f19f3b55d913..a016c27881e4 100644
--- a/configs/sei610_defconfig
+++ b/configs/sei610_defconfig
@@ -34,6 +34,8 @@  CONFIG_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="meson-sm1-sei610"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=2
+CONFIG_SYS_MMC_ENV_PART=1
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_USB_FUNCTION_FASTBOOT=y
 CONFIG_FASTBOOT_BUF_ADDR=0x6000000
diff --git a/configs/somlabs_visionsom_6ull_defconfig b/configs/somlabs_visionsom_6ull_defconfig
index 091c5b29b15b..97dae9f62acd 100644
--- a/configs/somlabs_visionsom_6ull_defconfig
+++ b/configs/somlabs_visionsom_6ull_defconfig
@@ -33,6 +33,7 @@  CONFIG_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="imx6ull-somlabs-visionsom"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=1
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_FSL_USDHC=y
diff --git a/configs/tbs2910_defconfig b/configs/tbs2910_defconfig
index 61b5a8b11bc1..c270fec24edf 100644
--- a/configs/tbs2910_defconfig
+++ b/configs/tbs2910_defconfig
@@ -60,6 +60,8 @@  CONFIG_OF_DTB_PROPS_REMOVE=y
 CONFIG_OF_REMOVE_PROPS="dmas dma-names interrupt-parent interrupts interrupts-extended interrupt-names interrupt-map interrupt-map-mask"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=2
+CONFIG_SYS_MMC_ENV_PART=1
 CONFIG_DM=y
 CONFIG_DWC_AHSATA=y
 CONFIG_DM_I2C=y
diff --git a/configs/tec-ng_defconfig b/configs/tec-ng_defconfig
index f99be9649889..0a9e04b1dd16 100644
--- a/configs/tec-ng_defconfig
+++ b/configs/tec-ng_defconfig
@@ -25,6 +25,7 @@  CONFIG_CMD_EXT4_WRITE=y
 # CONFIG_SPL_EFI_PARTITION is not set
 CONFIG_DEFAULT_DEVICE_TREE="tegra30-tec-ng"
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_PART=2
 CONFIG_SPL_DM=y
 CONFIG_SYS_I2C_TEGRA=y
 CONFIG_SF_DEFAULT_MODE=0
diff --git a/configs/tinker-rk3288_defconfig b/configs/tinker-rk3288_defconfig
index 9e6bcacba552..80babb70016e 100644
--- a/configs/tinker-rk3288_defconfig
+++ b/configs/tinker-rk3288_defconfig
@@ -40,6 +40,7 @@  CONFIG_DEFAULT_DEVICE_TREE="rk3288-tinker"
 CONFIG_OF_SPL_REMOVE_PROPS="clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=1
 CONFIG_REGMAP=y
 CONFIG_SPL_REGMAP=y
 CONFIG_SYSCON=y
diff --git a/configs/tinker-s-rk3288_defconfig b/configs/tinker-s-rk3288_defconfig
index daae189fe661..2456c3839f0c 100644
--- a/configs/tinker-s-rk3288_defconfig
+++ b/configs/tinker-s-rk3288_defconfig
@@ -41,6 +41,7 @@  CONFIG_DEFAULT_DEVICE_TREE="rk3288-tinker-s"
 CONFIG_OF_SPL_REMOVE_PROPS="clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=1
 CONFIG_REGMAP=y
 CONFIG_SPL_REGMAP=y
 CONFIG_SYSCON=y
diff --git a/configs/venice2_defconfig b/configs/venice2_defconfig
index 12702429b732..e1fc61d3e454 100644
--- a/configs/venice2_defconfig
+++ b/configs/venice2_defconfig
@@ -26,6 +26,7 @@  CONFIG_CMD_EXT4_WRITE=y
 # CONFIG_SPL_EFI_PARTITION is not set
 CONFIG_DEFAULT_DEVICE_TREE="tegra124-venice2"
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_PART=2
 CONFIG_SPL_DM=y
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
diff --git a/configs/ventana_defconfig b/configs/ventana_defconfig
index 8959a5c99a2f..1dea3b9714c8 100644
--- a/configs/ventana_defconfig
+++ b/configs/ventana_defconfig
@@ -25,6 +25,7 @@  CONFIG_CMD_EXT4_WRITE=y
 CONFIG_DEFAULT_DEVICE_TREE="tegra20-ventana"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_PART=2
 CONFIG_SPL_DM=y
 CONFIG_DM_PMIC=y
 CONFIG_DM_REGULATOR=y
diff --git a/configs/verdin-imx8mm_defconfig b/configs/verdin-imx8mm_defconfig
index 302345f17aea..b2650d6bb347 100644
--- a/configs/verdin-imx8mm_defconfig
+++ b/configs/verdin-imx8mm_defconfig
@@ -62,6 +62,7 @@  CONFIG_SPL_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="imx8mm-verdin"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_PART=1
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_IP_DEFRAG=y
 CONFIG_TFTP_BLOCKSIZE=4096
diff --git a/configs/vining_2000_defconfig b/configs/vining_2000_defconfig
index db79c7cba621..4cc40b6e462f 100644
--- a/configs/vining_2000_defconfig
+++ b/configs/vining_2000_defconfig
@@ -57,6 +57,7 @@  CONFIG_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="imx6sx-softing-vining-2000"
 CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_PART=1
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_DM_MMC=y
 CONFIG_SUPPORT_EMMC_RPMB=y
diff --git a/configs/vyasa-rk3288_defconfig b/configs/vyasa-rk3288_defconfig
index c46eed5ae3ff..8b25ed6a4d34 100644
--- a/configs/vyasa-rk3288_defconfig
+++ b/configs/vyasa-rk3288_defconfig
@@ -37,6 +37,7 @@  CONFIG_DEFAULT_DEVICE_TREE="rk3288-vyasa"
 CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=1
 CONFIG_REGMAP=y
 CONFIG_SPL_REGMAP=y
 CONFIG_SYSCON=y
diff --git a/configs/xpress_defconfig b/configs/xpress_defconfig
index b1bdb157bb95..c1815445565e 100644
--- a/configs/xpress_defconfig
+++ b/configs/xpress_defconfig
@@ -30,6 +30,7 @@  CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_PART=1
 CONFIG_SUPPORT_EMMC_BOOT=y
 CONFIG_FSL_USDHC=y
 CONFIG_MTD=y
diff --git a/configs/xpress_spl_defconfig b/configs/xpress_spl_defconfig
index 33e5a774c2ea..97efaeed2992 100644
--- a/configs/xpress_spl_defconfig
+++ b/configs/xpress_spl_defconfig
@@ -41,6 +41,7 @@  CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_PART=1
 CONFIG_SUPPORT_EMMC_BOOT=y
 CONFIG_FSL_USDHC=y
 CONFIG_MTD=y
diff --git a/configs/zc5202_defconfig b/configs/zc5202_defconfig
index 852baf000c8f..e33fe5d99c14 100644
--- a/configs/zc5202_defconfig
+++ b/configs/zc5202_defconfig
@@ -39,6 +39,8 @@  CONFIG_CMD_CACHE=y
 CONFIG_CMD_EXT4_WRITE=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=1
+CONFIG_SYS_MMC_ENV_PART=2
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_SUPPORT_EMMC_BOOT=y
 CONFIG_FSL_USDHC=y
diff --git a/configs/zc5601_defconfig b/configs/zc5601_defconfig
index 17c5ce420017..b04fa2c2688b 100644
--- a/configs/zc5601_defconfig
+++ b/configs/zc5601_defconfig
@@ -38,6 +38,8 @@  CONFIG_CMD_CACHE=y
 CONFIG_CMD_EXT4_WRITE=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=1
+CONFIG_SYS_MMC_ENV_PART=2
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_SUPPORT_EMMC_BOOT=y
 CONFIG_FSL_USDHC=y
diff --git a/env/Kconfig b/env/Kconfig
index 38e7fadbb93a..2eb2fe48da3d 100644
--- a/env/Kconfig
+++ b/env/Kconfig
@@ -567,6 +567,25 @@  config SYS_RELOC_GD_ENV_ADDR
 	  Relocate the early env_addr pointer so we know it is not inside
 	  the binary. Some systems need this and for the rest, it doesn't hurt.
 
+config SYS_MMC_ENV_DEV
+	int "mmc device number"
+	depends on ENV_IS_IN_MMC || ENV_IS_IN_FAT || SYS_LS_PPA_FW_IN_MMC || \
+		CMD_MVEBU_BUBT || FMAN_ENET || QE
+	default 0
+	help
+	  MMC device number on the platform where the environment is stored.
+
+config SYS_MMC_ENV_PART
+	int "mmc partition number"
+	depends on ENV_IS_IN_MMC || ENV_IS_IN_FAT
+	default 0
+	help
+	  MMC hardware partition device number on the platform where the
+	  environment is stored.  Note that this is not related to any software
+	  defined partition table but instead if we are in the user area, which is
+	  partition 0 or the first boot partition, which is 1 or some other defined
+	  partition.
+
 config USE_DEFAULT_ENV_FILE
 	bool "Create default environment from file"
 	help
diff --git a/include/configs/P1010RDB.h b/include/configs/P1010RDB.h
index fc74d57497e5..9d499a018e1d 100644
--- a/include/configs/P1010RDB.h
+++ b/include/configs/P1010RDB.h
@@ -638,7 +638,6 @@  extern unsigned long get_sdram_size(void);
  */
 #if defined(CONFIG_SDCARD)
 #define CONFIG_FSL_FIXED_MMC_LOCATION
-#define CONFIG_SYS_MMC_ENV_DEV		0
 #elif defined(CONFIG_MTD_RAW_NAND)
 #ifdef CONFIG_TPL_BUILD
 #define SPL_ENV_ADDR		(CONFIG_SYS_INIT_L2_ADDR + (160 << 10))
diff --git a/include/configs/P2041RDB.h b/include/configs/P2041RDB.h
index c6a64ee4797c..87b005a8ada2 100644
--- a/include/configs/P2041RDB.h
+++ b/include/configs/P2041RDB.h
@@ -51,7 +51,6 @@ 
 #if defined(CONFIG_SPIFLASH)
 #elif defined(CONFIG_SDCARD)
 	#define CONFIG_FSL_FIXED_MMC_LOCATION
-	#define CONFIG_SYS_MMC_ENV_DEV          0
 #endif
 
 #ifndef __ASSEMBLY__
diff --git a/include/configs/T102xRDB.h b/include/configs/T102xRDB.h
index efd9b6b5e195..0142e56fd4d4 100644
--- a/include/configs/T102xRDB.h
+++ b/include/configs/T102xRDB.h
@@ -134,11 +134,6 @@ 
 #define CONFIG_RESET_VECTOR_ADDRESS 0xfffffffc
 #endif
 
-#if defined(CONFIG_SPIFLASH)
-#elif defined(CONFIG_SDCARD)
-#define CONFIG_SYS_MMC_ENV_DEV		0
-#endif
-
 #ifndef __ASSEMBLY__
 unsigned long get_board_sys_clk(void);
 unsigned long get_board_ddr_clk(void);
diff --git a/include/configs/T104xRDB.h b/include/configs/T104xRDB.h
index 8f9de56f0790..23e852bc5466 100644
--- a/include/configs/T104xRDB.h
+++ b/include/configs/T104xRDB.h
@@ -159,8 +159,6 @@  $(SRCTREE)/board/freescale/t104xrdb/t1042d4_sd_rcw.cfg
 #define CONFIG_ENV_OVERWRITE
 
 #if defined(CONFIG_SPIFLASH)
-#elif defined(CONFIG_SDCARD)
-#define CONFIG_SYS_MMC_ENV_DEV          0
 #elif defined(CONFIG_MTD_RAW_NAND)
 #ifdef CONFIG_NXP_ESBC
 #define CONFIG_RAMBOOT_NAND
diff --git a/include/configs/T208xQDS.h b/include/configs/T208xQDS.h
index f32e6680b3af..a4e373e03c91 100644
--- a/include/configs/T208xQDS.h
+++ b/include/configs/T208xQDS.h
@@ -115,11 +115,6 @@ 
 #define CONFIG_MEM_INIT_VALUE		0xdeadbeef
 #endif
 
-#if defined(CONFIG_SPIFLASH)
-#elif defined(CONFIG_SDCARD)
-#define CONFIG_SYS_MMC_ENV_DEV	0
-#endif
-
 #ifndef __ASSEMBLY__
 unsigned long get_board_sys_clk(void);
 unsigned long get_board_ddr_clk(void);
diff --git a/include/configs/T208xRDB.h b/include/configs/T208xRDB.h
index e666e4f4a4c0..85c002b62b24 100644
--- a/include/configs/T208xRDB.h
+++ b/include/configs/T208xRDB.h
@@ -97,11 +97,6 @@ 
 #define CONFIG_MEM_INIT_VALUE		0xdeadbeef
 #endif
 
-#if defined(CONFIG_SPIFLASH)
-#elif defined(CONFIG_SDCARD)
-#define CONFIG_SYS_MMC_ENV_DEV	0
-#endif
-
 #ifndef __ASSEMBLY__
 unsigned long get_board_sys_clk(void);
 unsigned long get_board_ddr_clk(void);
diff --git a/include/configs/T4240RDB.h b/include/configs/T4240RDB.h
index ebe7a9cf92ca..f83f96606644 100644
--- a/include/configs/T4240RDB.h
+++ b/include/configs/T4240RDB.h
@@ -276,11 +276,6 @@ 
 	"setenv bootargs config-addr=0x60000000; "	\
 	"bootm 0x01000000 - 0x00f00000"
 
-#if defined(CONFIG_SPIFLASH)
-#elif defined(CONFIG_SDCARD)
-#define CONFIG_SYS_MMC_ENV_DEV          0
-#endif
-
 #define CONFIG_SYS_CLK_FREQ	66666666
 #define CONFIG_DDR_CLK_FREQ	133333333
 
diff --git a/include/configs/UCP1020.h b/include/configs/UCP1020.h
index 2590a28867d3..3de3660c67d2 100644
--- a/include/configs/UCP1020.h
+++ b/include/configs/UCP1020.h
@@ -32,9 +32,6 @@ 
 #define FWENV_TYPE	FWENV_NOR_FLASH
 
 #if (FWENV_TYPE == FWENV_MMC)
-#ifndef CONFIG_SYS_MMC_ENV_DEV
-#define CONFIG_SYS_MMC_ENV_DEV 1
-#endif
 #define FWENV_ADDR1 -1
 #define FWENV_ADDR2 -1
 #define FWENV_ADDR3 -1
@@ -369,7 +366,6 @@ 
  */
 #if !defined(CONFIG_ENV_FIT_UCBOOT) && defined(CONFIG_RAMBOOT_SDCARD)
 #define CONFIG_FSL_FIXED_MMC_LOCATION
-#define CONFIG_SYS_MMC_ENV_DEV	0
 #endif
 
 #define CONFIG_LOADS_ECHO		/* echo on for serial download */
diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index 6de463efa1ee..9c4ef369c5cf 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -275,8 +275,6 @@ 
 #if defined(CONFIG_SPI_BOOT)
 /* SPL related */
 #elif defined(CONFIG_EMMC_BOOT)
-#define CONFIG_SYS_MMC_ENV_DEV		1
-#define CONFIG_SYS_MMC_ENV_PART		0
 #define CONFIG_SYS_MMC_MAX_DEVICE	2
 #elif defined(CONFIG_ENV_IS_IN_NAND)
 #define CONFIG_SYS_ENV_SECT_SIZE	CONFIG_SYS_NAND_BLOCK_SIZE
diff --git a/include/configs/am335x_shc.h b/include/configs/am335x_shc.h
index c881ac621114..2e9c6b831b3f 100644
--- a/include/configs/am335x_shc.h
+++ b/include/configs/am335x_shc.h
@@ -30,11 +30,6 @@ 
  * in case of SD Card or Network boot we want to have a possibility to
  * debrick the shc, therefore do not read environment from eMMC
  */
-#if defined(CONFIG_SHC_SDBOOT) || defined(CONFIG_SHC_NETBOOT)
-#define CONFIG_SYS_MMC_ENV_DEV		0
-#else
-#define CONFIG_SYS_MMC_ENV_DEV		1
-#endif
 
 /*
  * Info when using boot partitions: As environment resides within first
diff --git a/include/configs/am335x_sl50.h b/include/configs/am335x_sl50.h
index 9087e04165f7..16849d870114 100644
--- a/include/configs/am335x_sl50.h
+++ b/include/configs/am335x_sl50.h
@@ -75,11 +75,6 @@ 
 /* disable EFI partitions and partition UUID support */
 #endif
 
-#if defined(CONFIG_EMMC_BOOT)
-#define CONFIG_SYS_MMC_ENV_DEV		1
-#define CONFIG_SYS_MMC_ENV_PART		2
-#endif
-
 /* Network. */
 
 #endif	/* ! __CONFIG_AM335X_SL50_H */
diff --git a/include/configs/am57xx_evm.h b/include/configs/am57xx_evm.h
index adcd9a12e2e5..899fb2e501e6 100644
--- a/include/configs/am57xx_evm.h
+++ b/include/configs/am57xx_evm.h
@@ -17,8 +17,6 @@ 
 #define CONFIG_IODELAY_RECALIBRATION
 
 /* MMC ENV related defines */
-#define CONFIG_SYS_MMC_ENV_DEV		1		/* eMMC */
-#define CONFIG_SYS_MMC_ENV_PART		0
 
 #define CONFIG_SYS_BOOTM_LEN		SZ_64M
 
diff --git a/include/configs/am65x_evm.h b/include/configs/am65x_evm.h
index 19d861d40288..6507bb60abb1 100644
--- a/include/configs/am65x_evm.h
+++ b/include/configs/am65x_evm.h
@@ -141,10 +141,6 @@ 
 	EXTRA_ENV_DFUARGS
 
 /* MMC ENV related defines */
-#ifdef CONFIG_ENV_IS_IN_MMC
-#define CONFIG_SYS_MMC_ENV_DEV		0
-#define CONFIG_SYS_MMC_ENV_PART	1
-#endif
 
 /* Now for the remaining common defines */
 #include <configs/ti_armv7_common.h>
diff --git a/include/configs/apalis-imx8.h b/include/configs/apalis-imx8.h
index 6dad8216e969..ba7f5939aeda 100644
--- a/include/configs/apalis-imx8.h
+++ b/include/configs/apalis-imx8.h
@@ -84,8 +84,6 @@ 
 #define CONFIG_SYS_INIT_SP_ADDR		0x80200000
 
 /* Environment in eMMC, before config block at the end of 1st "boot sector" */
-#define CONFIG_SYS_MMC_ENV_DEV		0	/* USDHC1 eMMC */
-#define CONFIG_SYS_MMC_ENV_PART		1
 
 #define CONFIG_SYS_MMC_IMG_LOAD_PART	1
 
diff --git a/include/configs/apalis-tk1.h b/include/configs/apalis-tk1.h
index 519b3b78238c..e5dad9372f32 100644
--- a/include/configs/apalis-tk1.h
+++ b/include/configs/apalis-tk1.h
@@ -20,8 +20,6 @@ 
 #define FDT_MODULE_V1_0			"apalis"
 
 /* Environment in eMMC, before config block at the end of 1st "boot sector" */
-#define CONFIG_SYS_MMC_ENV_DEV		0
-#define CONFIG_SYS_MMC_ENV_PART		1
 
 /* PCI host support */
 #undef CONFIG_PCI_SCAN_SHOW
diff --git a/include/configs/apalis_imx6.h b/include/configs/apalis_imx6.h
index efd4aa295b93..6aa5682f85cb 100644
--- a/include/configs/apalis_imx6.h
+++ b/include/configs/apalis_imx6.h
@@ -198,8 +198,6 @@ 
 
 #if defined(CONFIG_ENV_IS_IN_MMC)
 /* Environment in eMMC, before config block at the end of 1st "boot sector" */
-#define CONFIG_SYS_MMC_ENV_DEV		0
-#define CONFIG_SYS_MMC_ENV_PART		1
 #endif
 
 #endif	/* __CONFIG_H */
diff --git a/include/configs/apalis_t30.h b/include/configs/apalis_t30.h
index 701b34aa8463..691853815737 100644
--- a/include/configs/apalis_t30.h
+++ b/include/configs/apalis_t30.h
@@ -19,8 +19,6 @@ 
 #define CONFIG_MACH_TYPE		MACH_TYPE_APALIS_T30
 
 /* Environment in eMMC, before config block at the end of 1st "boot sector" */
-#define CONFIG_SYS_MMC_ENV_DEV		0
-#define CONFIG_SYS_MMC_ENV_PART		1
 
 /* PCI networking support */
 #define CONFIG_E1000_NO_NVM
diff --git a/include/configs/apx4devkit.h b/include/configs/apx4devkit.h
index b66069c81a81..9261dd7ba8d8 100644
--- a/include/configs/apx4devkit.h
+++ b/include/configs/apx4devkit.h
@@ -25,9 +25,6 @@ 
 #define CONFIG_ENV_OVERWRITE
 
 /* Environment is in MMC */
-#if defined(CONFIG_CMD_MMC) && defined(CONFIG_ENV_IS_IN_MMC)
-#define CONFIG_SYS_MMC_ENV_DEV		0
-#endif
 
 /* Environment is in NAND */
 #if defined(CONFIG_CMD_NAND) && defined(CONFIG_ENV_IS_IN_NAND)
diff --git a/include/configs/at91-sama5_common.h b/include/configs/at91-sama5_common.h
index 53629743d9d4..ba21149e43ca 100644
--- a/include/configs/at91-sama5_common.h
+++ b/include/configs/at91-sama5_common.h
@@ -25,11 +25,6 @@ 
 #define CONFIG_BOOTP_BOOTFILESIZE
 
 #ifdef CONFIG_SD_BOOT
-
-#ifdef CONFIG_ENV_IS_IN_MMC
-#define CONFIG_SYS_MMC_ENV_DEV		0
-#endif
-
 #define CONFIG_BOOTCOMMAND	"if test ! -n ${dtb_name}; then "	\
 				    "setenv dtb_name at91-${board_name}.dtb; " \
 				"fi; "					\
diff --git a/include/configs/at91sam9260ek.h b/include/configs/at91sam9260ek.h
index e27c276a460c..780bf0cce7a3 100644
--- a/include/configs/at91sam9260ek.h
+++ b/include/configs/at91sam9260ek.h
@@ -129,7 +129,6 @@ 
 #else	/* CONFIG_SYS_USE_MMC */
 /* bootstrap + u-boot + env + linux in mmc */
 /* For FAT system, most cases it should be in the reserved sector */
-#define CONFIG_SYS_MMC_ENV_DEV		0
 
 #define CONFIG_BOOTCOMMAND						\
 	"fatload mmc 0:1 0x22000000 uImage; bootm"
diff --git a/include/configs/at91sam9n12ek.h b/include/configs/at91sam9n12ek.h
index c2d4e485a9d3..aa875fa9b03d 100644
--- a/include/configs/at91sam9n12ek.h
+++ b/include/configs/at91sam9n12ek.h
@@ -98,7 +98,6 @@ 
 
 #ifdef CONFIG_ENV_IS_IN_MMC
 /* Use raw reserved sectors to save environment */
-#define CONFIG_SYS_MMC_ENV_DEV		0
 #else
 /* Use file in FAT file to save environment */
 #endif
diff --git a/include/configs/bcm23550_w1d.h b/include/configs/bcm23550_w1d.h
index e771548aa670..05ada258eacf 100644
--- a/include/configs/bcm23550_w1d.h
+++ b/include/configs/bcm23550_w1d.h
@@ -76,7 +76,6 @@ 
 #define CONFIG_SYS_NS16550_COM1		0x3e000000
 
 /* must fit into GPT:u-boot-env partition */
-#define CONFIG_SYS_MMC_ENV_DEV		0
 
 /* console configuration */
 #define CONFIG_SYS_CBSIZE		1024	/* Console buffer size */
diff --git a/include/configs/bcm28155_ap.h b/include/configs/bcm28155_ap.h
index d807997277ae..c84a5ca2e5e6 100644
--- a/include/configs/bcm28155_ap.h
+++ b/include/configs/bcm28155_ap.h
@@ -75,7 +75,6 @@ 
 #define CONFIG_SYS_NS16550_COM1		0x3e000000
 
 /* must fit into GPT:u-boot-env partition */
-#define CONFIG_SYS_MMC_ENV_DEV		0
 
 /* console configuration */
 #define CONFIG_SYS_CBSIZE		1024	/* Console buffer size */
diff --git a/include/configs/bcm7260.h b/include/configs/bcm7260.h
index 31fd6ec08bba..f72d62ec3541 100644
--- a/include/configs/bcm7260.h
+++ b/include/configs/bcm7260.h
@@ -30,7 +30,5 @@ 
 /*
  * Environment configuration for eMMC.
  */
-#define CONFIG_SYS_MMC_ENV_DEV	0
-#define CONFIG_SYS_MMC_ENV_PART	0
 
 #endif	/* __CONFIG_H */
diff --git a/include/configs/beaver.h b/include/configs/beaver.h
index 1b6ba8c85d24..545e21ad57f8 100644
--- a/include/configs/beaver.h
+++ b/include/configs/beaver.h
@@ -23,8 +23,6 @@ 
 #define CONFIG_MACH_TYPE		MACH_TYPE_BEAVER
 
 /* Environment in eMMC, at the end of 2nd "boot sector" */
-#define CONFIG_SYS_MMC_ENV_DEV		0
-#define CONFIG_SYS_MMC_ENV_PART		2
 
 /* SPI */
 #define CONFIG_TEGRA_SLINK_CTRLS       6
diff --git a/include/configs/brppt1.h b/include/configs/brppt1.h
index 68931c1358e3..8e7c53af9456 100644
--- a/include/configs/brppt1.h
+++ b/include/configs/brppt1.h
@@ -183,10 +183,6 @@  NANDTGTS \
 #if defined(CONFIG_SPI)
 /* SPI Flash */
 /* Environment */
-#elif defined(CONFIG_ENV_IS_IN_MMC)
-#define CONFIG_SYS_MMC_ENV_DEV		1
-#define CONFIG_SYS_MMC_ENV_PART		2
-
 #elif defined(CONFIG_ENV_IS_IN_NAND)
 /* No NAND env support in SPL */
 #define CONFIG_SYS_ENV_SECT_SIZE	CONFIG_ENV_SIZE
diff --git a/include/configs/brxre1.h b/include/configs/brxre1.h
index 3a18aec5d332..d6a7af1a1526 100644
--- a/include/configs/brxre1.h
+++ b/include/configs/brxre1.h
@@ -64,7 +64,5 @@  BUR_COMMON_ENV \
 #define CONFIG_INITRD_TAG
 
 /* Environment */
-#define CONFIG_SYS_MMC_ENV_DEV		1
-#define CONFIG_SYS_MMC_ENV_PART		2
 
 #endif	/* __CONFIG_BRXRE1_H__ */
diff --git a/include/configs/capricorn-common.h b/include/configs/capricorn-common.h
index 38a56e897e82..8151bd8700c1 100644
--- a/include/configs/capricorn-common.h
+++ b/include/configs/capricorn-common.h
@@ -136,8 +136,6 @@ 
 
 /* Environment organisation */
 #define CONFIG_ENV_OVERWRITE
-#define CONFIG_SYS_MMC_ENV_DEV		0	/* USDHC1, eMMC */
-#define CONFIG_SYS_MMC_ENV_PART		2	/* 2nd boot partition */
 
 /* On CCP board, USDHC1 is for eMMC */
 #define CONFIG_MMCROOT			"/dev/mmcblk0p2"  /* eMMC */
diff --git a/include/configs/cardhu.h b/include/configs/cardhu.h
index 7eeadfc9c3d2..17155163d8e3 100644
--- a/include/configs/cardhu.h
+++ b/include/configs/cardhu.h
@@ -27,8 +27,6 @@ 
 #define CONFIG_MACH_TYPE		MACH_TYPE_CARDHU
 
 /* Environment in eMMC, at the end of 2nd "boot sector" */
-#define CONFIG_SYS_MMC_ENV_DEV		0
-#define CONFIG_SYS_MMC_ENV_PART		2
 
 /* SPI */
 #define CONFIG_TEGRA_SLINK_CTRLS       6
diff --git a/include/configs/cei-tk1-som.h b/include/configs/cei-tk1-som.h
index dbebef34e386..12bb03899d9b 100644
--- a/include/configs/cei-tk1-som.h
+++ b/include/configs/cei-tk1-som.h
@@ -23,8 +23,6 @@ 
 #define CONFIG_SYS_NS16550_COM1		NV_PA_APB_UARTD_BASE
 
 /* Environment in eMMC, at the end of 2nd "boot sector" */
-#define CONFIG_SYS_MMC_ENV_DEV		0
-#define CONFIG_SYS_MMC_ENV_PART		2
 
 /* SPI */
 #define CONFIG_SPI_FLASH_SIZE		(4 << 20)
diff --git a/include/configs/cgtqmx6eval.h b/include/configs/cgtqmx6eval.h
index a2cc4f9fa838..26166d359b1d 100644
--- a/include/configs/cgtqmx6eval.h
+++ b/include/configs/cgtqmx6eval.h
@@ -86,7 +86,6 @@ 
 #define CONFIG_MXC_UART_BASE	UART2_BASE
 #define CONSOLE_DEV	"ttymxc1"
 #define CONFIG_MMCROOT		"/dev/mmcblk0p2"
-#define CONFIG_SYS_MMC_ENV_DEV		0
 
 #define CONFIG_EXTRA_ENV_SETTINGS \
 	"script=boot.scr\0" \
@@ -201,8 +200,5 @@ 
 	(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
 
 /* Environment organization */
-#if defined (CONFIG_ENV_IS_IN_MMC)
-#define CONFIG_SYS_MMC_ENV_DEV		0
-#endif
 
 #endif			       /* __CONFIG_CGTQMX6EVAL_H */
diff --git a/include/configs/chiliboard.h b/include/configs/chiliboard.h
index a2d198c5197b..86cac236f96b 100644
--- a/include/configs/chiliboard.h
+++ b/include/configs/chiliboard.h
@@ -161,8 +161,6 @@ 
 
 #if defined(CONFIG_ENV_IS_IN_NAND)
 #define CONFIG_SYS_ENV_SECT_SIZE	CONFIG_SYS_NAND_BLOCK_SIZE
-#else
-#define CONFIG_SYS_MMC_ENV_DEV		0
 #endif
 
 /* Network. */
diff --git a/include/configs/ci20.h b/include/configs/ci20.h
index 67f5bbe9d8c6..1afd2b38eb09 100644
--- a/include/configs/ci20.h
+++ b/include/configs/ci20.h
@@ -39,7 +39,6 @@ 
 #define DM9000_DATA			(CONFIG_DM9000_BASE + 2)
 
 /* Environment */
-#define CONFIG_SYS_MMC_ENV_DEV		0
 #define CONFIG_ENV_OVERWRITE
 
 #define CONFIG_SYS_CBSIZE	1024		/* Console I/O buffer size */
diff --git a/include/configs/clearfog.h b/include/configs/clearfog.h
index 74be2f137851..5441da8c9cdc 100644
--- a/include/configs/clearfog.h
+++ b/include/configs/clearfog.h
@@ -30,7 +30,6 @@ 
 #define CONFIG_ENV_MIN_ENTRIES		128
 
 /* Environment in MMC */
-#define CONFIG_SYS_MMC_ENV_DEV		0
 /*
  * For SD - reserve 1 LBA for MBR + 1M for u-boot image. The MMC/eMMC
  * boot image starts @ LBA-0.
diff --git a/include/configs/colibri-imx8x.h b/include/configs/colibri-imx8x.h
index 8d7222902cd3..e8d654551c62 100644
--- a/include/configs/colibri-imx8x.h
+++ b/include/configs/colibri-imx8x.h
@@ -116,8 +116,6 @@ 
 #define CONFIG_SYS_INIT_SP_ADDR		0x80200000
 
 /* Environment in eMMC, before config block at the end of 1st "boot sector" */
-#define CONFIG_SYS_MMC_ENV_DEV		0	/* USDHC1 eMMC */
-#define CONFIG_SYS_MMC_ENV_PART		1
 
 #define CONFIG_SYS_MMC_IMG_LOAD_PART	1
 
diff --git a/include/configs/colibri_imx6.h b/include/configs/colibri_imx6.h
index dab96f038dc7..1d0278bf2c82 100644
--- a/include/configs/colibri_imx6.h
+++ b/include/configs/colibri_imx6.h
@@ -177,8 +177,6 @@ 
 
 #if defined(CONFIG_ENV_IS_IN_MMC)
 /* Environment in eMMC, before config block at the end of 1st "boot sector" */
-#define CONFIG_SYS_MMC_ENV_DEV		0
-#define CONFIG_SYS_MMC_ENV_PART		1
 #endif
 
 #endif	/* __CONFIG_H */
diff --git a/include/configs/colibri_imx7.h b/include/configs/colibri_imx7.h
index 1afa9373a16b..c6a6173a2177 100644
--- a/include/configs/colibri_imx7.h
+++ b/include/configs/colibri_imx7.h
@@ -197,8 +197,6 @@ 
 
 #if defined(CONFIG_ENV_IS_IN_MMC)
 /* Environment in eMMC, before config block at the end of 1st "boot sector" */
-#define CONFIG_SYS_MMC_ENV_DEV		0
-#define CONFIG_SYS_MMC_ENV_PART		1
 #endif
 
 #ifdef CONFIG_TARGET_COLIBRI_IMX7_NAND
diff --git a/include/configs/colibri_t30.h b/include/configs/colibri_t30.h
index 4e5e89b547d9..85a5c27a37ce 100644
--- a/include/configs/colibri_t30.h
+++ b/include/configs/colibri_t30.h
@@ -21,8 +21,6 @@ 
 #define CONFIG_MACH_TYPE		MACH_TYPE_COLIBRI_T30
 
 /* Environment in eMMC, before config block at the end of 1st "boot sector" */
-#define CONFIG_SYS_MMC_ENV_DEV		0
-#define CONFIG_SYS_MMC_ENV_PART		1
 
 /* General networking support */
 #define CONFIG_TFTP_TSIZE
diff --git a/include/configs/controlcenterd.h b/include/configs/controlcenterd.h
index 512d8e16eee5..8ab8bb9f33c7 100644
--- a/include/configs/controlcenterd.h
+++ b/include/configs/controlcenterd.h
@@ -268,7 +268,6 @@ 
 #if defined(CONFIG_TRAILBLAZER)
 #elif defined(CONFIG_RAMBOOT_SDCARD)
 #define CONFIG_FSL_FIXED_MMC_LOCATION
-#define CONFIG_SYS_MMC_ENV_DEV	0
 #endif
 
 #define CONFIG_SYS_LOAD_ADDR	0x2000000	/* default load address */
diff --git a/include/configs/corenet_ds.h b/include/configs/corenet_ds.h
index d7812bd88631..3570f5b664f0 100644
--- a/include/configs/corenet_ds.h
+++ b/include/configs/corenet_ds.h
@@ -64,7 +64,6 @@ 
 #if defined(CONFIG_SPIFLASH)
 #elif defined(CONFIG_SDCARD)
 #define CONFIG_FSL_FIXED_MMC_LOCATION
-#define CONFIG_SYS_MMC_ENV_DEV          0
 #endif
 
 #define CONFIG_SYS_CLK_FREQ	get_board_sys_clk() /* sysclk for MPC85xx */
diff --git a/include/configs/cyrus.h b/include/configs/cyrus.h
index b587cb8d7732..21e036710bc9 100644
--- a/include/configs/cyrus.h
+++ b/include/configs/cyrus.h
@@ -52,7 +52,6 @@ 
 
 #if defined(CONFIG_SDCARD)
 #define CONFIG_FSL_FIXED_MMC_LOCATION
-#define CONFIG_SYS_MMC_ENV_DEV          0
 #endif
 
 /*
diff --git a/include/configs/dalmore.h b/include/configs/dalmore.h
index 0cfc197142e5..18d9ba1784d9 100644
--- a/include/configs/dalmore.h
+++ b/include/configs/dalmore.h
@@ -20,8 +20,6 @@ 
 #define CONFIG_MACH_TYPE		MACH_TYPE_DALMORE
 
 /* Environment in eMMC, at the end of 2nd "boot sector" */
-#define CONFIG_SYS_MMC_ENV_DEV		0
-#define CONFIG_SYS_MMC_ENV_PART		2
 
 /* SPI */
 #define CONFIG_SPI_FLASH_SIZE          (4 << 20)
diff --git a/include/configs/dart_6ul.h b/include/configs/dart_6ul.h
index d933f79e34e3..b27f71579830 100644
--- a/include/configs/dart_6ul.h
+++ b/include/configs/dart_6ul.h
@@ -42,8 +42,6 @@ 
 /* Environment settings */
 
 /* Environment in SD */
-#define CONFIG_SYS_MMC_ENV_DEV		0
-#define CONFIG_SYS_MMC_ENV_PART		0
 #define MMC_ROOTFS_DEV			0
 #define MMC_ROOTFS_PART			2
 
diff --git a/include/configs/dh_imx6.h b/include/configs/dh_imx6.h
index 5d3187331ff8..bf3afd801648 100644
--- a/include/configs/dh_imx6.h
+++ b/include/configs/dh_imx6.h
@@ -48,7 +48,6 @@ 
 /* MMC Configs */
 #define CONFIG_SYS_FSL_ESDHC_ADDR	0
 #define CONFIG_SYS_FSL_USDHC_NUM	3
-#define CONFIG_SYS_MMC_ENV_DEV		2 /* 1 = SDHC3, 2 = SDHC4 (eMMC) */
 
 /* SATA Configs */
 #define CONFIG_LBA48
diff --git a/include/configs/dra7xx_evm.h b/include/configs/dra7xx_evm.h
index 14cd82f5a3e6..5f7b65fc09e7 100644
--- a/include/configs/dra7xx_evm.h
+++ b/include/configs/dra7xx_evm.h
@@ -20,7 +20,6 @@ 
 
 #ifndef CONFIG_QSPI_BOOT
 /* MMC ENV related defines */
-#define CONFIG_SYS_MMC_ENV_DEV		1	/* SLOT2: eMMC(1) */
 #endif
 
 #if (CONFIG_CONS_INDEX == 1)
diff --git a/include/configs/draak.h b/include/configs/draak.h
index 3248320b9d64..d28cc9d336e3 100644
--- a/include/configs/draak.h
+++ b/include/configs/draak.h
@@ -18,8 +18,6 @@ 
 #define COUNTER_FREQUENCY	0xFE502A	/* 16.66MHz from CPclk */
 
 /* Environment in eMMC, at the end of 2nd "boot sector" */
-#define CONFIG_SYS_MMC_ENV_DEV		0
-#define CONFIG_SYS_MMC_ENV_PART		2
 
 #define CONFIG_CFI_FLASH_USE_WEAK_ACCESSORS
 #define CONFIG_FLASH_SHOW_PROGRESS	45
diff --git a/include/configs/dragonboard410c.h b/include/configs/dragonboard410c.h
index 9362e9322cdb..65537e477824 100644
--- a/include/configs/dragonboard410c.h
+++ b/include/configs/dragonboard410c.h
@@ -79,9 +79,6 @@  REFLASH(dragonboard/u-boot.img, 8)\
 	"pxefile_addr_r=0x90100000\0"\
 	BOOTENV
 
-#define CONFIG_SYS_MMC_ENV_DEV		0	/* mmc0 = emmc, mmc1 = sd */
-#define CONFIG_SYS_MMC_ENV_PART 2 /* Set env partition to BOOT2 partition */
-
 /* Size of malloc() pool */
 #define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + SZ_8M)
 
diff --git a/include/configs/e2220-1170.h b/include/configs/e2220-1170.h
index c4349bda4592..5ed62678ce7b 100644
--- a/include/configs/e2220-1170.h
+++ b/include/configs/e2220-1170.h
@@ -18,8 +18,6 @@ 
 #define CONFIG_TEGRA_ENABLE_UARTA
 
 /* Environment in eMMC, at the end of 2nd "boot sector" */
-#define CONFIG_SYS_MMC_ENV_DEV		0
-#define CONFIG_SYS_MMC_ENV_PART		2
 
 /* SPI */
 #define CONFIG_SPI_FLASH_SIZE		(4 << 20)
diff --git a/include/configs/ebisu.h b/include/configs/ebisu.h
index 521a348435af..06cbb03dc6ae 100644
--- a/include/configs/ebisu.h
+++ b/include/configs/ebisu.h
@@ -21,7 +21,5 @@ 
 #define COUNTER_FREQUENCY	0xFE502A	/* 16.66MHz from CPclk */
 
 /* Environment in eMMC, at the end of 2nd "boot sector" */
-#define CONFIG_SYS_MMC_ENV_DEV		2
-#define CONFIG_SYS_MMC_ENV_PART		2
 
 #endif /* __EBISU_H */
diff --git a/include/configs/edison.h b/include/configs/edison.h
index 3918a9fc1c37..606c656a7272 100644
--- a/include/configs/edison.h
+++ b/include/configs/edison.h
@@ -26,8 +26,6 @@ 
 #define CONFIG_SYS_MALLOC_LEN			(128 * 1024 * 1024)
 
 /* Environment */
-#define CONFIG_SYS_MMC_ENV_DEV			0
-#define CONFIG_SYS_MMC_ENV_PART			0
 
 /* RTC */
 #define CONFIG_SYS_ISA_IO_BASE_ADDRESS	0
diff --git a/include/configs/el6x_common.h b/include/configs/el6x_common.h
index 665550a5ebe6..27e6f1dabe02 100644
--- a/include/configs/el6x_common.h
+++ b/include/configs/el6x_common.h
@@ -88,9 +88,4 @@ 
 
 /* environment organization */
 
-#if defined(CONFIG_ENV_IS_IN_MMC)
-#define CONFIG_SYS_MMC_ENV_DEV		1
-#define CONFIG_SYS_MMC_ENV_PART		2
-#endif
-
 #endif                         /* __EL6Q_COMMON_CONFIG_H */
diff --git a/include/configs/elgin_rv1108.h b/include/configs/elgin_rv1108.h
index aa6c4b09e27e..df04892e5fa2 100644
--- a/include/configs/elgin_rv1108.h
+++ b/include/configs/elgin_rv1108.h
@@ -8,6 +8,4 @@ 
 
 #include <configs/rv1108_common.h>
 
-#define CONFIG_SYS_MMC_ENV_DEV	0
-
 #endif
diff --git a/include/configs/embestmx6boards.h b/include/configs/embestmx6boards.h
index 565cc8818e7b..8148453d931d 100644
--- a/include/configs/embestmx6boards.h
+++ b/include/configs/embestmx6boards.h
@@ -65,7 +65,6 @@ 
 /* RiOTboard */
 #define CONFIG_FDTFILE	"imx6dl-riotboard.dtb"
 #define CONFIG_SYS_FSL_USDHC_NUM	3
-#define CONFIG_SYS_MMC_ENV_DEV		2	/* SDHC4 */
 #elif defined(CONFIG_ENV_IS_IN_SPI_FLASH)
 /* MarSBoard */
 #define CONFIG_FDTFILE	"imx6q-marsboard.dtb"
diff --git a/include/configs/evb_px30.h b/include/configs/evb_px30.h
index e761c7c51960..27201fcfd7cb 100644
--- a/include/configs/evb_px30.h
+++ b/include/configs/evb_px30.h
@@ -8,8 +8,6 @@ 
 
 #include <configs/px30_common.h>
 
-#define CONFIG_SYS_MMC_ENV_DEV 0
-
 #define ROCKCHIP_DEVICE_SETTINGS \
 		"stdout=serial,vidconsole\0" \
 		"stderr=serial,vidconsole\0"
diff --git a/include/configs/evb_px5.h b/include/configs/evb_px5.h
index ed801dd84556..13ddc18b347d 100644
--- a/include/configs/evb_px5.h
+++ b/include/configs/evb_px5.h
@@ -8,6 +8,4 @@ 
 
 #include <configs/rk3368_common.h>
 
-#define CONFIG_SYS_MMC_ENV_DEV 0
-
 #endif
diff --git a/include/configs/evb_rk3128.h b/include/configs/evb_rk3128.h
index bf6c7eaf4c19..768004a43c87 100644
--- a/include/configs/evb_rk3128.h
+++ b/include/configs/evb_rk3128.h
@@ -8,6 +8,4 @@ 
 
 #include <configs/rk3128_common.h>
 
-#define CONFIG_SYS_MMC_ENV_DEV 0
-
 #endif
diff --git a/include/configs/evb_rk3229.h b/include/configs/evb_rk3229.h
index 6a91a82ceb46..77d99d0a42ba 100644
--- a/include/configs/evb_rk3229.h
+++ b/include/configs/evb_rk3229.h
@@ -8,6 +8,4 @@ 
 
 #include <configs/rk322x_common.h>
 
-#define CONFIG_SYS_MMC_ENV_DEV 0
-
 #endif
diff --git a/include/configs/evb_rk3288.h b/include/configs/evb_rk3288.h
index e19fa9021283..053c9032e2da 100644
--- a/include/configs/evb_rk3288.h
+++ b/include/configs/evb_rk3288.h
@@ -13,6 +13,4 @@ 
 
 #include <configs/rk3288_common.h>
 
-#define CONFIG_SYS_MMC_ENV_DEV 0
-
 #endif
diff --git a/include/configs/evb_rk3308.h b/include/configs/evb_rk3308.h
index 0d2cb21ac679..e8893eb7de85 100644
--- a/include/configs/evb_rk3308.h
+++ b/include/configs/evb_rk3308.h
@@ -9,7 +9,6 @@ 
 #include <configs/rk3308_common.h>
 
 #define CONFIG_SUPPORT_EMMC_RPMB
-#define CONFIG_SYS_MMC_ENV_DEV 0
 
 #define ROCKCHIP_DEVICE_SETTINGS \
 			"stdout=serial,vidconsole\0" \
diff --git a/include/configs/evb_rk3328.h b/include/configs/evb_rk3328.h
index 26687e638616..cac613d021a8 100644
--- a/include/configs/evb_rk3328.h
+++ b/include/configs/evb_rk3328.h
@@ -8,8 +8,6 @@ 
 
 #include <configs/rk3328_common.h>
 
-#define CONFIG_SYS_MMC_ENV_DEV 1
-
 #define SDRAM_BANK_SIZE			(2UL << 30)
 
 #endif
diff --git a/include/configs/evb_rk3399.h b/include/configs/evb_rk3399.h
index 2d3db22877da..b7e850370b31 100644
--- a/include/configs/evb_rk3399.h
+++ b/include/configs/evb_rk3399.h
@@ -13,10 +13,6 @@ 
 
 #include <configs/rk3399_common.h>
 
-#if defined(CONFIG_ENV_IS_IN_MMC)
-# define CONFIG_SYS_MMC_ENV_DEV		0
-#endif
-
 #define SDRAM_BANK_SIZE			(2UL << 30)
 
 #endif
diff --git a/include/configs/exynos5-common.h b/include/configs/exynos5-common.h
index dff6a26f3b95..9297fbdc0817 100644
--- a/include/configs/exynos5-common.h
+++ b/include/configs/exynos5-common.h
@@ -72,8 +72,6 @@ 
 
 #define CONFIG_SYS_MONITOR_BASE	0x00000000
 
-#define CONFIG_SYS_MMC_ENV_DEV		0
-
 #define CONFIG_SECURE_BL1_ONLY
 
 /* Secure FW size configuration */
diff --git a/include/configs/firefly-rk3288.h b/include/configs/firefly-rk3288.h
index 9e4a66902b50..df96c32952f3 100644
--- a/include/configs/firefly-rk3288.h
+++ b/include/configs/firefly-rk3288.h
@@ -13,6 +13,4 @@ 
 
 #include <configs/rk3288_common.h>
 
-#define CONFIG_SYS_MMC_ENV_DEV 0
-
 #endif
diff --git a/include/configs/firefly_rk3308.h b/include/configs/firefly_rk3308.h
index 7b8b62fbcb15..3af24930431e 100644
--- a/include/configs/firefly_rk3308.h
+++ b/include/configs/firefly_rk3308.h
@@ -9,7 +9,6 @@ 
 #include <configs/rk3308_common.h>
 
 #define CONFIG_SUPPORT_EMMC_RPMB
-#define CONFIG_SYS_MMC_ENV_DEV 0
 
 #define ROCKCHIP_DEVICE_SETTINGS \
 			"stdout=serial,vidconsole\0" \
diff --git a/include/configs/gru.h b/include/configs/gru.h
index a0d27b6d51a5..be2dc79968c0 100644
--- a/include/configs/gru.h
+++ b/include/configs/gru.h
@@ -13,6 +13,4 @@ 
 
 #include <configs/rk3399_common.h>
 
-#define CONFIG_SYS_MMC_ENV_DEV 0
-
 #endif
diff --git a/include/configs/gw_ventana.h b/include/configs/gw_ventana.h
index 38e8e8e13114..a666d420e4b6 100644
--- a/include/configs/gw_ventana.h
+++ b/include/configs/gw_ventana.h
@@ -146,10 +146,6 @@ 
  */
 
 /* Persistent Environment Config */
-#if defined(CONFIG_ENV_IS_IN_MMC)
-  #define CONFIG_SYS_MMC_ENV_DEV         0
-  #define CONFIG_SYS_MMC_ENV_PART        1
-#endif
 
 /* Environment */
 #define CONFIG_IPADDR             192.168.1.1
diff --git a/include/configs/helios4.h b/include/configs/helios4.h
index 2f4b67025ceb..396870a67f2b 100644
--- a/include/configs/helios4.h
+++ b/include/configs/helios4.h
@@ -30,7 +30,6 @@ 
 #define CONFIG_ENV_MIN_ENTRIES		128
 
 /* Environment in MMC */
-#define CONFIG_SYS_MMC_ENV_DEV		0
 /*
  * For SD - reserve 1 LBA for MBR + 1M for u-boot image. The MMC/eMMC
  * boot image starts @ LBA-0.
diff --git a/include/configs/hikey.h b/include/configs/hikey.h
index 70cd682ca957..a323a0bf69b0 100644
--- a/include/configs/hikey.h
+++ b/include/configs/hikey.h
@@ -80,8 +80,6 @@ 
 				BOOTENV
 
 /* Preserve environment on eMMC */
-#define CONFIG_SYS_MMC_ENV_DEV		0	/* Use eMMC */
-#define CONFIG_SYS_MMC_ENV_PART		2	/* Use Boot1 partition */
 
 /* Monitor Command Prompt */
 #define CONFIG_SYS_CBSIZE		512	/* Console I/O Buffer Size */
diff --git a/include/configs/imx6-engicam.h b/include/configs/imx6-engicam.h
index 4c7a0cb0bb71..0786d6605204 100644
--- a/include/configs/imx6-engicam.h
+++ b/include/configs/imx6-engicam.h
@@ -139,9 +139,6 @@ 
 #endif
 
 /* MMC */
-#ifdef CONFIG_FSL_USDHC
-# define CONFIG_SYS_MMC_ENV_DEV		0
-#endif
 
 /* NAND */
 #ifdef CONFIG_NAND_MXS
diff --git a/include/configs/imx6dl-mamoj.h b/include/configs/imx6dl-mamoj.h
index d70c6dbc23ad..ee91b7a4b42c 100644
--- a/include/configs/imx6dl-mamoj.h
+++ b/include/configs/imx6dl-mamoj.h
@@ -46,7 +46,6 @@ 
 #define CONFIG_MXC_UART_BASE		UART3_BASE
 
 /* MMC */
-#define CONFIG_SYS_MMC_ENV_DEV		2
 
 /* Ethernet */
 #define CONFIG_FEC_MXC_PHYADDR		1
diff --git a/include/configs/imx8mm_beacon.h b/include/configs/imx8mm_beacon.h
index ce3ba7492435..93a1f7720703 100644
--- a/include/configs/imx8mm_beacon.h
+++ b/include/configs/imx8mm_beacon.h
@@ -108,7 +108,6 @@ 
 	(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
 
 #define CONFIG_ENV_OVERWRITE
-#define CONFIG_SYS_MMC_ENV_DEV	1   /* USDHC2 */
 
 /* Size of malloc() pool */
 #define CONFIG_SYS_MALLOC_LEN		SZ_32M
diff --git a/include/configs/imx8mm_evk.h b/include/configs/imx8mm_evk.h
index d1c0e0ec2ed6..ccfcbaccdbfc 100644
--- a/include/configs/imx8mm_evk.h
+++ b/include/configs/imx8mm_evk.h
@@ -111,7 +111,6 @@ 
 	(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
 
 #define CONFIG_ENV_OVERWRITE
-#define CONFIG_SYS_MMC_ENV_DEV		1   /* USDHC2 */
 #define CONFIG_MMCROOT			"/dev/mmcblk1p2"  /* USDHC2 */
 
 /* Size of malloc() pool */
diff --git a/include/configs/imx8mn_evk.h b/include/configs/imx8mn_evk.h
index 4350b5a62aff..919f71f31a46 100644
--- a/include/configs/imx8mn_evk.h
+++ b/include/configs/imx8mn_evk.h
@@ -113,7 +113,6 @@ 
 	(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
 
 #define CONFIG_ENV_OVERWRITE
-#define CONFIG_SYS_MMC_ENV_DEV		0   /* USDHC2 */
 #define CONFIG_MMCROOT			"/dev/mmcblk1p2"  /* USDHC2 */
 
 /* Size of malloc() pool */
diff --git a/include/configs/imx8mp_evk.h b/include/configs/imx8mp_evk.h
index 9c13235982c6..b6b85b83272e 100644
--- a/include/configs/imx8mp_evk.h
+++ b/include/configs/imx8mp_evk.h
@@ -121,7 +121,6 @@ 
 	(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
 
 #define CONFIG_ENV_OVERWRITE
-#define CONFIG_SYS_MMC_ENV_DEV		1   /* USDHC2 */
 #define CONFIG_MMCROOT			"/dev/mmcblk1p2"  /* USDHC2 */
 
 /* Size of malloc() pool */
diff --git a/include/configs/imx8mq_evk.h b/include/configs/imx8mq_evk.h
index 366577857ab2..30c652f79588 100644
--- a/include/configs/imx8mq_evk.h
+++ b/include/configs/imx8mq_evk.h
@@ -163,7 +163,6 @@ 
 	(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
 
 #define CONFIG_ENV_OVERWRITE
-#define CONFIG_SYS_MMC_ENV_DEV		1   /* USDHC2 */
 #define CONFIG_MMCROOT			"/dev/mmcblk1p2"  /* USDHC2 */
 
 /* Size of malloc() pool */
diff --git a/include/configs/imx8mq_phanbell.h b/include/configs/imx8mq_phanbell.h
index 9c83e1b9f84f..7d3d397c7515 100644
--- a/include/configs/imx8mq_phanbell.h
+++ b/include/configs/imx8mq_phanbell.h
@@ -155,7 +155,6 @@ 
 	(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
 
 #define CONFIG_ENV_OVERWRITE
-#define CONFIG_SYS_MMC_ENV_DEV		1   /* USDHC2 */
 #define CONFIG_MMCROOT			"/dev/mmcblk1p2"  /* USDHC2 */
 
 /* Size of malloc() pool */
diff --git a/include/configs/imx8qm_mek.h b/include/configs/imx8qm_mek.h
index 1864374a4fc8..ae2f7e59ad00 100644
--- a/include/configs/imx8qm_mek.h
+++ b/include/configs/imx8qm_mek.h
@@ -155,12 +155,10 @@ 
 #define CONFIG_SYS_INIT_SP_ADDR         0x80200000
 
 /* Default environment is in SD */
-#define CONFIG_SYS_MMC_ENV_PART		0	/* user area */
 
 #define CONFIG_SYS_MMC_IMG_LOAD_PART	1
 
 /* On LPDDR4 board, USDHC1 is for eMMC, USDHC2 is for SD on CPU board */
-#define CONFIG_SYS_MMC_ENV_DEV		1   /* USDHC2 */
 #define CONFIG_MMCROOT			"/dev/mmcblk1p2"  /* USDHC2 */
 #define CONFIG_SYS_FSL_USDHC_NUM	2
 
diff --git a/include/configs/imx8qm_rom7720.h b/include/configs/imx8qm_rom7720.h
index 5621ba8232da..c9dc76d7a34b 100644
--- a/include/configs/imx8qm_rom7720.h
+++ b/include/configs/imx8qm_rom7720.h
@@ -137,8 +137,6 @@ 
 #define CONFIG_ENV_SPI_CS	CONFIG_SF_DEFAULT_CS
 #define CONFIG_ENV_SPI_MODE	CONFIG_SF_DEFAULT_MODE
 #define CONFIG_ENV_SPI_MAX_HZ	CONFIG_SF_DEFAULT_SPEED
-#else
-#define CONFIG_SYS_MMC_ENV_PART		0	/* user area */
 #endif
 
 #define CONFIG_SYS_MMC_IMG_LOAD_PART	1
@@ -147,7 +145,6 @@ 
  * USDHC3 is for SD on base board On DDR4 board, USDHC1 is mux for NAND,
  * USDHC2 is for SD, USDHC3 is for SD on base board
  */
-#define CONFIG_SYS_MMC_ENV_DEV		2   /* USDHC3 */
 #define CONFIG_MMCROOT			"/dev/mmcblk2p2"  /* USDHC3 */
 #define CONFIG_SYS_FSL_USDHC_NUM	3
 
diff --git a/include/configs/imx8qxp_mek.h b/include/configs/imx8qxp_mek.h
index 5fdb67f0ece6..f2eb8a692e31 100644
--- a/include/configs/imx8qxp_mek.h
+++ b/include/configs/imx8qxp_mek.h
@@ -154,12 +154,10 @@ 
 #define CONFIG_SYS_INIT_SP_ADDR         0x80200000
 
 /* Default environment is in SD */
-#define CONFIG_SYS_MMC_ENV_PART		0	/* user area */
 
 #define CONFIG_SYS_MMC_IMG_LOAD_PART	1
 
 /* On LPDDR4 board, USDHC1 is for eMMC, USDHC2 is for SD on CPU board */
-#define CONFIG_SYS_MMC_ENV_DEV		1   /* USDHC2 */
 #define CONFIG_MMCROOT			"/dev/mmcblk1p2"  /* USDHC2 */
 #define CONFIG_SYS_FSL_USDHC_NUM	2
 
diff --git a/include/configs/imxrt1020-evk.h b/include/configs/imxrt1020-evk.h
index 8e54565f1af8..4fb44774b0c1 100644
--- a/include/configs/imxrt1020-evk.h
+++ b/include/configs/imxrt1020-evk.h
@@ -28,8 +28,6 @@ 
 #define DMAMEM_BASE			(PHYS_SDRAM + PHYS_SDRAM_SIZE - \
 					 DMAMEM_SZ_ALL)
 
-#define CONFIG_SYS_MMC_ENV_DEV		0   /* USDHC1 */
-
 /*
  * Configuration of the external SDRAM memory
  */
diff --git a/include/configs/imxrt1050-evk.h b/include/configs/imxrt1050-evk.h
index 3a6b972d9ac1..4fbcda9581c2 100644
--- a/include/configs/imxrt1050-evk.h
+++ b/include/configs/imxrt1050-evk.h
@@ -28,8 +28,6 @@ 
 #define DMAMEM_BASE			(PHYS_SDRAM + PHYS_SDRAM_SIZE - \
 					 DMAMEM_SZ_ALL)
 
-#define CONFIG_SYS_MMC_ENV_DEV		0   /* USDHC1 */
-
 #ifdef CONFIG_DM_VIDEO
 #define CONFIG_VIDEO_MXS
 #define CONFIG_VIDEO_LOGO
diff --git a/include/configs/j721e_evm.h b/include/configs/j721e_evm.h
index 7488b661f53a..6f1ad8bbf7bc 100644
--- a/include/configs/j721e_evm.h
+++ b/include/configs/j721e_evm.h
@@ -152,9 +152,5 @@ 
 #include <configs/ti_armv7_common.h>
 
 /* MMC ENV related defines */
-#ifdef CONFIG_ENV_IS_IN_MMC
-#define CONFIG_SYS_MMC_ENV_DEV		0
-#define CONFIG_SYS_MMC_ENV_PART	1
-#endif
 
 #endif /* __CONFIG_J721E_EVM_H */
diff --git a/include/configs/jetson-tk1.h b/include/configs/jetson-tk1.h
index 98248876e8eb..a3c385b6e22a 100644
--- a/include/configs/jetson-tk1.h
+++ b/include/configs/jetson-tk1.h
@@ -19,8 +19,6 @@ 
 #define CONFIG_SYS_NS16550_COM1		NV_PA_APB_UARTD_BASE
 
 /* Environment in eMMC, at the end of 2nd "boot sector" */
-#define CONFIG_SYS_MMC_ENV_DEV		0
-#define CONFIG_SYS_MMC_ENV_PART		2
 
 /* SPI */
 #define CONFIG_SPI_FLASH_SIZE		(4 << 20)
diff --git a/include/configs/kp_imx53.h b/include/configs/kp_imx53.h
index 5e2af76c6e4b..b755f943aa05 100644
--- a/include/configs/kp_imx53.h
+++ b/include/configs/kp_imx53.h
@@ -97,6 +97,5 @@ 
 	(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
 
 /* environment organization */
-#define CONFIG_SYS_MMC_ENV_DEV 0
 
 #endif				/* __CONFIG_H_ */
diff --git a/include/configs/kp_imx6q_tpc.h b/include/configs/kp_imx6q_tpc.h
index 0f0fe63f4fbf..6485527bd00a 100644
--- a/include/configs/kp_imx6q_tpc.h
+++ b/include/configs/kp_imx6q_tpc.h
@@ -27,8 +27,6 @@ 
 /* FEC ethernet */
 #define CONFIG_ARP_TIMEOUT		200UL
 
-#define CONFIG_SYS_MMC_ENV_DEV		1 /* 0 = SDHC2, 1 = SDHC4 (eMMC) */
-
 /* USB Configs */
 #ifdef CONFIG_CMD_USB
 #define CONFIG_EHCI_HCD_INIT_AFTER_RESET
diff --git a/include/configs/kylin_rk3036.h b/include/configs/kylin_rk3036.h
index 1ef7633633fe..75fc03f14723 100644
--- a/include/configs/kylin_rk3036.h
+++ b/include/configs/kylin_rk3036.h
@@ -12,8 +12,6 @@ 
 #ifndef CONFIG_SPL_BUILD
 
 /* Store env in emmc */
-#define CONFIG_SYS_MMC_ENV_DEV		0 /* emmc */
-#define CONFIG_SYS_MMC_ENV_PART		0 /* user area */
 
 #endif
 
diff --git a/include/configs/lion_rk3368.h b/include/configs/lion_rk3368.h
index cae0f1ed29da..c5b78f9c896f 100644
--- a/include/configs/lion_rk3368.h
+++ b/include/configs/lion_rk3368.h
@@ -8,7 +8,6 @@ 
 
 #include <configs/rk3368_common.h>
 
-#define CONFIG_SYS_MMC_ENV_DEV		0
 #define KERNEL_LOAD_ADDR		0x280000
 #define DTB_LOAD_ADDR			0x5600000
 #define INITRD_LOAD_ADDR		0x5bf0000
diff --git a/include/configs/liteboard.h b/include/configs/liteboard.h
index 2dcd4db28cb0..db5e6fc133b3 100644
--- a/include/configs/liteboard.h
+++ b/include/configs/liteboard.h
@@ -121,8 +121,6 @@ 
 	(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
 
 /* FLASH and environment organization */
-#define CONFIG_SYS_MMC_ENV_DEV		0
-#define CONFIG_SYS_MMC_ENV_PART		0
 #define CONFIG_MMCROOT			"/dev/mmcblk0p2"
 
 /* USB Configs */
diff --git a/include/configs/ls1021aiot.h b/include/configs/ls1021aiot.h
index b0a150dbfb14..59e68dfd4981 100644
--- a/include/configs/ls1021aiot.h
+++ b/include/configs/ls1021aiot.h
@@ -220,10 +220,6 @@ 
 
 #define CONFIG_ENV_OVERWRITE
 
-#if defined(CONFIG_SD_BOOT)
-#define CONFIG_SYS_MMC_ENV_DEV	0
-#endif
-
 #define CONFIG_OF_BOARD_SETUP
 #define CONFIG_OF_STDOUT_VIA_ALIAS
 
diff --git a/include/configs/ls1021aqds.h b/include/configs/ls1021aqds.h
index 18800ea07aef..f1192ac438af 100644
--- a/include/configs/ls1021aqds.h
+++ b/include/configs/ls1021aqds.h
@@ -474,10 +474,6 @@  unsigned long get_board_ddr_clk(void);
  */
 #define CONFIG_ENV_OVERWRITE
 
-#if defined(CONFIG_SD_BOOT)
-#define CONFIG_SYS_MMC_ENV_DEV		0
-#endif
-
 #include <asm/fsl_secure_boot.h>
 #define CONFIG_SYS_BOOTM_LEN	(64 << 20) /* Increase max gunzip size */
 
diff --git a/include/configs/ls1021atsn.h b/include/configs/ls1021atsn.h
index 72aed8fed61c..84aab7f3bba4 100644
--- a/include/configs/ls1021atsn.h
+++ b/include/configs/ls1021atsn.h
@@ -238,10 +238,6 @@ 
 /* Environment */
 #define CONFIG_ENV_OVERWRITE
 
-#if defined(CONFIG_SD_BOOT)
-#define CONFIG_SYS_MMC_ENV_DEV		0
-#endif
-
 #define CONFIG_SYS_BOOTM_LEN		0x8000000 /* 128 MB */
 
 #endif
diff --git a/include/configs/ls1021atwr.h b/include/configs/ls1021atwr.h
index 6f7d051bd8ac..0a3f8b6144ee 100644
--- a/include/configs/ls1021atwr.h
+++ b/include/configs/ls1021atwr.h
@@ -447,10 +447,6 @@ 
  */
 #define CONFIG_ENV_OVERWRITE
 
-#if defined(CONFIG_SD_BOOT)
-#define CONFIG_SYS_MMC_ENV_DEV		0
-#endif
-
 #include <asm/fsl_secure_boot.h>
 #define CONFIG_SYS_BOOTM_LEN	(64 << 20) /* Increase max gunzip size */
 
diff --git a/include/configs/ls1028a_common.h b/include/configs/ls1028a_common.h
index d184673a71b5..8e4825b0882a 100644
--- a/include/configs/ls1028a_common.h
+++ b/include/configs/ls1028a_common.h
@@ -95,7 +95,6 @@ 
 #define CONFIG_SYS_FSL_MMC_HAS_CAPBLT_VS33
 #endif
 
-#define CONFIG_SYS_MMC_ENV_DEV         0
 #define OCRAM_NONSECURE_SIZE		0x00010000
 #define CONFIG_SYS_FSL_QSPI_BASE	0x20000000
 
diff --git a/include/configs/ls1043aqds.h b/include/configs/ls1043aqds.h
index 46baeb0d0dd5..7dc81c94d71f 100644
--- a/include/configs/ls1043aqds.h
+++ b/include/configs/ls1043aqds.h
@@ -396,15 +396,6 @@  unsigned long get_board_ddr_clk(void);
  */
 #define CONFIG_ENV_OVERWRITE
 
-#ifdef CONFIG_TFABOOT
-#define CONFIG_SYS_MMC_ENV_DEV		0
-#else
-#ifdef CONFIG_NAND_BOOT
-#elif defined(CONFIG_SD_BOOT)
-#define CONFIG_SYS_MMC_ENV_DEV		0
-#endif
-#endif
-
 #define CONFIG_CMDLINE_TAG
 
 #include <asm/fsl_secure_boot.h>
diff --git a/include/configs/ls1043ardb.h b/include/configs/ls1043ardb.h
index bfaa574fc959..d48b38a3862c 100644
--- a/include/configs/ls1043ardb.h
+++ b/include/configs/ls1043ardb.h
@@ -244,15 +244,6 @@ 
 #define CONFIG_ENV_OVERWRITE
 #endif
 
-#ifdef CONFIG_TFABOOT
-#define CONFIG_SYS_MMC_ENV_DEV		0
-#else
-#if defined(CONFIG_NAND_BOOT)
-#elif defined(CONFIG_SD_BOOT)
-#define CONFIG_SYS_MMC_ENV_DEV		0
-#endif
-#endif
-
 /* FMan */
 #ifndef SPL_NO_FMAN
 #define AQR105_IRQ_MASK			0x40000000
diff --git a/include/configs/ls1046afrwy.h b/include/configs/ls1046afrwy.h
index 44e7fc3a72c3..b75aedc0932c 100644
--- a/include/configs/ls1046afrwy.h
+++ b/include/configs/ls1046afrwy.h
@@ -96,7 +96,6 @@ 
 /*
  * Environment
  */
-#define CONFIG_SYS_MMC_ENV_DEV		0
 #define CONFIG_SYS_FSL_QSPI_BASE	0x40000000
 
 #ifndef CONFIG_SPL_BUILD
diff --git a/include/configs/ls1046aqds.h b/include/configs/ls1046aqds.h
index 969d2c540baf..9102c812b5bc 100644
--- a/include/configs/ls1046aqds.h
+++ b/include/configs/ls1046aqds.h
@@ -409,7 +409,6 @@  unsigned long get_board_ddr_clk(void);
 /*
  * Environment
  */
-#define CONFIG_SYS_MMC_ENV_DEV		0
 
 #define CONFIG_CMDLINE_TAG
 
diff --git a/include/configs/ls1046ardb.h b/include/configs/ls1046ardb.h
index fe8108dae037..dddaa2541718 100644
--- a/include/configs/ls1046ardb.h
+++ b/include/configs/ls1046ardb.h
@@ -153,7 +153,6 @@ 
 /*
  * Environment
  */
-#define CONFIG_SYS_MMC_ENV_DEV		0
 #define CONFIG_SYS_FSL_QSPI_BASE        0x40000000
 
 #define AQR105_IRQ_MASK			0x80000000
diff --git a/include/configs/ls1088aqds.h b/include/configs/ls1088aqds.h
index 1e9e6a8f96ea..b92ec14c6917 100644
--- a/include/configs/ls1088aqds.h
+++ b/include/configs/ls1088aqds.h
@@ -15,14 +15,7 @@  unsigned long get_board_ddr_clk(void);
 #endif
 
 #ifdef CONFIG_TFABOOT
-#define CONFIG_SYS_MMC_ENV_DEV		0
-
 #define CONFIG_MISC_INIT_R
-#else
-#if defined(CONFIG_QSPI_BOOT)
-#elif defined(CONFIG_SD_BOOT)
-#define CONFIG_SYS_MMC_ENV_DEV		0
-#endif
 #endif
 
 #if defined(CONFIG_QSPI_BOOT) || defined(CONFIG_SD_BOOT_QSPI)
diff --git a/include/configs/ls1088ardb.h b/include/configs/ls1088ardb.h
index 16e0486d4039..5bb321c20e30 100644
--- a/include/configs/ls1088ardb.h
+++ b/include/configs/ls1088ardb.h
@@ -8,8 +8,6 @@ 
 
 #include "ls1088a_common.h"
 
-#define CONFIG_SYS_MMC_ENV_DEV		0
-
 #if defined(CONFIG_TFABOOT) || \
 	defined(CONFIG_QSPI_BOOT) || defined(CONFIG_SD_BOOT_QSPI)
 #ifndef CONFIG_SPL_BUILD
diff --git a/include/configs/ls2080aqds.h b/include/configs/ls2080aqds.h
index 751325ad6998..9e174afb92ed 100644
--- a/include/configs/ls2080aqds.h
+++ b/include/configs/ls2080aqds.h
@@ -56,10 +56,6 @@  unsigned long get_board_ddr_clk(void);
 #define CONFIG_SYS_SCSI_MAX_DEVICE		(CONFIG_SYS_SCSI_MAX_SCSI_ID * \
 						CONFIG_SYS_SCSI_MAX_LUN)
 
-#ifdef CONFIG_TFABOOT
-#define CONFIG_SYS_MMC_ENV_DEV		0
-#endif
-
 #define CONFIG_SYS_NOR0_CSPR_EXT	(0x0)
 #define CONFIG_SYS_NOR_AMASK		IFC_AMASK(128*1024*1024)
 #define CONFIG_SYS_NOR_AMASK_EARLY	IFC_AMASK(64*1024*1024)
@@ -227,8 +223,6 @@  unsigned long get_board_ddr_clk(void);
 #define CONFIG_SPL_PAD_TO		0x20000
 #define CONFIG_SYS_NAND_U_BOOT_OFFS	(256 * 1024)
 #define CONFIG_SYS_NAND_U_BOOT_SIZE	(640 * 1024)
-#elif defined(CONFIG_SD_BOOT)
-#define CONFIG_SYS_MMC_ENV_DEV		0
 #endif
 #else
 #define CONFIG_SYS_CSPR0_EXT		CONFIG_SYS_NOR0_CSPR_EXT
diff --git a/include/configs/ls2080ardb.h b/include/configs/ls2080ardb.h
index 006a4c97fb1b..b7a7dc0a64a7 100644
--- a/include/configs/ls2080ardb.h
+++ b/include/configs/ls2080ardb.h
@@ -70,9 +70,6 @@  unsigned long get_board_sys_clk(void);
 #define CONFIG_SYS_SCSI_MAX_LUN			1
 #define CONFIG_SYS_SCSI_MAX_DEVICE		(CONFIG_SYS_SCSI_MAX_SCSI_ID * \
 						CONFIG_SYS_SCSI_MAX_LUN)
-#ifdef CONFIG_TFABOOT
-#define CONFIG_SYS_MMC_ENV_DEV         0
-#endif
 
 #if !defined(CONFIG_FSL_QSPI) || defined(CONFIG_TFABOOT)
 
diff --git a/include/configs/lx2160a_common.h b/include/configs/lx2160a_common.h
index 9bc287f7aa43..697cd5d83bf3 100644
--- a/include/configs/lx2160a_common.h
+++ b/include/configs/lx2160a_common.h
@@ -170,8 +170,6 @@  unsigned long get_board_ddr_clk(void);
 #define CONFIG_HWCONFIG
 #define HWCONFIG_BUFFER_SIZE		128
 
-#define CONFIG_SYS_MMC_ENV_DEV          0
-
 /* Allow to overwrite serial and ethaddr */
 #define CONFIG_ENV_OVERWRITE
 
diff --git a/include/configs/meerkat96.h b/include/configs/meerkat96.h
index 33172a6b97a9..f43a8415e1aa 100644
--- a/include/configs/meerkat96.h
+++ b/include/configs/meerkat96.h
@@ -33,8 +33,6 @@ 
 	(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
 
 /* Environment configs */
-#define CONFIG_SYS_MMC_ENV_DEV		0
-#define CONFIG_SYS_MMC_ENV_PART		0
 
 /* USB configs */
 #define CONFIG_EHCI_HCD_INIT_AFTER_RESET
diff --git a/include/configs/meson64_android.h b/include/configs/meson64_android.h
index a4d9779667f4..8fff915b50a4 100644
--- a/include/configs/meson64_android.h
+++ b/include/configs/meson64_android.h
@@ -9,9 +9,6 @@ 
 #ifndef __MESON64_ANDROID_CONFIG_H
 #define __MESON64_ANDROID_CONFIG_H
 
-#define CONFIG_SYS_MMC_ENV_DEV	2
-#define CONFIG_SYS_MMC_ENV_PART	1
-
 
 #define BOOTENV_DEV_FASTBOOT(devtypeu, devtypel, instance) \
 	"bootcmd_fastboot=" \
diff --git a/include/configs/miqi_rk3288.h b/include/configs/miqi_rk3288.h
index e19fa9021283..053c9032e2da 100644
--- a/include/configs/miqi_rk3288.h
+++ b/include/configs/miqi_rk3288.h
@@ -13,6 +13,4 @@ 
 
 #include <configs/rk3288_common.h>
 
-#define CONFIG_SYS_MMC_ENV_DEV 0
-
 #endif
diff --git a/include/configs/mt7622.h b/include/configs/mt7622.h
index dfd506ed245a..09e038c631ea 100644
--- a/include/configs/mt7622.h
+++ b/include/configs/mt7622.h
@@ -23,8 +23,6 @@ 
 /* Allow to overwrite serial and ethaddr */
 #define CONFIG_ENV_OVERWRITE
 
-#define CONFIG_SYS_MMC_ENV_DEV 0
-
 /* Uboot definition */
 #define CONFIG_SYS_UBOOT_BASE                   CONFIG_SYS_TEXT_BASE
 
diff --git a/include/configs/mt7623.h b/include/configs/mt7623.h
index fe436cca3891..f415bff4e970 100644
--- a/include/configs/mt7623.h
+++ b/include/configs/mt7623.h
@@ -57,8 +57,6 @@ 
 #define CONFIG_IPADDR			192.168.1.1
 #define CONFIG_SERVERIP			192.168.1.2
 
-#define CONFIG_SYS_MMC_ENV_DEV		0
-
 #ifdef CONFIG_DISTRO_DEFAULTS
 
 #define BOOT_TARGET_DEVICES(func)	\
diff --git a/include/configs/mt8512.h b/include/configs/mt8512.h
index 253a54332cbb..22e4c8f68817 100644
--- a/include/configs/mt8512.h
+++ b/include/configs/mt8512.h
@@ -31,7 +31,6 @@ 
 
 /* ENV Setting */
 #if defined(CONFIG_MMC_MTK)
-#define CONFIG_SYS_MMC_ENV_DEV			0
 #define CONFIG_ENV_OVERWRITE
 
 /* MMC offset in block unit,and block size is 0x200 */
diff --git a/include/configs/mt8518.h b/include/configs/mt8518.h
index 276fbc285f81..c80d567e9de7 100644
--- a/include/configs/mt8518.h
+++ b/include/configs/mt8518.h
@@ -34,7 +34,6 @@ 
 
 /* ENV Setting */
 #if defined(CONFIG_MMC_MTK)
-#define CONFIG_SYS_MMC_ENV_DEV			0
 #define CONFIG_ENV_OVERWRITE
 
 /* MMC offset in block unit,and block size is 0x200 */
diff --git a/include/configs/mvebu_armada-8k.h b/include/configs/mvebu_armada-8k.h
index 19b5b5b386e2..c1c2a003aa4c 100644
--- a/include/configs/mvebu_armada-8k.h
+++ b/include/configs/mvebu_armada-8k.h
@@ -46,7 +46,6 @@ 
 #define CONFIG_SYS_INIT_SP_ADDR         (CONFIG_SYS_TEXT_BASE + 0xFF0000)
 
 /* When runtime detection fails this is the default */
-#define CONFIG_SYS_MMC_ENV_DEV		0
 
 #define CONFIG_SYS_MAX_NAND_DEVICE	1
 #define CONFIG_SYS_NAND_MAX_CHIPS	1
diff --git a/include/configs/mx23_olinuxino.h b/include/configs/mx23_olinuxino.h
index 1f55e9209191..795c5f1b472e 100644
--- a/include/configs/mx23_olinuxino.h
+++ b/include/configs/mx23_olinuxino.h
@@ -19,9 +19,6 @@ 
 #define CONFIG_ENV_OVERWRITE
 
 /* Environment is in MMC */
-#if defined(CONFIG_CMD_MMC) && defined(CONFIG_ENV_IS_IN_MMC)
-#define CONFIG_SYS_MMC_ENV_DEV	0
-#endif
 
 /* Status LED */
 
diff --git a/include/configs/mx23evk.h b/include/configs/mx23evk.h
index 595727aa3071..cd963216f2b0 100644
--- a/include/configs/mx23evk.h
+++ b/include/configs/mx23evk.h
@@ -22,9 +22,6 @@ 
 #define CONFIG_ENV_OVERWRITE
 
 /* Environment is in MMC */
-#if defined(CONFIG_CMD_MMC) && defined(CONFIG_ENV_IS_IN_MMC)
-#define CONFIG_SYS_MMC_ENV_DEV	0
-#endif
 
 /* USB */
 #ifdef	CONFIG_CMD_USB
diff --git a/include/configs/mx25pdk.h b/include/configs/mx25pdk.h
index c114ec78e179..11249ed88cd9 100644
--- a/include/configs/mx25pdk.h
+++ b/include/configs/mx25pdk.h
@@ -46,7 +46,6 @@ 
 #define CONFIG_MXC_UART_BASE	UART1_BASE
 
 /* No NOR flash present */
-#define CONFIG_SYS_MMC_ENV_DEV		0
 
 /* U-Boot general configuration */
 #define CONFIG_SYS_CBSIZE	1024	/* Console I/O Buffer Size  */
diff --git a/include/configs/mx28evk.h b/include/configs/mx28evk.h
index 15b64ee03eca..2b58f939d064 100644
--- a/include/configs/mx28evk.h
+++ b/include/configs/mx28evk.h
@@ -22,9 +22,6 @@ 
 #define CONFIG_ENV_OVERWRITE
 
 /* Environment is in MMC */
-#if defined(CONFIG_CMD_MMC) && defined(CONFIG_ENV_IS_IN_MMC)
-#define CONFIG_SYS_MMC_ENV_DEV		0
-#endif
 
 /* Environment is in NAND */
 #if defined(CONFIG_CMD_NAND) && defined(CONFIG_ENV_IS_IN_NAND)
diff --git a/include/configs/mx51evk.h b/include/configs/mx51evk.h
index e99dcd2aa19a..93a6f15e4d1f 100644
--- a/include/configs/mx51evk.h
+++ b/include/configs/mx51evk.h
@@ -191,6 +191,5 @@ 
  * write the direct value here
  */
 #define CONFIG_BOARD_SIZE_LIMIT		785408
-#define CONFIG_SYS_MMC_ENV_DEV 0
 
 #endif
diff --git a/include/configs/mx53ard.h b/include/configs/mx53ard.h
index eb6aa0cda0cc..d6d6bdf13a93 100644
--- a/include/configs/mx53ard.h
+++ b/include/configs/mx53ard.h
@@ -164,7 +164,6 @@ 
 	(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
 
 /* environment organization */
-#define CONFIG_SYS_MMC_ENV_DEV	0
 
 #define MX53ARD_CS1GCR1		(CSEN | DSZ(2))
 #define MX53ARD_CS1RCR1		(RCSN(2) | OEN (1) | RWSC(22))
diff --git a/include/configs/mx53cx9020.h b/include/configs/mx53cx9020.h
index e0210047ff5e..e88384827b75 100644
--- a/include/configs/mx53cx9020.h
+++ b/include/configs/mx53cx9020.h
@@ -94,7 +94,6 @@ 
 	(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
 
 /* environment organization */
-#define CONFIG_SYS_MMC_ENV_DEV 0
 
 /* Framebuffer and LCD */
 #define CONFIG_IMX_VIDEO_SKIP
diff --git a/include/configs/mx53evk.h b/include/configs/mx53evk.h
index 19f8408e4527..c25a85963e96 100644
--- a/include/configs/mx53evk.h
+++ b/include/configs/mx53evk.h
@@ -115,6 +115,5 @@ 
 	(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
 
 /* environment organization */
-#define CONFIG_SYS_MMC_ENV_DEV 0
 
 #endif				/* __CONFIG_H */
diff --git a/include/configs/mx53loco.h b/include/configs/mx53loco.h
index b19a8492116b..93ee3a0a106f 100644
--- a/include/configs/mx53loco.h
+++ b/include/configs/mx53loco.h
@@ -170,7 +170,6 @@ 
  * write the direct value here
  */
 #define CONFIG_BOARD_SIZE_LIMIT		785408
-#define CONFIG_SYS_MMC_ENV_DEV 0
 
 #ifdef CONFIG_CMD_SATA
 	#define CONFIG_SYS_SATA_MAX_DEVICE      1
diff --git a/include/configs/mx53ppd.h b/include/configs/mx53ppd.h
index 8c7d1395d087..e71a73bf803b 100644
--- a/include/configs/mx53ppd.h
+++ b/include/configs/mx53ppd.h
@@ -140,7 +140,6 @@ 
 	(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
 
 /* FLASH and environment organization */
-#define CONFIG_SYS_MMC_ENV_DEV 0
 
 #define CONFIG_FSL_IIM
 
diff --git a/include/configs/mx53smd.h b/include/configs/mx53smd.h
index a8d50507cb20..03f8321b2a22 100644
--- a/include/configs/mx53smd.h
+++ b/include/configs/mx53smd.h
@@ -110,6 +110,5 @@ 
 	(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
 
 /* environment organization */
-#define CONFIG_SYS_MMC_ENV_DEV 0
 
 #endif				/* __CONFIG_H */
diff --git a/include/configs/mx6cuboxi.h b/include/configs/mx6cuboxi.h
index 57efe1bab6ef..b03129bfc6ad 100644
--- a/include/configs/mx6cuboxi.h
+++ b/include/configs/mx6cuboxi.h
@@ -45,7 +45,6 @@ 
 
 #define CONFIG_MXC_UART_BASE	UART1_BASE
 #define CONSOLE_DEV	"ttymxc0"
-#define CONFIG_SYS_MMC_ENV_DEV		0	/* SDHC2 */
 
 #ifndef CONFIG_SPL_BUILD
 #define CONFIG_EXTRA_ENV_SETTINGS \
diff --git a/include/configs/mx6qarm2.h b/include/configs/mx6qarm2.h
index cdc108a73565..83c09ead2710 100644
--- a/include/configs/mx6qarm2.h
+++ b/include/configs/mx6qarm2.h
@@ -115,7 +115,6 @@ 
 	(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
 
 /* Environment organization */
-#define CONFIG_SYS_MMC_ENV_DEV		1
 
 /* USB Configs */
 #ifdef CONFIG_CMD_USB
diff --git a/include/configs/mx6sabreauto.h b/include/configs/mx6sabreauto.h
index e444930dc87b..11896777182d 100644
--- a/include/configs/mx6sabreauto.h
+++ b/include/configs/mx6sabreauto.h
@@ -49,9 +49,6 @@ 
 #endif
 
 #define CONFIG_SYS_FSL_USDHC_NUM	2
-#if defined(CONFIG_ENV_IS_IN_MMC)
-#define CONFIG_SYS_MMC_ENV_DEV		0
-#endif
 
 /* I2C Configs */
 #define CONFIG_SYS_I2C
diff --git a/include/configs/mx6sabresd.h b/include/configs/mx6sabresd.h
index ec1537541aea..e8f52cee202e 100644
--- a/include/configs/mx6sabresd.h
+++ b/include/configs/mx6sabresd.h
@@ -29,9 +29,6 @@ 
 #define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR        0x1000  /* 2MB */
 
 #define CONFIG_SYS_FSL_USDHC_NUM	3
-#if defined(CONFIG_ENV_IS_IN_MMC)
-#define CONFIG_SYS_MMC_ENV_DEV		1	/* SDHC3 */
-#endif
 
 #ifdef CONFIG_CMD_PCI
 #define CONFIG_PCI_SCAN_SHOW
diff --git a/include/configs/mx6slevk.h b/include/configs/mx6slevk.h
index 3ee9cdd52d84..44dadd681c0c 100644
--- a/include/configs/mx6slevk.h
+++ b/include/configs/mx6slevk.h
@@ -131,9 +131,6 @@ 
 #endif
 
 #define CONFIG_SYS_FSL_USDHC_NUM	3
-#if defined(CONFIG_ENV_IS_IN_MMC)
-#define CONFIG_SYS_MMC_ENV_DEV		1	/* SDHC2*/
-#endif
 
 #define CONFIG_IMX_THERMAL
 
diff --git a/include/configs/mx6sllevk.h b/include/configs/mx6sllevk.h
index f13429d6ea51..9533d3074286 100644
--- a/include/configs/mx6sllevk.h
+++ b/include/configs/mx6sllevk.h
@@ -117,13 +117,11 @@ 
 	(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
 
 /* Environment organization */
-#define CONFIG_SYS_MMC_ENV_PART		0   /* user partition */
 #define CONFIG_MMCROOT			"/dev/mmcblk0p2"  /* USDHC1 */
 
 /* MMC Configs */
 #define CONFIG_SYS_FSL_ESDHC_ADDR	USDHC1_BASE_ADDR
 #define CONFIG_SYS_FSL_USDHC_NUM	3
-#define CONFIG_SYS_MMC_ENV_DEV		0   /* USDHC1 */
 
 #define CONFIG_IMX_THERMAL
 
diff --git a/include/configs/mx6sxsabreauto.h b/include/configs/mx6sxsabreauto.h
index 070216338bcf..9ad29341c14b 100644
--- a/include/configs/mx6sxsabreauto.h
+++ b/include/configs/mx6sxsabreauto.h
@@ -141,8 +141,5 @@ 
 #define CONFIG_IMX_THERMAL
 
 #define CONFIG_SYS_FSL_USDHC_NUM	2
-#if defined(CONFIG_ENV_IS_IN_MMC)
-#define CONFIG_SYS_MMC_ENV_DEV		0  /*USDHC3*/
-#endif
 
 #endif				/* __CONFIG_H */
diff --git a/include/configs/mx6sxsabresd.h b/include/configs/mx6sxsabresd.h
index b30f9e51fbd5..4a521ec80d91 100644
--- a/include/configs/mx6sxsabresd.h
+++ b/include/configs/mx6sxsabresd.h
@@ -186,8 +186,5 @@ 
 #endif
 
 #define CONFIG_SYS_FSL_USDHC_NUM	3
-#if defined(CONFIG_ENV_IS_IN_MMC)
-#define CONFIG_SYS_MMC_ENV_DEV		2  /*USDHC4*/
-#endif
 
 #endif				/* __CONFIG_H */
diff --git a/include/configs/mx6ul_14x14_evk.h b/include/configs/mx6ul_14x14_evk.h
index f83ad914dbac..6f1e0d878da4 100644
--- a/include/configs/mx6ul_14x14_evk.h
+++ b/include/configs/mx6ul_14x14_evk.h
@@ -151,8 +151,6 @@ 
 	(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
 
 /* environment organization */
-#define CONFIG_SYS_MMC_ENV_DEV		1   /* USDHC2 */
-#define CONFIG_SYS_MMC_ENV_PART		0	/* user area */
 #define CONFIG_MMCROOT			"/dev/mmcblk1p2"  /* USDHC2 */
 
 /* USB Configs */
diff --git a/include/configs/mx6ullevk.h b/include/configs/mx6ullevk.h
index e37559d9030b..ca2f2bd975d2 100644
--- a/include/configs/mx6ullevk.h
+++ b/include/configs/mx6ullevk.h
@@ -148,8 +148,6 @@ 
 	(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
 
 /* environment organization */
-#define CONFIG_SYS_MMC_ENV_DEV		1	/* USDHC2 */
-#define CONFIG_SYS_MMC_ENV_PART		0	/* user area */
 #define CONFIG_MMCROOT			"/dev/mmcblk1p2"  /* USDHC2 */
 
 #define CONFIG_IMX_THERMAL
diff --git a/include/configs/mx7dsabresd.h b/include/configs/mx7dsabresd.h
index 7e1e8b02cb7d..98fab6b83de5 100644
--- a/include/configs/mx7dsabresd.h
+++ b/include/configs/mx7dsabresd.h
@@ -131,9 +131,6 @@ 
 #define CONFIG_SYS_FSL_USDHC_NUM	2
 #endif
 
-#define CONFIG_SYS_MMC_ENV_DEV		0   /* USDHC1 */
-#define CONFIG_SYS_MMC_ENV_PART		0	/* user area */
-
 /* USB Configs */
 #define CONFIG_MXC_USB_PORTSC  (PORT_PTS_UTMI | PORT_PTS_PTW)
 
diff --git a/include/configs/mx7ulp_com.h b/include/configs/mx7ulp_com.h
index 78bdfab5a6a5..44ece34e686f 100644
--- a/include/configs/mx7ulp_com.h
+++ b/include/configs/mx7ulp_com.h
@@ -24,7 +24,6 @@ 
  * write the direct value here
  */
 #define CONFIG_BOARD_SIZE_LIMIT		785408
-#define CONFIG_SYS_MMC_ENV_DEV		0
 #define CONFIG_MMCROOT			"/dev/mmcblk0p2"
 #define CONFIG_SYS_MMC_IMG_LOAD_PART	1
 
diff --git a/include/configs/mx7ulp_evk.h b/include/configs/mx7ulp_evk.h
index 9e932690746a..1e27920988a2 100644
--- a/include/configs/mx7ulp_evk.h
+++ b/include/configs/mx7ulp_evk.h
@@ -14,8 +14,6 @@ 
 #define CONFIG_BOARD_POSTCLK_INIT
 #define CONFIG_SYS_BOOTM_LEN		0x1000000
 
-#define CONFIG_SYS_MMC_ENV_DEV          0	/* USDHC1 */
-#define CONFIG_SYS_MMC_ENV_PART         0	/* user area */
 #define CONFIG_MMCROOT                  "/dev/mmcblk0p2"  /* USDHC1 */
 #define CONFIG_SYS_MMC_IMG_LOAD_PART    1
 
diff --git a/include/configs/nitrogen6x.h b/include/configs/nitrogen6x.h
index 0f7d8e7cb512..0598224f6678 100644
--- a/include/configs/nitrogen6x.h
+++ b/include/configs/nitrogen6x.h
@@ -145,10 +145,6 @@ 
 
 /* Environment organization */
 
-#if defined(CONFIG_ENV_IS_IN_MMC)
-#define CONFIG_SYS_MMC_ENV_DEV		0
-#endif
-
 /*
  * PCI express
  */
diff --git a/include/configs/novena.h b/include/configs/novena.h
index 14581e0be021..62faef0703e4 100644
--- a/include/configs/novena.h
+++ b/include/configs/novena.h
@@ -24,9 +24,6 @@ 
  * as recommended by GNU/fdisk. See below for details:
  * http://homepage.ntlworld.com./jonathan.deboynepollard/FGA/disc-partition-alignment.html
  */
-#ifdef CONFIG_CMD_MMC
-#define CONFIG_SYS_MMC_ENV_DEV		0
-#endif
 
 /* Booting Linux */
 #define CONFIG_BOOTFILE			"fitImage"
diff --git a/include/configs/nyan-big.h b/include/configs/nyan-big.h
index 97dd168b0180..394fb15f3136 100644
--- a/include/configs/nyan-big.h
+++ b/include/configs/nyan-big.h
@@ -19,8 +19,6 @@ 
 #define CONFIG_SYS_NS16550_COM1		NV_PA_APB_UARTA_BASE
 
 /* Environment in eMMC, at the end of 2nd "boot sector" */
-#define CONFIG_SYS_MMC_ENV_DEV		0
-#define CONFIG_SYS_MMC_ENV_PART		2
 
 /* Align LCD to 1MB boundary */
 #define CONFIG_LCD_ALIGNMENT	MMU_SECTION_SIZE
diff --git a/include/configs/odroid.h b/include/configs/odroid.h
index 03229910b2f4..7173eeba6776 100644
--- a/include/configs/odroid.h
+++ b/include/configs/odroid.h
@@ -45,7 +45,6 @@ 
 
 #define CONFIG_SYS_MONITOR_BASE	0x00000000
 
-#define CONFIG_SYS_MMC_ENV_DEV		CONFIG_MMC_DEFAULT_DEV
 #define CONFIG_ENV_OVERWRITE
 
 /* Partitions name */
diff --git a/include/configs/odroid_go2.h b/include/configs/odroid_go2.h
index 00eac2d2a8e2..53781ba7ae8a 100644
--- a/include/configs/odroid_go2.h
+++ b/include/configs/odroid_go2.h
@@ -8,8 +8,6 @@ 
 
 #include <configs/px30_common.h>
 
-#define CONFIG_SYS_MMC_ENV_DEV 0
-
 #define ROCKCHIP_DEVICE_SETTINGS \
 		"stdout=serial,vidconsole\0" \
 		"stderr=serial,vidconsole\0"
diff --git a/include/configs/omap4_sdp4430.h b/include/configs/omap4_sdp4430.h
index 884f45df2256..462aa4a5b902 100644
--- a/include/configs/omap4_sdp4430.h
+++ b/include/configs/omap4_sdp4430.h
@@ -20,6 +20,5 @@ 
 #include <configs/ti_omap4_common.h>
 
 /* ENV related config options */
-#define CONFIG_SYS_MMC_ENV_DEV		1	/* SLOT2: eMMC(1) */
 
 #endif /* __CONFIG_SDP4430_H */
diff --git a/include/configs/omap5_uevm.h b/include/configs/omap5_uevm.h
index 53589c03ead8..a1f1dafad79b 100644
--- a/include/configs/omap5_uevm.h
+++ b/include/configs/omap5_uevm.h
@@ -31,7 +31,6 @@ 
 #define CONFIG_SYS_NS16550_COM3		UART3_BASE
 
 /* MMC ENV related defines */
-#define CONFIG_SYS_MMC_ENV_DEV		1	/* SLOT2: eMMC(1) */
 
 /* Enhance our eMMC support / experience. */
 #define CONFIG_HSMMC2_8BIT
diff --git a/include/configs/opos6uldev.h b/include/configs/opos6uldev.h
index 3ef5ebbac793..69f5e9f96ab5 100644
--- a/include/configs/opos6uldev.h
+++ b/include/configs/opos6uldev.h
@@ -59,8 +59,6 @@ 
 #endif
 
 /* Environment is stored in the eMMC boot partition */
-#define CONFIG_SYS_MMC_ENV_DEV          0
-#define CONFIG_SYS_MMC_ENV_PART         1
 
 #define CONFIG_ENV_VERSION	100
 #define CONFIG_BOARD_NAME	opos6ul
diff --git a/include/configs/origen.h b/include/configs/origen.h
index 3bedc4784b7c..24b0338deb3f 100644
--- a/include/configs/origen.h
+++ b/include/configs/origen.h
@@ -77,7 +77,6 @@ 
 /* MIU (Memory Interleaving Unit) */
 #define CONFIG_MIU_2BIT_21_7_INTERLEAVED
 
-#define CONFIG_SYS_MMC_ENV_DEV		0
 #define RESERVE_BLOCK_SIZE		(512)
 #define BL1_SIZE			(16 << 10) /*16 K reserved for BL1*/
 
diff --git a/include/configs/p1_p2_rdb_pc.h b/include/configs/p1_p2_rdb_pc.h
index a33f2f30ca84..9448024c54ae 100644
--- a/include/configs/p1_p2_rdb_pc.h
+++ b/include/configs/p1_p2_rdb_pc.h
@@ -697,7 +697,6 @@ 
  */
 #if defined(CONFIG_SDCARD)
 #define CONFIG_FSL_FIXED_MMC_LOCATION
-#define CONFIG_SYS_MMC_ENV_DEV	0
 #elif defined(CONFIG_MTD_RAW_NAND)
 #define CONFIG_ENV_RANGE	(3 * CONFIG_ENV_SIZE)
 #ifdef CONFIG_TPL_BUILD
diff --git a/include/configs/p2371-0000.h b/include/configs/p2371-0000.h
index 8e3e1a77f5ae..5cebafc7c7c6 100644
--- a/include/configs/p2371-0000.h
+++ b/include/configs/p2371-0000.h
@@ -18,8 +18,6 @@ 
 #define CONFIG_TEGRA_ENABLE_UARTA
 
 /* Environment in eMMC, at the end of 2nd "boot sector" */
-#define CONFIG_SYS_MMC_ENV_DEV		0
-#define CONFIG_SYS_MMC_ENV_PART		2
 
 /* SPI */
 #define CONFIG_SPI_FLASH_SIZE		(4 << 20)
diff --git a/include/configs/p2371-2180.h b/include/configs/p2371-2180.h
index 7998eabd30cb..5e1d50b25466 100644
--- a/include/configs/p2371-2180.h
+++ b/include/configs/p2371-2180.h
@@ -18,8 +18,6 @@ 
 #define CONFIG_TEGRA_ENABLE_UARTA
 
 /* Environment in eMMC, at the end of 2nd "boot sector" */
-#define CONFIG_SYS_MMC_ENV_DEV		0
-#define CONFIG_SYS_MMC_ENV_PART		2
 
 /* SPI */
 #define CONFIG_SPI_FLASH_SIZE		(4 << 20)
diff --git a/include/configs/p2571.h b/include/configs/p2571.h
index e7b860a30ec4..0b3183a67ddb 100644
--- a/include/configs/p2571.h
+++ b/include/configs/p2571.h
@@ -19,8 +19,6 @@ 
 #define CONFIG_TEGRA_ENABLE_UARTA
 
 /* Environment in eMMC, at the end of 2nd "boot sector" */
-#define CONFIG_SYS_MMC_ENV_DEV		0
-#define CONFIG_SYS_MMC_ENV_PART		2
 
 /* SPI */
 #define CONFIG_SPI_FLASH_SIZE		(4 << 20)
diff --git a/include/configs/p2771-0000.h b/include/configs/p2771-0000.h
index 7c6d68a4f11a..4c3da224c66d 100644
--- a/include/configs/p2771-0000.h
+++ b/include/configs/p2771-0000.h
@@ -14,8 +14,6 @@ 
 #define CONFIG_TEGRA_BOARD_STRING	"NVIDIA P2771-0000"
 
 /* Environment in eMMC, at the end of 2nd "boot sector" */
-#define CONFIG_SYS_MMC_ENV_DEV		0
-#define CONFIG_SYS_MMC_ENV_PART		2
 
 #define BOARD_EXTRA_ENV_SETTINGS \
 	"calculated_vars=kernel_addr_r fdt_addr_r scriptaddr pxefile_addr_r " \
diff --git a/include/configs/paz00.h b/include/configs/paz00.h
index ae8e0dee2cd1..7a09ac0dee73 100644
--- a/include/configs/paz00.h
+++ b/include/configs/paz00.h
@@ -22,8 +22,6 @@ 
 #define CONFIG_MACH_TYPE		MACH_TYPE_PAZ00
 
 /* Environment in eMMC, at the end of 2nd "boot sector" */
-#define CONFIG_SYS_MMC_ENV_DEV 0
-#define CONFIG_SYS_MMC_ENV_PART 2
 
 #include "tegra-common-post.h"
 
diff --git a/include/configs/pcl063_ull.h b/include/configs/pcl063_ull.h
index 4ae955d9cac6..d7c6f8808e0d 100644
--- a/include/configs/pcl063_ull.h
+++ b/include/configs/pcl063_ull.h
@@ -24,8 +24,6 @@ 
 /* Environment settings */
 
 /* Environment in SD */
-#define CONFIG_SYS_MMC_ENV_DEV		0
-#define CONFIG_SYS_MMC_ENV_PART		0
 #define MMC_ROOTFS_DEV		0
 #define MMC_ROOTFS_PART		2
 
diff --git a/include/configs/pcm052.h b/include/configs/pcm052.h
index ba7aad8b05fd..01496cf70407 100644
--- a/include/configs/pcm052.h
+++ b/include/configs/pcm052.h
@@ -158,8 +158,5 @@ 
 	(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
 
 /* environment organization */
-#ifdef CONFIG_ENV_IS_IN_MMC
-#define CONFIG_SYS_MMC_ENV_DEV		0
-#endif
 
 #endif
diff --git a/include/configs/phycore_am335x_r2.h b/include/configs/phycore_am335x_r2.h
index 58fa2162a811..80610a590a75 100644
--- a/include/configs/phycore_am335x_r2.h
+++ b/include/configs/phycore_am335x_r2.h
@@ -15,7 +15,6 @@ 
 #include <configs/ti_am335x_common.h>
 
 #define CONFIG_MACH_TYPE		MACH_TYPE_SBC_PHYCORE_AM335X
-#define CONFIG_SYS_MMC_ENV_DEV		0
 #define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION	1
 
 #ifdef CONFIG_MTD_RAW_NAND
diff --git a/include/configs/phycore_rk3288.h b/include/configs/phycore_rk3288.h
index 9135aa6b7a81..2b7a0670c02a 100644
--- a/include/configs/phycore_rk3288.h
+++ b/include/configs/phycore_rk3288.h
@@ -16,6 +16,4 @@ 
 	func(MMC, mmc, 0) \
 	func(MMC, mmc, 1)
 
-#define CONFIG_SYS_MMC_ENV_DEV 1
-
 #endif
diff --git a/include/configs/pico-imx6.h b/include/configs/pico-imx6.h
index 814e4b027f91..7403c544a490 100644
--- a/include/configs/pico-imx6.h
+++ b/include/configs/pico-imx6.h
@@ -133,7 +133,6 @@ 
  * write the direct value here
  */
 #define CONFIG_BOARD_SIZE_LIMIT		715776
-#define CONFIG_SYS_MMC_ENV_DEV		0
 
 /* Ethernet Configuration */
 #define CONFIG_FEC_MXC
diff --git a/include/configs/pico-imx6ul.h b/include/configs/pico-imx6ul.h
index d7942afb679c..d712b638b4cd 100644
--- a/include/configs/pico-imx6ul.h
+++ b/include/configs/pico-imx6ul.h
@@ -144,10 +144,6 @@ 
  */
 #define CONFIG_BOARD_SIZE_LIMIT		715776
 
-
-#define CONFIG_SYS_MMC_ENV_DEV		0
-#define CONFIG_SYS_MMC_ENV_PART		0
-
 #ifdef CONFIG_VIDEO
 #define CONFIG_VIDEO_MXS
 #define CONFIG_VIDEO_LOGO
diff --git a/include/configs/pico-imx7d.h b/include/configs/pico-imx7d.h
index 3ca3ec61126d..f1b2ad4480c8 100644
--- a/include/configs/pico-imx7d.h
+++ b/include/configs/pico-imx7d.h
@@ -166,9 +166,6 @@ 
 
 #define CONFIG_SYS_FSL_USDHC_NUM		2
 
-#define CONFIG_SYS_MMC_ENV_DEV			0
-#define CONFIG_SYS_MMC_ENV_PART		0
-
 /* USB Configs */
 #define CONFIG_EHCI_HCD_INIT_AFTER_RESET
 #define CONFIG_MXC_USB_PORTSC			(PORT_PTS_UTMI | PORT_PTS_PTW)
diff --git a/include/configs/pico-imx8mq.h b/include/configs/pico-imx8mq.h
index e880fe59aef0..c792711df5e3 100644
--- a/include/configs/pico-imx8mq.h
+++ b/include/configs/pico-imx8mq.h
@@ -134,7 +134,6 @@ 
 	(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
 
 #define CONFIG_ENV_OVERWRITE
-#define CONFIG_SYS_MMC_ENV_DEV		1	/* USDHC2 */
 #define CONFIG_MMCROOT			"/dev/mmcblk1p2"	/* USDHC2 */
 
 /* Size of malloc() pool */
diff --git a/include/configs/platinum.h b/include/configs/platinum.h
index 77169f38bbec..325a28001e5b 100644
--- a/include/configs/platinum.h
+++ b/include/configs/platinum.h
@@ -77,7 +77,6 @@ 
 #else /* CONFIG_CMD_NAND */
 
 /* Environment in MMC */
-#define CONFIG_SYS_MMC_ENV_DEV		0
 
 #endif /* CONFIG_CMD_NAND */
 
diff --git a/include/configs/poplar.h b/include/configs/poplar.h
index 2c7dc8bab618..9763218ecbb3 100644
--- a/include/configs/poplar.h
+++ b/include/configs/poplar.h
@@ -51,9 +51,6 @@ 
 			"ramdisk_addr_r=0x32400000\0"			\
 			BOOTENV
 
-
-#define CONFIG_SYS_MMC_ENV_DEV		0
-
 /* Monitor Command Prompt */
 #define CONFIG_SYS_CBSIZE		512
 #define CONFIG_SYS_MAXARGS		64
diff --git a/include/configs/popmetal_rk3288.h b/include/configs/popmetal_rk3288.h
index ddd7012c8f39..222e5aae7436 100644
--- a/include/configs/popmetal_rk3288.h
+++ b/include/configs/popmetal_rk3288.h
@@ -9,6 +9,4 @@ 
 #define ROCKCHIP_DEVICE_SETTINGS
 #include <configs/rk3288_common.h>
 
-#define CONFIG_SYS_MMC_ENV_DEV 0
-
 #endif
diff --git a/include/configs/puma_rk3399.h b/include/configs/puma_rk3399.h
index 27a8a7d9c3af..d8b71a4a5e17 100644
--- a/include/configs/puma_rk3399.h
+++ b/include/configs/puma_rk3399.h
@@ -8,10 +8,6 @@ 
 
 #include <configs/rk3399_common.h>
 
-#if defined(CONFIG_ENV_IS_IN_MMC)
-#define CONFIG_SYS_MMC_ENV_DEV 1
-#endif
-
 #define SDRAM_BANK_SIZE			(2UL << 30)
 
 #define CONFIG_SERIAL_TAG
diff --git a/include/configs/rock.h b/include/configs/rock.h
index d9177576add9..96aefc194789 100644
--- a/include/configs/rock.h
+++ b/include/configs/rock.h
@@ -9,6 +9,4 @@ 
 #define ROCKCHIP_DEVICE_SETTINGS
 #include <configs/rk3188_common.h>
 
-#define CONFIG_SYS_MMC_ENV_DEV 0
-
 #endif
diff --git a/include/configs/rock2.h b/include/configs/rock2.h
index 9e4a66902b50..df96c32952f3 100644
--- a/include/configs/rock2.h
+++ b/include/configs/rock2.h
@@ -13,6 +13,4 @@ 
 
 #include <configs/rk3288_common.h>
 
-#define CONFIG_SYS_MMC_ENV_DEV 0
-
 #endif
diff --git a/include/configs/rock960_rk3399.h b/include/configs/rock960_rk3399.h
index 304ad2b7aae9..c6f9122154a8 100644
--- a/include/configs/rock960_rk3399.h
+++ b/include/configs/rock960_rk3399.h
@@ -13,8 +13,6 @@ 
 
 #include <configs/rk3399_common.h>
 
-#define CONFIG_SYS_MMC_ENV_DEV		1
-
 #define SDRAM_BANK_SIZE			(2UL << 30)
 
 #endif
diff --git a/include/configs/s32v234evb.h b/include/configs/s32v234evb.h
index 11ae2c1c528c..d6a133dac62d 100644
--- a/include/configs/s32v234evb.h
+++ b/include/configs/s32v234evb.h
@@ -163,8 +163,6 @@ 
 
 /* environment organization */
 
-#define CONFIG_SYS_MMC_ENV_DEV		0
-
 
 #define CONFIG_BOOTP_BOOTFILESIZE
 
diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
index 620217f52880..305d29f8f361 100644
--- a/include/configs/s5p_goni.h
+++ b/include/configs/s5p_goni.h
@@ -162,7 +162,6 @@ 
 
 /* FLASH and environment organization */
 #define CONFIG_MMC_DEFAULT_DEV	0
-#define CONFIG_SYS_MMC_ENV_DEV		CONFIG_MMC_DEFAULT_DEV
 #define CONFIG_ENV_OVERWRITE
 
 #define CONFIG_USE_ONENAND_BOARD_INIT
diff --git a/include/configs/s5pc210_universal.h b/include/configs/s5pc210_universal.h
index 5a80958739df..da6ed975c367 100644
--- a/include/configs/s5pc210_universal.h
+++ b/include/configs/s5pc210_universal.h
@@ -53,8 +53,6 @@ 
 #define CONFIG_BOOTBLOCK	"10"
 #define CONFIG_UBIBLOCK		"9"
 
-#define CONFIG_SYS_MMC_ENV_DEV		CONFIG_MMC_DEFAULT_DEV
-
 #define CONFIG_ENV_UBIFS_OPTION	" rootflags=bulk_read,no_chk_data_crc "
 #define CONFIG_ENV_FLASHBOOT	CONFIG_ENV_UBI_MTD CONFIG_ENV_UBIFS_OPTION \
 				"${mtdparts}"
diff --git a/include/configs/salvator-x.h b/include/configs/salvator-x.h
index 84c6ca95eafe..240df9c63b99 100644
--- a/include/configs/salvator-x.h
+++ b/include/configs/salvator-x.h
@@ -18,7 +18,5 @@ 
 #define COUNTER_FREQUENCY	0xFE502A	/* 16.66MHz from CPclk */
 
 /* Environment in eMMC, at the end of 2nd "boot sector" */
-#define CONFIG_SYS_MMC_ENV_DEV		1
-#define CONFIG_SYS_MMC_ENV_PART		2
 
 #endif /* __SALVATOR_X_H */
diff --git a/include/configs/sc_sps_1.h b/include/configs/sc_sps_1.h
index 3484bfebf2ec..6011fb7d522d 100644
--- a/include/configs/sc_sps_1.h
+++ b/include/configs/sc_sps_1.h
@@ -21,9 +21,6 @@ 
 /* Environment */
 
 /* Environment is in MMC */
-#if defined(CONFIG_CMD_MMC) && defined(CONFIG_ENV_IS_IN_MMC)
-#define CONFIG_SYS_MMC_ENV_DEV		0
-#endif
 
 /* FEC Ethernet on SoC */
 #ifdef CONFIG_CMD_NET
diff --git a/include/configs/seaboard.h b/include/configs/seaboard.h
index 857e2e349e2b..5b5aa1b2f205 100644
--- a/include/configs/seaboard.h
+++ b/include/configs/seaboard.h
@@ -27,8 +27,6 @@ 
 #define CONFIG_MACH_TYPE		MACH_TYPE_SEABOARD
 
 /* Environment in eMMC, at the end of 2nd "boot sector" */
-#define CONFIG_SYS_MMC_ENV_DEV 0
-#define CONFIG_SYS_MMC_ENV_PART 2
 
 /* NAND support */
 #define CONFIG_TEGRA_NAND
diff --git a/include/configs/secomx6quq7.h b/include/configs/secomx6quq7.h
index 45acf95a5b8f..bd3c3402c485 100644
--- a/include/configs/secomx6quq7.h
+++ b/include/configs/secomx6quq7.h
@@ -75,7 +75,6 @@ 
 /* Environment organization */
 
 #if defined(CONFIG_ENV_IS_IN_MMC)
-	#define CONFIG_SYS_MMC_ENV_DEV		0
 	#define CONFIG_DYNAMIC_MMC_DEVNO
 #endif
 
diff --git a/include/configs/sheep_rk3368.h b/include/configs/sheep_rk3368.h
index 550597c957d0..08cc4bf356d9 100644
--- a/include/configs/sheep_rk3368.h
+++ b/include/configs/sheep_rk3368.h
@@ -8,7 +8,6 @@ 
 
 #include <configs/rk3368_common.h>
 
-#define CONFIG_SYS_MMC_ENV_DEV		0
 #define KERNEL_LOAD_ADDR		0x280000
 #define DTB_LOAD_ADDR			0x5600000
 #define INITRD_LOAD_ADDR		0x5bf0000
diff --git a/include/configs/sksimx6.h b/include/configs/sksimx6.h
index 33ec049cf223..511b1a440e80 100644
--- a/include/configs/sksimx6.h
+++ b/include/configs/sksimx6.h
@@ -52,7 +52,6 @@ 
 #define CONFIG_SYS_FSL_USDHC_NUM	1
 
 /* Environment organization */
-#define CONFIG_SYS_MMC_ENV_DEV		0
 
 /* Default environment */
 #define CONFIG_EXTRA_ENV_SETTINGS \
diff --git a/include/configs/smdkv310.h b/include/configs/smdkv310.h
index 336571d4c4e0..a3f011c400e9 100644
--- a/include/configs/smdkv310.h
+++ b/include/configs/smdkv310.h
@@ -62,7 +62,6 @@ 
 /* MIU (Memory Interleaving Unit) */
 #define CONFIG_MIU_2BIT_INTERLEAVED
 
-#define CONFIG_SYS_MMC_ENV_DEV		0
 #define RESERVE_BLOCK_SIZE		(512)
 #define BL1_SIZE			(16 << 10) /*16 K reserved for BL1*/
 
diff --git a/include/configs/socfpga_common.h b/include/configs/socfpga_common.h
index 07c9745eba92..63eac09da5f1 100644
--- a/include/configs/socfpga_common.h
+++ b/include/configs/socfpga_common.h
@@ -159,9 +159,6 @@  unsigned int cm_get_qspi_controller_clk_hz(void);
  */
 
 /* Environment for SDMMC boot */
-#if defined(CONFIG_ENV_IS_IN_MMC)
-#define CONFIG_SYS_MMC_ENV_DEV		0 /* device 0 */
-#endif
 
 /* Environment for QSPI boot */
 
diff --git a/include/configs/socfpga_soc64_common.h b/include/configs/socfpga_soc64_common.h
index 775a122f1f12..89f5104fa104 100644
--- a/include/configs/socfpga_soc64_common.h
+++ b/include/configs/socfpga_soc64_common.h
@@ -49,7 +49,6 @@ 
 /*
  * U-Boot environment configurations
  */
-#define CONFIG_SYS_MMC_ENV_DEV		0	/* device 0 */
 
 /*
  * QSPI support
diff --git a/include/configs/somlabs_visionsom_6ull.h b/include/configs/somlabs_visionsom_6ull.h
index 099c069a9f6f..204818b8eb7f 100644
--- a/include/configs/somlabs_visionsom_6ull.h
+++ b/include/configs/somlabs_visionsom_6ull.h
@@ -87,8 +87,6 @@ 
 	(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
 
 /* environment organization */
-#define CONFIG_SYS_MMC_ENV_DEV		1	/* USDHC2 */
-#define CONFIG_SYS_MMC_ENV_PART		0	/* user area */
 
 /* USB Configs */
 #ifdef CONFIG_CMD_USB
diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
index 5b0bec056164..3651d7fcc542 100644
--- a/include/configs/sunxi-common.h
+++ b/include/configs/sunxi-common.h
@@ -136,10 +136,8 @@ 
 
 #if CONFIG_MMC_SUNXI_SLOT_EXTRA != -1
 /* If we have two devices (most likely eMMC + MMC), favour the eMMC */
-#define CONFIG_SYS_MMC_ENV_DEV		1
 #else
 /* Otherwise, use the only device we have */
-#define CONFIG_SYS_MMC_ENV_DEV		0
 #endif
 #define CONFIG_SYS_MMC_MAX_DEVICE	4
 #endif
diff --git a/include/configs/tbs2910.h b/include/configs/tbs2910.h
index 32845978a65c..b9feee9e9c04 100644
--- a/include/configs/tbs2910.h
+++ b/include/configs/tbs2910.h
@@ -66,8 +66,6 @@ 
 #endif /* CONFIG_CMD_USB      */
 
 /* Environment organization */
-#define CONFIG_SYS_MMC_ENV_DEV		2 /* overwritten on SD boot */
-#define CONFIG_SYS_MMC_ENV_PART		1 /* overwritten on SD boot */
 #define CONFIG_ENV_OVERWRITE
 
 #define CONFIG_BOARD_SIZE_LIMIT		392192 /* (CONFIG_ENV_OFFSET - 1024) */
diff --git a/include/configs/tec-ng.h b/include/configs/tec-ng.h
index 1047372105e2..2bc531c463ef 100644
--- a/include/configs/tec-ng.h
+++ b/include/configs/tec-ng.h
@@ -17,8 +17,6 @@ 
 #define CONFIG_SYS_NS16550_COM1		NV_PA_APB_UARTD_BASE
 
 /* Environment in eMMC, at the end of 2nd "boot sector" */
-#define CONFIG_SYS_MMC_ENV_DEV		0
-#define CONFIG_SYS_MMC_ENV_PART		2
 
 /* SPI */
 #define CONFIG_TEGRA_SLINK_CTRLS       6
diff --git a/include/configs/tinker_rk3288.h b/include/configs/tinker_rk3288.h
index d239e3beb1cf..269ec529a340 100644
--- a/include/configs/tinker_rk3288.h
+++ b/include/configs/tinker_rk3288.h
@@ -22,6 +22,4 @@ 
 	func(PXE, pxe, na) \
 	func(DHCP, dchp, na)
 
-#define CONFIG_SYS_MMC_ENV_DEV 1
-
 #endif
diff --git a/include/configs/titanium.h b/include/configs/titanium.h
index 9100d3b14a01..7678f69dede3 100644
--- a/include/configs/titanium.h
+++ b/include/configs/titanium.h
@@ -145,7 +145,6 @@ 
 #else /* CONFIG_CMD_NAND */
 
 /* Environment in MMC */
-#define CONFIG_SYS_MMC_ENV_DEV		0
 
 #endif /* CONFIG_CMD_NAND */
 
diff --git a/include/configs/tqma6.h b/include/configs/tqma6.h
index 13ab1cc4bf51..b58c475c2247 100644
--- a/include/configs/tqma6.h
+++ b/include/configs/tqma6.h
@@ -74,8 +74,6 @@ 
 #define TQMA6_UBOOT_SECTOR_START	0x2
 #define TQMA6_UBOOT_SECTOR_COUNT	0x7fe
 
-#define CONFIG_SYS_MMC_ENV_DEV		0
-
 #define TQMA6_FDT_OFFSET		(2 * SZ_1M)
 #define TQMA6_FDT_SECTOR_START		0x1000
 #define TQMA6_FDT_SECTOR_COUNT		0x800
diff --git a/include/configs/trats.h b/include/configs/trats.h
index f39a7c726a2b..81bd7b1cc4ed 100644
--- a/include/configs/trats.h
+++ b/include/configs/trats.h
@@ -46,8 +46,6 @@ 
 #define CONFIG_BOOTBLOCK		"10"
 #define CONFIG_ENV_COMMON_BOOT		"${console} ${meminfo}"
 
-#define CONFIG_SYS_MMC_ENV_DEV		CONFIG_MMC_DEFAULT_DEV
-
 #define CONFIG_ENV_OVERWRITE
 
 /* Tizen - partitions definitions */
diff --git a/include/configs/trats2.h b/include/configs/trats2.h
index f6593e227b9e..cbd37586780e 100644
--- a/include/configs/trats2.h
+++ b/include/configs/trats2.h
@@ -41,8 +41,6 @@ 
 
 #define CONFIG_SYS_MONITOR_BASE	0x00000000
 
-#define CONFIG_SYS_MMC_ENV_DEV		CONFIG_MMC_DEFAULT_DEV
-
 #define CONFIG_ENV_OVERWRITE
 
 /* Tizen - partitions definitions */
diff --git a/include/configs/ts4600.h b/include/configs/ts4600.h
index 6aab8a06a963..ae9352f5b9ad 100644
--- a/include/configs/ts4600.h
+++ b/include/configs/ts4600.h
@@ -23,9 +23,6 @@ 
 /* Environment */
 
 /* Environment is in MMC */
-#if defined(CONFIG_CMD_MMC) && defined(CONFIG_ENV_IS_IN_MMC)
-#define CONFIG_SYS_MMC_ENV_DEV		0
-#endif
 
 /* Boot Linux */
 #define CONFIG_LOADADDR		0x42000000
diff --git a/include/configs/ts4800.h b/include/configs/ts4800.h
index aca0d860afd5..c8565dbf72cb 100644
--- a/include/configs/ts4800.h
+++ b/include/configs/ts4800.h
@@ -133,6 +133,4 @@ 
  * Environment organization
  */
 
-#define CONFIG_SYS_MMC_ENV_DEV 0
-
 #endif
diff --git a/include/configs/udoo.h b/include/configs/udoo.h
index 706efb203549..b4fbf8c6383d 100644
--- a/include/configs/udoo.h
+++ b/include/configs/udoo.h
@@ -85,6 +85,4 @@ 
 
 /* Environment organization */
 
-#define CONFIG_SYS_MMC_ENV_DEV		0
-
 #endif			       /* __CONFIG_H * */
diff --git a/include/configs/udoo_neo.h b/include/configs/udoo_neo.h
index 4e95788b24f7..34a95a0283f0 100644
--- a/include/configs/udoo_neo.h
+++ b/include/configs/udoo_neo.h
@@ -22,7 +22,6 @@ 
 
 /* Command definition */
 #define CONFIG_MXC_UART_BASE		UART1_BASE
-#define CONFIG_SYS_MMC_ENV_DEV		0  /*USDHC2*/
 
 /* Linux only */
 #define CONFIG_EXTRA_ENV_SETTINGS \
diff --git a/include/configs/ulcb.h b/include/configs/ulcb.h
index e006ad280b45..15fb62722874 100644
--- a/include/configs/ulcb.h
+++ b/include/configs/ulcb.h
@@ -18,7 +18,5 @@ 
 #define COUNTER_FREQUENCY	0xFE502A	/* 16.66MHz from CPclk */
 
 /* Environment in eMMC, at the end of 2nd "boot sector" */
-#define CONFIG_SYS_MMC_ENV_DEV		1
-#define CONFIG_SYS_MMC_ENV_PART		2
 
 #endif /* __ULCB_H */
diff --git a/include/configs/uniphier.h b/include/configs/uniphier.h
index d0841a7d55f9..740249a74f3e 100644
--- a/include/configs/uniphier.h
+++ b/include/configs/uniphier.h
@@ -50,9 +50,6 @@ 
 /* Boot Argument Buffer Size */
 #define CONFIG_SYS_BARGSIZE		(CONFIG_SYS_CBSIZE)
 
-#define CONFIG_SYS_MMC_ENV_DEV		0
-#define CONFIG_SYS_MMC_ENV_PART		1
-
 #if !defined(CONFIG_ARM64)
 /* Time clock 1MHz */
 #define CONFIG_SYS_TIMER_RATE			1000000
diff --git a/include/configs/usbarmory.h b/include/configs/usbarmory.h
index 0c0f85097b23..27053c067fca 100644
--- a/include/configs/usbarmory.h
+++ b/include/configs/usbarmory.h
@@ -15,7 +15,6 @@ 
 #include <asm/arch/imx-regs.h>
 
 /* U-Boot environment */
-#define CONFIG_SYS_MMC_ENV_DEV	0
 
 /* U-Boot general configurations */
 #define CONFIG_SYS_CBSIZE	512
diff --git a/include/configs/venice2.h b/include/configs/venice2.h
index b62a43054a21..fe861a6f7b8a 100644
--- a/include/configs/venice2.h
+++ b/include/configs/venice2.h
@@ -19,8 +19,6 @@ 
 #define CONFIG_SYS_NS16550_COM1		NV_PA_APB_UARTA_BASE
 
 /* Environment in eMMC, at the end of 2nd "boot sector" */
-#define CONFIG_SYS_MMC_ENV_DEV		0
-#define CONFIG_SYS_MMC_ENV_PART		2
 
 /* SPI */
 #define CONFIG_SPI_FLASH_SIZE          (4 << 20)
diff --git a/include/configs/ventana.h b/include/configs/ventana.h
index 2c2d66cdc099..21f90f38fc9b 100644
--- a/include/configs/ventana.h
+++ b/include/configs/ventana.h
@@ -20,8 +20,6 @@ 
 #define CONFIG_MACH_TYPE		MACH_TYPE_VENTANA
 
 /* Environment in eMMC, at the end of 2nd "boot sector" */
-#define CONFIG_SYS_MMC_ENV_DEV 0
-#define CONFIG_SYS_MMC_ENV_PART 2
 
 #include "tegra-common-post.h"
 
diff --git a/include/configs/verdin-imx8mm.h b/include/configs/verdin-imx8mm.h
index 878c4996df42..3019f357e893 100644
--- a/include/configs/verdin-imx8mm.h
+++ b/include/configs/verdin-imx8mm.h
@@ -86,8 +86,6 @@ 
 #define CONFIG_ENV_OVERWRITE
 #if defined(CONFIG_ENV_IS_IN_MMC)
 /* Environment in eMMC, before config block at the end of 1st "boot sector" */
-#define CONFIG_SYS_MMC_ENV_DEV		0	/* USDHC1 eMMC */
-#define CONFIG_SYS_MMC_ENV_PART	1
 #endif
 
 /* Size of malloc() pool */
diff --git a/include/configs/vf610twr.h b/include/configs/vf610twr.h
index 0ef2de33cc8a..cb857cdb4b0f 100644
--- a/include/configs/vf610twr.h
+++ b/include/configs/vf610twr.h
@@ -176,10 +176,6 @@ 
 #define CONFIG_SYS_INIT_SP_ADDR \
 	(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
 
-#ifdef CONFIG_ENV_IS_IN_MMC
-#define CONFIG_SYS_MMC_ENV_DEV		0
-#endif
-
 #ifdef CONFIG_ENV_IS_IN_NAND
 #define CONFIG_ENV_RANGE		(512 * 1024)
 #endif
diff --git a/include/configs/vining_2000.h b/include/configs/vining_2000.h
index c4db6f4b3c1a..a851fb41a814 100644
--- a/include/configs/vining_2000.h
+++ b/include/configs/vining_2000.h
@@ -78,9 +78,7 @@ 
 #define CONFIG_IMX6_PWM_PER_CLK 66000000
 
 #ifdef CONFIG_ENV_IS_IN_MMC
-#define CONFIG_SYS_MMC_ENV_DEV		0 /* USDHC4 eMMC */
 /* 0=user, 1=boot0, 2=boot1, * 4..7=general0..3. */
-#define CONFIG_SYS_MMC_ENV_PART		1 /* boot0 */
 #endif
 
 #ifdef CONFIG_SPL_BUILD
diff --git a/include/configs/vyasa-rk3288.h b/include/configs/vyasa-rk3288.h
index 4d8b4a03e1a7..3dc10b29c3fa 100644
--- a/include/configs/vyasa-rk3288.h
+++ b/include/configs/vyasa-rk3288.h
@@ -20,8 +20,6 @@ 
 #define BOOT_TARGET_DEVICES(func) \
 	func(MMC, mmc, 1) \
 
-#define CONFIG_SYS_MMC_ENV_DEV 1
-
 #ifndef CONFIG_TPL_BUILD
 
 #define CONFIG_SPL_OS_BOOT
diff --git a/include/configs/wandboard.h b/include/configs/wandboard.h
index c798ca64bf19..df13e3da537f 100644
--- a/include/configs/wandboard.h
+++ b/include/configs/wandboard.h
@@ -122,6 +122,4 @@ 
 
 /* Environment organization */
 
-#define CONFIG_SYS_MMC_ENV_DEV		0
-
 #endif			       /* __CONFIG_H * */
diff --git a/include/configs/warp.h b/include/configs/warp.h
index 1ab72cd00bce..f17eea117f3a 100644
--- a/include/configs/warp.h
+++ b/include/configs/warp.h
@@ -37,8 +37,6 @@ 
 #define CONFIG_SYS_INIT_SP_ADDR \
 	(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
 
-#define CONFIG_SYS_MMC_ENV_DEV		0
-
 /* VDD voltage 1.65 - 1.95 */
 #define CONFIG_SYS_SD_VOLTAGE		0x00000080
 
diff --git a/include/configs/warp7.h b/include/configs/warp7.h
index 60a902b2c747..2d1ede3bc8dc 100644
--- a/include/configs/warp7.h
+++ b/include/configs/warp7.h
@@ -143,9 +143,6 @@ 
 
 #define CONFIG_SYS_FSL_USDHC_NUM	1
 
-#define CONFIG_SYS_MMC_ENV_DEV		0
-#define CONFIG_SYS_MMC_ENV_PART		0
-
 
 #define CONFIG_MXC_USB_PORTSC		(PORT_PTS_UTMI | PORT_PTS_PTW)
 
diff --git a/include/configs/xpress.h b/include/configs/xpress.h
index 79364d3437fe..399925a75bda 100644
--- a/include/configs/xpress.h
+++ b/include/configs/xpress.h
@@ -48,8 +48,6 @@ 
 	(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
 
 /* Environment is in stored in the eMMC boot partition */
-#define CONFIG_SYS_MMC_ENV_DEV		0	/* USDHC2 */
-#define CONFIG_SYS_MMC_ENV_PART		1	/* boot parition */
 #define CONFIG_MMCROOT			"/dev/mmcblk0p2"  /* USDHC2 */
 
 /* USB Configs */
diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt
index 2ec7642583d2..ce422894730f 100644
--- a/scripts/config_whitelist.txt
+++ b/scripts/config_whitelist.txt
@@ -3055,8 +3055,6 @@  CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR
 CONFIG_SYS_MMC_BASE
 CONFIG_SYS_MMC_CD_PIN
 CONFIG_SYS_MMC_CLK_OD
-CONFIG_SYS_MMC_ENV_DEV
-CONFIG_SYS_MMC_ENV_PART
 CONFIG_SYS_MMC_MAX_BLK_COUNT
 CONFIG_SYS_MMC_MAX_DEVICE
 CONFIG_SYS_MMC_U_BOOT_DST