PCMCIA: sa1111: use new per-socket irq/gpio infrastructure

Convert sa1111 PCMCIA drivers to use the new per-socket irq/gpio
infrastructure.  As the core takes care of handling the IRQs, we
can get rid of sa1111_pcmcia_socket_init(), sa1111_pcmcia_socket_suspend(),
sa1111_pcmcia_hw_init() and sa1111_pcmcia_hw_shutdown(), as well
as the private IRQ table.

We remove the NCR_0 setting in Neponset, as this is duplicating
what's already done via configure_socket in suspend.

Acked-by: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
This commit is contained in:
Russell King 2011-12-19 23:04:22 +00:00
parent a9bb5a4bf9
commit 81f33c65e6
6 changed files with 13 additions and 52 deletions

View File

@ -202,7 +202,6 @@ lubbock_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
static struct pcmcia_low_level lubbock_pcmcia_ops = {
.owner = THIS_MODULE,
.configure_socket = lubbock_pcmcia_configure_socket,
.socket_init = sa1111_pcmcia_socket_init,
.first = 0,
.nr = 2,
};

View File

@ -128,7 +128,6 @@ badge4_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state
static struct pcmcia_low_level badge4_pcmcia_ops = {
.owner = THIS_MODULE,
.configure_socket = badge4_pcmcia_configure_socket,
.socket_init = sa1111_pcmcia_socket_init,
.first = 0,
.nr = 2,
};

View File

@ -92,7 +92,6 @@ jornada720_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_s
static struct pcmcia_low_level jornada720_pcmcia_ops = {
.owner = THIS_MODULE,
.configure_socket = jornada720_pcmcia_configure_socket,
.socket_init = sa1111_pcmcia_socket_init,
.first = 0,
.nr = 2,
};

View File

@ -106,18 +106,9 @@ neponset_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_sta
return 0;
}
static void neponset_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
{
if (skt->nr == 0)
NCR_0 &= ~(NCR_A0VPP | NCR_A1VPP);
sa1111_pcmcia_socket_init(skt);
}
static struct pcmcia_low_level neponset_pcmcia_ops = {
.owner = THIS_MODULE,
.configure_socket = neponset_pcmcia_configure_socket,
.socket_init = neponset_pcmcia_socket_init,
.first = 0,
.nr = 2,
};

View File

@ -29,23 +29,6 @@
#define IDX_IRQ_S1_CD_VALID (4)
#define IDX_IRQ_S1_BVD1_STSCHG (5)
static struct pcmcia_irqs irqs[] = {
{ 0, NO_IRQ, "SA1111 PCMCIA card detect" },
{ 0, NO_IRQ, "SA1111 PCMCIA BVD1" },
{ 1, NO_IRQ, "SA1111 CF card detect" },
{ 1, NO_IRQ, "SA1111 CF BVD1" },
};
static int sa1111_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
{
return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
}
static void sa1111_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
{
soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
}
void sa1111_pcmcia_socket_state(struct soc_pcmcia_socket *skt, struct pcmcia_state *state)
{
struct sa1111_pcmcia_socket *s = to_skt(skt);
@ -114,26 +97,13 @@ int sa1111_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_s
return 0;
}
void sa1111_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
{
soc_pcmcia_enable_irqs(skt, irqs, ARRAY_SIZE(irqs));
}
static void sa1111_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
{
soc_pcmcia_disable_irqs(skt, irqs, ARRAY_SIZE(irqs));
}
int sa1111_pcmcia_add(struct sa1111_dev *dev, struct pcmcia_low_level *ops,
int (*add)(struct soc_pcmcia_socket *))
{
struct sa1111_pcmcia_socket *s;
int i, ret = 0;
ops->hw_init = sa1111_pcmcia_hw_init;
ops->hw_shutdown = sa1111_pcmcia_hw_shutdown;
ops->socket_state = sa1111_pcmcia_socket_state;
ops->socket_suspend = sa1111_pcmcia_socket_suspend;
for (i = 0; i < ops->nr; i++) {
s = kzalloc(sizeof(*s), GFP_KERNEL);
@ -142,10 +112,20 @@ int sa1111_pcmcia_add(struct sa1111_dev *dev, struct pcmcia_low_level *ops,
s->soc.nr = ops->first + i;
soc_pcmcia_init_one(&s->soc, ops, &dev->dev);
s->soc.socket.pci_irq = s->soc.nr ?
dev->irq[IDX_IRQ_S0_READY_NINT] :
dev->irq[IDX_IRQ_S1_READY_NINT];
s->dev = dev;
if (s->soc.nr) {
s->soc.socket.pci_irq = dev->irq[IDX_IRQ_S1_READY_NINT];
s->soc.stat[SOC_STAT_CD].irq = dev->irq[IDX_IRQ_S1_CD_VALID];
s->soc.stat[SOC_STAT_CD].name = "SA1111 CF card detect";
s->soc.stat[SOC_STAT_BVD1].irq = dev->irq[IDX_IRQ_S1_BVD1_STSCHG];
s->soc.stat[SOC_STAT_BVD1].name = "SA1111 CF BVD1";
} else {
s->soc.socket.pci_irq = dev->irq[IDX_IRQ_S0_READY_NINT];
s->soc.stat[SOC_STAT_CD].irq = dev->irq[IDX_IRQ_S0_CD_VALID];
s->soc.stat[SOC_STAT_CD].name = "SA1111 PCMCIA card detect";
s->soc.stat[SOC_STAT_BVD1].irq = dev->irq[IDX_IRQ_S0_BVD1_STSCHG];
s->soc.stat[SOC_STAT_BVD1].name = "SA1111 PCMCIA BVD1";
}
ret = add(&s->soc);
if (ret == 0) {
@ -170,12 +150,6 @@ static int pcmcia_probe(struct sa1111_dev *dev)
base = dev->mapbase;
/* Initialize PCMCIA IRQs */
irqs[0].irq = dev->irq[IDX_IRQ_S0_CD_VALID];
irqs[1].irq = dev->irq[IDX_IRQ_S0_BVD1_STSCHG];
irqs[2].irq = dev->irq[IDX_IRQ_S1_CD_VALID];
irqs[3].irq = dev->irq[IDX_IRQ_S1_BVD1_STSCHG];
/*
* Initialise the suspend state.
*/

View File

@ -17,7 +17,6 @@ int sa1111_pcmcia_add(struct sa1111_dev *dev, struct pcmcia_low_level *ops,
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 int pcmcia_badge4_init(struct device *);
extern int pcmcia_jornada720_init(struct device *);