rk3288: veyron: Enable SDMMC when booting from SPI
Subsystems (3)
v2 cover rk3288: veyron: Enable SDMMC when booting from SPI
From: Carlo Caione <[email protected]>
These patches toghether with the previously submitted patch [0] enable the chromebook veyron jerry to use the SDMMC interface when U-Boot is not chainloaded by depthcharge but booted directly from SPI.
[0] https://marc.info/?l=u-boot&m=152836928803742&w=2
Changelog:
V2:
- Add Reviewed-by
- Expand comment on PATCH 2/3
Carlo Caione (3):
rk3288: veyron: Init boot-on regulators
rk3288: Disable JTAG function from sdmmc0 IO
rockchip: veyron: Set vcc33_sd regulator value
arch/arm/mach-rockchip/rk3288-board.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
Signature · 1 line
2.17.1
PATCH v2 1/3 rk3288: veyron: Init boot-on regulators
From: Carlo Caione <[email protected]>
Use regulators_enable_boot_on() to init all the regulators with regulator-boot-on property.
--- arch/arm/mach-rockchip/rk3288-board.c | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm/mach-rockchip/rk3288-board.c +6 -0
@@ -122,6 +122,12 @@ static int veyron_init(void)if (IS_ERR_VALUE (ret))return ret; + ret =regulators_enable_boot_on (false); +if (ret) { +debug ("%s: Cannot enable boot on regulators\n" , __func__); +return ret; + } + return 0; }#endif
Signature · 1 line
2.17.1
PATCH v2 1/3 rk3288: veyron: Init boot-on regulators
Quoted 10 lines · Carlo Caione
From: Carlo Caione <[email protected]>
Use
regulators_enable_boot_on()to init all the regulators with regulator-boot-on property.Signed-off-by Carlo Caione <[email protected]>Reviewed-by Simon Glass <[email protected]>
PATCH v2 2/3 rk3288: Disable JTAG function from sdmmc0 IO
In reply to Carlo CaioneFrom: Carlo Caione <[email protected]>
The GRF_SOC_CON0.grf_force_jtag bit is automatically set at boot and it is preventing the SDMMC to work correctly. Disable the JTAG function on the assumption that a working SD has higher priority over JTAG.
--- arch/arm/mach-rockchip/rk3288-board.c | 7 +++++++ 1 file changed, 7 insertions(+)
arch/arm/mach-rockchip/rk3288-board.c +7 -0
@@ -307,6 +307,7 @@ U_BOOT_CMD("" ); +#define GRF_SOC_CON0 0xff770244#define GRF_SOC_CON2 0xff77024cint board_early_init_f (void )
@@ -339,5 +340,11 @@ int board_early_init_f(void) }rk_setreg (GRF_SOC_CON2 ,1 <<0 ); +/* +* Disable JTAG on sdmmc0 IO. The SDMMC won't work until this bit is +* cleared +*/ +rk_clrreg (GRF_SOC_CON0 ,1 <<12 ); +return 0 ; }
Signature · 1 line
2.17.1
PATCH v2 2/3 rk3288: Disable JTAG function from sdmmc0 IO
Quoted 11 lines · Carlo Caione
From: Carlo Caione <[email protected]>
The GRF_SOC_CON0.grf_force_jtag bit is automatically set at boot and it is preventing the SDMMC to work correctly. Disable the JTAG function on the assumption that a working SD has higher priority over JTAG.
Signed-off-by Carlo Caione <[email protected]>Reviewed-by Simon Glass <[email protected]>
See below for a nitpick ...
Quoted 9 lines
---
arch/arm/mach-rockchip/rk3288-board.c| 7 +++++++1 file changed, 7 insertions(+)arch/arm/mach-rockchip/rk3288-board.c +0
-0
arch/arm/mach-rockchip/rk3288-board.c U_BOOT_CMD( · line 311
Quoted 5 lines
arch/arm/mach-rockchip/rk3288-board.c +1
-0@@ -307,6 +307,7 @@ U_BOOT_CMD("" ); +#define GRF_SOC_CON0 0xff770244#define GRF_SOC_CON2 0xff77024c
Could you convert these to ‘const uintptr_t GRF_SOC_CON0 = …’ ?
The compiler will generate the same code for a const as if it’s a define, but we’ll have full type-safety.
Quoted 17 lines
arch/arm/mach-rockchip/rk3288-board.c +6
-0int board_early_init_f (void )@@ -339,5 +340,11 @@ int board_early_init_f(void) }rk_setreg (GRF_SOC_CON2 ,1 <<0 ); +/* +* Disable JTAG on sdmmc0 IO. The SDMMC won't work until this bit is +* cleared +*/ +rk_clrreg (GRF_SOC_CON0 ,1 <<12 ); +return 0 ; }Signature · 1 line
2.17.1
PATCH v2 2/3 rk3288: Disable JTAG function from sdmmc0 IO
Quoted 1 line · Dr. Philipp Tomsich
Quoted 1 line · Carlo Caione
/cut
Quoted 7 lines
Quoted 2 lines
+#define
GRF_SOC_CON00xff770244
#defineGRF_SOC_CON20xff77024cCould you convert these to ‘const
uintptr_tGRF_SOC_CON0= …’ ? The compiler will generate the same code for a const as if it’s a define, but we’ll
have full type-safety.
Yeah, no problem. But if this is ok with you in v3 I'm going to leave this patch as is and adding one more patch to convert both the lines at the same time.
Thanks.
PATCH v2 2/3 rk3288: Disable JTAG function from sdmmc0 IO
Quoted 8 lines · Carlo Caione
Quoted 1 line · Dr. Philipp Tomsich
Quoted 1 line · Carlo Caione
/cut
Quoted 3 lines
Quoted 2 lines
+#define
GRF_SOC_CON00xff770244
#defineGRF_SOC_CON20xff77024c
Quoted 8 lines
Quoted 4 lines
Could you convert these to ‘const
uintptr_tGRF_SOC_CON0= …’ ? The compiler will generate the same code for a const as if it’s a define, but we’ll
have full type-safety.Yeah, no problem. But if this is ok with you in v3 I'm going to leave this patch as is and adding one more patch to convert both the lines at the same time.
Sure. Add another patch and I’ll squash it when applying.
—Philipp.
PATCH v2 3/3 rockchip: veyron: Set vcc33_sd regulator value
In reply to Carlo CaioneFrom: Carlo Caione <[email protected]>
On the veyron board the vcc33_sd regulator is used as vmmc-supply for the SD card. This regulator is powered in the MMC core during power on but its value is never actually set.
In the veyron platform the reset value for the LDO output is 1.8V while the standard (min and max) value for this regulator defined in the DTS is 3.3V. When the MMC core enable the regulator without setting its value, the output is automatically set to 1.8V instead of 3.3V.
With this patch we preemptively set the value to 3.3V.
--- arch/arm/mach-rockchip/rk3288-board.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/arm/mach-rockchip/rk3288-board.c +10 -0
@@ -122,6 +122,16 @@ static int veyron_init(void)if (IS_ERR_VALUE (ret))return ret; + ret =regulator_get_by_platname ("vcc33_sd" , &dev); +if (ret) { +debug ("Cannot get regulator name\n" ); +return ret; + } + + ret =regulator_set_value (dev,3300000 ); +if (ret) +return ret; + ret =regulators_enable_boot_on (false);if (ret) {debug ("%s: Cannot enable boot on regulators\n" , __func__);
Signature · 1 line
2.17.1
PATCH v2 3/3 rockchip: veyron: Set vcc33_sd regulator value
Quoted 14 lines · Carlo Caione
From: Carlo Caione <[email protected]>
On the veyron board the
vcc33_sdregulator is used as vmmc-supply for the SD card. This regulator is powered in the MMC core during power on but its value is never actually set.In the veyron platform the reset value for the LDO output is 1.8V while the standard (min and max) value for this regulator defined in the DTS is 3.3V. When the MMC core enable the regulator without setting its value, the output is automatically set to 1.8V instead of 3.3V.
Quoted 4 lines
With this patch we preemptively set the value to 3.3V.
Signed-off-by Carlo Caione <[email protected]>Reviewed-by Simon Glass <[email protected]>