[TG3]: Set minimal hw interrupt mitigation.
[linux-2.6/verdex.git] / arch / arm / mach-lh7a40x / arch-kev7a400.c
blobbe5d17fe9dcbeec55805452971561019f027caae
1 /* arch/arm/mach-lh7a40x/arch-kev7a400.c
3 * Copyright (C) 2004 Logic Product Development
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * version 2 as published by the Free Software Foundation.
9 */
11 #include <linux/tty.h>
12 #include <linux/init.h>
13 #include <linux/device.h>
14 #include <linux/interrupt.h>
16 #include <asm/hardware.h>
17 #include <asm/setup.h>
18 #include <asm/mach-types.h>
19 #include <asm/mach/arch.h>
20 #include <asm/irq.h>
21 #include <asm/mach/irq.h>
22 #include <asm/mach/map.h>
24 #include "common.h"
26 /* This function calls the board specific IRQ initialization function. */
28 static struct map_desc kev7a400_io_desc[] __initdata = {
29 { IO_VIRT, IO_PHYS, IO_SIZE, MT_DEVICE },
30 { CPLD_VIRT, CPLD_PHYS, CPLD_SIZE, MT_DEVICE },
33 void __init kev7a400_map_io(void)
35 iotable_init (kev7a400_io_desc, ARRAY_SIZE (kev7a400_io_desc));
38 static u16 CPLD_IRQ_mask; /* Mask for CPLD IRQs, 1 == unmasked */
40 static void kev7a400_ack_cpld_irq (u32 irq)
42 CPLD_CL_INT = 1 << (irq - IRQ_KEV7A400_CPLD);
45 static void kev7a400_mask_cpld_irq (u32 irq)
47 CPLD_IRQ_mask &= ~(1 << (irq - IRQ_KEV7A400_CPLD));
48 CPLD_WR_PB_INT_MASK = CPLD_IRQ_mask;
51 static void kev7a400_unmask_cpld_irq (u32 irq)
53 CPLD_IRQ_mask |= 1 << (irq - IRQ_KEV7A400_CPLD);
54 CPLD_WR_PB_INT_MASK = CPLD_IRQ_mask;
57 static struct irqchip kev7a400_cpld_chip = {
58 .ack = kev7a400_ack_cpld_irq,
59 .mask = kev7a400_mask_cpld_irq,
60 .unmask = kev7a400_unmask_cpld_irq,
64 static void kev7a400_cpld_handler (unsigned int irq, struct irqdesc *desc,
65 struct pt_regs *regs)
67 u32 mask = CPLD_LATCHED_INTS;
68 irq = IRQ_KEV7A400_CPLD;
69 for (; mask; mask >>= 1, ++irq) {
70 if (mask & 1)
71 desc[irq].handle (irq, desc, regs);
75 void __init lh7a40x_init_board_irq (void)
77 int irq;
79 for (irq = IRQ_KEV7A400_CPLD;
80 irq < IRQ_KEV7A400_CPLD + NR_IRQ_BOARD; ++irq) {
81 set_irq_chip (irq, &kev7a400_cpld_chip);
82 set_irq_handler (irq, do_edge_IRQ);
83 set_irq_flags (irq, IRQF_VALID);
85 set_irq_chained_handler (IRQ_CPLD, kev7a400_cpld_handler);
87 /* Clear all CPLD interrupts */
88 CPLD_CL_INT = 0xff; /* CPLD_INTR_MMC_CD | CPLD_INTR_ETH_INT; */
90 GPIO_GPIOINTEN = 0; /* Disable all GPIO interrupts */
91 barrier();
93 #if 0
94 GPIO_INTTYPE1
95 = (GPIO_INTR_PCC1_CD | GPIO_INTR_PCC1_CD); /* Edge trig. */
96 GPIO_INTTYPE2 = 0; /* Falling edge & low-level */
97 GPIO_GPIOFEOI = 0xff; /* Clear all GPIO interrupts */
98 GPIO_GPIOINTEN = 0xff; /* Enable all GPIO interrupts */
100 init_FIQ();
101 #endif
104 MACHINE_START (KEV7A400, "Sharp KEV7a400")
105 MAINTAINER ("Marc Singer")
106 BOOT_MEM (0xc0000000, 0x80000000, io_p2v (0x80000000))
107 BOOT_PARAMS (0xc0000100)
108 MAPIO (kev7a400_map_io)
109 INITIRQ (lh7a400_init_irq)
110 .timer = &lh7a40x_timer,
111 MACHINE_END