public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Nandor Han <nandor.han@vaisala.com>
To: u-boot@lists.denx.de, trini@konsulko.com, sjg@chromium.org
Cc: Nandor Han <nandor.han@vaisala.com>, vesa.jaaskelainen@vaisala.com
Subject: [PATCH v4 0/3] Add reboot mode support
Date: Thu, 10 Jun 2021 16:56:42 +0300	[thread overview]
Message-ID: <cover.1623332762.git.nandor.han@vaisala.com> (raw)

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

-- 
2.26.3


             reply	other threads:[~2021-06-10 13:57 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-10 13:56 Nandor Han [this message]
2021-06-10 13:56 ` [PATCH v4 1/3] reboot-mode: add support for reboot mode control Nandor Han
2021-06-26 18:30   ` Simon Glass
2021-07-23 18:52   ` Tom Rini
2021-06-10 13:56 ` [PATCH v4 2/3] reboot-mode: read the boot mode from GPIOs status Nandor Han
2021-06-26 18:30   ` Simon Glass
2021-07-23 18:52   ` Tom Rini
2021-06-10 13:56 ` [PATCH v4 3/3] reboot-mode: read the boot mode from RTC memory Nandor Han
2021-06-26 18:30   ` Simon Glass
2021-06-28  9:44     ` Nandor Han
2021-07-05 15:29       ` Simon Glass
2021-07-14  9:55         ` Nandor Han
2021-07-23 18:52   ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1623332762.git.nandor.han@vaisala.com \
    --to=nandor.han@vaisala.com \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=vesa.jaaskelainen@vaisala.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox