162306a36Sopenharmony_ci 262306a36Sopenharmony_ci* Marvell MBus 362306a36Sopenharmony_ci 462306a36Sopenharmony_ciRequired properties: 562306a36Sopenharmony_ci 662306a36Sopenharmony_ci- compatible: Should be set to one of the following: 762306a36Sopenharmony_ci marvell,armada370-mbus 862306a36Sopenharmony_ci marvell,armadaxp-mbus 962306a36Sopenharmony_ci marvell,armada375-mbus 1062306a36Sopenharmony_ci marvell,armada380-mbus 1162306a36Sopenharmony_ci marvell,kirkwood-mbus 1262306a36Sopenharmony_ci marvell,dove-mbus 1362306a36Sopenharmony_ci marvell,orion5x-88f5281-mbus 1462306a36Sopenharmony_ci marvell,orion5x-88f5182-mbus 1562306a36Sopenharmony_ci marvell,orion5x-88f5181-mbus 1662306a36Sopenharmony_ci marvell,orion5x-88f6183-mbus 1762306a36Sopenharmony_ci marvell,mv78xx0-mbus 1862306a36Sopenharmony_ci 1962306a36Sopenharmony_ci- address-cells: Must be '2'. The first cell for the MBus ID encoding, 2062306a36Sopenharmony_ci the second cell for the address offset within the window. 2162306a36Sopenharmony_ci 2262306a36Sopenharmony_ci- size-cells: Must be '1'. 2362306a36Sopenharmony_ci 2462306a36Sopenharmony_ci- ranges: Must be set up to provide a proper translation for each child. 2562306a36Sopenharmony_ci See the examples below. 2662306a36Sopenharmony_ci 2762306a36Sopenharmony_ci- controller: Contains a single phandle referring to the MBus controller 2862306a36Sopenharmony_ci node. This allows to specify the node that contains the 2962306a36Sopenharmony_ci registers that control the MBus, which is typically contained 3062306a36Sopenharmony_ci within the internal register window (see below). 3162306a36Sopenharmony_ci 3262306a36Sopenharmony_ciOptional properties: 3362306a36Sopenharmony_ci 3462306a36Sopenharmony_ci- pcie-mem-aperture: This optional property contains the aperture for 3562306a36Sopenharmony_ci the memory region of the PCIe driver. 3662306a36Sopenharmony_ci If it's defined, it must encode the base address and 3762306a36Sopenharmony_ci size for the address decoding windows allocated for 3862306a36Sopenharmony_ci the PCIe memory region. 3962306a36Sopenharmony_ci 4062306a36Sopenharmony_ci- pcie-io-aperture: Just as explained for the above property, this 4162306a36Sopenharmony_ci optional property contains the aperture for the 4262306a36Sopenharmony_ci I/O region of the PCIe driver. 4362306a36Sopenharmony_ci 4462306a36Sopenharmony_ci* Marvell MBus controller 4562306a36Sopenharmony_ci 4662306a36Sopenharmony_ciRequired properties: 4762306a36Sopenharmony_ci 4862306a36Sopenharmony_ci- compatible: Should be set to "marvell,mbus-controller". 4962306a36Sopenharmony_ci 5062306a36Sopenharmony_ci- reg: Device's register space. 5162306a36Sopenharmony_ci Two or three entries are expected (see the examples below): 5262306a36Sopenharmony_ci the first one controls the devices decoding window, 5362306a36Sopenharmony_ci the second one controls the SDRAM decoding window and 5462306a36Sopenharmony_ci the third controls the MBus bridge (only with the 5562306a36Sopenharmony_ci marvell,armada370-mbus and marvell,armadaxp-mbus 5662306a36Sopenharmony_ci compatible strings) 5762306a36Sopenharmony_ci 5862306a36Sopenharmony_ciExample: 5962306a36Sopenharmony_ci 6062306a36Sopenharmony_ci soc { 6162306a36Sopenharmony_ci compatible = "marvell,armada370-mbus", "simple-bus"; 6262306a36Sopenharmony_ci #address-cells = <2>; 6362306a36Sopenharmony_ci #size-cells = <1>; 6462306a36Sopenharmony_ci controller = <&mbusc>; 6562306a36Sopenharmony_ci pcie-mem-aperture = <0xe0000000 0x8000000>; 6662306a36Sopenharmony_ci pcie-io-aperture = <0xe8000000 0x100000>; 6762306a36Sopenharmony_ci 6862306a36Sopenharmony_ci internal-regs { 6962306a36Sopenharmony_ci compatible = "simple-bus"; 7062306a36Sopenharmony_ci 7162306a36Sopenharmony_ci mbusc: mbus-controller@20000 { 7262306a36Sopenharmony_ci compatible = "marvell,mbus-controller"; 7362306a36Sopenharmony_ci reg = <0x20000 0x100>, <0x20180 0x20>, <0x20250 0x8>; 7462306a36Sopenharmony_ci }; 7562306a36Sopenharmony_ci 7662306a36Sopenharmony_ci /* more children ...*/ 7762306a36Sopenharmony_ci }; 7862306a36Sopenharmony_ci }; 7962306a36Sopenharmony_ci 8062306a36Sopenharmony_ci** MBus address decoding window specification 8162306a36Sopenharmony_ci 8262306a36Sopenharmony_ciThe MBus children address space is comprised of two cells: the first one for 8362306a36Sopenharmony_cithe window ID and the second one for the offset within the window. 8462306a36Sopenharmony_ciIn order to allow to describe valid and non-valid window entries, the 8562306a36Sopenharmony_cifollowing encoding is used: 8662306a36Sopenharmony_ci 8762306a36Sopenharmony_ci 0xSIAA0000 0x00oooooo 8862306a36Sopenharmony_ci 8962306a36Sopenharmony_ciWhere: 9062306a36Sopenharmony_ci 9162306a36Sopenharmony_ci S = 0x0 for a MBus valid window 9262306a36Sopenharmony_ci S = 0xf for a non-valid window (see below) 9362306a36Sopenharmony_ci 9462306a36Sopenharmony_ciIf S = 0x0, then: 9562306a36Sopenharmony_ci 9662306a36Sopenharmony_ci I = 4-bit window target ID 9762306a36Sopenharmony_ci AA = windpw attribute 9862306a36Sopenharmony_ci 9962306a36Sopenharmony_ciIf S = 0xf, then: 10062306a36Sopenharmony_ci 10162306a36Sopenharmony_ci I = don't care 10262306a36Sopenharmony_ci AA = 1 for internal register 10362306a36Sopenharmony_ci 10462306a36Sopenharmony_ciFollowing the above encoding, for each ranges entry for a MBus valid window 10562306a36Sopenharmony_ci(S = 0x0), an address decoding window is allocated. On the other side, 10662306a36Sopenharmony_cientries for translation that do not correspond to valid windows (S = 0xf) 10762306a36Sopenharmony_ciare skipped. 10862306a36Sopenharmony_ci 10962306a36Sopenharmony_ci soc { 11062306a36Sopenharmony_ci compatible = "marvell,armada370-mbus", "simple-bus"; 11162306a36Sopenharmony_ci #address-cells = <2>; 11262306a36Sopenharmony_ci #size-cells = <1>; 11362306a36Sopenharmony_ci controller = <&mbusc>; 11462306a36Sopenharmony_ci 11562306a36Sopenharmony_ci ranges = <0xf0010000 0 0 0xd0000000 0x100000 11662306a36Sopenharmony_ci 0x01e00000 0 0 0xfff00000 0x100000>; 11762306a36Sopenharmony_ci 11862306a36Sopenharmony_ci bootrom { 11962306a36Sopenharmony_ci compatible = "marvell,bootrom"; 12062306a36Sopenharmony_ci reg = <0x01e00000 0 0x100000>; 12162306a36Sopenharmony_ci }; 12262306a36Sopenharmony_ci 12362306a36Sopenharmony_ci /* other children */ 12462306a36Sopenharmony_ci ... 12562306a36Sopenharmony_ci 12662306a36Sopenharmony_ci internal-regs { 12762306a36Sopenharmony_ci compatible = "simple-bus"; 12862306a36Sopenharmony_ci ranges = <0 0xf0010000 0 0x100000>; 12962306a36Sopenharmony_ci 13062306a36Sopenharmony_ci mbusc: mbus-controller@20000 { 13162306a36Sopenharmony_ci compatible = "marvell,mbus-controller"; 13262306a36Sopenharmony_ci reg = <0x20000 0x100>, <0x20180 0x20>, <0x20250 0x8>; 13362306a36Sopenharmony_ci }; 13462306a36Sopenharmony_ci 13562306a36Sopenharmony_ci /* more children ...*/ 13662306a36Sopenharmony_ci }; 13762306a36Sopenharmony_ci }; 13862306a36Sopenharmony_ci 13962306a36Sopenharmony_ciIn the shown example, the translation entry in the 'ranges' property is what 14062306a36Sopenharmony_cimakes the MBus driver create a static decoding window for the corresponding 14162306a36Sopenharmony_cigiven child device. Note that the binding does not require child nodes to be 14262306a36Sopenharmony_cipresent. Of course, child nodes are needed to probe the devices. 14362306a36Sopenharmony_ci 14462306a36Sopenharmony_ciSince each window is identified by its target ID and attribute ID there's 14562306a36Sopenharmony_cia special macro that can be use to simplify the translation entries: 14662306a36Sopenharmony_ci 14762306a36Sopenharmony_ci#define MBUS_ID(target,attributes) (((target) << 24) | ((attributes) << 16)) 14862306a36Sopenharmony_ci 14962306a36Sopenharmony_ciUsing this macro, the above example would be: 15062306a36Sopenharmony_ci 15162306a36Sopenharmony_ci soc { 15262306a36Sopenharmony_ci compatible = "marvell,armada370-mbus", "simple-bus"; 15362306a36Sopenharmony_ci #address-cells = <2>; 15462306a36Sopenharmony_ci #size-cells = <1>; 15562306a36Sopenharmony_ci controller = <&mbusc>; 15662306a36Sopenharmony_ci 15762306a36Sopenharmony_ci ranges = < MBUS_ID(0xf0, 0x01) 0 0 0xd0000000 0x100000 15862306a36Sopenharmony_ci MBUS_ID(0x01, 0xe0) 0 0 0xfff00000 0x100000>; 15962306a36Sopenharmony_ci 16062306a36Sopenharmony_ci bootrom { 16162306a36Sopenharmony_ci compatible = "marvell,bootrom"; 16262306a36Sopenharmony_ci reg = <MBUS_ID(0x01, 0xe0) 0 0x100000>; 16362306a36Sopenharmony_ci }; 16462306a36Sopenharmony_ci 16562306a36Sopenharmony_ci /* other children */ 16662306a36Sopenharmony_ci ... 16762306a36Sopenharmony_ci 16862306a36Sopenharmony_ci internal-regs { 16962306a36Sopenharmony_ci compatible = "simple-bus"; 17062306a36Sopenharmony_ci #address-cells = <1>; 17162306a36Sopenharmony_ci #size-cells = <1>; 17262306a36Sopenharmony_ci ranges = <0 MBUS_ID(0xf0, 0x01) 0 0x100000>; 17362306a36Sopenharmony_ci 17462306a36Sopenharmony_ci mbusc: mbus-controller@20000 { 17562306a36Sopenharmony_ci compatible = "marvell,mbus-controller"; 17662306a36Sopenharmony_ci reg = <0x20000 0x100>, <0x20180 0x20>, <0x20250 0x8>; 17762306a36Sopenharmony_ci }; 17862306a36Sopenharmony_ci 17962306a36Sopenharmony_ci /* other children */ 18062306a36Sopenharmony_ci ... 18162306a36Sopenharmony_ci }; 18262306a36Sopenharmony_ci }; 18362306a36Sopenharmony_ci 18462306a36Sopenharmony_ci 18562306a36Sopenharmony_ci** About the window base address 18662306a36Sopenharmony_ci 18762306a36Sopenharmony_ciRemember the MBus controller allows a great deal of flexibility for choosing 18862306a36Sopenharmony_cithe decoding window base address. When planning the device tree layout it's 18962306a36Sopenharmony_cipossible to choose any address as the base address, provided of course there's 19062306a36Sopenharmony_cia region large enough available, and with the required alignment. 19162306a36Sopenharmony_ci 19262306a36Sopenharmony_ciYet in other words: there's nothing preventing us from setting a base address 19362306a36Sopenharmony_ciof 0xf0000000, or 0xd0000000 for the NOR device shown above, if such region is 19462306a36Sopenharmony_ciunused. 19562306a36Sopenharmony_ci 19662306a36Sopenharmony_ci** Window allocation policy 19762306a36Sopenharmony_ci 19862306a36Sopenharmony_ciThe mbus-node ranges property defines a set of mbus windows that are expected 19962306a36Sopenharmony_cito be set by the operating system and that are guaranteed to be free of overlaps 20062306a36Sopenharmony_ciwith one another or with the system memory ranges. 20162306a36Sopenharmony_ci 20262306a36Sopenharmony_ciEach entry in the property refers to exactly one window. If the operating system 20362306a36Sopenharmony_cichooses to use a different set of mbus windows, it must ensure that any address 20462306a36Sopenharmony_citranslations performed from downstream devices are adapted accordingly. 20562306a36Sopenharmony_ci 20662306a36Sopenharmony_ciThe operating system may insert additional mbus windows that do not conflict 20762306a36Sopenharmony_ciwith the ones listed in the ranges, e.g. for mapping PCIe devices. 20862306a36Sopenharmony_ciAs a special case, the internal register window must be set up by the boot 20962306a36Sopenharmony_ciloader at the address listed in the ranges property, since access to that region 21062306a36Sopenharmony_ciis needed to set up the other windows. 21162306a36Sopenharmony_ci 21262306a36Sopenharmony_ci** Example 21362306a36Sopenharmony_ci 21462306a36Sopenharmony_ciSee the example below, where a more complete device tree is shown: 21562306a36Sopenharmony_ci 21662306a36Sopenharmony_ci soc { 21762306a36Sopenharmony_ci compatible = "marvell,armadaxp-mbus", "simple-bus"; 21862306a36Sopenharmony_ci controller = <&mbusc>; 21962306a36Sopenharmony_ci 22062306a36Sopenharmony_ci ranges = <MBUS_ID(0xf0, 0x01) 0 0 0xd0000000 0x100000 /* internal-regs */ 22162306a36Sopenharmony_ci MBUS_ID(0x01, 0x1d) 0 0 0xfff00000 0x100000 22262306a36Sopenharmony_ci MBUS_ID(0x01, 0x2f) 0 0 0xf0000000 0x8000000>; 22362306a36Sopenharmony_ci 22462306a36Sopenharmony_ci bootrom { 22562306a36Sopenharmony_ci compatible = "marvell,bootrom"; 22662306a36Sopenharmony_ci reg = <MBUS_ID(0x01, 0x1d) 0 0x100000>; 22762306a36Sopenharmony_ci }; 22862306a36Sopenharmony_ci 22962306a36Sopenharmony_ci devbus-bootcs { 23062306a36Sopenharmony_ci ranges = <0 MBUS_ID(0x01, 0x2f) 0 0x8000000>; 23162306a36Sopenharmony_ci 23262306a36Sopenharmony_ci /* NOR */ 23362306a36Sopenharmony_ci nor { 23462306a36Sopenharmony_ci compatible = "cfi-flash"; 23562306a36Sopenharmony_ci reg = <0 0x8000000>; 23662306a36Sopenharmony_ci bank-width = <2>; 23762306a36Sopenharmony_ci }; 23862306a36Sopenharmony_ci }; 23962306a36Sopenharmony_ci 24062306a36Sopenharmony_ci pcie-controller { 24162306a36Sopenharmony_ci compatible = "marvell,armada-xp-pcie"; 24262306a36Sopenharmony_ci device_type = "pci"; 24362306a36Sopenharmony_ci 24462306a36Sopenharmony_ci #address-cells = <3>; 24562306a36Sopenharmony_ci #size-cells = <2>; 24662306a36Sopenharmony_ci 24762306a36Sopenharmony_ci ranges = 24862306a36Sopenharmony_ci <0x82000000 0 0x40000 MBUS_ID(0xf0, 0x01) 0x40000 0 0x00002000 /* Port 0.0 registers */ 24962306a36Sopenharmony_ci 0x82000000 0 0x42000 MBUS_ID(0xf0, 0x01) 0x42000 0 0x00002000 /* Port 2.0 registers */ 25062306a36Sopenharmony_ci 0x82000000 0 0x44000 MBUS_ID(0xf0, 0x01) 0x44000 0 0x00002000 /* Port 0.1 registers */ 25162306a36Sopenharmony_ci 0x82000000 0 0x48000 MBUS_ID(0xf0, 0x01) 0x48000 0 0x00002000 /* Port 0.2 registers */ 25262306a36Sopenharmony_ci 0x82000000 0 0x4c000 MBUS_ID(0xf0, 0x01) 0x4c000 0 0x00002000 /* Port 0.3 registers */ 25362306a36Sopenharmony_ci 0x82000800 0 0xe0000000 MBUS_ID(0x04, 0xe8) 0xe0000000 0 0x08000000 /* Port 0.0 MEM */ 25462306a36Sopenharmony_ci 0x81000800 0 0 MBUS_ID(0x04, 0xe0) 0xe8000000 0 0x00100000 /* Port 0.0 IO */>; 25562306a36Sopenharmony_ci 25662306a36Sopenharmony_ci 25762306a36Sopenharmony_ci pcie@1,0 { 25862306a36Sopenharmony_ci /* Port 0, Lane 0 */ 25962306a36Sopenharmony_ci }; 26062306a36Sopenharmony_ci }; 26162306a36Sopenharmony_ci 26262306a36Sopenharmony_ci internal-regs { 26362306a36Sopenharmony_ci compatible = "simple-bus"; 26462306a36Sopenharmony_ci #address-cells = <1>; 26562306a36Sopenharmony_ci #size-cells = <1>; 26662306a36Sopenharmony_ci ranges = <0 MBUS_ID(0xf0, 0x01) 0 0x100000>; 26762306a36Sopenharmony_ci 26862306a36Sopenharmony_ci mbusc: mbus-controller@20000 { 26962306a36Sopenharmony_ci reg = <0x20000 0x100>, <0x20180 0x20>, <0x20250 0x8>; 27062306a36Sopenharmony_ci }; 27162306a36Sopenharmony_ci 27262306a36Sopenharmony_ci interrupt-controller@20000 { 27362306a36Sopenharmony_ci reg = <0x20a00 0x2d0>, <0x21070 0x58>; 27462306a36Sopenharmony_ci }; 27562306a36Sopenharmony_ci }; 27662306a36Sopenharmony_ci }; 277