Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c2de1c38 authored by Marc Zyngier's avatar Marc Zyngier Committed by Eric Miao
Browse files

[ARM] pxa/zeus: make Viper pcmcia support more generic to support Zeus



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: default avatarMarc Zyngier <maz@misterjones.org>
Signed-off-by: default avatarEric Miao <eric.y.miao@gmail.com>
parent e491a11c
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -63,6 +63,7 @@ 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"
@@ -70,6 +71,7 @@ config MACH_ARCOM_ZEUS
	select ISA
	select PXA_HAVE_BOARD_IRQS
	select PXA_HAVE_ISA_IRQS
	select ARCOM_PCMCIA

config MACH_BALLOON3
	bool "Balloon 3 board"
@@ -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
+11 −0
Original line number Diff line number Diff line
#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
+0 −2
Original line number Diff line number Diff line
@@ -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)
+18 −2
Original line number Diff line number Diff line
@@ -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>
@@ -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
@@ -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 = {
+29 −0
Original line number Diff line number Diff line
@@ -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"
@@ -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],
@@ -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 */
Loading