Commit d4d07e46 authored by Nicolas Pitre's avatar Nicolas Pitre Committed by Russell King

[ARM PATCH] 1828/2: rework SA11xx PCMCIA code structure for better sharing of generic

 code

Patch from Nicolas Pitre

[Updated after comments on patch #1828/1]

This patch moves things around and rename a few files/functions/structures
to be shared with PXA2xx PCMCIA support (coming in a separate patch) and
maybe others SOCs. No functional change were made so SA11xx users
shouldn't see any difference.
parent 3d29f7cb
......@@ -19,6 +19,8 @@ obj-$(CONFIG_PCMCIA_SA1111) += sa11xx_core.o sa1111_cs.o
pcmcia_core-y += cistpl.o rsrc_mgr.o bulkmem.o cs.o
pcmcia_core-$(CONFIG_CARDBUS) += cardbus.o
sa11xx_core-y += soc_common.o sa11xx_base.o
sa1111_cs-y += sa1111_generic.o
sa1111_cs-$(CONFIG_SA1100_ADSBITSY) += sa1100_adsbitsy.o
sa1111_cs-$(CONFIG_ASSABET_NEPONSET) += sa1100_neponset.o
......
......@@ -20,7 +20,7 @@
#include "sa1111_generic.h"
static int adsbitsy_pcmcia_hw_init(struct sa1100_pcmcia_socket *skt)
static int adsbitsy_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
{
/* Set GPIO_A<3:0> to be outputs for PCMCIA/CF power controller: */
PA_DDR &= ~(GPIO_GPIO0 | GPIO_GPIO1 | GPIO_GPIO2 | GPIO_GPIO3);
......@@ -35,7 +35,7 @@ static int adsbitsy_pcmcia_hw_init(struct sa1100_pcmcia_socket *skt)
}
static int
adsbitsy_pcmcia_configure_socket(struct sa1100_pcmcia_socket *skt, const socket_state_t *state)
adsbitsy_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_t *state)
{
unsigned int pa_dwr_mask, pa_dwr_set;
int ret;
......
......@@ -25,23 +25,23 @@ static struct pcmcia_irqs irqs[] = {
{ 1, ASSABET_IRQ_GPIO_CF_BVD1, "CF BVD1" },
};
static int assabet_pcmcia_hw_init(struct sa1100_pcmcia_socket *skt)
static int assabet_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
{
skt->irq = ASSABET_IRQ_GPIO_CF_IRQ;
return sa11xx_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
}
/*
* Release all resources.
*/
static void assabet_pcmcia_hw_shutdown(struct sa1100_pcmcia_socket *skt)
static void assabet_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
{
sa11xx_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
}
static void
assabet_pcmcia_socket_state(struct sa1100_pcmcia_socket *skt, struct pcmcia_state *state)
assabet_pcmcia_socket_state(struct soc_pcmcia_socket *skt, struct pcmcia_state *state)
{
unsigned long levels = GPLR;
......@@ -55,7 +55,7 @@ assabet_pcmcia_socket_state(struct sa1100_pcmcia_socket *skt, struct pcmcia_stat
}
static int
assabet_pcmcia_configure_socket(struct sa1100_pcmcia_socket *skt, const socket_state_t *state)
assabet_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_t *state)
{
unsigned int mask;
......@@ -93,22 +93,22 @@ assabet_pcmcia_configure_socket(struct sa1100_pcmcia_socket *skt, const socket_s
* be called at initialisation, power management event, or
* pcmcia event.
*/
static void assabet_pcmcia_socket_init(struct sa1100_pcmcia_socket *skt)
static void assabet_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
{
/*
* Enable CF bus
*/
ASSABET_BCR_clear(ASSABET_BCR_CF_BUS_OFF);
sa11xx_enable_irqs(skt, irqs, ARRAY_SIZE(irqs));
soc_pcmcia_enable_irqs(skt, irqs, ARRAY_SIZE(irqs));
}
/*
* Disable card status IRQs on suspend.
*/
static void assabet_pcmcia_socket_suspend(struct sa1100_pcmcia_socket *skt)
static void assabet_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
{
sa11xx_disable_irqs(skt, irqs, ARRAY_SIZE(irqs));
soc_pcmcia_disable_irqs(skt, irqs, ARRAY_SIZE(irqs));
/*
* Tristate the CF bus signals. Also assert CF
......
......@@ -75,7 +75,7 @@ static void complain_about_jumpering(const char *whom,
}
static int
badge4_pcmcia_configure_socket(struct sa1100_pcmcia_socket *skt, const socket_state_t *state)
badge4_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_t *state)
{
int ret;
......
......@@ -27,20 +27,20 @@ static struct pcmcia_irqs irqs[] = {
{ CERF_SOCKET, CERF_IRQ_GPIO_CF_BVD1, "CF_BVD1" }
};
static int cerf_pcmcia_hw_init(struct sa1100_pcmcia_socket *skt)
static int cerf_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
{
skt->irq = CERF_IRQ_GPIO_CF_IRQ;
return sa11xx_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
}
static void cerf_pcmcia_hw_shutdown(struct sa1100_pcmcia_socket *skt)
static void cerf_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
{
sa11xx_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
}
static void
cerf_pcmcia_socket_state(struct sa1100_pcmcia_socket *skt, struct pcmcia_state *state)
cerf_pcmcia_socket_state(struct soc_pcmcia_socket *skt, struct pcmcia_state *state)
{
unsigned long levels = GPLR;
......@@ -54,7 +54,7 @@ cerf_pcmcia_socket_state(struct sa1100_pcmcia_socket *skt, struct pcmcia_state *
}
static int
cerf_pcmcia_configure_socket(struct sa1100_pcmcia_socket *skt,
cerf_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
const socket_state_t *state)
{
switch (state->Vcc) {
......@@ -78,14 +78,14 @@ cerf_pcmcia_configure_socket(struct sa1100_pcmcia_socket *skt,
return 0;
}
static void cerf_pcmcia_socket_init(struct sa1100_pcmcia_socket *skt)
static void cerf_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
{
sa11xx_enable_irqs(skt, irqs, ARRAY_SIZE(irqs));
soc_pcmcia_enable_irqs(skt, irqs, ARRAY_SIZE(irqs));
}
static void cerf_pcmcia_socket_suspend(struct sa1100_pcmcia_socket *skt)
static void cerf_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
{
sa11xx_disable_irqs(skt, irqs, ARRAY_SIZE(irqs));
soc_pcmcia_disable_irqs(skt, irqs, ARRAY_SIZE(irqs));
}
static struct pcmcia_low_level cerf_pcmcia_ops = {
......
......@@ -28,20 +28,20 @@ static struct pcmcia_irqs irqs[] = {
*
* Called by sa1100_pcmcia_driver_init on startup.
*/
static int flexanet_pcmcia_hw_init(struct sa1100_pcmcia_socket *skt)
static int flexanet_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
{
skt->irq = skt->nr ? IRQ_GPIO_CF2_IRQ : IRQ_GPIO_CF1_IRQ;
return sa11xx_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
}
/*
* Socket shutdown
*/
static void flexanet_pcmcia_hw_shutdown(struct sa1100_pcmcia_socket *skt)
static void flexanet_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
{
sa11xx_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
}
......@@ -52,7 +52,7 @@ static void flexanet_pcmcia_hw_shutdown(struct sa1100_pcmcia_socket *skt)
*
*/
static void
flexanet_pcmcia_socket_state(struct sa1100_pcmcia_socket *skt,
flexanet_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
struct pcmcia_state *state)
{
unsigned long levels = GPLR; /* Sense the GPIOs, asynchronously */
......@@ -85,7 +85,7 @@ flexanet_pcmcia_socket_state(struct sa1100_pcmcia_socket *skt,
*
*/
static int
flexanet_pcmcia_configure_socket(struct sa1100_pcmcia_socket *skt,
flexanet_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
const socket_state_t *state)
{
unsigned long value, flags, mask;
......@@ -133,14 +133,14 @@ flexanet_pcmcia_configure_socket(struct sa1100_pcmcia_socket *skt,
return 0;
}
static void flexanet_pcmcia_socket_init(struct sa1100_pcmcia_socket *skt)
static void flexanet_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
{
sa11xx_enable_irqs(skt, irqs, ARRAY_SIZE(irqs));
soc_pcmcia_enable_irqs(skt, irqs, ARRAY_SIZE(irqs));
}
static void flexanet_pcmcia_socket_suspend(struct sa1100_pcmcia_socket *skt)
static void flexanet_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
{
sa11xx_disable_irqs(skt, irqs, ARRAY_SIZE(irqs));
soc_pcmcia_disable_irqs(skt, irqs, ARRAY_SIZE(irqs));
}
/*
......
......@@ -20,7 +20,7 @@ static struct pcmcia_irqs irqs[] = {
{ 0, IRQ_GPIO_FREEBIRD_CF_BVD, "CF_BVD1" },
};
static int freebird_pcmcia_init(struct sa1100_pcmcia_socket *skt)
static int freebird_pcmcia_init(struct soc_pcmcia_socket *skt)
{
/* Enable Linkup CF card */
LINKUP_PRC = 0xc0;
......@@ -35,12 +35,12 @@ static int freebird_pcmcia_init(struct sa1100_pcmcia_socket *skt)
skt->irq = IRQ_GPIO_FREEBIRD_CF_IRQ;
return sa11xx_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
}
static void freebird_pcmcia_shutdown(struct sa1100_pcmcia_socket *skt)
static void freebird_pcmcia_shutdown(struct soc_pcmcia_socket *skt)
{
sa11xx_free_irqs(skt, irqs, ARRAY_SIZE(irqs);
soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs);
/* Disable CF card */
LINKUP_PRC = 0x40; /* SSP=1 SOE=0 */
......@@ -48,7 +48,7 @@ static void freebird_pcmcia_shutdown(struct sa1100_pcmcia_socket *skt)
}
static void
freebird_pcmcia_socket_state(struct sa1100_pcmcia_socket *skt, struct pcmcia_state *state)
freebird_pcmcia_socket_state(struct soc_pcmcia_socket *skt, struct pcmcia_state *state)
{
unsigned long levels = LINKUP_PRS;
// printk("LINKUP_PRS=%x\n",levels);
......@@ -63,7 +63,7 @@ freebird_pcmcia_socket_state(struct sa1100_pcmcia_socket *skt, struct pcmcia_sta
}
static int
freebird_pcmcia_configure_socket(struct sa1100_pcmcia_socket *skt,
freebird_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
socket_state_t *state)
{
unsigned long value, flags;
......@@ -103,14 +103,14 @@ freebird_pcmcia_configure_socket(struct sa1100_pcmcia_socket *skt,
return 0;
}
static void freebird_pcmcia_socket_init(struct sa1100_pcmcia_socket *skt)
static void freebird_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
{
sa11xx_disable_irqs(skt, irqs, ARRAY_SIZE(irqs));
soc_pcmcia_disable_irqs(skt, irqs, ARRAY_SIZE(irqs));
}
static void freebird_pcmcia_socket_suspend(struct sa1100_pcmcia_socket *skt)
static void freebird_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
{
sa11xx_enable_irqs(skt, irqs, ARRAY_SIZE(irqs));
soc_pcmcia_enable_irqs(skt, irqs, ARRAY_SIZE(irqs));
}
static struct pcmcia_low_level freebird_pcmcia_ops = {
......
......@@ -43,7 +43,7 @@
#include <pcmcia/cs.h>
#include <pcmcia/ss.h>
#include "sa1100.h"
#include "sa1100_generic.h"
static int (*sa11x0_pcmcia_hw_init[])(struct device *dev) = {
#ifdef CONFIG_SA1100_ASSABET
......@@ -118,7 +118,7 @@ static int sa11x0_drv_pcmcia_resume(struct device *dev, u32 level)
static struct device_driver sa11x0_pcmcia_driver = {
.probe = sa11x0_drv_pcmcia_probe,
.remove = sa11xx_drv_pcmcia_remove,
.remove = soc_common_drv_pcmcia_remove,
.name = "sa11x0-pcmcia",
.bus = &platform_bus_type,
.suspend = sa11x0_drv_pcmcia_suspend,
......
#include "sa11xx_core.h"
#include "soc_common.h"
#include "sa11xx_base.h"
/*
* Declaration for all machine specific init/exit functions.
......
......@@ -38,7 +38,7 @@ static struct pcmcia_irqs irqs[] = {
{ 0, S0_CD_IRQ, "PCMCIA 0 CD" },
};
static int gcplus_pcmcia_init(struct sa1100_pcmcia_socket *skt)
static int gcplus_pcmcia_init(struct soc_pcmcia_socket *skt)
{
// Reset PCMCIA
// Reset Timing for CPLD(U2) version 8001E or later
......@@ -54,10 +54,10 @@ static int gcplus_pcmcia_init(struct sa1100_pcmcia_socket *skt)
skt->irq = S0_STS_IRQ;
/* Register interrupts */
return sa11xx_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
}
static void gcplus_pcmcia_hw_shutdown(struct sa1100_pcmcia_socket *skt)
static void gcplus_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
{
/* disable IRQs */
free_irq(S0_CD_IRQ, skt);
......@@ -68,7 +68,7 @@ static void gcplus_pcmcia_hw_shutdown(struct sa1100_pcmcia_socket *skt)
}
static void
gcplus_pcmcia_socket_state(struct sa1100_pcmcia_socket *skt, struct pcmcia_state *state)
gcplus_pcmcia_socket_state(struct soc_pcmcia_socket *skt, struct pcmcia_state *state)
{
unsigned long levels = *PCMCIA_Status;
......@@ -82,7 +82,7 @@ gcplus_pcmcia_socket_state(struct sa1100_pcmcia_socket *skt, struct pcmcia_state
}
static int
gcplus_pcmcia_configure_socket(struct sa1100_pcmcia_socket *skt,
gcplus_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
const socket_state_t *state)
{
unsigned long flags;
......@@ -125,11 +125,11 @@ gcplus_pcmcia_configure_socket(struct sa1100_pcmcia_socket *skt,
return 0;
}
static void gcplus_pcmcia_socket_init(struct sa1100_pcmcia_socket *skt)
static void gcplus_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
{
}
static void gcplus_pcmcia_socket_suspend(struct sa1100_pcmcia_socket *skt)
static void gcplus_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
{
}
......
......@@ -19,7 +19,7 @@
#include "sa1111_generic.h"
static int graphicsmaster_pcmcia_hw_init(struct sa1100_pcmcia_socket *skt)
static int graphicsmaster_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
{
int return_val=0;
......@@ -36,7 +36,7 @@ static int graphicsmaster_pcmcia_hw_init(struct sa1100_pcmcia_socket *skt)
}
static int
graphicsmaster_pcmcia_configure_socket(struct sa1100_pcmcia_socket *skt,
graphicsmaster_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
const socket_state_t *state)
{
unsigned int pa_dwr_mask, pa_dwr_set;
......
......@@ -23,18 +23,18 @@ static struct pcmcia_irqs irqs[] = {
{ 1, IRQ_GPIO_H3600_PCMCIA_CD1, "PCMCIA CD1" }
};
static int h3600_pcmcia_hw_init(struct sa1100_pcmcia_socket *skt)
static int h3600_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
{
skt->irq = skt->nr ? IRQ_GPIO_H3600_PCMCIA_IRQ1
: IRQ_GPIO_H3600_PCMCIA_IRQ0;
return sa11xx_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
}
static void h3600_pcmcia_hw_shutdown(struct sa1100_pcmcia_socket *skt)
static void h3600_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
{
sa11xx_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
/* Disable CF bus: */
clr_h3600_egpio(IPAQ_EGPIO_OPT_NVRAM_ON);
......@@ -43,7 +43,7 @@ static void h3600_pcmcia_hw_shutdown(struct sa1100_pcmcia_socket *skt)
}
static void
h3600_pcmcia_socket_state(struct sa1100_pcmcia_socket *skt, struct pcmcia_state *state)
h3600_pcmcia_socket_state(struct soc_pcmcia_socket *skt, struct pcmcia_state *state)
{
unsigned long levels = GPLR;
......@@ -71,7 +71,7 @@ h3600_pcmcia_socket_state(struct sa1100_pcmcia_socket *skt, struct pcmcia_state
}
static int
h3600_pcmcia_configure_socket(struct sa1100_pcmcia_socket *skt, const socket_state_t *state)
h3600_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_t *state)
{
if (state->Vcc != 0 && state->Vcc != 33 && state->Vcc != 50) {
printk(KERN_ERR "h3600_pcmcia: unrecognized Vcc %u.%uV\n",
......@@ -89,7 +89,7 @@ h3600_pcmcia_configure_socket(struct sa1100_pcmcia_socket *skt, const socket_sta
return 0;
}
static void h3600_pcmcia_socket_init(struct sa1100_pcmcia_socket *skt)
static void h3600_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
{
/* Enable CF bus: */
set_h3600_egpio(IPAQ_EGPIO_OPT_NVRAM_ON);
......@@ -99,12 +99,12 @@ static void h3600_pcmcia_socket_init(struct sa1100_pcmcia_socket *skt)
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(10*HZ / 1000);
sa11xx_enable_irqs(skt, irqs, ARRAY_SIZE(irqs));
soc_pcmcia_enable_irqs(skt, irqs, ARRAY_SIZE(irqs));
}
static void h3600_pcmcia_socket_suspend(struct sa1100_pcmcia_socket *skt)
static void h3600_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
{
sa11xx_disable_irqs(skt, irqs, ARRAY_SIZE(irqs));
soc_pcmcia_disable_irqs(skt, irqs, ARRAY_SIZE(irqs));
/*
* FIXME: This doesn't fit well. We don't have the mechanism in
......
......@@ -23,7 +23,7 @@
#warning *** Does SOCKET1_3V actually do anything?
#define SOCKET1_3V GPIO_GPIO3
static int jornada720_pcmcia_hw_init(struct sa1100_pcmcia_socket *skt)
static int jornada720_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
{
/*
* What is all this crap for?
......@@ -49,7 +49,7 @@ static int jornada720_pcmcia_hw_init(struct sa1100_pcmcia_socket *skt)
}
static int
jornada720_pcmcia_configure_socket(struct sa1100_pcmcia_socket *skt, const socket_state_t *state)
jornada720_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_t *state)
{
unsigned int pa_dwr_mask, pa_dwr_set;
int ret;
......
......@@ -42,7 +42,7 @@
*/
static int
neponset_pcmcia_configure_socket(struct sa1100_pcmcia_socket *skt, const socket_state_t *state)
neponset_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_t *state)
{
unsigned int ncr_mask, ncr_set, pa_dwr_mask, pa_dwr_set;
int ret;
......@@ -106,7 +106,7 @@ neponset_pcmcia_configure_socket(struct sa1100_pcmcia_socket *skt, const socket_
return 0;
}
static void neponset_pcmcia_socket_init(struct sa1100_pcmcia_socket *skt)
static void neponset_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
{
if (skt->nr == 0)
NCR_0 &= ~(NCR_A0VPP | NCR_A1VPP);
......
......@@ -26,7 +26,7 @@ static struct pcmcia_irqs irqs[] = {
{ PANGOLIN_SOCK, IRQ_PCMCIA_CD, "PCMCIA CD" },
};
static int pangolin_pcmcia_hw_init(struct sa1100_pcmcia_socket *skt)
static int pangolin_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
{
int res;
......@@ -37,12 +37,12 @@ static int pangolin_pcmcia_hw_init(struct sa1100_pcmcia_socket *skt)
skt->irq = IRQ_PCMCIA_IRQ;
return sa11xx_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
}
static void pangolin_pcmcia_hw_shutdown(struct sa1100_pcmcia_socket *skt)
static void pangolin_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
{
sa11xx_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
#ifndef CONFIG_SA1100_PANGOLIN_PCMCIA_IDE
/* Disable PCMCIA bus: */
......@@ -51,7 +51,7 @@ static void pangolin_pcmcia_hw_shutdown(struct sa1100_pcmcia_socket *skt)
}
static void
pangolin_pcmcia_socket_state(struct sa1100_pcmcia_socket *skt,
pangolin_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
struct pcmcia_state *state)
{
unsigned long levels = GPLR;
......@@ -66,7 +66,7 @@ pangolin_pcmcia_socket_state(struct sa1100_pcmcia_socket *skt,
}
static int
pangolin_pcmcia_configure_socket(struct sa1100_pcmcia_socket *skt,
pangolin_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
const socket_state_t *state)
{
unsigned long value, flags;
......@@ -115,14 +115,14 @@ pangolin_pcmcia_configure_socket(struct sa1100_pcmcia_socket *skt,
return 0;
}
static void pangolin_pcmcia_socket_init(struct sa1100_pcmcia_socket *skt)
static void pangolin_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
{
sa11xx_enable_irqs(skt, irqs, ARRAY_SIZE(irqs));
soc_pcmcia_enable_irqs(skt, irqs, ARRAY_SIZE(irqs));
}
static void pangolin_pcmcia_socket_suspend(struct sa1100_pcmcia_socket *skt)
static void pangolin_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
{
sa11xx_disable_irqs(skt, irqs, ARRAY_SIZE(irqs));
soc_pcmcia_disable_irqs(skt, irqs, ARRAY_SIZE(irqs));
}
static struct pcmcia_low_level pangolin_pcmcia_ops = {
......
......@@ -18,7 +18,7 @@
#include "sa1111_generic.h"
static int pfs168_pcmcia_init(struct sa1100_pcmcia_socket *skt)
static int pfs168_pcmcia_init(struct soc_pcmcia_socket *skt)
{
/* TPS2211 to standby mode: */
PA_DWR &= ~(GPIO_GPIO0 | GPIO_GPIO1 | GPIO_GPIO2 | GPIO_GPIO3);
......@@ -30,7 +30,7 @@ static int pfs168_pcmcia_init(struct sa1100_pcmcia_socket *skt)
}
static int
pfs168_pcmcia_configure_socket(struct sa1100_pcmcia_socket *skt,
pfs168_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
const socket_state_t *state)
{
unsigned int pa_dwr_mask = 0, pa_dwr_set = 0;
......
......@@ -21,7 +21,7 @@ static struct pcmcia_irqs irqs[] = {
{ 1, SHANNON_IRQ_GPIO_EJECT_1, "PCMCIA_CD_1" },
};
static int shannon_pcmcia_hw_init(struct sa1100_pcmcia_socket *skt)
static int shannon_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
{
/* All those are inputs */
GPDR &= ~(SHANNON_GPIO_EJECT_0 | SHANNON_GPIO_EJECT_1 |
......@@ -31,16 +31,16 @@ static int shannon_pcmcia_hw_init(struct sa1100_pcmcia_socket *skt)
skt->irq = skt->nr ? SHANNON_IRQ_GPIO_RDY_1 : SHANNON_IRQ_GPIO_RDY_0;
return sa11xx_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
}
static void shannon_pcmcia_hw_shutdown(struct sa1100_pcmcia_socket *skt)
static void shannon_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
{
sa11xx_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
}
static void
shannon_pcmcia_socket_state(struct sa1100_pcmcia_socket *skt,
shannon_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
struct pcmcia_state *state)
{
unsigned long levels = GPLR;
......@@ -69,7 +69,7 @@ shannon_pcmcia_socket_state(struct sa1100_pcmcia_socket *skt,
}
static int
shannon_pcmcia_configure_socket(struct sa1100_pcmcia_socket *skt,
shannon_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
const socket_state_t *state)
{
switch (state->Vcc) {
......@@ -93,14 +93,14 @@ shannon_pcmcia_configure_socket(struct sa1100_pcmcia_socket *skt,
return 0;
}
static void shannon_pcmcia_socket_init(struct sa1100_pcmcia_socket *skt)
static void shannon_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
{
sa11xx_enable_irqs(skt, irqs, ARRAY_SIZE(irqs));
soc_pcmcia_enable_irqs(skt, irqs, ARRAY_SIZE(irqs));
}
static void shannon_pcmcia_socket_suspend(struct sa1100_pcmcia_socket *skt)
static void shannon_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
{
sa11xx_disable_irqs(skt, irqs, ARRAY_SIZE(irqs));
soc_pcmcia_disable_irqs(skt, irqs, ARRAY_SIZE(irqs));
}
static struct pcmcia_low_level shannon_pcmcia_ops = {
......
......@@ -24,19 +24,19 @@ static struct pcmcia_irqs irqs[] = {
{ 1, IRQ_GPIO_CF_CD, "CF_CD" },
};
static int simpad_pcmcia_hw_init(struct sa1100_pcmcia_socket *skt)
static int simpad_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
{
clear_cs3_bit(VCC_3V_EN|VCC_5V_EN|EN0|EN1);
skt->irq = IRQ_GPIO_CF_IRQ;
return sa11xx_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
}
static void simpad_pcmcia_hw_shutdown(struct sa1100_pcmcia_socket *skt)
static void simpad_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
{
sa11xx_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
/* Disable CF bus: */
//set_cs3_bit(PCMCIA_BUFF_DIS);
......@@ -44,7 +44,7 @@ static void simpad_pcmcia_hw_shutdown(struct sa1100_pcmcia_socket *skt)
}
static void
simpad_pcmcia_socket_state(struct sa1100_pcmcia_socket *skt,
simpad_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
struct pcmcia_state *state)
{
unsigned long levels = GPLR;
......@@ -66,7 +66,7 @@ simpad_pcmcia_socket_state(struct sa1100_pcmcia_socket *skt,
}
static int
simpad_pcmcia_configure_socket(struct sa1100_pcmcia_socket *skt,
simpad_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
const socket_state_t *state)
{
unsigned long flags;
......@@ -103,14 +103,14 @@ simpad_pcmcia_configure_socket(struct sa1100_pcmcia_socket *skt,
return 0;
}
static void simpad_pcmcia_socket_init(struct sa1100_pcmcia_socket *skt)
static void simpad_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
{
sa11xx_enable_irqs(skt, irqs, ARRAY_SIZE(irqs));
soc_pcmcia_enable_irqs(skt, irqs, ARRAY_SIZE(irqs));
}
static void simpad_pcmcia_socket_suspend(struct sa1100_pcmcia_socket *skt)
static void simpad_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
{
sa11xx_disable_irqs(skt, irqs, ARRAY_SIZE(irqs));
soc_pcmcia_disable_irqs(skt, irqs, ARRAY_SIZE(irqs));
set_cs3_bit(PCMCIA_RESET);
}
......
......@@ -36,24 +36,24 @@ static struct pcmcia_irqs irqs[] = {
{ 1, IRQ_GPIO_STORK_PCMCIA_B_CARD_DETECT, "PCMCIA_CD1" },
};
static int stork_pcmcia_hw_init(struct sa1100_pcmcia_socket *skt)
static int stork_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
{
printk("in stork_pcmcia_init\n");
skt->irq = skt->nr ? IRQ_GPIO_STORK_PCMCIA_B_RDY
: IRQ_GPIO_STORK_PCMCIA_A_RDY;
return sa11xx_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
}
static void stork_pcmcia_hw_shutdown(struct sa1100_pcmcia_socket *skt)
static void stork_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
{
int i;
printk("%s\n", __FUNCTION__);
/* disable IRQs */
sa11xx_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
/* Disable CF bus: */
storkClearLatchA(STORK_PCMCIA_PULL_UPS_POWER_ON);
......@@ -62,7 +62,7 @@ static void stork_pcmcia_hw_shutdown(struct sa1100_pcmcia_socket *skt)
}
static void
stork_pcmcia_socket_state(struct sa1100_pcmcia_socket *skt,
stork_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
struct pcmcia_state *state)
{
unsigned long levels = GPLR;
......@@ -95,7 +95,7 @@ stork_pcmcia_socket_state(struct sa1100_pcmcia_socket *skt,
}
static int
stork_pcmcia_configure_socket(struct sa1100_pcmcia_socket *skt,
stork_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
const socket_state_t *state)
{
unsigned long flags;
......@@ -156,16 +156,16 @@ stork_pcmcia_configure_socket(struct sa1100_pcmcia_socket *skt,
return 0;
}
static void stork_pcmcia_socket_init(struct sa1100_pcmcia_socket *skt)
static void stork_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
{
storkSetLatchA(STORK_PCMCIA_PULL_UPS_POWER_ON);
sa11xx_enable_irqs(skt, irqs, ARRAY_SIZE(irqs));
soc_pcmcia_enable_irqs(skt, irqs, ARRAY_SIZE(irqs));
}
static void stork_pcmcia_socket_suspend(struct sa1100_pcmcia_socket *skt)
static void stork_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
{
sa11xx_disable_irqs(skt, irqs, ARRAY_SIZE(irqs));
soc_pcmcia_disable_irqs(skt, irqs, ARRAY_SIZE(irqs));
/*
* Hack!
......
......@@ -47,7 +47,7 @@
# define DPRINTK( x, args... ) /* nix */
#endif
static int system3_pcmcia_hw_init(struct sa1100_pcmcia_socket *skt)
static int system3_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
{
skt->irq = skt->nr ? IRQ_S1_READY_NINT : IRQ_S0_READY_NINT;
......@@ -55,12 +55,12 @@ static int system3_pcmcia_hw_init(struct sa1100_pcmcia_socket *skt)
return 0;
}
void system3_pcmcia_hw_shutdown(struct sa1100_pcmcia_socket *skt)
void system3_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
{
}
static void
system3_pcmcia_socket_state(struct sa1100_pcmcia_socket *skt, struct pcmcia_state *state)
system3_pcmcia_socket_state(struct soc_pcmcia_socket *skt, struct pcmcia_state *state)
{
unsigned long status = PCSR;
......
......@@ -32,7 +32,7 @@ static struct pcmcia_irqs irqs[] = {
*
*
******************************************************/
static int trizeps_pcmcia_init(struct sa1100_pcmcia_socket *skt)
static int trizeps_pcmcia_init(struct soc_pcmcia_socket *skt)
{
skt->irq = TRIZEPS_IRQ_PCMCIA_IRQ0;
......@@ -43,18 +43,18 @@ static int trizeps_pcmcia_init(struct sa1100_pcmcia_socket *skt)
GPDR &= ~((GPIO_GPIO(TRIZEPS_GPIO_PCMCIA_CD0))
| (GPIO_GPIO(TRIZEPS_GPIO_PCMCIA_IRQ0)));
return sa11xx_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
}
/**
*
*
******************************************************/
static void trizeps_pcmcia_shutdown(struct sa1100_pcmcia_socket *skt)
static void trizeps_pcmcia_shutdown(struct soc_pcmcia_socket *skt)
{
printk(">>>>>PCMCIA TRIZEPS shutdown\n");
sa11xx_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
/* Disable CF bus: */
TRIZEPS_BCR_set(TRIZEPS_BCR1, TRIZEPS_nPCM_ENA_REG);
......@@ -64,7 +64,7 @@ static void trizeps_pcmcia_shutdown(struct sa1100_pcmcia_socket *skt)
*
******************************************************/
static void
trizeps_pcmcia_socket_state(struct sa1100_pcmcia_socket *skt,
trizeps_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
struct pcmcia_state *state_array)
{
unsigned long levels = GPLR;
......@@ -83,7 +83,7 @@ trizeps_pcmcia_socket_state(struct sa1100_pcmcia_socket *skt,
*
******************************************************/
static int
trizeps_pcmcia_configure_socket(struct sa1100_pcmcia_socket *skt,
trizeps_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
const socket_state_t *state)
{
unsigned long flags;
......@@ -129,14 +129,14 @@ trizeps_pcmcia_configure_socket(struct sa1100_pcmcia_socket *skt,
return 0;
}
static void trizeps_pcmcia_socket_init(struct sa1100_pcmcia_socket *skt)
static void trizeps_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
{
sa11xx_enable_irqs(skt, irqs, ARRAY_SIZE(irqs));
soc_pcmcia_enable_irqs(skt, irqs, ARRAY_SIZE(irqs));
}
static void trizeps_pcmcia_socket_suspend(struct sa1100_pcmcia_socket *skt)
static void trizeps_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
{
sa11xx_disable_irqs(skt, irqs, ARRAY_SIZE(irqs));
soc_pcmcia_disable_irqs(skt, irqs, ARRAY_SIZE(irqs));
}
/**
......
......@@ -19,7 +19,7 @@
#define NCR_A0VPP (1<<16)
#define NCR_A1VPP (1<<17)
static int xp860_pcmcia_hw_init(struct sa1100_pcmcia_socket *skt)
static int xp860_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
{
/* Set GPIO_A<3:0> to be outputs for PCMCIA/CF power controller: */
PA_DDR &= ~(GPIO_GPIO0 | GPIO_GPIO1 | GPIO_GPIO2 | GPIO_GPIO3);
......@@ -42,7 +42,7 @@ static int xp860_pcmcia_hw_init(struct sa1100_pcmcia_socket *skt)
}
static int
xp860_pcmcia_configure_socket(struct sa1100_pcmcia_socket *skt, const socket_state_t *state)
xp860_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_t *state)
{
unsigned int gpio_mask, pa_dwr_mask;
unsigned int gpio_set, pa_dwr_set;
......
......@@ -33,19 +33,19 @@ static struct pcmcia_irqs irqs[] = {
{ 0, IRQ_CF_BVD1, "CF_BVD1" },
};
static int yopy_pcmcia_hw_init(struct sa1100_pcmcia_socket *skt)
static int yopy_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
{
skt->irq = IRQ_CF_IREQ;
pcmcia_power(0);
pcmcia_reset(1);
return sa11xx_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
}
static void yopy_pcmcia_hw_shutdown(struct sa1100_pcmcia_socket *skt)
static void yopy_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
{
sa11xx_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
/* Disable CF */
pcmcia_reset(1);
......@@ -53,7 +53,7 @@ static void yopy_pcmcia_hw_shutdown(struct sa1100_pcmcia_socket *skt)
}
static void
yopy_pcmcia_socket_state(struct sa1100_pcmcia_socket *skt,
yopy_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
struct pcmcia_state_array *state)
{
unsigned long levels = GPLR;
......@@ -68,7 +68,7 @@ yopy_pcmcia_socket_state(struct sa1100_pcmcia_socket *skt,
}
static int
yopy_pcmcia_configure_socket(struct sa1100_pcmcia_socket *skt,
yopy_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
const socket_state_t *state)
{
switch (state->Vcc) {
......@@ -93,14 +93,14 @@ yopy_pcmcia_configure_socket(struct sa1100_pcmcia_socket *skt,
return 0;
}
static void yopy_pcmcia_socket_init(struct sa1100_pcmcia_socket *skt)
static void yopy_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
{
sa11xx_enable_irqs(skt, irqs, ARRAY_SIZE(irqs));
soc_pcmcia_enable_irqs(skt, irqs, ARRAY_SIZE(irqs));
}
static void yopy_pcmcia_socket_suspend(struct sa1100_pcmcia_socket *skt)
static void yopy_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
{
sa11xx_disable_irqs(skt, irqs, ARRAY_SIZE(irqs));
soc_pcmcia_disable_irqs(skt, irqs, ARRAY_SIZE(irqs));
}
static struct pcmcia_low_level yopy_pcmcia_ops = {
......
......@@ -29,20 +29,20 @@ static struct pcmcia_irqs irqs[] = {
{ 1, IRQ_S1_BVD1_STSCHG, "SA1111 CF BVD1" },
};
int sa1111_pcmcia_hw_init(struct sa1100_pcmcia_socket *skt)
int sa1111_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
{
if (skt->irq == NO_IRQ)
skt->irq = skt->nr ? IRQ_S1_READY_NINT : IRQ_S0_READY_NINT;
return sa11xx_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
}
void sa1111_pcmcia_hw_shutdown(struct sa1100_pcmcia_socket *skt)
void sa1111_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
{
sa11xx_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
}
void sa1111_pcmcia_socket_state(struct sa1100_pcmcia_socket *skt, struct pcmcia_state *state)
void sa1111_pcmcia_socket_state(struct soc_pcmcia_socket *skt, struct pcmcia_state *state)
{
struct sa1111_dev *sadev = SA1111_DEV(skt->dev);
unsigned long status = sa1111_readl(sadev->mapbase + SA1111_PCSR);
......@@ -70,7 +70,7 @@ void sa1111_pcmcia_socket_state(struct sa1100_pcmcia_socket *skt, struct pcmcia_
}
}
int sa1111_pcmcia_configure_socket(struct sa1100_pcmcia_socket *skt, const socket_state_t *state)
int sa1111_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_t *state)
{
struct sa1111_dev *sadev = SA1111_DEV(skt->dev);
unsigned int pccr_skt_mask, pccr_set_mask, val;
......@@ -110,14 +110,14 @@ int sa1111_pcmcia_configure_socket(struct sa1100_pcmcia_socket *skt, const socke
return 0;
}
void sa1111_pcmcia_socket_init(struct sa1100_pcmcia_socket *skt)
void sa1111_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
{
sa11xx_enable_irqs(skt, irqs, ARRAY_SIZE(irqs));
soc_pcmcia_enable_irqs(skt, irqs, ARRAY_SIZE(irqs));
}
void sa1111_pcmcia_socket_suspend(struct sa1100_pcmcia_socket *skt)
void sa1111_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
{
sa11xx_disable_irqs(skt, irqs, ARRAY_SIZE(irqs));
soc_pcmcia_disable_irqs(skt, irqs, ARRAY_SIZE(irqs));
}
static int pcmcia_probe(struct sa1111_dev *dev)
......@@ -165,7 +165,7 @@ static int pcmcia_probe(struct sa1111_dev *dev)
static int __devexit pcmcia_remove(struct sa1111_dev *dev)
{
sa11xx_drv_pcmcia_remove(&dev->dev);
soc_common_drv_pcmcia_remove(&dev->dev);
release_mem_region(dev->res.start, 512);
return 0;
}
......
#include "sa11xx_core.h"
#include "soc_common.h"
#include "sa11xx_base.h"
extern int sa1111_pcmcia_hw_init(struct sa1100_pcmcia_socket *);
extern void sa1111_pcmcia_hw_shutdown(struct sa1100_pcmcia_socket *);
extern void sa1111_pcmcia_socket_state(struct sa1100_pcmcia_socket *, struct pcmcia_state *);
extern int sa1111_pcmcia_configure_socket(struct sa1100_pcmcia_socket *, const socket_state_t *);
extern void sa1111_pcmcia_socket_init(struct sa1100_pcmcia_socket *);
extern void sa1111_pcmcia_socket_suspend(struct sa1100_pcmcia_socket *);
extern int sa1111_pcmcia_hw_init(struct soc_pcmcia_socket *);
extern void sa1111_pcmcia_hw_shutdown(struct soc_pcmcia_socket *);
extern void sa1111_pcmcia_socket_state(struct soc_pcmcia_socket *, struct pcmcia_state *);
extern int sa1111_pcmcia_configure_socket(struct soc_pcmcia_socket *, const socket_state_t *);
extern void sa1111_pcmcia_socket_init(struct soc_pcmcia_socket *);
extern void sa1111_pcmcia_socket_suspend(struct soc_pcmcia_socket *);
extern int pcmcia_badge4_init(struct device *);
extern int pcmcia_jornada720_init(struct device *);
......
/*======================================================================
Device driver for the PCMCIA control functionality of StrongARM
SA-1100 microprocessors.
The contents of this file are subject to the Mozilla Public
License Version 1.1 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of
the License at http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
implied. See the License for the specific language governing
rights and limitations under the License.
The initial developer of the original code is John G. Dorsey
<john+@cs.cmu.edu>. Portions created by John G. Dorsey are
Copyright (C) 1999 John G. Dorsey. All Rights Reserved.
Alternatively, the contents of this file may be used under the
terms of the GNU Public License version 2 (the "GPL"), in which
case the provisions of the GPL are applicable instead of the
above. If you wish to allow the use of your version of this file
only under the terms of the GPL and not to allow others to use
your version of this file under the MPL, indicate your decision
by deleting the provisions above and replace them with the notice
and other provisions required by the GPL. If you do not delete
the provisions above, a recipient may use your version of this
file under either the MPL or the GPL.
======================================================================*/
#include <linux/module.h>
#include <linux/init.h>
#include <linux/config.h>
#include <linux/cpufreq.h>
#include <linux/ioport.h>
#include <linux/kernel.h>
#include <linux/notifier.h>
#include <linux/spinlock.h>
#include <asm/hardware.h>
#include <asm/io.h>
#include <asm/irq.h>
#include <asm/system.h>
#include "soc_common.h"
#include "sa11xx_base.h"
/*
* sa1100_pcmcia_default_mecr_timing
* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
*
* Calculate MECR clock wait states for given CPU clock
* speed and command wait state. This function can be over-
* written by a board specific version.
*
* The default is to simply calculate the BS values as specified in
* the INTEL SA1100 development manual
* "Expansion Memory (PCMCIA) Configuration Register (MECR)"
* that's section 10.2.5 in _my_ version of the manual ;)
*/
static unsigned int
sa1100_pcmcia_default_mecr_timing(struct soc_pcmcia_socket *skt,
unsigned int cpu_speed,
unsigned int cmd_time)
{
return sa1100_pcmcia_mecr_bs(cmd_time, cpu_speed);
}
static unsigned short
calc_speed(unsigned short *spds, int num, unsigned short dflt)
{
unsigned short speed = 0;
int i;
for (i = 0; i < num; i++)
if (speed < spds[i])
speed = spds[i];
if (speed == 0)
speed = dflt;
return speed;
}
/* sa1100_pcmcia_set_mecr()
* ^^^^^^^^^^^^^^^^^^^^^^^^
*
* set MECR value for socket <sock> based on this sockets
* io, mem and attribute space access speed.
* Call board specific BS value calculation to allow boards
* to tweak the BS values.
*/
static int
sa1100_pcmcia_set_mecr(struct soc_pcmcia_socket *skt, unsigned int cpu_clock)
{
u32 mecr, old_mecr;
unsigned long flags;
unsigned short speed;
unsigned int bs_io, bs_mem, bs_attr;
speed = calc_speed(skt->spd_io, MAX_IO_WIN, SOC_PCMCIA_IO_ACCESS);
bs_io = skt->ops->get_timing(skt, cpu_clock, speed);
speed = calc_speed(skt->spd_mem, MAX_WIN, SOC_PCMCIA_3V_MEM_ACCESS);
bs_mem = skt->ops->get_timing(skt, cpu_clock, speed);
speed = calc_speed(skt->spd_attr, MAX_WIN, SOC_PCMCIA_3V_MEM_ACCESS);
bs_attr = skt->ops->get_timing(skt, cpu_clock, speed);
local_irq_save(flags);
old_mecr = mecr = MECR;
MECR_FAST_SET(mecr, skt->nr, 0);
MECR_BSIO_SET(mecr, skt->nr, bs_io);
MECR_BSA_SET(mecr, skt->nr, bs_attr);
MECR_BSM_SET(mecr, skt->nr, bs_mem);
if (old_mecr != mecr)
MECR = mecr;
local_irq_restore(flags);
debug(skt, 2, "FAST %X BSM %X BSA %X BSIO %X\n",
MECR_FAST_GET(mecr, skt->nr),
MECR_BSM_GET(mecr, skt->nr), MECR_BSA_GET(mecr, skt->nr),
MECR_BSIO_GET(mecr, skt->nr));
return 0;
}
static int
sa1100_pcmcia_set_timing(struct soc_pcmcia_socket *skt)
{
return sa1100_pcmcia_set_mecr(skt, cpufreq_get(0));
}
static int
sa1100_pcmcia_show_timing(struct soc_pcmcia_socket *skt, char *buf)
{
unsigned int clock = cpufreq_get(0);
unsigned long mecr = MECR;
char *p = buf;
p+=sprintf(p, "I/O : %u (%u)\n",
calc_speed(skt->spd_io, MAX_IO_WIN, SOC_PCMCIA_IO_ACCESS),
sa1100_pcmcia_cmd_time(clock, MECR_BSIO_GET(mecr, skt->nr)));
p+=sprintf(p, "attribute: %u (%u)\n",
calc_speed(skt->spd_attr, MAX_WIN, SOC_PCMCIA_3V_MEM_ACCESS),
sa1100_pcmcia_cmd_time(clock, MECR_BSA_GET(mecr, skt->nr)));
p+=sprintf(p, "common : %u (%u)\n",
calc_speed(skt->spd_mem, MAX_WIN, SOC_PCMCIA_3V_MEM_ACCESS),
sa1100_pcmcia_cmd_time(clock, MECR_BSM_GET(mecr, skt->nr)));
return p - buf;
}
int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops,
int first, int nr)
{
/*
* set default MECR calculation if the board specific
* code did not specify one...
*/
if (!ops->get_timing)
ops->get_timing = sa1100_pcmcia_default_mecr_timing;
/* Provide our SA11x0 specific timing routines. */
ops->set_timing = sa1100_pcmcia_set_timing;
ops->show_timing = sa1100_pcmcia_show_timing;
return soc_common_drv_pcmcia_probe(dev, ops, first, nr);
}
EXPORT_SYMBOL(sa11xx_drv_pcmcia_probe);
#ifdef CONFIG_CPU_FREQ
/* sa1100_pcmcia_update_mecr()
* ^^^^^^^^^^^^^^^^^^^^^^^^^^^
* When sa1100_pcmcia_notifier() decides that a MECR adjustment (due
* to a core clock frequency change) is needed, this routine establishes
* new BS_xx values consistent with the clock speed `clock'.
*/
static void sa1100_pcmcia_update_mecr(unsigned int clock)
{
struct soc_pcmcia_socket *skt;
down(&soc_pcmcia_sockets_lock);
list_for_each_entry(skt, &soc_pcmcia_sockets, node)
sa1100_pcmcia_set_mecr(skt, clock);
up(&soc_pcmcia_sockets_lock);
}
/* sa1100_pcmcia_notifier()
* ^^^^^^^^^^^^^^^^^^^^^^^^
* When changing the processor core clock frequency, it is necessary
* to adjust the MECR timings accordingly. We've recorded the timings
* requested by Card Services, so this is just a matter of finding
* out what our current speed is, and then recomputing the new MECR
* values.
*
* Returns: 0 on success, -1 on error
*/
static int
sa1100_pcmcia_notifier(struct notifier_block *nb, unsigned long val,
void *data)
{
struct cpufreq_freqs *freqs = data;
switch (val) {
case CPUFREQ_PRECHANGE:
if (freqs->new > freqs->old)
sa1100_pcmcia_update_mecr(freqs->new);
break;
case CPUFREQ_POSTCHANGE:
if (freqs->new < freqs->old)
sa1100_pcmcia_update_mecr(freqs->new);
break;
}
return 0;
}
static struct notifier_block sa1100_pcmcia_notifier_block = {
.notifier_call = sa1100_pcmcia_notifier
};
static int __init sa11xx_pcmcia_init(void)
{
int ret;
printk(KERN_INFO "SA11xx PCMCIA\n");
ret = cpufreq_register_notifier(&sa1100_pcmcia_notifier_block,
CPUFREQ_TRANSITION_NOTIFIER);
if (ret < 0)
printk(KERN_ERR "Unable to register CPU frequency change "
"notifier (%d)\n", ret);
return ret;
}
module_init(sa11xx_pcmcia_init);
static void __exit sa11xx_pcmcia_exit(void)
{
cpufreq_unregister_notifier(&sa1100_pcmcia_notifier_block, CPUFREQ_TRANSITION_NOTIFIER);
}
module_exit(sa11xx_pcmcia_exit);
#endif
MODULE_AUTHOR("John Dorsey <john+@cs.cmu.edu>");
MODULE_DESCRIPTION("Linux PCMCIA Card Services: SA-11xx core socket driver");
MODULE_LICENSE("Dual MPL/GPL");
......@@ -33,12 +33,16 @@
#if !defined(_PCMCIA_SA1100_H)
# define _PCMCIA_SA1100_H
#include <pcmcia/cs_types.h>
#include <pcmcia/ss.h>
#include <pcmcia/bulkmem.h>
#include <pcmcia/cistpl.h>
#include "cs_internal.h"
#include "sa1100_generic.h"
/* SA-1100 PCMCIA Memory and I/O timing
* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
* The SA-1110 Developer's Manual, section 10.2.5, says the following:
*
* "To calculate the recommended BS_xx value for each address space:
* divide the command width time (the greater of twIOWR and twIORD,
* or the greater of twWE and twOE) by processor cycle time; divide
* by 2; divide again by 3 (number of BCLK's per command assertion);
* round up to the next whole number; and subtract 1."
*/
/* MECR: Expansion Memory Configuration Register
* (SA-1100 Developers Manual, p.10-13; SA-1110 Developers Manual, p.10-24)
......@@ -105,7 +109,7 @@ static inline unsigned int sa1100_pcmcia_mecr_bs(unsigned int pcmcia_cycle_ns,
return (t / 1000000) + (((t % 1000000) == 0) ? 0 : 1);
}
/* This function returns the (approxmiate) command assertion period, in
/* This function returns the (approximate) command assertion period, in
* nanoseconds, for a given CPU clock frequency and MECR BS value:
*/
static inline unsigned int sa1100_pcmcia_cmd_time(unsigned int cpu_clock_khz,
......@@ -114,51 +118,6 @@ static inline unsigned int sa1100_pcmcia_cmd_time(unsigned int cpu_clock_khz,
}
/* SA-1100 PCMCIA Memory and I/O timing
* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
* The SA-1110 Developer's Manual, section 10.2.5, says the following:
*
* "To calculate the recommended BS_xx value for each address space:
* divide the command width time (the greater of twIOWR and twIORD,
* or the greater of twWE and twOE) by processor cycle time; divide
* by 2; divide again by 3 (number of BCLK's per command assertion);
* round up to the next whole number; and subtract 1."
*
* The PC Card Standard, Release 7, section 4.13.4, says that twIORD
* has a minimum value of 165ns. Section 4.13.5 says that twIOWR has
* a minimum value of 165ns, as well. Section 4.7.2 (describing
* common and attribute memory write timing) says that twWE has a
* minimum value of 150ns for a 250ns cycle time (for 5V operation;
* see section 4.7.4), or 300ns for a 600ns cycle time (for 3.3V
* operation, also section 4.7.4). Section 4.7.3 says that taOE
* has a maximum value of 150ns for a 300ns cycle time (for 5V
* operation), or 300ns for a 600ns cycle time (for 3.3V operation).
*
* When configuring memory maps, Card Services appears to adopt the policy
* that a memory access time of "0" means "use the default." The default
* PCMCIA I/O command width time is 165ns. The default PCMCIA 5V attribute
* and memory command width time is 150ns; the PCMCIA 3.3V attribute and
* memory command width time is 300ns.
*/
#define SA1100_PCMCIA_IO_ACCESS (165)
#define SA1100_PCMCIA_5V_MEM_ACCESS (150)
#define SA1100_PCMCIA_3V_MEM_ACCESS (300)
/* The socket driver actually works nicely in interrupt-driven form,
* so the (relatively infrequent) polling is "just to be sure."
*/
#define SA1100_PCMCIA_POLL_PERIOD (2*HZ)
struct pcmcia_low_level;
/* I/O pins replacing memory pins
* (PCMCIA System Architecture, 2nd ed., by Don Anderson, p.75)
*
* These signals change meaning when going from memory-only to
* memory-or-I/O interface:
*/
#define iostschg bvd1
#define iospkr bvd2
extern int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops, int first, int nr);
#endif /* !defined(_PCMCIA_SA1100_H) */
/*
* linux/include/asm/arch/pcmcia.h
* linux/drivers/pcmcia/soc_common.h
*
* Copyright (C) 2000 John G Dorsey <john+@cs.cmu.edu>
*
* This file contains definitions for the low-level SA-1100 kernel PCMCIA
* interface. Please see linux/Documentation/arm/SA1100/PCMCIA for details.
* This file contains definitions for the PCMCIA support code common to
* integrated SOCs like the SA-11x0 and PXA2xx microprocessors.
*/
#ifndef _ASM_ARCH_PCMCIA
#define _ASM_ARCH_PCMCIA
......@@ -18,31 +18,15 @@
#include <pcmcia/cistpl.h>
#include "cs_internal.h"
struct device;
/* Ideally, we'd support up to MAX_SOCK sockets, but the SA-1100 only
* has support for two. This shows up in lots of hardwired ways, such
* as the fact that MECR only has enough bits to configure two sockets.
* Since it's so entrenched in the hardware, limiting the software
* in this way doesn't seem too terrible.
*/
#define SA1100_PCMCIA_MAX_SOCK (2)
struct pcmcia_state {
unsigned detect: 1,
ready: 1,
bvd1: 1,
bvd2: 1,
wrprot: 1,
vs_3v: 1,
vs_Xv: 1;
};
struct device;
struct pcmcia_low_level;
/*
* This structure encapsulates per-socket state which we might need to
* use when responding to a Card Services query of some kind.
*/
struct sa1100_pcmcia_socket {
struct soc_pcmcia_socket {
struct pcmcia_socket socket;
/*
......@@ -76,46 +60,120 @@ struct sa1100_pcmcia_socket {
struct list_head node;
};
struct pcmcia_state {
unsigned detect: 1,
ready: 1,
bvd1: 1,
bvd2: 1,
wrprot: 1,
vs_3v: 1,
vs_Xv: 1;
};
struct pcmcia_low_level {
struct module *owner;
int (*hw_init)(struct sa1100_pcmcia_socket *);
void (*hw_shutdown)(struct sa1100_pcmcia_socket *);
/* first socket in system */
int first;
/* nr of sockets */
int nr;
void (*socket_state)(struct sa1100_pcmcia_socket *, struct pcmcia_state *);
int (*configure_socket)(struct sa1100_pcmcia_socket *, const socket_state_t *);
int (*hw_init)(struct soc_pcmcia_socket *);
void (*hw_shutdown)(struct soc_pcmcia_socket *);
void (*socket_state)(struct soc_pcmcia_socket *, struct pcmcia_state *);
int (*configure_socket)(struct soc_pcmcia_socket *, socket_state_t *);
/*
* Enable card status IRQs on (re-)initialisation. This can
* be called at initialisation, power management event, or
* pcmcia event.
*/
void (*socket_init)(struct sa1100_pcmcia_socket *);
void (*socket_init)(struct soc_pcmcia_socket *);
/*
* Disable card status IRQs and PCMCIA bus on suspend.
*/
void (*socket_suspend)(struct sa1100_pcmcia_socket *);
void (*socket_suspend)(struct soc_pcmcia_socket *);
/*
* Calculate MECR timing clock wait states
* Hardware specific timing routines.
* If provided, the get_timing routine overrides the SOC default.
*/
unsigned int (*socket_get_timing)(struct sa1100_pcmcia_socket *,
unsigned int cpu_speed, unsigned int cmd_time);
unsigned int (*get_timing)(struct soc_pcmcia_socket *, unsigned int, unsigned int);
int (*set_timing)(struct soc_pcmcia_socket *);
int (*show_timing)(struct soc_pcmcia_socket *, char *);
};
struct pcmcia_irqs {
int sock;
int irq;
const char *str;
};
int sa11xx_request_irqs(struct sa1100_pcmcia_socket *skt, struct pcmcia_irqs *irqs, int nr);
void sa11xx_free_irqs(struct sa1100_pcmcia_socket *skt, struct pcmcia_irqs *irqs, int nr);
void sa11xx_disable_irqs(struct sa1100_pcmcia_socket *skt, struct pcmcia_irqs *irqs, int nr);
void sa11xx_enable_irqs(struct sa1100_pcmcia_socket *skt, struct pcmcia_irqs *irqs, int nr);
extern int soc_pcmcia_request_irqs(struct soc_pcmcia_socket *skt, struct pcmcia_irqs *irqs, int nr);
extern void soc_pcmcia_free_irqs(struct soc_pcmcia_socket *skt, struct pcmcia_irqs *irqs, int nr);
extern void soc_pcmcia_disable_irqs(struct soc_pcmcia_socket *skt, struct pcmcia_irqs *irqs, int nr);
extern void soc_pcmcia_enable_irqs(struct soc_pcmcia_socket *skt, struct pcmcia_irqs *irqs, int nr);
extern struct list_head soc_pcmcia_sockets;
extern struct semaphore soc_pcmcia_sockets_lock;
extern int soc_common_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops, int first, int nr);
extern int soc_common_drv_pcmcia_remove(struct device *dev);
#ifdef DEBUG
extern void soc_pcmcia_debug(struct soc_pcmcia_socket *skt, const char *func,
int lvl, const char *fmt, ...);
#define debug(skt, lvl, fmt, arg...) \
soc_pcmcia_debug(skt, __func__, lvl, fmt , ## arg)
#else
#define debug(skt, lvl, fmt, arg...) do { } while (0)
#endif
/*
* The PC Card Standard, Release 7, section 4.13.4, says that twIORD
* has a minimum value of 165ns. Section 4.13.5 says that twIOWR has
* a minimum value of 165ns, as well. Section 4.7.2 (describing
* common and attribute memory write timing) says that twWE has a
* minimum value of 150ns for a 250ns cycle time (for 5V operation;
* see section 4.7.4), or 300ns for a 600ns cycle time (for 3.3V
* operation, also section 4.7.4). Section 4.7.3 says that taOE
* has a maximum value of 150ns for a 300ns cycle time (for 5V
* operation), or 300ns for a 600ns cycle time (for 3.3V operation).
*
* When configuring memory maps, Card Services appears to adopt the policy
* that a memory access time of "0" means "use the default." The default
* PCMCIA I/O command width time is 165ns. The default PCMCIA 5V attribute
* and memory command width time is 150ns; the PCMCIA 3.3V attribute and
* memory command width time is 300ns.
*/
#define SOC_PCMCIA_IO_ACCESS (165)
#define SOC_PCMCIA_5V_MEM_ACCESS (150)
#define SOC_PCMCIA_3V_MEM_ACCESS (300)
#define SOC_PCMCIA_ATTR_MEM_ACCESS (300)
extern int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops, int first, int nr);
extern int sa11xx_drv_pcmcia_remove(struct device *dev);
/*
* The socket driver actually works nicely in interrupt-driven form,
* so the (relatively infrequent) polling is "just to be sure."
*/
#define SOC_PCMCIA_POLL_PERIOD (2*HZ)
/* I/O pins replacing memory pins
* (PCMCIA System Architecture, 2nd ed., by Don Anderson, p.75)
*
* These signals change meaning when going from memory-only to
* memory-or-I/O interface:
*/
#define iostschg bvd1
#define iospkr bvd2
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment