diff options
-rw-r--r-- | arch/arm/mach-mx2/pcm038.c | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/arch/arm/mach-mx2/pcm038.c b/arch/arm/mach-mx2/pcm038.c index d246eb1bb3ce..7d935e17aa1c 100644 --- a/arch/arm/mach-mx2/pcm038.c +++ b/arch/arm/mach-mx2/pcm038.c | |||
@@ -21,11 +21,17 @@ | |||
21 | #include <linux/mtd/physmap.h> | 21 | #include <linux/mtd/physmap.h> |
22 | #include <linux/mtd/plat-ram.h> | 22 | #include <linux/mtd/plat-ram.h> |
23 | #include <linux/io.h> | 23 | #include <linux/io.h> |
24 | #include <linux/i2c.h> | ||
25 | #include <linux/i2c/at24.h> | ||
26 | |||
24 | #include <asm/mach/arch.h> | 27 | #include <asm/mach/arch.h> |
25 | #include <asm/mach-types.h> | 28 | #include <asm/mach-types.h> |
26 | #include <mach/common.h> | 29 | #include <mach/common.h> |
27 | #include <mach/hardware.h> | 30 | #include <mach/hardware.h> |
28 | #include <mach/iomux.h> | 31 | #include <mach/iomux.h> |
32 | #ifdef CONFIG_I2C_IMX | ||
33 | #include <mach/i2c.h> | ||
34 | #endif | ||
29 | #include <asm/mach/time.h> | 35 | #include <asm/mach/time.h> |
30 | #include <mach/imx-uart.h> | 36 | #include <mach/imx-uart.h> |
31 | #include <mach/board-pcm038.h> | 37 | #include <mach/board-pcm038.h> |
@@ -204,6 +210,51 @@ static void __init pcm038_init_sram(void) | |||
204 | __raw_writel(0x22220a00, CSCR_A(1)); | 210 | __raw_writel(0x22220a00, CSCR_A(1)); |
205 | } | 211 | } |
206 | 212 | ||
213 | #ifdef CONFIG_I2C_IMX | ||
214 | static int mxc_i2c1_pins[] = { | ||
215 | PC5_PF_I2C2_SDA, | ||
216 | PC6_PF_I2C2_SCL | ||
217 | }; | ||
218 | |||
219 | static int pcm038_i2c_1_init(struct device *dev) | ||
220 | { | ||
221 | return mxc_gpio_setup_multiple_pins(mxc_i2c1_pins, ARRAY_SIZE(mxc_i2c1_pins), | ||
222 | "I2C1"); | ||
223 | } | ||
224 | |||
225 | static void pcm038_i2c_1_exit(struct device *dev) | ||
226 | { | ||
227 | mxc_gpio_release_multiple_pins(mxc_i2c1_pins, ARRAY_SIZE(mxc_i2c1_pins)); | ||
228 | } | ||
229 | |||
230 | static struct imxi2c_platform_data pcm038_i2c_1_data = { | ||
231 | .bitrate = 100000, | ||
232 | .init = pcm038_i2c_1_init, | ||
233 | .exit = pcm038_i2c_1_exit, | ||
234 | }; | ||
235 | |||
236 | static struct at24_platform_data board_eeprom = { | ||
237 | .byte_len = 4096, | ||
238 | .page_size = 32, | ||
239 | .flags = AT24_FLAG_ADDR16, | ||
240 | }; | ||
241 | |||
242 | static struct i2c_board_info pcm038_i2c_devices[] = { | ||
243 | [0] = { | ||
244 | I2C_BOARD_INFO("at24", 0x52), /* E0=0, E1=1, E2=0 */ | ||
245 | .platform_data = &board_eeprom, | ||
246 | }, | ||
247 | [1] = { | ||
248 | I2C_BOARD_INFO("rtc-pcf8563", 0x51), | ||
249 | .type = "pcf8563" | ||
250 | }, | ||
251 | [2] = { | ||
252 | I2C_BOARD_INFO("lm75", 0x4a), | ||
253 | .type = "lm75" | ||
254 | } | ||
255 | }; | ||
256 | #endif | ||
257 | |||
207 | static void __init pcm038_init(void) | 258 | static void __init pcm038_init(void) |
208 | { | 259 | { |
209 | gpio_fec_active(); | 260 | gpio_fec_active(); |
@@ -216,6 +267,14 @@ static void __init pcm038_init(void) | |||
216 | mxc_gpio_mode(PE16_AF_OWIRE); | 267 | mxc_gpio_mode(PE16_AF_OWIRE); |
217 | mxc_register_device(&mxc_nand_device, &pcm038_nand_board_info); | 268 | mxc_register_device(&mxc_nand_device, &pcm038_nand_board_info); |
218 | 269 | ||
270 | #ifdef CONFIG_I2C_IMX | ||
271 | /* only the i2c master 1 is used on this CPU card */ | ||
272 | i2c_register_board_info(1, pcm038_i2c_devices, | ||
273 | ARRAY_SIZE(pcm038_i2c_devices)); | ||
274 | |||
275 | mxc_register_device(&mxc_i2c_device1, &pcm038_i2c_1_data); | ||
276 | #endif | ||
277 | |||
219 | platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); | 278 | platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); |
220 | 279 | ||
221 | #ifdef CONFIG_MACH_PCM970_BASEBOARD | 280 | #ifdef CONFIG_MACH_PCM970_BASEBOARD |