1889ee9feSJeremy KerrFSI bus & engine generic device tree bindings 2889ee9feSJeremy Kerr============================================= 3889ee9feSJeremy Kerr 4889ee9feSJeremy KerrThe FSI bus is probe-able, so the OS is able to enumerate FSI slaves, and 5889ee9feSJeremy Kerrengines within those slaves. However, we have a facility to match devicetree 6889ee9feSJeremy Kerrnodes to probed engines. This allows for fsi engines to expose non-probeable 7889ee9feSJeremy Kerrbusses, which are then exposed by the device tree. For example, an FSI engine 8889ee9feSJeremy Kerrthat is an I2C master - the I2C bus can be described by the device tree under 9889ee9feSJeremy Kerrthe engine's device tree node. 10889ee9feSJeremy Kerr 11889ee9feSJeremy KerrFSI masters may require their own DT nodes (to describe the master HW itself); 12889ee9feSJeremy Kerrthat requirement is defined by the master's implementation, and is described by 13889ee9feSJeremy Kerrthe fsi-master-* binding specifications. 14889ee9feSJeremy Kerr 15889ee9feSJeremy KerrUnder the masters' nodes, we can describe the bus topology using nodes to 16889ee9feSJeremy Kerrrepresent the FSI slaves and their slave engines. As a basic outline: 17889ee9feSJeremy Kerr 18889ee9feSJeremy Kerr fsi-master { 19889ee9feSJeremy Kerr /* top-level of FSI bus topology, bound to an FSI master driver and 20889ee9feSJeremy Kerr * exposes an FSI bus */ 21889ee9feSJeremy Kerr 22889ee9feSJeremy Kerr fsi-slave@<link,id> { 23889ee9feSJeremy Kerr /* this node defines the FSI slave device, and is handled 24889ee9feSJeremy Kerr * entirely with FSI core code */ 25889ee9feSJeremy Kerr 26889ee9feSJeremy Kerr fsi-slave-engine@<addr> { 27889ee9feSJeremy Kerr /* this node defines the engine endpoint & address range, which 28889ee9feSJeremy Kerr * is bound to the relevant fsi device driver */ 29889ee9feSJeremy Kerr ... 30889ee9feSJeremy Kerr }; 31889ee9feSJeremy Kerr 32889ee9feSJeremy Kerr fsi-slave-engine@<addr> { 33889ee9feSJeremy Kerr ... 34889ee9feSJeremy Kerr }; 35889ee9feSJeremy Kerr 36889ee9feSJeremy Kerr }; 37889ee9feSJeremy Kerr }; 38889ee9feSJeremy Kerr 39889ee9feSJeremy KerrNote that since the bus is probe-able, some (or all) of the topology may 40889ee9feSJeremy Kerrnot be described; this binding only provides an optional facility for 41889ee9feSJeremy Kerradding subordinate device tree nodes as children of FSI engines. 42889ee9feSJeremy Kerr 43889ee9feSJeremy KerrFSI masters 44889ee9feSJeremy Kerr----------- 45889ee9feSJeremy Kerr 46889ee9feSJeremy KerrFSI master nodes declare themselves as such with the "fsi-master" compatible 47889ee9feSJeremy Kerrvalue. It's likely that an implementation-specific compatible value will 48889ee9feSJeremy Kerrbe needed as well, for example: 49889ee9feSJeremy Kerr 50889ee9feSJeremy Kerr compatible = "fsi-master-gpio", "fsi-master"; 51889ee9feSJeremy Kerr 52889ee9feSJeremy KerrSince the master nodes describe the top-level of the FSI topology, they also 53889ee9feSJeremy Kerrneed to declare the FSI-standard addressing scheme. This requires two cells for 54889ee9feSJeremy Kerraddresses (link index and slave ID), and no size: 55889ee9feSJeremy Kerr 56889ee9feSJeremy Kerr #address-cells = <2>; 57889ee9feSJeremy Kerr #size-cells = <0>; 58889ee9feSJeremy Kerr 59dd798739SChristopher BosticAn optional boolean property can be added to indicate that a particular master 60dd798739SChristopher Bosticshould not scan for connected devices at initialization time. This is 61dd798739SChristopher Bosticnecessary in cases where a scan could cause arbitration issues with other 62dd798739SChristopher Bosticmasters that may be present on the bus. 63dd798739SChristopher Bostic 64dd798739SChristopher Bostic no-scan-on-init; 65dd798739SChristopher Bostic 66889ee9feSJeremy KerrFSI slaves 67889ee9feSJeremy Kerr---------- 68889ee9feSJeremy Kerr 69889ee9feSJeremy KerrSlaves are identified by a (link-index, slave-id) pair, so require two cells 70889ee9feSJeremy Kerrfor an address identifier. Since these are not a range, no size cells are 71889ee9feSJeremy Kerrrequired. For an example, a slave on link 1, with ID 2, could be represented 72889ee9feSJeremy Kerras: 73889ee9feSJeremy Kerr 74889ee9feSJeremy Kerr cfam@1,2 { 75889ee9feSJeremy Kerr reg = <1 2>; 76889ee9feSJeremy Kerr [...]; 77889ee9feSJeremy Kerr } 78889ee9feSJeremy Kerr 79889ee9feSJeremy KerrEach slave provides an address-space, under which the engines are accessible. 80889ee9feSJeremy KerrThat address space has a maximum of 23 bits, so we use one cell to represent 81889ee9feSJeremy Kerraddresses and sizes in the slave address space: 82889ee9feSJeremy Kerr 83889ee9feSJeremy Kerr #address-cells = <1>; 84889ee9feSJeremy Kerr #size-cells = <1>; 85889ee9feSJeremy Kerr 86*e13c542dSBenjamin HerrenschmidtOptionally, a slave can provide a global unique chip ID which is used to 87*e13c542dSBenjamin Herrenschmidtidentify the physical location of the chip in a system specific way 88*e13c542dSBenjamin Herrenschmidt 89*e13c542dSBenjamin Herrenschmidt chip-id = <0>; 90889ee9feSJeremy Kerr 91889ee9feSJeremy KerrFSI engines (devices) 92889ee9feSJeremy Kerr--------------------- 93889ee9feSJeremy Kerr 94889ee9feSJeremy KerrEngines are identified by their address under the slaves' address spaces. We 95889ee9feSJeremy Kerruse a single cell for address and size. Engine nodes represent the endpoint 96889ee9feSJeremy KerrFSI device, and are passed to those FSI device drivers' ->probe() functions. 97889ee9feSJeremy Kerr 98889ee9feSJeremy KerrFor example, for a slave using a single 0x400-byte page starting at address 99889ee9feSJeremy Kerr0xc00: 100889ee9feSJeremy Kerr 101889ee9feSJeremy Kerr engine@c00 { 102889ee9feSJeremy Kerr reg = <0xc00 0x400>; 103889ee9feSJeremy Kerr }; 104889ee9feSJeremy Kerr 105889ee9feSJeremy Kerr 106889ee9feSJeremy KerrFull example 107889ee9feSJeremy Kerr------------ 108889ee9feSJeremy Kerr 109889ee9feSJeremy KerrHere's an example that illustrates: 110889ee9feSJeremy Kerr - an FSI master 111889ee9feSJeremy Kerr - connected to an FSI slave 112889ee9feSJeremy Kerr - that contains an engine that is an I2C master 113889ee9feSJeremy Kerr - connected to an I2C EEPROM 114889ee9feSJeremy Kerr 115889ee9feSJeremy KerrThe FSI master may be connected to additional slaves, and slaves may have 116889ee9feSJeremy Kerradditional engines, but they don't necessarily need to be describe in the 117889ee9feSJeremy Kerrdevice tree if no extra platform information is required. 118889ee9feSJeremy Kerr 119889ee9feSJeremy Kerr /* The GPIO-based FSI master node, describing the top level of the 120889ee9feSJeremy Kerr * FSI bus 121889ee9feSJeremy Kerr */ 122889ee9feSJeremy Kerr gpio-fsi { 123889ee9feSJeremy Kerr compatible = "fsi-master-gpio", "fsi-master"; 124889ee9feSJeremy Kerr #address-cells = <2>; 125889ee9feSJeremy Kerr #size-cells = <0>; 126889ee9feSJeremy Kerr 127889ee9feSJeremy Kerr /* A FSI slave (aka. CFAM) at link 0, ID 0. */ 128889ee9feSJeremy Kerr cfam@0,0 { 129889ee9feSJeremy Kerr reg = <0 0>; 130889ee9feSJeremy Kerr #address-cells = <1>; 131889ee9feSJeremy Kerr #size-cells = <1>; 132*e13c542dSBenjamin Herrenschmidt chip-id = <0>; 133889ee9feSJeremy Kerr 134889ee9feSJeremy Kerr /* FSI engine at 0xc00, using a single page. In this example, 135889ee9feSJeremy Kerr * it's an I2C master controller, so subnodes describe the 136889ee9feSJeremy Kerr * I2C bus. 137889ee9feSJeremy Kerr */ 138889ee9feSJeremy Kerr i2c-controller@c00 { 139889ee9feSJeremy Kerr reg = <0xc00 0x400>; 140889ee9feSJeremy Kerr 141889ee9feSJeremy Kerr /* Engine-specific data. In this case, we're describing an 142889ee9feSJeremy Kerr * I2C bus, so we're conforming to the generic I2C binding 143889ee9feSJeremy Kerr */ 144889ee9feSJeremy Kerr compatible = "some-vendor,fsi-i2c-controller"; 145889ee9feSJeremy Kerr #address-cells = <1>; 146889ee9feSJeremy Kerr #size-cells = <1>; 147889ee9feSJeremy Kerr 148889ee9feSJeremy Kerr /* I2C endpoint device: an Atmel EEPROM */ 149889ee9feSJeremy Kerr eeprom@50 { 150889ee9feSJeremy Kerr compatible = "atmel,24c256"; 151889ee9feSJeremy Kerr reg = <0x50>; 152889ee9feSJeremy Kerr pagesize = <64>; 153889ee9feSJeremy Kerr }; 154889ee9feSJeremy Kerr }; 155889ee9feSJeremy Kerr }; 156889ee9feSJeremy Kerr }; 157