aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/board-4430sdp.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-10-25 16:46:56 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-10-25 16:46:56 -0400
commit7b6181e06841f5ad15c4ff708b967b4db65a64de (patch)
treebdfcf5b74b692f76581156e452d268b64c795200 /arch/arm/mach-omap2/board-4430sdp.c
parent72e58063d63c5f0a7bf65312f1e3a5ed9bb5c2ff (diff)
parentbc487fb341af05120bccb9f59ce76302391dcc77 (diff)
Merge branch 'omap-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6
* 'omap-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6: (163 commits) omap: complete removal of machine_desc.io_pg_offst and .phys_io omap: UART: fix wakeup registers for OMAP24xx UART2 omap: Fix spotty MMC voltages ASoC: OMAP4: MCPDM: Remove unnecessary include of plat/control.h serial: omap-serial: fix signess error OMAP3: DMA: Errata i541: sDMA FIFO draining does not finish omap: dma: Fix buffering disable bit setting for omap24xx omap: serial: Fix the boot-up crash/reboot without CONFIG_PM OMAP3: PM: fix scratchpad memory accesses for off-mode omap4: pandaboard: enable the ehci port on pandaboard omap4: pandaboard: Fix the init if CONFIG_MMC_OMAP_HS is not set omap4: pandaboard: remove unused hsmmc definition OMAP: McBSP: Remove null omap44xx ops comment OMAP: McBSP: Swap CLKS source definition OMAP: McBSP: Fix CLKR and FSR signal muxing OMAP2+: clock: reduce the amount of standard debugging while disabling unused clocks OMAP: control: move plat-omap/control.h to mach-omap2/control.h OMAP: split plat-omap/common.c OMAP: McBSP: implement functional clock switching via clock framework OMAP: McBSP: implement McBSP CLKR and FSR signal muxing via mach-omap2/mcbsp.c ... Fixed up trivial conflicts in arch/arm/mach-omap2/ {board-zoom-peripherals.c,devices.c} as per Tony
Diffstat (limited to 'arch/arm/mach-omap2/board-4430sdp.c')
-rw-r--r--arch/arm/mach-omap2/board-4430sdp.c87
1 files changed, 81 insertions, 6 deletions
diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index 0b6a65f3a10a..69a4ae971e41 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
@@ -31,15 +32,18 @@
31 32
32#include <plat/board.h> 33#include <plat/board.h>
33#include <plat/common.h> 34#include <plat/common.h>
34#include <plat/control.h>
35#include <plat/timer-gp.h>
36#include <plat/usb.h> 35#include <plat/usb.h>
37#include <plat/mmc.h> 36#include <plat/mmc.h>
37
38#include "hsmmc.h" 38#include "hsmmc.h"
39#include "timer-gp.h"
40#include "control.h"
39 41
40#define ETH_KS8851_IRQ 34 42#define ETH_KS8851_IRQ 34
41#define ETH_KS8851_POWER_ON 48 43#define ETH_KS8851_POWER_ON 48
42#define ETH_KS8851_QUART 138 44#define ETH_KS8851_QUART 138
45#define OMAP4_SFH7741_SENSOR_OUTPUT_GPIO 184
46#define OMAP4_SFH7741_ENABLE_GPIO 188
43 47
44static struct gpio_led sdp4430_gpio_leds[] = { 48static struct gpio_led sdp4430_gpio_leds[] = {
45 { 49 {
@@ -77,11 +81,47 @@ static struct gpio_led sdp4430_gpio_leds[] = {
77 81
78}; 82};
79 83
84static struct gpio_keys_button sdp4430_gpio_keys[] = {
85 {
86 .desc = "Proximity Sensor",
87 .type = EV_SW,
88 .code = SW_FRONT_PROXIMITY,
89 .gpio = OMAP4_SFH7741_SENSOR_OUTPUT_GPIO,
90 .active_low = 0,
91 }
92};
93
80static struct gpio_led_platform_data sdp4430_led_data = { 94static struct gpio_led_platform_data sdp4430_led_data = {
81 .leds = sdp4430_gpio_leds, 95 .leds = sdp4430_gpio_leds,
82 .num_leds = ARRAY_SIZE(sdp4430_gpio_leds), 96 .num_leds = ARRAY_SIZE(sdp4430_gpio_leds),
83}; 97};
84 98
99static int omap_prox_activate(struct device *dev)
100{
101 gpio_set_value(OMAP4_SFH7741_ENABLE_GPIO , 1);
102 return 0;
103}
104
105static void omap_prox_deactivate(struct device *dev)
106{
107 gpio_set_value(OMAP4_SFH7741_ENABLE_GPIO , 0);
108}
109
110static struct gpio_keys_platform_data sdp4430_gpio_keys_data = {
111 .buttons = sdp4430_gpio_keys,
112 .nbuttons = ARRAY_SIZE(sdp4430_gpio_keys),
113 .enable = omap_prox_activate,
114 .disable = omap_prox_deactivate,
115};
116
117static struct platform_device sdp4430_gpio_keys_device = {
118 .name = "gpio-keys",
119 .id = -1,
120 .dev = {
121 .platform_data = &sdp4430_gpio_keys_data,
122 },
123};
124
85static struct platform_device sdp4430_leds_gpio = { 125static struct platform_device sdp4430_leds_gpio = {
86 .name = "leds-gpio", 126 .name = "leds-gpio",
87 .id = -1, 127 .id = -1,
@@ -161,6 +201,7 @@ static struct platform_device sdp4430_lcd_device = {
161 201
162static struct platform_device *sdp4430_devices[] __initdata = { 202static struct platform_device *sdp4430_devices[] __initdata = {
163 &sdp4430_lcd_device, 203 &sdp4430_lcd_device,
204 &sdp4430_gpio_keys_device,
164 &sdp4430_leds_gpio, 205 &sdp4430_leds_gpio,
165}; 206};
166 207
@@ -193,15 +234,16 @@ static struct omap_musb_board_data musb_board_data = {
193static struct omap2_hsmmc_info mmc[] = { 234static struct omap2_hsmmc_info mmc[] = {
194 { 235 {
195 .mmc = 1, 236 .mmc = 1,
196 .wires = 8, 237 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
197 .gpio_wp = -EINVAL, 238 .gpio_wp = -EINVAL,
198 }, 239 },
199 { 240 {
200 .mmc = 2, 241 .mmc = 2,
201 .wires = 8, 242 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
202 .gpio_cd = -EINVAL, 243 .gpio_cd = -EINVAL,
203 .gpio_wp = -EINVAL, 244 .gpio_wp = -EINVAL,
204 .nonremovable = true, 245 .nonremovable = true,
246 .ocr_mask = MMC_VDD_29_30,
205 }, 247 },
206 {} /* Terminator */ 248 {} /* Terminator */
207}; 249};
@@ -235,8 +277,14 @@ static int omap4_twl6030_hsmmc_late_init(struct device *dev)
235 277
236static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev) 278static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev)
237{ 279{
238 struct omap_mmc_platform_data *pdata = dev->platform_data; 280 struct omap_mmc_platform_data *pdata;
239 281
282 /* dev can be null if CONFIG_MMC_OMAP_HS is not set */
283 if (!dev) {
284 pr_err("Failed %s\n", __func__);
285 return;
286 }
287 pdata = dev->platform_data;
240 pdata->init = omap4_twl6030_hsmmc_late_init; 288 pdata->init = omap4_twl6030_hsmmc_late_init;
241} 289}
242 290
@@ -412,6 +460,11 @@ static struct i2c_board_info __initdata sdp4430_i2c_3_boardinfo[] = {
412 I2C_BOARD_INFO("tmp105", 0x48), 460 I2C_BOARD_INFO("tmp105", 0x48),
413 }, 461 },
414}; 462};
463static struct i2c_board_info __initdata sdp4430_i2c_4_boardinfo[] = {
464 {
465 I2C_BOARD_INFO("hmc5843", 0x1e),
466 },
467};
415static int __init omap4_i2c_init(void) 468static int __init omap4_i2c_init(void)
416{ 469{
417 /* 470 /*
@@ -423,14 +476,36 @@ static int __init omap4_i2c_init(void)
423 omap_register_i2c_bus(2, 400, NULL, 0); 476 omap_register_i2c_bus(2, 400, NULL, 0);
424 omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo, 477 omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo,
425 ARRAY_SIZE(sdp4430_i2c_3_boardinfo)); 478 ARRAY_SIZE(sdp4430_i2c_3_boardinfo));
426 omap_register_i2c_bus(4, 400, NULL, 0); 479 omap_register_i2c_bus(4, 400, sdp4430_i2c_4_boardinfo,
480 ARRAY_SIZE(sdp4430_i2c_4_boardinfo));
427 return 0; 481 return 0;
428} 482}
483
484static void __init omap_sfh7741prox_init(void)
485{
486 int error;
487
488 error = gpio_request(OMAP4_SFH7741_ENABLE_GPIO, "sfh7741");
489 if (error < 0) {
490 pr_err("%s:failed to request GPIO %d, error %d\n",
491 __func__, OMAP4_SFH7741_ENABLE_GPIO, error);
492 return;
493 }
494
495 error = gpio_direction_output(OMAP4_SFH7741_ENABLE_GPIO , 0);
496 if (error < 0) {
497 pr_err("%s: GPIO configuration failed: GPIO %d,error %d\n",
498 __func__, OMAP4_SFH7741_ENABLE_GPIO, error);
499 gpio_free(OMAP4_SFH7741_ENABLE_GPIO);
500 }
501}
502
429static void __init omap_4430sdp_init(void) 503static void __init omap_4430sdp_init(void)
430{ 504{
431 int status; 505 int status;
432 506
433 omap4_i2c_init(); 507 omap4_i2c_init();
508 omap_sfh7741prox_init();
434 platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices)); 509 platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices));
435 omap_serial_init(); 510 omap_serial_init();
436 omap4_twl6030_hsmmc_init(mmc); 511 omap4_twl6030_hsmmc_init(mmc);