3 The Devicetree Specification does not define any properties related to hardware
4 byteswapping, but endianness issues show up frequently in porting Linux to
5 different machine types. This document attempts to provide a consistent
6 way of handling byteswapping across drivers.
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.
21 If a binding supports these properties, then the binding should also
22 specify the default behavior if none of these properties are present.
23 In such cases, little-endian is the preferred default, but it is not
24 a requirement. The of_device_is_big_endian() and of_fdt_is_big_endian()
25 helper functions do assume that little-endian is the default, because
26 most existing (PCI-based) drivers implicitly default to LE by using
27 readl/writel for MMIO accesses.
30 Scenario 1 : CPU in LE mode & device in LE mode.
33 reg = <0x40031000 0x1000>;
38 Scenario 2 : CPU in LE mode & device in BE mode.
41 reg = <0x40031000 0x1000>;
46 Scenario 3 : CPU in BE mode & device in BE mode.
49 reg = <0x40031000 0x1000>;
54 Scenario 4 : CPU in BE mode & device in LE mode.
57 reg = <0x40031000 0x1000>;