Path: blob/master/Documentation/devicetree/bindings/i2c/i2c-pxa-pci-ce4100.txt
26307 views
CE4100 I2C1----------23CE4100 has one PCI device which is described as the I2C-Controller. This4PCI device has three PCI-bars, each bar contains a complete I2C5controller. So we have a total of three independent I2C-Controllers6which share only an interrupt line.7The driver is probed via the PCI-ID and is gathering the information of8attached devices from the devices tree.9Grant Likely recommended to use the ranges property to map the PCI-Bar10number to its physical address and to use this to find the child nodes11of the specific I2C controller. This were his exact words:1213Here's where the magic happens. Each entry in14ranges describes how the parent pci address space15(middle group of 3) is translated to the local16address space (first group of 2) and the size of17each range (last cell). In this particular case,18the first cell of the local address is chosen to be191:1 mapped to the BARs, and the second is the20offset from be base of the BAR (which would be21non-zero if you had 2 or more devices mapped off22the same BAR)2324ranges allows the address mapping to be described25in a way that the OS can interpret without26requiring custom device driver code.2728This is an example which is used on FalconFalls:29------------------------------------------------30i2c-controller@b,2 {31#address-cells = <2>;32#size-cells = <1>;33compatible = "pci8086,2e68.2",34"pci8086,2e68",35"pciclass,ff0000",36"pciclass,ff00";3738reg = <0x15a00 0x0 0x0 0x0 0x0>;39interrupts = <16 1>;4041/* as described by Grant, the first number in the group of42* three is the bar number followed by the 64bit bar address43* followed by size of the mapping. The bar address44* requires also a valid translation in parents ranges45* property.46*/47ranges = <0 0 0x02000000 0 0xdffe0500 0x100481 0 0x02000000 0 0xdffe0600 0x100492 0 0x02000000 0 0xdffe0700 0x100>;5051i2c@0 {52#address-cells = <1>;53#size-cells = <0>;54compatible = "intel,ce4100-i2c-controller";5556/* The first number in the reg property is the57* number of the bar58*/59reg = <0 0 0x100>;6061/* This I2C controller has no devices */62};6364i2c@1 {65#address-cells = <1>;66#size-cells = <0>;67compatible = "intel,ce4100-i2c-controller";68reg = <1 0 0x100>;6970/* This I2C controller has one gpio controller */71gpio@26 {72#gpio-cells = <2>;73compatible = "nxp,pcf8575";74reg = <0x26>;75gpio-controller;76};77};7879i2c@2 {80#address-cells = <1>;81#size-cells = <0>;82compatible = "intel,ce4100-i2c-controller";83reg = <2 0 0x100>;8485gpio@26 {86#gpio-cells = <2>;87compatible = "nxp,pcf8575";88reg = <0x26>;89gpio-controller;90};91};92};939495