[PATCH] i2c: New bus driver for the OpenCores I2C controller
[usb.git] / Documentation / i2c / busses / i2c-ocores
blobcfcebb10d14edb0e70af97d2b4ec0df4378eed05
1 Kernel driver i2c-ocores
3 Supported adapters:
4   * OpenCores.org I2C controller by Richard Herveille (see datasheet link)
5     Datasheet: http://www.opencores.org/projects.cgi/web/i2c/overview
7 Author: Peter Korsgaard <jacmet@sunsite.dk>
9 Description
10 -----------
12 i2c-ocores is an i2c bus driver for the OpenCores.org I2C controller
13 IP core by Richard Herveille.
15 Usage
16 -----
18 i2c-ocores uses the platform bus, so you need to provide a struct
19 platform_device with the base address and interrupt number. The
20 dev.platform_data of the device should also point to a struct
21 ocores_i2c_platform_data (see linux/i2c-ocores.h) describing the
22 distance between registers and the input clock speed.
24 E.G. something like:
26 static struct resource ocores_resources[] = {
27         [0] = {
28                 .start  = MYI2C_BASEADDR,
29                 .end    = MYI2C_BASEADDR + 8,
30                 .flags  = IORESOURCE_MEM,
31         },
32         [1] = {
33                 .start  = MYI2C_IRQ,
34                 .end    = MYI2C_IRQ,
35                 .flags  = IORESOURCE_IRQ,
36         },
39 static struct ocores_i2c_platform_data myi2c_data = {
40         .regstep        = 2,            /* two bytes between registers */
41         .clock_khz      = 50000,        /* input clock of 50MHz */
44 static struct platform_device myi2c = {
45         .name                   = "ocores-i2c",
46         .dev = {
47                 .platform_data  = &myi2c_data,
48         },
49         .num_resources          = ARRAY_SIZE(ocores_resources),
50         .resource               = ocores_resources,