1Common properties
2=================
3
4Endianness
5----------
6
7The Devicetree Specification does not define any properties related to hardware
8byteswapping, but endianness issues show up frequently in porting Linux to
9different machine types.  This document attempts to provide a consistent
10way of handling byteswapping across drivers.
11
12Optional properties:
13 - big-endian: Boolean; force big endian register accesses
14   unconditionally (e.g. ioread32be/iowrite32be).  Use this if you
15   know the peripheral always needs to be accessed in BE mode.
16 - little-endian: Boolean; force little endian register accesses
17   unconditionally (e.g. readl/writel).  Use this if you know the
18   peripheral always needs to be accessed in LE mode.
19 - native-endian: Boolean; always use register accesses matched to the
20   endianness of the kernel binary (e.g. LE vmlinux -> readl/writel,
21   BE vmlinux -> ioread32be/iowrite32be).  In this case no byteswaps
22   will ever be performed.  Use this if the hardware "self-adjusts"
23   register endianness based on the CPU's configured endianness.
24
25If a binding supports these properties, then the binding should also
26specify the default behavior if none of these properties are present.
27In such cases, little-endian is the preferred default, but it is not
28a requirement.  The of_device_is_big_endian() and of_fdt_is_big_endian()
29helper functions do assume that little-endian is the default, because
30most existing (PCI-based) drivers implicitly default to LE by using
31readl/writel for MMIO accesses.
32
33Examples:
34Scenario 1 : CPU in LE mode & device in LE mode.
35dev: dev@40031000 {
36	      compatible = "name";
37	      reg = <0x40031000 0x1000>;
38	      ...
39	      native-endian;
40};
41
42Scenario 2 : CPU in LE mode & device in BE mode.
43dev: dev@40031000 {
44	      compatible = "name";
45	      reg = <0x40031000 0x1000>;
46	      ...
47	      big-endian;
48};
49
50Scenario 3 : CPU in BE mode & device in BE mode.
51dev: dev@40031000 {
52	      compatible = "name";
53	      reg = <0x40031000 0x1000>;
54	      ...
55	      native-endian;
56};
57
58Scenario 4 : CPU in BE mode & device in LE mode.
59dev: dev@40031000 {
60	      compatible = "name";
61	      reg = <0x40031000 0x1000>;
62	      ...
63	      little-endian;
64};
65
66Daisy-chained devices
67---------------------
68
69Many serially-attached GPIO and IIO devices are daisy-chainable.  To the
70host controller, a daisy-chain appears as a single device, but the number
71of inputs and outputs it provides is the sum of inputs and outputs provided
72by all of its devices.  The driver needs to know how many devices the
73daisy-chain comprises to determine the amount of data exchanged, how many
74inputs and outputs to register and so on.
75
76Optional properties:
77 - #daisy-chained-devices: Number of devices in the daisy-chain (default is 1).
78
79Example:
80gpio@0 {
81	      compatible = "name";
82	      reg = <0>;
83	      gpio-controller;
84	      #gpio-cells = <2>;
85	      #daisy-chained-devices = <3>;
86};
87