From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 10/11] sandbox: dts: include state node by default
Date: Mon, 12 Oct 2020 00:11:59 +0200 [thread overview]
Message-ID: <20201011221200.9023-10-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20201011221200.9023-1-a.fatoum@pengutronix.de>
For testing barebox-state, it would be nice to have a state
pre-configured out-of-the-box. Add one to sandbox.dts.
Because the barebox message on an non-configured state can looks
quite scary, add an init script that tells the user that all
is well.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
arch/sandbox/board/env/init/state | 12 +++++
arch/sandbox/dts/sandbox-state-example.dtsi | 50 ---------------------
arch/sandbox/dts/sandbox.dts | 35 +++++++++++++++
3 files changed, 47 insertions(+), 50 deletions(-)
create mode 100644 arch/sandbox/board/env/init/state
delete mode 100644 arch/sandbox/dts/sandbox-state-example.dtsi
diff --git a/arch/sandbox/board/env/init/state b/arch/sandbox/board/env/init/state
new file mode 100644
index 000000000000..0b8e40409f97
--- /dev/null
+++ b/arch/sandbox/board/env/init/state
@@ -0,0 +1,12 @@
+if [ "x$state.dirty" != "x1" -o $global.system.reset != "POR" ]; then
+ exit
+fi
+
+source /env/data/ansi-colors
+
+echo -e $CYAN
+echo "******************************************************************"
+echo "*** Inconsistent barebox state buckets detected on first boot ***"
+echo "*** barebox will repair them on next shutdown ***"
+echo "*****************************************************************"
+echo -e -n $NC
diff --git a/arch/sandbox/dts/sandbox-state-example.dtsi b/arch/sandbox/dts/sandbox-state-example.dtsi
deleted file mode 100644
index 98640f6677cf..000000000000
--- a/arch/sandbox/dts/sandbox-state-example.dtsi
+++ /dev/null
@@ -1,50 +0,0 @@
-/ {
- aliases {
- state = &state;
- };
-
- disk {
- compatible = "barebox,hostfile";
- barebox,filename = "disk";
- reg = <0x0 0x0 0x0 0x100000>;
-
- partitions {
- compatible = "fixed-partitions";
- #address-cells = <1>;
- #size-cells = <1>;
-
- hostfile_state: state@0 {
- reg = <0x0 0x1000>;
- label = "state";
- };
- };
- };
-
- state: state {
- magic = <0xaa3b86a6>;
- compatible = "barebox,state";
- backend-type = "raw";
- backend = <&hostfile_state>;
- backend-storage-type = "direct";
- backend-stridesize = <64>;
-
- #address-cells = <1>;
- #size-cells = <1>;
- vars {
- #address-cells = <1>;
- #size-cells = <1>;
-
- x {
- reg = <0x0 0x4>;
- type = "uint32";
- default = <1>;
- };
-
- y {
- reg = <0x4 0x4>;
- type = "uint32";
- default = <3>;
- };
- };
- };
-};
diff --git a/arch/sandbox/dts/sandbox.dts b/arch/sandbox/dts/sandbox.dts
index f830adecf796..afe48154c488 100644
--- a/arch/sandbox/dts/sandbox.dts
+++ b/arch/sandbox/dts/sandbox.dts
@@ -9,6 +9,7 @@
aliases {
bmode = &bmode;
+ state = &state;
};
chosen {
@@ -23,6 +24,35 @@
reg = <0 0 0 0>;
};
+ state: state {
+ magic = <0xaa3b86a6>;
+ compatible = "barebox,state";
+ backend-type = "raw";
+ backend = <&part_state>;
+ backend-storage-type = "direct";
+ backend-stridesize = <64>;
+
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ vars {
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ x {
+ reg = <0x0 0x4>;
+ type = "uint32";
+ default = <1>;
+ };
+
+ y {
+ reg = <0x4 0x4>;
+ type = "uint32";
+ default = <3>;
+ };
+ };
+ };
+
stickypage: stickypage {
compatible = "barebox,hostfile", "syscon", "simple-mfd";
reg = <0 0 0 4096>;
@@ -47,6 +77,11 @@
reg = <0x400 0x800>;
label = "env";
};
+
+ part_state: state@800 {
+ reg = <0xC00 0x400>;
+ label = "state";
+ };
};
};
--
2.28.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2020-10-11 22:12 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-11 22:11 [PATCH 01/11] sandbox: dts: retire skeleton.dtsi Ahmad Fatoum
2020-10-11 22:11 ` [PATCH 02/11] of: implement of_property_read_u64_array Ahmad Fatoum
2020-10-11 22:11 ` [PATCH 03/11] sandbox: hostfile: unify --image and direct device tree probe Ahmad Fatoum
2020-10-11 22:11 ` [PATCH 04/11] sandbox: hostfile: support anonymous hostfiles in device tree Ahmad Fatoum
2020-10-11 22:11 ` [PATCH 05/11] sandbox: dts: define default environment node Ahmad Fatoum
2020-10-11 22:11 ` [PATCH 06/11] sandbox: poweroff: migrate to driver probed from device tree Ahmad Fatoum
2020-10-11 22:11 ` [PATCH 07/11] sandbox: power: implement reset source support Ahmad Fatoum
2020-10-11 22:11 ` [PATCH 08/11] sandbox: dts: implement reboot mode Ahmad Fatoum
2020-10-11 22:11 ` [PATCH 09/11] sandbox: add watchdog driver Ahmad Fatoum
2020-10-11 22:11 ` Ahmad Fatoum [this message]
2020-10-11 22:12 ` [PATCH 11/11] sandbox: defconfig: enable new generic features Ahmad Fatoum
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=20201011221200.9023-10-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
/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