From: Trostel Alain <Alain.Trostel@xxxxxxxxxxxxxx> Some improvements for the state binding documentation. These come from the conversation with Trostel Alain who tried to use the state framework and stumbled upon these things missing. Patch originally by Alain, thanks. Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx> --- .../devicetree/bindings/barebox/barebox,state.rst | 39 +++++++++++++++++++--- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/Documentation/devicetree/bindings/barebox/barebox,state.rst b/Documentation/devicetree/bindings/barebox/barebox,state.rst index 438cc43..7b9d1bb 100644 --- a/Documentation/devicetree/bindings/barebox/barebox,state.rst +++ b/Documentation/devicetree/bindings/barebox/barebox,state.rst @@ -43,6 +43,16 @@ Optional properties: moment. For MTD with erasing the correct type is ``circular``. For all other devices and files, ``direct`` is the needed type. +Configuration +------------- + +The following config options must be enabled when building the barebox image +to have full support of the barebox state framework: + +* CONFIG_STATE +* CONFIG_STATE_DRV +* CONFIG_CMD_STATE + Variable nodes -------------- @@ -71,13 +81,18 @@ Optional properties: storage. For ``enum32`` values it is an integer representing an offset into the names array. -Example:: +The following examples have to be configured in the board-specific device +tree files (\*.dts) within barebox. - state: state@0 { +State example:: + + state: state { magic = <0x27031977>; compatible = "barebox,state"; backend-type = "raw"; - backend = &eeprom, "partname:state"; + backend = &part_state; + #address-cells = <1>; + #size-cells = <1>; foo { reg = <0x00 0x4>; @@ -93,6 +108,13 @@ Example:: }; }; +Partition example:: + + part_state: partition@1C0000 { + label = "state"; + reg = <0x1C0000 0x60000>; + }; + Variable Types -------------- @@ -139,4 +161,13 @@ be accessed like normal shell variables. The ``state`` command is used to save/restore a state to the backend device. After initializing the variable can be accessed with ``$state.foo``. -``state -s`` stores the state to eeprom. +``state -s`` stores the state persistently. + +From Linux +---------- + +It exists a tool called «barebox-state» to access these state variables +from the Linux user-space. The mentioned tool is available as GIT project +under the following location:: + + git://git.pengutronix.de/git/tools/dt-utils.git -- 2.10.2 _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox