10b125278SEzequiel Garcia 20b125278SEzequiel Garcia* Marvell MBus 30b125278SEzequiel Garcia 40b125278SEzequiel GarciaRequired properties: 50b125278SEzequiel Garcia 60b125278SEzequiel Garcia- compatible: Should be set to one of the following: 70b125278SEzequiel Garcia marvell,armada370-mbus 80b125278SEzequiel Garcia marvell,armadaxp-mbus 9ddefbdb4SThomas Petazzoni marvell,armada375-mbus 10ddefbdb4SThomas Petazzoni marvell,armada380-mbus 110b125278SEzequiel Garcia marvell,kirkwood-mbus 120b125278SEzequiel Garcia marvell,dove-mbus 130b125278SEzequiel Garcia marvell,orion5x-88f5281-mbus 140b125278SEzequiel Garcia marvell,orion5x-88f5182-mbus 150b125278SEzequiel Garcia marvell,orion5x-88f5181-mbus 160b125278SEzequiel Garcia marvell,orion5x-88f6183-mbus 170b125278SEzequiel Garcia marvell,mv78xx0-mbus 180b125278SEzequiel Garcia 190b125278SEzequiel Garcia- address-cells: Must be '2'. The first cell for the MBus ID encoding, 200b125278SEzequiel Garcia the second cell for the address offset within the window. 210b125278SEzequiel Garcia 220b125278SEzequiel Garcia- size-cells: Must be '1'. 230b125278SEzequiel Garcia 240b125278SEzequiel Garcia- ranges: Must be set up to provide a proper translation for each child. 250b125278SEzequiel Garcia See the examples below. 260b125278SEzequiel Garcia 270b125278SEzequiel Garcia- controller: Contains a single phandle referring to the MBus controller 280b125278SEzequiel Garcia node. This allows to specify the node that contains the 290b125278SEzequiel Garcia registers that control the MBus, which is typically contained 300b125278SEzequiel Garcia within the internal register window (see below). 310b125278SEzequiel Garcia 320b125278SEzequiel GarciaOptional properties: 330b125278SEzequiel Garcia 340b125278SEzequiel Garcia- pcie-mem-aperture: This optional property contains the aperture for 350b125278SEzequiel Garcia the memory region of the PCIe driver. 360b125278SEzequiel Garcia If it's defined, it must encode the base address and 370b125278SEzequiel Garcia size for the address decoding windows allocated for 380b125278SEzequiel Garcia the PCIe memory region. 390b125278SEzequiel Garcia 400b125278SEzequiel Garcia- pcie-io-aperture: Just as explained for the above property, this 410b125278SEzequiel Garcia optional property contains the aperture for the 420b125278SEzequiel Garcia I/O region of the PCIe driver. 430b125278SEzequiel Garcia 440b125278SEzequiel Garcia* Marvell MBus controller 450b125278SEzequiel Garcia 460b125278SEzequiel GarciaRequired properties: 470b125278SEzequiel Garcia 480b125278SEzequiel Garcia- compatible: Should be set to "marvell,mbus-controller". 490b125278SEzequiel Garcia 500b125278SEzequiel Garcia- reg: Device's register space. 51a0e89c02SThomas Petazzoni Two or three entries are expected (see the examples below): 52a0e89c02SThomas Petazzoni the first one controls the devices decoding window, 53a0e89c02SThomas Petazzoni the second one controls the SDRAM decoding window and 54a0e89c02SThomas Petazzoni the third controls the MBus bridge (only with the 55a0e89c02SThomas Petazzoni marvell,armada370-mbus and marvell,armadaxp-mbus 56a0e89c02SThomas Petazzoni compatible strings) 570b125278SEzequiel Garcia 580b125278SEzequiel GarciaExample: 590b125278SEzequiel Garcia 600b125278SEzequiel Garcia soc { 610b125278SEzequiel Garcia compatible = "marvell,armada370-mbus", "simple-bus"; 620b125278SEzequiel Garcia #address-cells = <2>; 630b125278SEzequiel Garcia #size-cells = <1>; 640b125278SEzequiel Garcia controller = <&mbusc>; 650b125278SEzequiel Garcia pcie-mem-aperture = <0xe0000000 0x8000000>; 660b125278SEzequiel Garcia pcie-io-aperture = <0xe8000000 0x100000>; 670b125278SEzequiel Garcia 680b125278SEzequiel Garcia internal-regs { 690b125278SEzequiel Garcia compatible = "simple-bus"; 700b125278SEzequiel Garcia 710b125278SEzequiel Garcia mbusc: mbus-controller@20000 { 720b125278SEzequiel Garcia compatible = "marvell,mbus-controller"; 73a0e89c02SThomas Petazzoni reg = <0x20000 0x100>, <0x20180 0x20>, <0x20250 0x8>; 740b125278SEzequiel Garcia }; 750b125278SEzequiel Garcia 760b125278SEzequiel Garcia /* more children ...*/ 770b125278SEzequiel Garcia }; 780b125278SEzequiel Garcia }; 790b125278SEzequiel Garcia 800b125278SEzequiel Garcia** MBus address decoding window specification 810b125278SEzequiel Garcia 820b125278SEzequiel GarciaThe MBus children address space is comprised of two cells: the first one for 830b125278SEzequiel Garciathe window ID and the second one for the offset within the window. 840b125278SEzequiel GarciaIn order to allow to describe valid and non-valid window entries, the 850b125278SEzequiel Garciafollowing encoding is used: 860b125278SEzequiel Garcia 870b125278SEzequiel Garcia 0xSIAA0000 0x00oooooo 880b125278SEzequiel Garcia 890b125278SEzequiel GarciaWhere: 900b125278SEzequiel Garcia 910b125278SEzequiel Garcia S = 0x0 for a MBus valid window 920b125278SEzequiel Garcia S = 0xf for a non-valid window (see below) 930b125278SEzequiel Garcia 940b125278SEzequiel GarciaIf S = 0x0, then: 950b125278SEzequiel Garcia 960b125278SEzequiel Garcia I = 4-bit window target ID 970b125278SEzequiel Garcia AA = windpw attribute 980b125278SEzequiel Garcia 990b125278SEzequiel GarciaIf S = 0xf, then: 1000b125278SEzequiel Garcia 1010b125278SEzequiel Garcia I = don't care 1020b125278SEzequiel Garcia AA = 1 for internal register 1030b125278SEzequiel Garcia 1040b125278SEzequiel GarciaFollowing the above encoding, for each ranges entry for a MBus valid window 1050b125278SEzequiel Garcia(S = 0x0), an address decoding window is allocated. On the other side, 1060b125278SEzequiel Garciaentries for translation that do not correspond to valid windows (S = 0xf) 1070b125278SEzequiel Garciaare skipped. 1080b125278SEzequiel Garcia 1090b125278SEzequiel Garcia soc { 1100b125278SEzequiel Garcia compatible = "marvell,armada370-mbus", "simple-bus"; 1110b125278SEzequiel Garcia #address-cells = <2>; 1120b125278SEzequiel Garcia #size-cells = <1>; 1130b125278SEzequiel Garcia controller = <&mbusc>; 1140b125278SEzequiel Garcia 1150b125278SEzequiel Garcia ranges = <0xf0010000 0 0 0xd0000000 0x100000 1160b125278SEzequiel Garcia 0x01e00000 0 0 0xfff00000 0x100000>; 1170b125278SEzequiel Garcia 1180b125278SEzequiel Garcia bootrom { 1190b125278SEzequiel Garcia compatible = "marvell,bootrom"; 1200b125278SEzequiel Garcia reg = <0x01e00000 0 0x100000>; 1210b125278SEzequiel Garcia }; 1220b125278SEzequiel Garcia 1230b125278SEzequiel Garcia /* other children */ 1240b125278SEzequiel Garcia ... 1250b125278SEzequiel Garcia 1260b125278SEzequiel Garcia internal-regs { 1270b125278SEzequiel Garcia compatible = "simple-bus"; 1280b125278SEzequiel Garcia ranges = <0 0xf0010000 0 0x100000>; 1290b125278SEzequiel Garcia 1300b125278SEzequiel Garcia mbusc: mbus-controller@20000 { 1310b125278SEzequiel Garcia compatible = "marvell,mbus-controller"; 132a0e89c02SThomas Petazzoni reg = <0x20000 0x100>, <0x20180 0x20>, <0x20250 0x8>; 1330b125278SEzequiel Garcia }; 1340b125278SEzequiel Garcia 1350b125278SEzequiel Garcia /* more children ...*/ 1360b125278SEzequiel Garcia }; 1370b125278SEzequiel Garcia }; 1380b125278SEzequiel Garcia 1390b125278SEzequiel GarciaIn the shown example, the translation entry in the 'ranges' property is what 1400b125278SEzequiel Garciamakes the MBus driver create a static decoding window for the corresponding 1410b125278SEzequiel Garciagiven child device. Note that the binding does not require child nodes to be 1420b125278SEzequiel Garciapresent. Of course, child nodes are needed to probe the devices. 1430b125278SEzequiel Garcia 1440b125278SEzequiel GarciaSince each window is identified by its target ID and attribute ID there's 1450b125278SEzequiel Garciaa special macro that can be use to simplify the translation entries: 1460b125278SEzequiel Garcia 1470b125278SEzequiel Garcia#define MBUS_ID(target,attributes) (((target) << 24) | ((attributes) << 16)) 1480b125278SEzequiel Garcia 1490b125278SEzequiel GarciaUsing this macro, the above example would be: 1500b125278SEzequiel Garcia 1510b125278SEzequiel Garcia soc { 1520b125278SEzequiel Garcia compatible = "marvell,armada370-mbus", "simple-bus"; 1530b125278SEzequiel Garcia #address-cells = <2>; 1540b125278SEzequiel Garcia #size-cells = <1>; 1550b125278SEzequiel Garcia controller = <&mbusc>; 1560b125278SEzequiel Garcia 1570b125278SEzequiel Garcia ranges = < MBUS_ID(0xf0, 0x01) 0 0 0xd0000000 0x100000 1580b125278SEzequiel Garcia MBUS_ID(0x01, 0xe0) 0 0 0xfff00000 0x100000>; 1590b125278SEzequiel Garcia 1600b125278SEzequiel Garcia bootrom { 1610b125278SEzequiel Garcia compatible = "marvell,bootrom"; 1620b125278SEzequiel Garcia reg = <MBUS_ID(0x01, 0xe0) 0 0x100000>; 1630b125278SEzequiel Garcia }; 1640b125278SEzequiel Garcia 1650b125278SEzequiel Garcia /* other children */ 1660b125278SEzequiel Garcia ... 1670b125278SEzequiel Garcia 1680b125278SEzequiel Garcia internal-regs { 1690b125278SEzequiel Garcia compatible = "simple-bus"; 1700b125278SEzequiel Garcia #address-cells = <1>; 1710b125278SEzequiel Garcia #size-cells = <1>; 1720b125278SEzequiel Garcia ranges = <0 MBUS_ID(0xf0, 0x01) 0 0x100000>; 1730b125278SEzequiel Garcia 1740b125278SEzequiel Garcia mbusc: mbus-controller@20000 { 1750b125278SEzequiel Garcia compatible = "marvell,mbus-controller"; 176a0e89c02SThomas Petazzoni reg = <0x20000 0x100>, <0x20180 0x20>, <0x20250 0x8>; 1770b125278SEzequiel Garcia }; 1780b125278SEzequiel Garcia 1790b125278SEzequiel Garcia /* other children */ 1800b125278SEzequiel Garcia ... 1810b125278SEzequiel Garcia }; 1820b125278SEzequiel Garcia }; 1830b125278SEzequiel Garcia 1840b125278SEzequiel Garcia 1850b125278SEzequiel Garcia** About the window base address 1860b125278SEzequiel Garcia 1870b125278SEzequiel GarciaRemember the MBus controller allows a great deal of flexibility for choosing 1880b125278SEzequiel Garciathe decoding window base address. When planning the device tree layout it's 1890b125278SEzequiel Garciapossible to choose any address as the base address, provided of course there's 1900b125278SEzequiel Garciaa region large enough available, and with the required alignment. 1910b125278SEzequiel Garcia 1920b125278SEzequiel GarciaYet in other words: there's nothing preventing us from setting a base address 1930b125278SEzequiel Garciaof 0xf0000000, or 0xd0000000 for the NOR device shown above, if such region is 1940b125278SEzequiel Garciaunused. 1950b125278SEzequiel Garcia 1960b125278SEzequiel Garcia** Window allocation policy 1970b125278SEzequiel Garcia 1980b125278SEzequiel GarciaThe mbus-node ranges property defines a set of mbus windows that are expected 1990b125278SEzequiel Garciato be set by the operating system and that are guaranteed to be free of overlaps 2000b125278SEzequiel Garciawith one another or with the system memory ranges. 2010b125278SEzequiel Garcia 2020b125278SEzequiel GarciaEach entry in the property refers to exactly one window. If the operating system 203c98be0c9SCarlos Garciachooses to use a different set of mbus windows, it must ensure that any address 2040b125278SEzequiel Garciatranslations performed from downstream devices are adapted accordingly. 2050b125278SEzequiel Garcia 2060b125278SEzequiel GarciaThe operating system may insert additional mbus windows that do not conflict 2070b125278SEzequiel Garciawith the ones listed in the ranges, e.g. for mapping PCIe devices. 2080b125278SEzequiel GarciaAs a special case, the internal register window must be set up by the boot 2090b125278SEzequiel Garcialoader at the address listed in the ranges property, since access to that region 2100b125278SEzequiel Garciais needed to set up the other windows. 2110b125278SEzequiel Garcia 2120b125278SEzequiel Garcia** Example 2130b125278SEzequiel Garcia 2140b125278SEzequiel GarciaSee the example below, where a more complete device tree is shown: 2150b125278SEzequiel Garcia 2160b125278SEzequiel Garcia soc { 2170b125278SEzequiel Garcia compatible = "marvell,armadaxp-mbus", "simple-bus"; 2180b125278SEzequiel Garcia controller = <&mbusc>; 2190b125278SEzequiel Garcia 2200b125278SEzequiel Garcia ranges = <MBUS_ID(0xf0, 0x01) 0 0 0xd0000000 0x100000 /* internal-regs */ 2210b125278SEzequiel Garcia MBUS_ID(0x01, 0x1d) 0 0 0xfff00000 0x100000 2220b125278SEzequiel Garcia MBUS_ID(0x01, 0x2f) 0 0 0xf0000000 0x8000000>; 2230b125278SEzequiel Garcia 2240b125278SEzequiel Garcia bootrom { 2250b125278SEzequiel Garcia compatible = "marvell,bootrom"; 2260b125278SEzequiel Garcia reg = <MBUS_ID(0x01, 0x1d) 0 0x100000>; 2270b125278SEzequiel Garcia }; 2280b125278SEzequiel Garcia 2290b125278SEzequiel Garcia devbus-bootcs { 2300b125278SEzequiel Garcia ranges = <0 MBUS_ID(0x01, 0x2f) 0 0x8000000>; 2310b125278SEzequiel Garcia 2320b125278SEzequiel Garcia /* NOR */ 2330b125278SEzequiel Garcia nor { 2340b125278SEzequiel Garcia compatible = "cfi-flash"; 2350b125278SEzequiel Garcia reg = <0 0x8000000>; 2360b125278SEzequiel Garcia bank-width = <2>; 2370b125278SEzequiel Garcia }; 2380b125278SEzequiel Garcia }; 2390b125278SEzequiel Garcia 2400b125278SEzequiel Garcia pcie-controller { 2410b125278SEzequiel Garcia compatible = "marvell,armada-xp-pcie"; 2420b125278SEzequiel Garcia device_type = "pci"; 2430b125278SEzequiel Garcia 2440b125278SEzequiel Garcia #address-cells = <3>; 2450b125278SEzequiel Garcia #size-cells = <2>; 2460b125278SEzequiel Garcia 2470b125278SEzequiel Garcia ranges = 2480b125278SEzequiel Garcia <0x82000000 0 0x40000 MBUS_ID(0xf0, 0x01) 0x40000 0 0x00002000 /* Port 0.0 registers */ 2490b125278SEzequiel Garcia 0x82000000 0 0x42000 MBUS_ID(0xf0, 0x01) 0x42000 0 0x00002000 /* Port 2.0 registers */ 2500b125278SEzequiel Garcia 0x82000000 0 0x44000 MBUS_ID(0xf0, 0x01) 0x44000 0 0x00002000 /* Port 0.1 registers */ 2510b125278SEzequiel Garcia 0x82000000 0 0x48000 MBUS_ID(0xf0, 0x01) 0x48000 0 0x00002000 /* Port 0.2 registers */ 2520b125278SEzequiel Garcia 0x82000000 0 0x4c000 MBUS_ID(0xf0, 0x01) 0x4c000 0 0x00002000 /* Port 0.3 registers */ 2530b125278SEzequiel Garcia 0x82000800 0 0xe0000000 MBUS_ID(0x04, 0xe8) 0xe0000000 0 0x08000000 /* Port 0.0 MEM */ 2540b125278SEzequiel Garcia 0x81000800 0 0 MBUS_ID(0x04, 0xe0) 0xe8000000 0 0x00100000 /* Port 0.0 IO */>; 2550b125278SEzequiel Garcia 2560b125278SEzequiel Garcia 2570b125278SEzequiel Garcia pcie@1,0 { 2580b125278SEzequiel Garcia /* Port 0, Lane 0 */ 2590b125278SEzequiel Garcia }; 2600b125278SEzequiel Garcia }; 2610b125278SEzequiel Garcia 2620b125278SEzequiel Garcia internal-regs { 2630b125278SEzequiel Garcia compatible = "simple-bus"; 2640b125278SEzequiel Garcia #address-cells = <1>; 2650b125278SEzequiel Garcia #size-cells = <1>; 2660b125278SEzequiel Garcia ranges = <0 MBUS_ID(0xf0, 0x01) 0 0x100000>; 2670b125278SEzequiel Garcia 2680b125278SEzequiel Garcia mbusc: mbus-controller@20000 { 269a0e89c02SThomas Petazzoni reg = <0x20000 0x100>, <0x20180 0x20>, <0x20250 0x8>; 2700b125278SEzequiel Garcia }; 2710b125278SEzequiel Garcia 2720b125278SEzequiel Garcia interrupt-controller@20000 { 2730b125278SEzequiel Garcia reg = <0x20a00 0x2d0>, <0x21070 0x58>; 2740b125278SEzequiel Garcia }; 2750b125278SEzequiel Garcia }; 2760b125278SEzequiel Garcia }; 277