Add reboot mode support
v4 cover Add reboot mode support
Description
-----------
Add support for reboot-mode configuration using GPIOs and RTC SRAM as back-end.
Testing
-------
Tested on a Zynq based board where device tree was configured to contain the reboot-mode configuration:
&amba {
status = "okay";
reboot-mode-gpio {
compatible = "reboot-mode-gpio";
gpios = <&gpio0 47 GPIO_ACTIVE_LOW>;
mode-test = <0x1>;
};
reboot-mode-rtc {
compatible = "reboot-mode-rtc";
rtc = <&rtc_0>;
reg = <0x14 4>;
mode-test = <0x21969147>;
};
};In addition to this and not part of this patchset is a change to board.c where GPIO or RTC SRAM backed is selected dynamically at runtime.
1. Test that the reboot mode configured in user-space is read in U-Boot and environment configured: PASS
Userspace ~ # reboot test
....
[ 177.335936] reboot: Restarting system with command 'test'
U-Boot SPL 2019.01 (Mar 29 2019 - 10:44:22 +0000)
...
U-Boot> print reboot-mode
reboot-mode=test
2. Reset the system using the reset command and stop in U-Boot.
3. Verify that reboot-mode env variable is not configured anymore: PASS
U-Boot> print reboot-mode
## Error: "reboot-mode" not defined
4. Toggle the GPIO configured for test mode to active and reset the system with command reset.
5. Stop in U-Boot and check that reboot-mode env variable is configured:PASS
U-Boot> print reboot-mode
reboot-mode=test
6. Verify that unit-tests are successful: PASS
``` localhost /u-boot-latest (wip-reboot-mode)> ./test/py/test.py --bd sandbox --build -k ut_dm_reboot_mode -v ... test/py/tests/test_ut.py::test_ut[ut_dm_reboot_mode_gpio] PASSED [ 50%] test/py/tests/test_ut.py::test_ut[ut_dm_reboot_mode_rtc] PASSED [100%] ========================================================== 2 passed, 759 deselected in 0.40 seconds ========================================================== ```
Changes since v1:
----------------
- rebased
Changes since v2:
----------------
- unit-tests added
Changes since v3:
----------------
- rebased
- fix the struct udevice and struct driver incompatibilities
Nandor Han (3):
reboot-mode: add support for reboot mode control
reboot-mode: read the boot mode from GPIOs status
reboot-mode: read the boot mode from RTC memory
arch/sandbox/dts/test.dts | 18 +++ configs/sandbox_defconfig | 3 + .../reboot-mode/reboot-mode-gpio.txt | 20 +++ .../reboot-mode/reboot-mode-rtc.txt | 22 +++ drivers/Kconfig | 2 + drivers/Makefile | 1 + drivers/reboot-mode/Kconfig | 36 +++++ drivers/reboot-mode/Makefile | 9 ++ drivers/reboot-mode/reboot-mode-gpio.c | 128 +++++++++++++++++ drivers/reboot-mode/reboot-mode-rtc.c | 127 +++++++++++++++++ drivers/reboot-mode/reboot-mode-uclass.c | 134 ++++++++++++++++++ include/dm/uclass-id.h | 1 + include/reboot-mode/reboot-mode-gpio.h | 32 +++++ include/reboot-mode/reboot-mode-rtc.h | 16 +++ include/reboot-mode/reboot-mode.h | 56 ++++++++ test/dm/Makefile | 1 + test/dm/reboot-mode.c | 71 ++++++++++ 17 files changed, 677 insertions(+) create mode 100644 doc/device-tree-bindings/reboot-mode/reboot-mode-gpio.txt create mode 100644 doc/device-tree-bindings/reboot-mode/reboot-mode-rtc.txt create mode 100644 drivers/reboot-mode/Kconfig create mode 100644 drivers/reboot-mode/Makefile create mode 100644 drivers/reboot-mode/reboot-mode-gpio.c create mode 100644 drivers/reboot-mode/reboot-mode-rtc.c create mode 100644 drivers/reboot-mode/reboot-mode-uclass.c create mode 100644 include/reboot-mode/reboot-mode-gpio.h create mode 100644 include/reboot-mode/reboot-mode-rtc.h create mode 100644 include/reboot-mode/reboot-mode.h create mode 100644 test/dm/reboot-mode.c
Signature · 1 line
2.26.3
PATCH v4 1/3 reboot-mode: add support for reboot mode control
A new driver uclass is created to handle the reboot mode control.
The new uclass driver is updating an environment variable with the configured reboot mode. The mode is extracted from a map provided at initialization time. The map contains a list of modes and associated ids.
--- drivers/Kconfig | 2 + drivers/Makefile | 1 + drivers/reboot-mode/Kconfig | 18 +++ drivers/reboot-mode/Makefile | 7 ++ drivers/reboot-mode/reboot-mode-uclass.c | 134 +++++++++++++++++++++++ include/dm/uclass-id.h | 1 + include/reboot-mode/reboot-mode.h | 56 ++++++++++ 7 files changed, 219 insertions(+) create mode 100644 drivers/reboot-mode/Kconfig create mode 100644 drivers/reboot-mode/Makefile create mode 100644 drivers/reboot-mode/reboot-mode-uclass.c create mode 100644 include/reboot-mode/reboot-mode.h
drivers/Kconfig +2 -0
@@ -90,6 +90,8 @@ source "drivers/qe/Kconfig" source "drivers/ram/Kconfig" +source "drivers/reboot-mode/Kconfig" + source "drivers/remoteproc/Kconfig" source "drivers/reset/Kconfig"
drivers/Makefile +1 -0
@@ -95,6 +95,7 @@ obj-y += dfu/ obj-$(CONFIG_PCH) += pch/ obj-y += phy/allwinner/ obj-y += phy/marvell/ +obj-$(CONFIG_DM_REBOOT_MODE) += reboot-mode/ obj-y += phy/rockchip/ obj-y += rtc/ obj-y += scsi/
drivers/reboot-mode/Kconfig new file +18 -0
@@ -0,0 +1,18 @@ +# +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright (c), Vaisala Oyj +# + +menu "Reboot Mode Support" + +config DM_REBOOT_MODE + bool "Enable reboot mode using Driver Model" + depends on DM + default n + help + Enable support for reboot mode control. This will allow users to + adjust the boot process based on reboot mode parameter + passed to U-Boot. + +endmenu
drivers/reboot-mode/Makefile new file +7 -0
@@ -0,0 +1,7 @@ +# +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright (c), Vaisala Oyj +# + +obj-$(CONFIG_DM_REBOOT_MODE) += reboot-mode-uclass.o
drivers/reboot-mode/reboot-mode-uclass.c new file +134 -0
134 lines not on this page · raw message
include/dm/uclass-id.h +1 -0
@@ -92,6 +92,7 @@ enum uclass_id {UCLASS_PWRSEQ ,/* Power sequence device */ UCLASS_QFW ,/* QEMU firmware config device */ UCLASS_RAM ,/* RAM controller */ +UCLASS_REBOOT_MODE ,/* Reboot mode */ UCLASS_REGULATOR ,/* Regulator device */ UCLASS_REMOTEPROC ,/* Remote Processor device */ UCLASS_RESET, /* Reset controller device */
include/reboot-mode/reboot-mode.h new file +56 -0
56 lines not on this page · raw message
Signature · 1 line
2.26.3
Re: [PATCH v4 1/3] reboot-mode: add support for reboot mode control
Quoted 9 lines · Nandor Han
A new driver uclass is created to handle the reboot mode control.
The new uclass driver is updating an environment variable with the configured reboot mode. The mode is extracted from a map provided at initialization time. The map contains a list of modes and associated ids.
Signed-off-by Nandor Han <[email protected]>
Quoted 14 lines
--- drivers/Kconfig | 2 + drivers/Makefile | 1 + drivers/reboot-mode/Kconfig | 18 +++ drivers/reboot-mode/Makefile | 7 ++ drivers/reboot-mode/reboot-mode-uclass.c | 134 +++++++++++++++++++++++ include/dm/uclass-id.h | 1 + include/reboot-mode/reboot-mode.h | 56 ++++++++++ 7 files changed, 219 insertions(+) create mode 100644 drivers/reboot-mode/Kconfig create mode 100644 drivers/reboot-mode/Makefile create mode 100644 drivers/reboot-mode/reboot-mode-uclass.c create mode 100644 include/reboot-mode/reboot-mode.h
Re: [PATCH v4 1/3] reboot-mode: add support for reboot mode control
In reply to Nandor HanQuoted 9 lines · Nandor Han
A new driver uclass is created to handle the reboot mode control.
The new uclass driver is updating an environment variable with the configured reboot mode. The mode is extracted from a map provided at initialization time. The map contains a list of modes and associated ids.
Signed-off-by Nandor Han <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom
PATCH v4 2/3 reboot-mode: read the boot mode from GPIOs status
In reply to Nandor HanA use case for controlling the boot mode is when the user wants to control the device boot by pushing a button without needing to go in user-space.
Add a new backed for reboot mode where GPIOs are used to control the reboot-mode. The driver is able to scan a predefined list of GPIOs and return the magic value. Having the modes associated with the magic value generated based on the GPIO values, allows the reboot mode uclass to select the proper mode.
--- arch/sandbox/dts/test.dts | 8 ++ configs/sandbox_defconfig | 2 + .../reboot-mode/reboot-mode-gpio.txt | 20 +++ drivers/reboot-mode/Kconfig | 9 ++ drivers/reboot-mode/Makefile | 1 + drivers/reboot-mode/reboot-mode-gpio.c | 128 ++++++++++++++++++ include/reboot-mode/reboot-mode-gpio.h | 32 +++++ test/dm/Makefile | 1 + test/dm/reboot-mode.c | 42 ++++++ 9 files changed, 243 insertions(+) create mode 100644 doc/device-tree-bindings/reboot-mode/reboot-mode-gpio.txt create mode 100644 drivers/reboot-mode/reboot-mode-gpio.c create mode 100644 include/reboot-mode/reboot-mode-gpio.h create mode 100644 test/dm/reboot-mode.c
arch/sandbox/dts/test.dts +8 -0
@@ -59,6 +59,14 @@ }; }; + reboot-mode0 { + compatible = "reboot-mode-gpio"; + gpios = <&gpio_c 0 GPIO_ACTIVE_HIGH>, <&gpio_c 1 GPIO_ACTIVE_HIGH>; + u-boot,env-variable = "bootstatus"; + mode-test = <0x01>; + mode-download = <0x03>; + }; + audio: audio-codec { compatible = "sandbox,audio-codec"; #sound-dai-cells = <1>;
configs/sandbox_defconfig +2 -0
@@ -287,3 +287,5 @@ CONFIG_TEST_FDTDEC=y CONFIG_UNIT_TEST=y CONFIG_UT_TIME=y CONFIG_UT_DM=y +CONFIG_DM_REBOOT_MODE=y +CONFIG_DM_REBOOT_MODE_GPIO=y
doc/device-tree-bindings/reboot-mode/reboot-mode-gpio.txt new file +20 -0
@@ -0,0 +1,20 @@ +GPIO Reboot Mode Configuration + +Required Properties: +- compatible: must be "reboot-mode-gpio". +- gpios: list of gpios that are used to calculate the reboot-mode magic value. + Every gpio represents a bit in the magic value in the same order + as defined in device tree. +- modes: list of properties that define the modes and associated unique ids. + +Optional Properties: +- u-boot,env-variable: used to save the reboot mode (default: reboot-mode). + +Example: + reboot-mode { + compatible = "reboot-mode-gpio"; + gpios = <&gpio1 2 GPIO_ACTIVE_LOW>, <&gpio2 6 GPIO_ACTIVE_HIGH>; + u-boot,env-variable = "bootstatus"; + mode-test = <0x00000001>; + mode-download = <0x00000002>; + };
drivers/reboot-mode/Kconfig +9 -0
@@ -15,4 +15,13 @@ config DM_REBOOT_MODE adjust the boot process based on reboot mode parameter passed to U-Boot. +config DM_REBOOT_MODE_GPIO + bool "Use GPIOs as reboot mode backend" + depends on DM_REBOOT_MODE + default n + help + Use GPIOs to control the reboot mode. This will allow users to boot + a device in a specific mode by using a GPIO that can be controlled + outside U-Boot. + endmenu
drivers/reboot-mode/Makefile +1 -0
@@ -5,3 +5,4 @@ # obj-$(CONFIG_DM_REBOOT_MODE) += reboot-mode-uclass.o +obj-$(CONFIG_DM_REBOOT_MODE_GPIO) += reboot-mode-gpio.o
drivers/reboot-mode/reboot-mode-gpio.c new file +128 -0
128 lines not on this page · raw message
include/reboot-mode/reboot-mode-gpio.h new file +32 -0
@@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright (c) Vaisala Oyj. +*/ + +#ifndef REBOOT_MODE_REBOOT_MODE_GPIO_H_ +#define REBOOT_MODE_REBOOT_MODE_GPIO_H_ + +#include <asm/gpio.h> + +/* +* In case of initializing the driver statically (using U_BOOT_DEVICE macro), +* we can use this struct to declare the pins used. +*/ + +#if !CONFIG_IS_ENABLED (OF_CONTROL ) +struct reboot_mode_gpio_config { +int gpio_dev_offset; +int gpio_offset; +int flags; +}; +#endif + +struct reboot_mode_gpio_platdata { +struct gpio_desc *gpio_desc; +#if !CONFIG_IS_ENABLED (OF_CONTROL ) +struct reboot_mode_gpio_config *gpios_config; +#endif +int gpio_count; +}; + +#endif /* REBOOT_MODE_REBOOT_MODE_GPIO_H_ */
test/dm/Makefile +1 -0
@@ -27,6 +27,7 @@ obj-$(CONFIG_AXI) += axi.o obj-$(CONFIG_BLK) += blk.o obj-$(CONFIG_BUTTON) += button.o obj-$(CONFIG_DM_BOOTCOUNT) += bootcount.o +obj-$(CONFIG_DM_REBOOT_MODE) += reboot-mode.o obj-$(CONFIG_CLK) += clk.o clk_ccf.o obj-$(CONFIG_CPU) += cpu.o obj-$(CONFIG_CROS_EC) += cros_ec.o
test/dm/reboot-mode.c new file +42 -0
42 lines not on this page · raw message
Signature · 1 line
2.26.3
Re: [PATCH v4 2/3] reboot-mode: read the boot mode from GPIOs status
Quoted 12 lines · Nandor Han
A use case for controlling the boot mode is when the user wants to control the device boot by pushing a button without needing to go in user-space.
Add a new backed for reboot mode where GPIOs are used to control the reboot-mode. The driver is able to scan a predefined list of GPIOs and return the magic value. Having the modes associated with the magic value generated based on the GPIO values, allows the reboot mode uclass to select the proper mode.
Signed-off-by Nandor Han <[email protected]>
Quoted 15 lines
--- arch/sandbox/dts/test.dts | 8 ++ configs/sandbox_defconfig | 2 + .../reboot-mode/reboot-mode-gpio.txt | 20 +++ drivers/reboot-mode/Kconfig | 9 ++ drivers/reboot-mode/Makefile | 1 + drivers/reboot-mode/reboot-mode-gpio.c | 128 ++++++++++++++++++ include/reboot-mode/reboot-mode-gpio.h | 32 +++++ test/dm/Makefile | 1 + test/dm/reboot-mode.c | 42 ++++++ 9 files changed, 243 insertions(+) create mode 100644 doc/device-tree-bindings/reboot-mode/reboot-mode-gpio.txt create mode 100644 drivers/reboot-mode/reboot-mode-gpio.c create mode 100644 include/reboot-mode/reboot-mode-gpio.h create mode 100644 test/dm/reboot-mode.c
Re: [PATCH v4 2/3] reboot-mode: read the boot mode from GPIOs status
In reply to Nandor HanQuoted 4 lines · Nandor Han
A use case for controlling the boot mode is when the user wants to control the device boot by pushing a button without needing to go in user-space.
Quoted 8 lines
Add a new backed for reboot mode where GPIOs are used to control the reboot-mode. The driver is able to scan a predefined list of GPIOs and return the magic value. Having the modes associated with the magic value generated based on the GPIO values, allows the reboot mode uclass to select the proper mode.
Signed-off-by Nandor Han <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom
PATCH v4 3/3 reboot-mode: read the boot mode from RTC memory
In reply to Nandor HanRTC devices could provide battery-backed memory that can be used for storing the reboot mode magic value.
Add a new reboot-mode back-end that uses RTC to store the reboot-mode magic value. The driver also supports both endianness modes.
--- arch/sandbox/dts/test.dts | 10 ++ configs/sandbox_defconfig | 1 + .../reboot-mode/reboot-mode-rtc.txt | 22 +++ drivers/reboot-mode/Kconfig | 9 ++ drivers/reboot-mode/Makefile | 1 + drivers/reboot-mode/reboot-mode-rtc.c | 127 ++++++++++++++++++ include/reboot-mode/reboot-mode-rtc.h | 16 +++ test/dm/reboot-mode.c | 29 ++++ 8 files changed, 215 insertions(+) create mode 100644 doc/device-tree-bindings/reboot-mode/reboot-mode-rtc.txt create mode 100644 drivers/reboot-mode/reboot-mode-rtc.c create mode 100644 include/reboot-mode/reboot-mode-rtc.h
arch/sandbox/dts/test.dts +10 -0
@@ -67,6 +67,16 @@ mode-download = <0x03>; }; + reboot_mode1: reboot-mode@14 { + compatible = "reboot-mode-rtc"; + rtc = <&rtc_0>; + reg = <0x30 4>; + u-boot,env-variable = "bootstatus"; + big-endian; + mode-test = <0x21969147>; + mode-download = <0x51939147>; + }; + audio: audio-codec { compatible = "sandbox,audio-codec"; #sound-dai-cells = <1>;
configs/sandbox_defconfig +1 -0
@@ -289,3 +289,4 @@ CONFIG_UT_TIME=y CONFIG_UT_DM=y CONFIG_DM_REBOOT_MODE=y CONFIG_DM_REBOOT_MODE_GPIO=y +CONFIG_DM_REBOOT_MODE_RTC=y
doc/device-tree-bindings/reboot-mode/reboot-mode-rtc.txt new file +22 -0
@@ -0,0 +1,22 @@ +RTC Reboot Mode Configuration + +Required Properties: +- compatible: must be "reboot-mode-rtc". +- rtc: reference to the rtc device used. +- reg: start register and the number of bytes used. Maximum 4 bytes supported. +- modes: list of properties that define the modes and associated unique ids. + +Optional Properties: +- u-boot,env-variable: used to save the reboot mode (default: reboot-mode). +- big-endian: if the magic value is stored in big-endian. (default: false). + +Example: + reboot-mode-rtc { + compatible = "reboot-mode-rtc"; + rtc = <&rtc_0>; + reg = <0x14 4>; + u-boot,env-variable = "bootstatus"; + big-endian; + modes-test = <0x21969147>; + modes-download = <0x51939147>; + };
drivers/reboot-mode/Kconfig +9 -0
@@ -24,4 +24,13 @@ config DM_REBOOT_MODE_GPIO a device in a specific mode by using a GPIO that can be controlled outside U-Boot. +config DM_REBOOT_MODE_RTC + bool "Use RTC as reboot mode backend" + depends on DM_REBOOT_MODE + default n + help + Use RTC non volatile memory to control the reboot mode. This will allow users to boot + a device in a specific mode by using a register(s) that can be controlled + outside U-Boot (e.g. Kernel). + endmenu
drivers/reboot-mode/Makefile +1 -0
@@ -6,3 +6,4 @@ obj-$(CONFIG_DM_REBOOT_MODE) += reboot-mode-uclass.o obj-$(CONFIG_DM_REBOOT_MODE_GPIO) += reboot-mode-gpio.o +obj-$(CONFIG_DM_REBOOT_MODE_RTC) += reboot-mode-rtc.o
drivers/reboot-mode/reboot-mode-rtc.c new file +127 -0
127 lines not on this page · raw message
include/reboot-mode/reboot-mode-rtc.h new file +16 -0
@@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright (c), Vaisala Oyj +*/ + +#ifndef REBOOT_MODE_REBOOT_MODE_RTC_H_ +#define REBOOT_MODE_REBOOT_MODE_RTC_H_ + +struct reboot_mode_rtc_platdata { +struct udevice *rtc; +bool is_big_endian; +int addr; +size_t size; +}; + +#endif /* REBOOT_MODE_REBOOT_MODE_RTC_H_ */
test/dm/reboot-mode.c +29 -0
@@ -9,10 +9,13 @@#include <env.h> #include <log.h> #include <asm/gpio.h> +#include <asm/rtc.h> #include <asm/test.h> #include <dm/test.h> #include <test/test.h> #include <test/ut.h> +#include <rtc.h> +#include <linux/byteorder/generic.h> static int dm_test_reboot_mode_gpio (struct unit_test_state *uts) {
@@ -40,3 +43,29 @@ static int dm_test_reboot_mode_gpio(struct unit_test_state *uts)DM_TEST (dm_test_reboot_mode_gpio,UT_TESTF_PROBE_TEST |UT_TESTF_SCAN_FDT |UT_TESTF_FLAT_TREE ); + +static int dm_test_reboot_mode_rtc (struct unit_test_state *uts) +{ +struct udevice *rtc_dev; +struct udevice *rm_dev; +u32 read_val; +u32 test_magic_val =cpu_to_be32 (0x21969147 ); + +uclass_get_device_by_name (UCLASS_RTC ,"rtc@43" , + &rtc_dev); +dm_rtc_write (rtc_dev,REG_AUX0 , (u8 *)&test_magic_val,4 ); + +ut_assertok (uclass_get_device_by_name (UCLASS_REBOOT_MODE , +"reboot-mode@14" , &rm_dev)); +ut_assertok (dm_reboot_mode_update (rm_dev)); + +ut_asserteq_str ("test" ,env_get ("bootstatus" )); + +dm_rtc_read (rtc_dev,REG_AUX0 , (u8 *)&read_val,4 ); +ut_asserteq (read_val,0 ); + +return 0 ; +} + +DM_TEST (dm_test_reboot_mode_rtc, +UT_TESTF_PROBE_TEST |UT_TESTF_SCAN_FDT |UT_TESTF_FLAT_TREE );
Signature · 1 line
2.26.3
Re: [PATCH v4 3/3] reboot-mode: read the boot mode from RTC memory
Hi Nandor,
Quoted 8 lines · Nandor Han
RTC devices could provide battery-backed memory that can be used for storing the reboot mode magic value.
Add a new reboot-mode back-end that uses RTC to store the reboot-mode magic value. The driver also supports both endianness modes.
Signed-off-by Nandor Han <[email protected]>
Quoted 14 lines
--- arch/sandbox/dts/test.dts | 10 ++ configs/sandbox_defconfig | 1 + .../reboot-mode/reboot-mode-rtc.txt | 22 +++ drivers/reboot-mode/Kconfig | 9 ++ drivers/reboot-mode/Makefile | 1 + drivers/reboot-mode/reboot-mode-rtc.c | 127 ++++++++++++++++++ include/reboot-mode/reboot-mode-rtc.h | 16 +++ test/dm/reboot-mode.c | 29 ++++ 8 files changed, 215 insertions(+) create mode 100644 doc/device-tree-bindings/reboot-mode/reboot-mode-rtc.txt create mode 100644 drivers/reboot-mode/reboot-mode-rtc.c create mode 100644 include/reboot-mode/reboot-mode-rtc.h
But I think it would be better to put this device as a child of the rtc, so it is more obvious that they are related. It also avoids the phandle. What do you think?
Re: [PATCH v4 3/3] reboot-mode: read the boot mode from RTC memory
Quoted 26 lines · Simon Glass
Hi Nandor,
Quoted 18 lines · Nandor Han
RTC devices could provide battery-backed memory that can be used for storing the reboot mode magic value.
Add a new reboot-mode back-end that uses RTC to store the reboot-mode magic value. The driver also supports both endianness modes.
Signed-off-by Nandor Han <[email protected]>--- arch/sandbox/dts/test.dts | 10 ++ configs/sandbox_defconfig | 1 + .../reboot-mode/reboot-mode-rtc.txt | 22 +++ drivers/reboot-mode/Kconfig | 9 ++ drivers/reboot-mode/Makefile | 1 + drivers/reboot-mode/reboot-mode-rtc.c | 127 ++++++++++++++++++ include/reboot-mode/reboot-mode-rtc.h | 16 +++ test/dm/reboot-mode.c | 29 ++++ 8 files changed, 215 insertions(+)Quoted 4 lines
create mode 100644
doc/device-tree-bindings/reboot-mode/reboot-mode-rtc.txtcreate mode 100644drivers/reboot-mode/reboot-mode-rtc.c
create mode 100644include/reboot-mode/reboot-mode-rtc.h
Quoted 6 lines
Reviewed-by Simon Glass <[email protected]>But I think it would be better to put this device as a child of the rtc, so it is more obvious that they are related. It also avoids the phandle. What do you think?
Hi Simon and thanks for reviewing the code,
I think the idea is not bad, however, would be ok to consider the
recommendation as improvement opportunity and merge this as
it is for now? I'm a bit busy with some other stuff now and I could start implementing this some time later. At least it would help me since this are on the mailing list since Dec 2019 :).
Signature · 2 lines
Regards, Nandor
Re: [PATCH v4 3/3] reboot-mode: read the boot mode from RTC memory
Hi Nandor,
Quoted 35 lines · Nandor Han
Quoted 26 lines · Simon Glass
Hi Nandor,
Quoted 18 lines · Nandor Han
RTC devices could provide battery-backed memory that can be used for storing the reboot mode magic value.
Add a new reboot-mode back-end that uses RTC to store the reboot-mode magic value. The driver also supports both endianness modes.
Signed-off-by Nandor Han <[email protected]>--- arch/sandbox/dts/test.dts | 10 ++ configs/sandbox_defconfig | 1 + .../reboot-mode/reboot-mode-rtc.txt | 22 +++ drivers/reboot-mode/Kconfig | 9 ++ drivers/reboot-mode/Makefile | 1 + drivers/reboot-mode/reboot-mode-rtc.c | 127 ++++++++++++++++++ include/reboot-mode/reboot-mode-rtc.h | 16 +++ test/dm/reboot-mode.c | 29 ++++ 8 files changed, 215 insertions(+)Quoted 4 lines
create mode 100644
doc/device-tree-bindings/reboot-mode/reboot-mode-rtc.txtcreate mode 100644drivers/reboot-mode/reboot-mode-rtc.c
create mode 100644include/reboot-mode/reboot-mode-rtc.hQuoted 6 lines
Reviewed-by Simon Glass <[email protected]>But I think it would be better to put this device as a child of the rtc, so it is more obvious that they are related. It also avoids the phandle. What do you think?
Quoted 6 lines
Hi Simon and thanks for reviewing the code,
I think the idea is not bad, however, would be ok to consider the
recommendation as improvement opportunity and merge this as it is for now? I'm a bit busy with some other stuff now and I could start implementing this some time later. At least it would help me since this are on the mailing list since Dec 2019 :).
Well I don't think you could change this later because it would change the binding. I suppose you could add it as an option.
I am OK with either way (hence my reviewed-by tag). With my use of RTC for data storage I have made it a subnode since it makes it easy to see which parts of the RTC are used for what:
rtc: rtc {
compatible = "motorola,mc146818";
u-boot,dm-pre-proper;
reg = <0x70 2>;
#address-cells = <1>;
#size-cells = <0>;
nvdata {
u-boot,dm-vpl;
compatible = "google,cmos-nvdata";
reg = <0x26>;
nvdata,types = <CROS_NV_DATA>;
};
};Regards,
Simon
Re: [PATCH v4 3/3] reboot-mode: read the boot mode from RTC memory
Quoted 45 lines · Simon Glass
Hi Nandor,
Quoted 35 lines · Nandor Han
Quoted 26 lines · Simon Glass
Hi Nandor,
Quoted 18 lines · Nandor Han
RTC devices could provide battery-backed memory that can be used for storing the reboot mode magic value.
Add a new reboot-mode back-end that uses RTC to store the reboot-mode magic value. The driver also supports both endianness modes.
Signed-off-by Nandor Han <[email protected]>--- arch/sandbox/dts/test.dts | 10 ++ configs/sandbox_defconfig | 1 + .../reboot-mode/reboot-mode-rtc.txt | 22 +++ drivers/reboot-mode/Kconfig | 9 ++ drivers/reboot-mode/Makefile | 1 + drivers/reboot-mode/reboot-mode-rtc.c | 127 ++++++++++++++++++ include/reboot-mode/reboot-mode-rtc.h | 16 +++ test/dm/reboot-mode.c | 29 ++++ 8 files changed, 215 insertions(+)Quoted 4 lines
create mode 100644
doc/device-tree-bindings/reboot-mode/reboot-mode-rtc.txtcreate mode 100644drivers/reboot-mode/reboot-mode-rtc.ccreate mode 100644include/reboot-mode/reboot-mode-rtc.hQuoted 6 lines
Reviewed-by Simon Glass <[email protected]>But I think it would be better to put this device as a child of the rtc, so it is more obvious that they are related. It also avoids the phandle. What do you think?
Quoted 6 lines
Hi Simon and thanks for reviewing the code,
I think the idea is not bad, however, would be ok to consider the
recommendation as improvement opportunity and merge this as it is for now? I'm a bit busy with some other stuff now and I could start implementing this some time later. At least it would help me since this are on the mailing list since Dec 2019 :).
Quoted 4 lines
Well I don't think you could change this later because it would change the binding. I suppose you could add it as an option.
I am OK with either way (hence my reviewed-by tag).
Thanks Simon.
Signature · 2 lines
Regards, Nandor
Re: [PATCH v4 3/3] reboot-mode: read the boot mode from RTC memory
In reply to Nandor HanQuoted 8 lines · Nandor Han
RTC devices could provide battery-backed memory that can be used for storing the reboot mode magic value.
Add a new reboot-mode back-end that uses RTC to store the reboot-mode magic value. The driver also supports both endianness modes.
Signed-off-by Nandor Han <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom