Skip to contentSkip to conversation

imx8mm_beacon: Enable fixed regulator in SPL

PATCH New Adam Ford 3 participants 10 messages Dec 30, 2020 – Jan 23, 2021

Subsystems (2)
lore
Share & tools
lore

Adam Ford

author
#0 lore raw

PATCH 1/2 imx8mm_beacon: Enable fixed regulator in SPL

Because SPL can support SD UHS, the fixed regulator needs to be enabled in SPL to reset the SD card.

Fixes 1a5d9c84b472 ("imx8mm_beacon: Enable HS400 on MMC controller")
configs/imx8mm_beacon_defconfig +1 -0
index 49d5453078..b0ea87a58c 100644
@@ -95,6 +95,7 @@ CONFIG_SPL_DM_REGULATOR=y
 CONFIG_DM_REGULATOR_BD71837=y
 CONFIG_SPL_DM_REGULATOR_BD71837=y
 CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_SPL_DM_REGULATOR_FIXED=y
 CONFIG_DM_REGULATOR_GPIO=y
 CONFIG_CONS_INDEX=2
 CONFIG_DM_SERIAL=y
Signature · 1 line
2.25.1
author
#1 lore raw

PATCH 2/2 ARM: dts: imx8mm-beacon: add UHS and HS400/HS400ES properties

i.MX8M Mini can provide support for high speed grades in the usdhc controllers.

On the imx8mm-beacon-kit, the sdhc2 hosts a microSD card, and sdhc3 hosts an eMMC capable of HS400ES.

In order to toggle this mode in SPL, the reg_usdhc2_vmmc must be available in SPL. Add all these flags to imx8mm-beacon-kit-u-boot.dtsi

arch/arm/dts/imx8mm-beacon-kit-u-boot.dtsi +5 -0
index 6d80a529ae..d7da29c592 100644
@@ -38,6 +38,7 @@
 };
 
 &reg_usdhc2_vmmc {
+	u-boot,dm-spl;
 	u-boot,off-on-delay-us = <20000>;
 };
 
@@ -112,10 +113,14 @@
 
 &usdhc2 {
 	u-boot,dm-spl;
+	sd-uhs-sdr104;
+	sd-uhs-ddr50;
 };
 
 &usdhc3 {
 	u-boot,dm-spl;
+	mmc-hs400-1_8v;
+	mmc-hs400-enhanced-strobe;
 };
 
 &i2c1 {
Signature · 1 line
2.25.1
reviewer
#2 lore raw

PATCH 2/2 ARM: dts: imx8mm-beacon: add UHS and HS400/HS400ES properties

Hi Adam,

arch/arm/dts/imx8mm-beacon-kit-u-boot.dtsi line 117

Quoted 4 lines · Adam Ford
 &usdhc2 {
        u-boot,dm-spl;
arch/arm/dts/imx8mm-beacon-kit-u-boot.dtsi +2 -0
+       sd-uhs-sdr104;
+       sd-uhs-ddr50;

Shouldn't these properties be part of the main dtsi instead of adding them to the u-boot.dtsi one?

author
#3 lore raw

PATCH 2/2 ARM: dts: imx8mm-beacon: add UHS and HS400/HS400ES properties

Quoted 5 lines · Fabio Estevam

Hi Adam,

On Wed, Dec 30, 2020 at 11:14 AM Adam Ford <[email protected]> wrote:

Quoted 7 lines

arch/arm/dts/imx8mm-beacon-kit-u-boot.dtsi line 117

Quoted 4 lines
 &usdhc2 {
        u-boot,dm-spl;
arch/arm/dts/imx8mm-beacon-kit-u-boot.dtsi +2 -0
+       sd-uhs-sdr104;
+       sd-uhs-ddr50;

Shouldn't these properties be part of the main dtsi instead of adding them to the u-boot.dtsi one?

Linux doesn't appear to need it, and no 64-bit imx boards in Linux appear to use them. Some layerscape boards appear to use these flags. If it's not necessary for Linux, but it is necessary for U-Boot, it seems like the -u-boot.dtsi file is the right place to put it.
It's consistent with that was done for the imx8mm-evk-u-boot.dtsi and others [1]

[1] - https://gitlab.denx.de/u-boot/u-boot/-/commit/50b1a69cee0dc06d0c713a5a978998f2b4a9cb31

adam

reviewer
#4 lore raw

PATCH 2/2 ARM: dts: imx8mm-beacon: add UHS and HS400/HS400ES properties

Quoted 5 lines · Adam Ford

Linux doesn't appear to need it, and no 64-bit imx boards in Linux appear to use them. Some layerscape boards appear to use these flags. If it's not necessary for Linux, but it is necessary for U-Boot, it seems like the -u-boot.dtsi file is the right place to put it.
It's consistent with that was done for the imx8mm-evk-u-boot.dtsi and others [1]

IMHO the device trees should be the same for Linux and U-Boot as much as we can.

Of course, it is OK to add custom U-Boot properties, such as u-boot,dm-spl inside -u-boot.dtsi file, but adding MMC related properties only in U-Boot dtsi does not seem correct.

It would be nice if someone could investigate what is missing in the U-Boot sdhc driver to handle these modes by default.

author
#5 lore raw

PATCH 2/2 ARM: dts: imx8mm-beacon: add UHS and HS400/HS400ES properties

Quoted 9 lines · Fabio Estevam
Quoted 5 lines · Adam Ford

Linux doesn't appear to need it, and no 64-bit imx boards in Linux appear to use them. Some layerscape boards appear to use these flags. If it's not necessary for Linux, but it is necessary for U-Boot, it seems like the -u-boot.dtsi file is the right place to put it.
It's consistent with that was done for the imx8mm-evk-u-boot.dtsi and others [1]

Quoted 8 lines

IMHO the device trees should be the same for Linux and U-Boot as much as we can.

Of course, it is OK to add custom U-Boot properties, such as u-boot,dm-spl inside -u-boot.dtsi file, but adding MMC related properties only in U-Boot dtsi does not seem correct.

It would be nice if someone could investigate what is missing in the U-Boot sdhc driver to handle these modes by default.

U-Boot has a structure to define the capabilities of the usdhc controller.

static struct esdhc_soc_data usdhc_imx8qm_data = {
.flags = ESDHC_FLAG_USDHC | ESDHC_FLAG_STD_TUNING | ESDHC_FLAG_HAVE_CAP1 | ESDHC_FLAG_HS200 | ESDHC_FLAG_HS400 | ESDHC_FLAG_HS400_ES,
};

This is referenced from a variety of compatible flags, including the imx8mm.

It looks like the code is missing the checks for all of them except ESDHC_FLAG_USDHC and ESDHC_FLAG_STD_TUNING.
The flags get copied from data->flags to priv->flags, but we check the flags and convert them to host capabilities. I think these flags need to somehow get checked and then converted to cfg->host_caps. It gets more complicated, because the flags would need to get cleared if the pinmux doesn't have 100MHz and 200MHz options available to it.

By comparison, the Linux code appears to handle the various flags.

In the meantime, would you be opposed to this patch since other imx8m kits have the equivalent patch already applied? They could be removed if/when the esdhc driver gets updated.

adam

reviewer
#6 lore raw

PATCH 2/2 ARM: dts: imx8mm-beacon: add UHS and HS400/HS400ES properties

Quoted 3 lines · Adam Ford

In the meantime, would you be opposed to this patch since other imx8m kits have the equivalent patch already applied? They could be removed if/when the esdhc driver gets updated.

I am not opposed to this patch, but would be nice if the U-Boot esdhc driver could be changed to behave like the kernel one.

author
#7 lore raw

PATCH 2/2 ARM: dts: imx8mm-beacon: add UHS and HS400/HS400ES properties

Quoted 9 lines · Fabio Estevam
Quoted 3 lines · Adam Ford

In the meantime, would you be opposed to this patch since other imx8m kits have the equivalent patch already applied? They could be removed if/when the esdhc driver gets updated.

I am not opposed to this patch, but would be nice if the U-Boot esdhc driver could be changed to behave like the kernel one.

I just sent an RFC [1] for change that uses the esdhc_soc_data flags to determine whether or not the function/feature is present in the controller and checks to see if the function is enabled from Kconfig.

I was able to remove the u-boot.dtsi changes that I previously pushed, and I was able to see that the eMMC device is running at HS400_ES (200MHz)

u-boot=> mmc dev 2
switch to partitions #0, OK
mmc2(part 0) is current device
u-boot=> mmc info
Device: FSL_SDHC
Manufacturer ID: 45
OEM: 100
Name: DG403
Bus Speed: 200000000
Mode: HS400ES (200MHz)
Rd Block Len: 512
MMC version 5.1
High Capacity: Yes
Capacity: 29.1 GiB
Bus Width: 8-bit DDR
Erase Group Size: 512 KiB
HC WP Group Size: 8 MiB
User Capacity: 29.1 GiB WRREL
Boot Capacity: 4 MiB ENH
RPMB Capacity: 4 MiB ENH
Boot area 0 is not write protected
Boot area 1 is not write protected
u-boot=>

[1] - https://patchwork.ozlabs.org/project/uboot/patch/20201230173907.2891555-1-aford173 at gmail.com/

reviewer
#8 lore raw

PATCH 2/2 ARM: dts: imx8mm-beacon: add UHS and HS400/HS400ES properties

Hi Adam,

Quoted 7 lines · Adam Ford

I just sent an RFC [1] for change that uses the esdhc_soc_data flags to determine whether or not the function/feature is present in the controller and checks to see if the function is enabled from Kconfig.

I was able to remove the u-boot.dtsi changes that I previously pushed, and I was able to see that the eMMC device is running at HS400_ES (200MHz)

Thanks for investigating and providing a patch. Appreciated!

#9 lore raw

PATCH 1/2 imx8mm_beacon: Enable fixed regulator in SPL

In reply to Adam Ford
Quoted 9 lines

Because SPL can support SD UHS, the fixed regulator needs to be enabled in SPL to reset the SD card.

Fixes 1a5d9c84b472 ("imx8mm_beacon: Enable HS400 on MMC controller")
configs/imx8mm_beacon_defconfig +0 -0
index 49d5453078..b0ea87a58c 100644

configs/imx8mm_beacon_defconfig CONFIG_SPL_DM_REGULATOR=y · line 101

Quoted 7 lines
configs/imx8mm_beacon_defconfig +1 -0
@@ -95,6 +95,7 @@ CONFIG_SPL_DM_REGULATOR=y
 CONFIG_DM_REGULATOR_BD71837=y
 CONFIG_SPL_DM_REGULATOR_BD71837=y
 CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_SPL_DM_REGULATOR_FIXED=y
 CONFIG_DM_REGULATOR_GPIO=y
 CONFIG_CONS_INDEX=2
 CONFIG_DM_SERIAL=y

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================