162306a36Sopenharmony_ciFSI bus & engine generic device tree bindings 262306a36Sopenharmony_ci============================================= 362306a36Sopenharmony_ci 462306a36Sopenharmony_ciThe FSI bus is probe-able, so the OS is able to enumerate FSI slaves, and 562306a36Sopenharmony_ciengines within those slaves. However, we have a facility to match devicetree 662306a36Sopenharmony_cinodes to probed engines. This allows for fsi engines to expose non-probeable 762306a36Sopenharmony_cibusses, which are then exposed by the device tree. For example, an FSI engine 862306a36Sopenharmony_cithat is an I2C master - the I2C bus can be described by the device tree under 962306a36Sopenharmony_cithe engine's device tree node. 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_ciFSI masters may require their own DT nodes (to describe the master HW itself); 1262306a36Sopenharmony_cithat requirement is defined by the master's implementation, and is described by 1362306a36Sopenharmony_cithe fsi-master-* binding specifications. 1462306a36Sopenharmony_ci 1562306a36Sopenharmony_ciUnder the masters' nodes, we can describe the bus topology using nodes to 1662306a36Sopenharmony_cirepresent the FSI slaves and their slave engines. As a basic outline: 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ci fsi-master { 1962306a36Sopenharmony_ci /* top-level of FSI bus topology, bound to an FSI master driver and 2062306a36Sopenharmony_ci * exposes an FSI bus */ 2162306a36Sopenharmony_ci 2262306a36Sopenharmony_ci fsi-slave@<link,id> { 2362306a36Sopenharmony_ci /* this node defines the FSI slave device, and is handled 2462306a36Sopenharmony_ci * entirely with FSI core code */ 2562306a36Sopenharmony_ci 2662306a36Sopenharmony_ci fsi-slave-engine@<addr> { 2762306a36Sopenharmony_ci /* this node defines the engine endpoint & address range, which 2862306a36Sopenharmony_ci * is bound to the relevant fsi device driver */ 2962306a36Sopenharmony_ci ... 3062306a36Sopenharmony_ci }; 3162306a36Sopenharmony_ci 3262306a36Sopenharmony_ci fsi-slave-engine@<addr> { 3362306a36Sopenharmony_ci ... 3462306a36Sopenharmony_ci }; 3562306a36Sopenharmony_ci 3662306a36Sopenharmony_ci }; 3762306a36Sopenharmony_ci }; 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_ciNote that since the bus is probe-able, some (or all) of the topology may 4062306a36Sopenharmony_cinot be described; this binding only provides an optional facility for 4162306a36Sopenharmony_ciadding subordinate device tree nodes as children of FSI engines. 4262306a36Sopenharmony_ci 4362306a36Sopenharmony_ciFSI masters 4462306a36Sopenharmony_ci----------- 4562306a36Sopenharmony_ci 4662306a36Sopenharmony_ciFSI master nodes declare themselves as such with the "fsi-master" compatible 4762306a36Sopenharmony_civalue. It's likely that an implementation-specific compatible value will 4862306a36Sopenharmony_cibe needed as well, for example: 4962306a36Sopenharmony_ci 5062306a36Sopenharmony_ci compatible = "fsi-master-gpio", "fsi-master"; 5162306a36Sopenharmony_ci 5262306a36Sopenharmony_ciSince the master nodes describe the top-level of the FSI topology, they also 5362306a36Sopenharmony_cineed to declare the FSI-standard addressing scheme. This requires two cells for 5462306a36Sopenharmony_ciaddresses (link index and slave ID), and no size: 5562306a36Sopenharmony_ci 5662306a36Sopenharmony_ci #address-cells = <2>; 5762306a36Sopenharmony_ci #size-cells = <0>; 5862306a36Sopenharmony_ci 5962306a36Sopenharmony_ciAn optional boolean property can be added to indicate that a particular master 6062306a36Sopenharmony_cishould not scan for connected devices at initialization time. This is 6162306a36Sopenharmony_cinecessary in cases where a scan could cause arbitration issues with other 6262306a36Sopenharmony_cimasters that may be present on the bus. 6362306a36Sopenharmony_ci 6462306a36Sopenharmony_ci no-scan-on-init; 6562306a36Sopenharmony_ci 6662306a36Sopenharmony_ciFSI slaves 6762306a36Sopenharmony_ci---------- 6862306a36Sopenharmony_ci 6962306a36Sopenharmony_ciSlaves are identified by a (link-index, slave-id) pair, so require two cells 7062306a36Sopenharmony_cifor an address identifier. Since these are not a range, no size cells are 7162306a36Sopenharmony_cirequired. For an example, a slave on link 1, with ID 2, could be represented 7262306a36Sopenharmony_cias: 7362306a36Sopenharmony_ci 7462306a36Sopenharmony_ci cfam@1,2 { 7562306a36Sopenharmony_ci reg = <1 2>; 7662306a36Sopenharmony_ci [...]; 7762306a36Sopenharmony_ci } 7862306a36Sopenharmony_ci 7962306a36Sopenharmony_ciEach slave provides an address-space, under which the engines are accessible. 8062306a36Sopenharmony_ciThat address space has a maximum of 23 bits, so we use one cell to represent 8162306a36Sopenharmony_ciaddresses and sizes in the slave address space: 8262306a36Sopenharmony_ci 8362306a36Sopenharmony_ci #address-cells = <1>; 8462306a36Sopenharmony_ci #size-cells = <1>; 8562306a36Sopenharmony_ci 8662306a36Sopenharmony_ciOptionally, a slave can provide a global unique chip ID which is used to 8762306a36Sopenharmony_ciidentify the physical location of the chip in a system specific way 8862306a36Sopenharmony_ci 8962306a36Sopenharmony_ci chip-id = <0>; 9062306a36Sopenharmony_ci 9162306a36Sopenharmony_ciFSI engines (devices) 9262306a36Sopenharmony_ci--------------------- 9362306a36Sopenharmony_ci 9462306a36Sopenharmony_ciEngines are identified by their address under the slaves' address spaces. We 9562306a36Sopenharmony_ciuse a single cell for address and size. Engine nodes represent the endpoint 9662306a36Sopenharmony_ciFSI device, and are passed to those FSI device drivers' ->probe() functions. 9762306a36Sopenharmony_ci 9862306a36Sopenharmony_ciFor example, for a slave using a single 0x400-byte page starting at address 9962306a36Sopenharmony_ci0xc00: 10062306a36Sopenharmony_ci 10162306a36Sopenharmony_ci engine@c00 { 10262306a36Sopenharmony_ci reg = <0xc00 0x400>; 10362306a36Sopenharmony_ci }; 10462306a36Sopenharmony_ci 10562306a36Sopenharmony_ci 10662306a36Sopenharmony_ciFull example 10762306a36Sopenharmony_ci------------ 10862306a36Sopenharmony_ci 10962306a36Sopenharmony_ciHere's an example that illustrates: 11062306a36Sopenharmony_ci - an FSI master 11162306a36Sopenharmony_ci - connected to an FSI slave 11262306a36Sopenharmony_ci - that contains an engine that is an I2C master 11362306a36Sopenharmony_ci - connected to an I2C EEPROM 11462306a36Sopenharmony_ci 11562306a36Sopenharmony_ciThe FSI master may be connected to additional slaves, and slaves may have 11662306a36Sopenharmony_ciadditional engines, but they don't necessarily need to be describe in the 11762306a36Sopenharmony_cidevice tree if no extra platform information is required. 11862306a36Sopenharmony_ci 11962306a36Sopenharmony_ci /* The GPIO-based FSI master node, describing the top level of the 12062306a36Sopenharmony_ci * FSI bus 12162306a36Sopenharmony_ci */ 12262306a36Sopenharmony_ci gpio-fsi { 12362306a36Sopenharmony_ci compatible = "fsi-master-gpio", "fsi-master"; 12462306a36Sopenharmony_ci #address-cells = <2>; 12562306a36Sopenharmony_ci #size-cells = <0>; 12662306a36Sopenharmony_ci 12762306a36Sopenharmony_ci /* A FSI slave (aka. CFAM) at link 0, ID 0. */ 12862306a36Sopenharmony_ci cfam@0,0 { 12962306a36Sopenharmony_ci reg = <0 0>; 13062306a36Sopenharmony_ci #address-cells = <1>; 13162306a36Sopenharmony_ci #size-cells = <1>; 13262306a36Sopenharmony_ci chip-id = <0>; 13362306a36Sopenharmony_ci 13462306a36Sopenharmony_ci /* FSI engine at 0xc00, using a single page. In this example, 13562306a36Sopenharmony_ci * it's an I2C master controller, so subnodes describe the 13662306a36Sopenharmony_ci * I2C bus. 13762306a36Sopenharmony_ci */ 13862306a36Sopenharmony_ci i2c-controller@c00 { 13962306a36Sopenharmony_ci reg = <0xc00 0x400>; 14062306a36Sopenharmony_ci 14162306a36Sopenharmony_ci /* Engine-specific data. In this case, we're describing an 14262306a36Sopenharmony_ci * I2C bus, so we're conforming to the generic I2C binding 14362306a36Sopenharmony_ci */ 14462306a36Sopenharmony_ci compatible = "some-vendor,fsi-i2c-controller"; 14562306a36Sopenharmony_ci #address-cells = <1>; 14662306a36Sopenharmony_ci #size-cells = <1>; 14762306a36Sopenharmony_ci 14862306a36Sopenharmony_ci /* I2C endpoint device: an Atmel EEPROM */ 14962306a36Sopenharmony_ci eeprom@50 { 15062306a36Sopenharmony_ci compatible = "atmel,24c256"; 15162306a36Sopenharmony_ci reg = <0x50>; 15262306a36Sopenharmony_ci pagesize = <64>; 15362306a36Sopenharmony_ci }; 15462306a36Sopenharmony_ci }; 15562306a36Sopenharmony_ci }; 15662306a36Sopenharmony_ci }; 157