diff options
author | Alessandro Rubini <rubini@gnudd.com> | 2009-07-02 10:29:22 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-07-02 16:20:46 -0400 |
commit | 63796b740b888b396eb0cc78917d755693cc224c (patch) | |
tree | 1a2b599f252121be7e220a63f19c63d4cf7b67a0 | |
parent | 2ec1d3594563e0283873e24bb5d100dffee5d568 (diff) |
[ARM] 5585/1: nomadik: add gpio-i2c devices
Signed-off-by: Alessandro Rubini <rubini@unipv.it>
Acked-by: Andrea Gallo <andrea.gallo@stericsson.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r-- | arch/arm/mach-nomadik/Kconfig | 7 | ||||
-rw-r--r-- | arch/arm/mach-nomadik/Makefile | 3 | ||||
-rw-r--r-- | arch/arm/mach-nomadik/i2c-8815nhk.c | 65 |
3 files changed, 75 insertions, 0 deletions
diff --git a/arch/arm/mach-nomadik/Kconfig b/arch/arm/mach-nomadik/Kconfig index abce23461061..2a02b49c40f0 100644 --- a/arch/arm/mach-nomadik/Kconfig +++ b/arch/arm/mach-nomadik/Kconfig | |||
@@ -11,4 +11,11 @@ endmenu | |||
11 | config NOMADIK_8815 | 11 | config NOMADIK_8815 |
12 | bool | 12 | bool |
13 | 13 | ||
14 | |||
15 | config I2C_BITBANG_8815NHK | ||
16 | tristate "Driver for bit-bang busses found on the 8815 NHK" | ||
17 | depends on I2C && MACH_NOMADIK_8815NHK | ||
18 | select I2C_ALGOBIT | ||
19 | default y | ||
20 | |||
14 | endif | 21 | endif |
diff --git a/arch/arm/mach-nomadik/Makefile b/arch/arm/mach-nomadik/Makefile index 3fc43543e6e7..412040982a40 100644 --- a/arch/arm/mach-nomadik/Makefile +++ b/arch/arm/mach-nomadik/Makefile | |||
@@ -14,3 +14,6 @@ obj-$(CONFIG_NOMADIK_8815) += cpu-8815.o | |||
14 | 14 | ||
15 | # Specific board support | 15 | # Specific board support |
16 | obj-$(CONFIG_MACH_NOMADIK_8815NHK) += board-nhk8815.o | 16 | obj-$(CONFIG_MACH_NOMADIK_8815NHK) += board-nhk8815.o |
17 | |||
18 | # Nomadik extra devices | ||
19 | obj-$(CONFIG_I2C_BITBANG_8815NHK) += i2c-8815nhk.o | ||
diff --git a/arch/arm/mach-nomadik/i2c-8815nhk.c b/arch/arm/mach-nomadik/i2c-8815nhk.c new file mode 100644 index 000000000000..abfe25a08d6b --- /dev/null +++ b/arch/arm/mach-nomadik/i2c-8815nhk.c | |||
@@ -0,0 +1,65 @@ | |||
1 | #include <linux/module.h> | ||
2 | #include <linux/init.h> | ||
3 | #include <linux/i2c.h> | ||
4 | #include <linux/i2c-algo-bit.h> | ||
5 | #include <linux/i2c-gpio.h> | ||
6 | #include <linux/gpio.h> | ||
7 | #include <linux/platform_device.h> | ||
8 | |||
9 | /* | ||
10 | * There are two busses in the 8815NHK. | ||
11 | * They could, in theory, be driven by the hardware component, but we | ||
12 | * use bit-bang through GPIO by now, to keep things simple | ||
13 | */ | ||
14 | |||
15 | static struct i2c_gpio_platform_data nhk8815_i2c_data0 = { | ||
16 | /* keep defaults for timeouts; pins are push-pull bidirectional */ | ||
17 | .scl_pin = 62, | ||
18 | .sda_pin = 63, | ||
19 | }; | ||
20 | |||
21 | static struct i2c_gpio_platform_data nhk8815_i2c_data1 = { | ||
22 | /* keep defaults for timeouts; pins are push-pull bidirectional */ | ||
23 | .scl_pin = 53, | ||
24 | .sda_pin = 54, | ||
25 | }; | ||
26 | |||
27 | /* first bus: GPIO XX and YY */ | ||
28 | static struct platform_device nhk8815_i2c_dev0 = { | ||
29 | .name = "i2c-gpio", | ||
30 | .id = 0, | ||
31 | .dev = { | ||
32 | .platform_data = &nhk8815_i2c_data0, | ||
33 | }, | ||
34 | }; | ||
35 | /* second bus: GPIO XX and YY */ | ||
36 | static struct platform_device nhk8815_i2c_dev1 = { | ||
37 | .name = "i2c-gpio", | ||
38 | .id = 1, | ||
39 | .dev = { | ||
40 | .platform_data = &nhk8815_i2c_data1, | ||
41 | }, | ||
42 | }; | ||
43 | |||
44 | static int __init nhk8815_i2c_init(void) | ||
45 | { | ||
46 | nmk_gpio_set_mode(nhk8815_i2c_data0.scl_pin, NMK_GPIO_ALT_GPIO); | ||
47 | nmk_gpio_set_mode(nhk8815_i2c_data0.sda_pin, NMK_GPIO_ALT_GPIO); | ||
48 | platform_device_register(&nhk8815_i2c_dev0); | ||
49 | |||
50 | nmk_gpio_set_mode(nhk8815_i2c_data1.scl_pin, NMK_GPIO_ALT_GPIO); | ||
51 | nmk_gpio_set_mode(nhk8815_i2c_data1.sda_pin, NMK_GPIO_ALT_GPIO); | ||
52 | platform_device_register(&nhk8815_i2c_dev1); | ||
53 | |||
54 | return 0; | ||
55 | } | ||
56 | |||
57 | static void __exit nhk8815_i2c_exit(void) | ||
58 | { | ||
59 | platform_device_unregister(&nhk8815_i2c_dev0); | ||
60 | platform_device_unregister(&nhk8815_i2c_dev1); | ||
61 | return; | ||
62 | } | ||
63 | |||
64 | module_init(nhk8815_i2c_init); | ||
65 | module_exit(nhk8815_i2c_exit); | ||