All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] led: Configure LED default-state on boot
@ 2022-04-03 23:23 Marek Vasut
  2022-04-15 12:07 ` Tom Rini
  2022-04-21 15:09 ` Patrice CHOTARD
  0 siblings, 2 replies; 13+ messages in thread
From: Marek Vasut @ 2022-04-03 23:23 UTC (permalink / raw)
  To: u-boot
  Cc: Marek Vasut, Alex Nemirovsky, Patrick Delaunay, Philippe Reynes,
	Sean Anderson, Simon Glass, Steven Lawrance

In case the DT LED subnode contains "default-state" property set to
either "on" or "off", probe the LED driver and configure the LED state
automatically.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Alex Nemirovsky <alex.nemirovsky@cortina-access.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Cc: Philippe Reynes <philippe.reynes@softathome.com>
Cc: Sean Anderson <seanga2@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Steven Lawrance <steven.lawrance@softathome.com>
---
 drivers/led/led-uclass.c | 57 ++++++++++++++++++++++------------------
 include/led.h            | 24 +++++++++--------
 2 files changed, 45 insertions(+), 36 deletions(-)

diff --git a/drivers/led/led-uclass.c b/drivers/led/led-uclass.c
index 2f4aa18fb10..5d7bf40896b 100644
--- a/drivers/led/led-uclass.c
+++ b/drivers/led/led-uclass.c
@@ -66,43 +66,49 @@ int led_set_period(struct udevice *dev, int period_ms)
 }
 #endif
 
+/* This is superseded by led_post_bind()/led_post_probe() below. */
 int led_default_state(void)
 {
-	struct udevice *dev;
-	struct uclass *uc;
-	const char *default_state;
-	int ret;
-
-	ret = uclass_get(UCLASS_LED, &uc);
-	if (ret)
-		return ret;
-	for (uclass_find_first_device(UCLASS_LED, &dev);
-	     dev;
-	     uclass_find_next_device(&dev)) {
-		default_state = dev_read_string(dev, "default-state");
-		if (!default_state)
-			continue;
-		ret = device_probe(dev);
-		if (ret)
-			return ret;
-		if (!strncmp(default_state, "on", 2))
-			led_set_state(dev, LEDST_ON);
-		else if (!strncmp(default_state, "off", 3))
-			led_set_state(dev, LEDST_OFF);
-		/* default-state = "keep" : device is only probed */
-	}
-
-	return ret;
+	return 0;
 }
 
 static int led_post_bind(struct udevice *dev)
 {
 	struct led_uc_plat *uc_plat = dev_get_uclass_plat(dev);
+	const char *default_state;
 
 	uc_plat->label = dev_read_string(dev, "label");
 	if (!uc_plat->label)
 		uc_plat->label = ofnode_get_name(dev_ofnode(dev));
 
+	uc_plat->default_state = LEDST_COUNT;
+
+	default_state = dev_read_string(dev, "default-state");
+	if (!default_state)
+		return 0;
+
+	if (!strncmp(default_state, "on", 2))
+		uc_plat->default_state = LEDST_ON;
+	else if (!strncmp(default_state, "off", 3))
+		uc_plat->default_state = LEDST_OFF;
+	else
+		return 0;
+
+	/*
+	 * In case the LED has default-state DT property, trigger
+	 * probe() to configure its default state during startup.
+	 */
+	return device_probe(dev);
+}
+
+static int led_post_probe(struct udevice *dev)
+{
+	struct led_uc_plat *uc_plat = dev_get_uclass_plat(dev);
+
+	if (uc_plat->default_state == LEDST_ON ||
+	    uc_plat->default_state == LEDST_OFF)
+		led_set_state(dev, uc_plat->default_state);
+
 	return 0;
 }
 
@@ -111,4 +117,5 @@ UCLASS_DRIVER(led) = {
 	.name		= "led",
 	.per_device_plat_auto	= sizeof(struct led_uc_plat),
 	.post_bind	= led_post_bind,
+	.post_probe	= led_post_probe,
 };
diff --git a/include/led.h b/include/led.h
index 8eeb5a7c6d3..43acca85719 100644
--- a/include/led.h
+++ b/include/led.h
@@ -9,13 +9,26 @@
 
 struct udevice;
 
+enum led_state_t {
+	LEDST_OFF = 0,
+	LEDST_ON = 1,
+	LEDST_TOGGLE,
+#ifdef CONFIG_LED_BLINK
+	LEDST_BLINK,
+#endif
+
+	LEDST_COUNT,
+};
+
 /**
  * struct led_uc_plat - Platform data the uclass stores about each device
  *
  * @label:	LED label
+ * @default_state:	LED default state
  */
 struct led_uc_plat {
 	const char *label;
+	enum led_state_t default_state;
 };
 
 /**
@@ -27,17 +40,6 @@ struct led_uc_priv {
 	int period_ms;
 };
 
-enum led_state_t {
-	LEDST_OFF = 0,
-	LEDST_ON = 1,
-	LEDST_TOGGLE,
-#ifdef CONFIG_LED_BLINK
-	LEDST_BLINK,
-#endif
-
-	LEDST_COUNT,
-};
-
 struct led_ops {
 	/**
 	 * set_state() - set the state of an LED
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH] led: Configure LED default-state on boot
  2022-04-03 23:23 [PATCH] led: Configure LED default-state on boot Marek Vasut
@ 2022-04-15 12:07 ` Tom Rini
  2022-04-21 15:09 ` Patrice CHOTARD
  1 sibling, 0 replies; 13+ messages in thread
From: Tom Rini @ 2022-04-15 12:07 UTC (permalink / raw)
  To: Marek Vasut
  Cc: u-boot, Alex Nemirovsky, Patrick Delaunay, Philippe Reynes,
	Sean Anderson, Simon Glass, Steven Lawrance

[-- Attachment #1: Type: text/plain, Size: 632 bytes --]

On Mon, Apr 04, 2022 at 01:23:27AM +0200, Marek Vasut wrote:

> In case the DT LED subnode contains "default-state" property set to
> either "on" or "off", probe the LED driver and configure the LED state
> automatically.
> 
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Alex Nemirovsky <alex.nemirovsky@cortina-access.com>
> Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
> Cc: Philippe Reynes <philippe.reynes@softathome.com>
> Cc: Sean Anderson <seanga2@gmail.com>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: Steven Lawrance <steven.lawrance@softathome.com>

Applied to u-boot/master, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] led: Configure LED default-state on boot
  2022-04-03 23:23 [PATCH] led: Configure LED default-state on boot Marek Vasut
  2022-04-15 12:07 ` Tom Rini
@ 2022-04-21 15:09 ` Patrice CHOTARD
  2022-04-21 15:18   ` Marek Vasut
  1 sibling, 1 reply; 13+ messages in thread
From: Patrice CHOTARD @ 2022-04-21 15:09 UTC (permalink / raw)
  To: Marek Vasut, u-boot
  Cc: Alex Nemirovsky, Patrick Delaunay, Philippe Reynes,
	Sean Anderson, Simon Glass, Steven Lawrance

Hi Marek

I tested the current U-Boot master branch (22bfaa1f673ab5442dfb9778eea4c9a18dee42d0)
This patch is breaking the boot sequence on stm32mp157c-dk2.

Thanks
Patrice


On 4/4/22 01:23, Marek Vasut wrote:
> In case the DT LED subnode contains "default-state" property set to
> either "on" or "off", probe the LED driver and configure the LED state
> automatically.
> 
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Alex Nemirovsky <alex.nemirovsky@cortina-access.com>
> Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
> Cc: Philippe Reynes <philippe.reynes@softathome.com>
> Cc: Sean Anderson <seanga2@gmail.com>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: Steven Lawrance <steven.lawrance@softathome.com>
> ---
>  drivers/led/led-uclass.c | 57 ++++++++++++++++++++++------------------
>  include/led.h            | 24 +++++++++--------
>  2 files changed, 45 insertions(+), 36 deletions(-)
> 
> diff --git a/drivers/led/led-uclass.c b/drivers/led/led-uclass.c
> index 2f4aa18fb10..5d7bf40896b 100644
> --- a/drivers/led/led-uclass.c
> +++ b/drivers/led/led-uclass.c
> @@ -66,43 +66,49 @@ int led_set_period(struct udevice *dev, int period_ms)
>  }
>  #endif
>  
> +/* This is superseded by led_post_bind()/led_post_probe() below. */
>  int led_default_state(void)
>  {
> -	struct udevice *dev;
> -	struct uclass *uc;
> -	const char *default_state;
> -	int ret;
> -
> -	ret = uclass_get(UCLASS_LED, &uc);
> -	if (ret)
> -		return ret;
> -	for (uclass_find_first_device(UCLASS_LED, &dev);
> -	     dev;
> -	     uclass_find_next_device(&dev)) {
> -		default_state = dev_read_string(dev, "default-state");
> -		if (!default_state)
> -			continue;
> -		ret = device_probe(dev);
> -		if (ret)
> -			return ret;
> -		if (!strncmp(default_state, "on", 2))
> -			led_set_state(dev, LEDST_ON);
> -		else if (!strncmp(default_state, "off", 3))
> -			led_set_state(dev, LEDST_OFF);
> -		/* default-state = "keep" : device is only probed */
> -	}
> -
> -	return ret;
> +	return 0;
>  }
>  
>  static int led_post_bind(struct udevice *dev)
>  {
>  	struct led_uc_plat *uc_plat = dev_get_uclass_plat(dev);
> +	const char *default_state;
>  
>  	uc_plat->label = dev_read_string(dev, "label");
>  	if (!uc_plat->label)
>  		uc_plat->label = ofnode_get_name(dev_ofnode(dev));
>  
> +	uc_plat->default_state = LEDST_COUNT;
> +
> +	default_state = dev_read_string(dev, "default-state");
> +	if (!default_state)
> +		return 0;
> +
> +	if (!strncmp(default_state, "on", 2))
> +		uc_plat->default_state = LEDST_ON;
> +	else if (!strncmp(default_state, "off", 3))
> +		uc_plat->default_state = LEDST_OFF;
> +	else
> +		return 0;
> +
> +	/*
> +	 * In case the LED has default-state DT property, trigger
> +	 * probe() to configure its default state during startup.
> +	 */
> +	return device_probe(dev);
> +}
> +
> +static int led_post_probe(struct udevice *dev)
> +{
> +	struct led_uc_plat *uc_plat = dev_get_uclass_plat(dev);
> +
> +	if (uc_plat->default_state == LEDST_ON ||
> +	    uc_plat->default_state == LEDST_OFF)
> +		led_set_state(dev, uc_plat->default_state);
> +
>  	return 0;
>  }
>  
> @@ -111,4 +117,5 @@ UCLASS_DRIVER(led) = {
>  	.name		= "led",
>  	.per_device_plat_auto	= sizeof(struct led_uc_plat),
>  	.post_bind	= led_post_bind,
> +	.post_probe	= led_post_probe,
>  };
> diff --git a/include/led.h b/include/led.h
> index 8eeb5a7c6d3..43acca85719 100644
> --- a/include/led.h
> +++ b/include/led.h
> @@ -9,13 +9,26 @@
>  
>  struct udevice;
>  
> +enum led_state_t {
> +	LEDST_OFF = 0,
> +	LEDST_ON = 1,
> +	LEDST_TOGGLE,
> +#ifdef CONFIG_LED_BLINK
> +	LEDST_BLINK,
> +#endif
> +
> +	LEDST_COUNT,
> +};
> +
>  /**
>   * struct led_uc_plat - Platform data the uclass stores about each device
>   *
>   * @label:	LED label
> + * @default_state:	LED default state
>   */
>  struct led_uc_plat {
>  	const char *label;
> +	enum led_state_t default_state;
>  };
>  
>  /**
> @@ -27,17 +40,6 @@ struct led_uc_priv {
>  	int period_ms;
>  };
>  
> -enum led_state_t {
> -	LEDST_OFF = 0,
> -	LEDST_ON = 1,
> -	LEDST_TOGGLE,
> -#ifdef CONFIG_LED_BLINK
> -	LEDST_BLINK,
> -#endif
> -
> -	LEDST_COUNT,
> -};
> -
>  struct led_ops {
>  	/**
>  	 * set_state() - set the state of an LED

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] led: Configure LED default-state on boot
  2022-04-21 15:09 ` Patrice CHOTARD
@ 2022-04-21 15:18   ` Marek Vasut
  2022-04-21 15:26     ` Patrice CHOTARD
  0 siblings, 1 reply; 13+ messages in thread
From: Marek Vasut @ 2022-04-21 15:18 UTC (permalink / raw)
  To: Patrice CHOTARD, u-boot
  Cc: Alex Nemirovsky, Patrick Delaunay, Philippe Reynes,
	Sean Anderson, Simon Glass, Steven Lawrance

On 4/21/22 17:09, Patrice CHOTARD wrote:
> Hi Marek

Hi,

> I tested the current U-Boot master branch (22bfaa1f673ab5442dfb9778eea4c9a18dee42d0)
> This patch is breaking the boot sequence on stm32mp157c-dk2.

Breaking it ... how ? What happens, hang ?

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] led: Configure LED default-state on boot
  2022-04-21 15:18   ` Marek Vasut
@ 2022-04-21 15:26     ` Patrice CHOTARD
  2022-04-22  0:06       ` Sean Anderson
  0 siblings, 1 reply; 13+ messages in thread
From: Patrice CHOTARD @ 2022-04-21 15:26 UTC (permalink / raw)
  To: Marek Vasut, u-boot
  Cc: Alex Nemirovsky, Patrick Delaunay, Philippe Reynes,
	Sean Anderson, Simon Glass, Steven Lawrance



On 4/21/22 17:18, Marek Vasut wrote:
> On 4/21/22 17:09, Patrice CHOTARD wrote:
>> Hi Marek
> 
> Hi,
> 
>> I tested the current U-Boot master branch (22bfaa1f673ab5442dfb9778eea4c9a18dee42d0)
>> This patch is breaking the boot sequence on stm32mp157c-dk2.
> 
> Breaking it ... how ? What happens, hang ?

Here is the boot log :

U-Boot SPL 2022.04-00827-g22bfaa1f67 (Apr 21 2022 - 17:22:47 +0200)
RAM: DDR3-DDR3L 16bits 533000kHz
WDT:   Started watchdog@5a002000 with servicing (32s timeout)


U-Boot 2022.04-00827-g22bfaa1f67 (Apr 21 2022 - 17:22:47 +0200)

CPU: STM32MP157CAC Rev.B
Model: STMicroelectronics STM32MP157C-DK2 Discovery Board
Board: stm32mp1 in basic mode (st,stm32mp157c-dk2)
Board: MB1272 Var2.0 Rev.C-01
DRAM:  512 MiB
Clocks:
- MPU : 0 MHz
- MCU : 0 MHz
- AXI : 0 MHz
- PER : 0 MHz
- DDR : 0 MHz
clock rate is 0
clock rate is 0
clock rate is 0
clock rate is 0
clock rate is 0
cloc\x03

What worried me is that all clocks are set to 0 (MPU/MCU/AXI ....)...no direct link with the led-uclass update.
For information, if i comment the device_probe(dev) in led_post_bind(), it avoid the hang.

Thanks
Patrice

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] led: Configure LED default-state on boot
  2022-04-21 15:26     ` Patrice CHOTARD
@ 2022-04-22  0:06       ` Sean Anderson
  2022-04-22  7:09         ` Patrice CHOTARD
  0 siblings, 1 reply; 13+ messages in thread
From: Sean Anderson @ 2022-04-22  0:06 UTC (permalink / raw)
  To: Patrice CHOTARD, Marek Vasut, u-boot
  Cc: Alex Nemirovsky, Patrick Delaunay, Philippe Reynes, Simon Glass,
	Steven Lawrance

On 4/21/22 11:26 AM, Patrice CHOTARD wrote:
> 
> 
> On 4/21/22 17:18, Marek Vasut wrote:
>> On 4/21/22 17:09, Patrice CHOTARD wrote:
>>> Hi Marek
>>
>> Hi,
>>
>>> I tested the current U-Boot master branch (22bfaa1f673ab5442dfb9778eea4c9a18dee42d0)
>>> This patch is breaking the boot sequence on stm32mp157c-dk2.
>>
>> Breaking it ... how ? What happens, hang ?
> 
> Here is the boot log :
> 
> U-Boot SPL 2022.04-00827-g22bfaa1f67 (Apr 21 2022 - 17:22:47 +0200)
> RAM: DDR3-DDR3L 16bits 533000kHz
> WDT:   Started watchdog@5a002000 with servicing (32s timeout)
> 
> 
> U-Boot 2022.04-00827-g22bfaa1f67 (Apr 21 2022 - 17:22:47 +0200)
> 
> CPU: STM32MP157CAC Rev.B
> Model: STMicroelectronics STM32MP157C-DK2 Discovery Board
> Board: stm32mp1 in basic mode (st,stm32mp157c-dk2)
> Board: MB1272 Var2.0 Rev.C-01
> DRAM:  512 MiB
> Clocks:
> - MPU : 0 MHz
> - MCU : 0 MHz
> - AXI : 0 MHz
> - PER : 0 MHz
> - DDR : 0 MHz
> clock rate is 0
> clock rate is 0
> clock rate is 0
> clock rate is 0
> clock rate is 0
> cloc\x03
> 
> What worried me is that all clocks are set to 0 (MPU/MCU/AXI ....)...no direct link with the led-uclass update.
> For information, if i comment the device_probe(dev) in led_post_bind(), it avoid the hang.

Can you try applying the LED patch on top of 2022.04?
I made some clock changes recently, so it could be an interaction with that.

--Sean

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] led: Configure LED default-state on boot
  2022-04-22  0:06       ` Sean Anderson
@ 2022-04-22  7:09         ` Patrice CHOTARD
  2022-04-22  9:02           ` Marek Vasut
  0 siblings, 1 reply; 13+ messages in thread
From: Patrice CHOTARD @ 2022-04-22  7:09 UTC (permalink / raw)
  To: Sean Anderson, Marek Vasut, u-boot
  Cc: Alex Nemirovsky, Patrick Delaunay, Philippe Reynes, Simon Glass,
	Steven Lawrance

Hi Sean

On 4/22/22 02:06, Sean Anderson wrote:
> On 4/21/22 11:26 AM, Patrice CHOTARD wrote:
>>
>>
>> On 4/21/22 17:18, Marek Vasut wrote:
>>> On 4/21/22 17:09, Patrice CHOTARD wrote:
>>>> Hi Marek
>>>
>>> Hi,
>>>
>>>> I tested the current U-Boot master branch (22bfaa1f673ab5442dfb9778eea4c9a18dee42d0)
>>>> This patch is breaking the boot sequence on stm32mp157c-dk2.
>>>
>>> Breaking it ... how ? What happens, hang ?
>>
>> Here is the boot log :
>>
>> U-Boot SPL 2022.04-00827-g22bfaa1f67 (Apr 21 2022 - 17:22:47 +0200)
>> RAM: DDR3-DDR3L 16bits 533000kHz
>> WDT:   Started watchdog@5a002000 with servicing (32s timeout)
>>
>>
>> U-Boot 2022.04-00827-g22bfaa1f67 (Apr 21 2022 - 17:22:47 +0200)
>>
>> CPU: STM32MP157CAC Rev.B
>> Model: STMicroelectronics STM32MP157C-DK2 Discovery Board
>> Board: stm32mp1 in basic mode (st,stm32mp157c-dk2)
>> Board: MB1272 Var2.0 Rev.C-01
>> DRAM:  512 MiB
>> Clocks:
>> - MPU : 0 MHz
>> - MCU : 0 MHz
>> - AXI : 0 MHz
>> - PER : 0 MHz
>> - DDR : 0 MHz
>> clock rate is 0
>> clock rate is 0
>> clock rate is 0
>> clock rate is 0
>> clock rate is 0
>> cloc\x03
>>
>> What worried me is that all clocks are set to 0 (MPU/MCU/AXI ....)...no direct link with the led-uclass update.
>> For information, if i comment the device_probe(dev) in led_post_bind(), it avoid the hang.
> 
> Can you try applying the LED patch on top of 2022.04?
> I made some clock changes recently, so it could be an interaction with that.
> 

Thanks for the tips, but unfortunately, i have the same issue when applying this patch on top of v2022.04.
I am still investigating ..... ;-)

Patrice

> --Sean

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] led: Configure LED default-state on boot
  2022-04-22  7:09         ` Patrice CHOTARD
@ 2022-04-22  9:02           ` Marek Vasut
  2022-04-22 11:41             ` Marek Vasut
  0 siblings, 1 reply; 13+ messages in thread
From: Marek Vasut @ 2022-04-22  9:02 UTC (permalink / raw)
  To: Patrice CHOTARD, Sean Anderson, u-boot
  Cc: Alex Nemirovsky, Patrick Delaunay, Philippe Reynes, Simon Glass,
	Steven Lawrance

On 4/22/22 09:09, Patrice CHOTARD wrote:
> Hi Sean
> 
> On 4/22/22 02:06, Sean Anderson wrote:
>> On 4/21/22 11:26 AM, Patrice CHOTARD wrote:
>>>
>>>
>>> On 4/21/22 17:18, Marek Vasut wrote:
>>>> On 4/21/22 17:09, Patrice CHOTARD wrote:
>>>>> Hi Marek
>>>>
>>>> Hi,
>>>>
>>>>> I tested the current U-Boot master branch (22bfaa1f673ab5442dfb9778eea4c9a18dee42d0)
>>>>> This patch is breaking the boot sequence on stm32mp157c-dk2.
>>>>
>>>> Breaking it ... how ? What happens, hang ?
>>>
>>> Here is the boot log :
>>>
>>> U-Boot SPL 2022.04-00827-g22bfaa1f67 (Apr 21 2022 - 17:22:47 +0200)
>>> RAM: DDR3-DDR3L 16bits 533000kHz
>>> WDT:   Started watchdog@5a002000 with servicing (32s timeout)
>>>
>>>
>>> U-Boot 2022.04-00827-g22bfaa1f67 (Apr 21 2022 - 17:22:47 +0200)
>>>
>>> CPU: STM32MP157CAC Rev.B
>>> Model: STMicroelectronics STM32MP157C-DK2 Discovery Board
>>> Board: stm32mp1 in basic mode (st,stm32mp157c-dk2)
>>> Board: MB1272 Var2.0 Rev.C-01
>>> DRAM:  512 MiB
>>> Clocks:
>>> - MPU : 0 MHz
>>> - MCU : 0 MHz
>>> - AXI : 0 MHz
>>> - PER : 0 MHz
>>> - DDR : 0 MHz
>>> clock rate is 0
>>> clock rate is 0
>>> clock rate is 0
>>> clock rate is 0
>>> clock rate is 0
>>> cloc\x03
>>>
>>> What worried me is that all clocks are set to 0 (MPU/MCU/AXI ....)...no direct link with the led-uclass update.
>>> For information, if i comment the device_probe(dev) in led_post_bind(), it avoid the hang.
>>
>> Can you try applying the LED patch on top of 2022.04?
>> I made some clock changes recently, so it could be an interaction with that.
>>
> 
> Thanks for the tips, but unfortunately, i have the same issue when applying this patch on top of v2022.04.
> I am still investigating ..... ;-)

Maybe the clk_* in gpio_stm32 is the problem, is the gpio driver for mp1 
probed by the time the led post_bind is called ? If not, maybe that's an 
issue.

I'll have a look too.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] led: Configure LED default-state on boot
  2022-04-22  9:02           ` Marek Vasut
@ 2022-04-22 11:41             ` Marek Vasut
  2022-04-22 12:35               ` Patrice CHOTARD
  0 siblings, 1 reply; 13+ messages in thread
From: Marek Vasut @ 2022-04-22 11:41 UTC (permalink / raw)
  To: Patrice CHOTARD, Sean Anderson, u-boot
  Cc: Alex Nemirovsky, Patrick Delaunay, Philippe Reynes, Simon Glass,
	Steven Lawrance

On 4/22/22 11:02, Marek Vasut wrote:
> On 4/22/22 09:09, Patrice CHOTARD wrote:
>> Hi Sean
>>
>> On 4/22/22 02:06, Sean Anderson wrote:
>>> On 4/21/22 11:26 AM, Patrice CHOTARD wrote:
>>>>
>>>>
>>>> On 4/21/22 17:18, Marek Vasut wrote:
>>>>> On 4/21/22 17:09, Patrice CHOTARD wrote:
>>>>>> Hi Marek
>>>>>
>>>>> Hi,
>>>>>
>>>>>> I tested the current U-Boot master branch 
>>>>>> (22bfaa1f673ab5442dfb9778eea4c9a18dee42d0)
>>>>>> This patch is breaking the boot sequence on stm32mp157c-dk2.
>>>>>
>>>>> Breaking it ... how ? What happens, hang ?
>>>>
>>>> Here is the boot log :
>>>>
>>>> U-Boot SPL 2022.04-00827-g22bfaa1f67 (Apr 21 2022 - 17:22:47 +0200)
>>>> RAM: DDR3-DDR3L 16bits 533000kHz
>>>> WDT:   Started watchdog@5a002000 with servicing (32s timeout)
>>>>
>>>>
>>>> U-Boot 2022.04-00827-g22bfaa1f67 (Apr 21 2022 - 17:22:47 +0200)
>>>>
>>>> CPU: STM32MP157CAC Rev.B
>>>> Model: STMicroelectronics STM32MP157C-DK2 Discovery Board
>>>> Board: stm32mp1 in basic mode (st,stm32mp157c-dk2)
>>>> Board: MB1272 Var2.0 Rev.C-01
>>>> DRAM:  512 MiB
>>>> Clocks:
>>>> - MPU : 0 MHz
>>>> - MCU : 0 MHz
>>>> - AXI : 0 MHz
>>>> - PER : 0 MHz
>>>> - DDR : 0 MHz
>>>> clock rate is 0
>>>> clock rate is 0
>>>> clock rate is 0
>>>> clock rate is 0
>>>> clock rate is 0
>>>> cloc\x03
>>>>
>>>> What worried me is that all clocks are set to 0 (MPU/MCU/AXI 
>>>> ....)...no direct link with the led-uclass update.
>>>> For information, if i comment the device_probe(dev) in 
>>>> led_post_bind(), it avoid the hang.
>>>
>>> Can you try applying the LED patch on top of 2022.04?
>>> I made some clock changes recently, so it could be an interaction 
>>> with that.
>>>
>>
>> Thanks for the tips, but unfortunately, i have the same issue when 
>> applying this patch on top of v2022.04.
>> I am still investigating ..... ;-)
> 
> Maybe the clk_* in gpio_stm32 is the problem, is the gpio driver for mp1 
> probed by the time the led post_bind is called ? If not, maybe that's an 
> issue.
> 
> I'll have a look too.

Try this patch, does it "fix" it for you ?

diff --git a/arch/arm/dts/stm32mp151.dtsi b/arch/arm/dts/stm32mp151.dtsi
index 5a2be007586..ec5cddfcf98 100644
--- a/arch/arm/dts/stm32mp151.dtsi
+++ b/arch/arm/dts/stm32mp151.dtsi
@@ -70,7 +70,7 @@
                 interrupt-parent = <&intc>;
         };

-       clocks {
+//     clocks {
                 clk_hse: clk-hse {
                         #clock-cells = <0>;
                         compatible = "fixed-clock";
@@ -100,7 +100,7 @@
                         compatible = "fixed-clock";
                         clock-frequency = <4000000>;
                 };
-       };
+//     };

         thermal-zones {
                 cpu_thermal: cpu-thermal {

If so, we need to figure out why.

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH] led: Configure LED default-state on boot
  2022-04-22 11:41             ` Marek Vasut
@ 2022-04-22 12:35               ` Patrice CHOTARD
  2022-04-22 13:14                 ` Marek Vasut
  0 siblings, 1 reply; 13+ messages in thread
From: Patrice CHOTARD @ 2022-04-22 12:35 UTC (permalink / raw)
  To: Marek Vasut, Sean Anderson, u-boot
  Cc: Alex Nemirovsky, Patrick Delaunay, Philippe Reynes, Simon Glass,
	Steven Lawrance

Hi Marek

On 4/22/22 13:41, Marek Vasut wrote:
> On 4/22/22 11:02, Marek Vasut wrote:
>> On 4/22/22 09:09, Patrice CHOTARD wrote:
>>> Hi Sean
>>>
>>> On 4/22/22 02:06, Sean Anderson wrote:
>>>> On 4/21/22 11:26 AM, Patrice CHOTARD wrote:
>>>>>
>>>>>
>>>>> On 4/21/22 17:18, Marek Vasut wrote:
>>>>>> On 4/21/22 17:09, Patrice CHOTARD wrote:
>>>>>>> Hi Marek
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>>> I tested the current U-Boot master branch (22bfaa1f673ab5442dfb9778eea4c9a18dee42d0)
>>>>>>> This patch is breaking the boot sequence on stm32mp157c-dk2.
>>>>>>
>>>>>> Breaking it ... how ? What happens, hang ?
>>>>>
>>>>> Here is the boot log :
>>>>>
>>>>> U-Boot SPL 2022.04-00827-g22bfaa1f67 (Apr 21 2022 - 17:22:47 +0200)
>>>>> RAM: DDR3-DDR3L 16bits 533000kHz
>>>>> WDT:   Started watchdog@5a002000 with servicing (32s timeout)
>>>>>
>>>>>
>>>>> U-Boot 2022.04-00827-g22bfaa1f67 (Apr 21 2022 - 17:22:47 +0200)
>>>>>
>>>>> CPU: STM32MP157CAC Rev.B
>>>>> Model: STMicroelectronics STM32MP157C-DK2 Discovery Board
>>>>> Board: stm32mp1 in basic mode (st,stm32mp157c-dk2)
>>>>> Board: MB1272 Var2.0 Rev.C-01
>>>>> DRAM:  512 MiB
>>>>> Clocks:
>>>>> - MPU : 0 MHz
>>>>> - MCU : 0 MHz
>>>>> - AXI : 0 MHz
>>>>> - PER : 0 MHz
>>>>> - DDR : 0 MHz
>>>>> clock rate is 0
>>>>> clock rate is 0
>>>>> clock rate is 0
>>>>> clock rate is 0
>>>>> clock rate is 0
>>>>> cloc\x03
>>>>>
>>>>> What worried me is that all clocks are set to 0 (MPU/MCU/AXI ....)...no direct link with the led-uclass update.
>>>>> For information, if i comment the device_probe(dev) in led_post_bind(), it avoid the hang.
>>>>
>>>> Can you try applying the LED patch on top of 2022.04?
>>>> I made some clock changes recently, so it could be an interaction with that.
>>>>
>>>
>>> Thanks for the tips, but unfortunately, i have the same issue when applying this patch on top of v2022.04.
>>> I am still investigating ..... ;-)
>>
>> Maybe the clk_* in gpio_stm32 is the problem, is the gpio driver for mp1 probed by the time the led post_bind is called ? If not, maybe that's an issue.
>>
>> I'll have a look too.
> 
> Try this patch, does it "fix" it for you ?
> 
> diff --git a/arch/arm/dts/stm32mp151.dtsi b/arch/arm/dts/stm32mp151.dtsi
> index 5a2be007586..ec5cddfcf98 100644
> --- a/arch/arm/dts/stm32mp151.dtsi
> +++ b/arch/arm/dts/stm32mp151.dtsi
> @@ -70,7 +70,7 @@
>                 interrupt-parent = <&intc>;
>         };
> 
> -       clocks {
> +//     clocks {
>                 clk_hse: clk-hse {
>                         #clock-cells = <0>;
>                         compatible = "fixed-clock";
> @@ -100,7 +100,7 @@
>                         compatible = "fixed-clock";
>                         clock-frequency = <4000000>;
>                 };
> -       };
> +//     };
> 
>         thermal-zones {
>                 cpu_thermal: cpu-thermal {
> 
> If so, we need to figure out why.

With this patch, the board is booting fine 

The "led patch" is changing the order of probing of some early drivers (led, clock, gpio, pinctrl....) ..... to be continued ... ;-)


Thanks
Patrice

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] led: Configure LED default-state on boot
  2022-04-22 12:35               ` Patrice CHOTARD
@ 2022-04-22 13:14                 ` Marek Vasut
  2022-04-22 13:46                   ` Patrice CHOTARD
  0 siblings, 1 reply; 13+ messages in thread
From: Marek Vasut @ 2022-04-22 13:14 UTC (permalink / raw)
  To: Patrice CHOTARD, Sean Anderson, u-boot
  Cc: Alex Nemirovsky, Patrick Delaunay, Philippe Reynes, Simon Glass,
	Steven Lawrance

On 4/22/22 14:35, Patrice CHOTARD wrote:
> Hi Marek
> 
> On 4/22/22 13:41, Marek Vasut wrote:
>> On 4/22/22 11:02, Marek Vasut wrote:
>>> On 4/22/22 09:09, Patrice CHOTARD wrote:
>>>> Hi Sean
>>>>
>>>> On 4/22/22 02:06, Sean Anderson wrote:
>>>>> On 4/21/22 11:26 AM, Patrice CHOTARD wrote:
>>>>>>
>>>>>>
>>>>>> On 4/21/22 17:18, Marek Vasut wrote:
>>>>>>> On 4/21/22 17:09, Patrice CHOTARD wrote:
>>>>>>>> Hi Marek
>>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>>> I tested the current U-Boot master branch (22bfaa1f673ab5442dfb9778eea4c9a18dee42d0)
>>>>>>>> This patch is breaking the boot sequence on stm32mp157c-dk2.
>>>>>>>
>>>>>>> Breaking it ... how ? What happens, hang ?
>>>>>>
>>>>>> Here is the boot log :
>>>>>>
>>>>>> U-Boot SPL 2022.04-00827-g22bfaa1f67 (Apr 21 2022 - 17:22:47 +0200)
>>>>>> RAM: DDR3-DDR3L 16bits 533000kHz
>>>>>> WDT:   Started watchdog@5a002000 with servicing (32s timeout)
>>>>>>
>>>>>>
>>>>>> U-Boot 2022.04-00827-g22bfaa1f67 (Apr 21 2022 - 17:22:47 +0200)
>>>>>>
>>>>>> CPU: STM32MP157CAC Rev.B
>>>>>> Model: STMicroelectronics STM32MP157C-DK2 Discovery Board
>>>>>> Board: stm32mp1 in basic mode (st,stm32mp157c-dk2)
>>>>>> Board: MB1272 Var2.0 Rev.C-01
>>>>>> DRAM:  512 MiB
>>>>>> Clocks:
>>>>>> - MPU : 0 MHz
>>>>>> - MCU : 0 MHz
>>>>>> - AXI : 0 MHz
>>>>>> - PER : 0 MHz
>>>>>> - DDR : 0 MHz
>>>>>> clock rate is 0
>>>>>> clock rate is 0
>>>>>> clock rate is 0
>>>>>> clock rate is 0
>>>>>> clock rate is 0
>>>>>> cloc\x03
>>>>>>
>>>>>> What worried me is that all clocks are set to 0 (MPU/MCU/AXI ....)...no direct link with the led-uclass update.
>>>>>> For information, if i comment the device_probe(dev) in led_post_bind(), it avoid the hang.
>>>>>
>>>>> Can you try applying the LED patch on top of 2022.04?
>>>>> I made some clock changes recently, so it could be an interaction with that.
>>>>>
>>>>
>>>> Thanks for the tips, but unfortunately, i have the same issue when applying this patch on top of v2022.04.
>>>> I am still investigating ..... ;-)
>>>
>>> Maybe the clk_* in gpio_stm32 is the problem, is the gpio driver for mp1 probed by the time the led post_bind is called ? If not, maybe that's an issue.
>>>
>>> I'll have a look too.
>>
>> Try this patch, does it "fix" it for you ?
>>
>> diff --git a/arch/arm/dts/stm32mp151.dtsi b/arch/arm/dts/stm32mp151.dtsi
>> index 5a2be007586..ec5cddfcf98 100644
>> --- a/arch/arm/dts/stm32mp151.dtsi
>> +++ b/arch/arm/dts/stm32mp151.dtsi
>> @@ -70,7 +70,7 @@
>>                  interrupt-parent = <&intc>;
>>          };
>>
>> -       clocks {
>> +//     clocks {
>>                  clk_hse: clk-hse {
>>                          #clock-cells = <0>;
>>                          compatible = "fixed-clock";
>> @@ -100,7 +100,7 @@
>>                          compatible = "fixed-clock";
>>                          clock-frequency = <4000000>;
>>                  };
>> -       };
>> +//     };
>>
>>          thermal-zones {
>>                  cpu_thermal: cpu-thermal {
>>
>> If so, we need to figure out why.
> 
> With this patch, the board is booting fine
> 
> The "led patch" is changing the order of probing of some early drivers (led, clock, gpio, pinctrl....) ..... to be continued ... ;-)

Larger change is coming, you are on CC.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] led: Configure LED default-state on boot
  2022-04-22 13:14                 ` Marek Vasut
@ 2022-04-22 13:46                   ` Patrice CHOTARD
  2022-04-22 13:52                     ` Marek Vasut
  0 siblings, 1 reply; 13+ messages in thread
From: Patrice CHOTARD @ 2022-04-22 13:46 UTC (permalink / raw)
  To: Marek Vasut, Sean Anderson, u-boot
  Cc: Alex Nemirovsky, Patrick Delaunay, Philippe Reynes, Simon Glass,
	Steven Lawrance

Hi Marek

On 4/22/22 15:14, Marek Vasut wrote:
> On 4/22/22 14:35, Patrice CHOTARD wrote:
>> Hi Marek
>>
>> On 4/22/22 13:41, Marek Vasut wrote:
>>> On 4/22/22 11:02, Marek Vasut wrote:
>>>> On 4/22/22 09:09, Patrice CHOTARD wrote:
>>>>> Hi Sean
>>>>>
>>>>> On 4/22/22 02:06, Sean Anderson wrote:
>>>>>> On 4/21/22 11:26 AM, Patrice CHOTARD wrote:
>>>>>>>
>>>>>>>
>>>>>>> On 4/21/22 17:18, Marek Vasut wrote:
>>>>>>>> On 4/21/22 17:09, Patrice CHOTARD wrote:
>>>>>>>>> Hi Marek
>>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>>> I tested the current U-Boot master branch (22bfaa1f673ab5442dfb9778eea4c9a18dee42d0)
>>>>>>>>> This patch is breaking the boot sequence on stm32mp157c-dk2.
>>>>>>>>
>>>>>>>> Breaking it ... how ? What happens, hang ?
>>>>>>>
>>>>>>> Here is the boot log :
>>>>>>>
>>>>>>> U-Boot SPL 2022.04-00827-g22bfaa1f67 (Apr 21 2022 - 17:22:47 +0200)
>>>>>>> RAM: DDR3-DDR3L 16bits 533000kHz
>>>>>>> WDT:   Started watchdog@5a002000 with servicing (32s timeout)
>>>>>>>
>>>>>>>
>>>>>>> U-Boot 2022.04-00827-g22bfaa1f67 (Apr 21 2022 - 17:22:47 +0200)
>>>>>>>
>>>>>>> CPU: STM32MP157CAC Rev.B
>>>>>>> Model: STMicroelectronics STM32MP157C-DK2 Discovery Board
>>>>>>> Board: stm32mp1 in basic mode (st,stm32mp157c-dk2)
>>>>>>> Board: MB1272 Var2.0 Rev.C-01
>>>>>>> DRAM:  512 MiB
>>>>>>> Clocks:
>>>>>>> - MPU : 0 MHz
>>>>>>> - MCU : 0 MHz
>>>>>>> - AXI : 0 MHz
>>>>>>> - PER : 0 MHz
>>>>>>> - DDR : 0 MHz
>>>>>>> clock rate is 0
>>>>>>> clock rate is 0
>>>>>>> clock rate is 0
>>>>>>> clock rate is 0
>>>>>>> clock rate is 0
>>>>>>> cloc\x03
>>>>>>>
>>>>>>> What worried me is that all clocks are set to 0 (MPU/MCU/AXI ....)...no direct link with the led-uclass update.
>>>>>>> For information, if i comment the device_probe(dev) in led_post_bind(), it avoid the hang.
>>>>>>
>>>>>> Can you try applying the LED patch on top of 2022.04?
>>>>>> I made some clock changes recently, so it could be an interaction with that.
>>>>>>
>>>>>
>>>>> Thanks for the tips, but unfortunately, i have the same issue when applying this patch on top of v2022.04.
>>>>> I am still investigating ..... ;-)
>>>>
>>>> Maybe the clk_* in gpio_stm32 is the problem, is the gpio driver for mp1 probed by the time the led post_bind is called ? If not, maybe that's an issue.
>>>>
>>>> I'll have a look too.
>>>
>>> Try this patch, does it "fix" it for you ?
>>>
>>> diff --git a/arch/arm/dts/stm32mp151.dtsi b/arch/arm/dts/stm32mp151.dtsi
>>> index 5a2be007586..ec5cddfcf98 100644
>>> --- a/arch/arm/dts/stm32mp151.dtsi
>>> +++ b/arch/arm/dts/stm32mp151.dtsi
>>> @@ -70,7 +70,7 @@
>>>                  interrupt-parent = <&intc>;
>>>          };
>>>
>>> -       clocks {
>>> +//     clocks {
>>>                  clk_hse: clk-hse {
>>>                          #clock-cells = <0>;
>>>                          compatible = "fixed-clock";
>>> @@ -100,7 +100,7 @@
>>>                          compatible = "fixed-clock";
>>>                          clock-frequency = <4000000>;
>>>                  };
>>> -       };
>>> +//     };
>>>
>>>          thermal-zones {
>>>                  cpu_thermal: cpu-thermal {
>>>
>>> If so, we need to figure out why.
>>
>> With this patch, the board is booting fine
>>
>> The "led patch" is changing the order of probing of some early drivers (led, clock, gpio, pinctrl....) ..... to be continued ... ;-)
> 
> Larger change is coming, you are on CC.

Thanks, it fixes the issue ;-)

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] led: Configure LED default-state on boot
  2022-04-22 13:46                   ` Patrice CHOTARD
@ 2022-04-22 13:52                     ` Marek Vasut
  0 siblings, 0 replies; 13+ messages in thread
From: Marek Vasut @ 2022-04-22 13:52 UTC (permalink / raw)
  To: Patrice CHOTARD, Sean Anderson, u-boot
  Cc: Alex Nemirovsky, Patrick Delaunay, Philippe Reynes, Simon Glass,
	Steven Lawrance

On 4/22/22 15:46, Patrice CHOTARD wrote:

Hi,

[...]

>>>> If so, we need to figure out why.
>>>
>>> With this patch, the board is booting fine
>>>
>>> The "led patch" is changing the order of probing of some early drivers (led, clock, gpio, pinctrl....) ..... to be continued ... ;-)
>>
>> Larger change is coming, you are on CC.
> 
> Thanks, it fixes the issue ;-)

You're welcome.

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2022-04-22 13:52 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-03 23:23 [PATCH] led: Configure LED default-state on boot Marek Vasut
2022-04-15 12:07 ` Tom Rini
2022-04-21 15:09 ` Patrice CHOTARD
2022-04-21 15:18   ` Marek Vasut
2022-04-21 15:26     ` Patrice CHOTARD
2022-04-22  0:06       ` Sean Anderson
2022-04-22  7:09         ` Patrice CHOTARD
2022-04-22  9:02           ` Marek Vasut
2022-04-22 11:41             ` Marek Vasut
2022-04-22 12:35               ` Patrice CHOTARD
2022-04-22 13:14                 ` Marek Vasut
2022-04-22 13:46                   ` Patrice CHOTARD
2022-04-22 13:52                     ` Marek Vasut

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.