| .. | .. |
|---|
| 5 | 5 | ---------- |
|---|
| 6 | 6 | |
|---|
| 7 | 7 | The Devicetree Specification does not define any properties related to hardware |
|---|
| 8 | | -byteswapping, but endianness issues show up frequently in porting Linux to |
|---|
| 8 | +byte swapping, but endianness issues show up frequently in porting drivers to |
|---|
| 9 | 9 | different machine types. This document attempts to provide a consistent |
|---|
| 10 | | -way of handling byteswapping across drivers. |
|---|
| 10 | +way of handling byte swapping across drivers. |
|---|
| 11 | 11 | |
|---|
| 12 | 12 | Optional properties: |
|---|
| 13 | 13 | - big-endian: Boolean; force big endian register accesses |
|---|
| 14 | 14 | unconditionally (e.g. ioread32be/iowrite32be). Use this if you |
|---|
| 15 | | - know the peripheral always needs to be accessed in BE mode. |
|---|
| 15 | + know the peripheral always needs to be accessed in big endian (BE) mode. |
|---|
| 16 | 16 | - little-endian: Boolean; force little endian register accesses |
|---|
| 17 | 17 | unconditionally (e.g. readl/writel). Use this if you know the |
|---|
| 18 | | - peripheral always needs to be accessed in LE mode. |
|---|
| 18 | + peripheral always needs to be accessed in little endian (LE) mode. |
|---|
| 19 | 19 | - native-endian: Boolean; always use register accesses matched to the |
|---|
| 20 | 20 | endianness of the kernel binary (e.g. LE vmlinux -> readl/writel, |
|---|
| 21 | | - BE vmlinux -> ioread32be/iowrite32be). In this case no byteswaps |
|---|
| 21 | + BE vmlinux -> ioread32be/iowrite32be). In this case no byte swaps |
|---|
| 22 | 22 | will ever be performed. Use this if the hardware "self-adjusts" |
|---|
| 23 | 23 | register endianness based on the CPU's configured endianness. |
|---|
| 24 | 24 | |
|---|
| 25 | 25 | If a binding supports these properties, then the binding should also |
|---|
| 26 | 26 | specify the default behavior if none of these properties are present. |
|---|
| 27 | 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. |
|---|
| 28 | +a requirement. Some implementations assume that little-endian is |
|---|
| 29 | +the default, because most existing (PCI-based) drivers implicitly |
|---|
| 30 | +default to LE for their MMIO accesses. |
|---|
| 32 | 31 | |
|---|
| 33 | 32 | Examples: |
|---|
| 34 | 33 | Scenario 1 : CPU in LE mode & device in LE mode. |
|---|