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