common-properties.txt 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. Common properties
  2. The ePAPR specification does not define any properties related to hardware
  3. byteswapping, but endianness issues show up frequently in porting Linux to
  4. different machine types. This document attempts to provide a consistent
  5. way of handling byteswapping across drivers.
  6. Optional properties:
  7. - big-endian: Boolean; force big endian register accesses
  8. unconditionally (e.g. ioread32be/iowrite32be). Use this if you
  9. know the peripheral always needs to be accessed in BE mode.
  10. - little-endian: Boolean; force little endian register accesses
  11. unconditionally (e.g. readl/writel). Use this if you know the
  12. peripheral always needs to be accessed in LE mode.
  13. - native-endian: Boolean; always use register accesses matched to the
  14. endianness of the kernel binary (e.g. LE vmlinux -> readl/writel,
  15. BE vmlinux -> ioread32be/iowrite32be). In this case no byteswaps
  16. will ever be performed. Use this if the hardware "self-adjusts"
  17. register endianness based on the CPU's configured endianness.
  18. If a binding supports these properties, then the binding should also
  19. specify the default behavior if none of these properties are present.
  20. In such cases, little-endian is the preferred default, but it is not
  21. a requirement. The of_device_is_big_endian() and of_fdt_is_big_endian()
  22. helper functions do assume that little-endian is the default, because
  23. most existing (PCI-based) drivers implicitly default to LE by using
  24. readl/writel for MMIO accesses.
  25. Examples:
  26. Scenario 1 : CPU in LE mode & device in LE mode.
  27. dev: dev@40031000 {
  28. compatible = "name";
  29. reg = <0x40031000 0x1000>;
  30. ...
  31. native-endian;
  32. };
  33. Scenario 2 : CPU in LE mode & device in BE mode.
  34. dev: dev@40031000 {
  35. compatible = "name";
  36. reg = <0x40031000 0x1000>;
  37. ...
  38. big-endian;
  39. };
  40. Scenario 3 : CPU in BE mode & device in BE mode.
  41. dev: dev@40031000 {
  42. compatible = "name";
  43. reg = <0x40031000 0x1000>;
  44. ...
  45. native-endian;
  46. };
  47. Scenario 4 : CPU in BE mode & device in LE mode.
  48. dev: dev@40031000 {
  49. compatible = "name";
  50. reg = <0x40031000 0x1000>;
  51. ...
  52. little-endian;
  53. };