State Framework and dtb
Jan Remmet
J.Remmet at phytec.de
Tue Apr 4 01:04:09 PDT 2017
On Mon, Apr 03, 2017 at 11:59:50PM +0300, Çağlar Kilimci wrote:
> Hello,
>
> 2017-03-31 16:00 GMT+03:00 Sascha Hauer <s.hauer at pengutronix.de>:
> > On Fri, Mar 31, 2017 at 02:41:19PM +0300, Çağlar Kilimci wrote:
> >> Hey,
> >>
> >>
> >> I tried but got the same result and then I would like to apply your
> >> serious patch series of the state framework but release that our
> >> working branch is 2016.07 so could not apply patches. Let me update
> >> barebox and apply those patches. Are those based on master branch
> >> right? Or, which branch do you recommend to work on?
> >
> > The patches are based on master, yes. Anyway, you seem to have a problem
> > in getting your changes in the dts file to the running barebox. Please
> > try to add some nodes/properties to your dts file and verify that a
> > of_dump shows these nodes. Before that is the case it's not worth to
> > look any further.
>
> Finally, I updated and patched the code and now I can see state at 0
> device in the of_dump:
> state at 0 {
> magic = <0x27031977>;
> compatible = "barebox,state";
> backend-type = "raw";
> backend = <0x42>;
> foo {
> reg = <0x0 0x4>;
> type = "uint32";
> default = <0x0>;
> };
> bar {
> reg = <0x10 0x4>;
> type = "enum32";
> names = "baz", "qux";
> default = <0x1>;
> };
> };
Here a working example for barebox 2016.11.0 so there may be changes with the
actual state cleanup patches
+ state2: state_socket {
+ magic = <0x456ef363>;
+ compatible = "barebox,state";
+ backend-type = "raw";
+ backend = &eeprom;
+ backend-storage-type = "direct";
+ backend-stridesize = <0x53>;
+
+ stateapi {
+ reg = <0x00 0x1>;
+ type = "uint8";
+ default = <0x0>;
+ };
+ socketid {
+ reg = <0x01 0x1>;
+ type = "uint8";
+ default = <0x0>;
+ };
+
+ socketname {
+ reg = <0x02 0x10>;
+ type = "string";
+ default = "none";
+ };
+
+ socketserial {
+ reg = <0x12 0x19>;
+ type = "string";
+ default = "none";
+ };
+ };
+}
Maybe the missing backend-storage-type is a problem?
Im not sure how I calculate the backend-stridesize last time.
config fragments:
CONFIG_STATE=y
# CONFIG_STATE_CRYPTO is not set
CONFIG_CMD_STATE=y
CONFIG_STATE_DRV=y
Jan
> I can see in the eeprom section, too:
> barebox at Phytec phyCORE AM335x:/ of_dump i2c0
> i2c at 44e0b000 {
> compatible = "ti,omap4-i2c";
> #address-cells = <0x1>;
> #size-cells = <0x0>;
> ti,hwmods = "i2c1";
> reg = <0x44e0b000 0x1000>;
> interrupts = <0x46>;
> status = "okay";
> pinctrl-names = "default";
> pinctrl-0 = <0x2c>;
> clock-frequency = <0x61a80>;
> eeprom at 52 {
> status = "okay";
> compatible = "atmel,24c32";
> pagesize = <0x20>;
> reg = <0x52>;
> state at 1000 {
> label = "state";
> reg = <0x1000 0x1000>;
> linux,phandle = <0x42>;
> phandle = <0x42>;
> };
> };
> };
>
> But still state command does not show any state device:
> barebox at Phytec phyCORE AM335x:/ state
> registered state instances:
>
> Here is my diff for the dts:
> diff --git a/arch/arm/dts/am335x-phytec-phycore-som.dtsi
> b/arch/arm/dts/am335x-phytec-phycore-som.dtsi
> index 0b8c454..0d71e8b 100644
> --- a/arch/arm/dts/am335x-phytec-phycore-som.dtsi
> +++ b/arch/arm/dts/am335x-phytec-phycore-som.dtsi
> @@ -14,6 +14,26 @@
> status = "disabled";
> };
> };
> +
> + state: state at 0 {
> + magic = <0x27031977>;
> + compatible = "barebox,state";
> + backend-type = "raw";
> + backend = <&state_part>;
> +
> + foo {
> + reg = <0x00 0x4>;
> + type = "uint32";
> + default = <0x0>;
> + };
> +
> + bar {
> + reg = <0x10 0x4>;
> + type = "enum32";
> + names = "baz", "qux";
> + default = <1>;
> + };
> + };
> };
>
> &am33xx_pinmux {
> @@ -148,6 +168,10 @@
> compatible = "atmel,24c32";
> pagesize = <32>;
> reg = <0x52>;
> + state_part: state at 1000 {
> + label = "state";
> + reg = <0x1000 0x1000>;
> + };
> };
> };
>
> So, why does not state framework catch my state device?
>
> Sincerely,
> --
> Çağlar Kilimci
>
> _______________________________________________
> barebox mailing list
> barebox at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
More information about the barebox
mailing list