xref: /freebsd/sys/contrib/device-tree/Bindings/i2c/i2c-pxa-pci-ce4100.txt (revision c66ec88fed842fbaad62c30d510644ceb7bd2d71)
1*c66ec88fSEmmanuel VadotCE4100 I2C
2*c66ec88fSEmmanuel Vadot----------
3*c66ec88fSEmmanuel Vadot
4*c66ec88fSEmmanuel VadotCE4100 has one PCI device which is described as the I2C-Controller. This
5*c66ec88fSEmmanuel VadotPCI device has three PCI-bars, each bar contains a complete I2C
6*c66ec88fSEmmanuel Vadotcontroller. So we have a total of three independent I2C-Controllers
7*c66ec88fSEmmanuel Vadotwhich share only an interrupt line.
8*c66ec88fSEmmanuel VadotThe driver is probed via the PCI-ID and is gathering the information of
9*c66ec88fSEmmanuel Vadotattached devices from the devices tree.
10*c66ec88fSEmmanuel VadotGrant Likely recommended to use the ranges property to map the PCI-Bar
11*c66ec88fSEmmanuel Vadotnumber to its physical address and to use this to find the child nodes
12*c66ec88fSEmmanuel Vadotof the specific I2C controller. This were his exact words:
13*c66ec88fSEmmanuel Vadot
14*c66ec88fSEmmanuel Vadot       Here's where the magic happens.  Each entry in
15*c66ec88fSEmmanuel Vadot       ranges describes how the parent pci address space
16*c66ec88fSEmmanuel Vadot       (middle group of 3) is translated to the local
17*c66ec88fSEmmanuel Vadot       address space (first group of 2) and the size of
18*c66ec88fSEmmanuel Vadot       each range (last cell).  In this particular case,
19*c66ec88fSEmmanuel Vadot       the first cell of the local address is chosen to be
20*c66ec88fSEmmanuel Vadot       1:1 mapped to the BARs, and the second is the
21*c66ec88fSEmmanuel Vadot       offset from be base of the BAR (which would be
22*c66ec88fSEmmanuel Vadot       non-zero if you had 2 or more devices mapped off
23*c66ec88fSEmmanuel Vadot       the same BAR)
24*c66ec88fSEmmanuel Vadot
25*c66ec88fSEmmanuel Vadot       ranges allows the address mapping to be described
26*c66ec88fSEmmanuel Vadot       in a way that the OS can interpret without
27*c66ec88fSEmmanuel Vadot       requiring custom device driver code.
28*c66ec88fSEmmanuel Vadot
29*c66ec88fSEmmanuel VadotThis is an example which is used on FalconFalls:
30*c66ec88fSEmmanuel Vadot------------------------------------------------
31*c66ec88fSEmmanuel Vadot	i2c-controller@b,2 {
32*c66ec88fSEmmanuel Vadot		#address-cells = <2>;
33*c66ec88fSEmmanuel Vadot		#size-cells = <1>;
34*c66ec88fSEmmanuel Vadot		compatible = "pci8086,2e68.2",
35*c66ec88fSEmmanuel Vadot				"pci8086,2e68",
36*c66ec88fSEmmanuel Vadot				"pciclass,ff0000",
37*c66ec88fSEmmanuel Vadot				"pciclass,ff00";
38*c66ec88fSEmmanuel Vadot
39*c66ec88fSEmmanuel Vadot		reg = <0x15a00 0x0 0x0 0x0 0x0>;
40*c66ec88fSEmmanuel Vadot		interrupts = <16 1>;
41*c66ec88fSEmmanuel Vadot
42*c66ec88fSEmmanuel Vadot		/* as described by Grant, the first number in the group of
43*c66ec88fSEmmanuel Vadot		* three is the bar number followed by the 64bit bar address
44*c66ec88fSEmmanuel Vadot		* followed by size of the mapping. The bar address
45*c66ec88fSEmmanuel Vadot		* requires also a valid translation in parents ranges
46*c66ec88fSEmmanuel Vadot		* property.
47*c66ec88fSEmmanuel Vadot		*/
48*c66ec88fSEmmanuel Vadot		ranges = <0 0   0x02000000 0 0xdffe0500 0x100
49*c66ec88fSEmmanuel Vadot			  1 0   0x02000000 0 0xdffe0600 0x100
50*c66ec88fSEmmanuel Vadot			  2 0   0x02000000 0 0xdffe0700 0x100>;
51*c66ec88fSEmmanuel Vadot
52*c66ec88fSEmmanuel Vadot		i2c@0 {
53*c66ec88fSEmmanuel Vadot			#address-cells = <1>;
54*c66ec88fSEmmanuel Vadot			#size-cells = <0>;
55*c66ec88fSEmmanuel Vadot			compatible = "intel,ce4100-i2c-controller";
56*c66ec88fSEmmanuel Vadot
57*c66ec88fSEmmanuel Vadot			/* The first number in the reg property is the
58*c66ec88fSEmmanuel Vadot			* number of the bar
59*c66ec88fSEmmanuel Vadot			*/
60*c66ec88fSEmmanuel Vadot			reg = <0 0 0x100>;
61*c66ec88fSEmmanuel Vadot
62*c66ec88fSEmmanuel Vadot			/* This I2C controller has no devices */
63*c66ec88fSEmmanuel Vadot		};
64*c66ec88fSEmmanuel Vadot
65*c66ec88fSEmmanuel Vadot		i2c@1 {
66*c66ec88fSEmmanuel Vadot			#address-cells = <1>;
67*c66ec88fSEmmanuel Vadot			#size-cells = <0>;
68*c66ec88fSEmmanuel Vadot			compatible = "intel,ce4100-i2c-controller";
69*c66ec88fSEmmanuel Vadot			reg = <1 0 0x100>;
70*c66ec88fSEmmanuel Vadot
71*c66ec88fSEmmanuel Vadot			/* This I2C controller has one gpio controller */
72*c66ec88fSEmmanuel Vadot			gpio@26 {
73*c66ec88fSEmmanuel Vadot				#gpio-cells = <2>;
74*c66ec88fSEmmanuel Vadot				compatible = "ti,pcf8575";
75*c66ec88fSEmmanuel Vadot				reg = <0x26>;
76*c66ec88fSEmmanuel Vadot				gpio-controller;
77*c66ec88fSEmmanuel Vadot			};
78*c66ec88fSEmmanuel Vadot		};
79*c66ec88fSEmmanuel Vadot
80*c66ec88fSEmmanuel Vadot		i2c@2 {
81*c66ec88fSEmmanuel Vadot			#address-cells = <1>;
82*c66ec88fSEmmanuel Vadot			#size-cells = <0>;
83*c66ec88fSEmmanuel Vadot			compatible = "intel,ce4100-i2c-controller";
84*c66ec88fSEmmanuel Vadot			reg = <2 0 0x100>;
85*c66ec88fSEmmanuel Vadot
86*c66ec88fSEmmanuel Vadot			gpio@26 {
87*c66ec88fSEmmanuel Vadot				#gpio-cells = <2>;
88*c66ec88fSEmmanuel Vadot				compatible = "ti,pcf8575";
89*c66ec88fSEmmanuel Vadot				reg = <0x26>;
90*c66ec88fSEmmanuel Vadot				gpio-controller;
91*c66ec88fSEmmanuel Vadot			};
92*c66ec88fSEmmanuel Vadot		};
93*c66ec88fSEmmanuel Vadot	};
94