Commit 657922c7 authored by Russell King's avatar Russell King

[ARM] SA11x0 PCMCIA 5

Remove get_irq_info method, passing the information via the init
method instead.  The IRQ allocated to a socket never changes on
these platforms, so the extra code was just bloat.
parent a875f3b9
......@@ -90,7 +90,6 @@ static struct pcmcia_low_level adsbitsy_pcmcia_ops = {
.init = adsbitsy_pcmcia_init,
.shutdown = sa1111_pcmcia_shutdown,
.socket_state = sa1111_pcmcia_socket_state,
.get_irq_info = sa1111_pcmcia_get_irq_info,
.configure_socket = adsbitsy_pcmcia_configure_socket,
.socket_init = sa1111_pcmcia_socket_init,
......
......@@ -45,6 +45,9 @@ static int assabet_pcmcia_init(struct pcmcia_init *init)
goto irq_err;
}
init->socket_irq[0] = NO_IRQ;
init->socket_irq[1] = ASSABET_IRQ_GPIO_CF_IRQ;
/* There's only one slot, but it's "Slot 1": */
return 2;
......@@ -87,17 +90,6 @@ assabet_pcmcia_socket_state(int sock, struct pcmcia_state *state)
}
}
static int assabet_pcmcia_get_irq_info(struct pcmcia_irq_info *info)
{
if (info->sock > 1)
return -1;
if (info->sock == 1)
info->irq = ASSABET_IRQ_GPIO_CF_IRQ;
return 0;
}
static int
assabet_pcmcia_configure_socket(int sock, const struct pcmcia_configure *configure)
{
......@@ -195,7 +187,6 @@ static struct pcmcia_low_level assabet_pcmcia_ops = {
.init = assabet_pcmcia_init,
.shutdown = assabet_pcmcia_shutdown,
.socket_state = assabet_pcmcia_socket_state,
.get_irq_info = assabet_pcmcia_get_irq_info,
.configure_socket = assabet_pcmcia_configure_socket,
.socket_init = assabet_pcmcia_socket_init,
......
......@@ -153,7 +153,6 @@ static struct pcmcia_low_level badge4_pcmcia_ops = {
.init = badge4_pcmcia_init,
.shutdown = badge4_pcmcia_shutdown,
.socket_state = sa1111_pcmcia_socket_state,
.get_irq_info = sa1111_pcmcia_get_irq_info,
.configure_socket = badge4_pcmcia_configure_socket,
.socket_init = sa1111_pcmcia_socket_init,
......
......@@ -46,6 +46,8 @@ static int cerf_pcmcia_init(struct pcmcia_init *init)
goto irq_err;
}
init->socket_irq[CERF_SOCKET] = IRQ_GPIO_CF_IRQ;
return 2;
irq_err:
......@@ -83,16 +85,6 @@ static void cerf_pcmcia_socket_state(int sock, struct pcmcia_state *state)
}
}
static int cerf_pcmcia_get_irq_info(struct pcmcia_irq_info *info){
if(info->sock>1) return -1;
if (info->sock == CERF_SOCKET)
info->irq=IRQ_GPIO_CF_IRQ;
return 0;
}
static int cerf_pcmcia_configure_socket(int sock, const struct pcmcia_configure
*configure)
{
......@@ -162,7 +154,6 @@ static struct pcmcia_low_level cerf_pcmcia_ops = {
.init = cerf_pcmcia_init,
.shutdown = cerf_pcmcia_shutdown,
.socket_state = cerf_pcmcia_socket_state,
.get_irq_info = cerf_pcmcia_get_irq_info,
.configure_socket = cerf_pcmcia_configure_socket,
.socket_init = cerf_pcmcia_socket_init,
......
......@@ -54,6 +54,9 @@ static int flexanet_pcmcia_init(struct pcmcia_init *init)
break;
}
init->socket_irq[0] = IRQ_GPIO_CF1_IRQ;
init->socket_irq[1] = IRQ_GPIO_CF2_IRQ;
/* If we failed, then free all interrupts requested thus far. */
if (res < 0) {
printk(KERN_ERR "%s: request for IRQ%d failed: %d\n",
......@@ -117,25 +120,6 @@ static void flexanet_pcmcia_socket_state(int sock, struct pcmcia_state *state)
}
/*
* Return the IRQ information for a given socket number (the IRQ number)
*
*/
static int flexanet_pcmcia_get_irq_info(struct pcmcia_irq_info *info){
/* check the socket index */
if (info->sock > 1)
return -1;
if (info->sock == 0)
info->irq = IRQ_GPIO_CF1_IRQ;
else if (info->sock == 1)
info->irq = IRQ_GPIO_CF2_IRQ;
return 0;
}
/*
*
*/
......@@ -222,7 +206,6 @@ static struct pcmcia_low_level flexanet_pcmcia_ops = {
.init = flexanet_pcmcia_init,
.shutdown = flexanet_pcmcia_shutdown,
.socket_state = flexanet_pcmcia_socket_state,
.get_irq_info = flexanet_pcmcia_get_irq_info,
.configure_socket = flexanet_pcmcia_configure_socket,
.socket_init = flexanet_pcmcia_socket_init,
......
......@@ -49,6 +49,8 @@ static int freebird_pcmcia_init(struct pcmcia_init *init){
goto irq_err;
}
init->socket_irq[0] = IRQ_GPIO_FREEBIRD_CF_IRQ;
/* There's only one slot, but it's "Slot 1": */
return 2;
......@@ -93,16 +95,6 @@ static void freebird_pcmcia_socket_state(int sock, struct pcmcia_state *state)
}
}
static int freebird_pcmcia_get_irq_info(struct pcmcia_irq_info *info){
if(info->sock>1) return -1;
if(info->sock==0)
info->irq=IRQ_GPIO_FREEBIRD_CF_IRQ;
return 0;
}
static int freebird_pcmcia_configure_socket(int sock, const struct pcmcia_configure
*configure)
{
......@@ -171,7 +163,6 @@ static struct pcmcia_low_level freebird_pcmcia_ops = {
.init = freebird_pcmcia_init,
.shutdown = freebird_pcmcia_shutdown,
.socket_state = freebird_pcmcia_socket_state,
.get_irq_info = freebird_pcmcia_get_irq_info,
.configure_socket = freebird_pcmcia_configure_socket,
.socket_init = freebird_pcmcia_socket_init,
......
......@@ -945,6 +945,8 @@ int sa1100_register_pcmcia(struct pcmcia_low_level *ops, struct device *dev)
ops->socket_get_timing = sa1100_pcmcia_default_mecr_timing;
pcmcia_init.handler = sa1100_pcmcia_interrupt;
pcmcia_init.socket_irq[0] = NO_IRQ;
pcmcia_init.socket_irq[1] = NO_IRQ;
ret = ops->init(&pcmcia_init);
if (ret < 0) {
printk(KERN_ERR "Unable to initialize kernel PCMCIA service (%d).\n", ret);
......@@ -961,22 +963,16 @@ int sa1100_register_pcmcia(struct pcmcia_low_level *ops, struct device *dev)
*/
for (i = 0; i < sa1100_pcmcia_socket_count; i++) {
struct sa1100_pcmcia_socket *skt = PCMCIA_SOCKET(i);
struct pcmcia_irq_info irq_info;
if (!request_mem_region(_PCMCIA(i), PCMCIASp, "PCMCIA")) {
ret = -EBUSY;
goto out_err;
}
irq_info.sock = i;
irq_info.irq = -1;
ret = ops->get_irq_info(&irq_info);
if (ret < 0)
printk(KERN_ERR "Unable to get IRQ for socket %u (%d)\n", i, ret);
skt->nr = i;
skt->ops = ops;
skt->irq = irq_info.irq;
skt->irq = pcmcia_init.socket_irq[i];
skt->speed_io = SA1100_PCMCIA_IO_ACCESS;
skt->speed_attr = SA1100_PCMCIA_5V_MEM_ACCESS;
skt->speed_mem = SA1100_PCMCIA_5V_MEM_ACCESS;
......
......@@ -19,6 +19,7 @@
struct pcmcia_init {
void (*handler)(int irq, void *dev, struct pt_regs *regs);
int socket_irq[SA1100_PCMCIA_MAX_SOCK];
};
struct pcmcia_state {
......@@ -40,18 +41,12 @@ struct pcmcia_configure {
irq: 1;
};
struct pcmcia_irq_info {
unsigned int sock;
unsigned int irq;
};
struct pcmcia_low_level {
struct module *owner;
int (*init)(struct pcmcia_init *);
int (*shutdown)(void);
void (*socket_state)(int sock, struct pcmcia_state *);
int (*get_irq_info)(struct pcmcia_irq_info *);
int (*configure_socket)(int sock, const struct pcmcia_configure *);
/*
......
......@@ -53,6 +53,9 @@ static int h3600_pcmcia_init(struct pcmcia_init *init)
free_irq(irqs[i].irq, NULL);
}
init->socket_irq[0] = IRQ_GPIO_H3600_PCMCIA_IRQ0;
init->socket_irq[1] = IRQ_GPIO_H3600_PCMCIA_IRQ1;
return res ? res : 2;
}
......@@ -101,21 +104,6 @@ static void h3600_pcmcia_socket_state(int sock, struct pcmcia_state *state)
}
}
static int h3600_pcmcia_get_irq_info(struct pcmcia_irq_info *info)
{
switch (info->sock) {
case 0:
info->irq = IRQ_GPIO_H3600_PCMCIA_IRQ0;
break;
case 1:
info->irq = IRQ_GPIO_H3600_PCMCIA_IRQ1;
break;
default:
return -1;
}
return 0;
}
static int
h3600_pcmcia_configure_socket(int sock, const struct pcmcia_configure *conf)
{
......@@ -192,7 +180,6 @@ struct pcmcia_low_level h3600_pcmcia_ops = {
.init = h3600_pcmcia_init,
.shutdown = h3600_pcmcia_shutdown,
.socket_state = h3600_pcmcia_socket_state,
.get_irq_info = h3600_pcmcia_get_irq_info,
.configure_socket = h3600_pcmcia_configure_socket,
.socket_init = h3600_pcmcia_socket_init,
......
......@@ -108,7 +108,6 @@ static struct pcmcia_low_level jornada720_pcmcia_ops = {
.init = jornada720_pcmcia_init,
.shutdown = sa1111_pcmcia_shutdown,
.socket_state = sa1111_pcmcia_socket_state,
.get_irq_info = sa1111_pcmcia_get_irq_info,
.configure_socket = jornada720_pcmcia_configure_socket,
.socket_init = sa1111_pcmcia_socket_init,
......
......@@ -132,7 +132,6 @@ static struct pcmcia_low_level neponset_pcmcia_ops = {
.init = neponset_pcmcia_init,
.shutdown = sa1111_pcmcia_shutdown,
.socket_state = sa1111_pcmcia_socket_state,
.get_irq_info = sa1111_pcmcia_get_irq_info,
.configure_socket = neponset_pcmcia_configure_socket,
.socket_init = sa1111_pcmcia_socket_init,
......
......@@ -30,6 +30,8 @@ static int pangolin_pcmcia_init(struct pcmcia_init *init){
GPCR = GPIO_PCMCIA_BUS_ON;
#endif
init->socket_irq[PANGOLIN_SOCK] = IRQ_PCMCIA_IRQ;
/* Set transition detect */
set_irq_type(IRQ_PCMCIA_CD, IRQT_NOEDGE);
set_irq_type(IRQ_PCMCIA_IRQ, IRQT_FALLING);
......@@ -74,19 +76,6 @@ static void pangolin_pcmcia_socket_state(int sock, struct pcmcia_state *state)
}
}
static int pangolin_pcmcia_get_irq_info(struct pcmcia_irq_info *info){
if(info->sock>1) return -1;
#ifndef CONFIG_SA1100_PANGOLIN_PCMCIA_IDE
if(info->sock==1)
info->irq=IRQ_PCMCIA_IRQ;
#else
if(info->sock==0)
info->irq=IRQ_PCMCIA_IRQ;
#endif
return 0;
}
static int pangolin_pcmcia_configure_socket(int sock, const struct pcmcia_configure
*configure)
{
......@@ -157,11 +146,10 @@ static struct pcmcia_low_level pangolin_pcmcia_ops = {
.init = pangolin_pcmcia_init,
.shutdown = pangolin_pcmcia_shutdown,
.socket_state = pangolin_pcmcia_socket_state,
.get_irq_info = pangolin_pcmcia_get_irq_info,
.configure_socket = pangolin_pcmcia_configure_socket,
.socket_init = pangolin_pcmcia_socket_init,
socket_suspend, pangolin_pcmcia_socket_suspend,
.socket_suspend = pangolin_pcmcia_socket_suspend,
};
int __init pcmcia_pangolin_init(struct device *dev)
......
......@@ -125,7 +125,6 @@ static struct pcmcia_low_level pfs168_pcmcia_ops = {
.init = pfs168_pcmcia_init,
.shutdown = sa1111_pcmcia_shutdown,
.socket_state = sa1111_pcmcia_socket_state,
.get_irq_info = sa1111_pcmcia_get_irq_info,
.configure_socket = pfs168_pcmcia_configure_socket,
.socket_init = sa1111_pcmcia_socket_init,
......
......@@ -37,14 +37,16 @@ static int shannon_pcmcia_init(struct pcmcia_init *init)
/* Set transition detect */
set_irq_type(SHANNON_IRQ_GPIO_RDY_0, IRQT_FALLING);
set_irq_type(SHANNON_IRQ_GPIO_RDY_1, IRQT_FALLING);
init->socket_irq[0] = SHANNON_IRQ_GPIO_RDY_0;
init->socket_irq[1] = SHANNON_IRQ_GPIO_RDY_1;
/* Register interrupts */
for (i = 0; i < ARRAY_SIZE(irqs); i++) {
set_irq_type(irqs[i].irq, IRQT_NOEDGE);
res = request_irq(irqs[i].irq, init->handler, SA_INTERRUPT,
irqs[i].str, NULL);
if (res)
goto irq_err;
set_irq_type(irqs[i].irq, IRQT_NOEDGE);
}
return 2;
......@@ -97,17 +99,6 @@ static void shannon_pcmcia_socket_state(int sock, struct pcmcia_state *state)
}
}
static int shannon_pcmcia_get_irq_info(struct pcmcia_irq_info *info)
{
if (info->sock == 0)
info->irq = SHANNON_IRQ_GPIO_RDY_0;
else if (info->sock == 1)
info->irq = SHANNON_IRQ_GPIO_RDY_1;
else return -1;
return 0;
}
static int shannon_pcmcia_configure_socket(int sock, const struct pcmcia_configure *configure)
{
switch (configure->vcc) {
......@@ -156,7 +147,6 @@ static struct pcmcia_low_level shannon_pcmcia_ops = {
.init = shannon_pcmcia_init,
.shutdown = shannon_pcmcia_shutdown,
.socket_state = shannon_pcmcia_socket_state,
.get_irq_info = shannon_pcmcia_get_irq_info,
.configure_socket = shannon_pcmcia_configure_socket,
.socket_init = shannon_pcmcia_socket_init,
......
......@@ -32,12 +32,15 @@ static int simpad_pcmcia_init(struct pcmcia_init *init){
/* Set transition detect */
set_irq_type( IRQ_GPIO_CF_CD, IRQT_NOEDGE );
set_irq_type( IRQ_GPIO_CF_IRQ, IRQT_FALLING );
init->socket_irq[1] = IRQ_GPIO_CF_IRQ;
/* Register interrupts */
irq = IRQ_GPIO_CF_CD;
res = request_irq( irq, init->handler, SA_INTERRUPT, "CF_CD", NULL );
if( res < 0 ) goto irq_err;
set_irq_type( IRQ_GPIO_CF_CD, IRQT_NOEDGE );
/* There's only one slot, but it's "Slot 1": */
return 2;
......@@ -82,16 +85,6 @@ static void simpad_pcmcia_socket_state(int sock, struct pcmcia_state *state)
}
}
static int simpad_pcmcia_get_irq_info(struct pcmcia_irq_info *info){
if(info->sock>1) return -1;
if(info->sock==1)
info->irq=IRQ_GPIO_CF_IRQ;
return 0;
}
static int simpad_pcmcia_configure_socket(int sock, const struct pcmcia_configure
*configure)
{
......@@ -152,7 +145,6 @@ static struct pcmcia_low_level simpad_pcmcia_ops = {
.init = simpad_pcmcia_init,
.shutdown = simpad_pcmcia_shutdown,
.socket_state = simpad_pcmcia_socket_state,
.get_irq_info = simpad_pcmcia_get_irq_info,
.configure_socket = simpad_pcmcia_configure_socket,
.socket_init = simpad_pcmcia_socket_init,
......
......@@ -49,14 +49,16 @@ static int stork_pcmcia_init(struct pcmcia_init *init)
/* Set transition detect */
set_irq_type(IRQ_GPIO_STORK_PCMCIA_A_RDY, IRQT_FALLING);
set_irq_type(IRQ_GPIO_STORK_PCMCIA_B_RDY, IRQT_FALLING);
init->socket_irq[0] = IRQ_GPIO_STORK_PCMCIA_A_RDY;
init->socket_irq[1] = IRQ_GPIO_STORK_PCMCIA_B_RDY;
/* Register interrupts */
for (i = 0; i < ARRAY_SIZE(irqs); i++) {
set_irq_type(irqs[i].irq, IRQT_NOEDGE);
res = request_irq(irqs[i].irq, init->handler, SA_INTERRUPT,
irqs[i].str, NULL);
if (res)
goto irq_err;
set_irq_type(irqs[i].irq, IRQT_NOEDGE);
}
return 2;
......@@ -119,22 +121,6 @@ static void stork_pcmcia_socket_state(int sock, struct pcmcia_state *state)
}
}
static int stork_pcmcia_get_irq_info(struct pcmcia_irq_info *info)
{
switch (info->sock) {
case 0:
info->irq=IRQ_GPIO_STORK_PCMCIA_A_RDY;
break;
case 1:
info->irq=IRQ_GPIO_STORK_PCMCIA_B_RDY;
break;
default:
return -1;
}
return 0;
}
static int stork_pcmcia_configure_socket(int sock, const struct pcmcia_configure *configure)
{
unsigned long flags;
......@@ -231,7 +217,6 @@ static struct pcmcia_low_level stork_pcmcia_ops = {
.init = stork_pcmcia_init,
.shutdown = stork_pcmcia_shutdown,
.socket_state = stork_pcmcia_socket_state,
.get_irq_info = stork_pcmcia_get_irq_info,
.configure_socket = stork_pcmcia_configure_socket,
.socket_init = stork_pcmcia_socket_init,
......
......@@ -50,6 +50,9 @@
int system3_pcmcia_init(struct pcmcia_init *init)
{
init->socket_irq[0] = IRQ_S0_READY_NINT;
init->socket_irq[1] = IRQ_S1_READY_NINT;
/* Don't need no CD and BVD* interrupts */
return 2;
}
......@@ -105,7 +108,6 @@ struct pcmcia_low_level system3_pcmcia_ops = {
.init = system3_pcmcia_init,
.shutdown = system3_pcmcia_shutdown,
.socket_state = system3_pcmcia_socket_state,
.get_irq_info = sa1111_pcmcia_get_irq_info,
.configure_socket = system3_pcmcia_configure_socket,
.socket_init = sa1111_pcmcia_socket_init,
......
......@@ -31,6 +31,8 @@ static int trizeps_pcmcia_init(struct pcmcia_init *init)
{
int res;
init->socket_irq[0] = TRIZEPS_IRQ_PCMCIA_IRQ0;
/* Enable CF bus: */
TRIZEPS_BCR_clear(TRIZEPS_BCR1, TRIZEPS_nPCM_ENA_REG);
......@@ -96,24 +98,6 @@ static void trizeps_pcmcia_socket_state(int sock, struct pcmcia_state *state_arr
}
}
/**
*
*
******************************************************/
static int trizeps_pcmcia_get_irq_info(struct pcmcia_irq_info *info){
switch (info->sock) {
case 0:
info->irq=TRIZEPS_IRQ_PCMCIA_IRQ0;
break;
case 1:
// MFTB2 use only one Slot
default:
return -1;
}
return 0;
}
/**
*
*
......@@ -192,7 +176,6 @@ struct pcmcia_low_level trizeps_pcmcia_ops = {
.init = trizeps_pcmcia_init,
.shutdown = trizeps_pcmcia_shutdown,
.socket_state = trizeps_pcmcia_socket_state,
.get_irq_info = trizeps_pcmcia_get_irq_info,
.configure_socket = trizeps_pcmcia_configure_socket,
.socket_init = trizeps_pcmcia_socket_init,
.socket_suspend = trizeps_pcmcia_socket_suspend,
......
......@@ -138,7 +138,6 @@ static struct pcmcia_low_level xp860_pcmcia_ops = {
.init = xp860_pcmcia_init,
.shutdown = sa1111_pcmcia_shutdown,
.socket_state = sa1111_pcmcia_socket_state,
.get_irq_info = sa1111_pcmcia_get_irq_info,
.configure_socket = xp860_pcmcia_configure_socket,
.socket_init = sa1111_pcmcia_socket_init,
......
......@@ -40,6 +40,8 @@ static int yopy_pcmcia_init(struct pcmcia_init *init)
{
int i, res;
init->socket_irq[0] = IRQ_CF_IREQ;
pcmcia_power(0);
pcmcia_reset(1);
......@@ -97,16 +99,6 @@ static void yopy_pcmcia_socket_state(int sock, struct pcmcia_state_array *state)
}
}
static int yopy_pcmcia_get_irq_info(struct pcmcia_irq_info *info)
{
if (info->sock != 0)
return -1;
info->irq = IRQ_CF_IREQ;
return 0;
}
static int yopy_pcmcia_configure_socket(int sock, const struct pcmcia_configure *configure)
{
if (sock != 0)
......@@ -159,7 +151,6 @@ static struct pcmcia_low_level yopy_pcmcia_ops = {
.init = yopy_pcmcia_init,
.shutdown = yopy_pcmcia_shutdown,
.socket_state = yopy_pcmcia_socket_state,
.get_irq_info = yopy_pcmcia_get_irq_info,
.configure_socket = yopy_pcmcia_configure_socket,
.socket_init = yopy_pcmcia_socket_init,
......
......@@ -38,6 +38,11 @@ int sa1111_pcmcia_init(struct pcmcia_init *init)
{
int i, ret;
if (init->socket_irq[0] == NO_IRQ)
init->socket_irq[0] = IRQ_S0_READY_NINT;
if (init->socket_irq[1] == NO_IRQ)
init->socket_irq[1] = IRQ_S1_READY_NINT;
for (i = ret = 0; i < ARRAY_SIZE(irqs); i++) {
ret = request_irq(irqs[i].irq, init->handler, SA_INTERRUPT,
irqs[i].str, NULL);
......@@ -93,19 +98,6 @@ void sa1111_pcmcia_socket_state(int sock, struct pcmcia_state *state)
}
}
int sa1111_pcmcia_get_irq_info(struct pcmcia_irq_info *info)
{
int ret = 0;
switch (info->sock) {
case 0: info->irq = IRQ_S0_READY_NINT; break;
case 1: info->irq = IRQ_S1_READY_NINT; break;
default: ret = 1;
}
return ret;
}
int sa1111_pcmcia_configure_socket(int sock, const struct pcmcia_configure *conf)
{
unsigned int rst, flt, wait, pse, irq, pccr_mask, val;
......
extern int sa1111_pcmcia_init(struct pcmcia_init *);
extern int sa1111_pcmcia_shutdown(void);
extern void sa1111_pcmcia_socket_state(int sock, struct pcmcia_state *);
extern int sa1111_pcmcia_get_irq_info(struct pcmcia_irq_info *);
extern int sa1111_pcmcia_configure_socket(int sock, const struct pcmcia_configure *);
extern int sa1111_pcmcia_socket_init(int);
extern int sa1111_pcmcia_socket_suspend(int);
......
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