blob: 9e1dfe7553ad8ee39b5ff69d81f4ca4b672c554a [file] [log] [blame]
Peter Korsgaard18f98b12006-06-04 20:01:08 +02001Kernel driver i2c-ocores
2
3Supported adapters:
4 * OpenCores.org I2C controller by Richard Herveille (see datasheet link)
Federico Vagaa0ccb6b2018-05-28 10:59:14 +02005 https://opencores.org/project/i2c/overview
Peter Korsgaard18f98b12006-06-04 20:01:08 +02006
7Author: Peter Korsgaard <jacmet@sunsite.dk>
8
9Description
10-----------
11
12i2c-ocores is an i2c bus driver for the OpenCores.org I2C controller
13IP core by Richard Herveille.
14
15Usage
16-----
17
18i2c-ocores uses the platform bus, so you need to provide a struct
19platform_device with the base address and interrupt number. The
20dev.platform_data of the device should also point to a struct
21ocores_i2c_platform_data (see linux/i2c-ocores.h) describing the
22distance between registers and the input clock speed.
Richard Röjforsdd14be42009-06-05 15:40:32 +020023There is also a possibility to attach a list of i2c_board_info which
24the i2c-ocores driver will add to the bus upon creation.
Peter Korsgaard18f98b12006-06-04 20:01:08 +020025
26E.G. something like:
27
28static struct resource ocores_resources[] = {
29 [0] = {
30 .start = MYI2C_BASEADDR,
31 .end = MYI2C_BASEADDR + 8,
32 .flags = IORESOURCE_MEM,
33 },
34 [1] = {
35 .start = MYI2C_IRQ,
36 .end = MYI2C_IRQ,
37 .flags = IORESOURCE_IRQ,
38 },
39};
40
Richard Röjforsdd14be42009-06-05 15:40:32 +020041/* optional board info */
42struct i2c_board_info ocores_i2c_board_info[] = {
43 {
44 I2C_BOARD_INFO("tsc2003", 0x48),
45 .platform_data = &tsc2003_platform_data,
46 .irq = TSC_IRQ
47 },
48 {
49 I2C_BOARD_INFO("adv7180", 0x42 >> 1),
50 .irq = ADV_IRQ
51 }
52};
53
Peter Korsgaard18f98b12006-06-04 20:01:08 +020054static struct ocores_i2c_platform_data myi2c_data = {
55 .regstep = 2, /* two bytes between registers */
56 .clock_khz = 50000, /* input clock of 50MHz */
Richard Röjforsdd14be42009-06-05 15:40:32 +020057 .devices = ocores_i2c_board_info, /* optional table of devices */
58 .num_devices = ARRAY_SIZE(ocores_i2c_board_info), /* table size */
Peter Korsgaard18f98b12006-06-04 20:01:08 +020059};
60
61static struct platform_device myi2c = {
62 .name = "ocores-i2c",
63 .dev = {
64 .platform_data = &myi2c_data,
65 },
66 .num_resources = ARRAY_SIZE(ocores_resources),
67 .resource = ocores_resources,
68};