Path: blob/master/Documentation/devicetree/bindings/bus/mvebu-mbus.txt
26308 views
1* Marvell MBus23Required properties:45- compatible: Should be set to one of the following:6marvell,armada370-mbus7marvell,armadaxp-mbus8marvell,armada375-mbus9marvell,armada380-mbus10marvell,kirkwood-mbus11marvell,dove-mbus12marvell,orion5x-88f5281-mbus13marvell,orion5x-88f5182-mbus14marvell,orion5x-88f5181-mbus15marvell,orion5x-88f6183-mbus16marvell,mv78xx0-mbus1718- address-cells: Must be '2'. The first cell for the MBus ID encoding,19the second cell for the address offset within the window.2021- size-cells: Must be '1'.2223- ranges: Must be set up to provide a proper translation for each child.24See the examples below.2526- controller: Contains a single phandle referring to the MBus controller27node. This allows to specify the node that contains the28registers that control the MBus, which is typically contained29within the internal register window (see below).3031Optional properties:3233- pcie-mem-aperture: This optional property contains the aperture for34the memory region of the PCIe driver.35If it's defined, it must encode the base address and36size for the address decoding windows allocated for37the PCIe memory region.3839- pcie-io-aperture: Just as explained for the above property, this40optional property contains the aperture for the41I/O region of the PCIe driver.4243* Marvell MBus controller4445Required properties:4647- compatible: Should be set to "marvell,mbus-controller".4849- reg: Device's register space.50Two or three entries are expected (see the examples below):51the first one controls the devices decoding window,52the second one controls the SDRAM decoding window and53the third controls the MBus bridge (only with the54marvell,armada370-mbus and marvell,armadaxp-mbus55compatible strings)5657Example:5859soc {60compatible = "marvell,armada370-mbus", "simple-bus";61#address-cells = <2>;62#size-cells = <1>;63controller = <&mbusc>;64pcie-mem-aperture = <0xe0000000 0x8000000>;65pcie-io-aperture = <0xe8000000 0x100000>;6667internal-regs {68compatible = "simple-bus";6970mbusc: mbus-controller@20000 {71compatible = "marvell,mbus-controller";72reg = <0x20000 0x100>, <0x20180 0x20>, <0x20250 0x8>;73};7475/* more children ...*/76};77};7879** MBus address decoding window specification8081The MBus children address space is comprised of two cells: the first one for82the window ID and the second one for the offset within the window.83In order to allow to describe valid and non-valid window entries, the84following encoding is used:85860xSIAA0000 0x00oooooo8788Where:8990S = 0x0 for a MBus valid window91S = 0xf for a non-valid window (see below)9293If S = 0x0, then:9495I = 4-bit window target ID96AA = windpw attribute9798If S = 0xf, then:99100I = don't care101AA = 1 for internal register102103Following the above encoding, for each ranges entry for a MBus valid window104(S = 0x0), an address decoding window is allocated. On the other side,105entries for translation that do not correspond to valid windows (S = 0xf)106are skipped.107108soc {109compatible = "marvell,armada370-mbus", "simple-bus";110#address-cells = <2>;111#size-cells = <1>;112controller = <&mbusc>;113114ranges = <0xf0010000 0 0 0xd0000000 0x1000001150x01e00000 0 0 0xfff00000 0x100000>;116117bootrom {118compatible = "marvell,bootrom";119reg = <0x01e00000 0 0x100000>;120};121122/* other children */123...124125internal-regs {126compatible = "simple-bus";127ranges = <0 0xf0010000 0 0x100000>;128129mbusc: mbus-controller@20000 {130compatible = "marvell,mbus-controller";131reg = <0x20000 0x100>, <0x20180 0x20>, <0x20250 0x8>;132};133134/* more children ...*/135};136};137138In the shown example, the translation entry in the 'ranges' property is what139makes the MBus driver create a static decoding window for the corresponding140given child device. Note that the binding does not require child nodes to be141present. Of course, child nodes are needed to probe the devices.142143Since each window is identified by its target ID and attribute ID there's144a special macro that can be use to simplify the translation entries:145146#define MBUS_ID(target,attributes) (((target) << 24) | ((attributes) << 16))147148Using this macro, the above example would be:149150soc {151compatible = "marvell,armada370-mbus", "simple-bus";152#address-cells = <2>;153#size-cells = <1>;154controller = <&mbusc>;155156ranges = < MBUS_ID(0xf0, 0x01) 0 0 0xd0000000 0x100000157MBUS_ID(0x01, 0xe0) 0 0 0xfff00000 0x100000>;158159bootrom {160compatible = "marvell,bootrom";161reg = <MBUS_ID(0x01, 0xe0) 0 0x100000>;162};163164/* other children */165...166167internal-regs {168compatible = "simple-bus";169#address-cells = <1>;170#size-cells = <1>;171ranges = <0 MBUS_ID(0xf0, 0x01) 0 0x100000>;172173mbusc: mbus-controller@20000 {174compatible = "marvell,mbus-controller";175reg = <0x20000 0x100>, <0x20180 0x20>, <0x20250 0x8>;176};177178/* other children */179...180};181};182183184** About the window base address185186Remember the MBus controller allows a great deal of flexibility for choosing187the decoding window base address. When planning the device tree layout it's188possible to choose any address as the base address, provided of course there's189a region large enough available, and with the required alignment.190191Yet in other words: there's nothing preventing us from setting a base address192of 0xf0000000, or 0xd0000000 for the NOR device shown above, if such region is193unused.194195** Window allocation policy196197The mbus-node ranges property defines a set of mbus windows that are expected198to be set by the operating system and that are guaranteed to be free of overlaps199with one another or with the system memory ranges.200201Each entry in the property refers to exactly one window. If the operating system202chooses to use a different set of mbus windows, it must ensure that any address203translations performed from downstream devices are adapted accordingly.204205The operating system may insert additional mbus windows that do not conflict206with the ones listed in the ranges, e.g. for mapping PCIe devices.207As a special case, the internal register window must be set up by the boot208loader at the address listed in the ranges property, since access to that region209is needed to set up the other windows.210211** Example212213See the example below, where a more complete device tree is shown:214215soc {216compatible = "marvell,armadaxp-mbus", "simple-bus";217controller = <&mbusc>;218219ranges = <MBUS_ID(0xf0, 0x01) 0 0 0xd0000000 0x100000 /* internal-regs */220MBUS_ID(0x01, 0x1d) 0 0 0xfff00000 0x100000221MBUS_ID(0x01, 0x2f) 0 0 0xf0000000 0x8000000>;222223bootrom {224compatible = "marvell,bootrom";225reg = <MBUS_ID(0x01, 0x1d) 0 0x100000>;226};227228devbus-bootcs {229ranges = <0 MBUS_ID(0x01, 0x2f) 0 0x8000000>;230231/* NOR */232nor {233compatible = "cfi-flash";234reg = <0 0x8000000>;235bank-width = <2>;236};237};238239pcie-controller {240compatible = "marvell,armada-xp-pcie";241device_type = "pci";242243#address-cells = <3>;244#size-cells = <2>;245246ranges =247<0x82000000 0 0x40000 MBUS_ID(0xf0, 0x01) 0x40000 0 0x00002000 /* Port 0.0 registers */2480x82000000 0 0x42000 MBUS_ID(0xf0, 0x01) 0x42000 0 0x00002000 /* Port 2.0 registers */2490x82000000 0 0x44000 MBUS_ID(0xf0, 0x01) 0x44000 0 0x00002000 /* Port 0.1 registers */2500x82000000 0 0x48000 MBUS_ID(0xf0, 0x01) 0x48000 0 0x00002000 /* Port 0.2 registers */2510x82000000 0 0x4c000 MBUS_ID(0xf0, 0x01) 0x4c000 0 0x00002000 /* Port 0.3 registers */2520x82000800 0 0xe0000000 MBUS_ID(0x04, 0xe8) 0xe0000000 0 0x08000000 /* Port 0.0 MEM */2530x81000800 0 0 MBUS_ID(0x04, 0xe0) 0xe8000000 0 0x00100000 /* Port 0.0 IO */>;254255256pcie@1,0 {257/* Port 0, Lane 0 */258};259};260261internal-regs {262compatible = "simple-bus";263#address-cells = <1>;264#size-cells = <1>;265ranges = <0 MBUS_ID(0xf0, 0x01) 0 0x100000>;266267mbusc: mbus-controller@20000 {268reg = <0x20000 0x100>, <0x20180 0x20>, <0x20250 0x8>;269};270271interrupt-controller@20000 {272reg = <0x20a00 0x2d0>, <0x21070 0x58>;273};274};275};276277278