From: Jan Remmet <J.Remmet@phytec.de>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Barebox List <barebox@lists.infradead.org>
Subject: Re: [PATCH 01/42] state: Make pointing to the backend using a phandle the only supported method
Date: Mon, 15 May 2017 12:14:28 +0200 [thread overview]
Message-ID: <20170515101428.GB4612@lws-weitzel2@phytec.de> (raw)
In-Reply-To: <20170515091800.GA4612@lws-weitzel2@phytec.de>
On Mon, May 15, 2017 at 11:18:00AM +0200, Jan Remmet wrote:
> On Fri, Mar 31, 2017 at 09:03:05AM +0200, Sascha Hauer wrote:
> > All other methods are broken for some time already: When starting the
> > kernel the state code rewrites the state node in the device tree and
> > replaced the "backend" property with a phandle - even when the target
> > can't be described as a phandle. Since using phandles is the nicest way
> > to point to the storage device anyway remove the other methods.
> Is there a way to use block devices as storage? On eMMC we use mtd style
> partitios inside the sd/mmc host node to access barebox and
> barebox-environment. But using this barebox-state didn't find the backend
> path.
Using barebox-state 2016.12.0 the states from the mtd style partition is found
now.
Jan
>
> Jan
>
> >
> > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> > ---
> > .../devicetree/bindings/barebox/barebox,state.rst | 27 ++++++++++++++++------
> > common/state/state.c | 21 ++++++++---------
> > 2 files changed, 29 insertions(+), 19 deletions(-)
> >
> > diff --git a/Documentation/devicetree/bindings/barebox/barebox,state.rst b/Documentation/devicetree/bindings/barebox/barebox,state.rst
> > index 438cc434a2..e9daa65f1a 100644
> > --- a/Documentation/devicetree/bindings/barebox/barebox,state.rst
> > +++ b/Documentation/devicetree/bindings/barebox/barebox,state.rst
> > @@ -29,7 +29,8 @@ Required properties:
> >
> > * ``compatible``: should be ``barebox,state``;
> > * ``magic``: A 32bit number used as a magic to identify the state
> > -* ``backend``: describes where the data for this state is stored
> > +* ``backend``: contains a phandle to the device/partition which holds the
> > + actual state data.
> > * ``backend-type``: should be ``raw`` or ``dtb``.
> >
> > Optional properties:
> > @@ -77,19 +78,31 @@ Example::
> > magic = <0x27031977>;
> > compatible = "barebox,state";
> > backend-type = "raw";
> > - backend = &eeprom, "partname:state";
> > + backend = &state_part;
> >
> > foo {
> > - reg = <0x00 0x4>;
> > - type = "uint32";
> > + reg = <0x00 0x4>;
> > + type = "uint32";
> > default = <0x0>;
> > };
> >
> > bar {
> > - reg = <0x10 0x4>;
> > - type = "enum32";
> > + reg = <0x10 0x4>;
> > + type = "enum32";
> > names = "baz", "qux";
> > - default = <1>;
> > + default = <1>;
> > + };
> > + };
> > +
> > + &nand_flash {
> > + partitions {
> > + compatible = "fixed-partitions";
> > + #address-cells = <1>;
> > + #size-cells = <1>;
> > + state_part: state@10000 {
> > + label = "state";
> > + reg = <0x10000 0x10000>;
> > + };
> > };
> > };
> >
> > diff --git a/common/state/state.c b/common/state/state.c
> > index 02bb1bb24a..6e6b3a6f08 100644
> > --- a/common/state/state.c
> > +++ b/common/state/state.c
> > @@ -452,19 +452,16 @@ struct state *state_new_from_node(struct device_node *node, char *path,
> > }
> >
> > if (!path) {
> > - /* guess if of_path is a path, not a phandle */
> > - if (of_path[0] == '/' && len > 1) {
> > - ret = of_find_path(node, "backend", &path, 0);
> > - } else {
> > - struct device_node *partition_node;
> > -
> > - partition_node = of_parse_phandle(node, "backend", 0);
> > - if (!partition_node)
> > - goto out_release_state;
> > -
> > - of_path = partition_node->full_name;
> > - ret = of_find_path_by_node(partition_node, &path, 0);
> > + struct device_node *partition_node;
> > +
> > + partition_node = of_parse_phandle(node, "backend", 0);
> > + if (!partition_node) {
> > + dev_err(&state->dev, "Cannot resolve \"backend\" phandle\n");
> > + goto out_release_state;
> > }
> > +
> > + of_path = partition_node->full_name;
> > + ret = of_find_path_by_node(partition_node, &path, 0);
> > if (ret) {
> > if (ret != -EPROBE_DEFER)
> > dev_err(&state->dev, "state failed to parse path to backend: %s\n",
> > --
> > 2.11.0
> >
> >
> > _______________________________________________
> > barebox mailing list
> > barebox@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/barebox
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2017-05-15 10:14 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-31 7:03 State patches Sascha Hauer
2017-03-31 7:03 ` [PATCH 01/42] state: Make pointing to the backend using a phandle the only supported method Sascha Hauer
2017-05-15 9:18 ` Jan Remmet
2017-05-15 10:14 ` Jan Remmet [this message]
2017-05-16 5:33 ` Sascha Hauer
2017-05-17 9:13 ` Jan Remmet
2017-03-31 7:03 ` [PATCH 02/42] state: Use positive logic Sascha Hauer
2017-03-31 7:03 ` [PATCH 03/42] state: backend: remove .get_packed_len Sascha Hauer
2017-03-31 7:03 ` [PATCH 04/42] state: backend: remove len_hint argument from state_storage_read Sascha Hauer
2017-03-31 7:03 ` [PATCH 05/42] state: Drop backend as extra struct type Sascha Hauer
2017-03-31 7:03 ` [PATCH 06/42] state: merge backend.c into state.c Sascha Hauer
2017-03-31 7:03 ` [PATCH 07/42] state: open code state_backend_init in caller Sascha Hauer
2017-03-31 7:03 ` [PATCH 08/42] state: remove unnecessary argument from state_format_init Sascha Hauer
2017-03-31 7:03 ` [PATCH 09/42] state: pass struct state * to storage functions Sascha Hauer
2017-03-31 7:03 ` [PATCH 10/42] state: storage: initialize variable once outside loop Sascha Hauer
2017-03-31 7:03 ` [PATCH 11/42] state: backend_circular: Read whole PEB Sascha Hauer
2017-04-15 8:40 ` Sam Ravnborg
2017-03-31 7:03 ` [PATCH 12/42] state: drop lazy_init Sascha Hauer
2017-03-31 7:03 ` [PATCH 13/42] state: simplify direct backend Sascha Hauer
2017-03-31 7:03 ` [PATCH 14/42] state: replace len_hint logic Sascha Hauer
2017-03-31 7:03 ` [PATCH 15/42] state: Convert all bufs to void * Sascha Hauer
2017-03-31 7:03 ` [PATCH 16/42] state: Drop cache bucket Sascha Hauer
2017-04-15 8:53 ` Sam Ravnborg
2017-04-19 8:22 ` Sascha Hauer
2017-03-31 7:03 ` [PATCH 17/42] state: backend-direct: Fix max_size Sascha Hauer
2017-03-31 7:03 ` [PATCH 18/42] state: bucket: Make output more informative Sascha Hauer
2017-03-31 7:03 ` [PATCH 19/42] state: backend_bucket_direct: max_size is always given Sascha Hauer
2017-03-31 7:03 ` [PATCH 20/42] state: backend: Add more fields to struct state_backend_storage Sascha Hauer
2017-03-31 7:03 ` [PATCH 21/42] state: backend_circular: remove unnecessary warning Sascha Hauer
2017-03-31 7:03 ` [PATCH 22/42] state: storage: direct: do not close file that is not opened Sascha Hauer
2017-03-31 7:03 ` [PATCH 23/42] state: backend: Add some documentation Sascha Hauer
2017-03-31 7:03 ` [PATCH 24/42] state: backend_circular: default to circular storage Sascha Hauer
2017-03-31 7:03 ` [PATCH 25/42] state: backend_circular: rewrite function doc Sascha Hauer
2017-03-31 7:03 ` [PATCH 26/42] state: backend_storage: Rename variable nr_copies to n_buckets Sascha Hauer
2017-03-31 7:03 ` [PATCH 27/42] state: backend_storage: Rename variable desired_copies to desired_buckets Sascha Hauer
2017-03-31 7:03 ` [PATCH 28/42] state: backend_storage: rewrite function doc Sascha Hauer
2017-03-31 7:03 ` [PATCH 29/42] state: backend_storage: make locally used variable static Sascha Hauer
2017-03-31 7:03 ` [PATCH 30/42] state: backend_storage: rename more variables Sascha Hauer
2017-03-31 7:03 ` [PATCH 31/42] keystore: implement forgetting secrets Sascha Hauer
2017-03-31 7:03 ` [PATCH 32/42] commands: implement keystore command Sascha Hauer
2017-03-31 7:03 ` [PATCH 33/42] commands: state: allow loading state with -l Sascha Hauer
2017-03-31 7:03 ` [PATCH 34/42] crypto: digest: initialize earlier Sascha Hauer
2017-03-31 7:03 ` [PATCH 35/42] state: backend_raw: alloc digest only when needed Sascha Hauer
2017-03-31 7:03 ` [PATCH 36/42] state: backend_circular: Set minumum writesize to 8 Sascha Hauer
2017-03-31 7:03 ` [PATCH 37/42] state: backend bucket circular: Explain metadata Sascha Hauer
2017-03-31 7:03 ` [PATCH 38/42] state: Allow to load without authentification Sascha Hauer
2017-03-31 7:03 ` [PATCH 39/42] state: Update documentation Sascha Hauer
2017-03-31 7:03 ` [PATCH 40/42] state: Do not load state during state_new_from_node Sascha Hauer
2017-03-31 7:03 ` [PATCH 41/42] state: Remove -EUCLEAN check from userspace tool Sascha Hauer
2017-03-31 7:03 ` [PATCH 42/42] state: find device node from device path, not from device node path Sascha Hauer
2017-04-03 20:15 ` State patches Sam Ravnborg
2017-04-04 6:19 ` Sascha Hauer
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=20170515101428.GB4612@lws-weitzel2@phytec.de \
--to=j.remmet@phytec.de \
--cc=barebox@lists.infradead.org \
--cc=s.hauer@pengutronix.de \
/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