Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 142815
b: refs/heads/master
c: c9be0e3
h: refs/heads/master
i:
  142813: d4040fd
  142811: b10b879
  142807: 93bdd8c
  142799: b9b74f0
  142783: b74b921
v: v3
  • Loading branch information
Mike Rapoport authored and Eric Miao committed Apr 4, 2009
1 parent f0a813a commit 61d1d0d
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: eb650b9ed0f69be075a5a86ef9c4fc2cf7915293
refs/heads/master: c9be0e39618984b925ec758c1384853db4435ea8
86 changes: 78 additions & 8 deletions trunk/arch/arm/mach-pxa/em-x270.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@
#include <linux/regulator/machine.h>
#include <linux/spi/spi.h>
#include <linux/spi/tdo24m.h>
#include <linux/spi/libertas_spi.h>
#include <linux/power_supply.h>
#include <linux/apm-emulation.h>
#include <linux/delay.h>

#include <media/soc_camera.h>

Expand Down Expand Up @@ -62,6 +64,8 @@
#define GPIO93_CAM_RESET (93)
#define GPIO41_ETHIRQ (41)
#define EM_X270_ETHIRQ IRQ_GPIO(GPIO41_ETHIRQ)
#define GPIO115_WLAN_PWEN (115)
#define GPIO19_WLAN_STRAP (19)

static int mmc_cd;
static int nand_rb;
Expand Down Expand Up @@ -159,8 +163,8 @@ static unsigned long common_pin_config[] = {
GPIO57_SSP1_TXD,

/* SSP2 */
GPIO19_SSP2_SCLK,
GPIO14_SSP2_SFRM,
GPIO19_GPIO, /* SSP2 clock is used as GPIO for Libertas pin-strap */
GPIO14_GPIO,
GPIO89_SSP2_TXD,
GPIO88_SSP2_RXD,

Expand Down Expand Up @@ -648,20 +652,86 @@ static struct tdo24m_platform_data em_x270_tdo24m_pdata = {
.model = TDO35S,
};

static struct pxa2xx_spi_master em_x270_spi_2_info = {
.num_chipselect = 1,
.enable_dma = 1,
};

static struct pxa2xx_spi_chip em_x270_libertas_chip = {
.rx_threshold = 1,
.tx_threshold = 1,
.timeout = 1000,
};

static unsigned long em_x270_libertas_pin_config[] = {
/* SSP2 */
GPIO19_SSP2_SCLK,
GPIO14_GPIO,
GPIO89_SSP2_TXD,
GPIO88_SSP2_RXD,
};

static int em_x270_libertas_setup(struct spi_device *spi)
{
int err = gpio_request(GPIO115_WLAN_PWEN, "WLAN PWEN");
if (err)
return err;

gpio_direction_output(GPIO19_WLAN_STRAP, 1);
mdelay(100);

pxa2xx_mfp_config(ARRAY_AND_SIZE(em_x270_libertas_pin_config));

gpio_direction_output(GPIO115_WLAN_PWEN, 0);
mdelay(100);
gpio_set_value(GPIO115_WLAN_PWEN, 1);
mdelay(100);

spi->bits_per_word = 16;
spi_setup(spi);

return 0;
}

static int em_x270_libertas_teardown(struct spi_device *spi)
{
gpio_set_value(GPIO115_WLAN_PWEN, 0);
gpio_free(GPIO115_WLAN_PWEN);

return 0;
}

struct libertas_spi_platform_data em_x270_libertas_pdata = {
.use_dummy_writes = 1,
.gpio_cs = 14,
.setup = em_x270_libertas_setup,
.teardown = em_x270_libertas_teardown,
};

static struct spi_board_info em_x270_spi_devices[] __initdata = {
{
.modalias = "tdo24m",
.max_speed_hz = 1000000,
.bus_num = 1,
.chip_select = 0,
.controller_data = &em_x270_tdo24m_chip,
.platform_data = &em_x270_tdo24m_pdata,
.modalias = "tdo24m",
.max_speed_hz = 1000000,
.bus_num = 1,
.chip_select = 0,
.controller_data = &em_x270_tdo24m_chip,
.platform_data = &em_x270_tdo24m_pdata,
},
{
.modalias = "libertas_spi",
.max_speed_hz = 13000000,
.bus_num = 2,
.irq = IRQ_GPIO(116),
.chip_select = 0,
.controller_data = &em_x270_libertas_chip,
.platform_data = &em_x270_libertas_pdata,
},
};

static void __init em_x270_init_spi(void)
{
pxa2xx_set_spi_info(1, &em_x270_spi_info);
pxa2xx_set_spi_info(2, &em_x270_spi_2_info);
spi_register_board_info(ARRAY_AND_SIZE(em_x270_spi_devices));
}
#else
Expand Down

0 comments on commit 61d1d0d

Please sign in to comment.