omap3: rx51: Add wl1251 wlan driver support

wl1251 is connected to the SPI bus in rx51, add support for this.

Signed-off-by: Kalle Valo <kalle.valo@nokia.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
This commit is contained in:
Kalle Valo 2009-11-18 18:41:06 -08:00 committed by Tony Lindgren
parent 2000655ee7
commit a24e61a9ce

View File

@ -14,6 +14,7 @@
#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>
@ -37,6 +38,33 @@
#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
@ -617,11 +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));
}