~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/Documentation/i2c/busses/i2c-ocores.rst

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

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

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php