common-properties.txt 2.8 KB

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