Commit 562f3869 authored by Russell King's avatar Russell King

[ARM] Remove more static register accesses from sa1111.c

Use the ioremapped region for accesses to SA1111 IRQ
controller registers.
parent f3b47da1
...@@ -168,14 +168,14 @@ sa1111_irq_handler(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs) ...@@ -168,14 +168,14 @@ sa1111_irq_handler(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs)
{ {
unsigned int stat0, stat1, i; unsigned int stat0, stat1, i;
stat0 = INTSTATCLR0; stat0 = sa1111_readl(desc->data + SA1111_INTSTATCLR0);
stat1 = INTSTATCLR1; stat1 = sa1111_readl(desc->data + SA1111_INTSTATCLR1);
INTSTATCLR0 = stat0; sa1111_writel(stat0, desc->data + SA1111_INTSTATCLR0);
desc->chip->ack(irq); desc->chip->ack(irq);
INTSTATCLR1 = stat1; sa1111_writel(stat1, desc->data + SA1111_INTSTATCLR1);
if (stat0 == 0 && stat1 == 0) { if (stat0 == 0 && stat1 == 0) {
do_bad_IRQ(irq, desc, regs); do_bad_IRQ(irq, desc, regs);
...@@ -203,12 +203,22 @@ static void sa1111_ack_irq(unsigned int irq) ...@@ -203,12 +203,22 @@ static void sa1111_ack_irq(unsigned int irq)
static void sa1111_mask_lowirq(unsigned int irq) static void sa1111_mask_lowirq(unsigned int irq)
{ {
INTEN0 &= ~SA1111_IRQMASK_LO(irq); void *mapbase = get_irq_chipdata(irq);
unsigned long ie0;
ie0 = sa1111_readl(mapbase + SA1111_INTEN0);
ie0 &= ~SA1111_IRQMASK_LO(irq);
writel(ie0, mapbase + SA1111_INTEN0);
} }
static void sa1111_unmask_lowirq(unsigned int irq) static void sa1111_unmask_lowirq(unsigned int irq)
{ {
INTEN0 |= SA1111_IRQMASK_LO(irq); void *mapbase = get_irq_chipdata(irq);
unsigned long ie0;
ie0 = sa1111_readl(mapbase + SA1111_INTEN0);
ie0 |= SA1111_IRQMASK_LO(irq);
sa1111_writel(ie0, mapbase + SA1111_INTEN0);
} }
/* /*
...@@ -221,12 +231,15 @@ static void sa1111_unmask_lowirq(unsigned int irq) ...@@ -221,12 +231,15 @@ static void sa1111_unmask_lowirq(unsigned int irq)
static int sa1111_retrigger_lowirq(unsigned int irq) static int sa1111_retrigger_lowirq(unsigned int irq)
{ {
unsigned int mask = SA1111_IRQMASK_LO(irq); unsigned int mask = SA1111_IRQMASK_LO(irq);
void *mapbase = get_irq_chipdata(irq);
unsigned long ip0;
int i; int i;
ip0 = sa1111_readl(mapbase + SA1111_INTPOL0);
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
INTPOL0 ^= mask; sa1111_writel(ip0 ^ mask, mapbase + SA1111_INTPOL0);
INTPOL0 ^= mask; sa1111_writel(ip0, mapbase + SA1111_INTPOL0);
if (INTSTATCLR1 & mask) if (sa1111_readl(mapbase + SA1111_INTSTATCLR1) & mask)
break; break;
} }
...@@ -239,6 +252,8 @@ static int sa1111_retrigger_lowirq(unsigned int irq) ...@@ -239,6 +252,8 @@ static int sa1111_retrigger_lowirq(unsigned int irq)
static int sa1111_type_lowirq(unsigned int irq, unsigned int flags) static int sa1111_type_lowirq(unsigned int irq, unsigned int flags)
{ {
unsigned int mask = SA1111_IRQMASK_LO(irq); unsigned int mask = SA1111_IRQMASK_LO(irq);
void *mapbase = get_irq_chipdata(irq);
unsigned long ip0;
if (flags == IRQT_PROBE) if (flags == IRQT_PROBE)
return 0; return 0;
...@@ -246,11 +261,13 @@ static int sa1111_type_lowirq(unsigned int irq, unsigned int flags) ...@@ -246,11 +261,13 @@ static int sa1111_type_lowirq(unsigned int irq, unsigned int flags)
if ((!(flags & __IRQT_RISEDGE) ^ !(flags & __IRQT_FALEDGE)) == 0) if ((!(flags & __IRQT_RISEDGE) ^ !(flags & __IRQT_FALEDGE)) == 0)
return -EINVAL; return -EINVAL;
ip0 = sa1111_readl(mapbase + SA1111_INTPOL0);
if (flags & __IRQT_RISEDGE) if (flags & __IRQT_RISEDGE)
INTPOL0 &= ~mask; ip0 &= ~mask;
else else
INTPOL0 |= mask; ip0 |= mask;
WAKE_POL0 = INTPOL0; sa1111_writel(ip0, mapbase + SA1111_INTPOL0);
sa1111_writel(ip0, mapbase + SA1111_WAKEPOL0);
return 0; return 0;
} }
...@@ -258,11 +275,15 @@ static int sa1111_type_lowirq(unsigned int irq, unsigned int flags) ...@@ -258,11 +275,15 @@ static int sa1111_type_lowirq(unsigned int irq, unsigned int flags)
static int sa1111_wake_lowirq(unsigned int irq, unsigned int on) static int sa1111_wake_lowirq(unsigned int irq, unsigned int on)
{ {
unsigned int mask = SA1111_IRQMASK_LO(irq); unsigned int mask = SA1111_IRQMASK_LO(irq);
void *mapbase = get_irq_chipdata(irq);
unsigned long we0;
we0 = sa1111_readl(mapbase + SA1111_WAKEEN0);
if (on) if (on)
WAKE_EN0 |= mask; we0 |= mask;
else else
WAKE_EN0 &= ~mask; we0 &= ~mask;
sa1111_writel(we0, mapbase + SA1111_WAKEEN0);
return 0; return 0;
} }
...@@ -278,12 +299,22 @@ static struct irqchip sa1111_low_chip = { ...@@ -278,12 +299,22 @@ static struct irqchip sa1111_low_chip = {
static void sa1111_mask_highirq(unsigned int irq) static void sa1111_mask_highirq(unsigned int irq)
{ {
INTEN1 &= ~SA1111_IRQMASK_HI(irq); void *mapbase = get_irq_chipdata(irq);
unsigned long ie1;
ie1 = sa1111_readl(mapbase + SA1111_INTEN1);
ie1 &= ~SA1111_IRQMASK_HI(irq);
sa1111_writel(ie1, mapbase + SA1111_INTEN1);
} }
static void sa1111_unmask_highirq(unsigned int irq) static void sa1111_unmask_highirq(unsigned int irq)
{ {
INTEN1 |= SA1111_IRQMASK_HI(irq); void *mapbase = get_irq_chipdata(irq);
unsigned long ie1;
ie1 = sa1111_readl(mapbase + SA1111_INTEN1);
ie1 |= SA1111_IRQMASK_HI(irq);
sa1111_writel(ie1, mapbase + SA1111_INTEN1);
} }
/* /*
...@@ -296,12 +327,15 @@ static void sa1111_unmask_highirq(unsigned int irq) ...@@ -296,12 +327,15 @@ static void sa1111_unmask_highirq(unsigned int irq)
static int sa1111_retrigger_highirq(unsigned int irq) static int sa1111_retrigger_highirq(unsigned int irq)
{ {
unsigned int mask = SA1111_IRQMASK_HI(irq); unsigned int mask = SA1111_IRQMASK_HI(irq);
void *mapbase = get_irq_chipdata(irq);
unsigned long ip1;
int i; int i;
ip1 = sa1111_readl(mapbase + SA1111_INTPOL1);
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
INTPOL1 ^= mask; sa1111_writel(ip1 ^ mask, mapbase + SA1111_INTPOL1);
INTPOL1 ^= mask; sa1111_writel(ip1, mapbase + SA1111_INTPOL1);
if (INTSTATCLR1 & mask) if (sa1111_readl(mapbase + SA1111_INTSTATCLR1) & mask)
break; break;
} }
...@@ -314,6 +348,8 @@ static int sa1111_retrigger_highirq(unsigned int irq) ...@@ -314,6 +348,8 @@ static int sa1111_retrigger_highirq(unsigned int irq)
static int sa1111_type_highirq(unsigned int irq, unsigned int flags) static int sa1111_type_highirq(unsigned int irq, unsigned int flags)
{ {
unsigned int mask = SA1111_IRQMASK_HI(irq); unsigned int mask = SA1111_IRQMASK_HI(irq);
void *mapbase = get_irq_chipdata(irq);
unsigned long ip1;
if (flags == IRQT_PROBE) if (flags == IRQT_PROBE)
return 0; return 0;
...@@ -321,11 +357,13 @@ static int sa1111_type_highirq(unsigned int irq, unsigned int flags) ...@@ -321,11 +357,13 @@ static int sa1111_type_highirq(unsigned int irq, unsigned int flags)
if ((!(flags & __IRQT_RISEDGE) ^ !(flags & __IRQT_FALEDGE)) == 0) if ((!(flags & __IRQT_RISEDGE) ^ !(flags & __IRQT_FALEDGE)) == 0)
return -EINVAL; return -EINVAL;
ip1 = sa1111_readl(mapbase + SA1111_INTPOL1);
if (flags & __IRQT_RISEDGE) if (flags & __IRQT_RISEDGE)
INTPOL1 &= ~mask; ip1 &= ~mask;
else else
INTPOL1 |= mask; ip1 |= mask;
WAKE_POL1 = INTPOL1; sa1111_writel(ip1, mapbase + SA1111_INTPOL1);
sa1111_writel(ip1, mapbase + SA1111_WAKEPOL1);
return 0; return 0;
} }
...@@ -333,11 +371,15 @@ static int sa1111_type_highirq(unsigned int irq, unsigned int flags) ...@@ -333,11 +371,15 @@ static int sa1111_type_highirq(unsigned int irq, unsigned int flags)
static int sa1111_wake_highirq(unsigned int irq, unsigned int on) static int sa1111_wake_highirq(unsigned int irq, unsigned int on)
{ {
unsigned int mask = SA1111_IRQMASK_HI(irq); unsigned int mask = SA1111_IRQMASK_HI(irq);
void *mapbase = get_irq_chipdata(irq);
unsigned long we1;
we1 = sa1111_readl(mapbase + SA1111_WAKEEN1);
if (on) if (on)
WAKE_EN1 |= mask; we1 |= mask;
else else
WAKE_EN1 &= ~mask; we1 &= ~mask;
sa1111_writel(we1, mapbase + SA1111_WAKEEN1);
return 0; return 0;
} }
...@@ -381,12 +423,14 @@ static void __init sa1111_init_irq(struct sa1111_dev *sadev) ...@@ -381,12 +423,14 @@ static void __init sa1111_init_irq(struct sa1111_dev *sadev)
for (irq = IRQ_GPAIN0; irq <= SSPROR; irq++) { for (irq = IRQ_GPAIN0; irq <= SSPROR; irq++) {
set_irq_chip(irq, &sa1111_low_chip); set_irq_chip(irq, &sa1111_low_chip);
set_irq_chipdata(irq, sadev->mapbase);
set_irq_handler(irq, do_edge_IRQ); set_irq_handler(irq, do_edge_IRQ);
set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
} }
for (irq = AUDXMTDMADONEA; irq <= IRQ_S1_BVD1_STSCHG; irq++) { for (irq = AUDXMTDMADONEA; irq <= IRQ_S1_BVD1_STSCHG; irq++) {
set_irq_chip(irq, &sa1111_high_chip); set_irq_chip(irq, &sa1111_high_chip);
set_irq_chipdata(irq, sadev->mapbase);
set_irq_handler(irq, do_edge_IRQ); set_irq_handler(irq, do_edge_IRQ);
set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
} }
...@@ -395,6 +439,7 @@ static void __init sa1111_init_irq(struct sa1111_dev *sadev) ...@@ -395,6 +439,7 @@ static void __init sa1111_init_irq(struct sa1111_dev *sadev)
* Register SA1111 interrupt * Register SA1111 interrupt
*/ */
set_irq_type(sadev->irq[0], IRQT_RISING); set_irq_type(sadev->irq[0], IRQT_RISING);
set_irq_data(sadev->irq[0], sadev->mapbase);
set_irq_chained_handler(sadev->irq[0], sa1111_irq_handler); set_irq_chained_handler(sadev->irq[0], sa1111_irq_handler);
} }
......
...@@ -429,22 +429,6 @@ ...@@ -429,22 +429,6 @@
#define SA1111_WAKEPOL0 0x0034 #define SA1111_WAKEPOL0 0x0034
#define SA1111_WAKEPOL1 0x0038 #define SA1111_WAKEPOL1 0x0038
#define INTTEST0 __CCREG(SA1111_INTC + SA1111_INTTEST0)
#define INTTEST1 __CCREG(SA1111_INTC + SA1111_INTTEST1)
#define INTEN0 __CCREG(SA1111_INTC + SA1111_INTEN0)
#define INTEN1 __CCREG(SA1111_INTC + SA1111_INTEN1)
#define INTPOL0 __CCREG(SA1111_INTC + SA1111_INTPOL0)
#define INTPOL1 __CCREG(SA1111_INTC + SA1111_INTPOL1)
#define INTTSTSEL __CCREG(SA1111_INTC + SA1111_INTTSTSEL)
#define INTSTATCLR0 __CCREG(SA1111_INTC + SA1111_INTSTATCLR0)
#define INTSTATCLR1 __CCREG(SA1111_INTC + SA1111_INTSTATCLR1)
#define INTSET0 __CCREG(SA1111_INTC + SA1111_INTSET0)
#define INTSET1 __CCREG(SA1111_INTC + SA1111_INTSET1)
#define WAKE_EN0 __CCREG(SA1111_INTC + SA1111_WAKEEN0)
#define WAKE_EN1 __CCREG(SA1111_INTC + SA1111_WAKEEN1)
#define WAKE_POL0 __CCREG(SA1111_INTC + SA1111_WAKEPOL0)
#define WAKE_POL1 __CCREG(SA1111_INTC + SA1111_WAKEPOL1)
/* /*
* PS/2 Trackpad and Mouse Interfaces * PS/2 Trackpad and Mouse Interfaces
* *
......
...@@ -54,6 +54,8 @@ struct irqdesc { ...@@ -54,6 +54,8 @@ struct irqdesc {
struct irqchip *chip; struct irqchip *chip;
struct irqaction *action; struct irqaction *action;
struct list_head pend; struct list_head pend;
void *chipdata;
void *data;
unsigned int disable_depth; unsigned int disable_depth;
unsigned int triggered: 1; /* IRQ has occurred */ unsigned int triggered: 1; /* IRQ has occurred */
...@@ -88,6 +90,9 @@ void __set_irq_handler(unsigned int irq, irq_handler_t, int); ...@@ -88,6 +90,9 @@ void __set_irq_handler(unsigned int irq, irq_handler_t, int);
*/ */
#define set_irq_handler(irq,handler) __set_irq_handler(irq,handler,0) #define set_irq_handler(irq,handler) __set_irq_handler(irq,handler,0)
#define set_irq_chained_handler(irq,handler) __set_irq_handler(irq,handler,1) #define set_irq_chained_handler(irq,handler) __set_irq_handler(irq,handler,1)
#define set_irq_data(irq,d) do { irq_desc[irq].data = d; } while (0)
#define set_irq_chipdata(irq,d) do { irq_desc[irq].chipdata = d; } while (0)
#define get_irq_chipdata(irq) (irq_desc[irq].chipdata)
void set_irq_chip(unsigned int irq, struct irqchip *); void set_irq_chip(unsigned int irq, struct irqchip *);
void set_irq_flags(unsigned int irq, unsigned int flags); void set_irq_flags(unsigned int irq, unsigned int flags);
......
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