Merge remote-tracking branches 'asoc/topic/rl6231', 'asoc/topic/rt5514', 'asoc/topic...
[sfrench/cifs-2.6.git] / Documentation / devicetree / bindings / common-properties.txt
1 Common properties
2 =================
3
4 Endianness
5 ----------
6
7 The Devicetree Specification does not define any properties related to hardware
8 byteswapping, but endianness issues show up frequently in porting Linux to
9 different machine types.  This document attempts to provide a consistent
10 way of handling byteswapping across drivers.
11
12 Optional 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
25 If a binding supports these properties, then the binding should also
26 specify the default behavior if none of these properties are present.
27 In such cases, little-endian is the preferred default, but it is not
28 a requirement.  The of_device_is_big_endian() and of_fdt_is_big_endian()
29 helper functions do assume that little-endian is the default, because
30 most existing (PCI-based) drivers implicitly default to LE by using
31 readl/writel for MMIO accesses.
32
33 Examples:
34 Scenario 1 : CPU in LE mode & device in LE mode.
35 dev: dev@40031000 {
36               compatible = "name";
37               reg = <0x40031000 0x1000>;
38               ...
39               native-endian;
40 };
41
42 Scenario 2 : CPU in LE mode & device in BE mode.
43 dev: dev@40031000 {
44               compatible = "name";
45               reg = <0x40031000 0x1000>;
46               ...
47               big-endian;
48 };
49
50 Scenario 3 : CPU in BE mode & device in BE mode.
51 dev: dev@40031000 {
52               compatible = "name";
53               reg = <0x40031000 0x1000>;
54               ...
55               native-endian;
56 };
57
58 Scenario 4 : CPU in BE mode & device in LE mode.
59 dev: dev@40031000 {
60               compatible = "name";
61               reg = <0x40031000 0x1000>;
62               ...
63               little-endian;
64 };
65
66 Daisy-chained devices
67 ---------------------
68
69 Many serially-attached GPIO and IIO devices are daisy-chainable.  To the
70 host controller, a daisy-chain appears as a single device, but the number
71 of inputs and outputs it provides is the sum of inputs and outputs provided
72 by all of its devices.  The driver needs to know how many devices the
73 daisy-chain comprises to determine the amount of data exchanged, how many
74 inputs and outputs to register and so on.
75
76 Optional properties:
77  - #daisy-chained-devices: Number of devices in the daisy-chain (default is 1).
78
79 Example:
80 gpio@0 {
81               compatible = "name";
82               reg = <0>;
83               gpio-controller;
84               #gpio-cells = <2>;
85               #daisy-chained-devices = <3>;
86 };