aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/common/locomo.c53
-rw-r--r--arch/arm/include/asm/hardware/locomo.h4
-rw-r--r--arch/arm/mach-pxa/include/mach/irqs.h6
-rw-r--r--arch/arm/mach-pxa/poodle.c7
-rw-r--r--arch/arm/mach-sa1100/collie.c4
-rw-r--r--arch/arm/mach-sa1100/include/mach/irqs.h13
6 files changed, 48 insertions, 39 deletions
diff --git a/arch/arm/common/locomo.c b/arch/arm/common/locomo.c
index d8a1261f029c..90ae00b631c2 100644
--- a/arch/arm/common/locomo.c
+++ b/arch/arm/common/locomo.c
@@ -32,6 +32,12 @@
32 32
33#include <asm/hardware/locomo.h> 33#include <asm/hardware/locomo.h>
34 34
35/* LoCoMo Interrupts */
36#define IRQ_LOCOMO_KEY (0)
37#define IRQ_LOCOMO_GPIO (1)
38#define IRQ_LOCOMO_LT (2)
39#define IRQ_LOCOMO_SPI (3)
40
35/* M62332 output channel selection */ 41/* M62332 output channel selection */
36#define M62332_EVR_CH 1 /* M62332 volume channel number */ 42#define M62332_EVR_CH 1 /* M62332 volume channel number */
37 /* 0 : CH.1 , 1 : CH. 2 */ 43 /* 0 : CH.1 , 1 : CH. 2 */
@@ -58,6 +64,7 @@ struct locomo {
58 struct device *dev; 64 struct device *dev;
59 unsigned long phys; 65 unsigned long phys;
60 unsigned int irq; 66 unsigned int irq;
67 int irq_base;
61 spinlock_t lock; 68 spinlock_t lock;
62 void __iomem *base; 69 void __iomem *base;
63#ifdef CONFIG_PM 70#ifdef CONFIG_PM
@@ -81,9 +88,7 @@ struct locomo_dev_info {
81static struct locomo_dev_info locomo_devices[] = { 88static struct locomo_dev_info locomo_devices[] = {
82 { 89 {
83 .devid = LOCOMO_DEVID_KEYBOARD, 90 .devid = LOCOMO_DEVID_KEYBOARD,
84 .irq = { 91 .irq = { IRQ_LOCOMO_KEY },
85 IRQ_LOCOMO_KEY,
86 },
87 .name = "locomo-keyboard", 92 .name = "locomo-keyboard",
88 .offset = LOCOMO_KEYBOARD, 93 .offset = LOCOMO_KEYBOARD,
89 .length = 16, 94 .length = 16,
@@ -135,18 +140,18 @@ static struct locomo_dev_info locomo_devices[] = {
135 140
136static void locomo_handler(unsigned int irq, struct irq_desc *desc) 141static void locomo_handler(unsigned int irq, struct irq_desc *desc)
137{ 142{
143 struct locomo *lchip = get_irq_chip_data(irq);
138 int req, i; 144 int req, i;
139 void __iomem *mapbase = get_irq_chip_data(irq);
140 145
141 /* Acknowledge the parent IRQ */ 146 /* Acknowledge the parent IRQ */
142 desc->chip->ack(irq); 147 desc->chip->ack(irq);
143 148
144 /* check why this interrupt was generated */ 149 /* check why this interrupt was generated */
145 req = locomo_readl(mapbase + LOCOMO_ICR) & 0x0f00; 150 req = locomo_readl(lchip->base + LOCOMO_ICR) & 0x0f00;
146 151
147 if (req) { 152 if (req) {
148 /* generate the next interrupt(s) */ 153 /* generate the next interrupt(s) */
149 irq = IRQ_LOCOMO_KEY; 154 irq = lchip->irq_base;
150 for (i = 0; i <= 3; i++, irq++) { 155 for (i = 0; i <= 3; i++, irq++) {
151 if (req & (0x0100 << i)) { 156 if (req & (0x0100 << i)) {
152 generic_handle_irq(irq); 157 generic_handle_irq(irq);
@@ -162,20 +167,20 @@ static void locomo_ack_irq(unsigned int irq)
162 167
163static void locomo_mask_irq(unsigned int irq) 168static void locomo_mask_irq(unsigned int irq)
164{ 169{
165 void __iomem *mapbase = get_irq_chip_data(irq); 170 struct locomo *lchip = get_irq_chip_data(irq);
166 unsigned int r; 171 unsigned int r;
167 r = locomo_readl(mapbase + LOCOMO_ICR); 172 r = locomo_readl(lchip->base + LOCOMO_ICR);
168 r &= ~(0x0010 << (irq - IRQ_LOCOMO_KEY)); 173 r &= ~(0x0010 << (irq - lchip->irq_base));
169 locomo_writel(r, mapbase + LOCOMO_ICR); 174 locomo_writel(r, lchip->base + LOCOMO_ICR);
170} 175}
171 176
172static void locomo_unmask_irq(unsigned int irq) 177static void locomo_unmask_irq(unsigned int irq)
173{ 178{
174 void __iomem *mapbase = get_irq_chip_data(irq); 179 struct locomo *lchip = get_irq_chip_data(irq);
175 unsigned int r; 180 unsigned int r;
176 r = locomo_readl(mapbase + LOCOMO_ICR); 181 r = locomo_readl(lchip->base + LOCOMO_ICR);
177 r |= (0x0010 << (irq - IRQ_LOCOMO_KEY)); 182 r |= (0x0010 << (irq - lchip->irq_base));
178 locomo_writel(r, mapbase + LOCOMO_ICR); 183 locomo_writel(r, lchip->base + LOCOMO_ICR);
179} 184}
180 185
181static struct irq_chip locomo_chip = { 186static struct irq_chip locomo_chip = {
@@ -187,21 +192,20 @@ static struct irq_chip locomo_chip = {
187 192
188static void locomo_setup_irq(struct locomo *lchip) 193static void locomo_setup_irq(struct locomo *lchip)
189{ 194{
190 int irq; 195 int irq = lchip->irq_base;
191 void __iomem *irqbase = lchip->base;
192 196
193 /* 197 /*
194 * Install handler for IRQ_LOCOMO_HW. 198 * Install handler for IRQ_LOCOMO_HW.
195 */ 199 */
196 set_irq_type(lchip->irq, IRQ_TYPE_EDGE_FALLING); 200 set_irq_type(lchip->irq, IRQ_TYPE_EDGE_FALLING);
197 set_irq_chip_data(lchip->irq, irqbase); 201 set_irq_chip_data(lchip->irq, lchip);
198 set_irq_chained_handler(lchip->irq, locomo_handler); 202 set_irq_chained_handler(lchip->irq, locomo_handler);
199 203
200 /* install handlers for IRQ_LOCOMO_* */ 204 /* Install handlers for IRQ_LOCOMO_* */
201 for (irq = IRQ_LOCOMO_KEY; irq < IRQ_LOCOMO_KEY + 4; irq++) { 205 for ( ; irq <= lchip->irq_base + 3; irq++) {
202 set_irq_chip(irq, &locomo_chip); 206 set_irq_chip(irq, &locomo_chip);
203 set_irq_chip_data(irq, irqbase); 207 set_irq_chip_data(irq, lchip);
204 set_irq_handler(irq, handle_edge_irq); 208 set_irq_handler(irq, handle_level_irq);
205 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); 209 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
206 } 210 }
207} 211}
@@ -248,7 +252,8 @@ locomo_init_one_child(struct locomo *lchip, struct locomo_dev_info *info)
248 dev->mapbase = 0; 252 dev->mapbase = 0;
249 dev->length = info->length; 253 dev->length = info->length;
250 254
251 memmove(dev->irq, info->irq, sizeof(dev->irq)); 255 dev->irq[0] = (lchip->irq_base == NO_IRQ) ?
256 NO_IRQ : lchip->irq_base + info->irq[0];
252 257
253 ret = device_register(&dev->dev); 258 ret = device_register(&dev->dev);
254 if (ret) { 259 if (ret) {
@@ -365,6 +370,7 @@ static int locomo_resume(struct platform_device *dev)
365static int 370static int
366__locomo_probe(struct device *me, struct resource *mem, int irq) 371__locomo_probe(struct device *me, struct resource *mem, int irq)
367{ 372{
373 struct locomo_platform_data *pdata = me->platform_data;
368 struct locomo *lchip; 374 struct locomo *lchip;
369 unsigned long r; 375 unsigned long r;
370 int i, ret = -ENODEV; 376 int i, ret = -ENODEV;
@@ -380,6 +386,7 @@ __locomo_probe(struct device *me, struct resource *mem, int irq)
380 386
381 lchip->phys = mem->start; 387 lchip->phys = mem->start;
382 lchip->irq = irq; 388 lchip->irq = irq;
389 lchip->irq_base = (pdata) ? pdata->irq_base : NO_IRQ;
383 390
384 /* 391 /*
385 * Map the whole region. This also maps the 392 * Map the whole region. This also maps the
@@ -446,7 +453,7 @@ __locomo_probe(struct device *me, struct resource *mem, int irq)
446 * The interrupt controller must be initialised before any 453 * The interrupt controller must be initialised before any
447 * other device to ensure that the interrupts are available. 454 * other device to ensure that the interrupts are available.
448 */ 455 */
449 if (lchip->irq != NO_IRQ) 456 if (lchip->irq != NO_IRQ && lchip->irq_base != NO_IRQ)
450 locomo_setup_irq(lchip); 457 locomo_setup_irq(lchip);
451 458
452 for (i = 0; i < ARRAY_SIZE(locomo_devices); i++) 459 for (i = 0; i < ARRAY_SIZE(locomo_devices); i++)
diff --git a/arch/arm/include/asm/hardware/locomo.h b/arch/arm/include/asm/hardware/locomo.h
index 954b1be991b4..74e51d6bd93f 100644
--- a/arch/arm/include/asm/hardware/locomo.h
+++ b/arch/arm/include/asm/hardware/locomo.h
@@ -214,4 +214,8 @@ void locomo_m62332_senddata(struct locomo_dev *ldev, unsigned int dac_data, int
214/* Frontlight control */ 214/* Frontlight control */
215void locomo_frontlight_set(struct locomo_dev *dev, int duty, int vr, int bpwf); 215void locomo_frontlight_set(struct locomo_dev *dev, int duty, int vr, int bpwf);
216 216
217struct locomo_platform_data {
218 int irq_base; /* IRQ base for cascaded on-chip IRQs */
219};
220
217#endif 221#endif
diff --git a/arch/arm/mach-pxa/include/mach/irqs.h b/arch/arm/mach-pxa/include/mach/irqs.h
index 56a2c6131a7c..83b14f193a63 100644
--- a/arch/arm/mach-pxa/include/mach/irqs.h
+++ b/arch/arm/mach-pxa/include/mach/irqs.h
@@ -247,12 +247,6 @@
247#define BALLOON3_CODEC_IRQ IRQ_GPIO(BALLOON3_GPIO_CODEC_IRQ) 247#define BALLOON3_CODEC_IRQ IRQ_GPIO(BALLOON3_GPIO_CODEC_IRQ)
248#define BALLOON3_S0_CD_IRQ IRQ_GPIO(BALLOON3_GPIO_S0_CD) 248#define BALLOON3_S0_CD_IRQ IRQ_GPIO(BALLOON3_GPIO_S0_CD)
249 249
250/* LoCoMo Interrupts (CONFIG_SHARP_LOCOMO) */
251#define IRQ_LOCOMO_KEY (IRQ_BOARD_START + 0)
252#define IRQ_LOCOMO_GPIO (IRQ_BOARD_START + 1)
253#define IRQ_LOCOMO_LT (IRQ_BOARD_START + 2)
254#define IRQ_LOCOMO_SPI (IRQ_BOARD_START + 3)
255
256/* phyCORE-PXA270 (PCM027) Interrupts */ 250/* phyCORE-PXA270 (PCM027) Interrupts */
257#define PCM027_IRQ(x) (IRQ_BOARD_START + (x)) 251#define PCM027_IRQ(x) (IRQ_BOARD_START + (x))
258#define PCM027_BTDET_IRQ PCM027_IRQ(0) 252#define PCM027_BTDET_IRQ PCM027_IRQ(0)
diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c
index 1b9d7450ae21..d58a52415d75 100644
--- a/arch/arm/mach-pxa/poodle.c
+++ b/arch/arm/mach-pxa/poodle.c
@@ -174,11 +174,18 @@ static struct resource locomo_resources[] = {
174 }, 174 },
175}; 175};
176 176
177static struct locomo_platform_data locomo_info = {
178 .irq_base = IRQ_BOARD_START,
179};
180
177struct platform_device poodle_locomo_device = { 181struct platform_device poodle_locomo_device = {
178 .name = "locomo", 182 .name = "locomo",
179 .id = 0, 183 .id = 0,
180 .num_resources = ARRAY_SIZE(locomo_resources), 184 .num_resources = ARRAY_SIZE(locomo_resources),
181 .resource = locomo_resources, 185 .resource = locomo_resources,
186 .dev = {
187 .platform_data = &locomo_info,
188 },
182}; 189};
183 190
184EXPORT_SYMBOL(poodle_locomo_device); 191EXPORT_SYMBOL(poodle_locomo_device);
diff --git a/arch/arm/mach-sa1100/collie.c b/arch/arm/mach-sa1100/collie.c
index 9982c5c28edf..5d5f330c5d94 100644
--- a/arch/arm/mach-sa1100/collie.c
+++ b/arch/arm/mach-sa1100/collie.c
@@ -234,6 +234,10 @@ static struct resource locomo_resources[] = {
234 }, 234 },
235}; 235};
236 236
237static struct locomo_platform_data locomo_info = {
238 .irq_base = IRQ_BOARD_START,
239};
240
237struct platform_device collie_locomo_device = { 241struct platform_device collie_locomo_device = {
238 .name = "locomo", 242 .name = "locomo",
239 .id = 0, 243 .id = 0,
diff --git a/arch/arm/mach-sa1100/include/mach/irqs.h b/arch/arm/mach-sa1100/include/mach/irqs.h
index 40d3382218f0..6e51b549a4d1 100644
--- a/arch/arm/mach-sa1100/include/mach/irqs.h
+++ b/arch/arm/mach-sa1100/include/mach/irqs.h
@@ -124,13 +124,13 @@
124 * Figure out the MAX IRQ number. 124 * Figure out the MAX IRQ number.
125 * 125 *
126 * If we have an SA1111, the max IRQ is S1_BVD1_STSCHG+1. 126 * If we have an SA1111, the max IRQ is S1_BVD1_STSCHG+1.
127 * If we have an LoCoMo, the max IRQ is IRQ_LOCOMO_SPI_TEND+1 127 * If we have an LoCoMo, the max IRQ is IRQ_BOARD_START + 4
128 * Otherwise, we have the standard IRQs only. 128 * Otherwise, we have the standard IRQs only.
129 */ 129 */
130#ifdef CONFIG_SA1111 130#ifdef CONFIG_SA1111
131#define NR_IRQS (IRQ_S1_BVD1_STSCHG + 1) 131#define NR_IRQS (IRQ_S1_BVD1_STSCHG + 1)
132#elif defined(CONFIG_SHARP_LOCOMO) 132#elif defined(CONFIG_SHARPSL_LOCOMO)
133#define NR_IRQS (IRQ_LOCOMO_SPI + 1) 133#define NR_IRQS (IRQ_BOARD_START + 4)
134#else 134#else
135#define NR_IRQS (IRQ_BOARD_START) 135#define NR_IRQS (IRQ_BOARD_START)
136#endif 136#endif
@@ -142,10 +142,3 @@
142#define IRQ_NEPONSET_SMC9196 (IRQ_BOARD_START + 0) 142#define IRQ_NEPONSET_SMC9196 (IRQ_BOARD_START + 0)
143#define IRQ_NEPONSET_USAR (IRQ_BOARD_START + 1) 143#define IRQ_NEPONSET_USAR (IRQ_BOARD_START + 1)
144#define IRQ_NEPONSET_SA1111 (IRQ_BOARD_START + 2) 144#define IRQ_NEPONSET_SA1111 (IRQ_BOARD_START + 2)
145
146/* LoCoMo Interrupts (CONFIG_SHARP_LOCOMO) */
147#define IRQ_LOCOMO_KEY (IRQ_BOARD_START + 0)
148#define IRQ_LOCOMO_GPIO_BASE (IRQ_BOARD_START + 1)
149#define IRQ_LOCOMO_LT_BASE (IRQ_BOARD_START + 2)
150#define IRQ_LOCOMO_SPI_BASE (IRQ_BOARD_START + 3)
151