diff options
Diffstat (limited to 'arch/arm/mach-nomadik/i2c-8815nhk.c')
-rw-r--r-- | arch/arm/mach-nomadik/i2c-8815nhk.c | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/arch/arm/mach-nomadik/i2c-8815nhk.c b/arch/arm/mach-nomadik/i2c-8815nhk.c index 0fc2f6f1cc97..6d14454d4609 100644 --- a/arch/arm/mach-nomadik/i2c-8815nhk.c +++ b/arch/arm/mach-nomadik/i2c-8815nhk.c | |||
@@ -5,6 +5,7 @@ | |||
5 | #include <linux/i2c-gpio.h> | 5 | #include <linux/i2c-gpio.h> |
6 | #include <linux/platform_device.h> | 6 | #include <linux/platform_device.h> |
7 | #include <plat/gpio-nomadik.h> | 7 | #include <plat/gpio-nomadik.h> |
8 | #include <plat/pincfg.h> | ||
8 | 9 | ||
9 | /* | 10 | /* |
10 | * There are two busses in the 8815NHK. | 11 | * There are two busses in the 8815NHK. |
@@ -12,19 +13,27 @@ | |||
12 | * use bit-bang through GPIO by now, to keep things simple | 13 | * use bit-bang through GPIO by now, to keep things simple |
13 | */ | 14 | */ |
14 | 15 | ||
16 | /* I2C0 connected to the STw4811 power management chip */ | ||
15 | static struct i2c_gpio_platform_data nhk8815_i2c_data0 = { | 17 | static struct i2c_gpio_platform_data nhk8815_i2c_data0 = { |
16 | /* keep defaults for timeouts; pins are push-pull bidirectional */ | 18 | /* keep defaults for timeouts; pins are push-pull bidirectional */ |
17 | .scl_pin = 62, | 19 | .scl_pin = 62, |
18 | .sda_pin = 63, | 20 | .sda_pin = 63, |
19 | }; | 21 | }; |
20 | 22 | ||
23 | /* I2C1 connected to various sensors */ | ||
21 | static struct i2c_gpio_platform_data nhk8815_i2c_data1 = { | 24 | static struct i2c_gpio_platform_data nhk8815_i2c_data1 = { |
22 | /* keep defaults for timeouts; pins are push-pull bidirectional */ | 25 | /* keep defaults for timeouts; pins are push-pull bidirectional */ |
23 | .scl_pin = 53, | 26 | .scl_pin = 53, |
24 | .sda_pin = 54, | 27 | .sda_pin = 54, |
25 | }; | 28 | }; |
26 | 29 | ||
27 | /* first bus: GPIO XX and YY */ | 30 | /* I2C2 connected to the USB portions of the STw4811 only */ |
31 | static struct i2c_gpio_platform_data nhk8815_i2c_data2 = { | ||
32 | /* keep defaults for timeouts; pins are push-pull bidirectional */ | ||
33 | .scl_pin = 73, | ||
34 | .sda_pin = 74, | ||
35 | }; | ||
36 | |||
28 | static struct platform_device nhk8815_i2c_dev0 = { | 37 | static struct platform_device nhk8815_i2c_dev0 = { |
29 | .name = "i2c-gpio", | 38 | .name = "i2c-gpio", |
30 | .id = 0, | 39 | .id = 0, |
@@ -32,7 +41,7 @@ static struct platform_device nhk8815_i2c_dev0 = { | |||
32 | .platform_data = &nhk8815_i2c_data0, | 41 | .platform_data = &nhk8815_i2c_data0, |
33 | }, | 42 | }, |
34 | }; | 43 | }; |
35 | /* second bus: GPIO XX and YY */ | 44 | |
36 | static struct platform_device nhk8815_i2c_dev1 = { | 45 | static struct platform_device nhk8815_i2c_dev1 = { |
37 | .name = "i2c-gpio", | 46 | .name = "i2c-gpio", |
38 | .id = 1, | 47 | .id = 1, |
@@ -41,15 +50,29 @@ static struct platform_device nhk8815_i2c_dev1 = { | |||
41 | }, | 50 | }, |
42 | }; | 51 | }; |
43 | 52 | ||
53 | static struct platform_device nhk8815_i2c_dev2 = { | ||
54 | .name = "i2c-gpio", | ||
55 | .id = 2, | ||
56 | .dev = { | ||
57 | .platform_data = &nhk8815_i2c_data2, | ||
58 | }, | ||
59 | }; | ||
60 | |||
61 | static pin_cfg_t cpu8815_pins_i2c[] = { | ||
62 | PIN_CFG_INPUT(62, GPIO, PULLUP), | ||
63 | PIN_CFG_INPUT(63, GPIO, PULLUP), | ||
64 | PIN_CFG_INPUT(53, GPIO, PULLUP), | ||
65 | PIN_CFG_INPUT(54, GPIO, PULLUP), | ||
66 | PIN_CFG_INPUT(73, GPIO, PULLUP), | ||
67 | PIN_CFG_INPUT(74, GPIO, PULLUP), | ||
68 | }; | ||
69 | |||
44 | static int __init nhk8815_i2c_init(void) | 70 | static int __init nhk8815_i2c_init(void) |
45 | { | 71 | { |
46 | nmk_gpio_set_mode(nhk8815_i2c_data0.scl_pin, NMK_GPIO_ALT_GPIO); | 72 | nmk_config_pins(cpu8815_pins_i2c, ARRAY_SIZE(cpu8815_pins_i2c)); |
47 | nmk_gpio_set_mode(nhk8815_i2c_data0.sda_pin, NMK_GPIO_ALT_GPIO); | ||
48 | platform_device_register(&nhk8815_i2c_dev0); | 73 | 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); | 74 | platform_device_register(&nhk8815_i2c_dev1); |
75 | platform_device_register(&nhk8815_i2c_dev2); | ||
53 | 76 | ||
54 | return 0; | 77 | return 0; |
55 | } | 78 | } |
@@ -58,6 +81,7 @@ static void __exit nhk8815_i2c_exit(void) | |||
58 | { | 81 | { |
59 | platform_device_unregister(&nhk8815_i2c_dev0); | 82 | platform_device_unregister(&nhk8815_i2c_dev0); |
60 | platform_device_unregister(&nhk8815_i2c_dev1); | 83 | platform_device_unregister(&nhk8815_i2c_dev1); |
84 | platform_device_unregister(&nhk8815_i2c_dev2); | ||
61 | return; | 85 | return; |
62 | } | 86 | } |
63 | 87 | ||