power: regulator: Trigger probe of regulators which are always-on or boot-on
Subsystems (6)
PATCH 1/4 power: regulator: Trigger probe of regulators which are always-on or boot-on
In case a regulator DT node contains regulator-always-on or regulator-boot-on property, make sure the regulator gets correctly configured by U-Boot on start up. Unconditionally probe such regulator drivers. This is a preparatory patch for introduction of .regulator_post_probe() which would trigger the regulator configuration.
Parsing of regulator-always-on and regulator-boot-on DT property has been moved to regulator_post_bind() as the information is required early, the rest of the DT parsing has been kept in regulator_pre_probe() to avoid slowing down the boot process.
---
Cc: Ben Wolsieffer <[email protected]>
Cc: Caleb Connolly <[email protected]>
Cc: Chris Morgan <[email protected]>
Cc: Dragan Simic <[email protected]>
Cc: Eugen Hristev <[email protected]>
Cc: Francesco Dolcini <[email protected]>
Cc: Heinrich Schuchardt <[email protected]>
Cc: Jaehoon Chung <[email protected]>
Cc: Jagan Teki <[email protected]>
Cc: Jonas Karlman <[email protected]>
Cc: Kever Yang <[email protected]>
Cc: Kostya Porotchkin <[email protected]>
Cc: Matteo Lisi <[email protected]>
Cc: Mattijs Korpershoek <[email protected]>
Cc: Max Krummenacher <[email protected]>
Cc: Neil Armstrong <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Philipp Tomsich <[email protected]>
Cc: Quentin Schulz <[email protected]>
Cc: Sam Day <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Sumit Garg <[email protected]>
Cc: Svyatoslav Ryhel <[email protected]>
Cc: Thierry Reding <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: Volodymyr Babchuk <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
--- drivers/power/regulator/regulator-uclass.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-)
drivers/power/regulator/regulator-uclass.c +15 -7
@@ -433,6 +433,8 @@ static int regulator_post_bind(struct udevice *dev)const char *property ="regulator-name" ; uc_pdata =dev_get_uclass_plat (dev); + uc_pdata->always_on =dev_read_bool (dev,"regulator-always-on" ); + uc_pdata->boot_on =dev_read_bool (dev,"regulator-boot-on" );/* Regulator's mandatory constraint */ uc_pdata->name =dev_read_string (dev, property);
@@ -444,13 +446,21 @@ static int regulator_post_bind(struct udevice *dev)return -EINVAL ; } -if (regulator_name_is_unique (dev, uc_pdata->name)) -return 0 ; +if (!regulator_name_is_unique (dev, uc_pdata->name)) { +debug ("'%s' of dev: '%s', has nonunique value: '%s\n" , + property, dev->name, uc_pdata->name); +return -EINVAL ; + } -debug ("'%s' of dev: '%s', has nonunique value: '%s\n" , - property, dev->name, uc_pdata->name); +/* +* In case the regulator has regulator-always-on or +* regulator-boot-on DT property, trigger probe() to +* configure its default state during startup. +*/ +if (uc_pdata->always_on && uc_pdata->boot_on) +dev_or_flags (dev,DM_FLAG_PROBE_AFTER_BIND ); -return -EINVAL ; +return 0 ; }static int regulator_pre_probe (struct udevice *dev)
@@ -473,8 +483,6 @@ static int regulator_pre_probe(struct udevice *dev) -ENODATA); uc_pdata->max_uA =dev_read_u32_default (dev,"regulator-max-microamp" , -ENODATA ); - uc_pdata->always_on =dev_read_bool (dev,"regulator-always-on" ); - uc_pdata->boot_on =dev_read_bool (dev,"regulator-boot-on" ); uc_pdata->ramp_delay =dev_read_u32_default (dev,"regulator-ramp-delay" ,0 ); uc_pdata->force_off =dev_read_bool (dev,"regulator-force-boot-off" );
Signature · 1 line
2.43.0
PATCH 2/4 power: regulator: Convert regulators_enable_boot_on/off() to regulator_post_probe
Turn regulators_enable_boot_on() and regulators_enable_boot_off() into empty functions. Implement matching functionality in regulator_post_probe() instead. The regulator_post_probe() is called for all regulators after they probe, and regulators that have regulator-always-on or regulator-boot-on DT properties now always probe due to DM_FLAG_PROBE_AFTER_BIND being set on such regulators in regulator_post_bind().
Finally, fold regulator_unset() functionality into regulator_autoset().
---
Cc: Ben Wolsieffer <[email protected]>
Cc: Caleb Connolly <[email protected]>
Cc: Chris Morgan <[email protected]>
Cc: Dragan Simic <[email protected]>
Cc: Eugen Hristev <[email protected]>
Cc: Francesco Dolcini <[email protected]>
Cc: Heinrich Schuchardt <[email protected]>
Cc: Jaehoon Chung <[email protected]>
Cc: Jagan Teki <[email protected]>
Cc: Jonas Karlman <[email protected]>
Cc: Kever Yang <[email protected]>
Cc: Kostya Porotchkin <[email protected]>
Cc: Matteo Lisi <[email protected]>
Cc: Mattijs Korpershoek <[email protected]>
Cc: Max Krummenacher <[email protected]>
Cc: Neil Armstrong <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Philipp Tomsich <[email protected]>
Cc: Quentin Schulz <[email protected]>
Cc: Sam Day <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Sumit Garg <[email protected]>
Cc: Svyatoslav Ryhel <[email protected]>
Cc: Thierry Reding <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: Volodymyr Babchuk <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
--- drivers/power/regulator/regulator-uclass.c | 60 +++++++--------------- 1 file changed, 19 insertions(+), 41 deletions(-)
drivers/power/regulator/regulator-uclass.c +19 -41
@@ -308,6 +308,11 @@ int regulator_autoset(struct udevice *dev)return ret; } +if (uc_pdata->force_off) { + ret =regulator_set_enable (dev, false); + goto out; + } +if (!uc_pdata->always_on && !uc_pdata->boot_on) { ret = -EMEDIUMTYPE ; goto out;
@@ -512,56 +517,28 @@ static int regulator_pre_probe(struct udevice *dev)return 0 ; } -int regulators_enable_boot_on (bool verbose) +static int regulator_post_probe (struct udevice *dev) { -struct udevice *dev; -struct uclass *uc;int ret; - ret =uclass_get (UCLASS_REGULATOR , &uc); -if (ret) + ret =regulator_autoset (dev); +if (ret && ret != -EMEDIUMTYPE && ret !=ENOSYS )return ret; -for (uclass_first_device (UCLASS_REGULATOR , &dev); - dev; -uclass_next_device (&dev)) { - ret =regulator_autoset (dev); -if (ret == -EMEDIUMTYPE ) { - ret =0 ; -continue ; - } -if (verbose) -regulator_show (dev, ret); -if (ret == -ENOSYS ) - ret =0 ; - } -return ret; +if (_DEBUG) +regulator_show (dev, ret); + +return 0 ; } -int regulators_enable_boot_off (bool verbose) +int regulators_enable_boot_on (bool verbose) { -struct udevice *dev; -struct uclass *uc; -int ret; - - ret =uclass_get (UCLASS_REGULATOR , &uc); -if (ret) -return ret; -for (uclass_first_device (UCLASS_REGULATOR , &dev); - dev; -uclass_next_device (&dev)) { - ret =regulator_unset (dev); -if (ret == -EMEDIUMTYPE ) { - ret =0 ; -continue ; - } -if (verbose) -regulator_show (dev, ret); -if (ret == -ENOSYS ) - ret =0 ; - } +return 0 ; +} -return ret; +int regulators_enable_boot_off (bool verbose) +{ +return 0 ; }UCLASS_DRIVER (regulator) = {
@@ -569,5 +546,6 @@ UCLASS_DRIVER(regulator) = { .name = "regulator", .post_bind = regulator_post_bind, .pre_probe = regulator_pre_probe, + .post_probe = regulator_post_probe, .per_device_plat_auto = sizeof(struct dm_regulator_uclass_plat), };
Signature · 1 line
2.43.0
Re: [PATCH 2/4] power: regulator: Convert regulators_enable_boot_on/off() to regulator_post_probe
Hi Marek,
Quoted 144 lines · Marek Vasut
Turn
regulators_enable_boot_on()andregulators_enable_boot_off()into empty functions. Implement matching functionality inregulator_post_probe()instead. Theregulator_post_probe()is called for all regulators after they probe, and regulators that have regulator-always-on or regulator-boot-on DT properties now always probe due toDM_FLAG_PROBE_AFTER_BINDbeing set on such regulators inregulator_post_bind().Finally, fold
regulator_unset()functionality intoregulator_autoset().Signed-off-by Marek Vasut <[email protected]>---
Cc: Ben Wolsieffer <[email protected]>
Cc: Caleb Connolly <[email protected]>
Cc: Chris Morgan <[email protected]>
Cc: Dragan Simic <[email protected]>
Cc: Eugen Hristev <[email protected]>
Cc: Francesco Dolcini <[email protected]>
Cc: Heinrich Schuchardt <[email protected]>
Cc: Jaehoon Chung <[email protected]>
Cc: Jagan Teki <[email protected]>
Cc: Jonas Karlman <[email protected]>
Cc: Kever Yang <[email protected]>
Cc: Kostya Porotchkin <[email protected]>
Cc: Matteo Lisi <[email protected]>
Cc: Mattijs Korpershoek <[email protected]>
Cc: Max Krummenacher <[email protected]>
Cc: Neil Armstrong <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Philipp Tomsich <[email protected]>
Cc: Quentin Schulz <[email protected]>
Cc: Sam Day <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Sumit Garg <[email protected]>
Cc: Svyatoslav Ryhel <[email protected]>
Cc: Thierry Reding <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: Volodymyr Babchuk <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]--- drivers/power/regulator/regulator-uclass.c | 60 +++++++--------------- 1 file changed, 19 insertions(+), 41 deletions(-)drivers/power/regulator/regulator-uclass.c +19
-42@@ -308,6 +308,11 @@ int regulator_autoset(struct udevice *dev)return ret; } +if (uc_pdata->force_off) { + ret =regulator_set_enable (dev, false); + goto out; + } +if (!uc_pdata->always_on && !uc_pdata->boot_on) { ret = -EMEDIUMTYPE ; goto out;@@ -512,56 +517,28 @@ static int regulator_pre_probe(struct udevice *dev)return 0 ; } -int regulators_enable_boot_on (bool verbose) +static int regulator_post_probe (struct udevice *dev) { -struct udevice *dev; -struct uclass *uc;int ret; - ret =uclass_get (UCLASS_REGULATOR , &uc); -if (ret) + ret =regulator_autoset (dev); +if (ret && ret != -EMEDIUMTYPE && ret !=ENOSYS )return ret; -for (uclass_first_device (UCLASS_REGULATOR , &dev); - dev; -uclass_next_device (&dev)) { - ret =regulator_autoset (dev); -if (ret == -EMEDIUMTYPE ) { - ret =0 ; -continue ; - } -if (verbose) -regulator_show (dev, ret); -if (ret == -ENOSYS ) - ret =0 ; - } -return ret; +if (_DEBUG) +regulator_show (dev, ret); + +return 0 ; } -int regulators_enable_boot_off (bool verbose) +int regulators_enable_boot_on (bool verbose) { -struct udevice *dev; -struct uclass *uc; -int ret; - - ret =uclass_get (UCLASS_REGULATOR , &uc); -if (ret) -return ret; -for (uclass_first_device (UCLASS_REGULATOR , &dev); - dev; -uclass_next_device (&dev)) { - ret =regulator_unset (dev); -if (ret == -EMEDIUMTYPE ) { - ret =0 ; -continue ; - } -if (verbose) -regulator_show (dev, ret); -if (ret == -ENOSYS ) - ret =0 ; - } +return 0 ; +} -return ret; +int regulators_enable_boot_off (bool verbose) +{ +return 0 ; }UCLASS_DRIVER (regulator) = {@@ -569,5 +546,6 @@ UCLASS_DRIVER(regulator) = { .name = "regulator", .post_bind = regulator_post_bind, .pre_probe = regulator_pre_probe, + .post_probe = regulator_post_probe, .per_device_plat_auto = sizeof(struct dm_regulator_uclass_plat), }; --2.43.0
PATCH 3/4 power: regulator: Drop regulator_unset()
In reply to Marek VasutThis function is never called, drop it.
---
Cc: Ben Wolsieffer <[email protected]>
Cc: Caleb Connolly <[email protected]>
Cc: Chris Morgan <[email protected]>
Cc: Dragan Simic <[email protected]>
Cc: Eugen Hristev <[email protected]>
Cc: Francesco Dolcini <[email protected]>
Cc: Heinrich Schuchardt <[email protected]>
Cc: Jaehoon Chung <[email protected]>
Cc: Jagan Teki <[email protected]>
Cc: Jonas Karlman <[email protected]>
Cc: Kever Yang <[email protected]>
Cc: Kostya Porotchkin <[email protected]>
Cc: Matteo Lisi <[email protected]>
Cc: Mattijs Korpershoek <[email protected]>
Cc: Max Krummenacher <[email protected]>
Cc: Neil Armstrong <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Philipp Tomsich <[email protected]>
Cc: Quentin Schulz <[email protected]>
Cc: Sam Day <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Sumit Garg <[email protected]>
Cc: Svyatoslav Ryhel <[email protected]>
Cc: Thierry Reding <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: Volodymyr Babchuk <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
--- drivers/power/regulator/regulator-uclass.c | 11 ----------- include/power/regulator.h | 14 +------------- 2 files changed, 1 insertion(+), 24 deletions(-)
drivers/power/regulator/regulator-uclass.c +0 -11
@@ -339,17 +339,6 @@ out:return ret; } -int regulator_unset (struct udevice *dev) -{ -struct dm_regulator_uclass_plat *uc_pdata; - - uc_pdata =dev_get_uclass_plat (dev); -if (uc_pdata && uc_pdata->force_off) -return regulator_set_enable (dev, false); - -return -EMEDIUMTYPE ; -} -static void regulator_show (struct udevice *dev,int ret) {struct dm_regulator_uclass_plat *uc_pdata;
include/power/regulator.h +1 -13
@@ -430,7 +430,7 @@ int regulators_enable_boot_on(bool verbose);* * This disables all regulators which are marked to be off at boot time. * -* This effectively calls regulator_unset() for every regulator. +* This effectively does nothing. */ int regulators_enable_boot_off (bool verbose);
@@ -453,18 +453,6 @@ int regulators_enable_boot_off(bool verbose);*/ int regulator_autoset (struct udevice *dev); -/** -* regulator_unset: turn off a regulator -* -* The setup depends on constraints found in device's uclass's platform data -* (struct dm_regulator_uclass_platdata): -* -* - Disable - will set - if 'force_off' is set to true, -* -* The function returns on the first-encountered error. -*/ -int regulator_unset (struct udevice *dev); -/** * regulator_autoset_by_name: setup the regulator given by its uclass's * platform data name field. The setup depends on constraints found in device's
Signature · 1 line
2.43.0
PATCH 4/4 power: regulator: Drop regulators_enable_boot_on/off()
In reply to Marek VasutBoth regulators_enable_boot_on/off() are unused and superseded by regulator uclass regulator_post_probe(). Remove both functions.
---
Cc: Ben Wolsieffer <[email protected]>
Cc: Caleb Connolly <[email protected]>
Cc: Chris Morgan <[email protected]>
Cc: Dragan Simic <[email protected]>
Cc: Eugen Hristev <[email protected]>
Cc: Francesco Dolcini <[email protected]>
Cc: Heinrich Schuchardt <[email protected]>
Cc: Jaehoon Chung <[email protected]>
Cc: Jagan Teki <[email protected]>
Cc: Jonas Karlman <[email protected]>
Cc: Kever Yang <[email protected]>
Cc: Kostya Porotchkin <[email protected]>
Cc: Matteo Lisi <[email protected]>
Cc: Mattijs Korpershoek <[email protected]>
Cc: Max Krummenacher <[email protected]>
Cc: Neil Armstrong <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Philipp Tomsich <[email protected]>
Cc: Quentin Schulz <[email protected]>
Cc: Sam Day <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Sumit Garg <[email protected]>
Cc: Svyatoslav Ryhel <[email protected]>
Cc: Thierry Reding <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: Volodymyr Babchuk <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
--- arch/arm/mach-rockchip/board.c | 8 -------- arch/arm/mach-snapdragon/board.c | 1 - arch/arm/mach-tegra/board2.c | 3 --- board/Marvell/octeontx2_cn913x/board.c | 5 ----- .../amlogic/odroid-go-ultra/odroid-go-ultra.c | 2 -- board/dhelectronics/dh_stm32mp1/board.c | 2 -- board/engicam/stm32mp1/stm32mp1.c | 3 --- board/google/veyron/veyron.c | 6 ------ board/samsung/common/exynos5-dt.c | 4 ---- board/st/stm32mp1/stm32mp1.c | 2 -- drivers/power/regulator/regulator-uclass.c | 10 ---------- include/power/regulator.h | 20 ------------------- 12 files changed, 66 deletions(-)
arch/arm/mach-rockchip/board.c +0 -8
@@ -202,14 +202,6 @@ int board_late_init(void)int board_init (void ) { -int ret; - -#ifdef CONFIG_DM_REGULATOR - ret =regulators_enable_boot_on (false); -if (ret) -debug ("%s: Cannot enable boot on regulator\n" , __func__); -#endif -return 0 ; }
arch/arm/mach-snapdragon/board.c +0 -1
@@ -162,7 +162,6 @@ void __weak qcom_board_init(void)int board_init (void ) { -regulators_enable_boot_on (false);show_psci_version ();qcom_of_fixup_nodes ();qcom_board_init ();
arch/arm/mach-tegra/board2.c +0 -3
@@ -187,9 +187,6 @@ int board_init(void)warmboot_prepare_code (TEGRA_LP0_ADDR ,TEGRA_LP0_SIZE );#endif -/* Set up boot-on regulators */ -regulators_enable_boot_on (_DEBUG); -return nvidia_board_init (); }
board/Marvell/octeontx2_cn913x/board.c +0 -5
@@ -23,11 +23,6 @@ int board_early_init_f(void)int board_early_init_r (void ) { -if (CONFIG_IS_ENABLED (DM_REGULATOR )) { -/* Check if any existing regulator should be turned down */ -regulators_enable_boot_off (false); - } -return 0 ; }
board/amlogic/odroid-go-ultra/odroid-go-ultra.c +0 -2
@@ -16,7 +16,5 @@ int mmc_get_env_dev(void)int board_init (void ) { -regulators_enable_boot_on (_DEBUG); -return 0 ; }
board/dhelectronics/dh_stm32mp1/board.c +0 -2
@@ -622,8 +622,6 @@ static void board_init_regulator_av96(void)static void board_init_regulator (void ) {board_init_regulator_av96 (); - -regulators_enable_boot_on (_DEBUG); }#else static inline int board_get_regulator_buck3_nvm_uv_av96 (int *uv)
board/engicam/stm32mp1/stm32mp1.c +0 -3
@@ -37,9 +37,6 @@ int checkboard(void)/* board dependent setup after realloc */ int board_init (void ) { -if (IS_ENABLED (CONFIG_DM_REGULATOR )) -regulators_enable_boot_on (_DEBUG); -return 0 ; }
board/google/veyron/veyron.c +0 -6
@@ -61,12 +61,6 @@ static int veyron_init(void)if (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
board/samsung/common/exynos5-dt.c +0 -4
@@ -88,10 +88,6 @@ int exynos_power_init(void)if (ret == -ENODEV )return 0 ; - ret =regulators_enable_boot_on (false); -if (ret) -return ret; - ret =exynos_set_regulator ("vdd_mif" ,1100000 );if (ret)return ret;
board/st/stm32mp1/stm32mp1.c +0 -2
@@ -665,8 +665,6 @@ int board_init(void)if (board_is_stm32mp15x_dk2 ())board_stm32mp15x_dk2_init (); -regulators_enable_boot_on (_DEBUG); -/* * sysconf initialisation done only when U-Boot is running in secure * done in TF-A for TFABOOT.
drivers/power/regulator/regulator-uclass.c +0 -10
@@ -520,16 +520,6 @@ static int regulator_post_probe(struct udevice *dev)return 0 ; } -int regulators_enable_boot_on (bool verbose) -{ -return 0 ; -} - -int regulators_enable_boot_off (bool verbose) -{ -return 0 ; -} -UCLASS_DRIVER (regulator) = { .id =UCLASS_REGULATOR , .name ="regulator" ,
include/power/regulator.h +0 -20
@@ -414,26 +414,6 @@ int regulator_get_mode(struct udevice *dev);*/ int regulator_set_mode (struct udevice *dev,int mode_id); -/** -* regulators_enable_boot_on() - enable regulators needed for boot -* -* This enables all regulators which are marked to be on at boot time. This -* only works for regulators which don't have a range for voltage/current, -* since in that case it is not possible to know which value to use. -* -* This effectively calls regulator_autoset() for every regulator. -*/ -int regulators_enable_boot_on (bool verbose); - -/** -* regulators_enable_boot_off() - disable regulators needed for boot -* -* This disables all regulators which are marked to be off at boot time. -* -* This effectively does nothing. -*/ -int regulators_enable_boot_off (bool verbose); -/** * regulator_autoset: setup the voltage/current on a regulator *
Signature · 1 line
2.43.0
Hi Marek,
Quoted 100 lines · Marek Vasut
In case a regulator DT node contains regulator-always-on or regulator-boot-on property, make sure the regulator gets correctly configured by U-Boot on start up. Unconditionally probe such regulator drivers. This is a preparatory patch for introduction of .regulator_post_probe() which would trigger the regulator configuration.
Parsing of regulator-always-on and regulator-boot-on DT property has been moved to
regulator_post_bind()as the information is required early, the rest of the DT parsing has been kept inregulator_pre_probe()to avoid slowing down the boot process.Signed-off-by Marek Vasut <[email protected]>---
Cc: Ben Wolsieffer <[email protected]>
Cc: Caleb Connolly <[email protected]>
Cc: Chris Morgan <[email protected]>
Cc: Dragan Simic <[email protected]>
Cc: Eugen Hristev <[email protected]>
Cc: Francesco Dolcini <[email protected]>
Cc: Heinrich Schuchardt <[email protected]>
Cc: Jaehoon Chung <[email protected]>
Cc: Jagan Teki <[email protected]>
Cc: Jonas Karlman <[email protected]>
Cc: Kever Yang <[email protected]>
Cc: Kostya Porotchkin <[email protected]>
Cc: Matteo Lisi <[email protected]>
Cc: Mattijs Korpershoek <[email protected]>
Cc: Max Krummenacher <[email protected]>
Cc: Neil Armstrong <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Philipp Tomsich <[email protected]>
Cc: Quentin Schulz <[email protected]>
Cc: Sam Day <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Sumit Garg <[email protected]>
Cc: Svyatoslav Ryhel <[email protected]>
Cc: Thierry Reding <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: Volodymyr Babchuk <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]--- drivers/power/regulator/regulator-uclass.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-)drivers/power/regulator/regulator-uclass.c +15
-8@@ -433,6 +433,8 @@ static int regulator_post_bind(struct udevice *dev)const char *property ="regulator-name" ; uc_pdata =dev_get_uclass_plat (dev); + uc_pdata->always_on =dev_read_bool (dev,"regulator-always-on" ); + uc_pdata->boot_on =dev_read_bool (dev,"regulator-boot-on" );/* Regulator's mandatory constraint */ uc_pdata->name =dev_read_string (dev, property);@@ -444,13 +446,21 @@ static int regulator_post_bind(struct udevice *dev)return -EINVAL ; } -if (regulator_name_is_unique (dev, uc_pdata->name)) -return 0 ; +if (!regulator_name_is_unique (dev, uc_pdata->name)) { +debug ("'%s' of dev: '%s', has nonunique value: '%s\n" , + property, dev->name, uc_pdata->name); +return -EINVAL ; + } -debug ("'%s' of dev: '%s', has nonunique value: '%s\n" , - property, dev->name, uc_pdata->name); +/* +* In case the regulator has regulator-always-on or +* regulator-boot-on DT property, trigger probe() to +* configure its default state during startup. +*/ +if (uc_pdata->always_on && uc_pdata->boot_on) +dev_or_flags (dev,DM_FLAG_PROBE_AFTER_BIND ); -return -EINVAL ; +return 0 ; }static int regulator_pre_probe (struct udevice *dev)@@ -473,8 +483,6 @@ static int regulator_pre_probe(struct udevice *dev) -ENODATA); uc_pdata->max_uA =dev_read_u32_default (dev,"regulator-max-microamp" , -ENODATA ); - uc_pdata->always_on =dev_read_bool (dev,"regulator-always-on" ); - uc_pdata->boot_on =dev_read_bool (dev,"regulator-boot-on" ); uc_pdata->ramp_delay =dev_read_u32_default (dev,"regulator-ramp-delay" ,0 ); uc_pdata->force_off =dev_read_bool (dev,"regulator-force-boot-off" ); --
Quoted 2 lines
2.43.0
This is reading a lot of DT stuff very early, which may be slow. It is also reading from the DT in the bind() step which we sometimes have to do, but try to avoid.
Also this seems to happen in SPL and again pre-reloc and again in U-Boot post-reloc?
Should we have a step in the init sequence where we set up the regulators, by calling regulators_enable_boot_on() ?
Regards,
Simon
Quoted 101 lines · Simon Glass
Hi Marek,
Quoted 98 lines · Marek Vasut
In case a regulator DT node contains regulator-always-on or regulator-boot-on property, make sure the regulator gets correctly configured by U-Boot on start up. Unconditionally probe such regulator drivers. This is a preparatory patch for introduction of .regulator_post_probe() which would trigger the regulator configuration.
Parsing of regulator-always-on and regulator-boot-on DT property has been moved to
regulator_post_bind()as the information is required early, the rest of the DT parsing has been kept inregulator_pre_probe()to avoid slowing down the boot process.Signed-off-by Marek Vasut <[email protected]>---
Cc: Ben Wolsieffer <[email protected]>
Cc: Caleb Connolly <[email protected]>
Cc: Chris Morgan <[email protected]>
Cc: Dragan Simic <[email protected]>
Cc: Eugen Hristev <[email protected]>
Cc: Francesco Dolcini <[email protected]>
Cc: Heinrich Schuchardt <[email protected]>
Cc: Jaehoon Chung <[email protected]>
Cc: Jagan Teki <[email protected]>
Cc: Jonas Karlman <[email protected]>
Cc: Kever Yang <[email protected]>
Cc: Kostya Porotchkin <[email protected]>
Cc: Matteo Lisi <[email protected]>
Cc: Mattijs Korpershoek <[email protected]>
Cc: Max Krummenacher <[email protected]>
Cc: Neil Armstrong <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Philipp Tomsich <[email protected]>
Cc: Quentin Schulz <[email protected]>
Cc: Sam Day <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Sumit Garg <[email protected]>
Cc: Svyatoslav Ryhel <[email protected]>
Cc: Thierry Reding <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: Volodymyr Babchuk <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]--- drivers/power/regulator/regulator-uclass.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-)drivers/power/regulator/regulator-uclass.c +15
-7@@ -433,6 +433,8 @@ static int regulator_post_bind(struct udevice *dev)const char *property ="regulator-name" ; uc_pdata =dev_get_uclass_plat (dev); + uc_pdata->always_on =dev_read_bool (dev,"regulator-always-on" ); + uc_pdata->boot_on =dev_read_bool (dev,"regulator-boot-on" );/* Regulator's mandatory constraint */ uc_pdata->name =dev_read_string (dev, property);@@ -444,13 +446,21 @@ static int regulator_post_bind(struct udevice *dev)return -EINVAL ; } -if (regulator_name_is_unique (dev, uc_pdata->name)) -return 0 ; +if (!regulator_name_is_unique (dev, uc_pdata->name)) { +debug ("'%s' of dev: '%s', has nonunique value: '%s\n" , + property, dev->name, uc_pdata->name); +return -EINVAL ; + } -debug ("'%s' of dev: '%s', has nonunique value: '%s\n" , - property, dev->name, uc_pdata->name); +/* +* In case the regulator has regulator-always-on or +* regulator-boot-on DT property, trigger probe() to +* configure its default state during startup. +*/ +if (uc_pdata->always_on && uc_pdata->boot_on) +dev_or_flags (dev,DM_FLAG_PROBE_AFTER_BIND ); -return -EINVAL ; +return 0 ; }static int regulator_pre_probe (struct udevice *dev)@@ -473,8 +483,6 @@ static int regulator_pre_probe(struct udevice *dev) -ENODATA); uc_pdata->max_uA =dev_read_u32_default (dev,"regulator-max-microamp" , -ENODATA ); - uc_pdata->always_on =dev_read_bool (dev,"regulator-always-on" ); - uc_pdata->boot_on =dev_read_bool (dev,"regulator-boot-on" ); uc_pdata->ramp_delay =dev_read_u32_default (dev,"regulator-ramp-delay" ,0 );
Quoted 8 lines
Quoted 4 lines
drivers/power/regulator/regulator-uclass.c +0
-1uc_pdata->force_off =dev_read_bool (dev,"regulator-force-boot-off" ); --2.43.0
This is reading a lot of DT stuff very early, which may be slow. It is also reading from the DT in the
bind()step which we sometimes have to do, but try to avoid.
Could we set up the livetree pre-bind? What about MMU? On armv8 at least this would have a huge impact on performance. I've done some measurements and there is at least 1 order of magnitude difference between parsing FDT with no caches vs parsing livetree with, it's huge.
Quoted 9 lines
Also this seems to happen in SPL and again pre-reloc and again in U-Boot post-reloc?
Should we have a step in the init sequence where we set up the regulators, by calling
regulators_enable_boot_on()?Regards,
Simon
Signature · 1 line
// Caleb (they/them)
27 червня 2024 р. 11:48:46 GMT+03:00, Caleb Connolly <[email protected]> написав(-ла):
Quoted 113 lines · Simon Glass
Quoted 101 lines
Hi Marek,
Quoted 98 lines · Marek Vasut
In case a regulator DT node contains regulator-always-on or regulator-boot-on property, make sure the regulator gets correctly configured by U-Boot on start up. Unconditionally probe such regulator drivers. This is a preparatory patch for introduction of .regulator_post_probe() which would trigger the regulator configuration.
Parsing of regulator-always-on and regulator-boot-on DT property has been moved to
regulator_post_bind()as the information is required early, the rest of the DT parsing has been kept inregulator_pre_probe()to avoid slowing down the boot process.Signed-off-by Marek Vasut <[email protected]>---
Cc: Ben Wolsieffer <[email protected]>
Cc: Caleb Connolly <[email protected]>
Cc: Chris Morgan <[email protected]>
Cc: Dragan Simic <[email protected]>
Cc: Eugen Hristev <[email protected]>
Cc: Francesco Dolcini <[email protected]>
Cc: Heinrich Schuchardt <[email protected]>
Cc: Jaehoon Chung <[email protected]>
Cc: Jagan Teki <[email protected]>
Cc: Jonas Karlman <[email protected]>
Cc: Kever Yang <[email protected]>
Cc: Kostya Porotchkin <[email protected]>
Cc: Matteo Lisi <[email protected]>
Cc: Mattijs Korpershoek <[email protected]>
Cc: Max Krummenacher <[email protected]>
Cc: Neil Armstrong <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Philipp Tomsich <[email protected]>
Cc: Quentin Schulz <[email protected]>
Cc: Sam Day <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Sumit Garg <[email protected]>
Cc: Svyatoslav Ryhel <[email protected]>
Cc: Thierry Reding <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: Volodymyr Babchuk <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]--- drivers/power/regulator/regulator-uclass.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-)drivers/power/regulator/regulator-uclass.c +15
-7@@ -433,6 +433,8 @@ static int regulator_post_bind(struct udevice *dev)const char *property ="regulator-name" ; uc_pdata =dev_get_uclass_plat (dev); + uc_pdata->always_on =dev_read_bool (dev,"regulator-always-on" ); + uc_pdata->boot_on =dev_read_bool (dev,"regulator-boot-on" );/* Regulator's mandatory constraint */ uc_pdata->name =dev_read_string (dev, property);@@ -444,13 +446,21 @@ static int regulator_post_bind(struct udevice *dev)return -EINVAL ; } -if (regulator_name_is_unique (dev, uc_pdata->name)) -return 0 ; +if (!regulator_name_is_unique (dev, uc_pdata->name)) { +debug ("'%s' of dev: '%s', has nonunique value: '%s\n" , + property, dev->name, uc_pdata->name); +return -EINVAL ; + } -debug ("'%s' of dev: '%s', has nonunique value: '%s\n" , - property, dev->name, uc_pdata->name); +/* +* In case the regulator has regulator-always-on or +* regulator-boot-on DT property, trigger probe() to +* configure its default state during startup. +*/ +if (uc_pdata->always_on && uc_pdata->boot_on) +dev_or_flags (dev,DM_FLAG_PROBE_AFTER_BIND ); -return -EINVAL ; +return 0 ; }static int regulator_pre_probe (struct udevice *dev)@@ -473,8 +483,6 @@ static int regulator_pre_probe(struct udevice *dev) -ENODATA); uc_pdata->max_uA =dev_read_u32_default (dev,"regulator-max-microamp" , -ENODATA ); - uc_pdata->always_on =dev_read_bool (dev,"regulator-always-on" ); - uc_pdata->boot_on =dev_read_bool (dev,"regulator-boot-on" ); uc_pdata->ramp_delay =dev_read_u32_default (dev,"regulator-ramp-delay" ,0 );Quoted 8 lines
Quoted 4 lines
drivers/power/regulator/regulator-uclass.c +0
-1uc_pdata->force_off =dev_read_bool (dev,"regulator-force-boot-off" ); --2.43.0
This is reading a lot of DT stuff very early, which may be slow. It is also reading from the DT in the
bind()step which we sometimes have to do, but try to avoid.
Quoted 4 lines
Could we set up the livetree pre-bind? What about MMU? On armv8 at least this would have a huge impact on performance. I've done some measurements and there is at least 1 order of magnitude difference between parsing FDT with no caches vs parsing livetree with, it's huge.
Quoted 3 lines
Also this seems to happen in SPL and again pre-reloc and again in U-Boot post-reloc?
Not so long ago I proposed a similar patchset with the same goal and I have discovered massive issues with SPL and relocation interfering with driver loading.
The issue which I have personally encountered was i2c driver failure due to double probing. This behavior was triggered by always-on/boot-on regulators provided by pmic which in most cases is an i2c device.
At that time everyone just ignored me, so idk if tegra i2c is the only driver which has this response or there are more, but be aware that this patch set may cause cascade failure on many devices.
Best regards,
Svyatoslav R.
Quoted 7 lines
Quoted 6 lines
Should we have a step in the init sequence where we set up the regulators, by calling
regulators_enable_boot_on()?Regards,
Simon
Hi Svyatoslav,
Quoted 126 lines · Svyatoslav
27 червня 2024 р. 11:48:46 GMT+03:00, Caleb Connolly <[email protected]> написав(-ла):
Quoted 113 lines · Simon Glass
Quoted 101 lines
Hi Marek,
Quoted 98 lines · Marek Vasut
In case a regulator DT node contains regulator-always-on or regulator-boot-on property, make sure the regulator gets correctly configured by U-Boot on start up. Unconditionally probe such regulator drivers. This is a preparatory patch for introduction of .regulator_post_probe() which would trigger the regulator configuration.
Parsing of regulator-always-on and regulator-boot-on DT property has been moved to
regulator_post_bind()as the information is required early, the rest of the DT parsing has been kept inregulator_pre_probe()to avoid slowing down the boot process.Signed-off-by Marek Vasut <[email protected]>---
Cc: Ben Wolsieffer <[email protected]>
Cc: Caleb Connolly <[email protected]>
Cc: Chris Morgan <[email protected]>
Cc: Dragan Simic <[email protected]>
Cc: Eugen Hristev <[email protected]>
Cc: Francesco Dolcini <[email protected]>
Cc: Heinrich Schuchardt <[email protected]>
Cc: Jaehoon Chung <[email protected]>
Cc: Jagan Teki <[email protected]>
Cc: Jonas Karlman <[email protected]>
Cc: Kever Yang <[email protected]>
Cc: Kostya Porotchkin <[email protected]>
Cc: Matteo Lisi <[email protected]>
Cc: Mattijs Korpershoek <[email protected]>
Cc: Max Krummenacher <[email protected]>
Cc: Neil Armstrong <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Philipp Tomsich <[email protected]>
Cc: Quentin Schulz <[email protected]>
Cc: Sam Day <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Sumit Garg <[email protected]>
Cc: Svyatoslav Ryhel <[email protected]>
Cc: Thierry Reding <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: Volodymyr Babchuk <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]--- drivers/power/regulator/regulator-uclass.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-)drivers/power/regulator/regulator-uclass.c +15
-7@@ -433,6 +433,8 @@ static int regulator_post_bind(struct udevice *dev)const char *property ="regulator-name" ; uc_pdata =dev_get_uclass_plat (dev); + uc_pdata->always_on =dev_read_bool (dev,"regulator-always-on" ); + uc_pdata->boot_on =dev_read_bool (dev,"regulator-boot-on" );/* Regulator's mandatory constraint */ uc_pdata->name =dev_read_string (dev, property);@@ -444,13 +446,21 @@ static int regulator_post_bind(struct udevice *dev)return -EINVAL ; } -if (regulator_name_is_unique (dev, uc_pdata->name)) -return 0 ; +if (!regulator_name_is_unique (dev, uc_pdata->name)) { +debug ("'%s' of dev: '%s', has nonunique value: '%s\n" , + property, dev->name, uc_pdata->name); +return -EINVAL ; + } -debug ("'%s' of dev: '%s', has nonunique value: '%s\n" , - property, dev->name, uc_pdata->name); +/* +* In case the regulator has regulator-always-on or +* regulator-boot-on DT property, trigger probe() to +* configure its default state during startup. +*/ +if (uc_pdata->always_on && uc_pdata->boot_on) +dev_or_flags (dev,DM_FLAG_PROBE_AFTER_BIND ); -return -EINVAL ; +return 0 ; }static int regulator_pre_probe (struct udevice *dev)@@ -473,8 +483,6 @@ static int regulator_pre_probe(struct udevice *dev) -ENODATA); uc_pdata->max_uA =dev_read_u32_default (dev,"regulator-max-microamp" , -ENODATA ); - uc_pdata->always_on =dev_read_bool (dev,"regulator-always-on" ); - uc_pdata->boot_on =dev_read_bool (dev,"regulator-boot-on" ); uc_pdata->ramp_delay =dev_read_u32_default (dev,"regulator-ramp-delay" ,0 );Quoted 8 lines
Quoted 4 lines
drivers/power/regulator/regulator-uclass.c +0
-1uc_pdata->force_off =dev_read_bool (dev,"regulator-force-boot-off" ); --2.43.0
This is reading a lot of DT stuff very early, which may be slow. It is also reading from the DT in the
bind()step which we sometimes have to do, but try to avoid.Quoted 4 lines
Could we set up the livetree pre-bind? What about MMU? On armv8 at least this would have a huge impact on performance. I've done some measurements and there is at least 1 order of magnitude difference between parsing FDT with no caches vs parsing livetree with, it's huge.
Quoted 3 lines
Also this seems to happen in SPL and again pre-reloc and again in U-Boot post-reloc?
Not so long ago I proposed a similar patchset with the same goal and I have discovered massive issues with SPL and relocation interfering with driver loading.
Quoted 8 lines
The issue which I have personally encountered was i2c driver failure due to double probing. This behavior was triggered by always-on/boot-on regulators provided by pmic which in most cases is an i2c device.
At that time everyone just ignored me, so idk if tegra i2c is the only driver which has this response or there are more, but be aware that this patch set may cause cascade failure on many devices.
I'm not sure if I remember this, but I can certainly see some problems with it. Did we have drivers that probed in the bind() function, perhaps?
Quoted 11 lines
Best regards,
Svyatoslav R.Quoted 7 lines
Quoted 6 lines
Should we have a step in the init sequence where we set up the regulators, by calling
regulators_enable_boot_on()?Regards,
Simon
чт, 27 черв. 2024 р. о 12:26 Simon Glass <[email protected]> пише:
Quoted 135 lines
Hi Svyatoslav,
Quoted 131 lines · Svyatoslav
27 червня 2024 р. 11:48:46 GMT+03:00, Caleb Connolly <[email protected]> написав(-ла):
Quoted 113 lines · Simon Glass
Quoted 101 lines
Hi Marek,
Quoted 98 lines · Marek Vasut
In case a regulator DT node contains regulator-always-on or regulator-boot-on property, make sure the regulator gets correctly configured by U-Boot on start up. Unconditionally probe such regulator drivers. This is a preparatory patch for introduction of .regulator_post_probe() which would trigger the regulator configuration.
Parsing of regulator-always-on and regulator-boot-on DT property has been moved to
regulator_post_bind()as the information is required early, the rest of the DT parsing has been kept inregulator_pre_probe()to avoid slowing down the boot process.Signed-off-by Marek Vasut <[email protected]>---
Cc: Ben Wolsieffer <[email protected]>
Cc: Caleb Connolly <[email protected]>
Cc: Chris Morgan <[email protected]>
Cc: Dragan Simic <[email protected]>
Cc: Eugen Hristev <[email protected]>
Cc: Francesco Dolcini <[email protected]>
Cc: Heinrich Schuchardt <[email protected]>
Cc: Jaehoon Chung <[email protected]>
Cc: Jagan Teki <[email protected]>
Cc: Jonas Karlman <[email protected]>
Cc: Kever Yang <[email protected]>
Cc: Kostya Porotchkin <[email protected]>
Cc: Matteo Lisi <[email protected]>
Cc: Mattijs Korpershoek <[email protected]>
Cc: Max Krummenacher <[email protected]>
Cc: Neil Armstrong <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Philipp Tomsich <[email protected]>
Cc: Quentin Schulz <[email protected]>
Cc: Sam Day <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Sumit Garg <[email protected]>
Cc: Svyatoslav Ryhel <[email protected]>
Cc: Thierry Reding <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: Volodymyr Babchuk <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]--- drivers/power/regulator/regulator-uclass.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-)drivers/power/regulator/regulator-uclass.c +15
-7@@ -433,6 +433,8 @@ static int regulator_post_bind(struct udevice *dev)const char *property ="regulator-name" ; uc_pdata =dev_get_uclass_plat (dev); + uc_pdata->always_on =dev_read_bool (dev,"regulator-always-on" ); + uc_pdata->boot_on =dev_read_bool (dev,"regulator-boot-on" );/* Regulator's mandatory constraint */ uc_pdata->name =dev_read_string (dev, property);@@ -444,13 +446,21 @@ static int regulator_post_bind(struct udevice *dev)return -EINVAL ; } -if (regulator_name_is_unique (dev, uc_pdata->name)) -return 0 ; +if (!regulator_name_is_unique (dev, uc_pdata->name)) { +debug ("'%s' of dev: '%s', has nonunique value: '%s\n" , + property, dev->name, uc_pdata->name); +return -EINVAL ; + } -debug ("'%s' of dev: '%s', has nonunique value: '%s\n" , - property, dev->name, uc_pdata->name); +/* +* In case the regulator has regulator-always-on or +* regulator-boot-on DT property, trigger probe() to +* configure its default state during startup. +*/ +if (uc_pdata->always_on && uc_pdata->boot_on) +dev_or_flags (dev,DM_FLAG_PROBE_AFTER_BIND ); -return -EINVAL ; +return 0 ; }static int regulator_pre_probe (struct udevice *dev)@@ -473,8 +483,6 @@ static int regulator_pre_probe(struct udevice *dev) -ENODATA); uc_pdata->max_uA =dev_read_u32_default (dev,"regulator-max-microamp" , -ENODATA ); - uc_pdata->always_on =dev_read_bool (dev,"regulator-always-on" ); - uc_pdata->boot_on =dev_read_bool (dev,"regulator-boot-on" ); uc_pdata->ramp_delay =dev_read_u32_default (dev,"regulator-ramp-delay" ,0 );Quoted 8 lines
Quoted 4 lines
drivers/power/regulator/regulator-uclass.c +0
-1uc_pdata->force_off =dev_read_bool (dev,"regulator-force-boot-off" ); --2.43.0
This is reading a lot of DT stuff very early, which may be slow. It is also reading from the DT in the
bind()step which we sometimes have to do, but try to avoid.Quoted 4 lines
Could we set up the livetree pre-bind? What about MMU? On armv8 at least this would have a huge impact on performance. I've done some measurements and there is at least 1 order of magnitude difference between parsing FDT with no caches vs parsing livetree with, it's huge.
Quoted 3 lines
Also this seems to happen in SPL and again pre-reloc and again in U-Boot post-reloc?
Not so long ago I proposed a similar patchset with the same goal and I have discovered massive issues with SPL and relocation interfering with driver loading.
The issue which I have personally encountered was i2c driver failure due to double probing. This behavior was triggered by always-on/boot-on regulators provided by pmic which in most cases is an i2c device.
Quoted 8 lines
Quoted 3 lines
At that time everyone just ignored me, so idk if tegra i2c is the only driver which has this response or there are more, but be aware that this patch set may cause cascade failure on many devices.
I'm not sure if I remember this, but I can certainly see some problems with it. Did we have drivers that probed in the
bind()function, perhaps?
It is expected not to remember all patchsets sent, not an issue. As for drivers probed after bind there are several, but they are quite essential. Core GPIO and pinmux drivers are probed as early as possible but in most cases they have no dependencies among complex subsystems (like i2c).
Quoted 11 lines
Quoted 11 lines
Best regards,
Svyatoslav R.Quoted 7 lines
Quoted 6 lines
Should we have a step in the init sequence where we set up the regulators, by calling
regulators_enable_boot_on()?Regards,
Simon
Hi Svyatoslav,
Quoted 146 lines · Svyatoslav Ryhel
чт, 27 черв. 2024 р. о 12:26 Simon Glass <[email protected]> пише:
Quoted 135 lines
Hi Svyatoslav,
Quoted 131 lines · Svyatoslav
27 червня 2024 р. 11:48:46 GMT+03:00, Caleb Connolly <[email protected]> написав(-ла):
Quoted 113 lines · Simon Glass
Quoted 101 lines
Hi Marek,
Quoted 98 lines · Marek Vasut
In case a regulator DT node contains regulator-always-on or regulator-boot-on property, make sure the regulator gets correctly configured by U-Boot on start up. Unconditionally probe such regulator drivers. This is a preparatory patch for introduction of .regulator_post_probe() which would trigger the regulator configuration.
Parsing of regulator-always-on and regulator-boot-on DT property has been moved to
regulator_post_bind()as the information is required early, the rest of the DT parsing has been kept inregulator_pre_probe()to avoid slowing down the boot process.Signed-off-by Marek Vasut <[email protected]>---
Cc: Ben Wolsieffer <[email protected]>
Cc: Caleb Connolly <[email protected]>
Cc: Chris Morgan <[email protected]>
Cc: Dragan Simic <[email protected]>
Cc: Eugen Hristev <[email protected]>
Cc: Francesco Dolcini <[email protected]>
Cc: Heinrich Schuchardt <[email protected]>
Cc: Jaehoon Chung <[email protected]>
Cc: Jagan Teki <[email protected]>
Cc: Jonas Karlman <[email protected]>
Cc: Kever Yang <[email protected]>
Cc: Kostya Porotchkin <[email protected]>
Cc: Matteo Lisi <[email protected]>
Cc: Mattijs Korpershoek <[email protected]>
Cc: Max Krummenacher <[email protected]>
Cc: Neil Armstrong <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Philipp Tomsich <[email protected]>
Cc: Quentin Schulz <[email protected]>
Cc: Sam Day <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Sumit Garg <[email protected]>
Cc: Svyatoslav Ryhel <[email protected]>
Cc: Thierry Reding <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: Volodymyr Babchuk <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]--- drivers/power/regulator/regulator-uclass.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-)drivers/power/regulator/regulator-uclass.c +15
-7@@ -433,6 +433,8 @@ static int regulator_post_bind(struct udevice *dev)const char *property ="regulator-name" ; uc_pdata =dev_get_uclass_plat (dev); + uc_pdata->always_on =dev_read_bool (dev,"regulator-always-on" ); + uc_pdata->boot_on =dev_read_bool (dev,"regulator-boot-on" );/* Regulator's mandatory constraint */ uc_pdata->name =dev_read_string (dev, property);@@ -444,13 +446,21 @@ static int regulator_post_bind(struct udevice *dev)return -EINVAL ; } -if (regulator_name_is_unique (dev, uc_pdata->name)) -return 0 ; +if (!regulator_name_is_unique (dev, uc_pdata->name)) { +debug ("'%s' of dev: '%s', has nonunique value: '%s\n" , + property, dev->name, uc_pdata->name); +return -EINVAL ; + } -debug ("'%s' of dev: '%s', has nonunique value: '%s\n" , - property, dev->name, uc_pdata->name); +/* +* In case the regulator has regulator-always-on or +* regulator-boot-on DT property, trigger probe() to +* configure its default state during startup. +*/ +if (uc_pdata->always_on && uc_pdata->boot_on) +dev_or_flags (dev,DM_FLAG_PROBE_AFTER_BIND ); -return -EINVAL ; +return 0 ; }static int regulator_pre_probe (struct udevice *dev)@@ -473,8 +483,6 @@ static int regulator_pre_probe(struct udevice *dev) -ENODATA); uc_pdata->max_uA =dev_read_u32_default (dev,"regulator-max-microamp" , -ENODATA ); - uc_pdata->always_on =dev_read_bool (dev,"regulator-always-on" ); - uc_pdata->boot_on =dev_read_bool (dev,"regulator-boot-on" ); uc_pdata->ramp_delay =dev_read_u32_default (dev,"regulator-ramp-delay" ,0 );Quoted 8 lines
Quoted 4 lines
drivers/power/regulator/regulator-uclass.c +0
-1uc_pdata->force_off =dev_read_bool (dev,"regulator-force-boot-off" ); --2.43.0
This is reading a lot of DT stuff very early, which may be slow. It is also reading from the DT in the
bind()step which we sometimes have to do, but try to avoid.Quoted 4 lines
Could we set up the livetree pre-bind? What about MMU? On armv8 at least this would have a huge impact on performance. I've done some measurements and there is at least 1 order of magnitude difference between parsing FDT with no caches vs parsing livetree with, it's huge.
Quoted 3 lines
Also this seems to happen in SPL and again pre-reloc and again in U-Boot post-reloc?
Not so long ago I proposed a similar patchset with the same goal and I have discovered massive issues with SPL and relocation interfering with driver loading.
The issue which I have personally encountered was i2c driver failure due to double probing. This behavior was triggered by always-on/boot-on regulators provided by pmic which in most cases is an i2c device.
Quoted 8 lines
Quoted 3 lines
At that time everyone just ignored me, so idk if tegra i2c is the only driver which has this response or there are more, but be aware that this patch set may cause cascade failure on many devices.
I'm not sure if I remember this, but I can certainly see some problems with it. Did we have drivers that probed in the
bind()function, perhaps?
Quoted 4 lines
It is expected not to remember all patchsets sent, not an issue. As for drivers probed after bind there are several, but they are quite essential. Core GPIO and pinmux drivers are probed as early as possible but in most cases they have no dependencies among complex subsystems (like i2c).
OK, well I suppose that you managed to find a solution.
From my side I just want to avoid doing too much such stuff 'automatically' in driver model. As you say, it can lead to difficult race conditions / bugs.
Regards,
Simon
Hi Caleb,
Quoted 114 lines · Caleb Connolly
Quoted 101 lines · Simon Glass
Hi Marek,
Quoted 98 lines · Marek Vasut
In case a regulator DT node contains regulator-always-on or regulator-boot-on property, make sure the regulator gets correctly configured by U-Boot on start up. Unconditionally probe such regulator drivers. This is a preparatory patch for introduction of .regulator_post_probe() which would trigger the regulator configuration.
Parsing of regulator-always-on and regulator-boot-on DT property has been moved to
regulator_post_bind()as the information is required early, the rest of the DT parsing has been kept inregulator_pre_probe()to avoid slowing down the boot process.Signed-off-by Marek Vasut <[email protected]>---
Cc: Ben Wolsieffer <[email protected]>
Cc: Caleb Connolly <[email protected]>
Cc: Chris Morgan <[email protected]>
Cc: Dragan Simic <[email protected]>
Cc: Eugen Hristev <[email protected]>
Cc: Francesco Dolcini <[email protected]>
Cc: Heinrich Schuchardt <[email protected]>
Cc: Jaehoon Chung <[email protected]>
Cc: Jagan Teki <[email protected]>
Cc: Jonas Karlman <[email protected]>
Cc: Kever Yang <[email protected]>
Cc: Kostya Porotchkin <[email protected]>
Cc: Matteo Lisi <[email protected]>
Cc: Mattijs Korpershoek <[email protected]>
Cc: Max Krummenacher <[email protected]>
Cc: Neil Armstrong <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Philipp Tomsich <[email protected]>
Cc: Quentin Schulz <[email protected]>
Cc: Sam Day <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Sumit Garg <[email protected]>
Cc: Svyatoslav Ryhel <[email protected]>
Cc: Thierry Reding <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: Volodymyr Babchuk <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]--- drivers/power/regulator/regulator-uclass.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-)drivers/power/regulator/regulator-uclass.c +15
-7@@ -433,6 +433,8 @@ static int regulator_post_bind(struct udevice *dev)const char *property ="regulator-name" ; uc_pdata =dev_get_uclass_plat (dev); + uc_pdata->always_on =dev_read_bool (dev,"regulator-always-on" ); + uc_pdata->boot_on =dev_read_bool (dev,"regulator-boot-on" );/* Regulator's mandatory constraint */ uc_pdata->name =dev_read_string (dev, property);@@ -444,13 +446,21 @@ static int regulator_post_bind(struct udevice *dev)return -EINVAL ; } -if (regulator_name_is_unique (dev, uc_pdata->name)) -return 0 ; +if (!regulator_name_is_unique (dev, uc_pdata->name)) { +debug ("'%s' of dev: '%s', has nonunique value: '%s\n" , + property, dev->name, uc_pdata->name); +return -EINVAL ; + } -debug ("'%s' of dev: '%s', has nonunique value: '%s\n" , - property, dev->name, uc_pdata->name); +/* +* In case the regulator has regulator-always-on or +* regulator-boot-on DT property, trigger probe() to +* configure its default state during startup. +*/ +if (uc_pdata->always_on && uc_pdata->boot_on) +dev_or_flags (dev,DM_FLAG_PROBE_AFTER_BIND ); -return -EINVAL ; +return 0 ; }static int regulator_pre_probe (struct udevice *dev)@@ -473,8 +483,6 @@ static int regulator_pre_probe(struct udevice *dev) -ENODATA); uc_pdata->max_uA =dev_read_u32_default (dev,"regulator-max-microamp" , -ENODATA ); - uc_pdata->always_on =dev_read_bool (dev,"regulator-always-on" ); - uc_pdata->boot_on =dev_read_bool (dev,"regulator-boot-on" ); uc_pdata->ramp_delay =dev_read_u32_default (dev,"regulator-ramp-delay" ,0 );Quoted 8 lines
Quoted 4 lines
drivers/power/regulator/regulator-uclass.c +0
-1uc_pdata->force_off =dev_read_bool (dev,"regulator-force-boot-off" ); --2.43.0
This is reading a lot of DT stuff very early, which may be slow. It is also reading from the DT in the
bind()step which we sometimes have to do, but try to avoid.
Quoted 4 lines
Could we set up the livetree pre-bind? What about MMU? On armv8 at least this would have a huge impact on performance. I've done some measurements and there is at least 1 order of magnitude difference between parsing FDT with no caches vs parsing livetree with, it's huge.
That seems like a great idea to me, in general. The fact that SPL sets up the MMU on armv8 makes it more practical.
But for this series I believe we are going to have to define what happens in what phase. We have power_init_board() which is the old way of doing this...but perhaps we could use that as a way to start up regulators which are needed.
As to my question about whether this happens in SPL / pre-reloc / proper, I forgot that we have the bootph tags for that, so it should be fine. The main issue is that in U-Boot proper we will re-init the regulators even though that has already been done. Probably that can be handled by Kconfig or a flag in SPL handoff.
Quoted 6 lines
Quoted 6 lines
Also this seems to happen in SPL and again pre-reloc and again in U-Boot post-reloc?
Should we have a step in the init sequence where we set up the regulators, by calling
regulators_enable_boot_on()?
Regards,
Simon
Quoted 117 lines · Simon Glass
Hi Caleb,
Quoted 114 lines · Caleb Connolly
Quoted 109 lines · Simon Glass
Hi Marek,
Quoted 100 lines · Marek Vasut
In case a regulator DT node contains regulator-always-on or regulator-boot-on property, make sure the regulator gets correctly configured by U-Boot on start up. Unconditionally probe such regulator drivers. This is a preparatory patch for introduction of .regulator_post_probe() which would trigger the regulator configuration.
Parsing of regulator-always-on and regulator-boot-on DT property has been moved to
regulator_post_bind()as the information is required early, the rest of the DT parsing has been kept inregulator_pre_probe()to avoid slowing down the boot process.Signed-off-by Marek Vasut <[email protected]>---
Cc: Ben Wolsieffer <[email protected]>
Cc: Caleb Connolly <[email protected]>
Cc: Chris Morgan <[email protected]>
Cc: Dragan Simic <[email protected]>
Cc: Eugen Hristev <[email protected]>
Cc: Francesco Dolcini <[email protected]>
Cc: Heinrich Schuchardt <[email protected]>
Cc: Jaehoon Chung <[email protected]>
Cc: Jagan Teki <[email protected]>
Cc: Jonas Karlman <[email protected]>
Cc: Kever Yang <[email protected]>
Cc: Kostya Porotchkin <[email protected]>
Cc: Matteo Lisi <[email protected]>
Cc: Mattijs Korpershoek <[email protected]>
Cc: Max Krummenacher <[email protected]>
Cc: Neil Armstrong <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Philipp Tomsich <[email protected]>
Cc: Quentin Schulz <[email protected]>
Cc: Sam Day <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Sumit Garg <[email protected]>
Cc: Svyatoslav Ryhel <[email protected]>
Cc: Thierry Reding <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: Volodymyr Babchuk <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]--- drivers/power/regulator/regulator-uclass.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-)drivers/power/regulator/regulator-uclass.c +15
-8@@ -433,6 +433,8 @@ static int regulator_post_bind(struct udevice *dev)const char *property ="regulator-name" ; uc_pdata =dev_get_uclass_plat (dev); + uc_pdata->always_on =dev_read_bool (dev,"regulator-always-on" ); + uc_pdata->boot_on =dev_read_bool (dev,"regulator-boot-on" );/* Regulator's mandatory constraint */ uc_pdata->name =dev_read_string (dev, property);@@ -444,13 +446,21 @@ static int regulator_post_bind(struct udevice *dev)return -EINVAL ; } -if (regulator_name_is_unique (dev, uc_pdata->name)) -return 0 ; +if (!regulator_name_is_unique (dev, uc_pdata->name)) { +debug ("'%s' of dev: '%s', has nonunique value: '%s\n" , + property, dev->name, uc_pdata->name); +return -EINVAL ; + } -debug ("'%s' of dev: '%s', has nonunique value: '%s\n" , - property, dev->name, uc_pdata->name); +/* +* In case the regulator has regulator-always-on or +* regulator-boot-on DT property, trigger probe() to +* configure its default state during startup. +*/ +if (uc_pdata->always_on && uc_pdata->boot_on) +dev_or_flags (dev,DM_FLAG_PROBE_AFTER_BIND ); -return -EINVAL ; +return 0 ; }static int regulator_pre_probe (struct udevice *dev)@@ -473,8 +483,6 @@ static int regulator_pre_probe(struct udevice *dev) -ENODATA); uc_pdata->max_uA =dev_read_u32_default (dev,"regulator-max-microamp" , -ENODATA ); - uc_pdata->always_on =dev_read_bool (dev,"regulator-always-on" ); - uc_pdata->boot_on =dev_read_bool (dev,"regulator-boot-on" ); uc_pdata->ramp_delay =dev_read_u32_default (dev,"regulator-ramp-delay" ,0 ); uc_pdata->force_off =dev_read_bool (dev,"regulator-force-boot-off" ); --Quoted 2 lines
2.43.0
This is reading a lot of DT stuff very early, which may be slow. It is also reading from the DT in the
bind()step which we sometimes have to do, but try to avoid.
Quoted 7 lines
Quoted 4 lines
Could we set up the livetree pre-bind? What about MMU? On armv8 at least this would have a huge impact on performance. I've done some measurements and there is at least 1 order of magnitude difference between parsing FDT with no caches vs parsing livetree with, it's huge.
That seems like a great idea to me, in general. The fact that SPL sets up the MMU on armv8 makes it more practical.
Well, on qcom we don't use SPL (yet?), we did have a cyclical dependency since we rely on DTB for the memory layout, although I have some patches to do all the memory parsing in board_fdt_blob_setup() since that's needed for multi-dtb FIT. So I guess we could enable caches at the same time.
Quoted 11 lines
But for this series I believe we are going to have to define what happens in what phase. We have
power_init_board()which is the old way of doing this...but perhaps we could use that as a way to start up regulators which are needed.As to my question about whether this happens in SPL / pre-reloc / proper, I forgot that we have the bootph tags for that, so it should be fine. The main issue is that in U-Boot proper we will re-init the regulators even though that has already been done. Probably that can be handled by
Kconfigor a flag in SPL handoff.
Ensuring that it isn't done multiple times sounds like the right approach to me.
Quoted 11 lines
Quoted 8 lines
Quoted 8 lines
Also this seems to happen in SPL and again pre-reloc and again in U-Boot post-reloc?
Should we have a step in the init sequence where we set up the regulators, by calling
regulators_enable_boot_on()?Regards,
Simon
Signature · 1 line
// Caleb (they/them)
Hi Caleb,
Quoted 126 lines · Caleb Connolly
Quoted 122 lines · Simon Glass
Hi Caleb,
Quoted 118 lines · Caleb Connolly
Quoted 101 lines · Simon Glass
Hi Marek,
Quoted 98 lines · Marek Vasut
In case a regulator DT node contains regulator-always-on or regulator-boot-on property, make sure the regulator gets correctly configured by U-Boot on start up. Unconditionally probe such regulator drivers. This is a preparatory patch for introduction of .regulator_post_probe() which would trigger the regulator configuration.
Parsing of regulator-always-on and regulator-boot-on DT property has been moved to
regulator_post_bind()as the information is required early, the rest of the DT parsing has been kept inregulator_pre_probe()to avoid slowing down the boot process.Signed-off-by Marek Vasut <[email protected]>---
Cc: Ben Wolsieffer <[email protected]>
Cc: Caleb Connolly <[email protected]>
Cc: Chris Morgan <[email protected]>
Cc: Dragan Simic <[email protected]>
Cc: Eugen Hristev <[email protected]>
Cc: Francesco Dolcini <[email protected]>
Cc: Heinrich Schuchardt <[email protected]>
Cc: Jaehoon Chung <[email protected]>
Cc: Jagan Teki <[email protected]>
Cc: Jonas Karlman <[email protected]>
Cc: Kever Yang <[email protected]>
Cc: Kostya Porotchkin <[email protected]>
Cc: Matteo Lisi <[email protected]>
Cc: Mattijs Korpershoek <[email protected]>
Cc: Max Krummenacher <[email protected]>
Cc: Neil Armstrong <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Philipp Tomsich <[email protected]>
Cc: Quentin Schulz <[email protected]>
Cc: Sam Day <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Sumit Garg <[email protected]>
Cc: Svyatoslav Ryhel <[email protected]>
Cc: Thierry Reding <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: Volodymyr Babchuk <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]--- drivers/power/regulator/regulator-uclass.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-)drivers/power/regulator/regulator-uclass.c +15
-7@@ -433,6 +433,8 @@ static int regulator_post_bind(struct udevice *dev)const char *property ="regulator-name" ; uc_pdata =dev_get_uclass_plat (dev); + uc_pdata->always_on =dev_read_bool (dev,"regulator-always-on" ); + uc_pdata->boot_on =dev_read_bool (dev,"regulator-boot-on" );/* Regulator's mandatory constraint */ uc_pdata->name =dev_read_string (dev, property);@@ -444,13 +446,21 @@ static int regulator_post_bind(struct udevice *dev)return -EINVAL ; } -if (regulator_name_is_unique (dev, uc_pdata->name)) -return 0 ; +if (!regulator_name_is_unique (dev, uc_pdata->name)) { +debug ("'%s' of dev: '%s', has nonunique value: '%s\n" , + property, dev->name, uc_pdata->name); +return -EINVAL ; + } -debug ("'%s' of dev: '%s', has nonunique value: '%s\n" , - property, dev->name, uc_pdata->name); +/* +* In case the regulator has regulator-always-on or +* regulator-boot-on DT property, trigger probe() to +* configure its default state during startup. +*/ +if (uc_pdata->always_on && uc_pdata->boot_on) +dev_or_flags (dev,DM_FLAG_PROBE_AFTER_BIND ); -return -EINVAL ; +return 0 ; }static int regulator_pre_probe (struct udevice *dev)@@ -473,8 +483,6 @@ static int regulator_pre_probe(struct udevice *dev) -ENODATA); uc_pdata->max_uA =dev_read_u32_default (dev,"regulator-max-microamp" , -ENODATA ); - uc_pdata->always_on =dev_read_bool (dev,"regulator-always-on" ); - uc_pdata->boot_on =dev_read_bool (dev,"regulator-boot-on" ); uc_pdata->ramp_delay =dev_read_u32_default (dev,"regulator-ramp-delay" ,0 );Quoted 8 lines
Quoted 4 lines
drivers/power/regulator/regulator-uclass.c +0
-1uc_pdata->force_off =dev_read_bool (dev,"regulator-force-boot-off" ); --2.43.0
This is reading a lot of DT stuff very early, which may be slow. It is also reading from the DT in the
bind()step which we sometimes have to do, but try to avoid.Could we set up the livetree pre-bind? What about MMU? On armv8 at least this would have a huge impact on performance. I've done some measurements and there is at least 1 order of magnitude difference between parsing FDT with no caches vs parsing livetree with, it's huge.
Quoted 8 lines
Quoted 2 lines
That seems like a great idea to me, in general. The fact that SPL sets up the MMU on armv8 makes it more practical.
Well, on qcom we don't use SPL (yet?), we did have a cyclical dependency since we rely on DTB for the memory layout, although I have some patches to do all the memory parsing in
board_fdt_blob_setup()since that's needed for multi-dtb FIT. So I guess we could enable caches at the same time.
Yes...it seems that enabling cache in SPL has become common on armv8.
As to the memory layout, I'm not sure what is happening there, but it seems that the DT does not describe it in general (at least not until U-Boot adds the nodes).
Quoted 6 lines
Quoted 6 lines
But for this series I believe we are going to have to define what happens in what phase. We have
power_init_board()which is the old way of doing this...but perhaps we could use that as a way to start up regulators which are needed.
Quoted 8 lines
Quoted 5 lines
As to my question about whether this happens in SPL / pre-reloc / proper, I forgot that we have the bootph tags for that, so it should be fine. The main issue is that in U-Boot proper we will re-init the regulators even though that has already been done. Probably that can be handled by
Kconfigor a flag in SPL handoff.Ensuring that it isn't done multiple times sounds like the right approach to me.
OK...I wonder how we can solve this. Needs some though.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Also this seems to happen in SPL and again pre-reloc and again in U-Boot post-reloc?
Should we have a step in the init sequence where we set up the regulators, by calling
regulators_enable_boot_on()?
Regards,
Simon
Hi Simon,
Quoted 19 lines
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
Quoted 4 lines
This is reading a lot of DT stuff very early, which may be slow. It is also reading from the DT in the
bind()step which we sometimes have to do, but try to avoid.Could we set up the livetree pre-bind? What about MMU? On armv8 at least this would have a huge impact on performance. I've done some measurements and there is at least 1 order of magnitude difference between parsing FDT with no caches vs parsing livetree with, it's huge.
Quoted 8 lines
Quoted 2 lines
That seems like a great idea to me, in general. The fact that SPL sets up the MMU on armv8 makes it more practical.
Well, on qcom we don't use SPL (yet?), we did have a cyclical dependency since we rely on DTB for the memory layout, although I have some patches to do all the memory parsing in
board_fdt_blob_setup()since that's needed for multi-dtb FIT. So I guess we could enable caches at the same time.
Quoted 5 lines
Yes...it seems that enabling cache in SPL has become common on armv8.
As to the memory layout, I'm not sure what is happening there, but it seems that the DT does not describe it in general (at least not until U-Boot adds the nodes).
I suppose this depends on the platform. On Qualcomm we use DT as the source of truth as it lets us support many platforms (with totally different memory maps) with a single U-Boot binary, at least for development this is quite nice.
Quoted 30 lines
Quoted 7 lines
Quoted 7 lines
But for this series I believe we are going to have to define what happens in what phase. We have
power_init_board()which is the old way of doing this...but perhaps we could use that as a way to start up regulators which are needed.Quoted 8 lines
Quoted 5 lines
As to my question about whether this happens in SPL / pre-reloc / proper, I forgot that we have the bootph tags for that, so it should be fine. The main issue is that in U-Boot proper we will re-init the regulators even though that has already been done. Probably that can be handled by
Kconfigor a flag in SPL handoff.Ensuring that it isn't done multiple times sounds like the right approach to me.
OK...I wonder how we can solve this. Needs some though.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Also this seems to happen in SPL and again pre-reloc and again in U-Boot post-reloc?
Should we have a step in the init sequence where we set up the regulators, by calling
regulators_enable_boot_on()?Regards,
Simon
Signature · 1 line
// Caleb (they/them)
Quoted 1 line · Simon Glass
Hi Marek,
Hi,
[...]
Quoted 52 lines
Quoted 52 lines
--- drivers/power/regulator/regulator-uclass.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-)drivers/power/regulator/regulator-uclass.c +15
-7@@ -433,6 +433,8 @@ static int regulator_post_bind(struct udevice *dev)const char *property ="regulator-name" ; uc_pdata =dev_get_uclass_plat (dev); + uc_pdata->always_on =dev_read_bool (dev,"regulator-always-on" ); + uc_pdata->boot_on =dev_read_bool (dev,"regulator-boot-on" );/* Regulator's mandatory constraint */ uc_pdata->name =dev_read_string (dev, property);@@ -444,13 +446,21 @@ static int regulator_post_bind(struct udevice *dev)return -EINVAL ; } -if (regulator_name_is_unique (dev, uc_pdata->name)) -return 0 ; +if (!regulator_name_is_unique (dev, uc_pdata->name)) { +debug ("'%s' of dev: '%s', has nonunique value: '%s\n" , + property, dev->name, uc_pdata->name); +return -EINVAL ; + } -debug ("'%s' of dev: '%s', has nonunique value: '%s\n" , - property, dev->name, uc_pdata->name); +/* +* In case the regulator has regulator-always-on or +* regulator-boot-on DT property, trigger probe() to +* configure its default state during startup. +*/ +if (uc_pdata->always_on && uc_pdata->boot_on) +dev_or_flags (dev,DM_FLAG_PROBE_AFTER_BIND ); -return -EINVAL ; +return 0 ; }static int regulator_pre_probe (struct udevice *dev)@@ -473,8 +483,6 @@ static int regulator_pre_probe(struct udevice *dev) -ENODATA); uc_pdata->max_uA =dev_read_u32_default (dev,"regulator-max-microamp" , -ENODATA ); - uc_pdata->always_on =dev_read_bool (dev,"regulator-always-on" ); - uc_pdata->boot_on =dev_read_bool (dev,"regulator-boot-on" ); uc_pdata->ramp_delay =dev_read_u32_default (dev,"regulator-ramp-delay" ,0 );
Quoted 8 lines
Quoted 4 lines
drivers/power/regulator/regulator-uclass.c +0
-1uc_pdata->force_off =dev_read_bool (dev,"regulator-force-boot-off" ); --2.43.0
This is reading a lot of DT stuff very early, which may be slow. It is also reading from the DT in the
bind()step which we sometimes have to do, but try to avoid.
Actually, it is reading only the bare minimum very early in bind, the always-on and boot-on, the rest is in pre_probe, i.e. later.
Quoted 2 lines
Also this seems to happen in SPL and again pre-reloc and again in U-Boot post-reloc?
What does, the uclass post_bind ?
Quoted 2 lines
Should we have a step in the init sequence where we set up the regulators, by calling
regulators_enable_boot_on()?
Let's not do this , the entire point of this series is to get rid of those functions and do the regulator configuration the same way LED subsystem does it -- by probing always-on/boot-on regulators and configuring them correctly on probe.
To me regulators_enable_boot_on() and the like was always an inconsistently applied workaround for missing DM_FLAG_PROBE_AFTER_BIND , which is now implemented, so such workarounds can be removed.
Hi Marek,
Quoted 69 lines · Marek Vasut
Quoted 1 line · Simon Glass
Hi Marek,
Hi,
[...]
Quoted 52 lines
Quoted 52 lines
--- drivers/power/regulator/regulator-uclass.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-)drivers/power/regulator/regulator-uclass.c +15
-7@@ -433,6 +433,8 @@ static int regulator_post_bind(struct udevice *dev)const char *property ="regulator-name" ; uc_pdata =dev_get_uclass_plat (dev); + uc_pdata->always_on =dev_read_bool (dev,"regulator-always-on" ); + uc_pdata->boot_on =dev_read_bool (dev,"regulator-boot-on" );/* Regulator's mandatory constraint */ uc_pdata->name =dev_read_string (dev, property);@@ -444,13 +446,21 @@ static int regulator_post_bind(struct udevice *dev)return -EINVAL ; } -if (regulator_name_is_unique (dev, uc_pdata->name)) -return 0 ; +if (!regulator_name_is_unique (dev, uc_pdata->name)) { +debug ("'%s' of dev: '%s', has nonunique value: '%s\n" , + property, dev->name, uc_pdata->name); +return -EINVAL ; + } -debug ("'%s' of dev: '%s', has nonunique value: '%s\n" , - property, dev->name, uc_pdata->name); +/* +* In case the regulator has regulator-always-on or +* regulator-boot-on DT property, trigger probe() to +* configure its default state during startup. +*/ +if (uc_pdata->always_on && uc_pdata->boot_on) +dev_or_flags (dev,DM_FLAG_PROBE_AFTER_BIND ); -return -EINVAL ; +return 0 ; }static int regulator_pre_probe (struct udevice *dev)@@ -473,8 +483,6 @@ static int regulator_pre_probe(struct udevice *dev) -ENODATA); uc_pdata->max_uA =dev_read_u32_default (dev,"regulator-max-microamp" , -ENODATA ); - uc_pdata->always_on =dev_read_bool (dev,"regulator-always-on" ); - uc_pdata->boot_on =dev_read_bool (dev,"regulator-boot-on" ); uc_pdata->ramp_delay =dev_read_u32_default (dev,"regulator-ramp-delay" ,0 );Quoted 8 lines
Quoted 4 lines
drivers/power/regulator/regulator-uclass.c +0
-1uc_pdata->force_off =dev_read_bool (dev,"regulator-force-boot-off" ); --2.43.0
This is reading a lot of DT stuff very early, which may be slow. It is also reading from the DT in the
bind()step which we sometimes have to do, but try to avoid.
Quoted 2 lines
Actually, it is reading only the bare minimum very early in bind, the always-on and boot-on, the rest is in
pre_probe, i.e. later.
Yes, I see that. Also it is inevitable that these properties need to be read before probe(), since they control whether to probe().
Quoted 5 lines
Quoted 3 lines
Also this seems to happen in SPL and again pre-reloc and again in U-Boot post-reloc?
What does, the uclass
post_bind?
I mean that this code will be called in SPL (if the regulators are in the DT there), U-Boot pre-reloc and post-reloc, each time turning on the regulators. We need a way to control that, don't we?
Quoted 4 lines
Quoted 3 lines
Should we have a step in the init sequence where we set up the regulators, by calling
regulators_enable_boot_on()?
Quoted 8 lines
Let's not do this , the entire point of this series is to get rid of those functions and do the regulator configuration the same way LED subsystem does it -- by probing always-on/boot-on regulators and configuring them correctly on probe.
To me
regulators_enable_boot_on()and the like was always an inconsistently applied workaround for missingDM_FLAG_PROBE_AFTER_BIND, which is now implemented, so such workarounds can be removed.
That patch seemed to slip under the radar, sent and applied on the same day! We really need to add a test for it, BTW.
My concern is that this might cause us ordering problems. We perhaps want the regulators to be done first. If drivers are probed which use regulators, then presumably they will enable them. Consider this:
- LED driver auto-probes
- probes I2C bus 2
- probes LDO1 which is autoset so turns on
- LDO1 probes, but is already running
- LDO2 probes, which is autoset so turns on
So long as it is OK to enable the regulators in any order, then this seems fine. But is it? How do we handle the case where are particular sequence is needed?
Regards,
Simon
Quoted 1 line · Simon Glass
Hi Marek,
Hi,
[...]
Quoted 24 lines
Quoted 17 lines
Quoted 8 lines
Quoted 8 lines
drivers/power/regulator/regulator-uclass.c +0
-2@@ -473,8 +483,6 @@ static int regulator_pre_probe(struct udevice *dev) -ENODATA); uc_pdata->max_uA =dev_read_u32_default (dev,"regulator-max-microamp" , -ENODATA ); - uc_pdata->always_on =dev_read_bool (dev,"regulator-always-on" ); - uc_pdata->boot_on =dev_read_bool (dev,"regulator-boot-on" ); uc_pdata->ramp_delay =dev_read_u32_default (dev,"regulator-ramp-delay" ,0 );Quoted 8 lines
Quoted 4 lines
(quoted diff) +0
-1uc_pdata->force_off = dev_read_bool(dev, "regulator-force-boot-off"); --2.43.0
This is reading a lot of DT stuff very early, which may be slow. It is also reading from the DT in the
bind()step which we sometimes have to do, but try to avoid.Quoted 2 lines
Actually, it is reading only the bare minimum very early in bind, the always-on and boot-on, the rest is in
pre_probe, i.e. later.Yes, I see that. Also it is inevitable that these properties need to be read before
probe(), since they control whether toprobe().Quoted 1 line
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Also this seems to happen in SPL and again pre-reloc and again in U-Boot post-reloc?
What does, the uclass
post_bind?I mean that this code will be called in SPL (if the regulators are in the DT there), U-Boot pre-reloc and post-reloc, each time turning on the regulators. We need a way to control that, don't we?
I would assume that if those regulators are turned on once in the earliest stage , turning them on again in the follow up stage would be a noop ? This is the point of regulator-*-on, to keep the regulators on.
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
Should we have a step in the init sequence where we set up the regulators, by calling
regulators_enable_boot_on()?Let's not do this , the entire point of this series is to get rid of those functions and do the regulator configuration the same way LED subsystem does it -- by probing always-on/boot-on regulators and configuring them correctly on probe.
Quoted 6 lines
Quoted 3 lines
To me
regulators_enable_boot_on()and the like was always an inconsistently applied workaround for missingDM_FLAG_PROBE_AFTER_BIND, which is now implemented, so such workarounds can be removed.That patch seemed to slip under the radar, sent and applied on the same day! We really need to add a test for it, BTW.
Which patch ? My recollection of DM_FLAG_PROBE_AFTER_BIND was that it took a while to get in.
Quoted 10 lines
My concern is that this might cause us ordering problems. We perhaps want the regulators to be done first. If drivers are probed which use regulators, then presumably they will enable them. Consider this:
- LED driver auto-probes
- probes I2C bus 2
- probes LDO1 which is autoset so turns on
- LDO1 probes, but is already running
- LDO2 probes, which is autoset so turns on
Quoted 3 lines
So long as it is OK to enable the regulators in any order, then this seems fine. But is it? How do we handle the case where are particular sequence is needed?
Did we finally arrive at the point where we need -EPROBE_DEFER alike mechanism ?
Hi Marek,
Quoted 37 lines · Marek Vasut
Quoted 1 line · Simon Glass
Hi Marek,
Hi,
[...]
Quoted 29 lines
Quoted 17 lines
Quoted 8 lines
Quoted 8 lines
drivers/power/regulator/regulator-uclass.c +0
-2@@ -473,8 +483,6 @@ static int regulator_pre_probe(struct udevice *dev) -ENODATA); uc_pdata->max_uA =dev_read_u32_default (dev,"regulator-max-microamp" , -ENODATA ); - uc_pdata->always_on =dev_read_bool (dev,"regulator-always-on" ); - uc_pdata->boot_on =dev_read_bool (dev,"regulator-boot-on" ); uc_pdata->ramp_delay =dev_read_u32_default (dev,"regulator-ramp-delay" ,0 );Quoted 8 lines
Quoted 4 lines
(quoted diff) +0
-1uc_pdata->force_off = dev_read_bool(dev, "regulator-force-boot-off"); --2.43.0
This is reading a lot of DT stuff very early, which may be slow. It is also reading from the DT in the
bind()step which we sometimes have to do, but try to avoid.Quoted 2 lines
Actually, it is reading only the bare minimum very early in bind, the always-on and boot-on, the rest is in
pre_probe, i.e. later.Yes, I see that. Also it is inevitable that these properties need to be read before
probe(), since they control whether toprobe().Quoted 5 lines
Quoted 3 lines
Also this seems to happen in SPL and again pre-reloc and again in U-Boot post-reloc?
What does, the uclass
post_bind?
Quoted 7 lines
Quoted 3 lines
I mean that this code will be called in SPL (if the regulators are in the DT there), U-Boot pre-reloc and post-reloc, each time turning on the regulators. We need a way to control that, don't we?
I would assume that if those regulators are turned on once in the earliest stage , turning them on again in the follow up stage would be a noop ? This is the point of regulator-*-on, to keep the regulators on.
No, there is sometimes a particular sequence needed.
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 3 lines
Should we have a step in the init sequence where we set up the regulators, by calling
regulators_enable_boot_on()?Let's not do this , the entire point of this series is to get rid of those functions and do the regulator configuration the same way LED subsystem does it -- by probing always-on/boot-on regulators and configuring them correctly on probe.
To me
regulators_enable_boot_on()and the like was always an inconsistently applied workaround for missingDM_FLAG_PROBE_AFTER_BIND, which is now implemented, so such workarounds can be removed.
Quoted 5 lines
Quoted 2 lines
That patch seemed to slip under the radar, sent and applied on the same day! We really need to add a test for it, BTW.
Which patch ? My recollection of
DM_FLAG_PROBE_AFTER_BINDwas that it took a while to get in.
[1]
Quoted 11 lines
Quoted 11 lines
My concern is that this might cause us ordering problems. We perhaps want the regulators to be done first. If drivers are probed which use regulators, then presumably they will enable them. Consider this:
- LED driver auto-probes
- probes I2C bus 2
- probes LDO1 which is autoset so turns on
- LDO1 probes, but is already running
- LDO2 probes, which is autoset so turns on
Quoted 6 lines
Quoted 3 lines
So long as it is OK to enable the regulators in any order, then this seems fine. But is it? How do we handle the case where are particular sequence is needed?
Did we finally arrive at the point where we need -EPROBE_DEFER alike mechanism ?
Nope. But I am concerned that this patch is leading us there. bind() really needs to be as clean as possible. It is one of the design elements of driver model which Linux should adopt.
There is always a race to be the first to init something, move the init earlier, etc... I don't see any general need to init the regulators right at the start. It should be done in a separate function and be optional. I am happy to send a patch if you like.
Regards,
Simon
[1] https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
On 9/12/24 3:00 AM, Simon Glass wrote:
Hello Simon,
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Also this seems to happen in SPL and again pre-reloc and again in U-Boot post-reloc?
What does, the uclass
post_bind?I mean that this code will be called in SPL (if the regulators are in the DT there), U-Boot pre-reloc and post-reloc, each time turning on the regulators. We need a way to control that, don't we?
Quoted 5 lines
Quoted 3 lines
I would assume that if those regulators are turned on once in the earliest stage , turning them on again in the follow up stage would be a noop ? This is the point of regulator-*-on, to keep the regulators on.
No, there is sometimes a particular sequence needed.
If the regulators are already enabled, enabling them again will be a noop, do you agree ?
[...]
Quoted 17 lines
Quoted 10 lines
Quoted 10 lines
My concern is that this might cause us ordering problems. We perhaps want the regulators to be done first. If drivers are probed which use regulators, then presumably they will enable them. Consider this:
- LED driver auto-probes
- probes I2C bus 2
- probes LDO1 which is autoset so turns on
- LDO1 probes, but is already running
- LDO2 probes, which is autoset so turns onQuoted 6 lines
Quoted 3 lines
So long as it is OK to enable the regulators in any order, then this seems fine. But is it? How do we handle the case where are particular sequence is needed?
Did we finally arrive at the point where we need -EPROBE_DEFER alike mechanism ?
Quoted 8 lines
Nope. But I am concerned that this patch is leading us there.
bind()really needs to be as clean as possible. It is one of the design elements of driver model which Linux should adopt.There is always a race to be the first to init something, move the init earlier, etc... I don't see any general need to init the regulators right at the start. It should be done in a separate function and be optional. I am happy to send a patch if you like.
I strongly disagree that regulators which are marked in DT as always-on/boot-on should somehow be treated as optional-on in U-Boot , no , they should not. They should be enabled by the regulator uclass core code, for every regulator which is marked that way. If they are not to be enabled, they should not be marked that way in DT.
While the board code may exercise some control over enabling regulators earlier, it should still be the default in the core code to enable such regulators unconditionally.
If the concern is ordering problems between regulators, then regulators have to define vin-supply to describe their upstream supply in DT, which should address the ordering problem. DTTO for clock and pinmux etc.
Quoted 89 lines · Simon Glass
Hi Marek,
Quoted 37 lines · Marek Vasut
Quoted 1 line · Simon Glass
Hi Marek,
Hi,
[...]
Quoted 29 lines
Quoted 17 lines
Quoted 8 lines
Quoted 8 lines
drivers/power/regulator/regulator-uclass.c +0
-2@@ -473,8 +483,6 @@ static int regulator_pre_probe(struct udevice *dev) -ENODATA); uc_pdata->max_uA =dev_read_u32_default (dev,"regulator-max-microamp" , -ENODATA ); - uc_pdata->always_on =dev_read_bool (dev,"regulator-always-on" ); - uc_pdata->boot_on =dev_read_bool (dev,"regulator-boot-on" ); uc_pdata->ramp_delay =dev_read_u32_default (dev,"regulator-ramp-delay" ,0 );Quoted 8 lines
Quoted 4 lines
(quoted diff) +0
-1uc_pdata->force_off = dev_read_bool(dev, "regulator-force-boot-off"); --2.43.0
This is reading a lot of DT stuff very early, which may be slow. It is also reading from the DT in the
bind()step which we sometimes have to do, but try to avoid.Quoted 2 lines
Actually, it is reading only the bare minimum very early in bind, the always-on and boot-on, the rest is in
pre_probe, i.e. later.Yes, I see that. Also it is inevitable that these properties need to be read before
probe(), since they control whether toprobe().Quoted 5 lines
Quoted 3 lines
Also this seems to happen in SPL and again pre-reloc and again in U-Boot post-reloc?
What does, the uclass
post_bind?Quoted 7 lines
Quoted 3 lines
I mean that this code will be called in SPL (if the regulators are in the DT there), U-Boot pre-reloc and post-reloc, each time turning on the regulators. We need a way to control that, don't we?
I would assume that if those regulators are turned on once in the earliest stage , turning them on again in the follow up stage would be a noop ? This is the point of regulator-*-on, to keep the regulators on.
No, there is sometimes a particular sequence needed.
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 3 lines
Should we have a step in the init sequence where we set up the regulators, by calling
regulators_enable_boot_on()?Let's not do this , the entire point of this series is to get rid of those functions and do the regulator configuration the same way LED subsystem does it -- by probing always-on/boot-on regulators and configuring them correctly on probe.
To me
regulators_enable_boot_on()and the like was always an inconsistently applied workaround for missingDM_FLAG_PROBE_AFTER_BIND, which is now implemented, so such workarounds can be removed.Quoted 5 lines
Quoted 2 lines
That patch seemed to slip under the radar, sent and applied on the same day! We really need to add a test for it, BTW.
Which patch ? My recollection of
DM_FLAG_PROBE_AFTER_BINDwas that it took a while to get in.[1]
Quoted 11 lines
Quoted 11 lines
My concern is that this might cause us ordering problems. We perhaps want the regulators to be done first. If drivers are probed which use regulators, then presumably they will enable them. Consider this:
- LED driver auto-probes
- probes I2C bus 2
- probes LDO1 which is autoset so turns on
- LDO1 probes, but is already running
- LDO2 probes, which is autoset so turns onQuoted 6 lines
Quoted 3 lines
So long as it is OK to enable the regulators in any order, then this seems fine. But is it? How do we handle the case where are particular sequence is needed?
Did we finally arrive at the point where we need -EPROBE_DEFER alike mechanism ?
Quoted 8 lines
Nope. But I am concerned that this patch is leading us there.
bind()really needs to be as clean as possible. It is one of the design elements of driver model which Linux should adopt.There is always a race to be the first to init something, move the init earlier, etc... I don't see any general need to init the regulators right at the start. It should be done in a separate function and be optional. I am happy to send a patch if you like.
Since we're currently stuck on the point where Marek has patches that fix a real problem, and Svyatoslav has a problem with them, but isn't currently able to debug it, yes, please put forward your patch that might address both sets of problems so we can all figure out how to resolve the problems, thanks!
Signature · 1 line
Tom
пн, 16 вер. 2024 р. о 19:28 Tom Rini <[email protected]> пише:
Quoted 100 lines · Simon Glass
Quoted 89 lines
Hi Marek,
Quoted 37 lines · Marek Vasut
Quoted 1 line · Simon Glass
Hi Marek,
Hi,
[...]
Quoted 29 lines
Quoted 17 lines
Quoted 8 lines
Quoted 8 lines
(quoted diff) +0
-2@@ -473,8 +483,6 @@ static int regulator_pre_probe(struct udevice *dev) -ENODATA); uc_pdata->max_uA = dev_read_u32_default(dev, "regulator-max-microamp", -ENODATA); - uc_pdata->always_on = dev_read_bool(dev, "regulator-always-on"); - uc_pdata->boot_on = dev_read_bool(dev, "regulator-boot-on"); uc_pdata->ramp_delay = dev_read_u32_default(dev, "regulator-ramp-delay", 0);Quoted 8 lines
Quoted 4 lines
(quoted diff) +0
-1uc_pdata->force_off = dev_read_bool(dev, "regulator-force-boot-off"); --2.43.0
This is reading a lot of DT stuff very early, which may be slow. It is also reading from the DT in the
bind()step which we sometimes have to do, but try to avoid.Quoted 2 lines
Actually, it is reading only the bare minimum very early in bind, the always-on and boot-on, the rest is in
pre_probe, i.e. later.Yes, I see that. Also it is inevitable that these properties need to be read before
probe(), since they control whether toprobe().Quoted 5 lines
Quoted 3 lines
Also this seems to happen in SPL and again pre-reloc and again in U-Boot post-reloc?
What does, the uclass
post_bind?Quoted 7 lines
Quoted 3 lines
I mean that this code will be called in SPL (if the regulators are in the DT there), U-Boot pre-reloc and post-reloc, each time turning on the regulators. We need a way to control that, don't we?
I would assume that if those regulators are turned on once in the earliest stage , turning them on again in the follow up stage would be a noop ? This is the point of regulator-*-on, to keep the regulators on.
No, there is sometimes a particular sequence needed.
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 3 lines
Should we have a step in the init sequence where we set up the regulators, by calling
regulators_enable_boot_on()?Let's not do this , the entire point of this series is to get rid of those functions and do the regulator configuration the same way LED subsystem does it -- by probing always-on/boot-on regulators and configuring them correctly on probe.
To me
regulators_enable_boot_on()and the like was always an inconsistently applied workaround for missingDM_FLAG_PROBE_AFTER_BIND, which is now implemented, so such workarounds can be removed.Quoted 5 lines
Quoted 2 lines
That patch seemed to slip under the radar, sent and applied on the same day! We really need to add a test for it, BTW.
Which patch ? My recollection of
DM_FLAG_PROBE_AFTER_BINDwas that it took a while to get in.[1]
Quoted 11 lines
Quoted 11 lines
My concern is that this might cause us ordering problems. We perhaps want the regulators to be done first. If drivers are probed which use regulators, then presumably they will enable them. Consider this:
- LED driver auto-probes
- probes I2C bus 2
- probes LDO1 which is autoset so turns on
- LDO1 probes, but is already running
- LDO2 probes, which is autoset so turns onQuoted 6 lines
Quoted 3 lines
So long as it is OK to enable the regulators in any order, then this seems fine. But is it? How do we handle the case where are particular sequence is needed?
Did we finally arrive at the point where we need -EPROBE_DEFER alike mechanism ?
Quoted 8 lines
Nope. But I am concerned that this patch is leading us there.
bind()really needs to be as clean as possible. It is one of the design elements of driver model which Linux should adopt.There is always a race to be the first to init something, move the init earlier, etc... I don't see any general need to init the regulators right at the start. It should be done in a separate function and be optional. I am happy to send a patch if you like.
Quoted 8 lines
Since we're currently stuck on the point where Marek has patches that fix a real problem, and Svyatoslav has a problem with them, but isn't currently able to debug it, yes, please put forward your patch that might address both sets of problems so we can all figure out how to resolve the problems, thanks!
--
Tom
With patches from Marek there is no i2c chip probe of PMIC, while without i2c chip probe is called (probe_chip function). How this is even possible?
Quoted 107 lines · Svyatoslav Ryhel
пн, 16 вер. 2024 р. о 19:28 Tom Rini <[email protected]> пише:
Quoted 100 lines · Simon Glass
Quoted 89 lines
Hi Marek,
Quoted 37 lines · Marek Vasut
Quoted 1 line · Simon Glass
Hi Marek,
Hi,
[...]
Quoted 29 lines
Quoted 17 lines
Quoted 8 lines
Quoted 8 lines
(quoted diff) +0
-2@@ -473,8 +483,6 @@ static int regulator_pre_probe(struct udevice *dev) -ENODATA); uc_pdata->max_uA = dev_read_u32_default(dev, "regulator-max-microamp", -ENODATA); - uc_pdata->always_on = dev_read_bool(dev, "regulator-always-on"); - uc_pdata->boot_on = dev_read_bool(dev, "regulator-boot-on"); uc_pdata->ramp_delay = dev_read_u32_default(dev, "regulator-ramp-delay", 0);Quoted 8 lines
Quoted 4 lines
(quoted diff) +0
-1uc_pdata->force_off = dev_read_bool(dev, "regulator-force-boot-off"); --2.43.0
This is reading a lot of DT stuff very early, which may be slow. It is also reading from the DT in the
bind()step which we sometimes have to do, but try to avoid.Quoted 2 lines
Actually, it is reading only the bare minimum very early in bind, the always-on and boot-on, the rest is in
pre_probe, i.e. later.Yes, I see that. Also it is inevitable that these properties need to be read before
probe(), since they control whether toprobe().Quoted 5 lines
Quoted 3 lines
Also this seems to happen in SPL and again pre-reloc and again in U-Boot post-reloc?
What does, the uclass
post_bind?Quoted 7 lines
Quoted 3 lines
I mean that this code will be called in SPL (if the regulators are in the DT there), U-Boot pre-reloc and post-reloc, each time turning on the regulators. We need a way to control that, don't we?
I would assume that if those regulators are turned on once in the earliest stage , turning them on again in the follow up stage would be a noop ? This is the point of regulator-*-on, to keep the regulators on.
No, there is sometimes a particular sequence needed.
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 3 lines
Should we have a step in the init sequence where we set up the regulators, by calling
regulators_enable_boot_on()?Let's not do this , the entire point of this series is to get rid of those functions and do the regulator configuration the same way LED subsystem does it -- by probing always-on/boot-on regulators and configuring them correctly on probe.
To me
regulators_enable_boot_on()and the like was always an inconsistently applied workaround for missingDM_FLAG_PROBE_AFTER_BIND, which is now implemented, so such workarounds can be removed.Quoted 5 lines
Quoted 2 lines
That patch seemed to slip under the radar, sent and applied on the same day! We really need to add a test for it, BTW.
Which patch ? My recollection of
DM_FLAG_PROBE_AFTER_BINDwas that it took a while to get in.[1]
Quoted 11 lines
Quoted 11 lines
My concern is that this might cause us ordering problems. We perhaps want the regulators to be done first. If drivers are probed which use regulators, then presumably they will enable them. Consider this:
- LED driver auto-probes
- probes I2C bus 2
- probes LDO1 which is autoset so turns on
- LDO1 probes, but is already running
- LDO2 probes, which is autoset so turns onQuoted 6 lines
Quoted 3 lines
So long as it is OK to enable the regulators in any order, then this seems fine. But is it? How do we handle the case where are particular sequence is needed?
Did we finally arrive at the point where we need -EPROBE_DEFER alike mechanism ?
Quoted 8 lines
Nope. But I am concerned that this patch is leading us there.
bind()really needs to be as clean as possible. It is one of the design elements of driver model which Linux should adopt.There is always a race to be the first to init something, move the init earlier, etc... I don't see any general need to init the regulators right at the start. It should be done in a separate function and be optional. I am happy to send a patch if you like.
Quoted 5 lines
Since we're currently stuck on the point where Marek has patches that fix a real problem, and Svyatoslav has a problem with them, but isn't currently able to debug it, yes, please put forward your patch that might address both sets of problems so we can all figure out how to resolve the problems, thanks!
Quoted 3 lines
With patches from Marek there is no i2c chip probe of PMIC, while without i2c chip probe is called (
probe_chipfunction). How this is even possible?
Yes, it's very puzzling. Do you have the ability to get some debug console type information out so you can sprinkle in some prints and figure it out?
Signature · 1 line
Tom
Quoted 108 lines · Tom Rini
Quoted 107 lines · Svyatoslav Ryhel
пн, 16 вер. 2024 р. о 19:28 Tom Rini <[email protected]> пише:
Quoted 105 lines · Simon Glass
Quoted 89 lines
Hi Marek,
Quoted 37 lines · Marek Vasut
Quoted 1 line · Simon Glass
Hi Marek,
Hi,
[...]
Quoted 29 lines
Quoted 17 lines
Quoted 8 lines
Quoted 8 lines
(quoted diff) +0
-2@@ -473,8 +483,6 @@ static int regulator_pre_probe(struct udevice *dev) -ENODATA); uc_pdata->max_uA = dev_read_u32_default(dev, "regulator-max-microamp", -ENODATA); - uc_pdata->always_on = dev_read_bool(dev, "regulator-always-on"); - uc_pdata->boot_on = dev_read_bool(dev, "regulator-boot-on"); uc_pdata->ramp_delay = dev_read_u32_default(dev, "regulator-ramp-delay", 0);Quoted 8 lines
Quoted 4 lines
(quoted diff) +0
-1uc_pdata->force_off = dev_read_bool(dev, "regulator-force-boot-off"); --2.43.0
This is reading a lot of DT stuff very early, which may be slow. It is also reading from the DT in the
bind()step which we sometimes have to do, but try to avoid.Quoted 2 lines
Actually, it is reading only the bare minimum very early in bind, the always-on and boot-on, the rest is in
pre_probe, i.e. later.Yes, I see that. Also it is inevitable that these properties need to be read before
probe(), since they control whether toprobe().Quoted 5 lines
Quoted 3 lines
Also this seems to happen in SPL and again pre-reloc and again in U-Boot post-reloc?
What does, the uclass
post_bind?Quoted 7 lines
Quoted 3 lines
I mean that this code will be called in SPL (if the regulators are in the DT there), U-Boot pre-reloc and post-reloc, each time turning on the regulators. We need a way to control that, don't we?
I would assume that if those regulators are turned on once in the earliest stage , turning them on again in the follow up stage would be a noop ? This is the point of regulator-*-on, to keep the regulators on.
No, there is sometimes a particular sequence needed.
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 3 lines
Should we have a step in the init sequence where we set up the regulators, by calling
regulators_enable_boot_on()?Let's not do this , the entire point of this series is to get rid of those functions and do the regulator configuration the same way LED subsystem does it -- by probing always-on/boot-on regulators and configuring them correctly on probe.
To me
regulators_enable_boot_on()and the like was always an inconsistently applied workaround for missingDM_FLAG_PROBE_AFTER_BIND, which is now implemented, so such workarounds can be removed.Quoted 5 lines
Quoted 2 lines
That patch seemed to slip under the radar, sent and applied on the same day! We really need to add a test for it, BTW.
Which patch ? My recollection of
DM_FLAG_PROBE_AFTER_BINDwas that it took a while to get in.[1]
Quoted 11 lines
Quoted 11 lines
My concern is that this might cause us ordering problems. We perhaps want the regulators to be done first. If drivers are probed which use regulators, then presumably they will enable them. Consider this:
- LED driver auto-probes
- probes I2C bus 2
- probes LDO1 which is autoset so turns on
- LDO1 probes, but is already running
- LDO2 probes, which is autoset so turns onQuoted 6 lines
Quoted 3 lines
So long as it is OK to enable the regulators in any order, then this seems fine. But is it? How do we handle the case where are particular sequence is needed?
Did we finally arrive at the point where we need -EPROBE_DEFER alike mechanism ?
Quoted 8 lines
Nope. But I am concerned that this patch is leading us there.
bind()really needs to be as clean as possible. It is one of the design elements of driver model which Linux should adopt.There is always a race to be the first to init something, move the init earlier, etc... I don't see any general need to init the regulators right at the start. It should be done in a separate function and be optional. I am happy to send a patch if you like.
Since we're currently stuck on the point where Marek has patches that fix a real problem, and Svyatoslav has a problem with them, but isn't currently able to debug it, yes, please put forward your patch that might address both sets of problems so we can all figure out how to resolve the problems, thanks!
Quoted 7 lines
Quoted 3 lines
With patches from Marek there is no i2c chip probe of PMIC, while without i2c chip probe is called (
probe_chipfunction). How this is even possible?Yes, it's very puzzling. Do you have the ability to get some debug console type information out so you can sprinkle in some prints and figure it out?
So, here's my plan. Marek posted
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
which is a work-around, so that v2024.10 can work. I'm going to take that for master tomorrow. I'm also going to take _this_ series to -next tomorrow, as this is the best approach we currently have to solving the overall problem. The Tegra platforms that are now very oddly broken need to get debugged to see where their problem is, and if there's an entirely alternate approach, Simon can post patches for that instead on top of next.
Signature · 1 line
Tom
ср, 25 вер. 2024 р. о 02:44 Tom Rini <[email protected]> пише:
Quoted 128 lines · Tom Rini
Quoted 108 lines · Svyatoslav Ryhel
Quoted 107 lines
пн, 16 вер. 2024 р. о 19:28 Tom Rini <[email protected]> пише:
Quoted 105 lines · Simon Glass
Quoted 89 lines
Hi Marek,
Quoted 37 lines · Marek Vasut
Quoted 1 line · Simon Glass
Hi Marek,
Hi,
[...]
Quoted 29 lines
Quoted 17 lines
Quoted 8 lines
Quoted 8 lines
(quoted diff) +0
-2@@ -473,8 +483,6 @@ static int regulator_pre_probe(struct udevice *dev) -ENODATA); uc_pdata->max_uA = dev_read_u32_default(dev, "regulator-max-microamp", -ENODATA); - uc_pdata->always_on = dev_read_bool(dev, "regulator-always-on"); - uc_pdata->boot_on = dev_read_bool(dev, "regulator-boot-on"); uc_pdata->ramp_delay = dev_read_u32_default(dev, "regulator-ramp-delay", 0);Quoted 8 lines
Quoted 4 lines
(quoted diff) +0
-1uc_pdata->force_off = dev_read_bool(dev, "regulator-force-boot-off"); --2.43.0
This is reading a lot of DT stuff very early, which may be slow. It is also reading from the DT in the
bind()step which we sometimes have to do, but try to avoid.Quoted 2 lines
Actually, it is reading only the bare minimum very early in bind, the always-on and boot-on, the rest is in
pre_probe, i.e. later.Yes, I see that. Also it is inevitable that these properties need to be read before
probe(), since they control whether toprobe().Quoted 5 lines
Quoted 3 lines
Also this seems to happen in SPL and again pre-reloc and again in U-Boot post-reloc?
What does, the uclass
post_bind?Quoted 7 lines
Quoted 3 lines
I mean that this code will be called in SPL (if the regulators are in the DT there), U-Boot pre-reloc and post-reloc, each time turning on the regulators. We need a way to control that, don't we?
I would assume that if those regulators are turned on once in the earliest stage , turning them on again in the follow up stage would be a noop ? This is the point of regulator-*-on, to keep the regulators on.
No, there is sometimes a particular sequence needed.
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 3 lines
Should we have a step in the init sequence where we set up the regulators, by calling
regulators_enable_boot_on()?Let's not do this , the entire point of this series is to get rid of those functions and do the regulator configuration the same way LED subsystem does it -- by probing always-on/boot-on regulators and configuring them correctly on probe.
To me
regulators_enable_boot_on()and the like was always an inconsistently applied workaround for missingDM_FLAG_PROBE_AFTER_BIND, which is now implemented, so such workarounds can be removed.Quoted 5 lines
Quoted 2 lines
That patch seemed to slip under the radar, sent and applied on the same day! We really need to add a test for it, BTW.
Which patch ? My recollection of
DM_FLAG_PROBE_AFTER_BINDwas that it took a while to get in.[1]
Quoted 11 lines
Quoted 11 lines
My concern is that this might cause us ordering problems. We perhaps want the regulators to be done first. If drivers are probed which use regulators, then presumably they will enable them. Consider this:
- LED driver auto-probes
- probes I2C bus 2
- probes LDO1 which is autoset so turns on
- LDO1 probes, but is already running
- LDO2 probes, which is autoset so turns onQuoted 6 lines
Quoted 3 lines
So long as it is OK to enable the regulators in any order, then this seems fine. But is it? How do we handle the case where are particular sequence is needed?
Did we finally arrive at the point where we need -EPROBE_DEFER alike mechanism ?
Quoted 8 lines
Nope. But I am concerned that this patch is leading us there.
bind()really needs to be as clean as possible. It is one of the design elements of driver model which Linux should adopt.There is always a race to be the first to init something, move the init earlier, etc... I don't see any general need to init the regulators right at the start. It should be done in a separate function and be optional. I am happy to send a patch if you like.
Since we're currently stuck on the point where Marek has patches that fix a real problem, and Svyatoslav has a problem with them, but isn't currently able to debug it, yes, please put forward your patch that might address both sets of problems so we can all figure out how to resolve the problems, thanks!
Quoted 7 lines
Quoted 3 lines
With patches from Marek there is no i2c chip probe of PMIC, while without i2c chip probe is called (
probe_chipfunction). How this is even possible?Yes, it's very puzzling. Do you have the ability to get some debug console type information out so you can sprinkle in some prints and figure it out?
So, here's my plan. Marek posted
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
which is a work-around, so that v2024.10 can work. I'm going to take that for master tomorrow. I'm also going to take _this_ series to -next tomorrow, as this is the best approach we currently have to solving the overall problem. The Tegra platforms that are now very oddly broken need to get debugged to see where their problem is, and if there's an entirely alternate approach, Simon can post patches for that instead on top of next.
Quoted 2 lines
--
Tom
Hello there!
I was digging this when I had some free time and found that with patches from Marek the only difference is that function i2c_get_chip_for_busnum is not called for PMIC's main i2c address which results in issues with i2c you have seen in logs before. I assume this is not a tegra specific issue and not even related to these regulator patches itself.
To verify my suspicions, Tom and Marek my you please dump u-boot log with and without patches and with enabled debug logging from i2c-uclass and i2c driver of your SoC.
Here are logs from my device (Tegra SoC)
Not working
(bootloader) i2c: controller bus 0 at 7000d000, speed 0:i2c_init_controller: speed=400000
(bootloader) i2c_init_controller: CLK_DIV_STD_FAST_MODE setting = 25 (bootloader) i2c_get_chip: Searching bus 'i2c@7000d000' for address 59:
(bootloader) not found
(bootloader) pmic_reg_read: reg=37 priv->trans_len:1i2c_xfer: 2 messages (bootloader)
(bootloader) i2c_xfer: chip=0x58, len=0x1
(bootloader) i2c_write_data: chip=0x58, len=0x1
(bootloader) write_data: 0x37
(bootloader) pkt header 1 sent (0x10010)
(bootloader) pkt header 2 sent (0x0)
(bootloader) pkt header 3 sent (0x100b0)
(bootloader) pkt data sent (0x37)
(bootloader) tegra_i2c_write_data: Error (-1) !!!
Working
(bootloader) i2c: controller bus 0 at 7000d000, speed 0:i2c_init_controller: speed=400000
(bootloader) i2c_init_controller: CLK_DIV_STD_FAST_MODE setting = 25 (bootloader) pkt header 1 sent (0x10010)
(bootloader) pkt header 2 sent (0x0)
(bootloader) pkt header 3 sent (0xb0)
(bootloader) pkt data sent (0x0)
(bootloader) i2c_get_chip: Searching bus 'i2c@7000d000' for address 58:
(bootloader) i2c_get_chip: Searching bus 'i2c@7000d000' for address 59:
(bootloader) not found
(bootloader) found, ret=0
(bootloader) i2c_xfer: 2 messages
(bootloader) i2c_xfer: chip=0x58, len=0x1
(bootloader) i2c_write_data: chip=0x58, len=0x1
(bootloader) write_data: 0xfb
(bootloader) pkt header 1 sent (0x10010)
(bootloader) pkt header 2 sent (0x0)
(bootloader) pkt header 3 sent (0x100b0)
(bootloader) pkt data sent (0xfb)
(bootloader) i2c_xfer: chip=0x58, len=0x1
As you can see this part
(bootloader) pkt header 1 sent (0x10010)
(bootloader) pkt header 2 sent (0x0)
(bootloader) pkt header 3 sent (0xb0)
(bootloader) pkt data sent (0x0)
(bootloader) i2c_get_chip: Searching bus 'i2c@7000d000' for address 58:
is missing in log from u-boot where Marek's patches are applied and this log fragment co-responds to i2c_get_chip_for_busnum call
On 9/25/24 12:18 PM, Svyatoslav Ryhel wrote:
[...]
Quoted 4 lines
Hello there!
I was digging this when I had some free time and found that with patches from Marek the only difference is that functioni2c_get_chip_for_busnumis not called for PMIC's main i2c address
Is it possible this is called earlier, before UART output is initialized, so it does not show up in the log below ?
Could it be that it is called before your pinmux is properly initialized, hence no UART, and that is why the I2C communication fails?
So far, I only found Toradex Tegra T20 board here, no T30.
ср, 25 вер. 2024 р. о 15:48 Marek Vasut <[email protected]> пише:
Quoted 13 lines · Svyatoslav Ryhel
[...]
Quoted 4 lines
Hello there!
I was digging this when I had some free time and found that with patches from Marek the only difference is that functioni2c_get_chip_for_busnumis not called for PMIC's main i2c addressIs it possible this is called earlier, before UART output is initialized, so it does not show up in the log below ?
It is highly unlikely, this function is called when uart is already working and pinmux is set.
Quoted 3 lines
Could it be that it is called before your pinmux is properly initialized, hence no UART, and that is why the I2C communication fails?
But if we assume that pinmux is not set, then how we resolve situation when pinmux and regulator enable are both set by probe after bind and regulators are probed before pinmux. Regulators will fail, they will not deffer till pinmux probes. Or you propose return to pre-DM version of pinmux? Inconsistency.
Quoted 1 line
So far, I only found Toradex Tegra T20 board here, no T30.
What do you mean? Specify please
Quoted 11 lines · Svyatoslav Ryhel
ср, 25 вер. 2024 р. о 15:48 Marek Vasut <[email protected]> пише:
Quoted 10 lines · Svyatoslav Ryhel
[...]
Quoted 4 lines
Hello there!
I was digging this when I had some free time and found that with patches from Marek the only difference is that functioni2c_get_chip_for_busnumis not called for PMIC's main i2c address
Quoted 5 lines
Quoted 3 lines
Is it possible this is called earlier, before UART output is initialized, so it does not show up in the log below ?
It is highly unlikely, this function is called when uart is already working and pinmux is set.
It could be called earlier now, try to enable CONFIG_BOOTSTAGE and add BOOTSTAGE_MARKER() to points of interest (like the I2C functions). You should be able to see whether that function was called in 'bootstage' command output, even if UART wasn't active at that point yet.
Quoted 8 lines
Quoted 3 lines
Could it be that it is called before your pinmux is properly initialized, hence no UART, and that is why the I2C communication fails?
But if we assume that pinmux is not set, then how we resolve situation when pinmux and regulator enable are both set by probe after bind and regulators are probed before pinmux. Regulators will fail, they will not deffer till pinmux probes. Or you propose return to pre-DM version of pinmux? Inconsistency.
I am not going to guess what the problem is, currently it is unclear. Once we know what the problem is, we can determine the best solution.
Quoted 2 lines
Quoted 1 line
So far, I only found Toradex Tegra T20 board here, no T30.
What do you mean? Specify please
I have Toradex Tegra T20 SoM and board here, probably not useful.
Quoted 7 lines · Svyatoslav Ryhel
Hello there!
I was digging this when I had some free time and found that with patches from Marek the only difference is that functioni2c_get_chip_for_busnumis not called for PMIC's main i2c address which results in issues with i2c you have seen in logs before. I assume this is not a tegra specific issue and not even related to these regulator patches itself.
The i2c_get_chip_for_busnum call is typically protected by CONFIG_IS_ENABLED(DM_I2C), do you have DM_I2C and SPL_DM_I2C enabled?
grep DM_I2C .config
Quoted 6 lines
To verify my suspicions, Tom and Marek my you please dump u-boot log with and without patches and with enabled debug logging from i2c-uclass and i2c driver of your SoC.
Here are logs from my device (Tegra SoC)
What board target / defconfig is used? Would like to understand what bootph- props are used in the built control fdt.
Quoted 17 lines
Not working
(bootloader) i2c: controller bus 0 at7000d000, speed 0:i2c_init_controller: speed=400000
(bootloader)i2c_init_controller:CLK_DIV_STD_FAST_MODEsetting = 25 (bootloader)i2c_get_chip: Searching bus 'i2c@7000d000' for address 59:
(bootloader) not found
(bootloader)pmic_reg_read: reg=37 priv->trans_len:1i2c_xfer: 2 messages (bootloader)
(bootloader)i2c_xfer: chip=0x58, len=0x1
(bootloader)i2c_write_data: chip=0x58, len=0x1
(bootloader)write_data:0x37
(bootloader) pkt header 1 sent (0x10010)
(bootloader) pkt header 2 sent (0x0)
(bootloader) pkt header 3 sent (0x100b0)
(bootloader) pkt data sent (0x37)
(bootloader)tegra_i2c_write_data: Error (-1) !!!
Is this at SPL, U-Boot pre-reloc or after relocation? A more complete boot log may help us understand when this happens.
Quoted 14 lines
Working
(bootloader) i2c: controller bus 0 at7000d000, speed 0:i2c_init_controller: speed=400000
(bootloader)i2c_init_controller:CLK_DIV_STD_FAST_MODEsetting = 25 (bootloader) pkt header 1 sent (0x10010)
(bootloader) pkt header 2 sent (0x0)
(bootloader) pkt header 3 sent (0xb0)
(bootloader) pkt data sent (0x0)
(bootloader)i2c_get_chip: Searching bus 'i2c@7000d000' for address 58:
(bootloader)i2c_get_chip: Searching bus 'i2c@7000d000' for address 59:
(bootloader) not found
(bootloader) found, ret=0
(bootloader)i2c_xfer: 2 messages
Quoted 8 lines
(bootloader)
i2c_xfer: chip=0x58, len=0x1
(bootloader)i2c_write_data: chip=0x58, len=0x1
(bootloader)write_data:0xfb
(bootloader) pkt header 1 sent (0x10010)
(bootloader) pkt header 2 sent (0x0)
(bootloader) pkt header 3 sent (0x100b0)
(bootloader) pkt data sent (0xfb)
(bootloader)i2c_xfer: chip=0x58, len=0x1
Is the working scenario happening at same call site as not working?
Try with #define LOG_DEBUG in lib/initcall.c and compare/include a longer part of the boot log.
Regards,
Jonas
Quoted 11 lines
As you can see this part
(bootloader) pkt header 1 sent (
0x10010)
(bootloader) pkt header 2 sent (0x0)
(bootloader) pkt header 3 sent (0xb0)
(bootloader) pkt data sent (0x0)
(bootloader)i2c_get_chip: Searching bus 'i2c@7000d000' for address 58:is missing in log from u-boot where Marek's patches are applied and this log fragment co-responds to
i2c_get_chip_for_busnumcall
Hi,
Quoted 109 lines · Tom Rini
Quoted 107 lines · Svyatoslav Ryhel
пн, 16 вер. 2024 р. о 19:28 Tom Rini <[email protected]> пише:
Quoted 105 lines · Simon Glass
Quoted 89 lines
Hi Marek,
Quoted 37 lines · Marek Vasut
Quoted 1 line · Simon Glass
Hi Marek,
Hi,
[...]
Quoted 29 lines
Quoted 17 lines
Quoted 8 lines
Quoted 8 lines
(quoted diff) +0
-2@@ -473,8 +483,6 @@ static int regulator_pre_probe(struct udevice *dev) -ENODATA); uc_pdata->max_uA = dev_read_u32_default(dev, "regulator-max-microamp", -ENODATA); - uc_pdata->always_on = dev_read_bool(dev, "regulator-always-on"); - uc_pdata->boot_on = dev_read_bool(dev, "regulator-boot-on"); uc_pdata->ramp_delay = dev_read_u32_default(dev, "regulator-ramp-delay", 0);Quoted 8 lines
Quoted 4 lines
(quoted diff) +0
-1uc_pdata->force_off = dev_read_bool(dev, "regulator-force-boot-off"); --2.43.0
This is reading a lot of DT stuff very early, which may be slow. It is also reading from the DT in the
bind()step which we sometimes have to do, but try to avoid.Quoted 2 lines
Actually, it is reading only the bare minimum very early in bind, the always-on and boot-on, the rest is in
pre_probe, i.e. later.Yes, I see that. Also it is inevitable that these properties need to be read before
probe(), since they control whether toprobe().Quoted 5 lines
Quoted 3 lines
Also this seems to happen in SPL and again pre-reloc and again in U-Boot post-reloc?
What does, the uclass
post_bind?Quoted 7 lines
Quoted 3 lines
I mean that this code will be called in SPL (if the regulators are in the DT there), U-Boot pre-reloc and post-reloc, each time turning on the regulators. We need a way to control that, don't we?
I would assume that if those regulators are turned on once in the earliest stage , turning them on again in the follow up stage would be a noop ? This is the point of regulator-*-on, to keep the regulators on.
No, there is sometimes a particular sequence needed.
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 3 lines
Should we have a step in the init sequence where we set up the regulators, by calling
regulators_enable_boot_on()?Let's not do this , the entire point of this series is to get rid of those functions and do the regulator configuration the same way LED subsystem does it -- by probing always-on/boot-on regulators and configuring them correctly on probe.
To me
regulators_enable_boot_on()and the like was always an inconsistently applied workaround for missingDM_FLAG_PROBE_AFTER_BIND, which is now implemented, so such workarounds can be removed.Quoted 5 lines
Quoted 2 lines
That patch seemed to slip under the radar, sent and applied on the same day! We really need to add a test for it, BTW.
Which patch ? My recollection of
DM_FLAG_PROBE_AFTER_BINDwas that it took a while to get in.[1]
Quoted 11 lines
Quoted 11 lines
My concern is that this might cause us ordering problems. We perhaps want the regulators to be done first. If drivers are probed which use regulators, then presumably they will enable them. Consider this:
- LED driver auto-probes
- probes I2C bus 2
- probes LDO1 which is autoset so turns on
- LDO1 probes, but is already running
- LDO2 probes, which is autoset so turns onQuoted 6 lines
Quoted 3 lines
So long as it is OK to enable the regulators in any order, then this seems fine. But is it? How do we handle the case where are particular sequence is needed?
Did we finally arrive at the point where we need -EPROBE_DEFER alike mechanism ?
Quoted 8 lines
Nope. But I am concerned that this patch is leading us there.
bind()really needs to be as clean as possible. It is one of the design elements of driver model which Linux should adopt.There is always a race to be the first to init something, move the init earlier, etc... I don't see any general need to init the regulators right at the start. It should be done in a separate function and be optional. I am happy to send a patch if you like.
Since we're currently stuck on the point where Marek has patches that fix a real problem, and Svyatoslav has a problem with them, but isn't currently able to debug it, yes, please put forward your patch that might address both sets of problems so we can all figure out how to resolve the problems, thanks!
Quoted 7 lines
Quoted 3 lines
With patches from Marek there is no i2c chip probe of PMIC, while without i2c chip probe is called (
probe_chipfunction). How this is even possible?Yes, it's very puzzling. Do you have the ability to get some debug console type information out so you can sprinkle in some prints and figure it out?
We did have a pmic maintainer for a while, but perhaps has gone quiet?
I am OK with a call to regulators_enable_boot_on(), but where should it go? Should it happen in SPL? Should it happen before relocation? How is that decided and controlled?
I actually don't like DM_FLAG_PROBE_AFTER_BIND since it makes bind == probe, something which I believe U-Boot should really try to avoid. I would even rather have an explicit call in initf_dm() - or perhaps better initr_dm()? My favourite option would be a new line in the board_r init sequence instead of power_init_board(), which predates driver model.
Regards,
Simon
Quoted 10 lines · Marek Vasut
In case a regulator DT node contains regulator-always-on or regulator-boot-on property, make sure the regulator gets correctly configured by U-Boot on start up. Unconditionally probe such regulator drivers. This is a preparatory patch for introduction of .regulator_post_probe() which would trigger the regulator configuration.
Parsing of regulator-always-on and regulator-boot-on DT property has been moved to
regulator_post_bind()as the information is required early, the rest of the DT parsing has been kept inregulator_pre_probe()to avoid slowing down the boot process.
Is there anything blocking this series from being applied ?
нд, 28 лип. 2024 р. о 19:38 Marek Vasut <[email protected]> пише:
Quoted 8 lines · Marek Vasut
Quoted 6 lines
In case a regulator DT node contains regulator-always-on or regulator-boot-on property, make sure the regulator gets correctly configured by U-Boot on start up. Unconditionally probe such regulator drivers. This is a preparatory patch for introduction of .regulator_post_probe() which would trigger the regulator configuration.
Quoted 6 lines
Quoted 4 lines
Parsing of regulator-always-on and regulator-boot-on DT property has been moved to
regulator_post_bind()as the information is required early, the rest of the DT parsing has been kept inregulator_pre_probe()to avoid slowing down the boot process.Is there anything blocking this series from being applied ?
This patchset causes PMIC regulators probe too early which results in i2c line setup failure. These patches MUST NOT be applied in this form since they will break at least 15 Tegra 3 devices which use DM PMIC, maybe more.
Quoted 14 lines · Svyatoslav Ryhel
нд, 28 лип. 2024 р. о 19:38 Marek Vasut <[email protected]> пише:
Quoted 13 lines · Marek Vasut
Quoted 10 lines
In case a regulator DT node contains regulator-always-on or regulator-boot-on property, make sure the regulator gets correctly configured by U-Boot on start up. Unconditionally probe such regulator drivers. This is a preparatory patch for introduction of .regulator_post_probe() which would trigger the regulator configuration.
Parsing of regulator-always-on and regulator-boot-on DT property has been moved to
regulator_post_bind()as the information is required early, the rest of the DT parsing has been kept inregulator_pre_probe()to avoid slowing down the boot process.
Quoted 6 lines
Quoted 1 line
Is there anything blocking this series from being applied ?
This patchset causes PMIC regulators probe too early which results in i2c line setup failure. These patches MUST NOT be applied in this form since they will break at least 15 Tegra 3 devices which use DM PMIC, maybe more.
Thank you for testing. I do not have any tegra 3 devices, but this patchset does not do anything with pinmuxing. If a regulator is probed, all of its dependencies (i2c bus, pinmux configuration, etc.) should be probed as well. Can you have a look at what the problem with pinmuxing is on tegra 3? It seems it might be unrelated to this patchset and would eventually show up elsewhere?
28 липня 2024 р. 21:35:27 GMT+03:00, Marek Vasut <[email protected]> написав(-ла):
Quoted 15 lines · Svyatoslav Ryhel
Quoted 14 lines
нд, 28 лип. 2024 р. о 19:38 Marek Vasut <[email protected]> пише:
Quoted 13 lines · Marek Vasut
Quoted 10 lines
In case a regulator DT node contains regulator-always-on or regulator-boot-on property, make sure the regulator gets correctly configured by U-Boot on start up. Unconditionally probe such regulator drivers. This is a preparatory patch for introduction of .regulator_post_probe() which would trigger the regulator configuration.
Parsing of regulator-always-on and regulator-boot-on DT property has been moved to
regulator_post_bind()as the information is required early, the rest of the DT parsing has been kept inregulator_pre_probe()to avoid slowing down the boot process.
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
Is there anything blocking this series from being applied ?
This patchset causes PMIC regulators probe too early which results in i2c line setup failure. These patches MUST NOT be applied in this form since they will break at least 15 Tegra 3 devices which use DM PMIC, maybe more.
Thank you for testing. I do not have any tegra 3 devices, but this patchset does not do anything with pinmuxing. If a regulator is probed, all of its dependencies (i2c bus, pinmux configuration, etc.) should be probed as well. Can you have a look at what the problem with pinmuxing is on tegra 3? It seems it might be unrelated to this patchset and would eventually show up elsewhere?
Pinmux? Wdym, I wrote about a PMIC which is usually located on i2c line.
<https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/>
This is a similar patch.
You may be able to reproduce the issue I face if you have a device which uses SPL and has DM PMIC with regulators that need always-on/boot-on properties.
On 7/28/24 9:02 PM, Svyatoslav wrote:
Hi,
I'm trimming the CC because I keep getting ML blockage due to large CC list. If someone has been removed too hastily, sorry.
Quoted 25 lines
28 липня 2024 р. 21:35:27 GMT+03:00, Marek Vasut <[email protected]> написав(-ла):
Quoted 15 lines · Svyatoslav Ryhel
Quoted 14 lines
нд, 28 лип. 2024 р. о 19:38 Marek Vasut <[email protected]> пише:
Quoted 13 lines · Marek Vasut
Quoted 10 lines
In case a regulator DT node contains regulator-always-on or regulator-boot-on property, make sure the regulator gets correctly configured by U-Boot on start up. Unconditionally probe such regulator drivers. This is a preparatory patch for introduction of .regulator_post_probe() which would trigger the regulator configuration.
Parsing of regulator-always-on and regulator-boot-on DT property has been moved to
regulator_post_bind()as the information is required early, the rest of the DT parsing has been kept inregulator_pre_probe()to avoid slowing down the boot process.Quoted 8 lines
Quoted 6 lines
Quoted 1 line
Is there anything blocking this series from being applied ?
This patchset causes PMIC regulators probe too early which results in i2c line setup failure. These patches MUST NOT be applied in this form since they will break at least 15 Tegra 3 devices which use DM PMIC, maybe more.
Thank you for testing. I do not have any tegra 3 devices, but this patchset does not do anything with pinmuxing. If a regulator is probed, all of its dependencies (i2c bus, pinmux configuration, etc.) should be probed as well. Can you have a look at what the problem with pinmuxing is on tegra 3? It seems it might be unrelated to this patchset and would eventually show up elsewhere?
Quoted 7 lines
Pinmux? Wdym, I wrote about a PMIC which is usually located on i2c line.
<https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/>
This is a similar patch.
You may be able to reproduce the issue I face if you have a device which uses SPL and has DM PMIC with regulators that need always-on/boot-on properties.
I actually do use:
configs/imx8mp_dhcom_pdk3_defconfig:CONFIG_DM_PMIC=y configs/imx8mp_dhcom_pdk3_defconfig:CONFIG_DM_PMIC_PCA9450=y configs/imx8mp_dhcom_pdk3_defconfig:CONFIG_SPL_DM_PMIC_PCA9450=y
which is one of the devices I test this on.
The PMIC is on I2C, DM_PMIC enabled in SPL, both buck4 and buck5 regulators are enabled in SPL, have regulator-always-on and regulator-boot-on and bootph-pre-ram properties.
This seems similar enough, right ?
What is the problem you observe on tegra 3 ?
нд, 28 лип. 2024 р. о 23:08 Marek Vasut <[email protected]> пише:
Quoted 47 lines · Svyatoslav
Hi,
I'm trimming the CC because I keep getting ML blockage due to large CC list. If someone has been removed too hastily, sorry.
Quoted 25 lines
28 липня 2024 р. 21:35:27 GMT+03:00, Marek Vasut <[email protected]> написав(-ла):
Quoted 15 lines · Svyatoslav Ryhel
Quoted 14 lines
нд, 28 лип. 2024 р. о 19:38 Marek Vasut <[email protected]> пише:
Quoted 13 lines · Marek Vasut
Quoted 10 lines
In case a regulator DT node contains regulator-always-on or regulator-boot-on property, make sure the regulator gets correctly configured by U-Boot on start up. Unconditionally probe such regulator drivers. This is a preparatory patch for introduction of .regulator_post_probe() which would trigger the regulator configuration.
Parsing of regulator-always-on and regulator-boot-on DT property has been moved to
regulator_post_bind()as the information is required early, the rest of the DT parsing has been kept inregulator_pre_probe()to avoid slowing down the boot process.Quoted 8 lines
Quoted 6 lines
Quoted 1 line
Is there anything blocking this series from being applied ?
This patchset causes PMIC regulators probe too early which results in i2c line setup failure. These patches MUST NOT be applied in this form since they will break at least 15 Tegra 3 devices which use DM PMIC, maybe more.
Thank you for testing. I do not have any tegra 3 devices, but this patchset does not do anything with pinmuxing. If a regulator is probed, all of its dependencies (i2c bus, pinmux configuration, etc.) should be probed as well. Can you have a look at what the problem with pinmuxing is on tegra 3? It seems it might be unrelated to this patchset and would eventually show up elsewhere?
Quoted 7 lines
Pinmux? Wdym, I wrote about a PMIC which is usually located on i2c line.
<https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/>
This is a similar patch.
You may be able to reproduce the issue I face if you have a device which uses SPL and has DM PMIC with regulators that need always-on/boot-on properties.
I actually do use:
configs/imx8mp_dhcom_pdk3_defconfig:CONFIG_DM_PMIC=y configs/imx8mp_dhcom_pdk3_defconfig:CONFIG_DM_PMIC_PCA9450=y configs/imx8mp_dhcom_pdk3_defconfig:CONFIG_SPL_DM_PMIC_PCA9450=y
Quoted 8 lines
which is one of the devices I test this on.
The PMIC is on I2C,
DM_PMICenabled in SPL, both buck4 and buck5 regulators are enabled in SPL, have regulator-always-on and regulator-boot-on and bootph-pre-ram properties.This seems similar enough, right ?
Yes, though SPL must remain as small as possible and you propose add there i2c driver, PMIC driver, PMIC regulator drivers, PMIC GPIO drivers along with relocation of all this stuff. It is not optimal at all.
Quoted 1 line
What is the problem you observe on tegra 3 ?
i2c line fails since it probes in spl with your patch, but it does not relocate and then probes once more after relocation. Probe fails along with all devices on same line.
Even withCONFIG_SPL_I2C=yCONFIG_SPL_PMIC_PALMAS=y CONFIG_SPL_DM_REGULATOR_PALMAS=y CONFIG_SPL_PALMAS_GPIO=y
and all bootph-pre-ram; set I still get i2c failure
Here is log
(bootloader) read error from device: bd26f8e0 register: 0x37! (bootloader) read error from device: bd26f8e0 register: 0x3b! (bootloader) read error from device: bd26f8e0 register: 0x61! (bootloader) read error from device: bd26f8e0 register: 0x65! (bootloader) Core: 177 devices, 27 uclasses, devicetree: separate
(bootloader) MMC: sdhci@78000400: 1, sdhci@78000600: 0
(bootloader) Loading Environment from MMC... Reading from MMC(0)... *** (bootloader) Warning - bad CRC, using default environment (bootloader)
(bootloader) read error from device: bd26f8e0 register: 0x53! (bootloader) read error from device: bd26f8e0 register: 0x2f! (bootloader) tegra_dsi_bridge_probe: Cannot get panel: error -5 (bootloader) tegra_dsi_bridge_probe: Cannot get panel: error -114
(bootloader) In: serial,usbkbd,button-kbd (bootloader) Out: serial,vidconsole (bootloader) Err: serial,vidconsole (bootloader) Net: No ethernet found.
On 7/29/24 7:38 AM, Svyatoslav Ryhel wrote:
[...]
Quoted 10 lines
Quoted 6 lines
The PMIC is on I2C,
DM_PMICenabled in SPL, both buck4 and buck5 regulators are enabled in SPL, have regulator-always-on and regulator-boot-on and bootph-pre-ram properties.This seems similar enough, right ?
Yes, though SPL must remain as small as possible and you propose add there i2c driver, PMIC driver, PMIC regulator drivers, PMIC GPIO drivers along with relocation of all this stuff. It is not optimal at all.
Sure, if you do use DM_PMIC for PMIC on I2C bus, then you also need DM_I2C . You can also do non-DM PMIC configuration in SPL, non-DM in SPL is allowed.
Quoted 4 lines
Quoted 1 line
What is the problem you observe on tegra 3 ?
i2c line fails since it probes in spl with your patch, but it does not relocate and then probes once more after relocation. Probe fails along with all devices on same line.
Could it be that you either have to:
- Add DM_I2C to tegra 3 SPL
- Remove bootph-* from DT to remove the regulator node from SPL
- /delete-property/ regulator-always-on; and /delete-property/ regulator-boot-on; in -u-boot.dtsi to prevent the regulator from being enabled in SPL ?
regulator-always-on means the regulator has to be enabled unconditionally, and the system software has no other way to test whether the regulator is enabled but access the PMIC, so that is why the regulator is probed, even if it is early.
пн, 29 лип. 2024 р. о 13:42 Marek Vasut <[email protected]> пише:
Quoted 11 lines · Svyatoslav Ryhel
[...]
Quoted 6 lines
Quoted 6 lines
The PMIC is on I2C,
DM_PMICenabled in SPL, both buck4 and buck5 regulators are enabled in SPL, have regulator-always-on and regulator-boot-on and bootph-pre-ram properties.This seems similar enough, right ?
Quoted 9 lines
Quoted 4 lines
Yes, though SPL must remain as small as possible and you propose add there i2c driver, PMIC driver, PMIC regulator drivers, PMIC GPIO drivers along with relocation of all this stuff. It is not optimal at all.
Sure, if you do use
DM_PMICfor PMIC on I2C bus, then you also needDM_I2C. You can also do non-DM PMIC configuration in SPL, non-DM in SPL is allowed.
Thanks for explaining an obvious stuff, it seems that we are talking on different languages.
Quoted 5 lines
Quoted 4 lines
Quoted 1 line
What is the problem you observe on tegra 3 ?
i2c line fails since it probes in spl with your patch, but it does not relocate and then probes once more after relocation. Probe fails along with all devices on same line.
Quoted 7 lines
Could it be that you either have to:
- AddDM_I2Cto tegra 3 SPL
- Remove bootph-* from DT to remove the regulator node from SPL
- /delete-property/ regulator-always-on; and /delete-property/ regulator-boot-on; in-u-boot.dtsito prevent the regulator from being enabled in SPL ?
Obviously NO, you propose nonsense. Same dts is used for both stages. And I have to add hack-ish stuff just because you wanna introduce code which causes known regressions.
Quoted 4 lines
regulator-always-on means the regulator has to be enabled unconditionally, and the system software has no other way to test whether the regulator is enabled but access the PMIC, so that is why the regulator is probed, even if it is early.
Thanks for explaining an obvious stuff, it seems that we are talking on different languages.
Anyway,
"We must not probe things as we go. There might be other dependencies not yet bound. It may also take some time. This is not following driver model design, sorry.
So please think of a way to do this properly."
On 7/29/24 1:55 PM, Svyatoslav Ryhel wrote:
[...]
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 1 line
What is the problem you observe on tegra 3 ?
i2c line fails since it probes in spl with your patch, but it does not relocate and then probes once more after relocation. Probe fails along with all devices on same line.
Quoted 8 lines
Quoted 7 lines
Could it be that you either have to:
- AddDM_I2Cto tegra 3 SPL
- Remove bootph-* from DT to remove the regulator node from SPL
- /delete-property/ regulator-always-on; and /delete-property/ regulator-boot-on; in-u-boot.dtsito prevent the regulator from being enabled in SPL ?Obviously NO, you propose nonsense. Same dts is used for both stages.
DT source yes, DT blob likely no.
Quoted 2 lines
And I have to add hack-ish stuff just because you wanna introduce code which causes known regressions.
I am trying to understand what problem there is on tegra 3, but it is still not clear to me.
Is the problem somehow related to PMICs (?) being probed in SPL (?) because they have regulators (?) which are marked as regulator-always-on ? If so, then this is correct behavior, and if this is not desired in SPL, then you can remove this property from SPL DT in -u-boot.dtsi using /delete-property/ .
[...]
Quoted 5 lines
"We must not probe things as we go. There might be other dependencies not yet bound. It may also take some time. This is not following driver model design, sorry.
So please think of a way to do this properly."
What is this quote about ? Where is this from ?
Quoted 29 lines · Marek Vasut
On 7/29/24 1:55 PM, Svyatoslav Ryhel wrote:
[...]
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 1 line
What is the problem you observe on tegra 3 ?
i2c line fails since it probes in spl with your patch, but it does not relocate and then probes once more after relocation. Probe fails along with all devices on same line.
Quoted 8 lines
Quoted 7 lines
Could it be that you either have to:
- AddDM_I2Cto tegra 3 SPL
- Remove bootph-* from DT to remove the regulator node from SPL
- /delete-property/ regulator-always-on; and /delete-property/ regulator-boot-on; in-u-boot.dtsito prevent the regulator from being enabled in SPL ?Obviously NO, you propose nonsense. Same dts is used for both stages.
DT source yes, DT blob likely no.
Quoted 2 lines
And I have to add hack-ish stuff just because you wanna introduce code which causes known regressions.
I am trying to understand what problem there is on tegra 3, but it is still not clear to me.
Is the problem somehow related to PMICs (?) being probed in SPL (?) because they have regulators (?) which are marked as regulator-always-on ? If so, then this is correct behavior, and if this is not desired in SPL, then you can remove this property from SPL DT in
-u-boot.dtsiusing /delete-property/ .[...]
Quoted 7 lines
Quoted 5 lines
"We must not probe things as we go. There might be other dependencies not yet bound. It may also take some time. This is not following driver model design, sorry.
So please think of a way to do this properly."
What is this quote about ? Where is this from ?
What is the problem with Tegra 3 and this patchset ?
Can you please explain that so this patchset can move forward ?
Thank you
пн, 19 серп. 2024 р. о 20:27 Marek Vasut <[email protected]> пише:
Quoted 40 lines · Marek Vasut
Quoted 38 lines · Svyatoslav Ryhel
[...]
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 1 line
What is the problem you observe on tegra 3 ?
i2c line fails since it probes in spl with your patch, but it does not relocate and then probes once more after relocation. Probe fails along with all devices on same line.
Quoted 8 lines
Quoted 7 lines
Could it be that you either have to:
- AddDM_I2Cto tegra 3 SPL
- Remove bootph-* from DT to remove the regulator node from SPL
- /delete-property/ regulator-always-on; and /delete-property/ regulator-boot-on; in-u-boot.dtsito prevent the regulator from being enabled in SPL ?Obviously NO, you propose nonsense. Same dts is used for both stages.
DT source yes, DT blob likely no.
Quoted 2 lines
And I have to add hack-ish stuff just because you wanna introduce code which causes known regressions.
I am trying to understand what problem there is on tegra 3, but it is still not clear to me.
Is the problem somehow related to PMICs (?) being probed in SPL (?) because they have regulators (?) which are marked as regulator-always-on ? If so, then this is correct behavior, and if this is not desired in SPL, then you can remove this property from SPL DT in
-u-boot.dtsiusing /delete-property/ .[...]
Quoted 4 lines
"We must not probe things as we go. There might be other dependencies not yet bound. It may also take some time. This is not following driver model design, sorry.
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
So please think of a way to do this properly."
What is this quote about ? Where is this from ?
What is the problem with Tegra 3 and this patchset ?
Can you please explain that so this patchset can move forward ?
with your changes
U-Boot 2024.07-00696-ge217e2769db9-dirty (Aug 20 2024 - 09:55:29 +0300)
SoC: tegra114 Model: NVIDIA Tegra Note 7 Board: NVIDIA TegraTab DRAM: 1 GiB tegra_i2c_probe: called i2c: controller bus 0 at 7000d000, speed 0: tegra_i2c_probe: exit i2c_init_controller: speed=400000 i2c_init_controller: CLK_DIV_STD_FAST_MODE setting = 25 i2c_xfer: 2 messages i2c_xfer: chip=0x58, len=0x1 i2c_write_data: chip=0x58, len=0x1 write_data: 0x37
pkt header 1 sent (0x10010)
pkt header 2 sent (0x0)
pkt header 3 sent (0x100b0)
pkt data sent (0x37)tegra_i2c_write_data: Error (-1) !!!i2c_write_data(): rc=-1i2c_write: error sending
read error from device: bd26f8e0 register: 0x37!i2c_xfer: 2 messagesi2c_xfer: chip=0x58, len=0x1i2c_write_data: chip=0x58, len=0x1write_data: 0x3b
pkt header 1 sent (0x10010)
pkt header 2 sent (0x0)
pkt header 3 sent (0x100b0)
pkt data sent (0x3b)tegra_i2c_write_data: Error (-1) !!!i2c_write_data(): rc=-1i2c_write: error sending
read error from device: bd26f8e0 register: 0x3b!i2c_xfer: 2 messagesi2c_xfer: chip=0x58, len=0x1i2c_write_data: chip=0x58, len=0x1write_data: 0x61
pkt header 1 sent (0x10010)
pkt header 2 sent (0x0)
pkt header 3 sent (0x100b0)
pkt data sent (0x61)tegra_i2c_write_data: Error (-1) !!!i2c_write_data(): rc=-1i2c_write: error sending
read error from device: bd26f8e0 register: 0x61!i2c_xfer: 2 messagesi2c_xfer: chip=0x58, len=0x1i2c_write_data: chip=0x58, len=0x1i2c_xfer: chip=0x58, len=0x1i2c_write_data: chip=0x58, len=0x1write_data: 0x65
pkt header 1 sent (0x10010)
pkt header 2 sent (0x0)
pkt header 3 sent (0x100b0)
pkt data sent (0x65)tegra_i2c_write_data: Error (-1) !!!i2c_write_data(): rc=-1i2c_write: error sending
read error from device: bd26f8e0 register: 0x65!
pkt header 1 sent (0x10010)
pkt header 2 sent (0x0)
pkt header 3 sent (0xb0)
pkt data sent (0xbd)tegra_i2c_write_data: Error (-1) !!!
without your changes
U-Boot 2024.07-00696-g45c25f82f356-dirty (Aug 20 2024 - 09:58:40 +0300)
SoC: tegra114
Model: NVIDIA Tegra Note 7
Board: NVIDIA TegraTab
DRAM: 1 GiBtegra_i2c_probe: called
i2c: controller bus 0 at 7000d000, speed 0: tegra_i2c_probe: exiti2c_init_controller: speed=400000i2c_init_controller: CLK_DIV_STD_FAST_MODE setting = 25 pkt header 1 sent (0x10010)
pkt header 2 sent (0x0)
pkt header 3 sent (0xb0)
pkt data sent (0x0)i2c_xfer: 2 messagesi2c_xfer: chip=0x58, len=0x1i2c_write_data: chip=0x58, len=0x1write_data: 0xfb
pkt header 1 sent (0x10010)
pkt header 2 sent (0x0)
pkt header 3 sent (0x100b0)
pkt data sent (0xfb)i2c_xfer: chip=0x58, len=0x1
inside i2c_read_data():
pkt header 1 sent (0x10010)
pkt header 2 sent (0x0)
pkt header 3 sent (0x800b1)
pkt data received (0x2)
i2c_read_data: 0x02 i2c_xfer: 1 messages i2c_xfer: chip=0x58, len=0x2 i2c_write_data: chip=0x58, len=0x2 write_data: 0xfb 0x02
pkt header 1 sent (0x10010)
pkt header 2 sent (0x1)
pkt header 3 sent (0xb0)
pkt data sent (0x2fb)i2c_xfer: 2 messagesi2c_xfer: chip=0x58, len=0x1i2c_write_data: chip=0x58, len=0x1write_data: 0xfe
pkt header 1 sent (0x10010)
pkt header 2 sent (0x0)
pkt header 3 sent (0x100b0)
pkt data sent (0xfe)i2c_xfer: chip=0x58, len=0x1
inside i2c_read_data():
pkt header 1 sent (0x10010)
i2c driver refuses to work properly
Quoted 1 line
Thank you
Quoted 66 lines · Svyatoslav Ryhel
пн, 19 серп. 2024 р. о 20:27 Marek Vasut <[email protected]> пише:
Quoted 40 lines · Marek Vasut
Quoted 38 lines · Svyatoslav Ryhel
[...]
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 1 line
What is the problem you observe on tegra 3 ?
i2c line fails since it probes in spl with your patch, but it does not relocate and then probes once more after relocation. Probe fails along with all devices on same line.
Quoted 8 lines
Quoted 7 lines
Could it be that you either have to:
- AddDM_I2Cto tegra 3 SPL
- Remove bootph-* from DT to remove the regulator node from SPL
- /delete-property/ regulator-always-on; and /delete-property/ regulator-boot-on; in-u-boot.dtsito prevent the regulator from being enabled in SPL ?Obviously NO, you propose nonsense. Same dts is used for both stages.
DT source yes, DT blob likely no.
Quoted 2 lines
And I have to add hack-ish stuff just because you wanna introduce code which causes known regressions.
I am trying to understand what problem there is on tegra 3, but it is still not clear to me.
Is the problem somehow related to PMICs (?) being probed in SPL (?) because they have regulators (?) which are marked as regulator-always-on ? If so, then this is correct behavior, and if this is not desired in SPL, then you can remove this property from SPL DT in
-u-boot.dtsiusing /delete-property/ .[...]
Quoted 4 lines
"We must not probe things as we go. There might be other dependencies not yet bound. It may also take some time. This is not following driver model design, sorry.
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
So please think of a way to do this properly."
What is this quote about ? Where is this from ?
What is the problem with Tegra 3 and this patchset ?
Can you please explain that so this patchset can move forward ?
with your changes
U-Boot 2024.07-00696-ge217e2769db9-dirty (Aug 20 2024 - 09:55:29 +0300)
SoC: tegra114 Model: NVIDIA Tegra Note 7 Board: NVIDIA TegraTab DRAM: 1 GiB tegra_i2c_probe: called i2c: controller bus 0 at 7000d000, speed 0: tegra_i2c_probe: exit i2c_init_controller: speed=400000 i2c_init_controller: CLK_DIV_STD_FAST_MODE setting = 25 i2c_xfer: 2 messages i2c_xfer: chip=0x58, len=0x1 i2c_write_data: chip=0x58, len=0x1 write_data: 0x37
Quoted 8 lines
pkt header 1 sent (
0x10010)
pkt header 2 sent (0x0)
pkt header 3 sent (0x100b0)
pkt data sent (0x37)tegra_i2c_write_data: Error (-1) !!!i2c_write_data(): rc=-1i2c_write: error sending
read error from device:bd26f8e0register:0x37!
This seems like the PMIC driver (palmas?) is trying to read register 0x37 PGOOD and the I2C transfer fails . Why does the I2C transfer fail ?
You did mention something regarding I2C/PMIC driver probe timing, but it seems the I2C driver and PMIC drivers probe roughly around the same time in both pass and fail cases ?
It seems the tegra3 DTs have most of the PMIC regulators marked as boot-on and always-on , so enabling the regulators early is the right thing to do.
[...]
Quoted 8 lines
SoC: tegra114
Model: NVIDIA Tegra Note 7
Board: NVIDIA TegraTab
DRAM: 1 GiBtegra_i2c_probe: called
i2c: controller bus 0 at7000d000, speed 0:tegra_i2c_probe: exiti2c_init_controller: speed=400000i2c_init_controller:CLK_DIV_STD_FAST_MODEsetting = 25
Quoted 8 lines
pkt header 1 sent (
0x10010)
pkt header 2 sent (0x0)
pkt header 3 sent (0xb0)
pkt data sent (0x0)i2c_xfer: 2 messagesi2c_xfer: chip=0x58, len=0x1i2c_write_data: chip=0x58, len=0x1write_data:0xfb
This seems to be access to register 0xfb , i.e. something else ?
пн, 9 вер. 2024 р. о 19:13 Marek Vasut <[email protected]> пише:
Quoted 77 lines · Svyatoslav Ryhel
Quoted 66 lines
пн, 19 серп. 2024 р. о 20:27 Marek Vasut <[email protected]> пише:
Quoted 40 lines · Marek Vasut
Quoted 38 lines · Svyatoslav Ryhel
[...]
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 1 line
What is the problem you observe on tegra 3 ?
i2c line fails since it probes in spl with your patch, but it does not relocate and then probes once more after relocation. Probe fails along with all devices on same line.
Quoted 8 lines
Quoted 7 lines
Could it be that you either have to:
- AddDM_I2Cto tegra 3 SPL
- Remove bootph-* from DT to remove the regulator node from SPL
- /delete-property/ regulator-always-on; and /delete-property/ regulator-boot-on; in-u-boot.dtsito prevent the regulator from being enabled in SPL ?Obviously NO, you propose nonsense. Same dts is used for both stages.
DT source yes, DT blob likely no.
Quoted 2 lines
And I have to add hack-ish stuff just because you wanna introduce code which causes known regressions.
I am trying to understand what problem there is on tegra 3, but it is still not clear to me.
Is the problem somehow related to PMICs (?) being probed in SPL (?) because they have regulators (?) which are marked as regulator-always-on ? If so, then this is correct behavior, and if this is not desired in SPL, then you can remove this property from SPL DT in
-u-boot.dtsiusing /delete-property/ .[...]
Quoted 4 lines
"We must not probe things as we go. There might be other dependencies not yet bound. It may also take some time. This is not following driver model design, sorry.
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
So please think of a way to do this properly."
What is this quote about ? Where is this from ?
What is the problem with Tegra 3 and this patchset ?
Can you please explain that so this patchset can move forward ?
with your changes
U-Boot 2024.07-00696-ge217e2769db9-dirty (Aug 20 2024 - 09:55:29 +0300)
SoC: tegra114 Model: NVIDIA Tegra Note 7 Board: NVIDIA TegraTab DRAM: 1 GiB tegra_i2c_probe: called i2c: controller bus 0 at 7000d000, speed 0: tegra_i2c_probe: exit i2c_init_controller: speed=400000 i2c_init_controller: CLK_DIV_STD_FAST_MODE setting = 25 i2c_xfer: 2 messages i2c_xfer: chip=0x58, len=0x1 i2c_write_data: chip=0x58, len=0x1 write_data: 0x37Quoted 8 lines
pkt header 1 sent (
0x10010)
pkt header 2 sent (0x0)
pkt header 3 sent (0x100b0)
pkt data sent (0x37)tegra_i2c_write_data: Error (-1) !!!i2c_write_data(): rc=-1i2c_write: error sending
read error from device:bd26f8e0register:0x37!
Quoted 2 lines
This seems like the PMIC driver (palmas?) is trying to read register
0x37PGOOD and the I2C transfer fails . Why does the I2C transfer fail ?
You are asking me? Because your patches break some important setup sequence. PMIC model does not matter, all behave same way.
Quoted 3 lines
You did mention something regarding I2C/PMIC driver probe timing, but it seems the I2C driver and PMIC drivers probe roughly around the same time in both pass and fail cases ?
Yes, here I agree that they both probe and probe passes, but I assume timing of i2c call is critical and there may be some dependency which is not ready.
Quoted 3 lines
It seems the tegra3 DTs have most of the PMIC regulators marked as boot-on and always-on , so enabling the regulators early is the right thing to do.
Only essentials are added, thus they are marked this way.
Quoted 20 lines
[...]
Quoted 8 lines
SoC: tegra114
Model: NVIDIA Tegra Note 7
Board: NVIDIA TegraTab
DRAM: 1 GiBtegra_i2c_probe: called
i2c: controller bus 0 at7000d000, speed 0:tegra_i2c_probe: exiti2c_init_controller: speed=400000i2c_init_controller:CLK_DIV_STD_FAST_MODEsetting = 25Quoted 8 lines
pkt header 1 sent (
0x10010)
pkt header 2 sent (0x0)
pkt header 3 sent (0xb0)
pkt data sent (0x0)i2c_xfer: 2 messagesi2c_xfer: chip=0x58, len=0x1i2c_write_data: chip=0x58, len=0x1write_data:0xfbThis seems to be access to register
0xfb, i.e. something else ?
Quoted 78 lines · Svyatoslav Ryhel
пн, 9 вер. 2024 р. о 19:13 Marek Vasut <[email protected]> пише:
Quoted 77 lines · Svyatoslav Ryhel
Quoted 74 lines
пн, 19 серп. 2024 р. о 20:27 Marek Vasut <[email protected]> пише:
Quoted 40 lines · Marek Vasut
Quoted 38 lines · Svyatoslav Ryhel
[...]
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 1 line
What is the problem you observe on tegra 3 ?
i2c line fails since it probes in spl with your patch, but it does not relocate and then probes once more after relocation. Probe fails along with all devices on same line.
Quoted 8 lines
Quoted 7 lines
Could it be that you either have to:
- AddDM_I2Cto tegra 3 SPL
- Remove bootph-* from DT to remove the regulator node from SPL
- /delete-property/ regulator-always-on; and /delete-property/ regulator-boot-on; in-u-boot.dtsito prevent the regulator from being enabled in SPL ?Obviously NO, you propose nonsense. Same dts is used for both stages.
DT source yes, DT blob likely no.
Quoted 2 lines
And I have to add hack-ish stuff just because you wanna introduce code which causes known regressions.
I am trying to understand what problem there is on tegra 3, but it is still not clear to me.
Is the problem somehow related to PMICs (?) being probed in SPL (?) because they have regulators (?) which are marked as regulator-always-on ? If so, then this is correct behavior, and if this is not desired in SPL, then you can remove this property from SPL DT in
-u-boot.dtsiusing /delete-property/ .[...]
Quoted 4 lines
"We must not probe things as we go. There might be other dependencies not yet bound. It may also take some time. This is not following driver model design, sorry.
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
So please think of a way to do this properly."
What is this quote about ? Where is this from ?
What is the problem with Tegra 3 and this patchset ?
Can you please explain that so this patchset can move forward ?
with your changes
U-Boot 2024.07-00696-ge217e2769db9-dirty (Aug 20 2024 - 09:55:29 +0300)
SoC: tegra114 Model: NVIDIA Tegra Note 7 Board: NVIDIA TegraTab DRAM: 1 GiB tegra_i2c_probe: called i2c: controller bus 0 at 7000d000, speed 0: tegra_i2c_probe: exit i2c_init_controller: speed=400000 i2c_init_controller: CLK_DIV_STD_FAST_MODE setting = 25 i2c_xfer: 2 messages i2c_xfer: chip=0x58, len=0x1 i2c_write_data: chip=0x58, len=0x1 write_data: 0x37pkt header 1 sent (
0x10010)
pkt header 2 sent (0x0)
pkt header 3 sent (0x100b0)
pkt data sent (0x37)tegra_i2c_write_data: Error (-1) !!!i2c_write_data(): rc=-1i2c_write: error sending
read error from device:bd26f8e0register:0x37!
Quoted 5 lines
Quoted 2 lines
This seems like the PMIC driver (palmas?) is trying to read register
0x37PGOOD and the I2C transfer fails . Why does the I2C transfer fail ?You are asking me? Because your patches break some important setup sequence. PMIC model does not matter, all behave same way.
These regulator patches do not modify anything related to I2C and I don't observe this kind of behavior on iMX8M or STM32 platforms, so I suspect this is something specific to tegra.
Quoted 7 lines
Quoted 3 lines
You did mention something regarding I2C/PMIC driver probe timing, but it seems the I2C driver and PMIC drivers probe roughly around the same time in both pass and fail cases ?
Yes, here I agree that they both probe and probe passes, but I assume timing of i2c call is critical and there may be some dependency which is not ready.
My guess would be pinmux or clock, maybe the i2c controller is marked as bootph-* in DT and its pinmux/clock is not? Maybe the i2c on tegra works by sheer coincidence right now? Can you have a look?
вт, 10 вер. 2024 р. о 13:18 Marek Vasut <[email protected]> пише:
Quoted 94 lines · Svyatoslav Ryhel
Quoted 78 lines
пн, 9 вер. 2024 р. о 19:13 Marek Vasut <[email protected]> пише:
Quoted 77 lines · Svyatoslav Ryhel
Quoted 74 lines
пн, 19 серп. 2024 р. о 20:27 Marek Vasut <[email protected]> пише:
Quoted 40 lines · Marek Vasut
Quoted 38 lines · Svyatoslav Ryhel
[...]
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 1 line
What is the problem you observe on tegra 3 ?
i2c line fails since it probes in spl with your patch, but it does not relocate and then probes once more after relocation. Probe fails along with all devices on same line.
Quoted 8 lines
Quoted 7 lines
Could it be that you either have to:
- AddDM_I2Cto tegra 3 SPL
- Remove bootph-* from DT to remove the regulator node from SPL
- /delete-property/ regulator-always-on; and /delete-property/ regulator-boot-on; in-u-boot.dtsito prevent the regulator from being enabled in SPL ?Obviously NO, you propose nonsense. Same dts is used for both stages.
DT source yes, DT blob likely no.
Quoted 2 lines
And I have to add hack-ish stuff just because you wanna introduce code which causes known regressions.
I am trying to understand what problem there is on tegra 3, but it is still not clear to me.
Is the problem somehow related to PMICs (?) being probed in SPL (?) because they have regulators (?) which are marked as regulator-always-on ? If so, then this is correct behavior, and if this is not desired in SPL, then you can remove this property from SPL DT in
-u-boot.dtsiusing /delete-property/ .[...]
Quoted 4 lines
"We must not probe things as we go. There might be other dependencies not yet bound. It may also take some time. This is not following driver model design, sorry.
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
So please think of a way to do this properly."
What is this quote about ? Where is this from ?
What is the problem with Tegra 3 and this patchset ?
Can you please explain that so this patchset can move forward ?
with your changes
U-Boot 2024.07-00696-ge217e2769db9-dirty (Aug 20 2024 - 09:55:29 +0300)
SoC: tegra114 Model: NVIDIA Tegra Note 7 Board: NVIDIA TegraTab DRAM: 1 GiB tegra_i2c_probe: called i2c: controller bus 0 at 7000d000, speed 0: tegra_i2c_probe: exit i2c_init_controller: speed=400000 i2c_init_controller: CLK_DIV_STD_FAST_MODE setting = 25 i2c_xfer: 2 messages i2c_xfer: chip=0x58, len=0x1 i2c_write_data: chip=0x58, len=0x1 write_data: 0x37pkt header 1 sent (
0x10010)
pkt header 2 sent (0x0)
pkt header 3 sent (0x100b0)
pkt data sent (0x37)tegra_i2c_write_data: Error (-1) !!!i2c_write_data(): rc=-1i2c_write: error sending
read error from device:bd26f8e0register:0x37!Quoted 5 lines
Quoted 2 lines
This seems like the PMIC driver (palmas?) is trying to read register
0x37PGOOD and the I2C transfer fails . Why does the I2C transfer fail ?You are asking me? Because your patches break some important setup sequence. PMIC model does not matter, all behave same way.
These regulator patches do not modify anything related to I2C and I don't observe this kind of behavior on iMX8M or STM32 platforms, so I suspect this is something specific to tegra.
Quoted 4 lines
Quoted 3 lines
You did mention something regarding I2C/PMIC driver probe timing, but it seems the I2C driver and PMIC drivers probe roughly around the same time in both pass and fail cases ?
Quoted 7 lines
Quoted 3 lines
Yes, here I agree that they both probe and probe passes, but I assume timing of i2c call is critical and there may be some dependency which is not ready.
My guess would be pinmux or clock, maybe the i2c controller is marked as bootph-* in DT and its pinmux/clock is not? Maybe the i2c on tegra works by sheer coincidence right now? Can you have a look?
Power i2c line (one that hosts PMIC) is configured extremely early in SPL since it is needed for cpu and core voltage setup so even if, as you say, tegra works by sheer coincidence, specifically this i2c line should work non the less, since it has all its pre-requisites (clock and pinmux) configured on early stage.
As I have told, I was not able to determine exact reason why this happens, it should not and yet it does. This is why I have abandoned my attempt to implement same changes you are currently proposing.
On 9/11/24 7:57 AM, Svyatoslav Ryhel wrote:
[...]
Quoted 12 lines
Quoted 11 lines
Quoted 7 lines
Quoted 3 lines
You did mention something regarding I2C/PMIC driver probe timing, but it seems the I2C driver and PMIC drivers probe roughly around the same time in both pass and fail cases ?
Yes, here I agree that they both probe and probe passes, but I assume timing of i2c call is critical and there may be some dependency which is not ready.
My guess would be pinmux or clock, maybe the i2c controller is marked as bootph-* in DT and its pinmux/clock is not? Maybe the i2c on tegra works by sheer coincidence right now? Can you have a look?
Quoted 5 lines
Power i2c line (one that hosts PMIC) is configured extremely early in SPL since it is needed for cpu and core voltage setup so even if, as you say, tegra works by sheer coincidence, specifically this i2c line should work non the less, since it has all its pre-requisites (clock and pinmux) configured on early stage.
Is it possible that this configuration is somehow reset or reconfigured from DT early on in U-Boot proper ?
Do you have serial console output in board_f.c time in U-Boot proper , possibly using DEUBG_UART , to check if there might be some prior failing I2C transfer at that board_f.c time ?
Quoted 3 lines
As I have told, I was not able to determine exact reason why this happens, it should not and yet it does. This is why I have abandoned my attempt to implement same changes you are currently proposing.
If tegra has a problem, it should be fixed on tegra side and not block core plumbing. I am not seeing the problem on stm32 or imx systems, so I am banking toward tegra-specific issue.
Are you able to debug this ?
ср, 11 вер. 2024 р. о 14:01 Marek Vasut <[email protected]> пише:
Quoted 17 lines · Svyatoslav Ryhel
[...]
Quoted 12 lines
Quoted 11 lines
Quoted 7 lines
Quoted 3 lines
You did mention something regarding I2C/PMIC driver probe timing, but it seems the I2C driver and PMIC drivers probe roughly around the same time in both pass and fail cases ?
Yes, here I agree that they both probe and probe passes, but I assume timing of i2c call is critical and there may be some dependency which is not ready.
My guess would be pinmux or clock, maybe the i2c controller is marked as bootph-* in DT and its pinmux/clock is not? Maybe the i2c on tegra works by sheer coincidence right now? Can you have a look?
Quoted 8 lines
Quoted 5 lines
Power i2c line (one that hosts PMIC) is configured extremely early in SPL since it is needed for cpu and core voltage setup so even if, as you say, tegra works by sheer coincidence, specifically this i2c line should work non the less, since it has all its pre-requisites (clock and pinmux) configured on early stage.
Is it possible that this configuration is somehow reset or reconfigured from DT early on in U-Boot proper ?
No
Quoted 3 lines
Do you have serial console output in
board_f.ctime in U-Boot proper , possibly usingDEUBG_UART, to check if there might be some prior failing I2C transfer at thatboard_f.ctime ?
Haven't spotted anything weird there.
Quoted 8 lines
Quoted 3 lines
As I have told, I was not able to determine exact reason why this happens, it should not and yet it does. This is why I have abandoned my attempt to implement same changes you are currently proposing.
If tegra has a problem, it should be fixed on tegra side and not block core plumbing. I am not seeing the problem on stm32 or imx systems, so I am banking toward tegra-specific issue.
And yet you are pushing tegra breaking stuff. I will insist on reverting this is it passes.
Quoted 1 line
Are you able to debug this ?
No, I am not able find exact cuse of this behavior.
Quoted 44 lines · Svyatoslav Ryhel
ср, 11 вер. 2024 р. о 14:01 Marek Vasut <[email protected]> пише:
Quoted 17 lines · Svyatoslav Ryhel
[...]
Quoted 12 lines
Quoted 11 lines
Quoted 7 lines
Quoted 3 lines
You did mention something regarding I2C/PMIC driver probe timing, but it seems the I2C driver and PMIC drivers probe roughly around the same time in both pass and fail cases ?
Yes, here I agree that they both probe and probe passes, but I assume timing of i2c call is critical and there may be some dependency which is not ready.
My guess would be pinmux or clock, maybe the i2c controller is marked as bootph-* in DT and its pinmux/clock is not? Maybe the i2c on tegra works by sheer coincidence right now? Can you have a look?
Quoted 8 lines
Quoted 5 lines
Power i2c line (one that hosts PMIC) is configured extremely early in SPL since it is needed for cpu and core voltage setup so even if, as you say, tegra works by sheer coincidence, specifically this i2c line should work non the less, since it has all its pre-requisites (clock and pinmux) configured on early stage.
Is it possible that this configuration is somehow reset or reconfigured from DT early on in U-Boot proper ?
No
Quoted 3 lines
Do you have serial console output in
board_f.ctime in U-Boot proper , possibly usingDEUBG_UART, to check if there might be some prior failing I2C transfer at thatboard_f.ctime ?Haven't spotted anything weird there.
Quoted 8 lines
Quoted 3 lines
As I have told, I was not able to determine exact reason why this happens, it should not and yet it does. This is why I have abandoned my attempt to implement same changes you are currently proposing.
If tegra has a problem, it should be fixed on tegra side and not block core plumbing. I am not seeing the problem on stm32 or imx systems, so I am banking toward tegra-specific issue.
Quoted 6 lines
And yet you are pushing tegra breaking stuff. I will insist on reverting this is it passes.
Quoted 1 line
Are you able to debug this ?
No, I am not able find exact cuse of this behavior.
How do you propose we resolve this then, Svyatoslav? I threw this patch at some TI platforms as well and they're all fine. Are you unable to get some early debuging information out like Marek was asking? Thanks.
Signature · 1 line
Tom
Hi Tom,
Quoted 49 lines · Tom Rini
Quoted 47 lines · Svyatoslav Ryhel
ср, 11 вер. 2024 р. о 14:01 Marek Vasut <[email protected]> пише:
Quoted 17 lines · Svyatoslav Ryhel
[...]
Quoted 12 lines
Quoted 11 lines
Quoted 7 lines
Quoted 3 lines
You did mention something regarding I2C/PMIC driver probe timing, but it seems the I2C driver and PMIC drivers probe roughly around the same time in both pass and fail cases ?
Yes, here I agree that they both probe and probe passes, but I assume timing of i2c call is critical and there may be some dependency which is not ready.
My guess would be pinmux or clock, maybe the i2c controller is marked as bootph-* in DT and its pinmux/clock is not? Maybe the i2c on tegra works by sheer coincidence right now? Can you have a look?
Quoted 8 lines
Quoted 5 lines
Power i2c line (one that hosts PMIC) is configured extremely early in SPL since it is needed for cpu and core voltage setup so even if, as you say, tegra works by sheer coincidence, specifically this i2c line should work non the less, since it has all its pre-requisites (clock and pinmux) configured on early stage.
Is it possible that this configuration is somehow reset or reconfigured from DT early on in U-Boot proper ?
No
Quoted 3 lines
Do you have serial console output in
board_f.ctime in U-Boot proper , possibly usingDEUBG_UART, to check if there might be some prior failing I2C transfer at thatboard_f.ctime ?Haven't spotted anything weird there.
Quoted 8 lines
Quoted 3 lines
As I have told, I was not able to determine exact reason why this happens, it should not and yet it does. This is why I have abandoned my attempt to implement same changes you are currently proposing.
If tegra has a problem, it should be fixed on tegra side and not block core plumbing. I am not seeing the problem on stm32 or imx systems, so I am banking toward tegra-specific issue.
And yet you are pushing tegra breaking stuff. I will insist on reverting this is it passes.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Are you able to debug this ?
No, I am not able find exact cuse of this behavior.
How do you propose we resolve this then, Svyatoslav? I threw this patch at some TI platforms as well and they're all fine. Are you unable to get some early debuging information out like Marek was asking? Thanks.
At this point I would like to have an optional Kconfig to enable the always-on regulators in the init sequence, perhaps as part of initf_dm(). It should not be in DM core, sorry.
Quoted 2 lines
--
Tom
Quoted 1 line · Simon Glass
Hi Tom,
Hello Simon,
Quoted 7 lines
Quoted 3 lines
How do you propose we resolve this then, Svyatoslav? I threw this patch at some TI platforms as well and they're all fine. Are you unable to get some early debuging information out like Marek was asking? Thanks.
At this point I would like to have an optional
Kconfigto enable the always-on regulators in the init sequence, perhaps as part ofinitf_dm().
That would only move the current regulators_enable_boot_on() elsewhere without fixing the real issue which this series does address -- that the regulators which are marked as always-on/boot-on should always be enabled on boot, unconditionally. If there are regulators which should not be enabled on boot, they should not be marked always-on/boot-on in DT in the first place.
The regulators_enable_boot_on() is missing or forgotten in multiple board files, which makes boards randomly misbehave due to disabled always-on regulators. Adding a Kconfig option would convert this problem to "new Kconfig option is missing in multiple configs" problem, which is effectively identical problem, only moved elsewhere. It should be the core code that handles this the same way for all boards and configs.
The core has the tools for it too, the DM_FLAG_PROBE_AFTER_BIND flag which is already used for the same purpose for LEDs, pinctrl, PMICs, etc., which makes regulators_enable_boot_on() unnecessary.
The DM_FLAG_PROBE_AFTER_BIND should be used more instead of ad-hoc callbacks in random places of the init sequence, those do not scale.
Quoted 1 line
It should not be in DM core, sorry.
This is in regulator uclass, not in DM core ?
This discussion thread is about debugging tegra i2c, how is your comment related to the discussion here ?
нд, 28 лип. 2024 р. о 19:38 Marek Vasut <[email protected]> пише:
Quoted 8 lines · Marek Vasut
Quoted 6 lines
In case a regulator DT node contains regulator-always-on or regulator-boot-on property, make sure the regulator gets correctly configured by U-Boot on start up. Unconditionally probe such regulator drivers. This is a preparatory patch for introduction of .regulator_post_probe() which would trigger the regulator configuration.
Quoted 6 lines
Quoted 4 lines
Parsing of regulator-always-on and regulator-boot-on DT property has been moved to
regulator_post_bind()as the information is required early, the rest of the DT parsing has been kept inregulator_pre_probe()to avoid slowing down the boot process.Is there anything blocking this series from being applied ?
I would like to try it to be sure that it does not break my devices. I will respond within next 24 hours.