mvebu-mbus.txt 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. * Marvell MBus
  2. Required properties:
  3. - compatible: Should be set to one of the following:
  4. marvell,armada370-mbus
  5. marvell,armadaxp-mbus
  6. marvell,armada375-mbus
  7. marvell,armada380-mbus
  8. marvell,kirkwood-mbus
  9. marvell,dove-mbus
  10. marvell,orion5x-88f5281-mbus
  11. marvell,orion5x-88f5182-mbus
  12. marvell,orion5x-88f5181-mbus
  13. marvell,orion5x-88f6183-mbus
  14. marvell,mv78xx0-mbus
  15. - address-cells: Must be '2'. The first cell for the MBus ID encoding,
  16. the second cell for the address offset within the window.
  17. - size-cells: Must be '1'.
  18. - ranges: Must be set up to provide a proper translation for each child.
  19. See the examples below.
  20. - controller: Contains a single phandle referring to the MBus controller
  21. node. This allows to specify the node that contains the
  22. registers that control the MBus, which is typically contained
  23. within the internal register window (see below).
  24. Optional properties:
  25. - pcie-mem-aperture: This optional property contains the aperture for
  26. the memory region of the PCIe driver.
  27. If it's defined, it must encode the base address and
  28. size for the address decoding windows allocated for
  29. the PCIe memory region.
  30. - pcie-io-aperture: Just as explained for the above property, this
  31. optional property contains the aperture for the
  32. I/O region of the PCIe driver.
  33. * Marvell MBus controller
  34. Required properties:
  35. - compatible: Should be set to "marvell,mbus-controller".
  36. - reg: Device's register space.
  37. Two or three entries are expected (see the examples below):
  38. the first one controls the devices decoding window,
  39. the second one controls the SDRAM decoding window and
  40. the third controls the MBus bridge (only with the
  41. marvell,armada370-mbus and marvell,armadaxp-mbus
  42. compatible strings)
  43. Example:
  44. soc {
  45. compatible = "marvell,armada370-mbus", "simple-bus";
  46. #address-cells = <2>;
  47. #size-cells = <1>;
  48. controller = <&mbusc>;
  49. pcie-mem-aperture = <0xe0000000 0x8000000>;
  50. pcie-io-aperture = <0xe8000000 0x100000>;
  51. internal-regs {
  52. compatible = "simple-bus";
  53. mbusc: mbus-controller@20000 {
  54. compatible = "marvell,mbus-controller";
  55. reg = <0x20000 0x100>, <0x20180 0x20>, <0x20250 0x8>;
  56. };
  57. /* more children ...*/
  58. };
  59. };
  60. ** MBus address decoding window specification
  61. The MBus children address space is comprised of two cells: the first one for
  62. the window ID and the second one for the offset within the window.
  63. In order to allow to describe valid and non-valid window entries, the
  64. following encoding is used:
  65. 0xSIAA0000 0x00oooooo
  66. Where:
  67. S = 0x0 for a MBus valid window
  68. S = 0xf for a non-valid window (see below)
  69. If S = 0x0, then:
  70. I = 4-bit window target ID
  71. AA = windpw attribute
  72. If S = 0xf, then:
  73. I = don't care
  74. AA = 1 for internal register
  75. Following the above encoding, for each ranges entry for a MBus valid window
  76. (S = 0x0), an address decoding window is allocated. On the other side,
  77. entries for translation that do not correspond to valid windows (S = 0xf)
  78. are skipped.
  79. soc {
  80. compatible = "marvell,armada370-mbus", "simple-bus";
  81. #address-cells = <2>;
  82. #size-cells = <1>;
  83. controller = <&mbusc>;
  84. ranges = <0xf0010000 0 0 0xd0000000 0x100000
  85. 0x01e00000 0 0 0xfff00000 0x100000>;
  86. bootrom {
  87. compatible = "marvell,bootrom";
  88. reg = <0x01e00000 0 0x100000>;
  89. };
  90. /* other children */
  91. ...
  92. internal-regs {
  93. compatible = "simple-bus";
  94. ranges = <0 0xf0010000 0 0x100000>;
  95. mbusc: mbus-controller@20000 {
  96. compatible = "marvell,mbus-controller";
  97. reg = <0x20000 0x100>, <0x20180 0x20>, <0x20250 0x8>;
  98. };
  99. /* more children ...*/
  100. };
  101. };
  102. In the shown example, the translation entry in the 'ranges' property is what
  103. makes the MBus driver create a static decoding window for the corresponding
  104. given child device. Note that the binding does not require child nodes to be
  105. present. Of course, child nodes are needed to probe the devices.
  106. Since each window is identified by its target ID and attribute ID there's
  107. a special macro that can be use to simplify the translation entries:
  108. #define MBUS_ID(target,attributes) (((target) << 24) | ((attributes) << 16))
  109. Using this macro, the above example would be:
  110. soc {
  111. compatible = "marvell,armada370-mbus", "simple-bus";
  112. #address-cells = <2>;
  113. #size-cells = <1>;
  114. controller = <&mbusc>;
  115. ranges = < MBUS_ID(0xf0, 0x01) 0 0 0xd0000000 0x100000
  116. MBUS_ID(0x01, 0xe0) 0 0 0xfff00000 0x100000>;
  117. bootrom {
  118. compatible = "marvell,bootrom";
  119. reg = <MBUS_ID(0x01, 0xe0) 0 0x100000>;
  120. };
  121. /* other children */
  122. ...
  123. internal-regs {
  124. compatible = "simple-bus";
  125. #address-cells = <1>;
  126. #size-cells = <1>;
  127. ranges = <0 MBUS_ID(0xf0, 0x01) 0 0x100000>;
  128. mbusc: mbus-controller@20000 {
  129. compatible = "marvell,mbus-controller";
  130. reg = <0x20000 0x100>, <0x20180 0x20>, <0x20250 0x8>;
  131. };
  132. /* other children */
  133. ...
  134. };
  135. };
  136. ** About the window base address
  137. Remember the MBus controller allows a great deal of flexibility for choosing
  138. the decoding window base address. When planning the device tree layout it's
  139. possible to choose any address as the base address, provided of course there's
  140. a region large enough available, and with the required alignment.
  141. Yet in other words: there's nothing preventing us from setting a base address
  142. of 0xf0000000, or 0xd0000000 for the NOR device shown above, if such region is
  143. unused.
  144. ** Window allocation policy
  145. The mbus-node ranges property defines a set of mbus windows that are expected
  146. to be set by the operating system and that are guaranteed to be free of overlaps
  147. with one another or with the system memory ranges.
  148. Each entry in the property refers to exactly one window. If the operating system
  149. chooses to use a different set of mbus windows, it must ensure that any address
  150. translations performed from downstream devices are adapted accordingly.
  151. The operating system may insert additional mbus windows that do not conflict
  152. with the ones listed in the ranges, e.g. for mapping PCIe devices.
  153. As a special case, the internal register window must be set up by the boot
  154. loader at the address listed in the ranges property, since access to that region
  155. is needed to set up the other windows.
  156. ** Example
  157. See the example below, where a more complete device tree is shown:
  158. soc {
  159. compatible = "marvell,armadaxp-mbus", "simple-bus";
  160. controller = <&mbusc>;
  161. ranges = <MBUS_ID(0xf0, 0x01) 0 0 0xd0000000 0x100000 /* internal-regs */
  162. MBUS_ID(0x01, 0x1d) 0 0 0xfff00000 0x100000
  163. MBUS_ID(0x01, 0x2f) 0 0 0xf0000000 0x8000000>;
  164. bootrom {
  165. compatible = "marvell,bootrom";
  166. reg = <MBUS_ID(0x01, 0x1d) 0 0x100000>;
  167. };
  168. devbus-bootcs {
  169. status = "okay";
  170. ranges = <0 MBUS_ID(0x01, 0x2f) 0 0x8000000>;
  171. /* NOR */
  172. nor {
  173. compatible = "cfi-flash";
  174. reg = <0 0x8000000>;
  175. bank-width = <2>;
  176. };
  177. };
  178. pcie-controller {
  179. compatible = "marvell,armada-xp-pcie";
  180. status = "okay";
  181. device_type = "pci";
  182. #address-cells = <3>;
  183. #size-cells = <2>;
  184. ranges =
  185. <0x82000000 0 0x40000 MBUS_ID(0xf0, 0x01) 0x40000 0 0x00002000 /* Port 0.0 registers */
  186. 0x82000000 0 0x42000 MBUS_ID(0xf0, 0x01) 0x42000 0 0x00002000 /* Port 2.0 registers */
  187. 0x82000000 0 0x44000 MBUS_ID(0xf0, 0x01) 0x44000 0 0x00002000 /* Port 0.1 registers */
  188. 0x82000000 0 0x48000 MBUS_ID(0xf0, 0x01) 0x48000 0 0x00002000 /* Port 0.2 registers */
  189. 0x82000000 0 0x4c000 MBUS_ID(0xf0, 0x01) 0x4c000 0 0x00002000 /* Port 0.3 registers */
  190. 0x82000800 0 0xe0000000 MBUS_ID(0x04, 0xe8) 0xe0000000 0 0x08000000 /* Port 0.0 MEM */
  191. 0x81000800 0 0 MBUS_ID(0x04, 0xe0) 0xe8000000 0 0x00100000 /* Port 0.0 IO */>;
  192. pcie@1,0 {
  193. /* Port 0, Lane 0 */
  194. status = "okay";
  195. };
  196. };
  197. internal-regs {
  198. compatible = "simple-bus";
  199. #address-cells = <1>;
  200. #size-cells = <1>;
  201. ranges = <0 MBUS_ID(0xf0, 0x01) 0 0x100000>;
  202. mbusc: mbus-controller@20000 {
  203. reg = <0x20000 0x100>, <0x20180 0x20>, <0x20250 0x8>;
  204. };
  205. interrupt-controller@20000 {
  206. reg = <0x20a00 0x2d0>, <0x21070 0x58>;
  207. };
  208. };
  209. };