aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Rapoport <mike@compulab.co.il>2009-02-03 02:15:30 -0500
committerEric Miao <eric.miao@marvell.com>2009-04-03 20:24:39 -0400
commitc9be0e39618984b925ec758c1384853db4435ea8 (patch)
treeba5b0540d474464fca84473df559ce25954626fd
parenteb650b9ed0f69be075a5a86ef9c4fc2cf7915293 (diff)
[ARM] pxa/em-x270: add libertas device registration
Signed-off-by: Mike Rapoport <mike@compulab.co.il> Signed-off-by: Eric Miao <eric.miao@marvell.com>
-rw-r--r--arch/arm/mach-pxa/em-x270.c86
1 files changed, 78 insertions, 8 deletions
diff --git a/arch/arm/mach-pxa/em-x270.c b/arch/arm/mach-pxa/em-x270.c
index 920dfb8d36da..67611dadb44e 100644
--- a/arch/arm/mach-pxa/em-x270.c
+++ b/arch/arm/mach-pxa/em-x270.c
@@ -25,8 +25,10 @@
25#include <linux/regulator/machine.h> 25#include <linux/regulator/machine.h>
26#include <linux/spi/spi.h> 26#include <linux/spi/spi.h>
27#include <linux/spi/tdo24m.h> 27#include <linux/spi/tdo24m.h>
28#include <linux/spi/libertas_spi.h>
28#include <linux/power_supply.h> 29#include <linux/power_supply.h>
29#include <linux/apm-emulation.h> 30#include <linux/apm-emulation.h>
31#include <linux/delay.h>
30 32
31#include <media/soc_camera.h> 33#include <media/soc_camera.h>
32 34
@@ -62,6 +64,8 @@
62#define GPIO93_CAM_RESET (93) 64#define GPIO93_CAM_RESET (93)
63#define GPIO41_ETHIRQ (41) 65#define GPIO41_ETHIRQ (41)
64#define EM_X270_ETHIRQ IRQ_GPIO(GPIO41_ETHIRQ) 66#define EM_X270_ETHIRQ IRQ_GPIO(GPIO41_ETHIRQ)
67#define GPIO115_WLAN_PWEN (115)
68#define GPIO19_WLAN_STRAP (19)
65 69
66static int mmc_cd; 70static int mmc_cd;
67static int nand_rb; 71static int nand_rb;
@@ -159,8 +163,8 @@ static unsigned long common_pin_config[] = {
159 GPIO57_SSP1_TXD, 163 GPIO57_SSP1_TXD,
160 164
161 /* SSP2 */ 165 /* SSP2 */
162 GPIO19_SSP2_SCLK, 166 GPIO19_GPIO, /* SSP2 clock is used as GPIO for Libertas pin-strap */
163 GPIO14_SSP2_SFRM, 167 GPIO14_GPIO,
164 GPIO89_SSP2_TXD, 168 GPIO89_SSP2_TXD,
165 GPIO88_SSP2_RXD, 169 GPIO88_SSP2_RXD,
166 170
@@ -648,20 +652,86 @@ static struct tdo24m_platform_data em_x270_tdo24m_pdata = {
648 .model = TDO35S, 652 .model = TDO35S,
649}; 653};
650 654
655static struct pxa2xx_spi_master em_x270_spi_2_info = {
656 .num_chipselect = 1,
657 .enable_dma = 1,
658};
659
660static struct pxa2xx_spi_chip em_x270_libertas_chip = {
661 .rx_threshold = 1,
662 .tx_threshold = 1,
663 .timeout = 1000,
664};
665
666static unsigned long em_x270_libertas_pin_config[] = {
667 /* SSP2 */
668 GPIO19_SSP2_SCLK,
669 GPIO14_GPIO,
670 GPIO89_SSP2_TXD,
671 GPIO88_SSP2_RXD,
672};
673
674static int em_x270_libertas_setup(struct spi_device *spi)
675{
676 int err = gpio_request(GPIO115_WLAN_PWEN, "WLAN PWEN");
677 if (err)
678 return err;
679
680 gpio_direction_output(GPIO19_WLAN_STRAP, 1);
681 mdelay(100);
682
683 pxa2xx_mfp_config(ARRAY_AND_SIZE(em_x270_libertas_pin_config));
684
685 gpio_direction_output(GPIO115_WLAN_PWEN, 0);
686 mdelay(100);
687 gpio_set_value(GPIO115_WLAN_PWEN, 1);
688 mdelay(100);
689
690 spi->bits_per_word = 16;
691 spi_setup(spi);
692
693 return 0;
694}
695
696static int em_x270_libertas_teardown(struct spi_device *spi)
697{
698 gpio_set_value(GPIO115_WLAN_PWEN, 0);
699 gpio_free(GPIO115_WLAN_PWEN);
700
701 return 0;
702}
703
704struct libertas_spi_platform_data em_x270_libertas_pdata = {
705 .use_dummy_writes = 1,
706 .gpio_cs = 14,
707 .setup = em_x270_libertas_setup,
708 .teardown = em_x270_libertas_teardown,
709};
710
651static struct spi_board_info em_x270_spi_devices[] __initdata = { 711static struct spi_board_info em_x270_spi_devices[] __initdata = {
652 { 712 {
653 .modalias = "tdo24m", 713 .modalias = "tdo24m",
654 .max_speed_hz = 1000000, 714 .max_speed_hz = 1000000,
655 .bus_num = 1, 715 .bus_num = 1,
656 .chip_select = 0, 716 .chip_select = 0,
657 .controller_data = &em_x270_tdo24m_chip, 717 .controller_data = &em_x270_tdo24m_chip,
658 .platform_data = &em_x270_tdo24m_pdata, 718 .platform_data = &em_x270_tdo24m_pdata,
719 },
720 {
721 .modalias = "libertas_spi",
722 .max_speed_hz = 13000000,
723 .bus_num = 2,
724 .irq = IRQ_GPIO(116),
725 .chip_select = 0,
726 .controller_data = &em_x270_libertas_chip,
727 .platform_data = &em_x270_libertas_pdata,
659 }, 728 },
660}; 729};
661 730
662static void __init em_x270_init_spi(void) 731static void __init em_x270_init_spi(void)
663{ 732{
664 pxa2xx_set_spi_info(1, &em_x270_spi_info); 733 pxa2xx_set_spi_info(1, &em_x270_spi_info);
734 pxa2xx_set_spi_info(2, &em_x270_spi_2_info);
665 spi_register_board_info(ARRAY_AND_SIZE(em_x270_spi_devices)); 735 spi_register_board_info(ARRAY_AND_SIZE(em_x270_spi_devices));
666} 736}
667#else 737#else