From patchwork Tue Oct 13 16:58:13 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kalle Valo X-Patchwork-Id: 53457 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n9DHBZa5015303 for ; Tue, 13 Oct 2009 17:11:35 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760329AbZJMQ7u (ORCPT ); Tue, 13 Oct 2009 12:59:50 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754352AbZJMQ7u (ORCPT ); Tue, 13 Oct 2009 12:59:50 -0400 Received: from smtp.nokia.com ([192.100.122.230]:51899 "EHLO mgw-mx03.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753291AbZJMQ7s (ORCPT ); Tue, 13 Oct 2009 12:59:48 -0400 Received: from vaebh105.NOE.Nokia.com (vaebh105.europe.nokia.com [10.160.244.31]) by mgw-mx03.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id n9DGwOIZ011842; Tue, 13 Oct 2009 19:58:29 +0300 Received: from esebh102.NOE.Nokia.com ([172.21.138.183]) by vaebh105.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 13 Oct 2009 19:58:15 +0300 Received: from mgw-sa01.ext.nokia.com ([147.243.1.47]) by esebh102.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Tue, 13 Oct 2009 19:58:15 +0300 Received: from [127.0.1.1] (essapo-nirac25318.europe.nokia.com [10.162.253.18]) by mgw-sa01.ext.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id n9DGwE0p012247; Tue, 13 Oct 2009 19:58:14 +0300 From: Kalle Valo Subject: [PATCH] rx51: add wl1251 wlan driver support To: linux-omap@vger.kernel.org Cc: linux-wireless@vger.kernel.org Date: Tue, 13 Oct 2009 19:58:13 +0300 Message-ID: <20091013165812.1623.66247.stgit@tikku> User-Agent: StGIT/0.14.2 MIME-Version: 1.0 X-OriginalArrivalTime: 13 Oct 2009 16:58:15.0561 (UTC) FILETIME=[5B2CC790:01CA4C26] X-Nokia-AV: Clean Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c index c1af532..ccb8656 100644 --- a/arch/arm/mach-omap2/board-rx51-peripherals.c +++ b/arch/arm/mach-omap2/board-rx51-peripherals.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -36,6 +37,37 @@ #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 + +static void rx51_wl1251_set_power(bool enable); + +static struct wl12xx_platform_data wl1251_pdata = { + .set_power = rx51_wl1251_set_power, +}; + +static struct omap2_mcspi_device_config wl1251_mcspi_config = { + .turbo_mode = 0, + .single_channel = 1, +}; + +/* list all spi devices here */ +enum { + RX51_SPI_WL1251, +}; + +static struct spi_board_info rx51_peripherals_spi_board_info[] = { + [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, + }, +}; + static int board_keymap[] = { KEY(0, 0, KEY_Q), KEY(0, 1, KEY_O), @@ -257,6 +289,55 @@ static struct regulator_init_data rx51_vdac = { }, }; +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; + + 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. + */ +} + static int rx51_twlgpio_setup(struct device *dev, unsigned gpio, unsigned n) { /* FIXME this gpio setup is just a placeholder for now */ @@ -538,6 +619,10 @@ static inline void board_smc91x_init(void) void __init rx51_peripherals_init(void) { + rx51_init_wl1251(); + + spi_register_board_info(rx51_peripherals_spi_board_info, + ARRAY_SIZE(rx51_peripherals_spi_board_info)); rx51_i2c_init(); board_onenand_init(); board_smc91x_init();