led: introduce LED boot and activity function
v5 cover led: introduce LED boot and activity function
This series is a reworked version of the previous seried:
misc: introduce STATUS LED activity function
This series port and expand the legacy concept of LED boot from the legacy Status LED API to new LED API.
One thing that many device need is a way to communicate to the user that the device is actually doing something.
This is especially useful for recovery steps where an user (for example) insert an USB drive, keep a button pressed and the device autorecover.
There is currently no way to signal the user externally that the bootloader is processing/recoverying aside from setting a LED on.
A solid LED on is not enough and won't actually signal any kind of progress.
Solution is the good old blinking LED but uboot doesn't suggest (and support) interrupts and almost all the LED are usually GPIO LED that doesn't support HW blink.
Additional Kconfg are also introduced to set the LED boot and activity. Those are referenced by label.
A documentation for old and these new LED API is created.
(world tested with the azure pipeline)
Changes v5:
- Use led_get_by_label and don't cache led dev
- Improve Kconfig for /options location
- Add Reviewed-by tags
- Enable blink also on MTD read
- Drop additional get_state in led_sw_on_state_change from v4 Changes v4:
- Drop led_set_state/period_by_label
- Switch to /options/u-boot
- Rework to cache label and dev in led uclass
- Add multiple patch for additional helper
- Rework patches to limit ifdef in some place Changes v3:
- Switch to /config property
Changes v2:
- Drop GPIO SW implementation
- Add fix for new LED SW BLINK
Christian Marangi (11):
led: toggle LED on initial SW blink
dm: core: implement ofnode_options helpers
led: implement LED boot API
common: board_r: rework BOOT LED handling
led: implement LED activity API
tftp: implement support for LED activity
mtd: implement support for LED activity
ubi: implement support for LED activity
doc: introduce led.rst documentation
test: dm: Add tests for LED boot and activity
test: dm: Expand ofnode options test with new helper
arch/sandbox/dts/test.dts | 5 ++ cmd/mtd.c | 9 +++ cmd/ubi.c | 13 ++- common/board_r.c | 28 +++++-- doc/api/index.rst | 1 + doc/api/led.rst | 10 +++ drivers/core/ofnode.c | 33 ++++++++ drivers/led/Kconfig | 24 ++++++ drivers/led/led-uclass.c | 162 +++++++++++++++++++++++++++++++++++++ drivers/led/led_sw_blink.c | 17 +++- include/dm/ofnode.h | 41 ++++++++++ include/led.h | 147 ++++++++++++++++++++++++++++++++- include/status_led.h | 13 +++ net/net.c | 4 + net/tftp.c | 5 ++ test/dm/led.c | 72 +++++++++++++++++ test/dm/ofnode.c | 9 +++ 17 files changed, 579 insertions(+), 14 deletions(-) create mode 100644 doc/api/led.rst
Signature · 1 line
2.45.2
PATCH v5 1/11 led: toggle LED on initial SW blink
We currently init the LED OFF when SW blink is triggered when on_state_change() is called. This can be problematic for very short period as the ON/OFF blink might never trigger.
Toggle the LED (ON if OFF, OFF if ON) on initial SW blink to handle this corner case and better display a LED blink from the user.
--- drivers/led/led_sw_blink.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
drivers/led/led_sw_blink.c +15 -2
@@ -103,8 +103,21 @@ bool led_sw_on_state_change(struct udevice *dev, enum led_state_t state)return false;if (state ==LEDST_BLINK ) { -/* start blinking on next led_sw_blink() call */ - sw_blink->state =LED_SW_BLINK_ST_OFF ; +struct led_ops *ops =led_get_ops (dev); + +/* +* toggle LED initially and start blinking on next +* led_sw_blink() call. +*/ +switch (ops->get_state (dev)) { +case LEDST_ON : + ops->set_state (dev,LEDST_OFF ); + sw_blink->state =LED_SW_BLINK_ST_OFF ; +default : + ops->set_state (dev,LEDST_ON ); + sw_blink->state =LED_SW_BLINK_ST_ON ; + } +return true; }
Signature · 1 line
2.45.2
Re: [PATCH v5 01/11] led: toggle LED on initial SW blink
Quoted 5 lines · Christian Marangi
We currently init the LED OFF when SW blink is triggered when
on_state_change()is called. This can be problematic for very short period as the ON/OFF blink might never trigger.
Quoted 7 lines
Toggle the LED (ON if OFF, OFF if ON) on initial SW blink to handle this corner case and better display a LED blink from the user.
Signed-off-by Christian Marangi <[email protected]>--- drivers/led/led_sw_blink.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
Running a little bit blind here without a changelog. If you use patman it will do this automatically.
Re: [PATCH v5 01/11] led: toggle LED on initial SW blink
Quoted 14 lines · Simon Glass
Quoted 5 lines · Christian Marangi
We currently init the LED OFF when SW blink is triggered when
on_state_change()is called. This can be problematic for very short period as the ON/OFF blink might never trigger.Quoted 7 lines
Toggle the LED (ON if OFF, OFF if ON) on initial SW blink to handle this corner case and better display a LED blink from the user.
Signed-off-by Christian Marangi <[email protected]>--- drivers/led/led_sw_blink.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
Quoted 4 lines
Reviewed-by Simon Glass <[email protected]>Running a little bit blind here without a changelog. If you use patman it will do this automatically.
The cover letter didn't slip in the mailing list? Changelog is there or I'm missing something?
Signature · 1 line
Ansuel
Re: [PATCH v5 01/11] led: toggle LED on initial SW blink
In reply to Christian MarangiHi
Quoted 29 lines · Christian Marangi
We currently init the LED OFF when SW blink is triggered when
on_state_change()is called. This can be problematic for very short period as the ON/OFF blink might never trigger.Toggle the LED (ON if OFF, OFF if ON) on initial SW blink to handle this corner case and better display a LED blink from the user.
Signed-off-by Christian Marangi <[email protected]>--- drivers/led/led_sw_blink.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)drivers/led/led_sw_blink.c +6
-2@@ -103,8 +103,21 @@ bool led_sw_on_state_change(struct udevice *dev, enum led_state_t state)return false;if (state ==LEDST_BLINK ) { -/* start blinking on next led_sw_blink() call */ - sw_blink->state =LED_SW_BLINK_ST_OFF ; +struct led_ops *ops =led_get_ops (dev); + +/* +* toggle LED initially and start blinking on next +* led_sw_blink() call. +*/
drivers/led/led_sw_blink.c bool led_sw_on_state_change(struct udevice *dev, enum led_state_t state) · line 121
Quoted 10 lines
drivers/led/led_sw_blink.c +9
-0+switch (ops->get_state (dev)) { +case LEDST_ON : + ops->set_state (dev,LEDST_OFF ); + sw_blink->state =LED_SW_BLINK_ST_OFF ; +default : + ops->set_state (dev,LEDST_ON ); + sw_blink->state =LED_SW_BLINK_ST_ON ; + } +return true;
I think here error is not take in account. Is somenthing that we should care? and if not we should
warning the user?
Apart of that
michael
Quoted 5 lines
drivers/led/led_sw_blink.c +0
-1} --2.45.2
Signature · 11 lines
Michael Nazzareno Trimarchi Co-Founder & Chief Executive Officer M. +39 347 913 2170 [email protected] __________________________________ Amarula Solutions BV Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 [email protected] www.amarulasolutions.com
Re: [PATCH v5 01/11] led: toggle LED on initial SW blink
Quoted 38 lines · Michael Nazzareno Trimarchi
Hi
Quoted 35 lines · Christian Marangi
We currently init the LED OFF when SW blink is triggered when
on_state_change()is called. This can be problematic for very short period as the ON/OFF blink might never trigger.Toggle the LED (ON if OFF, OFF if ON) on initial SW blink to handle this corner case and better display a LED blink from the user.
Signed-off-by Christian Marangi <[email protected]>--- drivers/led/led_sw_blink.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)drivers/led/led_sw_blink.c +12
-2@@ -103,8 +103,21 @@ bool led_sw_on_state_change(struct udevice *dev, enum led_state_t state)return false;if (state ==LEDST_BLINK ) { -/* start blinking on next led_sw_blink() call */ - sw_blink->state =LED_SW_BLINK_ST_OFF ; +struct led_ops *ops =led_get_ops (dev); + +/* +* toggle LED initially and start blinking on next +* led_sw_blink() call. +*/ +switch (ops->get_state (dev)) { +case LEDST_ON : + ops->set_state (dev,LEDST_OFF ); + sw_blink->state =LED_SW_BLINK_ST_OFF ; +default : + ops->set_state (dev,LEDST_ON );
Quoted 8 lines
drivers/led/led_sw_blink.c bool led_sw_on_state_change(struct udevice *dev, enum led_state_t state) · line 121
Quoted 4 lines
drivers/led/led_sw_blink.c +3
-0+ sw_blink->state =LED_SW_BLINK_ST_ON ; + } +return true;I think here error is not take in account. Is somenthing that we should care? and if not we should
warning the user?
Yes it's intended. Here it's assumed these function works and are present. The check are already done before calling the on_state_change.
Quoted 25 lines
Apart of that
Reviewed-by Michael Trimarchi <[email protected]>michael
Quoted 5 lines
drivers/led/led_sw_blink.c +0
-1} --2.45.2
Signature · 11 lines
Michael Nazzareno Trimarchi Co-Founder & Chief Executive Officer M. +39 347 913 2170 [email protected] __________________________________ Amarula Solutions BV Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 [email protected] www.amarulasolutions.com
Signature · 1 line
Ansuel
PATCH v5 2/11 dm: core: implement ofnode_options helpers
In reply to Christian MarangiImplement ofnode_options helpers to read options in /options/u-boot to adapt to the new way to declare options as described in [1].
[1] dtschema/schemas/options/u-boot.yaml
--- drivers/core/ofnode.c | 33 +++++++++++++++++++++++++++++++++ include/dm/ofnode.h | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+)
drivers/core/ofnode.c +33 -0
@@ -1734,6 +1734,39 @@ const char *ofnode_conf_read_str(const char *prop_name)return ofnode_read_string (node, prop_name); } +bool ofnode_options_read_bool (const char *prop_name) +{ +ofnode uboot; + + uboot =ofnode_path ("/options/u-boot" ); +if (!ofnode_valid (uboot)) +return false; + +return ofnode_read_bool (uboot, prop_name); +} + +int ofnode_options_read_int (const char *prop_name,int default_val) +{ +ofnode uboot; + + uboot =ofnode_path ("/options/u-boot" ); +if (!ofnode_valid (uboot)) +return default_val; + +return ofnode_read_u32_default (uboot, prop_name, default_val); +} + +const char *ofnode_options_read_str (const char *prop_name) +{ +ofnode uboot; + + uboot =ofnode_path ("/options/u-boot" ); +if (!ofnode_valid (uboot)) +return NULL ; + +return ofnode_read_string (uboot, prop_name); +} +int ofnode_read_bootscript_address (u64 *bootscr_address,u64 *bootscr_offset) {int ret;
include/dm/ofnode.h +41 -0
47 lines not on this page · raw message
Signature · 1 line
2.45.2
PATCH v5 3/11 led: implement LED boot API
In reply to Christian MarangiImplement LED boot API to signal correct boot of the system.
led_boot_on/off/blink() are introduced to turn ON, OFF and BLINK the designated boot LED.
New Kconfig is introduced, CONFIG_LED_BOOT to enable the feature. This makes use of the /options/u-boot property "boot-led" to the define the boot LED.
It's also introduced a new /options/u-boot property "boot-led-period" to define the default period when the LED is set to blink mode.
If "boot-led-period" is not defined, the value of 250 (ms) is used by default.
If CONFIG_LED_BLINK or CONFIG_LED_SW_BLINK is not enabled, led_boot_blink call will fallback to simple LED ON.
To cache the data we repurpose the now unused led_uc_priv for storage of global LED uclass info.
--- drivers/led/Kconfig | 11 ++++++ drivers/led/led-uclass.c | 85 ++++++++++++++++++++++++++++++++++++++++ include/led.h | 55 +++++++++++++++++++++++++- 3 files changed, 149 insertions(+), 2 deletions(-)
drivers/led/Kconfig +11 -0
@@ -9,6 +9,17 @@ config LED can provide access to board-specific LEDs. Use of the device tree for configuration is encouraged. +config LED_BOOT + bool "Enable LED boot support" + help + Enable LED boot support. + + LED boot is a specific LED assigned to signal boot operation status. + Defined in Device Tree /options/u-boot node. Refer here for the supported + options [1]. + + [1] dtschema/schemas/options/u-boot.yaml + config LED_BCM6328 bool "LED Support for BCM6328" depends on LED && ARCH_BMIPS
drivers/led/led-uclass.c +85 -0
101 lines not on this page · raw message
include/led.h +53 -2
73 lines not on this page · raw message
Signature · 1 line
2.45.2
Re: [PATCH v5 03/11] led: implement LED boot API
Quoted 11 lines · Christian Marangi
Implement LED boot API to signal correct boot of the system.
led_boot_on/off/blink() are introduced to turn ON, OFF and BLINK the designated boot LED.
New
Kconfigis introduced,CONFIG_LED_BOOTto enable the feature. This makes use of the /options/u-boot property "boot-led" to the define the boot LED.
It's also introduced a new /options/u-boot property "boot-led-period" to define the default period when the LED is set to blink mode.
BTW could you please send a schema update for this so that Linux accepts it?
Quoted 10 lines
If "boot-led-period" is not defined, the value of 250 (ms) is used by default.
If
CONFIG_LED_BLINKorCONFIG_LED_SW_BLINKis not enabled,led_boot_blinkcall will fallback to simple LED ON.To cache the data we repurpose the now unused
led_uc_privfor storage of global LED uclass info.
Quoted 7 lines
Signed-off-by Christian Marangi <[email protected]>--- drivers/led/Kconfig | 11 ++++++ drivers/led/led-uclass.c | 85 ++++++++++++++++++++++++++++++++++++++++ include/led.h | 55 +++++++++++++++++++++++++- 3 files changed, 149 insertions(+), 2 deletions(-)
Re: [PATCH v5 03/11] led: implement LED boot API
Quoted 7 lines · Simon Glass
Quoted 6 lines · Christian Marangi
Implement LED boot API to signal correct boot of the system.
led_boot_on/off/blink() are introduced to turn ON, OFF and BLINK the designated boot LED.
Quoted 8 lines
Quoted 5 lines
New
Kconfigis introduced,CONFIG_LED_BOOTto enable the feature. This makes use of the /options/u-boot property "boot-led" to the define the boot LED.
It's also introduced a new /options/u-boot property "boot-led-period" to define the default period when the LED is set to blink mode.BTW could you please send a schema update for this so that Linux accepts it?
I open a PR there [1] or should I use other way?
[1] https://github.com/devicetree-org/dt-schema/pull/144
Quoted 19 lines
Quoted 10 lines
If "boot-led-period" is not defined, the value of 250 (ms) is used by default.
If
CONFIG_LED_BLINKorCONFIG_LED_SW_BLINKis not enabled,led_boot_blinkcall will fallback to simple LED ON.To cache the data we repurpose the now unused
led_uc_privfor storage of global LED uclass info.Quoted 7 lines
Signed-off-by Christian Marangi <[email protected]>--- drivers/led/Kconfig | 11 ++++++ drivers/led/led-uclass.c | 85 ++++++++++++++++++++++++++++++++++++++++ include/led.h | 55 +++++++++++++++++++++++++- 3 files changed, 149 insertions(+), 2 deletions(-)Reviewed-by Simon Glass <[email protected]>
Signature · 1 line
Ansuel
Re: [PATCH v5 03/11] led: implement LED boot API
Hi Christian,
Quoted 15 lines · Christian Marangi
Quoted 13 lines · Simon Glass
Quoted 11 lines · Christian Marangi
Implement LED boot API to signal correct boot of the system.
led_boot_on/off/blink() are introduced to turn ON, OFF and BLINK the designated boot LED.
New
Kconfigis introduced,CONFIG_LED_BOOTto enable the feature. This makes use of the /options/u-boot property "boot-led" to the define the boot LED.
It's also introduced a new /options/u-boot property "boot-led-period" to define the default period when the LED is set to blink mode.
Quoted 6 lines
Quoted 2 lines
BTW could you please send a schema update for this so that Linux accepts it?
I open a PR there [1] or should I use other way?
Well I see others getting merged, so yes that seems to be fine. I have only ever used the mailing list myself.
Regards,
SImon
Quoted 23 lines
Quoted 19 lines
Quoted 11 lines
If "boot-led-period" is not defined, the value of 250 (ms) is used by default.
If
CONFIG_LED_BLINKorCONFIG_LED_SW_BLINKis not enabled,led_boot_blinkcall will fallback to simple LED ON.To cache the data we repurpose the now unused
led_uc_privfor storage of global LED uclass info.Quoted 7 lines
Signed-off-by Christian Marangi <[email protected]>--- drivers/led/Kconfig | 11 ++++++ drivers/led/led-uclass.c | 85 ++++++++++++++++++++++++++++++++++++++++ include/led.h | 55 +++++++++++++++++++++++++- 3 files changed, 149 insertions(+), 2 deletions(-)Quoted 1 line
Reviewed-by Simon Glass <[email protected]>--
Ansuel
Re: [PATCH v5 03/11] led: implement LED boot API
In reply to Simon GlassHi Christian,
Quoted 8 lines · Simon Glass
Quoted 6 lines · Christian Marangi
Implement LED boot API to signal correct boot of the system.
led_boot_on/off/blink() are introduced to turn ON, OFF and BLINK the designated boot LED.
Quoted 7 lines
Quoted 5 lines
New
Kconfigis introduced,CONFIG_LED_BOOTto enable the feature. This makes use of the /options/u-boot property "boot-led" to the define the boot LED.
It's also introduced a new /options/u-boot property "boot-led-period" to define the default period when the LED is set to blink mode.BTW could you please send a schema update for this so that Linux accepts it?
I'm just checking that you did this?
Quoted 19 lines
Quoted 11 lines
If "boot-led-period" is not defined, the value of 250 (ms) is used by default.
If
CONFIG_LED_BLINKorCONFIG_LED_SW_BLINKis not enabled,led_boot_blinkcall will fallback to simple LED ON.To cache the data we repurpose the now unused
led_uc_privfor storage of global LED uclass info.Quoted 7 lines
Signed-off-by Christian Marangi <[email protected]>--- drivers/led/Kconfig | 11 ++++++ drivers/led/led-uclass.c | 85 ++++++++++++++++++++++++++++++++++++++++ include/led.h | 55 +++++++++++++++++++++++++- 3 files changed, 149 insertions(+), 2 deletions(-)
Quoted 1 line
Reviewed-by Simon Glass <[email protected]>
Regards,
Simon
Re: [PATCH v5 03/11] led: implement LED boot API
Quoted 17 lines · Simon Glass
Hi Christian,
Quoted 14 lines · Simon Glass
Quoted 11 lines · Christian Marangi
Implement LED boot API to signal correct boot of the system.
led_boot_on/off/blink() are introduced to turn ON, OFF and BLINK the designated boot LED.
New
Kconfigis introduced,CONFIG_LED_BOOTto enable the feature. This makes use of the /options/u-boot property "boot-led" to the define the boot LED.
It's also introduced a new /options/u-boot property "boot-led-period" to define the default period when the LED is set to blink mode.
Quoted 4 lines
Quoted 1 line
BTW could you please send a schema update for this so that Linux accepts it?
I'm just checking that you did this?
Yep [0]. Also tagged Rob 2 hours ago. (eh the coincidence)
Tell me if I should send it with usual way with a dedicated mail. (any hint on the mailing-list address?)
[0] https://github.com/devicetree-org/dt-schema/pull/144
Quoted 23 lines
Quoted 19 lines
Quoted 11 lines
If "boot-led-period" is not defined, the value of 250 (ms) is used by default.
If
CONFIG_LED_BLINKorCONFIG_LED_SW_BLINKis not enabled,led_boot_blinkcall will fallback to simple LED ON.To cache the data we repurpose the now unused
led_uc_privfor storage of global LED uclass info.Quoted 7 lines
Signed-off-by Christian Marangi <[email protected]>--- drivers/led/Kconfig | 11 ++++++ drivers/led/led-uclass.c | 85 ++++++++++++++++++++++++++++++++++++++++ include/led.h | 55 +++++++++++++++++++++++++- 3 files changed, 149 insertions(+), 2 deletions(-)Quoted 1 line
Reviewed-by Simon Glass <[email protected]>Regards,
Simon
Signature · 1 line
Ansuel
Re: [PATCH v5 03/11] led: implement LED boot API
Hi Christian,
Quoted 21 lines · Christian Marangi
Quoted 19 lines · Simon Glass
Hi Christian,
Quoted 15 lines · Simon Glass
Quoted 11 lines · Christian Marangi
Implement LED boot API to signal correct boot of the system.
led_boot_on/off/blink() are introduced to turn ON, OFF and BLINK the designated boot LED.
New
Kconfigis introduced,CONFIG_LED_BOOTto enable the feature. This makes use of the /options/u-boot property "boot-led" to the define the boot LED.
It's also introduced a new /options/u-boot property "boot-led-period" to define the default period when the LED is set to blink mode.BTW could you please send a schema update for this so that Linux accepts it?
Quoted 7 lines
Quoted 2 lines
I'm just checking that you did this?
Yep [0]. Also tagged Rob 2 hours ago. (eh the coincidence)
Tell me if I should send it with usual way with a dedicated mail. (any hint on the mailing-list address?)
OK great! Yes, once it lands, please send a patch to bring it into U-Boot
Regards,
Simon
Quoted 1 line
Re: [PATCH v5 03/11] led: implement LED boot API
Quoted 29 lines · Simon Glass
Hi Christian,
Quoted 26 lines · Christian Marangi
Quoted 17 lines · Simon Glass
Hi Christian,
Quoted 14 lines · Simon Glass
Quoted 11 lines · Christian Marangi
Implement LED boot API to signal correct boot of the system.
led_boot_on/off/blink() are introduced to turn ON, OFF and BLINK the designated boot LED.
New
Kconfigis introduced,CONFIG_LED_BOOTto enable the feature. This makes use of the /options/u-boot property "boot-led" to the define the boot LED.
It's also introduced a new /options/u-boot property "boot-led-period" to define the default period when the LED is set to blink mode.Quoted 4 lines
Quoted 1 line
BTW could you please send a schema update for this so that Linux accepts it?
I'm just checking that you did this?
Yep [0]. Also tagged Rob 2 hours ago. (eh the coincidence)
Quoted 9 lines
Quoted 2 lines
Tell me if I should send it with usual way with a dedicated mail. (any hint on the mailing-list address?)
OK great! Yes, once it lands, please send a patch to bring it into U-Boot
Regards,
SimonQuoted 1 line
I'm confused what kind of patch I should send to U-Boot?
Signature · 1 line
Ansuel
Re: [PATCH v5 03/11] led: implement LED boot API
Hi Christian,
Quoted 34 lines · Christian Marangi
Quoted 32 lines · Simon Glass
Hi Christian,
Quoted 28 lines · Christian Marangi
Quoted 17 lines · Simon Glass
Hi Christian,
Quoted 14 lines · Simon Glass
Quoted 11 lines · Christian Marangi
Implement LED boot API to signal correct boot of the system.
led_boot_on/off/blink() are introduced to turn ON, OFF and BLINK the designated boot LED.
New
Kconfigis introduced,CONFIG_LED_BOOTto enable the feature. This makes use of the /options/u-boot property "boot-led" to the define the boot LED.
It's also introduced a new /options/u-boot property "boot-led-period" to define the default period when the LED is set to blink mode.Quoted 4 lines
Quoted 1 line
BTW could you please send a schema update for this so that Linux accepts it?
I'm just checking that you did this?
Yep [0]. Also tagged Rob 2 hours ago. (eh the coincidence)
Tell me if I should send it with usual way with a dedicated mail. (any hint on the mailing-list address?)
Quoted 8 lines
Quoted 6 lines
OK great! Yes, once it lands, please send a patch to bring it into U-Boot
Regards,
SimonQuoted 1 line
I'm confused what kind of patch I should send to U-Boot?
Something to add the binding to U-Boot also. See my patch at [1]
Regards,
Simon
[1] https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
Re: [PATCH v5 03/11] led: implement LED boot API
Quoted 44 lines · Simon Glass
Hi Christian,
Quoted 41 lines · Christian Marangi
Quoted 38 lines · Simon Glass
Hi Christian,
Quoted 21 lines · Christian Marangi
Quoted 19 lines · Simon Glass
Hi Christian,
Quoted 15 lines · Simon Glass
Quoted 11 lines · Christian Marangi
Implement LED boot API to signal correct boot of the system.
led_boot_on/off/blink() are introduced to turn ON, OFF and BLINK the designated boot LED.
New
Kconfigis introduced,CONFIG_LED_BOOTto enable the feature. This makes use of the /options/u-boot property "boot-led" to the define the boot LED.
It's also introduced a new /options/u-boot property "boot-led-period" to define the default period when the LED is set to blink mode.BTW could you please send a schema update for this so that Linux accepts it?
Quoted 7 lines
Quoted 2 lines
I'm just checking that you did this?
Yep [0]. Also tagged Rob 2 hours ago. (eh the coincidence)
Tell me if I should send it with usual way with a dedicated mail. (any hint on the mailing-list address?)
OK great! Yes, once it lands, please send a patch to bring it into U-Boot
Regards,
SimonQuoted 1 line
Quoted 8 lines
Quoted 1 line
I'm confused what kind of patch I should send to U-Boot?
Something to add the binding to U-Boot also. See my patch at [1]
Regards,
Simon[1] https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
Ok thanks for the hint.
Anyway Rob checked the patch (good news) but he request some changes (bad news)
I created this PR [1] waiting for CI to confirm everything is ok.
Would be good if you can check the changes while CI tests.
[1] https://github.com/u-boot/u-boot/pull/686
Signature · 1 line
Ansuel
Re: [PATCH v5 03/11] led: implement LED boot API
Hi Christian,
Quoted 55 lines · Christian Marangi
Quoted 44 lines · Simon Glass
Hi Christian,
Quoted 41 lines · Christian Marangi
Quoted 38 lines · Simon Glass
Hi Christian,
Quoted 21 lines · Christian Marangi
Quoted 19 lines · Simon Glass
Hi Christian,
Quoted 15 lines · Simon Glass
Quoted 11 lines · Christian Marangi
Implement LED boot API to signal correct boot of the system.
led_boot_on/off/blink() are introduced to turn ON, OFF and BLINK the designated boot LED.
New
Kconfigis introduced,CONFIG_LED_BOOTto enable the feature. This makes use of the /options/u-boot property "boot-led" to the define the boot LED.
It's also introduced a new /options/u-boot property "boot-led-period" to define the default period when the LED is set to blink mode.BTW could you please send a schema update for this so that Linux accepts it?
Quoted 7 lines
Quoted 2 lines
I'm just checking that you did this?
Yep [0]. Also tagged Rob 2 hours ago. (eh the coincidence)
Tell me if I should send it with usual way with a dedicated mail. (any hint on the mailing-list address?)
OK great! Yes, once it lands, please send a patch to bring it into U-Boot
Regards,
SimonQuoted 1 line
Quoted 8 lines
Quoted 1 line
I'm confused what kind of patch I should send to U-Boot?
Something to add the binding to U-Boot also. See my patch at [1]
Regards,
Simon[1] https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
Quoted 8 lines
Ok thanks for the hint.
Anyway Rob checked the patch (good news) but he request some changes (bad news)
I created this PR [1] waiting for CI to confirm everything is ok.
Would be good if you can check the changes while CI tests.
A few things:
- Better to return -ENOENT or -EINVAL if something is missing, since we use -ENODEV in driver model to mean there is no device
- 'nodep' instead of 'node' for the parameter, so it is clear that it is returned
Otherwise it looks good to me (with the proviso that's I'm just looking at an emphemal github link!)
Regards,
Simon
Quoted 5 lines
[1] https://github.com/u-boot/u-boot/pull/686
--
Ansuel
Re: [PATCH v5 03/11] led: implement LED boot API
Quoted 67 lines · Simon Glass
Hi Christian,
Quoted 55 lines · Christian Marangi
Quoted 44 lines · Simon Glass
Hi Christian,
Quoted 41 lines · Christian Marangi
Quoted 38 lines · Simon Glass
Hi Christian,
Quoted 21 lines · Christian Marangi
Quoted 19 lines · Simon Glass
Hi Christian,
Quoted 15 lines · Simon Glass
Quoted 11 lines · Christian Marangi
Implement LED boot API to signal correct boot of the system.
led_boot_on/off/blink() are introduced to turn ON, OFF and BLINK the designated boot LED.
New
Kconfigis introduced,CONFIG_LED_BOOTto enable the feature. This makes use of the /options/u-boot property "boot-led" to the define the boot LED.
It's also introduced a new /options/u-boot property "boot-led-period" to define the default period when the LED is set to blink mode.BTW could you please send a schema update for this so that Linux accepts it?
Quoted 7 lines
Quoted 2 lines
I'm just checking that you did this?
Yep [0]. Also tagged Rob 2 hours ago. (eh the coincidence)
Tell me if I should send it with usual way with a dedicated mail. (any hint on the mailing-list address?)
OK great! Yes, once it lands, please send a patch to bring it into U-Boot
Regards,
SimonQuoted 1 line
Quoted 8 lines
Quoted 1 line
I'm confused what kind of patch I should send to U-Boot?
Something to add the binding to U-Boot also. See my patch at [1]
Regards,
Simon[1] https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
Quoted 8 lines
Ok thanks for the hint.
Anyway Rob checked the patch (good news) but he request some changes (bad news)
I created this PR [1] waiting for CI to confirm everything is ok.
Would be good if you can check the changes while CI tests.
Quoted 9 lines
A few things:
- Better to return-ENOENTor-EINVALif something is missing, since we use-ENODEVin driver model to mean there is no device
- 'nodep' instead of 'node' for the parameter, so it is clear that it is returnedOtherwise it looks good to me (with the proviso that's I'm just looking at an emphemal github link!)
Thanks a lot. Fighting a bit with the tests but thanks for the feedback.
Quoted 6 lines
Quoted 6 lines
[1] https://github.com/u-boot/u-boot/pull/686
--
Ansuel
Signature · 1 line
Ansuel
PATCH v5 4/11 common: board_r: rework BOOT LED handling
In reply to Christian MarangiRework BOOT LED handling. There is currently one legacy implementation for BOOT LED from Status Led API.
This work on ancient implementation used by BOOTP by setting the LED to Blink on boot and to turn it OFF when the firmware was correctly received by network.
Now that we new LED implementation have support for LED boot, rework this by also set the new BOOT LED to blink and also set it to ON before entering main loop to confirm successful boot.
--- common/board_r.c | 28 ++++++++++++++++++++-------- include/status_led.h | 13 +++++++++++++ 2 files changed, 33 insertions(+), 8 deletions(-)
common/board_r.c +20 -8
@@ -39,6 +39,7 @@#include <initcall.h> #include <kgdb.h> #include <irq_func.h> +#include <led.h> #include <malloc.h> #include <mapmem.h> #include <miiphy.h>
@@ -459,17 +460,28 @@ static int initr_malloc_bootparams(void) }#endif -#if defined(CONFIG_LED_STATUS )static int initr_status_led (void ) { -#if defined(CONFIG_LED_STATUS_BOOT ) -status_led_set (CONFIG_LED_STATUS_BOOT ,CONFIG_LED_STATUS_BLINKING ); -#else status_led_init (); -#endif + +return 0 ; +} + +static int initr_boot_led_blink (void ) +{ +status_led_boot_blink (); + +led_boot_blink (); + +return 0 ; +} + +static int initr_boot_led_on (void ) +{ +led_boot_on (); +return 0 ; } -#endif #ifdef CONFIG_CMD_NET static int initr_net (void )
@@ -713,9 +725,8 @@ static init_fnc_t init_sequence_r[] = {#if defined(CONFIG_MICROBLAZE ) || defined(CONFIG_M68K ) timer_init,/* initialize timer */ #endif -#if defined(CONFIG_LED_STATUS ) initr_status_led, -#endif + initr_boot_led_blink,/* PPC has a udelay(20) here dating from 2002. Why? */ #ifdef CONFIG_BOARD_LATE_INIT board_late_init,
@@ -738,6 +749,7 @@ static init_fnc_t init_sequence_r[] = {#if defined(CFG_PRAM ) initr_mem, #endif + initr_boot_led_on, run_main_loop, };
include/status_led.h +13 -0
@@ -39,6 +39,13 @@ void status_led_init(void);void status_led_tick (unsigned long timestamp);void status_led_set (int led,int state); +static inline void status_led_boot_blink (void ) +{ +#ifdef CONFIG_LED_STATUS_BOOT_ENABLE +status_led_set (CONFIG_LED_STATUS_BOOT ,CONFIG_LED_STATUS_BLINKING ); +#endif +} +/***** MVS v1 **********************************************************/ #if (defined(CONFIG_MVS ) &&CONFIG_MVS <2 )# define STATUS_LED_PAR im_ioport.iop_pdpar
@@ -72,6 +79,12 @@ void __led_blink(led_id_t mask, int freq);# include <asm/status_led.h> #endif +#else + +static inline void status_led_init (void ) { } +static inline void status_led_set (int led,int state) { } +static inline void status_led_boot_blink (void ) { } +#endif /* CONFIG_LED_STATUS */ /*
Signature · 1 line
2.45.2
PATCH v5 5/11 led: implement LED activity API
In reply to Christian MarangiImplement LED activity API similar to BOOT LED API.
Usual activity might be a file transfer with TFTP, a flash write...
User of this API will call led_activity_on/off/blink() to signal these kind of activity.
New Kconfig is implemented similar to BOOT LED, LED_ACTIVITY to enable support for it.
It's introduced a new /options/u-boot property "activity-led" and "activity-led-period" to define the activity LED label and the default period when the activity LED is set to blink mode.
If "activity-led-period" is not defined, the value of 250 (ms) is used by default.
If CONFIG_LED_BLINK or CONFIG_LED_SW_BLINK is not enabled, led_boot_blink call will fallback to simple LED ON.
--- drivers/led/Kconfig | 13 +++++++ drivers/led/led-uclass.c | 81 +++++++++++++++++++++++++++++++++++++++- include/led.h | 51 +++++++++++++++++++++++++ 3 files changed, 143 insertions(+), 2 deletions(-)
drivers/led/Kconfig +13 -0
@@ -20,6 +20,19 @@ config LED_BOOT [1] dtschema/schemas/options/u-boot.yaml +config LED_ACTIVITY + bool "Enable LED activity support" + help + Enable LED activity support. + + LED activity is a specific LED assigned to signal activity operation + like file trasnfer, flash write/erase... + + Defined in Device Tree /options/u-boot node. Refer here for the supported + options [1]. + + [1] dtschema/schemas/options/u-boot.yaml + config LED_BCM6328 bool "LED Support for BCM6328" depends on LED && ARCH_BMIPS
drivers/led/led-uclass.c +79 -2
105 lines not on this page · raw message
include/led.h +51 -0
69 lines not on this page · raw message
Signature · 1 line
2.45.2
Re: [PATCH v5 05/11] led: implement LED activity API
Quoted 21 lines · Christian Marangi
Implement LED activity API similar to BOOT LED API.
Usual activity might be a file transfer with TFTP, a flash write...
User of this API will call led_activity_on/off/blink() to signal these kind of activity.
New
Kconfigis implemented similar to BOOT LED,LED_ACTIVITYto enable support for it.It's introduced a new /options/u-boot property "activity-led" and "activity-led-period" to define the activity LED label and the default period when the activity LED is set to blink mode.
If "activity-led-period" is not defined, the value of 250 (ms) is used by default.
If
CONFIG_LED_BLINKorCONFIG_LED_SW_BLINKis not enabled,led_boot_blinkcall will fallback to simple LED ON.
Quoted 6 lines
Signed-off-by Christian Marangi <[email protected]>--- drivers/led/Kconfig | 13 +++++++ drivers/led/led-uclass.c | 81 +++++++++++++++++++++++++++++++++++++++- include/led.h | 51 +++++++++++++++++++++++++ 3 files changed, 143 insertions(+), 2 deletions(-)
PATCH v5 6/11 tftp: implement support for LED activity
In reply to Christian MarangiImplement support for LED activity. If the feature is enabled, make the defined ACTIVITY LED to signal traffic.
Also turn the ACTIVITY LED OFF if a CTRL-C is detected in the main net loop function.
--- net/net.c | 4 ++++ net/tftp.c | 5 +++++ 2 files changed, 9 insertions(+)
net/net.c +4 -0
@@ -87,6 +87,7 @@#include <env_internal.h> #include <errno.h> #include <image.h> +#include <led.h> #include <log.h> #include <net.h> #include <net6.h>
@@ -659,6 +660,9 @@ restart:/* Invalidate the last protocol */ eth_set_last_protocol (BOOTP ); +/* Turn off activity LED if triggered */ +led_activity_off (); +puts ("\nAbort\n" );/* include a debug print as well incase the debug messages are directed to stderr */
net/tftp.c +5 -0
@@ -10,6 +10,7 @@#include <efi_loader.h> #include <env.h> #include <image.h> +#include <led.h> #include <lmb.h> #include <log.h> #include <mapmem.h>
@@ -192,6 +193,7 @@ static void new_transfer(void)#ifdef CONFIG_CMD_TFTPPUT tftp_put_final_block_sent =0 ;#endif +led_activity_blink (); }#ifdef CONFIG_CMD_TFTPPUT
@@ -301,6 +303,9 @@ static void tftp_complete(void) time_start * 1000, "/s"); }puts ("\ndone\n" ); + +led_activity_off (); +if (!tftp_put_active) efi_set_bootdev("Net", "", tftp_filename, map_sysmem(tftp_load_addr, 0),
Signature · 1 line
2.45.2
PATCH v5 7/11 mtd: implement support for LED activity
In reply to Christian MarangiImplement support for LED activity. If the feature is enabled, make the defined ACTIVITY LED to signal mtd operations.
LED activity is implemented HERE and not in the subsystem side to limit any performance degradation in case multiple call to MTD subsystem read/write are done.
--- cmd/mtd.c | 9 +++++++++ 1 file changed, 9 insertions(+)
cmd/mtd.c +9 -0
@@ -10,6 +10,7 @@#include <command.h> #include <console.h> +#include <led.h> #if CONFIG_IS_ENABLED (CMD_MTD_OTP )#include <hexdump.h> #endif
@@ -558,6 +559,8 @@ static int do_mtd_io(struct cmd_tbl *cmdtp, int flag, int argc,while (mtd_block_isbad (mtd, off)) off += mtd->erasesize; +led_activity_blink (); +/* Loop over the pages to do the actual read/write */ while (remaining) {/* Skip the block if it is bad */
@@ -585,6 +588,8 @@ static int do_mtd_io(struct cmd_tbl *cmdtp, int flag, int argc, io_op.oobbuf += io_op.oobretlen; } +led_activity_off (); +if (!ret && dump)mtd_dump_device_buf (mtd, start_off, buf, len, woob);
@@ -652,6 +657,8 @@ static int do_mtd_erase(struct cmd_tbl *cmdtp, int flag, int argc, erase_op.addr = off; erase_op.len = mtd->erasesize; +led_activity_blink (); +while (len) {if (!scrub) { ret =mtd_block_isbad (mtd, erase_op.addr);
@@ -680,6 +687,8 @@ static int do_mtd_erase(struct cmd_tbl *cmdtp, int flag, int argc, erase_op.addr += mtd->erasesize; } +led_activity_off (); +if (ret && ret != -EIO ) ret =CMD_RET_FAILURE ;else
Signature · 1 line
2.45.2
Re: [PATCH v5 07/11] mtd: implement support for LED activity
Quoted 4 lines · Christian Marangi
Implement support for LED activity. If the feature is enabled, make the defined ACTIVITY LED to signal mtd operations.
Quoted 8 lines
LED activity is implemented HERE and not in the subsystem side to limit any performance degradation in case multiple call to MTD subsystem read/write are done.
Signed-off-by Christian Marangi <[email protected]>--- cmd/mtd.c | 9 +++++++++ 1 file changed, 9 insertions(+)
PATCH v5 8/11 ubi: implement support for LED activity
In reply to Christian MarangiImplement support for LED activity. If the feature is enabled, make the defined ACTIVITY LED to signal ubi write operation.
--- cmd/ubi.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
cmd/ubi.c +11 -2
@@ -14,6 +14,7 @@#include <command.h> #include <env.h> #include <exports.h> +#include <led.h> #include <malloc.h> #include <memalign.h> #include <mtd.h>
@@ -488,10 +489,18 @@ exit:int ubi_volume_write (char *volume,void *buf,loff_t offset,size_t size) { +int ret; + +led_activity_blink (); +if (!offset) -return ubi_volume_begin_write (volume, buf, size, size); + ret =ubi_volume_begin_write (volume, buf, size, size); +else + ret =ubi_volume_offset_write (volume, buf, offset, size); -return ubi_volume_offset_write (volume, buf, offset, size); +led_activity_off (); + +return ret; }int ubi_volume_read (char *volume,char *buf,loff_t offset,size_t size)
Signature · 1 line
2.45.2
PATCH v5 9/11 doc: introduce led.rst documentation
In reply to Christian MarangiIntroduce simple led.rst documentation to document all the additional Kconfig and the current limitation of LED_BLINK and GPIO software blink.
Also add missing definition for sw_blink in led_uc_plat struct.
--- doc/api/index.rst | 1 + doc/api/led.rst | 10 ++++++++++ include/led.h | 41 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+) create mode 100644 doc/api/led.rst
doc/api/index.rst +1 -0
@@ -14,6 +14,7 @@ U-Boot API documentation event getopt interrupt + led linker_lists lmb logging
doc/api/led.rst new file +10 -0
@@ -0,0 +1,10 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +LED +=== + +.. kernel-doc:: include/led.h + :doc: Overview + +.. kernel-doc:: include/led.h + :internal:
include/led.h +41 -0
53 lines not on this page · raw message
Signature · 1 line
2.45.2
PATCH v5 10/11 test: dm: Add tests for LED boot and activity
In reply to Christian MarangiAdd tests for LED boot and activity feature and add required property in sandbox test DTS.
--- arch/sandbox/dts/test.dts | 2 ++ test/dm/led.c | 72 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+)
arch/sandbox/dts/test.dts +2 -0
@@ -101,6 +101,8 @@ bootscr-ram-offset = /bits/ 64 <0x12345678>; bootscr-flash-offset = /bits/ 64 <0>; bootscr-flash-size = /bits/ 64 <0x2000>; + boot-led = "sandbox:green"; + activity-led = "sandbox:red"; }; };
test/dm/led.c +72 -0
75 lines not on this page · raw message
Signature · 1 line
2.45.2
PATCH v5 11/11 test: dm: Expand ofnode options test with new helper
In reply to Christian MarangiExpand ofnode options test with new generic helper for bool, int and string.
--- arch/sandbox/dts/test.dts | 3 +++ test/dm/ofnode.c | 9 +++++++++ 2 files changed, 12 insertions(+)
arch/sandbox/dts/test.dts +3 -0
@@ -103,6 +103,9 @@ bootscr-flash-size = /bits/ 64 <0x2000>; boot-led = "sandbox:green"; activity-led = "sandbox:red"; + testing-bool; + testing-int = <123>; + testing-str = "testing"; }; };
test/dm/ofnode.c +9 -0
@@ -614,6 +614,15 @@ static int dm_test_ofnode_options(struct unit_test_state *uts)u64 bootscr_address, bootscr_offset;u64 bootscr_flash_offset, bootscr_flash_size; +ut_assert (!ofnode_options_read_bool ("missing" )); +ut_assert (ofnode_options_read_bool ("testing-bool" )); + +ut_asserteq (123 ,ofnode_options_read_int ("testing-int" ,0 )); +ut_asserteq (6 ,ofnode_options_read_int ("missing" ,6 )); + +ut_assertnull (ofnode_options_read_str ("missing" )); +ut_asserteq_str ("testing" ,ofnode_options_read_str ("testing-str" )); +ut_assertok (ofnode_read_bootscript_address (&bootscr_address, &bootscr_offset));ut_asserteq_64 (0 , bootscr_address);
Signature · 1 line
2.45.2
Quoted 10 lines · Christian Marangi
This series is a reworked version of the previous seried:
misc: introduce STATUS LED activity functionThis series port and expand the legacy concept of LED boot from the legacy Status LED API to new LED API.
One thing that many device need is a way to communicate to the user that the device is actually doing something.
[...]
Applied to u-boot/master, thanks!
Signature · 1 line
Tom