aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pxa/em-x270.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-pxa/em-x270.c')
-rw-r--r--arch/arm/mach-pxa/em-x270.c90
1 files changed, 80 insertions, 10 deletions
diff --git a/arch/arm/mach-pxa/em-x270.c b/arch/arm/mach-pxa/em-x270.c
index 920dfb8d36da..bc0f73fbd4ca 100644
--- a/arch/arm/mach-pxa/em-x270.c
+++ b/arch/arm/mach-pxa/em-x270.c
@@ -25,6 +25,7 @@
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>
30 31
@@ -62,6 +63,8 @@
62#define GPIO93_CAM_RESET (93) 63#define GPIO93_CAM_RESET (93)
63#define GPIO41_ETHIRQ (41) 64#define GPIO41_ETHIRQ (41)
64#define EM_X270_ETHIRQ IRQ_GPIO(GPIO41_ETHIRQ) 65#define EM_X270_ETHIRQ IRQ_GPIO(GPIO41_ETHIRQ)
66#define GPIO115_WLAN_PWEN (115)
67#define GPIO19_WLAN_STRAP (19)
65 68
66static int mmc_cd; 69static int mmc_cd;
67static int nand_rb; 70static int nand_rb;
@@ -159,8 +162,8 @@ static unsigned long common_pin_config[] = {
159 GPIO57_SSP1_TXD, 162 GPIO57_SSP1_TXD,
160 163
161 /* SSP2 */ 164 /* SSP2 */
162 GPIO19_SSP2_SCLK, 165 GPIO19_GPIO, /* SSP2 clock is used as GPIO for Libertas pin-strap */
163 GPIO14_SSP2_SFRM, 166 GPIO14_GPIO,
164 GPIO89_SSP2_TXD, 167 GPIO89_SSP2_TXD,
165 GPIO88_SSP2_RXD, 168 GPIO88_SSP2_RXD,
166 169
@@ -640,28 +643,95 @@ static struct pxa2xx_spi_master em_x270_spi_info = {
640}; 643};
641 644
642static struct pxa2xx_spi_chip em_x270_tdo24m_chip = { 645static struct pxa2xx_spi_chip em_x270_tdo24m_chip = {
643 .rx_threshold = 1, 646 .rx_threshold = 1,
644 .tx_threshold = 1, 647 .tx_threshold = 1,
648 .gpio_cs = -1,
645}; 649};
646 650
647static struct tdo24m_platform_data em_x270_tdo24m_pdata = { 651static 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