1*c66ec88fSEmmanuel VadotFSI bus & engine generic device tree bindings 2*c66ec88fSEmmanuel Vadot============================================= 3*c66ec88fSEmmanuel Vadot 4*c66ec88fSEmmanuel VadotThe FSI bus is probe-able, so the OS is able to enumerate FSI slaves, and 5*c66ec88fSEmmanuel Vadotengines within those slaves. However, we have a facility to match devicetree 6*c66ec88fSEmmanuel Vadotnodes to probed engines. This allows for fsi engines to expose non-probeable 7*c66ec88fSEmmanuel Vadotbusses, which are then exposed by the device tree. For example, an FSI engine 8*c66ec88fSEmmanuel Vadotthat is an I2C master - the I2C bus can be described by the device tree under 9*c66ec88fSEmmanuel Vadotthe engine's device tree node. 10*c66ec88fSEmmanuel Vadot 11*c66ec88fSEmmanuel VadotFSI masters may require their own DT nodes (to describe the master HW itself); 12*c66ec88fSEmmanuel Vadotthat requirement is defined by the master's implementation, and is described by 13*c66ec88fSEmmanuel Vadotthe fsi-master-* binding specifications. 14*c66ec88fSEmmanuel Vadot 15*c66ec88fSEmmanuel VadotUnder the masters' nodes, we can describe the bus topology using nodes to 16*c66ec88fSEmmanuel Vadotrepresent the FSI slaves and their slave engines. As a basic outline: 17*c66ec88fSEmmanuel Vadot 18*c66ec88fSEmmanuel Vadot fsi-master { 19*c66ec88fSEmmanuel Vadot /* top-level of FSI bus topology, bound to an FSI master driver and 20*c66ec88fSEmmanuel Vadot * exposes an FSI bus */ 21*c66ec88fSEmmanuel Vadot 22*c66ec88fSEmmanuel Vadot fsi-slave@<link,id> { 23*c66ec88fSEmmanuel Vadot /* this node defines the FSI slave device, and is handled 24*c66ec88fSEmmanuel Vadot * entirely with FSI core code */ 25*c66ec88fSEmmanuel Vadot 26*c66ec88fSEmmanuel Vadot fsi-slave-engine@<addr> { 27*c66ec88fSEmmanuel Vadot /* this node defines the engine endpoint & address range, which 28*c66ec88fSEmmanuel Vadot * is bound to the relevant fsi device driver */ 29*c66ec88fSEmmanuel Vadot ... 30*c66ec88fSEmmanuel Vadot }; 31*c66ec88fSEmmanuel Vadot 32*c66ec88fSEmmanuel Vadot fsi-slave-engine@<addr> { 33*c66ec88fSEmmanuel Vadot ... 34*c66ec88fSEmmanuel Vadot }; 35*c66ec88fSEmmanuel Vadot 36*c66ec88fSEmmanuel Vadot }; 37*c66ec88fSEmmanuel Vadot }; 38*c66ec88fSEmmanuel Vadot 39*c66ec88fSEmmanuel VadotNote that since the bus is probe-able, some (or all) of the topology may 40*c66ec88fSEmmanuel Vadotnot be described; this binding only provides an optional facility for 41*c66ec88fSEmmanuel Vadotadding subordinate device tree nodes as children of FSI engines. 42*c66ec88fSEmmanuel Vadot 43*c66ec88fSEmmanuel VadotFSI masters 44*c66ec88fSEmmanuel Vadot----------- 45*c66ec88fSEmmanuel Vadot 46*c66ec88fSEmmanuel VadotFSI master nodes declare themselves as such with the "fsi-master" compatible 47*c66ec88fSEmmanuel Vadotvalue. It's likely that an implementation-specific compatible value will 48*c66ec88fSEmmanuel Vadotbe needed as well, for example: 49*c66ec88fSEmmanuel Vadot 50*c66ec88fSEmmanuel Vadot compatible = "fsi-master-gpio", "fsi-master"; 51*c66ec88fSEmmanuel Vadot 52*c66ec88fSEmmanuel VadotSince the master nodes describe the top-level of the FSI topology, they also 53*c66ec88fSEmmanuel Vadotneed to declare the FSI-standard addressing scheme. This requires two cells for 54*c66ec88fSEmmanuel Vadotaddresses (link index and slave ID), and no size: 55*c66ec88fSEmmanuel Vadot 56*c66ec88fSEmmanuel Vadot #address-cells = <2>; 57*c66ec88fSEmmanuel Vadot #size-cells = <0>; 58*c66ec88fSEmmanuel Vadot 59*c66ec88fSEmmanuel VadotAn optional boolean property can be added to indicate that a particular master 60*c66ec88fSEmmanuel Vadotshould not scan for connected devices at initialization time. This is 61*c66ec88fSEmmanuel Vadotnecessary in cases where a scan could cause arbitration issues with other 62*c66ec88fSEmmanuel Vadotmasters that may be present on the bus. 63*c66ec88fSEmmanuel Vadot 64*c66ec88fSEmmanuel Vadot no-scan-on-init; 65*c66ec88fSEmmanuel Vadot 66*c66ec88fSEmmanuel VadotFSI slaves 67*c66ec88fSEmmanuel Vadot---------- 68*c66ec88fSEmmanuel Vadot 69*c66ec88fSEmmanuel VadotSlaves are identified by a (link-index, slave-id) pair, so require two cells 70*c66ec88fSEmmanuel Vadotfor an address identifier. Since these are not a range, no size cells are 71*c66ec88fSEmmanuel Vadotrequired. For an example, a slave on link 1, with ID 2, could be represented 72*c66ec88fSEmmanuel Vadotas: 73*c66ec88fSEmmanuel Vadot 74*c66ec88fSEmmanuel Vadot cfam@1,2 { 75*c66ec88fSEmmanuel Vadot reg = <1 2>; 76*c66ec88fSEmmanuel Vadot [...]; 77*c66ec88fSEmmanuel Vadot } 78*c66ec88fSEmmanuel Vadot 79*c66ec88fSEmmanuel VadotEach slave provides an address-space, under which the engines are accessible. 80*c66ec88fSEmmanuel VadotThat address space has a maximum of 23 bits, so we use one cell to represent 81*c66ec88fSEmmanuel Vadotaddresses and sizes in the slave address space: 82*c66ec88fSEmmanuel Vadot 83*c66ec88fSEmmanuel Vadot #address-cells = <1>; 84*c66ec88fSEmmanuel Vadot #size-cells = <1>; 85*c66ec88fSEmmanuel Vadot 86*c66ec88fSEmmanuel VadotOptionally, a slave can provide a global unique chip ID which is used to 87*c66ec88fSEmmanuel Vadotidentify the physical location of the chip in a system specific way 88*c66ec88fSEmmanuel Vadot 89*c66ec88fSEmmanuel Vadot chip-id = <0>; 90*c66ec88fSEmmanuel Vadot 91*c66ec88fSEmmanuel VadotFSI engines (devices) 92*c66ec88fSEmmanuel Vadot--------------------- 93*c66ec88fSEmmanuel Vadot 94*c66ec88fSEmmanuel VadotEngines are identified by their address under the slaves' address spaces. We 95*c66ec88fSEmmanuel Vadotuse a single cell for address and size. Engine nodes represent the endpoint 96*c66ec88fSEmmanuel VadotFSI device, and are passed to those FSI device drivers' ->probe() functions. 97*c66ec88fSEmmanuel Vadot 98*c66ec88fSEmmanuel VadotFor example, for a slave using a single 0x400-byte page starting at address 99*c66ec88fSEmmanuel Vadot0xc00: 100*c66ec88fSEmmanuel Vadot 101*c66ec88fSEmmanuel Vadot engine@c00 { 102*c66ec88fSEmmanuel Vadot reg = <0xc00 0x400>; 103*c66ec88fSEmmanuel Vadot }; 104*c66ec88fSEmmanuel Vadot 105*c66ec88fSEmmanuel Vadot 106*c66ec88fSEmmanuel VadotFull example 107*c66ec88fSEmmanuel Vadot------------ 108*c66ec88fSEmmanuel Vadot 109*c66ec88fSEmmanuel VadotHere's an example that illustrates: 110*c66ec88fSEmmanuel Vadot - an FSI master 111*c66ec88fSEmmanuel Vadot - connected to an FSI slave 112*c66ec88fSEmmanuel Vadot - that contains an engine that is an I2C master 113*c66ec88fSEmmanuel Vadot - connected to an I2C EEPROM 114*c66ec88fSEmmanuel Vadot 115*c66ec88fSEmmanuel VadotThe FSI master may be connected to additional slaves, and slaves may have 116*c66ec88fSEmmanuel Vadotadditional engines, but they don't necessarily need to be describe in the 117*c66ec88fSEmmanuel Vadotdevice tree if no extra platform information is required. 118*c66ec88fSEmmanuel Vadot 119*c66ec88fSEmmanuel Vadot /* The GPIO-based FSI master node, describing the top level of the 120*c66ec88fSEmmanuel Vadot * FSI bus 121*c66ec88fSEmmanuel Vadot */ 122*c66ec88fSEmmanuel Vadot gpio-fsi { 123*c66ec88fSEmmanuel Vadot compatible = "fsi-master-gpio", "fsi-master"; 124*c66ec88fSEmmanuel Vadot #address-cells = <2>; 125*c66ec88fSEmmanuel Vadot #size-cells = <0>; 126*c66ec88fSEmmanuel Vadot 127*c66ec88fSEmmanuel Vadot /* A FSI slave (aka. CFAM) at link 0, ID 0. */ 128*c66ec88fSEmmanuel Vadot cfam@0,0 { 129*c66ec88fSEmmanuel Vadot reg = <0 0>; 130*c66ec88fSEmmanuel Vadot #address-cells = <1>; 131*c66ec88fSEmmanuel Vadot #size-cells = <1>; 132*c66ec88fSEmmanuel Vadot chip-id = <0>; 133*c66ec88fSEmmanuel Vadot 134*c66ec88fSEmmanuel Vadot /* FSI engine at 0xc00, using a single page. In this example, 135*c66ec88fSEmmanuel Vadot * it's an I2C master controller, so subnodes describe the 136*c66ec88fSEmmanuel Vadot * I2C bus. 137*c66ec88fSEmmanuel Vadot */ 138*c66ec88fSEmmanuel Vadot i2c-controller@c00 { 139*c66ec88fSEmmanuel Vadot reg = <0xc00 0x400>; 140*c66ec88fSEmmanuel Vadot 141*c66ec88fSEmmanuel Vadot /* Engine-specific data. In this case, we're describing an 142*c66ec88fSEmmanuel Vadot * I2C bus, so we're conforming to the generic I2C binding 143*c66ec88fSEmmanuel Vadot */ 144*c66ec88fSEmmanuel Vadot compatible = "some-vendor,fsi-i2c-controller"; 145*c66ec88fSEmmanuel Vadot #address-cells = <1>; 146*c66ec88fSEmmanuel Vadot #size-cells = <1>; 147*c66ec88fSEmmanuel Vadot 148*c66ec88fSEmmanuel Vadot /* I2C endpoint device: an Atmel EEPROM */ 149*c66ec88fSEmmanuel Vadot eeprom@50 { 150*c66ec88fSEmmanuel Vadot compatible = "atmel,24c256"; 151*c66ec88fSEmmanuel Vadot reg = <0x50>; 152*c66ec88fSEmmanuel Vadot pagesize = <64>; 153*c66ec88fSEmmanuel Vadot }; 154*c66ec88fSEmmanuel Vadot }; 155*c66ec88fSEmmanuel Vadot }; 156*c66ec88fSEmmanuel Vadot }; 157