aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
context:
space:
mode:
authorKevin Cernekee <cernekee@gmail.com>2015-04-09 16:05:16 -0400
committerRob Herring <robh@kernel.org>2015-04-14 20:35:44 -0400
commit65a71007a20cfe7ebd456d72c0bb155fe42de963 (patch)
tree19aeffd5e991fa7e0088dee899940a12344778e2 /Documentation
parentcc7837867a559feba70fdf68eb53c24a84e3712f (diff)
of: Document {little,big,native}-endian bindings
These apply to newly converted drivers, like serial8250/libahci/... The examples were adapted from the regmap bindings document. Signed-off-by: Kevin Cernekee <cernekee@gmail.com> Reviewed-by: Peter Hurley <peter@hurleysoftware.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Rob Herring <robh@kernel.org>
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/devicetree/bindings/common-properties.txt60
1 files changed, 60 insertions, 0 deletions
diff --git a/Documentation/devicetree/bindings/common-properties.txt b/Documentation/devicetree/bindings/common-properties.txt
new file mode 100644
index 000000000000..3193979b1d05
--- /dev/null
+++ b/Documentation/devicetree/bindings/common-properties.txt
@@ -0,0 +1,60 @@
1Common properties
2
3The ePAPR specification does not define any properties related to hardware
4byteswapping, but endianness issues show up frequently in porting Linux to
5different machine types. This document attempts to provide a consistent
6way of handling byteswapping across drivers.
7
8Optional properties:
9 - big-endian: Boolean; force big endian register accesses
10 unconditionally (e.g. ioread32be/iowrite32be). Use this if you
11 know the peripheral always needs to be accessed in BE mode.
12 - little-endian: Boolean; force little endian register accesses
13 unconditionally (e.g. readl/writel). Use this if you know the
14 peripheral always needs to be accessed in LE mode.
15 - native-endian: Boolean; always use register accesses matched to the
16 endianness of the kernel binary (e.g. LE vmlinux -> readl/writel,
17 BE vmlinux -> ioread32be/iowrite32be). In this case no byteswaps
18 will ever be performed. Use this if the hardware "self-adjusts"
19 register endianness based on the CPU's configured endianness.
20
21If a binding supports these properties, then the binding should also
22specify the default behavior if none of these properties are present.
23In such cases, little-endian is the preferred default, but it is not
24a requirement. The of_device_is_big_endian() and of_fdt_is_big_endian()
25helper functions do assume that little-endian is the default, because
26most existing (PCI-based) drivers implicitly default to LE by using
27readl/writel for MMIO accesses.
28
29Examples:
30Scenario 1 : CPU in LE mode & device in LE mode.
31dev: dev@40031000 {
32 compatible = "name";
33 reg = <0x40031000 0x1000>;
34 ...
35 native-endian;
36};
37
38Scenario 2 : CPU in LE mode & device in BE mode.
39dev: dev@40031000 {
40 compatible = "name";
41 reg = <0x40031000 0x1000>;
42 ...
43 big-endian;
44};
45
46Scenario 3 : CPU in BE mode & device in BE mode.
47dev: dev@40031000 {
48 compatible = "name";
49 reg = <0x40031000 0x1000>;
50 ...
51 native-endian;
52};
53
54Scenario 4 : CPU in BE mode & device in LE mode.
55dev: dev@40031000 {
56 compatible = "name";
57 reg = <0x40031000 0x1000>;
58 ...
59 little-endian;
60};