root/arch/arm/mach-imx/devices/platform-imx-i2c.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. imx_add_imx_i2c

   1 // SPDX-License-Identifier: GPL-2.0-only
   2 /*
   3  * Copyright (C) 2009-2010 Pengutronix
   4  * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
   5  */
   6 #include "../hardware.h"
   7 #include "devices-common.h"
   8 
   9 #define imx_imx_i2c_data_entry_single(soc, _devid, _id, _hwid, _size)   \
  10         {                                                               \
  11                 .devid = _devid,                                        \
  12                 .id = _id,                                              \
  13                 .iobase = soc ## _I2C ## _hwid ## _BASE_ADDR,           \
  14                 .iosize = _size,                                        \
  15                 .irq = soc ## _INT_I2C ## _hwid,                        \
  16         }
  17 
  18 #define imx_imx_i2c_data_entry(soc, _devid, _id, _hwid, _size)          \
  19         [_id] = imx_imx_i2c_data_entry_single(soc, _devid, _id, _hwid, _size)
  20 
  21 #ifdef CONFIG_SOC_IMX21
  22 const struct imx_imx_i2c_data imx21_imx_i2c_data __initconst =
  23         imx_imx_i2c_data_entry_single(MX21, "imx21-i2c", 0, , SZ_4K);
  24 #endif /* ifdef CONFIG_SOC_IMX21 */
  25 
  26 #ifdef CONFIG_SOC_IMX27
  27 const struct imx_imx_i2c_data imx27_imx_i2c_data[] __initconst = {
  28 #define imx27_imx_i2c_data_entry(_id, _hwid)                            \
  29         imx_imx_i2c_data_entry(MX27, "imx21-i2c", _id, _hwid, SZ_4K)
  30         imx27_imx_i2c_data_entry(0, 1),
  31         imx27_imx_i2c_data_entry(1, 2),
  32 };
  33 #endif /* ifdef CONFIG_SOC_IMX27 */
  34 
  35 #ifdef CONFIG_SOC_IMX31
  36 const struct imx_imx_i2c_data imx31_imx_i2c_data[] __initconst = {
  37 #define imx31_imx_i2c_data_entry(_id, _hwid)                            \
  38         imx_imx_i2c_data_entry(MX31, "imx21-i2c", _id, _hwid, SZ_4K)
  39         imx31_imx_i2c_data_entry(0, 1),
  40         imx31_imx_i2c_data_entry(1, 2),
  41         imx31_imx_i2c_data_entry(2, 3),
  42 };
  43 #endif /* ifdef CONFIG_SOC_IMX31 */
  44 
  45 #ifdef CONFIG_SOC_IMX35
  46 const struct imx_imx_i2c_data imx35_imx_i2c_data[] __initconst = {
  47 #define imx35_imx_i2c_data_entry(_id, _hwid)                            \
  48         imx_imx_i2c_data_entry(MX35, "imx21-i2c", _id, _hwid, SZ_4K)
  49         imx35_imx_i2c_data_entry(0, 1),
  50         imx35_imx_i2c_data_entry(1, 2),
  51         imx35_imx_i2c_data_entry(2, 3),
  52 };
  53 #endif /* ifdef CONFIG_SOC_IMX35 */
  54 
  55 struct platform_device *__init imx_add_imx_i2c(
  56                 const struct imx_imx_i2c_data *data,
  57                 const struct imxi2c_platform_data *pdata)
  58 {
  59         struct resource res[] = {
  60                 {
  61                         .start = data->iobase,
  62                         .end = data->iobase + data->iosize - 1,
  63                         .flags = IORESOURCE_MEM,
  64                 }, {
  65                         .start = data->irq,
  66                         .end = data->irq,
  67                         .flags = IORESOURCE_IRQ,
  68                 },
  69         };
  70 
  71         return imx_add_platform_device(data->devid, data->id,
  72                         res, ARRAY_SIZE(res),
  73                         pdata, sizeof(*pdata));
  74 }

/* [<][>][^][v][top][bottom][index][help] */