diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-omap2/board-4430sdp.c | 69 | ||||
-rw-r--r-- | arch/arm/mach-omap2/board-omap3beagle.c | 101 | ||||
-rw-r--r-- | arch/arm/mach-omap2/board-omap4panda.c | 32 |
3 files changed, 199 insertions, 3 deletions
diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c index e379bef1ef40..1bed1e666a60 100644 --- a/arch/arm/mach-omap2/board-4430sdp.c +++ b/arch/arm/mach-omap2/board-4430sdp.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/usb/otg.h> | 20 | #include <linux/usb/otg.h> |
21 | #include <linux/spi/spi.h> | 21 | #include <linux/spi/spi.h> |
22 | #include <linux/i2c/twl.h> | 22 | #include <linux/i2c/twl.h> |
23 | #include <linux/gpio_keys.h> | ||
23 | #include <linux/regulator/machine.h> | 24 | #include <linux/regulator/machine.h> |
24 | #include <linux/leds.h> | 25 | #include <linux/leds.h> |
25 | 26 | ||
@@ -40,6 +41,8 @@ | |||
40 | #define ETH_KS8851_IRQ 34 | 41 | #define ETH_KS8851_IRQ 34 |
41 | #define ETH_KS8851_POWER_ON 48 | 42 | #define ETH_KS8851_POWER_ON 48 |
42 | #define ETH_KS8851_QUART 138 | 43 | #define ETH_KS8851_QUART 138 |
44 | #define OMAP4_SFH7741_SENSOR_OUTPUT_GPIO 184 | ||
45 | #define OMAP4_SFH7741_ENABLE_GPIO 188 | ||
43 | 46 | ||
44 | static struct gpio_led sdp4430_gpio_leds[] = { | 47 | static struct gpio_led sdp4430_gpio_leds[] = { |
45 | { | 48 | { |
@@ -77,11 +80,47 @@ static struct gpio_led sdp4430_gpio_leds[] = { | |||
77 | 80 | ||
78 | }; | 81 | }; |
79 | 82 | ||
83 | static struct gpio_keys_button sdp4430_gpio_keys[] = { | ||
84 | { | ||
85 | .desc = "Proximity Sensor", | ||
86 | .type = EV_SW, | ||
87 | .code = SW_FRONT_PROXIMITY, | ||
88 | .gpio = OMAP4_SFH7741_SENSOR_OUTPUT_GPIO, | ||
89 | .active_low = 0, | ||
90 | } | ||
91 | }; | ||
92 | |||
80 | static struct gpio_led_platform_data sdp4430_led_data = { | 93 | static struct gpio_led_platform_data sdp4430_led_data = { |
81 | .leds = sdp4430_gpio_leds, | 94 | .leds = sdp4430_gpio_leds, |
82 | .num_leds = ARRAY_SIZE(sdp4430_gpio_leds), | 95 | .num_leds = ARRAY_SIZE(sdp4430_gpio_leds), |
83 | }; | 96 | }; |
84 | 97 | ||
98 | static int omap_prox_activate(struct device *dev) | ||
99 | { | ||
100 | gpio_set_value(OMAP4_SFH7741_ENABLE_GPIO , 1); | ||
101 | return 0; | ||
102 | } | ||
103 | |||
104 | static void omap_prox_deactivate(struct device *dev) | ||
105 | { | ||
106 | gpio_set_value(OMAP4_SFH7741_ENABLE_GPIO , 0); | ||
107 | } | ||
108 | |||
109 | static struct gpio_keys_platform_data sdp4430_gpio_keys_data = { | ||
110 | .buttons = sdp4430_gpio_keys, | ||
111 | .nbuttons = ARRAY_SIZE(sdp4430_gpio_keys), | ||
112 | .enable = omap_prox_activate, | ||
113 | .disable = omap_prox_deactivate, | ||
114 | }; | ||
115 | |||
116 | static struct platform_device sdp4430_gpio_keys_device = { | ||
117 | .name = "gpio-keys", | ||
118 | .id = -1, | ||
119 | .dev = { | ||
120 | .platform_data = &sdp4430_gpio_keys_data, | ||
121 | }, | ||
122 | }; | ||
123 | |||
85 | static struct platform_device sdp4430_leds_gpio = { | 124 | static struct platform_device sdp4430_leds_gpio = { |
86 | .name = "leds-gpio", | 125 | .name = "leds-gpio", |
87 | .id = -1, | 126 | .id = -1, |
@@ -161,6 +200,7 @@ static struct platform_device sdp4430_lcd_device = { | |||
161 | 200 | ||
162 | static struct platform_device *sdp4430_devices[] __initdata = { | 201 | static struct platform_device *sdp4430_devices[] __initdata = { |
163 | &sdp4430_lcd_device, | 202 | &sdp4430_lcd_device, |
203 | &sdp4430_gpio_keys_device, | ||
164 | &sdp4430_leds_gpio, | 204 | &sdp4430_leds_gpio, |
165 | }; | 205 | }; |
166 | 206 | ||
@@ -412,6 +452,11 @@ static struct i2c_board_info __initdata sdp4430_i2c_3_boardinfo[] = { | |||
412 | I2C_BOARD_INFO("tmp105", 0x48), | 452 | I2C_BOARD_INFO("tmp105", 0x48), |
413 | }, | 453 | }, |
414 | }; | 454 | }; |
455 | static struct i2c_board_info __initdata sdp4430_i2c_4_boardinfo[] = { | ||
456 | { | ||
457 | I2C_BOARD_INFO("hmc5843", 0x1e), | ||
458 | }, | ||
459 | }; | ||
415 | static int __init omap4_i2c_init(void) | 460 | static int __init omap4_i2c_init(void) |
416 | { | 461 | { |
417 | /* | 462 | /* |
@@ -423,14 +468,36 @@ static int __init omap4_i2c_init(void) | |||
423 | omap_register_i2c_bus(2, 400, NULL, 0); | 468 | omap_register_i2c_bus(2, 400, NULL, 0); |
424 | omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo, | 469 | omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo, |
425 | ARRAY_SIZE(sdp4430_i2c_3_boardinfo)); | 470 | ARRAY_SIZE(sdp4430_i2c_3_boardinfo)); |
426 | omap_register_i2c_bus(4, 400, NULL, 0); | 471 | omap_register_i2c_bus(4, 400, sdp4430_i2c_4_boardinfo, |
472 | ARRAY_SIZE(sdp4430_i2c_4_boardinfo)); | ||
427 | return 0; | 473 | return 0; |
428 | } | 474 | } |
475 | |||
476 | static void __init omap_sfh7741prox_init(void) | ||
477 | { | ||
478 | int error; | ||
479 | |||
480 | error = gpio_request(OMAP4_SFH7741_ENABLE_GPIO, "sfh7741"); | ||
481 | if (error < 0) { | ||
482 | pr_err("%s:failed to request GPIO %d, error %d\n", | ||
483 | __func__, OMAP4_SFH7741_ENABLE_GPIO, error); | ||
484 | return; | ||
485 | } | ||
486 | |||
487 | error = gpio_direction_output(OMAP4_SFH7741_ENABLE_GPIO , 0); | ||
488 | if (error < 0) { | ||
489 | pr_err("%s: GPIO configuration failed: GPIO %d,error %d\n", | ||
490 | __func__, OMAP4_SFH7741_ENABLE_GPIO, error); | ||
491 | gpio_free(OMAP4_SFH7741_ENABLE_GPIO); | ||
492 | } | ||
493 | } | ||
494 | |||
429 | static void __init omap_4430sdp_init(void) | 495 | static void __init omap_4430sdp_init(void) |
430 | { | 496 | { |
431 | int status; | 497 | int status; |
432 | 498 | ||
433 | omap4_i2c_init(); | 499 | omap4_i2c_init(); |
500 | omap_sfh7741prox_init(); | ||
434 | platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices)); | 501 | platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices)); |
435 | omap_serial_init(); | 502 | omap_serial_init(); |
436 | omap4_twl6030_hsmmc_init(mmc); | 503 | omap4_twl6030_hsmmc_init(mmc); |
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c index 51493f59325d..7e7048878649 100644 --- a/arch/arm/mach-omap2/board-omap3beagle.c +++ b/arch/arm/mach-omap2/board-omap3beagle.c | |||
@@ -51,6 +51,93 @@ | |||
51 | 51 | ||
52 | #define NAND_BLOCK_SIZE SZ_128K | 52 | #define NAND_BLOCK_SIZE SZ_128K |
53 | 53 | ||
54 | /* | ||
55 | * OMAP3 Beagle revision | ||
56 | * Run time detection of Beagle revision is done by reading GPIO. | ||
57 | * GPIO ID - | ||
58 | * AXBX = GPIO173, GPIO172, GPIO171: 1 1 1 | ||
59 | * C1_3 = GPIO173, GPIO172, GPIO171: 1 1 0 | ||
60 | * C4 = GPIO173, GPIO172, GPIO171: 1 0 1 | ||
61 | * XM = GPIO173, GPIO172, GPIO171: 0 0 0 | ||
62 | */ | ||
63 | enum { | ||
64 | OMAP3BEAGLE_BOARD_UNKN = 0, | ||
65 | OMAP3BEAGLE_BOARD_AXBX, | ||
66 | OMAP3BEAGLE_BOARD_C1_3, | ||
67 | OMAP3BEAGLE_BOARD_C4, | ||
68 | OMAP3BEAGLE_BOARD_XM, | ||
69 | }; | ||
70 | |||
71 | static u8 omap3_beagle_version; | ||
72 | |||
73 | static u8 omap3_beagle_get_rev(void) | ||
74 | { | ||
75 | return omap3_beagle_version; | ||
76 | } | ||
77 | |||
78 | static void __init omap3_beagle_init_rev(void) | ||
79 | { | ||
80 | int ret; | ||
81 | u16 beagle_rev = 0; | ||
82 | |||
83 | omap_mux_init_gpio(171, OMAP_PIN_INPUT_PULLUP); | ||
84 | omap_mux_init_gpio(172, OMAP_PIN_INPUT_PULLUP); | ||
85 | omap_mux_init_gpio(173, OMAP_PIN_INPUT_PULLUP); | ||
86 | |||
87 | ret = gpio_request(171, "rev_id_0"); | ||
88 | if (ret < 0) | ||
89 | goto fail0; | ||
90 | |||
91 | ret = gpio_request(172, "rev_id_1"); | ||
92 | if (ret < 0) | ||
93 | goto fail1; | ||
94 | |||
95 | ret = gpio_request(173, "rev_id_2"); | ||
96 | if (ret < 0) | ||
97 | goto fail2; | ||
98 | |||
99 | gpio_direction_input(171); | ||
100 | gpio_direction_input(172); | ||
101 | gpio_direction_input(173); | ||
102 | |||
103 | beagle_rev = gpio_get_value(171) | (gpio_get_value(172) << 1) | ||
104 | | (gpio_get_value(173) << 2); | ||
105 | |||
106 | switch (beagle_rev) { | ||
107 | case 7: | ||
108 | printk(KERN_INFO "OMAP3 Beagle Rev: Ax/Bx\n"); | ||
109 | omap3_beagle_version = OMAP3BEAGLE_BOARD_AXBX; | ||
110 | break; | ||
111 | case 6: | ||
112 | printk(KERN_INFO "OMAP3 Beagle Rev: C1/C2/C3\n"); | ||
113 | omap3_beagle_version = OMAP3BEAGLE_BOARD_C1_3; | ||
114 | break; | ||
115 | case 5: | ||
116 | printk(KERN_INFO "OMAP3 Beagle Rev: C4\n"); | ||
117 | omap3_beagle_version = OMAP3BEAGLE_BOARD_C4; | ||
118 | break; | ||
119 | case 0: | ||
120 | printk(KERN_INFO "OMAP3 Beagle Rev: xM\n"); | ||
121 | omap3_beagle_version = OMAP3BEAGLE_BOARD_XM; | ||
122 | break; | ||
123 | default: | ||
124 | printk(KERN_INFO "OMAP3 Beagle Rev: unknown %hd\n", beagle_rev); | ||
125 | omap3_beagle_version = OMAP3BEAGLE_BOARD_UNKN; | ||
126 | } | ||
127 | |||
128 | return; | ||
129 | |||
130 | fail2: | ||
131 | gpio_free(172); | ||
132 | fail1: | ||
133 | gpio_free(171); | ||
134 | fail0: | ||
135 | printk(KERN_ERR "Unable to get revision detection GPIO pins\n"); | ||
136 | omap3_beagle_version = OMAP3BEAGLE_BOARD_UNKN; | ||
137 | |||
138 | return; | ||
139 | } | ||
140 | |||
54 | static struct mtd_partition omap3beagle_nand_partitions[] = { | 141 | static struct mtd_partition omap3beagle_nand_partitions[] = { |
55 | /* All the partition sizes are listed in terms of NAND block size */ | 142 | /* All the partition sizes are listed in terms of NAND block size */ |
56 | { | 143 | { |
@@ -186,7 +273,10 @@ static struct gpio_led gpio_leds[]; | |||
186 | static int beagle_twl_gpio_setup(struct device *dev, | 273 | static int beagle_twl_gpio_setup(struct device *dev, |
187 | unsigned gpio, unsigned ngpio) | 274 | unsigned gpio, unsigned ngpio) |
188 | { | 275 | { |
189 | if (system_rev >= 0x20 && system_rev <= 0x34301000) { | 276 | if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM) { |
277 | mmc[0].gpio_wp = -EINVAL; | ||
278 | } else if ((omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_C1_3) || | ||
279 | (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_C4)) { | ||
190 | omap_mux_init_gpio(23, OMAP_PIN_INPUT); | 280 | omap_mux_init_gpio(23, OMAP_PIN_INPUT); |
191 | mmc[0].gpio_wp = 23; | 281 | mmc[0].gpio_wp = 23; |
192 | } else { | 282 | } else { |
@@ -323,13 +413,19 @@ static struct i2c_board_info __initdata beagle_i2c_boardinfo[] = { | |||
323 | }, | 413 | }, |
324 | }; | 414 | }; |
325 | 415 | ||
416 | static struct i2c_board_info __initdata beagle_i2c_eeprom[] = { | ||
417 | { | ||
418 | I2C_BOARD_INFO("eeprom", 0x50), | ||
419 | }, | ||
420 | }; | ||
421 | |||
326 | static int __init omap3_beagle_i2c_init(void) | 422 | static int __init omap3_beagle_i2c_init(void) |
327 | { | 423 | { |
328 | omap_register_i2c_bus(1, 2600, beagle_i2c_boardinfo, | 424 | omap_register_i2c_bus(1, 2600, beagle_i2c_boardinfo, |
329 | ARRAY_SIZE(beagle_i2c_boardinfo)); | 425 | ARRAY_SIZE(beagle_i2c_boardinfo)); |
330 | /* Bus 3 is attached to the DVI port where devices like the pico DLP | 426 | /* Bus 3 is attached to the DVI port where devices like the pico DLP |
331 | * projector don't work reliably with 400kHz */ | 427 | * projector don't work reliably with 400kHz */ |
332 | omap_register_i2c_bus(3, 100, NULL, 0); | 428 | omap_register_i2c_bus(3, 100, beagle_i2c_eeprom, ARRAY_SIZE(beagle_i2c_eeprom)); |
333 | return 0; | 429 | return 0; |
334 | } | 430 | } |
335 | 431 | ||
@@ -465,6 +561,7 @@ static struct omap_musb_board_data musb_board_data = { | |||
465 | static void __init omap3_beagle_init(void) | 561 | static void __init omap3_beagle_init(void) |
466 | { | 562 | { |
467 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); | 563 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); |
564 | omap3_beagle_init_rev(); | ||
468 | omap3_beagle_i2c_init(); | 565 | omap3_beagle_i2c_init(); |
469 | platform_add_devices(omap3_beagle_devices, | 566 | platform_add_devices(omap3_beagle_devices, |
470 | ARRAY_SIZE(omap3_beagle_devices)); | 567 | ARRAY_SIZE(omap3_beagle_devices)); |
diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c index 0bb2353b64a4..aa8296e7e9d4 100644 --- a/arch/arm/mach-omap2/board-omap4panda.c +++ b/arch/arm/mach-omap2/board-omap4panda.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/init.h> | 20 | #include <linux/init.h> |
21 | #include <linux/platform_device.h> | 21 | #include <linux/platform_device.h> |
22 | #include <linux/io.h> | 22 | #include <linux/io.h> |
23 | #include <linux/leds.h> | ||
23 | #include <linux/gpio.h> | 24 | #include <linux/gpio.h> |
24 | #include <linux/usb/otg.h> | 25 | #include <linux/usb/otg.h> |
25 | #include <linux/i2c/twl.h> | 26 | #include <linux/i2c/twl.h> |
@@ -40,6 +41,36 @@ | |||
40 | #include "hsmmc.h" | 41 | #include "hsmmc.h" |
41 | 42 | ||
42 | 43 | ||
44 | static struct gpio_led gpio_leds[] = { | ||
45 | { | ||
46 | .name = "pandaboard::status1", | ||
47 | .default_trigger = "heartbeat", | ||
48 | .gpio = 7, | ||
49 | }, | ||
50 | { | ||
51 | .name = "pandaboard::status2", | ||
52 | .default_trigger = "mmc0", | ||
53 | .gpio = 8, | ||
54 | }, | ||
55 | }; | ||
56 | |||
57 | static struct gpio_led_platform_data gpio_led_info = { | ||
58 | .leds = gpio_leds, | ||
59 | .num_leds = ARRAY_SIZE(gpio_leds), | ||
60 | }; | ||
61 | |||
62 | static struct platform_device leds_gpio = { | ||
63 | .name = "leds-gpio", | ||
64 | .id = -1, | ||
65 | .dev = { | ||
66 | .platform_data = &gpio_led_info, | ||
67 | }, | ||
68 | }; | ||
69 | |||
70 | static struct platform_device *panda_devices[] __initdata = { | ||
71 | &leds_gpio, | ||
72 | }; | ||
73 | |||
43 | static void __init omap4_panda_init_irq(void) | 74 | static void __init omap4_panda_init_irq(void) |
44 | { | 75 | { |
45 | omap2_init_common_hw(NULL, NULL); | 76 | omap2_init_common_hw(NULL, NULL); |
@@ -275,6 +306,7 @@ static int __init omap4_panda_i2c_init(void) | |||
275 | static void __init omap4_panda_init(void) | 306 | static void __init omap4_panda_init(void) |
276 | { | 307 | { |
277 | omap4_panda_i2c_init(); | 308 | omap4_panda_i2c_init(); |
309 | platform_add_devices(panda_devices, ARRAY_SIZE(panda_devices)); | ||
278 | omap_serial_init(); | 310 | omap_serial_init(); |
279 | omap4_twl6030_hsmmc_init(mmc); | 311 | omap4_twl6030_hsmmc_init(mmc); |
280 | /* OMAP4 Panda uses internal transceiver so register nop transceiver */ | 312 | /* OMAP4 Panda uses internal transceiver so register nop transceiver */ |