From b7adcdd073c055b0e87a66b6a95fa42079fad7f7 Mon Sep 17 00:00:00 2001 From: Lukasz Majewski Date: Sat, 25 Jan 2020 09:00:58 +0100 Subject: [PATCH 1/3] regulator: fix: Move code to enable gpio regulator to pre_probe from ofdata_to_platdata The commit e8e9715df2d4 ("regulator: fixed: Modify enable-active-high behavior") fixed the regulator driver behavior when 'enable-active-high' is defined. Unfortunately, this patch used dm_regulator_platdata()'s "boot_on" member to set GPIOD_IS_OUT_ACTIVE flag and enable the regulator. The issue here is that regulator_common_ofdata_to_platdata() is called _before_ regulator_pre_probe() function in which the 'regulator-boot-on' property is asserted. As a result the GPIOD_IS_OUT_ACTIVE flag is not set and gpio_request_by_name() called in the former function is not enabling the regulator. This is problematic for e.g. i.MX ethernet driver, which then tries to perform initialization without power (and fails). The solution here is to explicitly enable regulator in regulator_pre_probe() callback only when 'regulator-boot-on' property is present in device tree. The GPIOD_IS_OUT_ACTIVE flag is not set at all, but relevant gpio is requested. Signed-off-by: Lukasz Majewski Reviewed-by: Patrice Chotard Tested-by: Patrice Chotard --- drivers/power/regulator/regulator-uclass.c | 3 +++ drivers/power/regulator/regulator_common.c | 5 ----- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/power/regulator/regulator-uclass.c b/drivers/power/regulator/regulator-uclass.c index 90961de95c..c9d26344d7 100644 --- a/drivers/power/regulator/regulator-uclass.c +++ b/drivers/power/regulator/regulator-uclass.c @@ -464,6 +464,9 @@ static int regulator_pre_probe(struct udevice *dev) (uc_pdata->min_uA == uc_pdata->max_uA)) uc_pdata->flags |= REGULATOR_FLAG_AUTOSET_UA; + if (uc_pdata->boot_on) + regulator_set_enable(dev, uc_pdata->boot_on); + return 0; } diff --git a/drivers/power/regulator/regulator_common.c b/drivers/power/regulator/regulator_common.c index 939efb2c0d..33b73b7c2f 100644 --- a/drivers/power/regulator/regulator_common.c +++ b/drivers/power/regulator/regulator_common.c @@ -12,16 +12,11 @@ int regulator_common_ofdata_to_platdata(struct udevice *dev, struct regulator_common_platdata *dev_pdata, const char *enable_gpio_name) { struct gpio_desc *gpio; - struct dm_regulator_uclass_platdata *uc_pdata; int flags = GPIOD_IS_OUT; int ret; - uc_pdata = dev_get_uclass_platdata(dev); - if (!dev_read_bool(dev, "enable-active-high")) flags |= GPIOD_ACTIVE_LOW; - if (uc_pdata->boot_on) - flags |= GPIOD_IS_OUT_ACTIVE; /* Get optional enable GPIO desc */ gpio = &dev_pdata->gpio; From 2a3720181195b5deca7e370935c5573cf79d4859 Mon Sep 17 00:00:00 2001 From: Dario Binacchi Date: Sun, 9 Feb 2020 19:57:41 +0100 Subject: [PATCH 2/3] dm: fix design.rst document The patch fixes some errors. Signed-off-by: Dario Binacchi Reviewed-by: Bin Meng --- doc/driver-model/design.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/driver-model/design.rst b/doc/driver-model/design.rst index 8fd28c0f52..5247ecc276 100644 --- a/doc/driver-model/design.rst +++ b/doc/driver-model/design.rst @@ -231,7 +231,7 @@ You should see something like this:: What is going on? ----------------- -Let's start at the top. The demo command is in common/cmd_demo.c. It does +Let's start at the top. The demo command is in cmd/demo.c. It does the usual command processing and then: .. code-block:: c @@ -402,7 +402,7 @@ in the board file. .. code-block:: c - static const struct dm_demo_cdata red_square = { + static const struct dm_demo_pdata red_square = { .colour = "red", .sides = 4. }; @@ -489,12 +489,12 @@ The demo uclass is declared like this: .. code-block:: c - U_BOOT_CLASS(demo) = { + UCLASS_DRIVER(demo) = { .id = UCLASS_DEMO, }; It is also possible to specify special methods for probe, etc. The uclass -numbering comes from include/dm/uclass.h. To add a new uclass, add to the +numbering comes from include/dm/uclass-id.h. To add a new uclass, add to the end of the enum there, then declare your uclass as above. From 2aa69c9b9d4511d35b372715d6ea4ccebb75a526 Mon Sep 17 00:00:00 2001 From: Marek Bykowski Date: Mon, 3 Feb 2020 11:43:32 +0100 Subject: [PATCH 3/3] Kconfig: update LOGLEVEL range As LOGLEVEL ranges form 0 to 9 set the limit to 10. Signed-off-by: Marek Bykowski --- common/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/Kconfig b/common/Kconfig index a7c5ba278a..4bc3df4e1b 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -469,7 +469,7 @@ config IDENT_STRING config LOGLEVEL int "loglevel" default 4 - range 0 8 + range 0 10 help All Messages with a loglevel smaller than the console loglevel will be compiled in. The loglevels are defined as follows: