rockchip: rk3399: rk3399-nanopi-4: Fix SD power initialization in SPL
Subsystems (3)
v2 cover rockchip: rk3399: rk3399-nanopi-4: Fix SD power initialization in SPL
The NanoPi RK3399 boards support UHS-I (up to SDR104) SD cards, however using any of these 1.8v modes results in a boot failure in SPL upon soft reboot.
The issue is that the "vcc_sdio" regulator is left at 1.8v on reboot and the corresponding GPIO defaults to 3.3v. This prevents the SD card from being reinitialized and read successfully.
This change series resolves this issue by allowing the proper initialization and control of the "vcc3v0_sd" (vmmc-supply) and "vcc_sdio" (vqmmc-supply) regulators and corresponding GPIO in SPL.
Changes in v2:
- Made added IO-domain driver logs verbose and consistent
- Added separate patch for added CONFIG_SPL_ROCKCHIP_IODOMAIN Kconfig
- Added separate patch for added CONFIG_SPL_REGULATOR_RK8XX Kconfig
- Added patch to remove device-tree properties that conflicted with MMC driver initialization
- Added defconfig changes for all NanoPi RK3399 boards
Justin Klaassen (5):
rockchip: io-domain: Add debug logging for regulators during probe
rockchip: io-domain: Add CONFIG_SPL_ROCKCHIP_IODOMAIN
regulator: rk8xx: Add CONFIG_SPL_REGULATOR_RK8XX
rockchip: rk3399-nanopi-4: Allow MMC driver to control SD regulators
rockchip: rk3399-nanopi-4: Enable IO-domain driver in SPL
arch/arm/dts/rk3399-nanopi4-u-boot.dtsi | 12 ++++++++++++ configs/nanopc-t4-rk3399_defconfig | 7 +++++++ configs/nanopi-m4-2gb-rk3399_defconfig | 7 +++++++ configs/nanopi-m4-rk3399_defconfig | 7 +++++++ configs/nanopi-m4b-rk3399_defconfig | 7 +++++++ configs/nanopi-neo4-rk3399_defconfig | 7 +++++++ configs/nanopi-r4s-rk3399_defconfig | 7 +++++++ drivers/misc/Kconfig | 8 ++++++++ drivers/misc/rockchip-io-domain.c | 7 ++++++- drivers/power/regulator/Kconfig | 9 +++++++++ drivers/power/regulator/rk8xx.c | 8 ++------ 11 files changed, 79 insertions(+), 7 deletions(-)
Signature · 1 line
2.45.3
PATCH v2 1/5 rockchip: io-domain: Add debug logging for regulators during probe
Log the value of the regulators during initialization of the IO-domain driver to aid in debugging GPIO voltage configuration problems.
---
Changes in v2:
- Made added IO-domain driver logs verbose and consistent
drivers/misc/rockchip-io-domain.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/misc/rockchip-io-domain.c +6 -1
@@ -5,6 +5,8 @@* Ported from linux drivers/soc/rockchip/io-domain.c */ +#define LOG_CATEGORY UCLASS_NOP +#include <dm.h> #include <dm/device_compat.h> #include <regmap.h>
@@ -344,8 +346,10 @@ static int rockchip_iodomain_probe(struct udevice *dev)continue ; ret =device_get_supply_regulator (dev, supply_name, ®); -if (ret) +if (ret) { +log_debug ("%s: Regulator not found\n" , supply_name);continue ; + } ret =regulator_autoset (reg); if (ret && ret != -EALREADY && ret != -EMEDIUMTYPE &&
@@ -353,6 +357,7 @@ static int rockchip_iodomain_probe(struct udevice *dev)continue ; uV =regulator_get_value (reg); +log_debug ("%s: Regulator %s at %d uV\n" , supply_name, reg->name, uV);if (uV <=0 )continue ;
Signature · 1 line
2.45.3
Re: [PATCH v2 1/5] rockchip: io-domain: Add debug logging for regulators during probe
Hi Justin,
Quoted 28 lines · Justin Klaassen
[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
Log the value of the regulators during initialization of the IO-domain driver to aid in debugging GPIO voltage configuration problems.
Signed-off-by Justin Klaassen <[email protected]>---
Changes in v2:
- Made added IO-domain driver logs verbose and consistentdrivers/misc/rockchip-io-domain.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/misc/rockchip-io-domain.c +2
-0@@ -5,6 +5,8 @@* Ported from linux drivers/soc/rockchip/io-domain.c */ +#define LOG_CATEGORY UCLASS_NOP +#include <dm.h> #include <dm/device_compat.h> #include <regmap.h>
drivers/misc/rockchip-io-domain.c static int rockchip_iodomain_probe(struct udevice *dev) · line 350
Quoted 6 lines
drivers/misc/rockchip-io-domain.c +2
-1@@ -344,8 +346,10 @@ static int rockchip_iodomain_probe(struct udevice *dev)continue ; ret =device_get_supply_regulator (dev, supply_name, ®); -if (ret) +if (ret) { +log_debug ("%s: Regulator not found\n" , supply_name);
Can you use dev_dbg() instead?
This would match what we use for other messages in the probe function?
Specifically, it could add the device name in front, which would be useful when debugging to highlight the IO domain device is the one requesting this regulator that isn't found.
drivers/misc/rockchip-io-domain.c static int rockchip_iodomain_probe(struct udevice *dev) · line 360
Quoted 10 lines
drivers/misc/rockchip-io-domain.c +2
-0continue ; + } ret =regulator_autoset (reg); if (ret && ret != -EALREADY && ret != -EMEDIUMTYPE &&@@ -353,6 +357,7 @@ static int rockchip_iodomain_probe(struct udevice *dev)continue ; uV =regulator_get_value (reg); +log_debug ("%s: Regulator %s at %d uV\n" , supply_name, reg->name, uV);
Ditto.
Not sure the reg->name brings a lot since this information could be derived from supply_name if I'm not mistaken, but I'm not too bothered by it :)
Cheers,
Quentin
Re: [PATCH v2 1/5] rockchip: io-domain: Add debug logging for regulators during probe
Hi Quentin,
Quoted 70 lines · Quentin Schulz
Hi Justin,
On 1/28/25 10:37 PM, Justin Klaassen wrote:
[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
Log the value of the regulators during initialization of the IO-domain
driver to aid in debugging GPIO voltage configuration problems.
Signed-off-by Justin Klaassen <[email protected]>---
Changes in v2:
- Made added IO-domain driver logs verbose and consistent
drivers/misc/rockchip-io-domain.c | 7 ++++++-1 file changed, 6 insertions(+), 1 deletion(-)drivers/misc/rockchip-io-domain.c +0
-0index
025b6049a9f..fdefc9c5fe3100644---
a/drivers/misc/rockchip-io-domain.c+++
b/drivers/misc/rockchip-io-domain.cdrivers/misc/rockchip-io-domain.c +4
-1@@ -5,6 +5,8 @@* Ported from linux drivers/soc/rockchip/io-domain.c */ +#define LOG_CATEGORY UCLASS_NOP +#include <dm.h> #include <dm/device_compat.h> #include <regmap.h> @@ -344,8 +346,10 @@ static int rockchip_iodomain_probe(struct udevice *dev)continue ; ret =device_get_supply_regulator (dev, supply_name, ®); -if (ret) +if (ret) { + log_debug("%s: Regulator not found\n",
supply_name);
Quoted 2 lines
Can you use
dev_dbg()instead?
Done.
Quoted 26 lines
This would match what we use for other messages in the probe function?
Specifically, it could add the device name in front, which would be useful when debugging to highlight the IO domain device is the one requesting this regulator that isn't found.
continue;drivers/misc/rockchip-io-domain.c +2
-0+ } ret =regulator_autoset (reg); if (ret && ret != -EALREADY && ret != -EMEDIUMTYPE &&@@ -353,6 +357,7 @@ static int rockchip_iodomain_probe(struct udevice *dev)continue ; uV =regulator_get_value (reg); + log_debug("%s: Regulator %s at %d uV\n", supply_name,
reg->name, uV);
Quoted 2 lines
Ditto.
Done.
Quoted 4 lines
Not sure the
reg->namebrings a lot since this information could be derived fromsupply_nameif I'm not mistaken, but I'm not too bothered by it 🙂
I found reg->name to be helpful when debugging as it made it slightly easier to find the correct regulator without having to go through a few levels of redirection in the device tree.
Quoted 6 lines
Cheers,
Quentin
Thanks,
Justin
PATCH v2 2/5 rockchip: io-domain: Add CONFIG_SPL_ROCKCHIP_IODOMAIN
In reply to Justin KlaassenAllows use of the Rockchip IO-domain driver in SPL to configure the GPIO to match the voltage supplied by specific regulators (e.g. "vcc_sdio").
---
Changes in v2:
- Added separate patch for added CONFIG_SPL_ROCKCHIP_IODOMAIN Kconfig
drivers/misc/Kconfig | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/misc/Kconfig +8 -0
@@ -110,6 +110,14 @@ config ROCKCHIP_IODOMAIN for the IO-domain setting of the SoC to match the voltage supplied by the regulators. +config SPL_ROCKCHIP_IODOMAIN + bool "Rockchip IO-domain driver support in SPL" + depends on SPL_MISC && ARCH_ROCKCHIP + help + Enable support for IO-domains in Rockchip SoCs in SPL. It is necessary + for the IO-domain setting of the SoC to match the voltage supplied + by the regulators. + config SIFIVE_OTP bool "SiFive eMemory OTP driver" depends on MISC
Signature · 1 line
2.45.3
Re: [PATCH v2 2/5] rockchip: io-domain: Add CONFIG_SPL_ROCKCHIP_IODOMAIN
Hi Justin
Quoted 18 lines · Justin Klaassen
Allows use of the Rockchip IO-domain driver in SPL to configure the GPIO to match the voltage supplied by specific regulators (e.g. "
vcc_sdio").Signed-off-by Justin Klaassen <[email protected]>---
Changes in v2:
- Added separate patch for addedCONFIG_SPL_ROCKCHIP_IODOMAINKconfigdrivers/misc/Kconfig | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/misc/Kconfig +0
-0
drivers/misc/Kconfig config ROCKCHIP_IODOMAIN · line 115
Quoted 6 lines
drivers/misc/Kconfig +3
-0@@ -110,6 +110,14 @@ config ROCKCHIP_IODOMAIN for the IO-domain setting of the SoC to match the voltage supplied by the regulators. +config SPL_ROCKCHIP_IODOMAIN + bool "Rockchip IO-domain driver support in SPL" + depends on SPL_MISC && ARCH_ROCKCHIP
I believe this is missing SPL_DM_REGULATOR as well?
Cheers,
Quentin
Re: [PATCH v2 2/5] rockchip: io-domain: Add CONFIG_SPL_ROCKCHIP_IODOMAIN
Hi Quentin,
Quoted 49 lines · Quentin Schulz
Hi Justin
On 1/28/25 10:37 PM, Justin Klaassen wrote:
Allows use of the Rockchip IO-domain driver in SPL to configure
the GPIO to match the voltage supplied by specific regulators
(e.g. "
vcc_sdio").Signed-off-by Justin Klaassen <[email protected]>---
Changes in v2:
- Added separate patch for added
CONFIG_SPL_ROCKCHIP_IODOMAINKconfigdrivers/misc/Kconfig | 8 ++++++++1 file changed, 8 insertions(+)drivers/misc/Kconfig +0
-0index
da84b35e804..ad935b81ae1100644--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
drivers/misc/Kconfig +3
-0@@ -110,6 +110,14 @@ config ROCKCHIP_IODOMAIN for the IO-domain setting of the SoC to match the voltage supplied by the regulators. +config SPL_ROCKCHIP_IODOMAIN + bool "Rockchip IO-domain driver support in SPL" + depends on SPL_MISC && ARCH_ROCKCHIP
Quoted 2 lines
I believe this is missing
SPL_DM_REGULATORas well?
Good catch. Fixed.
Quoted 4 lines
Cheers,
Quentin
Thanks,
Justin
PATCH v2 3/5 regulator: rk8xx: Add CONFIG_SPL_REGULATOR_RK8XX
In reply to Justin KlaassenAllows use of the regulator functions of the RK8XX PMIC in SPL, which is necessary to support the functionality of the Rockchip IO-domain driver on relevant platforms.
---
Changes in v2:
- Added separate patch for added CONFIG_SPL_REGULATOR_RK8XX Kconfig
drivers/power/regulator/Kconfig | 9 +++++++++ drivers/power/regulator/rk8xx.c | 8 ++------ 2 files changed, 11 insertions(+), 6 deletions(-)
drivers/power/regulator/Kconfig +9 -0
@@ -241,6 +241,15 @@ config REGULATOR_RK8XX by the PMIC device. This driver is controlled by a device tree node which includes voltage limits. +config SPL_REGULATOR_RK8XX + bool "Enable driver for RK8XX regulators in SPL" + depends on SPL_DM_REGULATOR && SPL_PMIC_RK8XX + help + Enable support for the regulator functions of the RK8XX PMIC in SPL. The + driver implements get/set api for the various BUCKS and LDOs supported + by the PMIC device. This driver is controlled by a device tree node + which includes voltage limits. + config DM_REGULATOR_S2MPS11 bool "Enable driver for S2MPS11 regulator" depends on DM_REGULATOR && PMIC_S2MPS11
drivers/power/regulator/rk8xx.c +2 -6
@@ -16,10 +16,6 @@#include <power/pmic.h> #include <power/regulator.h> -#ifndef CONFIG_XPL_BUILD -#define ENABLE_DRIVER -#endif -/* Not used or exisit register and configure */ #define NA 0xff
@@ -202,7 +198,7 @@ static const struct rk8xx_reg_info rk818_buck[] = { { 1800000, 100000, REG_BUCK4_ON_VSEL, REG_BUCK4_SLP_VSEL, REG_BUCK4_CONFIG, RK818_BUCK4_VSEL_MASK, 0x00, 0x1f }, }; -#ifdef ENABLE_DRIVER +#if CONFIG_IS_ENABLED (REGULATOR_RK8XX )static const struct rk8xx_reg_info rk806_nldo[] = {/* nldo 1 */ { 500000, 12500, RK806_NLDO_ON_VSEL(1), RK806_NLDO_SLP_VSEL(1), NA, RK806_NLDO_VSEL_MASK, 0x00, 0xe7},
@@ -454,7 +450,7 @@ static int _buck_set_enable(struct udevice *pmic, int buck, bool enable)return ret; } -#ifdef ENABLE_DRIVER +#if CONFIG_IS_ENABLED (REGULATOR_RK8XX )static int _buck_set_suspend_value (struct udevice *pmic,int buck,int uvolt) {const struct rk8xx_reg_info *info =get_buck_reg (pmic, buck, uvolt);
Signature · 1 line
2.45.3
Re: [PATCH v2 3/5] regulator: rk8xx: Add CONFIG_SPL_REGULATOR_RK8XX
Hi Justin,
Quoted 59 lines · Justin Klaassen
Allows use of the regulator functions of the RK8XX PMIC in SPL, which is necessary to support the functionality of the Rockchip IO-domain driver on relevant platforms.
Signed-off-by Justin Klaassen <[email protected]>---
Changes in v2:
- Added separate patch for addedCONFIG_SPL_REGULATOR_RK8XXKconfigdrivers/power/regulator/Kconfig | 9 +++++++++ drivers/power/regulator/rk8xx.c | 8 ++------ 2 files changed, 11 insertions(+), 6 deletions(-)drivers/power/regulator/Kconfig +9
-0@@ -241,6 +241,15 @@ config REGULATOR_RK8XX by the PMIC device. This driver is controlled by a device tree node which includes voltage limits. +config SPL_REGULATOR_RK8XX + bool "Enable driver for RK8XX regulators in SPL" + depends on SPL_DM_REGULATOR && SPL_PMIC_RK8XX + help + Enable support for the regulator functions of the RK8XX PMIC in SPL. The + driver implements get/set api for the various BUCKS and LDOs supported + by the PMIC device. This driver is controlled by a device tree node + which includes voltage limits. + config DM_REGULATOR_S2MPS11 bool "Enable driver for S2MPS11 regulator" depends on DM_REGULATOR && PMIC_S2MPS11drivers/power/regulator/rk8xx.c +1
-5@@ -16,10 +16,6 @@#include <power/pmic.h> #include <power/regulator.h> -#ifndef CONFIG_XPL_BUILD -#define ENABLE_DRIVER -#endif -/* Not used or exisit register and configure */ #define NA 0xff@@ -202,7 +198,7 @@ static const struct rk8xx_reg_info rk818_buck[] = { { 1800000, 100000, REG_BUCK4_ON_VSEL, REG_BUCK4_SLP_VSEL, REG_BUCK4_CONFIG, RK818_BUCK4_VSEL_MASK, 0x00, 0x1f }, }; -#ifdef ENABLE_DRIVER +#if CONFIG_IS_ENABLED (REGULATOR_RK8XX )static const struct rk8xx_reg_info rk806_nldo[] = {/* nldo 1 */ { 500000, 12500, RK806_NLDO_ON_VSEL(1), RK806_NLDO_SLP_VSEL(1), NA, RK806_NLDO_VSEL_MASK, 0x00, 0xe7},
drivers/power/regulator/rk8xx.c static int _buck_set_enable(struct udevice *pmic, int buck, bool enable) · line 456
Quoted 8 lines
drivers/power/regulator/rk8xx.c +1
-1@@ -454,7 +450,7 @@ static int _buck_set_enable(struct udevice *pmic, int buck, bool enable)return ret; } -#ifdef ENABLE_DRIVER +#if CONFIG_IS_ENABLED (REGULATOR_RK8XX )static int _buck_set_suspend_value (struct udevice *pmic,int buck,int uvolt) {const struct rk8xx_reg_info *info =get_buck_reg (pmic, buck, uvolt);
I would split the modification of the c file into a separate patch as the addition of the symbol and the modification of the C file aren't per se co-dependent.
Their order wouldn't even matter in that case.
In any case, looks good to me so:
Thanks!
Quentin
Re: [PATCH v2 3/5] regulator: rk8xx: Add CONFIG_SPL_REGULATOR_RK8XX
In reply to Justin KlaassenHi Justin,
Quoted 59 lines · Justin Klaassen
Allows use of the regulator functions of the RK8XX PMIC in SPL, which is necessary to support the functionality of the Rockchip IO-domain driver on relevant platforms.
Signed-off-by Justin Klaassen <[email protected]>---
Changes in v2:
- Added separate patch for addedCONFIG_SPL_REGULATOR_RK8XXKconfigdrivers/power/regulator/Kconfig | 9 +++++++++ drivers/power/regulator/rk8xx.c | 8 ++------ 2 files changed, 11 insertions(+), 6 deletions(-)drivers/power/regulator/Kconfig +9
-0@@ -241,6 +241,15 @@ config REGULATOR_RK8XX by the PMIC device. This driver is controlled by a device tree node which includes voltage limits. +config SPL_REGULATOR_RK8XX + bool "Enable driver for RK8XX regulators in SPL" + depends on SPL_DM_REGULATOR && SPL_PMIC_RK8XX + help + Enable support for the regulator functions of the RK8XX PMIC in SPL. The + driver implements get/set api for the various BUCKS and LDOs supported + by the PMIC device. This driver is controlled by a device tree node + which includes voltage limits. + config DM_REGULATOR_S2MPS11 bool "Enable driver for S2MPS11 regulator" depends on DM_REGULATOR && PMIC_S2MPS11drivers/power/regulator/rk8xx.c +1
-5@@ -16,10 +16,6 @@#include <power/pmic.h> #include <power/regulator.h> -#ifndef CONFIG_XPL_BUILD -#define ENABLE_DRIVER -#endif -/* Not used or exisit register and configure */ #define NA 0xff@@ -202,7 +198,7 @@ static const struct rk8xx_reg_info rk818_buck[] = { { 1800000, 100000, REG_BUCK4_ON_VSEL, REG_BUCK4_SLP_VSEL, REG_BUCK4_CONFIG, RK818_BUCK4_VSEL_MASK, 0x00, 0x1f }, }; -#ifdef ENABLE_DRIVER +#if CONFIG_IS_ENABLED (REGULATOR_RK8XX )static const struct rk8xx_reg_info rk806_nldo[] = {/* nldo 1 */ { 500000, 12500, RK806_NLDO_ON_VSEL(1), RK806_NLDO_SLP_VSEL(1), NA, RK806_NLDO_VSEL_MASK, 0x00, 0xe7},
drivers/power/regulator/rk8xx.c static int _buck_set_enable(struct udevice *pmic, int buck, bool enable) · line 456
Quoted 8 lines
drivers/power/regulator/rk8xx.c +1
-1@@ -454,7 +450,7 @@ static int _buck_set_enable(struct udevice *pmic, int buck, bool enable)return ret; } -#ifdef ENABLE_DRIVER +#if CONFIG_IS_ENABLED (REGULATOR_RK8XX )static int _buck_set_suspend_value (struct udevice *pmic,int buck,int uvolt) {const struct rk8xx_reg_info *info =get_buck_reg (pmic, buck, uvolt);
I would split the modification of the c file into a separate patch as the addition of the symbol and the modification of the C file aren't per se co-dependent.
Their order wouldn't even matter in that case.
In any case, looks good to me so:
Thanks!
Quentin
Re: [PATCH v2 3/5] regulator: rk8xx: Add CONFIG_SPL_REGULATOR_RK8XX
Hi Quentin,
Quoted 139 lines · Quentin Schulz
Hi Justin,
On 1/28/25 10:37 PM, Justin Klaassen wrote:
Allows use of the regulator functions of the RK8XX PMIC in SPL, which is
necessary to support the functionality of the Rockchip IO-domain driver
on relevant platforms.
Signed-off-by Justin Klaassen <[email protected]>---
Changes in v2:
- Added separate patch for added
CONFIG_SPL_REGULATOR_RK8XXKconfigdrivers/power/regulator/Kconfig | 9 +++++++++drivers/power/regulator/rk8xx.c | 8 ++------2 files changed, 11 insertions(+), 6 deletions(-)drivers/power/regulator/Kconfig +0
-0index
958f337c7e7..9b50128f859100644--- a/drivers/power/regulator/Kconfig
+++ b/drivers/power/regulator/Kconfig
drivers/power/regulator/Kconfig +5
-0@@ -241,6 +241,15 @@ config REGULATOR_RK8XX by the PMIC device. This driver is controlled by a device tree node which includes voltage limits. +config SPL_REGULATOR_RK8XX + bool "Enable driver for RK8XX regulators in SPL" + depends on SPL_DM_REGULATOR && SPL_PMIC_RK8XX + help + Enable support for the regulator functions of the RK8XX PMIC in SPL.The
drivers/power/regulator/Kconfig +4
-0+ driver implements get/set api for the various BUCKS and LDOs supported + by the PMIC device. This driver is controlled by a device tree node + which includes voltage limits. + config DM_REGULATOR_S2MPS11 bool "Enable driver for S2MPS11 regulator" depends on DM_REGULATOR && PMIC_S2MPS11drivers/power/regulator/rk8xx.c +0
-0index
368675ebb9f..88453bb7bdb100644---
a/drivers/power/regulator/rk8xx.c+++
b/drivers/power/regulator/rk8xx.cdrivers/power/regulator/rk8xx.c +1
-5@@ -16,10 +16,6 @@#include <power/pmic.h> #include <power/regulator.h> -#ifndef CONFIG_XPL_BUILD -#define ENABLE_DRIVER -#endif -/* Not used or exisit register and configure */ #define NA 0xff@@ -202,7 +198,7 @@ static const struct rk8xx_reg_info rk818_buck[] = { { 1800000, 100000, REG_BUCK4_ON_VSEL, REG_BUCK4_SLP_VSEL, REG_BUCK4_CONFIG, RK818_BUCK4_VSEL_MASK, 0x00, 0x1f }, }; -#ifdef ENABLE_DRIVER +#if CONFIG_IS_ENABLED(REGULATOR_RK8XX) static const struct rk8xx_reg_info rk806_nldo[] = { /* nldo 1 */ { 500000, 12500, RK806_NLDO_ON_VSEL(1), RK806_NLDO_SLP_VSEL(1), NA,
RK806_NLDO_VSEL_MASK,0x00,0xe7},drivers/power/regulator/rk8xx.c +1
-1@@ -454,7 +450,7 @@ static int _buck_set_enable(struct udevice *pmic, int buck, bool enable)return ret; } -#ifdef ENABLE_DRIVER +#if CONFIG_IS_ENABLED (REGULATOR_RK8XX ) static int _buck_set_suspend_value(struct udevice *pmic, int buck, intuvolt)
{
Quoted 9 lines
const struct rk8xx_reg_info *info = get_buck_reg(pmic, buck, uvolt);I would split the modification of the c file into a separate patch as the addition of the symbol and the modification of the C file aren't per se co-dependent.
Their order wouldn't even matter in that case.
My preference was to keep these changes together. Without the modification to the C file, enabling CONFIG_SPL_REGULATOR_RK8XX would not have the expected behavior since most of the driver code would still be disabled. If you feel strongly otherwise, I am happy to split into separate patches.
Quoted 8 lines
In any case, looks good to me so:
Reviewed-by Quentin Schulz <[email protected]>Thanks!
Quentin
Thanks,
Justin
PATCH v2 4/5 rockchip: rk3399-nanopi-4: Allow MMC driver to control SD regulators
In reply to Justin KlaassenThis change removes the "regulator-always-on" property from the "vcc3v0_sd" (vmmc-supply) and "vcc_sdio" (vqmmc-supply) regulators, which otherwise prevents the MMC driver from being able to power cycle the SD card as part of the initialization procedure.
It also removes the "regulator-boot-on" from the "vcc_sdio" regulator, which could theoretically damage a SD card that is already initialized in a low voltage mode.
---
Changes in v2:
- Added patch to remove device-tree properties that conflicted with MMC driver initialization
arch/arm/dts/rk3399-nanopi4-u-boot.dtsi | 3 +++ 1 file changed, 3 insertions(+)
arch/arm/dts/rk3399-nanopi4-u-boot.dtsi +3 -0
@@ -19,8 +19,11 @@ &vcc3v0_sd { bootph-pre-ram; + /delete-property/ regulator-always-on; }; &vcc_sdio { + /delete-property/ regulator-always-on; + /delete-property/ regulator-boot-on; regulator-init-microvolt = <3000000>; };
Signature · 1 line
2.45.3
PATCH v2 5/5 rockchip: rk3399-nanopi-4: Enable IO-domain driver in SPL
In reply to Justin KlaassenThe NanoPi RK3399 boards support UHS-I (up to SDR104) SD cards, however using any of these 1.8v modes results in a boot failure in SPL upon soft reboot.
The issue is that the "vcc_sdio" regulator is left at 1.8v on reboot and the corresponding GPIO defaults to 3.3v. This prevents the SD card from being reinitialized and read successfully.
This change enables the RK8XX regulators and Rockchip IO-domain drivers in SPL, which initializes "vcc_sdio" regulator to 3.0v and configures the GPIO for the correct level on boot.
---
Changes in v2:
- Added defconfig changes for all NanoPi RK3399 boards
arch/arm/dts/rk3399-nanopi4-u-boot.dtsi | 9 +++++++++ configs/nanopc-t4-rk3399_defconfig | 7 +++++++ configs/nanopi-m4-2gb-rk3399_defconfig | 7 +++++++ configs/nanopi-m4-rk3399_defconfig | 7 +++++++ configs/nanopi-m4b-rk3399_defconfig | 7 +++++++ configs/nanopi-neo4-rk3399_defconfig | 7 +++++++ configs/nanopi-r4s-rk3399_defconfig | 7 +++++++ 7 files changed, 51 insertions(+)
arch/arm/dts/rk3399-nanopi4-u-boot.dtsi +9 -0
@@ -9,6 +9,14 @@ bootph-pre-ram; }; +&i2c0_xfer { + bootph-pre-ram; +}; + +&io_domains { + bootph-pre-ram; +}; + &sdmmc { pinctrl-0 = <&sdmmc_bus4 &sdmmc_clk &sdmmc_cmd &sdmmc_cd>; };
@@ -23,6 +31,7 @@ }; &vcc_sdio { + bootph-pre-ram; /delete-property/ regulator-always-on; /delete-property/ regulator-boot-on; regulator-init-microvolt = <3000000>;
configs/nanopc-t4-rk3399_defconfig +7 -0
@@ -8,6 +8,7 @@ CONFIG_ENV_OFFSET=0x3F8000 CONFIG_DEFAULT_DEVICE_TREE="rockchip/rk3399-nanopc-t4" CONFIG_DM_RESET=y CONFIG_ROCKCHIP_RK3399=y +CONFIG_SPL_DRIVERS_MISC=y CONFIG_TARGET_EVB_RK3399=y CONFIG_SYS_LOAD_ADDR=0x800800 CONFIG_DEBUG_UART_BASE=0xFF1A0000
@@ -19,6 +20,8 @@ CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_SPL_MAX_SIZE=0x40000 CONFIG_SPL_PAD_TO=0x7f8000 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set +CONFIG_SPL_I2C=y +CONFIG_SPL_POWER=y CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y CONFIG_TPL=y CONFIG_CMD_BOOTZ=y
@@ -35,6 +38,7 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_ROCKCHIP_GPIO=y CONFIG_SYS_I2C_ROCKCHIP=y CONFIG_ROCKCHIP_IODOMAIN=y +CONFIG_SPL_ROCKCHIP_IODOMAIN=y CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y CONFIG_MMC_SDHCI=y
@@ -48,8 +52,11 @@ CONFIG_NVME_PCI=y CONFIG_PHY_ROCKCHIP_INNO_USB2=y CONFIG_PHY_ROCKCHIP_TYPEC=y CONFIG_PMIC_RK8XX=y +CONFIG_SPL_PMIC_RK8XX=y +CONFIG_SPL_DM_REGULATOR=y CONFIG_SPL_DM_REGULATOR_FIXED=y CONFIG_REGULATOR_RK8XX=y +CONFIG_SPL_REGULATOR_RK8XX=y CONFIG_PWM_ROCKCHIP=y CONFIG_BAUDRATE=1500000 CONFIG_DEBUG_UART_SHIFT=2
configs/nanopi-m4-2gb-rk3399_defconfig +7 -0
@@ -8,6 +8,7 @@ CONFIG_ENV_OFFSET=0x3F8000 CONFIG_DEFAULT_DEVICE_TREE="rk3399-nanopi-m4-2gb" CONFIG_DM_RESET=y CONFIG_ROCKCHIP_RK3399=y +CONFIG_SPL_DRIVERS_MISC=y CONFIG_TARGET_EVB_RK3399=y CONFIG_SYS_LOAD_ADDR=0x800800 CONFIG_DEBUG_UART_BASE=0xFF1A0000
@@ -20,6 +21,8 @@ CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_SPL_MAX_SIZE=0x40000 CONFIG_SPL_PAD_TO=0x7f8000 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set +CONFIG_SPL_I2C=y +CONFIG_SPL_POWER=y CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y CONFIG_TPL=y CONFIG_CMD_BOOTZ=y
@@ -39,6 +42,7 @@ CONFIG_AHCI_PCI=y CONFIG_ROCKCHIP_GPIO=y CONFIG_SYS_I2C_ROCKCHIP=y CONFIG_ROCKCHIP_IODOMAIN=y +CONFIG_SPL_ROCKCHIP_IODOMAIN=y CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y CONFIG_MMC_SDHCI=y
@@ -52,8 +56,11 @@ CONFIG_NVME_PCI=y CONFIG_PHY_ROCKCHIP_INNO_USB2=y CONFIG_PHY_ROCKCHIP_TYPEC=y CONFIG_PMIC_RK8XX=y +CONFIG_SPL_PMIC_RK8XX=y +CONFIG_SPL_DM_REGULATOR=y CONFIG_SPL_DM_REGULATOR_FIXED=y CONFIG_REGULATOR_RK8XX=y +CONFIG_SPL_REGULATOR_RK8XX=y CONFIG_PWM_ROCKCHIP=y CONFIG_SCSI=y CONFIG_BAUDRATE=1500000
configs/nanopi-m4-rk3399_defconfig +7 -0
@@ -8,6 +8,7 @@ CONFIG_ENV_OFFSET=0x3F8000 CONFIG_DEFAULT_DEVICE_TREE="rockchip/rk3399-nanopi-m4" CONFIG_DM_RESET=y CONFIG_ROCKCHIP_RK3399=y +CONFIG_SPL_DRIVERS_MISC=y CONFIG_TARGET_EVB_RK3399=y CONFIG_SYS_LOAD_ADDR=0x800800 CONFIG_DEBUG_UART_BASE=0xFF1A0000
@@ -20,6 +21,8 @@ CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_SPL_MAX_SIZE=0x40000 CONFIG_SPL_PAD_TO=0x7f8000 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set +CONFIG_SPL_I2C=y +CONFIG_SPL_POWER=y CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y CONFIG_TPL=y CONFIG_CMD_BOOTZ=y
@@ -38,6 +41,7 @@ CONFIG_AHCI_PCI=y CONFIG_ROCKCHIP_GPIO=y CONFIG_SYS_I2C_ROCKCHIP=y CONFIG_ROCKCHIP_IODOMAIN=y +CONFIG_SPL_ROCKCHIP_IODOMAIN=y CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y CONFIG_MMC_SDHCI=y
@@ -51,8 +55,11 @@ CONFIG_NVME_PCI=y CONFIG_PHY_ROCKCHIP_INNO_USB2=y CONFIG_PHY_ROCKCHIP_TYPEC=y CONFIG_PMIC_RK8XX=y +CONFIG_SPL_PMIC_RK8XX=y +CONFIG_SPL_DM_REGULATOR=y CONFIG_SPL_DM_REGULATOR_FIXED=y CONFIG_REGULATOR_RK8XX=y +CONFIG_SPL_REGULATOR_RK8XX=y CONFIG_PWM_ROCKCHIP=y CONFIG_SCSI=y CONFIG_BAUDRATE=1500000
configs/nanopi-m4b-rk3399_defconfig +7 -0
@@ -8,6 +8,7 @@ CONFIG_ENV_OFFSET=0x3F8000 CONFIG_DEFAULT_DEVICE_TREE="rockchip/rk3399-nanopi-m4b" CONFIG_DM_RESET=y CONFIG_ROCKCHIP_RK3399=y +CONFIG_SPL_DRIVERS_MISC=y CONFIG_TARGET_EVB_RK3399=y CONFIG_SYS_LOAD_ADDR=0x800800 CONFIG_DEBUG_UART_BASE=0xFF1A0000
@@ -20,6 +21,8 @@ CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_SPL_MAX_SIZE=0x40000 CONFIG_SPL_PAD_TO=0x7f8000 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set +CONFIG_SPL_I2C=y +CONFIG_SPL_POWER=y CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y CONFIG_TPL=y CONFIG_CMD_BOOTZ=y
@@ -38,6 +41,7 @@ CONFIG_AHCI_PCI=y CONFIG_ROCKCHIP_GPIO=y CONFIG_SYS_I2C_ROCKCHIP=y CONFIG_ROCKCHIP_IODOMAIN=y +CONFIG_SPL_ROCKCHIP_IODOMAIN=y CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y CONFIG_MMC_SDHCI=y
@@ -51,8 +55,11 @@ CONFIG_NVME_PCI=y CONFIG_PHY_ROCKCHIP_INNO_USB2=y CONFIG_PHY_ROCKCHIP_TYPEC=y CONFIG_PMIC_RK8XX=y +CONFIG_SPL_PMIC_RK8XX=y +CONFIG_SPL_DM_REGULATOR=y CONFIG_SPL_DM_REGULATOR_FIXED=y CONFIG_REGULATOR_RK8XX=y +CONFIG_SPL_REGULATOR_RK8XX=y CONFIG_PWM_ROCKCHIP=y CONFIG_SCSI=y CONFIG_BAUDRATE=1500000
configs/nanopi-neo4-rk3399_defconfig +7 -0
@@ -8,6 +8,7 @@ CONFIG_ENV_OFFSET=0x3F8000 CONFIG_DEFAULT_DEVICE_TREE="rockchip/rk3399-nanopi-neo4" CONFIG_DM_RESET=y CONFIG_ROCKCHIP_RK3399=y +CONFIG_SPL_DRIVERS_MISC=y CONFIG_TARGET_EVB_RK3399=y CONFIG_SYS_LOAD_ADDR=0x800800 CONFIG_DEBUG_UART_BASE=0xFF1A0000
@@ -18,6 +19,8 @@ CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_SPL_MAX_SIZE=0x40000 CONFIG_SPL_PAD_TO=0x7f8000 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set +CONFIG_SPL_I2C=y +CONFIG_SPL_POWER=y CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y CONFIG_TPL=y CONFIG_CMD_BOOTZ=y
@@ -33,6 +36,7 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_ROCKCHIP_GPIO=y CONFIG_SYS_I2C_ROCKCHIP=y CONFIG_ROCKCHIP_IODOMAIN=y +CONFIG_SPL_ROCKCHIP_IODOMAIN=y CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y CONFIG_MMC_SDHCI=y
@@ -45,8 +49,11 @@ CONFIG_GMAC_ROCKCHIP=y CONFIG_PHY_ROCKCHIP_INNO_USB2=y CONFIG_PHY_ROCKCHIP_TYPEC=y CONFIG_PMIC_RK8XX=y +CONFIG_SPL_PMIC_RK8XX=y +CONFIG_SPL_DM_REGULATOR=y CONFIG_SPL_DM_REGULATOR_FIXED=y CONFIG_REGULATOR_RK8XX=y +CONFIG_SPL_REGULATOR_RK8XX=y CONFIG_PWM_ROCKCHIP=y CONFIG_BAUDRATE=1500000 CONFIG_DEBUG_UART_SHIFT=2
configs/nanopi-r4s-rk3399_defconfig +7 -0
@@ -8,6 +8,7 @@ CONFIG_ENV_OFFSET=0x3F8000 CONFIG_DEFAULT_DEVICE_TREE="rockchip/rk3399-nanopi-r4s" CONFIG_DM_RESET=y CONFIG_ROCKCHIP_RK3399=y +CONFIG_SPL_DRIVERS_MISC=y CONFIG_TARGET_EVB_RK3399=y CONFIG_SYS_LOAD_ADDR=0x800800 CONFIG_DEBUG_UART_BASE=0xFF1A0000
@@ -18,6 +19,8 @@ CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_SPL_MAX_SIZE=0x40000 CONFIG_SPL_PAD_TO=0x7f8000 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set +CONFIG_SPL_I2C=y +CONFIG_SPL_POWER=y CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y CONFIG_TPL=y CONFIG_CMD_BOOTZ=y
@@ -33,6 +36,7 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_ROCKCHIP_GPIO=y CONFIG_SYS_I2C_ROCKCHIP=y CONFIG_ROCKCHIP_IODOMAIN=y +CONFIG_SPL_ROCKCHIP_IODOMAIN=y CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y CONFIG_MMC_SDHCI=y
@@ -45,8 +49,11 @@ CONFIG_GMAC_ROCKCHIP=y CONFIG_PHY_ROCKCHIP_INNO_USB2=y CONFIG_PHY_ROCKCHIP_TYPEC=y CONFIG_PMIC_RK8XX=y +CONFIG_SPL_PMIC_RK8XX=y +CONFIG_SPL_DM_REGULATOR=y CONFIG_SPL_DM_REGULATOR_FIXED=y CONFIG_REGULATOR_RK8XX=y +CONFIG_SPL_REGULATOR_RK8XX=y CONFIG_PWM_ROCKCHIP=y CONFIG_RAM_ROCKCHIP_LPDDR4=y CONFIG_BAUDRATE=1500000
Signature · 1 line
2.45.3