diff options
-rw-r--r-- | arch/arm/mach-u300/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/mach-u300/core.c | 8 | ||||
-rw-r--r-- | arch/arm/mach-u300/i2c.c | 43 | ||||
-rw-r--r-- | arch/arm/mach-u300/i2c.h | 23 |
4 files changed, 73 insertions, 2 deletions
diff --git a/arch/arm/mach-u300/Makefile b/arch/arm/mach-u300/Makefile index 4941f89ea798..885b5c027c1e 100644 --- a/arch/arm/mach-u300/Makefile +++ b/arch/arm/mach-u300/Makefile | |||
@@ -11,3 +11,4 @@ obj-$(CONFIG_ARCH_U300) += u300.o | |||
11 | obj-$(CONFIG_MMC) += mmc.o | 11 | obj-$(CONFIG_MMC) += mmc.o |
12 | obj-$(CONFIG_SPI_PL022) += spi.o | 12 | obj-$(CONFIG_SPI_PL022) += spi.o |
13 | obj-$(CONFIG_MACH_U300_SPIDUMMY) += dummyspichip.o | 13 | obj-$(CONFIG_MACH_U300_SPIDUMMY) += dummyspichip.o |
14 | obj-$(CONFIG_I2C_STU300) += i2c.o | ||
diff --git a/arch/arm/mach-u300/core.c b/arch/arm/mach-u300/core.c index 38d08a1c25d0..bad1ba228cbf 100644 --- a/arch/arm/mach-u300/core.c +++ b/arch/arm/mach-u300/core.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include "clock.h" | 33 | #include "clock.h" |
34 | #include "mmc.h" | 34 | #include "mmc.h" |
35 | #include "spi.h" | 35 | #include "spi.h" |
36 | #include "i2c.h" | ||
36 | 37 | ||
37 | /* | 38 | /* |
38 | * Static I/O mappings that are needed for booting the U300 platforms. The | 39 | * Static I/O mappings that are needed for booting the U300 platforms. The |
@@ -379,14 +380,14 @@ static struct platform_device wdog_device = { | |||
379 | }; | 380 | }; |
380 | 381 | ||
381 | static struct platform_device i2c0_device = { | 382 | static struct platform_device i2c0_device = { |
382 | .name = "stddci2c", | 383 | .name = "stu300", |
383 | .id = 0, | 384 | .id = 0, |
384 | .num_resources = ARRAY_SIZE(i2c0_resources), | 385 | .num_resources = ARRAY_SIZE(i2c0_resources), |
385 | .resource = i2c0_resources, | 386 | .resource = i2c0_resources, |
386 | }; | 387 | }; |
387 | 388 | ||
388 | static struct platform_device i2c1_device = { | 389 | static struct platform_device i2c1_device = { |
389 | .name = "stddci2c", | 390 | .name = "stu300", |
390 | .id = 1, | 391 | .id = 1, |
391 | .num_resources = ARRAY_SIZE(i2c1_resources), | 392 | .num_resources = ARRAY_SIZE(i2c1_resources), |
392 | .resource = i2c1_resources, | 393 | .resource = i2c1_resources, |
@@ -625,6 +626,9 @@ void __init u300_init_devices(void) | |||
625 | 626 | ||
626 | u300_assign_physmem(); | 627 | u300_assign_physmem(); |
627 | 628 | ||
629 | /* Register subdevices on the I2C buses */ | ||
630 | u300_i2c_register_board_devices(); | ||
631 | |||
628 | /* Register subdevices on the SPI bus */ | 632 | /* Register subdevices on the SPI bus */ |
629 | u300_spi_register_board_devices(); | 633 | u300_spi_register_board_devices(); |
630 | 634 | ||
diff --git a/arch/arm/mach-u300/i2c.c b/arch/arm/mach-u300/i2c.c new file mode 100644 index 000000000000..10be1f888b27 --- /dev/null +++ b/arch/arm/mach-u300/i2c.c | |||
@@ -0,0 +1,43 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-u300/i2c.c | ||
3 | * | ||
4 | * Copyright (C) 2009 ST-Ericsson AB | ||
5 | * License terms: GNU General Public License (GPL) version 2 | ||
6 | * | ||
7 | * Register board i2c devices | ||
8 | * Author: Linus Walleij <linus.walleij@stericsson.com> | ||
9 | */ | ||
10 | #include <linux/kernel.h> | ||
11 | #include <linux/i2c.h> | ||
12 | #include <mach/irqs.h> | ||
13 | |||
14 | static struct i2c_board_info __initdata bus0_i2c_board_info[] = { | ||
15 | { | ||
16 | .type = "ab3100", | ||
17 | .addr = 0x48, | ||
18 | .irq = IRQ_U300_IRQ0_EXT, | ||
19 | }, | ||
20 | }; | ||
21 | |||
22 | static struct i2c_board_info __initdata bus1_i2c_board_info[] = { | ||
23 | #ifdef CONFIG_MACH_U300_BS335 | ||
24 | { | ||
25 | .type = "fwcam", | ||
26 | .addr = 0x10, | ||
27 | }, | ||
28 | { | ||
29 | .type = "fwcam", | ||
30 | .addr = 0x5d, | ||
31 | }, | ||
32 | #else | ||
33 | { }, | ||
34 | #endif | ||
35 | }; | ||
36 | |||
37 | void __init u300_i2c_register_board_devices(void) | ||
38 | { | ||
39 | i2c_register_board_info(0, bus0_i2c_board_info, | ||
40 | ARRAY_SIZE(bus0_i2c_board_info)); | ||
41 | i2c_register_board_info(1, bus1_i2c_board_info, | ||
42 | ARRAY_SIZE(bus1_i2c_board_info)); | ||
43 | } | ||
diff --git a/arch/arm/mach-u300/i2c.h b/arch/arm/mach-u300/i2c.h new file mode 100644 index 000000000000..485c02e5c06d --- /dev/null +++ b/arch/arm/mach-u300/i2c.h | |||
@@ -0,0 +1,23 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-u300/i2c.h | ||
3 | * | ||
4 | * Copyright (C) 2009 ST-Ericsson AB | ||
5 | * License terms: GNU General Public License (GPL) version 2 | ||
6 | * | ||
7 | * Register board i2c devices | ||
8 | * Author: Linus Walleij <linus.walleij@stericsson.com> | ||
9 | */ | ||
10 | |||
11 | #ifndef MACH_U300_I2C_H | ||
12 | #define MACH_U300_I2C_H | ||
13 | |||
14 | #ifdef CONFIG_I2C_STU300 | ||
15 | void __init u300_i2c_register_board_devices(void); | ||
16 | #else | ||
17 | /* Compile out this stuff if no I2C adapter is available */ | ||
18 | static inline void __init u300_i2c_register_board_devices(void) | ||
19 | { | ||
20 | } | ||
21 | #endif | ||
22 | |||
23 | #endif | ||