mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Martin Hollingsworth <Martin.Hollingsworth@itk-engineering.de>
To: "barebox@lists.infradead.org" <barebox@lists.infradead.org>
Cc: "Çağlar Kilimci" <ckilimci@gmail.com>, "Sam Ravnborg" <sam@ravnborg.org>
Subject: AW: Barebox state on am335x-phytec-phycore-som
Date: Fri, 21 Jul 2017 11:35:20 +0000	[thread overview]
Message-ID: <d03206a3e4f3402c93a9a7d229c0a56f@itk-engineering.de> (raw)
In-Reply-To: <CAGUZs0=SjEOwtjx5V6z9BvutFUxuAc26PV5aaJMoHTrApircuQ@mail.gmail.com>

Hello Sam, Hello Caglar,
Thanks to you both for your quick support!

With the configuration of Caglar the state framework is directly detected by barebox. And because my setup seems to pass the DTS from barebox to the linux kernel the dt-utils under linux can directly read/write the state - in my case even without the need to modify the linux dts files. Only thing left now is to configure it all together with bootchooser :-)

Thanks again and cheers,
Martin

-----Ursprüngliche Nachricht-----
Von: Çağlar Kilimci [mailto:ckilimci@gmail.com] 
Gesendet: Freitag, 21. Juli 2017 08:47
An: Sam Ravnborg <sam@ravnborg.org>
Cc: Martin Hollingsworth <Martin.Hollingsworth@itk-engineering.de>; barebox@lists.infradead.org
Betreff: Re: Barebox state on am335x-phytec-phycore-som

Hi all,

2017-07-20 18:06 GMT+03:00 Sam Ravnborg <sam@ravnborg.org>:
> Hi Martin.
>
> On Thu, Jul 20, 2017 at 01:09:54PM +0000, Martin Hollingsworth wrote:
>> Hi,
>> I am trying to enable the barebox state framework and use it to store 
>> the bootchooser variables on the am335x-phytec-phycore-som board. I 
>> want to do that, so that the variables can be stored in EEPROM rather 
>> than in NAND (due to write/erase cycles).

I was exactly trying to do the same thing, 3-4 months ago. There is something missing or missleading in the documentation. First of all, you need to compile dts for both barebox and kernel. Each time I would like to make a change, I change both barebox dts and kernel dts. These are two similar but actually two different dts files. As an example, in am335x-phytec-phycore-som.dtsi eeprom device name is "eeprom" but "i2c_eeprom" in kernel's dts. Secondly, backend-storage-type and backend-stridesize have some importance. Even if they are written optional in the documentation, I could not run without them. You need to calculate "backend-stridesize". Lastly, backend should be like this "backend = <&eeprom>;". Here is the barebox patch I use:

diff --git a/arch/arm/dts/am335x-phytec-phycore-som.dtsi
b/arch/arm/dts/am335x-phytec-phycore-som.dtsi
index 0b8c454..62598cd 100644
--- a/arch/arm/dts/am335x-phytec-phycore-som.dtsi
+++ b/arch/arm/dts/am335x-phytec-phycore-som.dtsi
@@ -14,6 +14,86 @@
  status = "disabled";
  };
  };
+
+ state {
+ magic = <0x4aaef993>;
+ compatible = "barebox,state";
+ backend-type = "raw";
+ backend = <&eeprom>;
+ backend-storage-type = "direct";
+ backend-stridesize = <0xf0>;
+        bootchooser {
+            system1 {
+                boot{
+                    reg = <0x0 0x10>;
+                    type = "string";
+                    default = "system1";
+                };
+                default_attempts {
+                    reg = <0x10 0x4>;
+                    type = "uint32";
+                    default = <0x03>;
+                };
+                default_priority {
+                    reg = <0x14 0x4>;
+                    type = "uint32";
+                    default = <0x10>;
+                };
+                remaining_attempts {
+                    reg = <0x18 0x4>;
+                    type = "uint32";
+                    default = <0x03>;
+                };
+                priority {
+                    reg = <0x1c 0x4>;
+                    type = "uint32";
+                    default = <0x10>;
+                };
+            };
+            system2 {
+                boot{
+                    reg = <0x20 0x10>;
+                    type = "string";
+                    default = "system2";
+                };
+                default_attempts {
+                    reg = <0x30 0x4>;
+                    type = "uint32";
+                    default = <0x03>;
+                };
+                default_priority {
+                    reg = <0x34 0x4>;
+                    type = "uint32";
+                    default = <0x0f>;
+                };
+                remaining_attempts {
+                    reg = <0x38 0x4>;
+                    type = "uint32";
+                    default = <0x03>;
+                };
+                priority {
+                    reg = <0x3c 0x4>;
+                    type = "uint32";
+                    default = <0x0f>;
+                };
+            };
+            last_chosen {
+                reg = <0x40 0x4>;
+                type = "uint32";
+                default = <0x01>;
+            };
+            boot_to_be {
+                reg = <0x50 0x10>;
+                type = "string";
+                default = "none";
+            };
+            update_id {
+                reg = <0x60 0x10>;
+                type = "string";
+                default = "none";
+            };
+        };
+ };
 };

 &am33xx_pinmux {


Hope, this helps.

Sincerely,
--
Çağlar Kilimci
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

      reply	other threads:[~2017-07-21 11:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-20 13:09 Martin Hollingsworth
2017-07-20 15:06 ` Sam Ravnborg
2017-07-21  6:46   ` Çağlar Kilimci
2017-07-21 11:35     ` Martin Hollingsworth [this message]

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=d03206a3e4f3402c93a9a7d229c0a56f@itk-engineering.de \
    --to=martin.hollingsworth@itk-engineering.de \
    --cc=barebox@lists.infradead.org \
    --cc=ckilimci@gmail.com \
    --cc=sam@ravnborg.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