diff options
Diffstat (limited to 'Documentation/i2c/instantiating-devices')
| -rw-r--r-- | Documentation/i2c/instantiating-devices | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/Documentation/i2c/instantiating-devices b/Documentation/i2c/instantiating-devices index c70e7a7638d1..0d85ac1935b7 100644 --- a/Documentation/i2c/instantiating-devices +++ b/Documentation/i2c/instantiating-devices | |||
| @@ -8,8 +8,8 @@ reason, the kernel code must instantiate I2C devices explicitly. There are | |||
| 8 | several ways to achieve this, depending on the context and requirements. | 8 | several ways to achieve this, depending on the context and requirements. |
| 9 | 9 | ||
| 10 | 10 | ||
| 11 | Method 1: Declare the I2C devices by bus number | 11 | Method 1a: Declare the I2C devices by bus number |
| 12 | ----------------------------------------------- | 12 | ------------------------------------------------ |
| 13 | 13 | ||
| 14 | This method is appropriate when the I2C bus is a system bus as is the case | 14 | This method is appropriate when the I2C bus is a system bus as is the case |
| 15 | for many embedded systems. On such systems, each I2C bus has a number | 15 | for many embedded systems. On such systems, each I2C bus has a number |
| @@ -51,6 +51,43 @@ The devices will be automatically unbound and destroyed when the I2C bus | |||
| 51 | they sit on goes away (if ever.) | 51 | they sit on goes away (if ever.) |
| 52 | 52 | ||
| 53 | 53 | ||
| 54 | Method 1b: Declare the I2C devices via devicetree | ||
| 55 | ------------------------------------------------- | ||
| 56 | |||
| 57 | This method has the same implications as method 1a. The declaration of I2C | ||
| 58 | devices is here done via devicetree as subnodes of the master controller. | ||
| 59 | |||
| 60 | Example: | ||
| 61 | |||
| 62 | i2c1: i2c@400a0000 { | ||
| 63 | /* ... master properties skipped ... */ | ||
| 64 | clock-frequency = <100000>; | ||
| 65 | |||
| 66 | flash@50 { | ||
| 67 | compatible = "atmel,24c256"; | ||
| 68 | reg = <0x50>; | ||
| 69 | }; | ||
| 70 | |||
| 71 | pca9532: gpio@60 { | ||
| 72 | compatible = "nxp,pca9532"; | ||
| 73 | gpio-controller; | ||
| 74 | #gpio-cells = <2>; | ||
| 75 | reg = <0x60>; | ||
| 76 | }; | ||
| 77 | }; | ||
| 78 | |||
| 79 | Here, two devices are attached to the bus using a speed of 100kHz. For | ||
| 80 | additional properties which might be needed to set up the device, please refer | ||
| 81 | to its devicetree documentation in Documentation/devicetree/bindings/. | ||
| 82 | |||
| 83 | |||
| 84 | Method 1c: Declare the I2C devices via ACPI | ||
| 85 | ------------------------------------------- | ||
| 86 | |||
| 87 | ACPI can also describe I2C devices. There is special documentation for this | ||
| 88 | which is currently located at Documentation/acpi/enumeration.txt. | ||
| 89 | |||
| 90 | |||
| 54 | Method 2: Instantiate the devices explicitly | 91 | Method 2: Instantiate the devices explicitly |
| 55 | -------------------------------------------- | 92 | -------------------------------------------- |
| 56 | 93 | ||
