diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-08 08:15:29 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-08 08:15:29 -0800 |
commit | 1c496784a0d317535f846ddb2c93a08ba936266b (patch) | |
tree | 6d0225860032f263b6d95a3e55c364a1a5f55ec1 /arch/arm/mach-omap2/board-rx51-peripherals.c | |
parent | adf9904dc774f23f04a5425f0198483ea61f878b (diff) | |
parent | 9a01609e1885b827b979d6d9dd86f43208a9e5fc (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: (149 commits)
arm: omap: Add omap3_defconfig
AM35xx: Defconfig for AM3517 EVM board
AM35xx: Add support for AM3517 EVM board
omap: 3630sdp: defconfig creation
omap: 3630sdp: introduce 3630 sdp board support
omap3: Add defconfig for IGEP v2 board
omap3: Add minimal IGEP v2 support
omap3: Add CompuLab CM-T35 defconfig
omap3: Add CompuLab CM-T35 board support
omap3: rx51: Add wl1251 wlan driver support
omap3: rx51: Add SDRAM init
omap1: Add default kernel configuration for Herald
omap1: Add board support and LCD for HTC Herald
omap: zoom2: update defconfig for LL_DEBUG_NONE
omap: zoom3: defconfig creation
omap3: zoom: Introduce zoom3 board support
omap3: zoom: Drop i2c-1 speed to 2400
omap3: zoom: rename zoom2 name to generic zoom
omap3: zoom: split board file for software reuse
omap3evm: MIgrate to smsc911x ethernet driver
...
Fix trivial conflict (two unrelated config options added next to each
other) in arch/arm/mach-omap2/Makefile
Diffstat (limited to 'arch/arm/mach-omap2/board-rx51-peripherals.c')
-rw-r--r-- | arch/arm/mach-omap2/board-rx51-peripherals.c | 179 |
1 files changed, 171 insertions, 8 deletions
diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c index e34d96a825e..15ce6514c5f 100644 --- a/arch/arm/mach-omap2/board-rx51-peripherals.c +++ b/arch/arm/mach-omap2/board-rx51-peripherals.c @@ -14,28 +14,137 @@ #include <linux/input.h> #include <linux/input/matrix_keypad.h> #include <linux/spi/spi.h> +#include <linux/spi/wl12xx.h> #include <linux/i2c.h> #include <linux/i2c/twl4030.h> #include <linux/clk.h> #include <linux/delay.h> #include <linux/regulator/machine.h> #include <linux/gpio.h> +#include <linux/gpio_keys.h> #include <linux/mmc/host.h> -#include <mach/mcspi.h> -#include <mach/mux.h> -#include <mach/board.h> -#include <mach/common.h> -#include <mach/dma.h> -#include <mach/gpmc.h> -#include <mach/onenand.h> -#include <mach/gpmc-smc91x.h> +#include <plat/mcspi.h> +#include <plat/mux.h> +#include <plat/board.h> +#include <plat/common.h> +#include <plat/dma.h> +#include <plat/gpmc.h> +#include <plat/onenand.h> +#include <plat/gpmc-smc91x.h> #include "mmc-twl4030.h" #define SYSTEM_REV_B_USES_VAUX3 0x1699 #define SYSTEM_REV_S_USES_VAUX3 0x8 +#define RX51_WL1251_POWER_GPIO 87 +#define RX51_WL1251_IRQ_GPIO 42 + +/* list all spi devices here */ +enum { + RX51_SPI_WL1251, +}; + +static struct wl12xx_platform_data wl1251_pdata; + +static struct omap2_mcspi_device_config wl1251_mcspi_config = { + .turbo_mode = 0, + .single_channel = 1, +}; + +static struct spi_board_info rx51_peripherals_spi_board_info[] __initdata = { + [RX51_SPI_WL1251] = { + .modalias = "wl1251", + .bus_num = 4, + .chip_select = 0, + .max_speed_hz = 48000000, + .mode = SPI_MODE_2, + .controller_data = &wl1251_mcspi_config, + .platform_data = &wl1251_pdata, + }, +}; + +#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) + +#define RX51_GPIO_CAMERA_LENS_COVER 110 +#define RX51_GPIO_CAMERA_FOCUS 68 +#define RX51_GPIO_CAMERA_CAPTURE 69 +#define RX51_GPIO_KEYPAD_SLIDE 71 +#define RX51_GPIO_LOCK_BUTTON 113 +#define RX51_GPIO_PROXIMITY 89 + +#define RX51_GPIO_DEBOUNCE_TIMEOUT 10 + +static struct gpio_keys_button rx51_gpio_keys[] = { + { + .desc = "Camera Lens Cover", + .type = EV_SW, + .code = SW_CAMERA_LENS_COVER, + .gpio = RX51_GPIO_CAMERA_LENS_COVER, + .active_low = 1, + .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT, + }, { + .desc = "Camera Focus", + .type = EV_KEY, + .code = KEY_CAMERA_FOCUS, + .gpio = RX51_GPIO_CAMERA_FOCUS, + .active_low = 1, + .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT, + }, { + .desc = "Camera Capture", + .type = EV_KEY, + .code = KEY_CAMERA, + .gpio = RX51_GPIO_CAMERA_CAPTURE, + .active_low = 1, + .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT, + }, { + .desc = "Lock Button", + .type = EV_KEY, + .code = KEY_SCREENLOCK, + .gpio = RX51_GPIO_LOCK_BUTTON, + .active_low = 1, + .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT, + }, { + .desc = "Keypad Slide", + .type = EV_SW, + .code = SW_KEYPAD_SLIDE, + .gpio = RX51_GPIO_KEYPAD_SLIDE, + .active_low = 1, + .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT, + }, { + .desc = "Proximity Sensor", + .type = EV_SW, + .code = SW_FRONT_PROXIMITY, + .gpio = RX51_GPIO_PROXIMITY, + .active_low = 0, + .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT, + } +}; + +static struct gpio_keys_platform_data rx51_gpio_keys_data = { + .buttons = rx51_gpio_keys, + .nbuttons = ARRAY_SIZE(rx51_gpio_keys), +}; + +static struct platform_device rx51_gpio_keys_device = { + .name = "gpio-keys", + .id = -1, + .dev = { + .platform_data = &rx51_gpio_keys_data, + }, +}; + +static void __init rx51_add_gpio_keys(void) +{ + platform_device_register(&rx51_gpio_keys_device); +} +#else +static void __init rx51_add_gpio_keys(void) +{ +} +#endif /* CONFIG_KEYBOARD_GPIO || CONFIG_KEYBOARD_GPIO_MODULE */ + static int board_keymap[] = { KEY(0, 0, KEY_Q), KEY(0, 1, KEY_O), @@ -536,10 +645,64 @@ static inline void board_smc91x_init(void) #endif +static void rx51_wl1251_set_power(bool enable) +{ + gpio_set_value(RX51_WL1251_POWER_GPIO, enable); +} + +static void __init rx51_init_wl1251(void) +{ + int irq, ret; + + ret = gpio_request(RX51_WL1251_POWER_GPIO, "wl1251 power"); + if (ret < 0) + goto error; + + ret = gpio_direction_output(RX51_WL1251_POWER_GPIO, 0); + if (ret < 0) + goto err_power; + + ret = gpio_request(RX51_WL1251_IRQ_GPIO, "wl1251 irq"); + if (ret < 0) + goto err_power; + + ret = gpio_direction_input(RX51_WL1251_IRQ_GPIO); + if (ret < 0) + goto err_irq; + + irq = gpio_to_irq(RX51_WL1251_IRQ_GPIO); + if (irq < 0) + goto err_irq; + + wl1251_pdata.set_power = rx51_wl1251_set_power; + rx51_peripherals_spi_board_info[RX51_SPI_WL1251].irq = irq; + + return; + +err_irq: + gpio_free(RX51_WL1251_IRQ_GPIO); + +err_power: + gpio_free(RX51_WL1251_POWER_GPIO); + +error: + printk(KERN_ERR "wl1251 board initialisation failed\n"); + wl1251_pdata.set_power = NULL; + + /* + * Now rx51_peripherals_spi_board_info[1].irq is zero and + * set_power is null, and wl1251_probe() will fail. + */ +} + void __init rx51_peripherals_init(void) { rx51_i2c_init(); board_onenand_init(); board_smc91x_init(); + rx51_add_gpio_keys(); + rx51_init_wl1251(); + spi_register_board_info(rx51_peripherals_spi_board_info, + ARRAY_SIZE(rx51_peripherals_spi_board_info)); } |