···32323333#include <asm/hardware/locomo.h>34343535+/* LoCoMo Interrupts */3636+#define IRQ_LOCOMO_KEY (0)3737+#define IRQ_LOCOMO_GPIO (1)3838+#define IRQ_LOCOMO_LT (2)3939+#define IRQ_LOCOMO_SPI (3)4040+3541/* M62332 output channel selection */3642#define M62332_EVR_CH 1 /* M62332 volume channel number */3743 /* 0 : CH.1 , 1 : CH. 2 */···6458 struct device *dev;6559 unsigned long phys;6660 unsigned int irq;6161+ int irq_base;6762 spinlock_t lock;6863 void __iomem *base;6964#ifdef CONFIG_PM···8881static struct locomo_dev_info locomo_devices[] = {8982 {9083 .devid = LOCOMO_DEVID_KEYBOARD,9191- .irq = {9292- IRQ_LOCOMO_KEY,9393- },8484+ .irq = { IRQ_LOCOMO_KEY },9485 .name = "locomo-keyboard",9586 .offset = LOCOMO_KEYBOARD,9687 .length = 16,···140135141136static void locomo_handler(unsigned int irq, struct irq_desc *desc)142137{138138+ struct locomo *lchip = get_irq_chip_data(irq);143139 int req, i;144144- void __iomem *mapbase = get_irq_chip_data(irq);145140146141 /* Acknowledge the parent IRQ */147142 desc->chip->ack(irq);148143149144 /* check why this interrupt was generated */150150- req = locomo_readl(mapbase + LOCOMO_ICR) & 0x0f00;145145+ req = locomo_readl(lchip->base + LOCOMO_ICR) & 0x0f00;151146152147 if (req) {153148 /* generate the next interrupt(s) */154154- irq = IRQ_LOCOMO_KEY;149149+ irq = lchip->irq_base;155150 for (i = 0; i <= 3; i++, irq++) {156151 if (req & (0x0100 << i)) {157152 generic_handle_irq(irq);···167162168163static void locomo_mask_irq(unsigned int irq)169164{170170- void __iomem *mapbase = get_irq_chip_data(irq);165165+ struct locomo *lchip = get_irq_chip_data(irq);171166 unsigned int r;172172- r = locomo_readl(mapbase + LOCOMO_ICR);173173- r &= ~(0x0010 << (irq - IRQ_LOCOMO_KEY));174174- locomo_writel(r, mapbase + LOCOMO_ICR);167167+ r = locomo_readl(lchip->base + LOCOMO_ICR);168168+ r &= ~(0x0010 << (irq - lchip->irq_base));169169+ locomo_writel(r, lchip->base + LOCOMO_ICR);175170}176171177172static void locomo_unmask_irq(unsigned int irq)178173{179179- void __iomem *mapbase = get_irq_chip_data(irq);174174+ struct locomo *lchip = get_irq_chip_data(irq);180175 unsigned int r;181181- r = locomo_readl(mapbase + LOCOMO_ICR);182182- r |= (0x0010 << (irq - IRQ_LOCOMO_KEY));183183- locomo_writel(r, mapbase + LOCOMO_ICR);176176+ r = locomo_readl(lchip->base + LOCOMO_ICR);177177+ r |= (0x0010 << (irq - lchip->irq_base));178178+ locomo_writel(r, lchip->base + LOCOMO_ICR);184179}185180186181static struct irq_chip locomo_chip = {···192187193188static void locomo_setup_irq(struct locomo *lchip)194189{195195- int irq;196196- void __iomem *irqbase = lchip->base;190190+ int irq = lchip->irq_base;197191198192 /*199193 * Install handler for IRQ_LOCOMO_HW.200194 */201195 set_irq_type(lchip->irq, IRQ_TYPE_EDGE_FALLING);202202- set_irq_chip_data(lchip->irq, irqbase);196196+ set_irq_chip_data(lchip->irq, lchip);203197 set_irq_chained_handler(lchip->irq, locomo_handler);204198205205- /* install handlers for IRQ_LOCOMO_* */206206- for (irq = IRQ_LOCOMO_KEY; irq < IRQ_LOCOMO_KEY + 4; irq++) {199199+ /* Install handlers for IRQ_LOCOMO_* */200200+ for ( ; irq <= lchip->irq_base + 3; irq++) {207201 set_irq_chip(irq, &locomo_chip);208208- set_irq_chip_data(irq, irqbase);209209- set_irq_handler(irq, handle_edge_irq);202202+ set_irq_chip_data(irq, lchip);203203+ set_irq_handler(irq, handle_level_irq);210204 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);211205 }212206}···252248 dev->mapbase = 0;253249 dev->length = info->length;254250255255- memmove(dev->irq, info->irq, sizeof(dev->irq));251251+ dev->irq[0] = (lchip->irq_base == NO_IRQ) ?252252+ NO_IRQ : lchip->irq_base + info->irq[0];256253257254 ret = device_register(&dev->dev);258255 if (ret) {···370365static int371366__locomo_probe(struct device *me, struct resource *mem, int irq)372367{368368+ struct locomo_platform_data *pdata = me->platform_data;373369 struct locomo *lchip;374370 unsigned long r;375371 int i, ret = -ENODEV;···386380387381 lchip->phys = mem->start;388382 lchip->irq = irq;383383+ lchip->irq_base = (pdata) ? pdata->irq_base : NO_IRQ;389384390385 /*391386 * Map the whole region. This also maps the···453446 * The interrupt controller must be initialised before any454447 * other device to ensure that the interrupts are available.455448 */456456- if (lchip->irq != NO_IRQ)449449+ if (lchip->irq != NO_IRQ && lchip->irq_base != NO_IRQ)457450 locomo_setup_irq(lchip);458451459452 for (i = 0; i < ARRAY_SIZE(locomo_devices); i++)
+4
arch/arm/include/asm/hardware/locomo.h
···214214/* Frontlight control */215215void locomo_frontlight_set(struct locomo_dev *dev, int duty, int vr, int bpwf);216216217217+struct locomo_platform_data {218218+ int irq_base; /* IRQ base for cascaded on-chip IRQs */219219+};220220+217221#endif
···124124 * Figure out the MAX IRQ number.125125 *126126 * If we have an SA1111, the max IRQ is S1_BVD1_STSCHG+1.127127- * If we have an LoCoMo, the max IRQ is IRQ_LOCOMO_SPI_TEND+1127127+ * If we have an LoCoMo, the max IRQ is IRQ_BOARD_START + 4128128 * Otherwise, we have the standard IRQs only.129129 */130130#ifdef CONFIG_SA1111131131#define NR_IRQS (IRQ_S1_BVD1_STSCHG + 1)132132-#elif defined(CONFIG_SHARP_LOCOMO)133133-#define NR_IRQS (IRQ_LOCOMO_SPI + 1)132132+#elif defined(CONFIG_SHARPSL_LOCOMO)133133+#define NR_IRQS (IRQ_BOARD_START + 4)134134#else135135#define NR_IRQS (IRQ_BOARD_START)136136#endif···142142#define IRQ_NEPONSET_SMC9196 (IRQ_BOARD_START + 0)143143#define IRQ_NEPONSET_USAR (IRQ_BOARD_START + 1)144144#define IRQ_NEPONSET_SA1111 (IRQ_BOARD_START + 2)145145-146146-/* LoCoMo Interrupts (CONFIG_SHARP_LOCOMO) */147147-#define IRQ_LOCOMO_KEY (IRQ_BOARD_START + 0)148148-#define IRQ_LOCOMO_GPIO_BASE (IRQ_BOARD_START + 1)149149-#define IRQ_LOCOMO_LT_BASE (IRQ_BOARD_START + 2)150150-#define IRQ_LOCOMO_SPI_BASE (IRQ_BOARD_START + 3)151151-