1 Kernel driver i2c-ocores
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>
12 i2c-ocores is an i2c bus driver for the OpenCores.org I2C controller
13 IP core by Richard Herveille.
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.
23 There is also a possibility to attach a list of i2c_board_info which
24 the i2c-ocores driver will add to the bus upon creation.
28 static struct resource ocores_resources[] = {
30 .start = MYI2C_BASEADDR,
31 .end = MYI2C_BASEADDR + 8,
32 .flags = IORESOURCE_MEM,
37 .flags = IORESOURCE_IRQ,
41 /* optional board info */
42 struct i2c_board_info ocores_i2c_board_info[] = {
44 I2C_BOARD_INFO("tsc2003", 0x48),
45 .platform_data = &tsc2003_platform_data,
49 I2C_BOARD_INFO("adv7180", 0x42 >> 1),
54 static struct ocores_i2c_platform_data myi2c_data = {
55 .regstep = 2, /* two bytes between registers */
56 .clock_khz = 50000, /* input clock of 50MHz */
57 .devices = ocores_i2c_board_info, /* optional table of devices */
58 .num_devices = ARRAY_SIZE(ocores_i2c_board_info), /* table size */
61 static struct platform_device myi2c = {
64 .platform_data = &myi2c_data,
66 .num_resources = ARRAY_SIZE(ocores_resources),
67 .resource = ocores_resources,