|
1 | | -Device-Tree binding for regmap |
2 | | - |
3 | | -The endianness mode of CPU & Device scenarios: |
4 | | -Index Device Endianness properties |
5 | | ---------------------------------------------------- |
6 | | -1 BE 'big-endian' |
7 | | -2 LE 'little-endian' |
8 | | -3 Native 'native-endian' |
9 | | - |
10 | | -For one device driver, which will run in different scenarios above |
11 | | -on different SoCs using the devicetree, we need one way to simplify |
12 | | -this. |
| 1 | +Devicetree binding for regmap |
13 | 2 |
|
14 | 3 | Optional properties: |
15 | | -- {big,little,native}-endian: these are boolean properties, if absent |
16 | | - then the implementation will choose a default based on the device |
17 | | - being controlled. These properties are for register values and all |
18 | | - the buffers only. Native endian means that the CPU and device have |
19 | | - the same endianness. |
20 | 4 |
|
21 | | -Examples: |
22 | | -Scenario 1 : CPU in LE mode & device in LE mode. |
23 | | -dev: dev@40031000 { |
24 | | - compatible = "name"; |
25 | | - reg = <0x40031000 0x1000>; |
26 | | - ... |
27 | | -}; |
| 5 | + little-endian, |
| 6 | + big-endian, |
| 7 | + native-endian: See common-properties.txt for a definition |
28 | 8 |
|
29 | | -Scenario 2 : CPU in LE mode & device in BE mode. |
30 | | -dev: dev@40031000 { |
31 | | - compatible = "name"; |
32 | | - reg = <0x40031000 0x1000>; |
33 | | - ... |
34 | | - big-endian; |
35 | | -}; |
| 9 | +Note: |
| 10 | +Regmap defaults to little-endian register access on MMIO based |
| 11 | +devices, this is by far the most common setting. On CPU |
| 12 | +architectures that typically run big-endian operating systems |
| 13 | +(e.g. PowerPC), registers can be defined as big-endian and must |
| 14 | +be marked that way in the devicetree. |
36 | 15 |
|
37 | | -Scenario 3 : CPU in BE mode & device in BE mode. |
38 | | -dev: dev@40031000 { |
39 | | - compatible = "name"; |
40 | | - reg = <0x40031000 0x1000>; |
41 | | - ... |
42 | | -}; |
| 16 | +On SoCs that can be operated in both big-endian and little-endian |
| 17 | +modes, with a single hardware switch controlling both the endianess |
| 18 | +of the CPU and a byteswap for MMIO registers (e.g. many Broadcom MIPS |
| 19 | +chips), "native-endian" is used to allow using the same device tree |
| 20 | +blob in both cases. |
43 | 21 |
|
44 | | -Scenario 4 : CPU in BE mode & device in LE mode. |
| 22 | +Examples: |
| 23 | +Scenario 1 : a register set in big-endian mode. |
45 | 24 | dev: dev@40031000 { |
46 | | - compatible = "name"; |
| 25 | + compatible = "syscon"; |
47 | 26 | reg = <0x40031000 0x1000>; |
| 27 | + big-endian; |
48 | 28 | ... |
49 | | - little-endian; |
50 | 29 | }; |
0 commit comments