Skip to content

Commit

Permalink
[ARM] pxa/zeus: make Viper pcmcia support more generic to support Zeus
Browse files Browse the repository at this point in the history
The Arcom Zeus CF slot requires the same kind of support as the Viper.
To avoid code duplication, introduce a platform device that abstracts
the differences.

This also allows for the removal of the ugly export of viper_cf_rst().

Signed-off-by: Marc Zyngier <maz@misterjones.org>
Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
  • Loading branch information
Marc Zyngier authored and Eric Miao committed Dec 13, 2009
1 parent e491a11 commit c2de1c3
Show file tree
Hide file tree
Showing 9 changed files with 155 additions and 40 deletions.
7 changes: 7 additions & 0 deletions arch/arm/mach-pxa/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,15 @@ config ARCH_VIPER
select HAVE_PWM
select PXA_HAVE_BOARD_IRQS
select PXA_HAVE_ISA_IRQS
select ARCOM_PCMCIA

config MACH_ARCOM_ZEUS
bool "Arcom/Eurotech ZEUS SBC"
select PXA27x
select ISA
select PXA_HAVE_BOARD_IRQS
select PXA_HAVE_ISA_IRQS
select ARCOM_PCMCIA

config MACH_BALLOON3
bool "Balloon 3 board"
Expand Down Expand Up @@ -186,6 +188,11 @@ config MACH_TRIZEPS_ANY

endchoice

config ARCOM_PCMCIA
bool
help
Generic option for Arcom Viper/Zeus PCMCIA

config TRIZEPS_PCMCIA
bool
help
Expand Down
11 changes: 11 additions & 0 deletions arch/arm/mach-pxa/include/mach/arcom-pcmcia.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#ifndef __ARCOM_PCMCIA_H
#define __ARCOM_PCMCIA_H

struct arcom_pcmcia_pdata {
int cd_gpio;
int rdy_gpio;
int pwr_gpio;
void (*reset)(int state);
};

#endif
2 changes: 0 additions & 2 deletions arch/arm/mach-pxa/include/mach/viper.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@
/* Interrupt and Configuration Register (VIPER_ICR) */
/* This is a write only register. Only CF_RST is used under Linux */

extern void viper_cf_rst(int state);

#define VIPER_ICR_RETRIG (1 << 0)
#define VIPER_ICR_AUTO_CLR (1 << 1)
#define VIPER_ICR_R_DIS (1 << 2)
Expand Down
20 changes: 18 additions & 2 deletions arch/arm/mach-pxa/viper.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
#include <mach/pxafb.h>
#include <plat/i2c.h>
#include <mach/regs-uart.h>
#include <mach/arcom-pcmcia.h>
#include <mach/viper.h>

#include <asm/setup.h>
Expand Down Expand Up @@ -76,14 +77,28 @@ static void viper_icr_clear_bit(unsigned int bit)
}

/* This function is used from the pcmcia module to reset the CF */
void viper_cf_rst(int state)
static void viper_cf_reset(int state)
{
if (state)
viper_icr_set_bit(VIPER_ICR_CF_RST);
else
viper_icr_clear_bit(VIPER_ICR_CF_RST);
}
EXPORT_SYMBOL(viper_cf_rst);

static struct arcom_pcmcia_pdata viper_pcmcia_info = {
.cd_gpio = VIPER_CF_CD_GPIO,
.rdy_gpio = VIPER_CF_RDY_GPIO,
.pwr_gpio = VIPER_CF_POWER_GPIO,
.reset = viper_cf_reset,
};

static struct platform_device viper_pcmcia_device = {
.name = "viper-pcmcia",
.id = -1,
.dev = {
.platform_data = &viper_pcmcia_info,
},
};

/*
* The CPLD version register was not present on VIPER boards prior to
Expand Down Expand Up @@ -685,6 +700,7 @@ static struct platform_device *viper_devs[] __initdata = {
&viper_mtd_devices[0],
&viper_mtd_devices[1],
&viper_backlight_device,
&viper_pcmcia_device,
};

static mfp_cfg_t viper_pin_config[] __initdata = {
Expand Down
29 changes: 29 additions & 0 deletions arch/arm/mach-pxa/zeus.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include <mach/mfp-pxa27x.h>
#include <mach/pm.h>
#include <mach/audio.h>
#include <mach/arcom-pcmcia.h>
#include <mach/zeus.h>

#include "generic.h"
Expand Down Expand Up @@ -428,6 +429,33 @@ static struct platform_device zeus_leds_device = {
},
};

static void zeus_cf_reset(int state)
{
u16 cpld_state = __raw_readw(ZEUS_CPLD_CONTROL);

if (state)
cpld_state |= ZEUS_CPLD_CONTROL_CF_RST;
else
cpld_state &= ~ZEUS_CPLD_CONTROL_CF_RST;

__raw_writew(cpld_state, ZEUS_CPLD_CONTROL);
}

static struct arcom_pcmcia_pdata zeus_pcmcia_info = {
.cd_gpio = ZEUS_CF_CD_GPIO,
.rdy_gpio = ZEUS_CF_RDY_GPIO,
.pwr_gpio = ZEUS_CF_PWEN_GPIO,
.reset = zeus_cf_reset,
};

static struct platform_device zeus_pcmcia_device = {
.name = "zeus-pcmcia",
.id = -1,
.dev = {
.platform_data = &zeus_pcmcia_info,
},
};

static struct platform_device *zeus_devices[] __initdata = {
&zeus_serial_device,
&zeus_mtd_devices[0],
Expand All @@ -436,6 +464,7 @@ static struct platform_device *zeus_devices[] __initdata = {
&zeus_sram_device,
&pxa2xx_spi_ssp3_device,
&zeus_leds_device,
&zeus_pcmcia_device,
};

/* AC'97 */
Expand Down
2 changes: 1 addition & 1 deletion drivers/pcmcia/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ config PCMCIA_PXA2XX
depends on ARM && ARCH_PXA && PCMCIA
depends on (ARCH_LUBBOCK || MACH_MAINSTONE || PXA_SHARPSL \
|| MACH_ARMCORE || ARCH_PXA_PALM || TRIZEPS_PCMCIA \
|| ARCH_VIPER || ARCH_PXA_ESERIES || MACH_STARGATE2)
|| ARCOM_PCMCIA || ARCH_PXA_ESERIES || MACH_STARGATE2)
select PCMCIA_SOC_COMMON
help
Say Y here to include support for the PXA2xx PCMCIA controller
Expand Down
2 changes: 1 addition & 1 deletion drivers/pcmcia/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ pxa2xx-obj-$(CONFIG_ARCH_LUBBOCK) += pxa2xx_lubbock_cs.o
pxa2xx-obj-$(CONFIG_MACH_MAINSTONE) += pxa2xx_mainstone.o
pxa2xx-obj-$(CONFIG_PXA_SHARPSL) += pxa2xx_sharpsl.o
pxa2xx-obj-$(CONFIG_MACH_ARMCORE) += pxa2xx_cm_x2xx_cs.o
pxa2xx-obj-$(CONFIG_ARCH_VIPER) += pxa2xx_viper.o
pxa2xx-obj-$(CONFIG_ARCOM_PCMCIA) += pxa2xx_viper.o
pxa2xx-obj-$(CONFIG_TRIZEPS_PCMCIA) += pxa2xx_trizeps4.o
pxa2xx-obj-$(CONFIG_MACH_PALMTX) += pxa2xx_palmtx.o
pxa2xx-obj-$(CONFIG_MACH_PALMTC) += pxa2xx_palmtc.o
Expand Down
3 changes: 2 additions & 1 deletion drivers/pcmcia/pxa2xx_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@ static void pxa2xx_configure_sockets(struct device *dev)
MECR |= MECR_CIT;

/* Set MECR:NOS (Number Of Sockets) */
if ((ops->first + ops->nr) > 1 || machine_is_viper())
if ((ops->first + ops->nr) > 1 ||
machine_is_viper() || machine_is_arcom_zeus())
MECR |= MECR_NOS;
else
MECR &= ~MECR_NOS;
Expand Down
Loading

0 comments on commit c2de1c3

Please sign in to comment.