aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-orion5x/irq.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-orion5x/irq.c')
-rw-r--r--arch/arm/mach-orion5x/irq.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/arch/arm/mach-orion5x/irq.c b/arch/arm/mach-orion5x/irq.c
index 632a36f5cf14..6b2f1353797e 100644
--- a/arch/arm/mach-orion5x/irq.c
+++ b/arch/arm/mach-orion5x/irq.c
@@ -22,7 +22,7 @@
22/***************************************************************************** 22/*****************************************************************************
23 * Orion GPIO IRQ 23 * Orion GPIO IRQ
24 * 24 *
25 * GPIO_IN_POL register controlls whether GPIO_DATA_IN will hold the same 25 * GPIO_IN_POL register controls whether GPIO_DATA_IN will hold the same
26 * value of the line or the opposite value. 26 * value of the line or the opposite value.
27 * 27 *
28 * Level IRQ handlers: DATA_IN is used directly as cause register. 28 * Level IRQ handlers: DATA_IN is used directly as cause register.
@@ -82,7 +82,7 @@ static int orion5x_gpio_set_irq_type(u32 irq, u32 type)
82 int pin = irq_to_gpio(irq); 82 int pin = irq_to_gpio(irq);
83 struct irq_desc *desc; 83 struct irq_desc *desc;
84 84
85 if ((readl(GPIO_IO_CONF) & (1 << pin)) == 0) { 85 if ((readl(GPIO_IO_CONF(pin)) & (1 << pin)) == 0) {
86 printk(KERN_ERR "orion5x_gpio_set_irq_type failed " 86 printk(KERN_ERR "orion5x_gpio_set_irq_type failed "
87 "(irq %d, pin %d).\n", irq, pin); 87 "(irq %d, pin %d).\n", irq, pin);
88 return -EINVAL; 88 return -EINVAL;
@@ -94,22 +94,22 @@ static int orion5x_gpio_set_irq_type(u32 irq, u32 type)
94 case IRQ_TYPE_LEVEL_HIGH: 94 case IRQ_TYPE_LEVEL_HIGH:
95 desc->handle_irq = handle_level_irq; 95 desc->handle_irq = handle_level_irq;
96 desc->status |= IRQ_LEVEL; 96 desc->status |= IRQ_LEVEL;
97 orion5x_clrbits(GPIO_IN_POL, (1 << pin)); 97 orion5x_clrbits(GPIO_IN_POL(pin), (1 << pin));
98 break; 98 break;
99 case IRQ_TYPE_LEVEL_LOW: 99 case IRQ_TYPE_LEVEL_LOW:
100 desc->handle_irq = handle_level_irq; 100 desc->handle_irq = handle_level_irq;
101 desc->status |= IRQ_LEVEL; 101 desc->status |= IRQ_LEVEL;
102 orion5x_setbits(GPIO_IN_POL, (1 << pin)); 102 orion5x_setbits(GPIO_IN_POL(pin), (1 << pin));
103 break; 103 break;
104 case IRQ_TYPE_EDGE_RISING: 104 case IRQ_TYPE_EDGE_RISING:
105 desc->handle_irq = handle_edge_irq; 105 desc->handle_irq = handle_edge_irq;
106 desc->status &= ~IRQ_LEVEL; 106 desc->status &= ~IRQ_LEVEL;
107 orion5x_clrbits(GPIO_IN_POL, (1 << pin)); 107 orion5x_clrbits(GPIO_IN_POL(pin), (1 << pin));
108 break; 108 break;
109 case IRQ_TYPE_EDGE_FALLING: 109 case IRQ_TYPE_EDGE_FALLING:
110 desc->handle_irq = handle_edge_irq; 110 desc->handle_irq = handle_edge_irq;
111 desc->status &= ~IRQ_LEVEL; 111 desc->status &= ~IRQ_LEVEL;
112 orion5x_setbits(GPIO_IN_POL, (1 << pin)); 112 orion5x_setbits(GPIO_IN_POL(pin), (1 << pin));
113 break; 113 break;
114 case IRQ_TYPE_EDGE_BOTH: 114 case IRQ_TYPE_EDGE_BOTH:
115 desc->handle_irq = handle_edge_irq; 115 desc->handle_irq = handle_edge_irq;
@@ -117,11 +117,11 @@ static int orion5x_gpio_set_irq_type(u32 irq, u32 type)
117 /* 117 /*
118 * set initial polarity based on current input level 118 * set initial polarity based on current input level
119 */ 119 */
120 if ((readl(GPIO_IN_POL) ^ readl(GPIO_DATA_IN)) 120 if ((readl(GPIO_IN_POL(pin)) ^ readl(GPIO_DATA_IN(pin)))
121 & (1 << pin)) 121 & (1 << pin))
122 orion5x_setbits(GPIO_IN_POL, (1 << pin)); /* falling */ 122 orion5x_setbits(GPIO_IN_POL(pin), (1 << pin)); /* falling */
123 else 123 else
124 orion5x_clrbits(GPIO_IN_POL, (1 << pin)); /* rising */ 124 orion5x_clrbits(GPIO_IN_POL(pin), (1 << pin)); /* rising */
125 125
126 break; 126 break;
127 default: 127 default:
@@ -149,7 +149,7 @@ static void orion5x_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
149 149
150 BUG_ON(irq < IRQ_ORION5X_GPIO_0_7 || irq > IRQ_ORION5X_GPIO_24_31); 150 BUG_ON(irq < IRQ_ORION5X_GPIO_0_7 || irq > IRQ_ORION5X_GPIO_24_31);
151 offs = (irq - IRQ_ORION5X_GPIO_0_7) * 8; 151 offs = (irq - IRQ_ORION5X_GPIO_0_7) * 8;
152 cause = (readl(GPIO_DATA_IN) & readl(GPIO_LEVEL_MASK)) | 152 cause = (readl(GPIO_DATA_IN(offs)) & readl(GPIO_LEVEL_MASK)) |
153 (readl(GPIO_EDGE_CAUSE) & readl(GPIO_EDGE_MASK)); 153 (readl(GPIO_EDGE_CAUSE) & readl(GPIO_EDGE_MASK));
154 154
155 for (pin = offs; pin < offs + 8; pin++) { 155 for (pin = offs; pin < offs + 8; pin++) {
@@ -158,9 +158,9 @@ static void orion5x_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
158 desc = irq_desc + irq; 158 desc = irq_desc + irq;
159 if ((desc->status & IRQ_TYPE_SENSE_MASK) == IRQ_TYPE_EDGE_BOTH) { 159 if ((desc->status & IRQ_TYPE_SENSE_MASK) == IRQ_TYPE_EDGE_BOTH) {
160 /* Swap polarity (race with GPIO line) */ 160 /* Swap polarity (race with GPIO line) */
161 u32 polarity = readl(GPIO_IN_POL); 161 u32 polarity = readl(GPIO_IN_POL(pin));
162 polarity ^= 1 << pin; 162 polarity ^= 1 << pin;
163 writel(polarity, GPIO_IN_POL); 163 writel(polarity, GPIO_IN_POL(pin));
164 } 164 }
165 generic_handle_irq(irq); 165 generic_handle_irq(irq);
166 } 166 }