diff options
-rw-r--r-- | arch/arm/mach-mxs/devices-mx28.h | 3 | ||||
-rw-r--r-- | arch/arm/mach-mxs/devices/Kconfig | 3 | ||||
-rw-r--r-- | arch/arm/mach-mxs/devices/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/mach-mxs/devices/platform-mxs-i2c.c | 51 | ||||
-rw-r--r-- | arch/arm/mach-mxs/include/mach/devices-common.h | 9 |
5 files changed, 67 insertions, 0 deletions
diff --git a/arch/arm/mach-mxs/devices-mx28.h b/arch/arm/mach-mxs/devices-mx28.h index 69d19ea19d4d..a9eecdc7e227 100644 --- a/arch/arm/mach-mxs/devices-mx28.h +++ b/arch/arm/mach-mxs/devices-mx28.h | |||
@@ -33,4 +33,7 @@ extern const struct mxs_flexcan_data mx28_flexcan_data[] __initconst; | |||
33 | #define mx28_add_flexcan0(pdata) mx28_add_flexcan(0, pdata) | 33 | #define mx28_add_flexcan0(pdata) mx28_add_flexcan(0, pdata) |
34 | #define mx28_add_flexcan1(pdata) mx28_add_flexcan(1, pdata) | 34 | #define mx28_add_flexcan1(pdata) mx28_add_flexcan(1, pdata) |
35 | 35 | ||
36 | extern const struct mxs_i2c_data mx28_mxs_i2c_data[] __initconst; | ||
37 | #define mx28_add_mxs_i2c(id) mxs_add_mxs_i2c(&mx28_mxs_i2c_data[id]) | ||
38 | |||
36 | #define mx28_add_mxs_pwm(id) mxs_add_mxs_pwm(MX28_PWM_BASE_ADDR, id) | 39 | #define mx28_add_mxs_pwm(id) mxs_add_mxs_pwm(MX28_PWM_BASE_ADDR, id) |
diff --git a/arch/arm/mach-mxs/devices/Kconfig b/arch/arm/mach-mxs/devices/Kconfig index 3aeec246e746..a878915063ed 100644 --- a/arch/arm/mach-mxs/devices/Kconfig +++ b/arch/arm/mach-mxs/devices/Kconfig | |||
@@ -12,5 +12,8 @@ config MXS_HAVE_PLATFORM_FLEXCAN | |||
12 | select HAVE_CAN_FLEXCAN if CAN | 12 | select HAVE_CAN_FLEXCAN if CAN |
13 | bool | 13 | bool |
14 | 14 | ||
15 | config MXS_HAVE_PLATFORM_MXS_I2C | ||
16 | bool | ||
17 | |||
15 | config MXS_HAVE_PLATFORM_MXS_PWM | 18 | config MXS_HAVE_PLATFORM_MXS_PWM |
16 | bool | 19 | bool |
diff --git a/arch/arm/mach-mxs/devices/Makefile b/arch/arm/mach-mxs/devices/Makefile index 978310fcafd6..345b8399b80e 100644 --- a/arch/arm/mach-mxs/devices/Makefile +++ b/arch/arm/mach-mxs/devices/Makefile | |||
@@ -2,4 +2,5 @@ obj-$(CONFIG_MXS_HAVE_AMBA_DUART) += amba-duart.o | |||
2 | obj-$(CONFIG_MXS_HAVE_PLATFORM_AUART) += platform-auart.o | 2 | obj-$(CONFIG_MXS_HAVE_PLATFORM_AUART) += platform-auart.o |
3 | obj-$(CONFIG_MXS_HAVE_PLATFORM_FEC) += platform-fec.o | 3 | obj-$(CONFIG_MXS_HAVE_PLATFORM_FEC) += platform-fec.o |
4 | obj-$(CONFIG_MXS_HAVE_PLATFORM_FLEXCAN) += platform-flexcan.o | 4 | obj-$(CONFIG_MXS_HAVE_PLATFORM_FLEXCAN) += platform-flexcan.o |
5 | obj-$(CONFIG_MXS_HAVE_PLATFORM_MXS_I2C) += platform-mxs-i2c.o | ||
5 | obj-$(CONFIG_MXS_HAVE_PLATFORM_MXS_PWM) += platform-mxs-pwm.o | 6 | obj-$(CONFIG_MXS_HAVE_PLATFORM_MXS_PWM) += platform-mxs-pwm.o |
diff --git a/arch/arm/mach-mxs/devices/platform-mxs-i2c.c b/arch/arm/mach-mxs/devices/platform-mxs-i2c.c new file mode 100644 index 000000000000..eab3a06836d6 --- /dev/null +++ b/arch/arm/mach-mxs/devices/platform-mxs-i2c.c | |||
@@ -0,0 +1,51 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2011 Pengutronix | ||
3 | * Wolfram Sang <w.sang@pengutronix.de> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it under | ||
6 | * the terms of the GNU General Public License version 2 as published by the | ||
7 | * Free Software Foundation. | ||
8 | */ | ||
9 | #include <asm/sizes.h> | ||
10 | #include <mach/mx28.h> | ||
11 | #include <mach/devices-common.h> | ||
12 | |||
13 | #define mxs_i2c_data_entry_single(soc, _id) \ | ||
14 | { \ | ||
15 | .id = _id, \ | ||
16 | .iobase = soc ## _I2C ## _id ## _BASE_ADDR, \ | ||
17 | .errirq = soc ## _INT_I2C ## _id ## _ERROR, \ | ||
18 | .dmairq = soc ## _INT_I2C ## _id ## _DMA, \ | ||
19 | } | ||
20 | |||
21 | #define mxs_i2c_data_entry(soc, _id) \ | ||
22 | [_id] = mxs_i2c_data_entry_single(soc, _id) | ||
23 | |||
24 | #ifdef CONFIG_SOC_IMX28 | ||
25 | const struct mxs_i2c_data mx28_mxs_i2c_data[] __initconst = { | ||
26 | mxs_i2c_data_entry(MX28, 0), | ||
27 | mxs_i2c_data_entry(MX28, 1), | ||
28 | }; | ||
29 | #endif | ||
30 | |||
31 | struct platform_device *__init mxs_add_mxs_i2c(const struct mxs_i2c_data *data) | ||
32 | { | ||
33 | struct resource res[] = { | ||
34 | { | ||
35 | .start = data->iobase, | ||
36 | .end = data->iobase + SZ_8K - 1, | ||
37 | .flags = IORESOURCE_MEM, | ||
38 | }, { | ||
39 | .start = data->errirq, | ||
40 | .end = data->errirq, | ||
41 | .flags = IORESOURCE_IRQ, | ||
42 | }, { | ||
43 | .start = data->dmairq, | ||
44 | .end = data->dmairq, | ||
45 | .flags = IORESOURCE_IRQ, | ||
46 | }, | ||
47 | }; | ||
48 | |||
49 | return mxs_add_platform_device("mxs-i2c", data->id, res, | ||
50 | ARRAY_SIZE(res), NULL, 0); | ||
51 | } | ||
diff --git a/arch/arm/mach-mxs/include/mach/devices-common.h b/arch/arm/mach-mxs/include/mach/devices-common.h index d460d3045555..71f24484b044 100644 --- a/arch/arm/mach-mxs/include/mach/devices-common.h +++ b/arch/arm/mach-mxs/include/mach/devices-common.h | |||
@@ -64,6 +64,15 @@ struct platform_device *__init mxs_add_flexcan( | |||
64 | const struct mxs_flexcan_data *data, | 64 | const struct mxs_flexcan_data *data, |
65 | const struct flexcan_platform_data *pdata); | 65 | const struct flexcan_platform_data *pdata); |
66 | 66 | ||
67 | /* i2c */ | ||
68 | struct mxs_i2c_data { | ||
69 | int id; | ||
70 | resource_size_t iobase; | ||
71 | resource_size_t errirq; | ||
72 | resource_size_t dmairq; | ||
73 | }; | ||
74 | struct platform_device * __init mxs_add_mxs_i2c(const struct mxs_i2c_data *data); | ||
75 | |||
67 | /* pwm */ | 76 | /* pwm */ |
68 | struct platform_device *__init mxs_add_mxs_pwm( | 77 | struct platform_device *__init mxs_add_mxs_pwm( |
69 | resource_size_t iobase, int id); | 78 | resource_size_t iobase, int id); |