summaryrefslogtreecommitdiffstats
path: root/arch/arm/dts/state-example.dtsi
blob: 4572168336aec36a35db477fb0f289329dfd405a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/*
 * This code is released using a dual license strategy: BSD/GPL
 * You can choose the licence that better fits your requirements.
 *
 * Released under the terms of 3-clause BSD License
 * Released under the terms of GNU General Public License Version 2.0
 *
 */

/*
 * This contains an example how to use the state framework. This file
 * can be directly included by imx6qdl-phytec-pbab01.dtsi, other boards
 * need adjustments. Note that this example may use the partitions in
 * other ways than intended by phytec, so before using this see below
 * if it will overwrite some precious data.
 */

#define STATE_VARS \
	#address-cells = <1>;				\
	#size-cells = <1>;				\
	mac {						\
		reg = <0x0 0x6>;			\
		type = "mac";				\
	};						\
							\
	number {					\
		reg = <0x8 0x4>;			\
		type = "uint32";			\
	};						\
							\
	name {						\
		reg = <0xc 0x10>;			\
		type = "string";			\
	};						\
							\
	fruit {						\
		reg = <0x1c 0x4>;			\
		type = "enum32";			\
		names = "apple", "pear", "banana";	\
	}

/ {
	aliases {
		state_nor = &state_nor;
		state_nand = &state_nand;
		state_sd = &state_sd;
		state_eeprom = &state_eeprom;
	};

	state_nor: state_nor {
		magic = <0x512890a0>;
		compatible = "barebox,state";
		backend-type = "raw";
		backend = <&backend_state_nor>;
		backend-storage-type = "circular";

		STATE_VARS;
	};

	state_nand: state_nand {
		magic = <0xab67421f>;
		compatible = "barebox,state";
		backend-type = "raw";
		backend = <&backend_state_nand>;
		backend-storage-type = "circular";

		STATE_VARS;
	};

	state_sd: state_sd {
		magic = <0xef784236>;
		compatible = "barebox,state";
		backend-type = "raw";
		backend = <&backend_state_usdhc>;
		backend-stridesize = <1024>;

		STATE_VARS;
	};

	state_eeprom: state_eeprom {
		magic = <0x344682db>;
		compatible = "barebox,state";
		backend-type = "raw";
		backend = <&backend_state_eeprom>;
		backend-stridesize = <64>;

		STATE_VARS;
	};

};

backend_state_nor: &{ecspi3/flash@0/partitions/partition@120000} {
};

/* Reduce barebox partition size from 16M to 15M */
&{gpmi/partitions/partition@0} {
	reg = <0x0 0xf00000>;
};

&{gpmi/partitions} {
	backend_state_nand: partition@f00000 {
		label = "barebox-state";
		reg = <0xf00000 0x100000>;
	};
};

&som_eeprom { /* On I2C1 */
	partitions {
		compatible = "fixed-partitions";
		#size-cells = <1>;
		#address-cells = <1>;
		backend_state_eeprom: state@400 {
			reg = <0x400 0x400>;
			label = "state-eeprom";
		};
	};
};

&usdhc2 {
	partitions {
		compatible = "fixed-partitions";
		#size-cells = <1>;
		#address-cells = <1>;
		backend_state_usdhc: state@0x80000 {
			reg = <0x80000 0x80000>;
			label = "state-sd";
		};
	};
};