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.
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>
21 #include <asm/mach/irq.h>
22 #include <asm/mach/map.h>
26 /* This function calls the board specific IRQ initialization function. */
28 static struct map_desc kev7a400_io_desc[] __initdata = {
31 .pfn = __phys_to_pfn(IO_PHYS),
36 .pfn = __phys_to_pfn(CPLD_PHYS),
42 void __init kev7a400_map_io(void)
44 iotable_init (kev7a400_io_desc, ARRAY_SIZE (kev7a400_io_desc));
47 static u16 CPLD_IRQ_mask; /* Mask for CPLD IRQs, 1 == unmasked */
49 static void kev7a400_ack_cpld_irq (u32 irq)
51 CPLD_CL_INT = 1 << (irq - IRQ_KEV7A400_CPLD);
54 static void kev7a400_mask_cpld_irq (u32 irq)
56 CPLD_IRQ_mask &= ~(1 << (irq - IRQ_KEV7A400_CPLD));
57 CPLD_WR_PB_INT_MASK = CPLD_IRQ_mask;
60 static void kev7a400_unmask_cpld_irq (u32 irq)
62 CPLD_IRQ_mask |= 1 << (irq - IRQ_KEV7A400_CPLD);
63 CPLD_WR_PB_INT_MASK = CPLD_IRQ_mask;
66 static struct irq_chip kev7a400_cpld_chip = {
68 .ack = kev7a400_ack_cpld_irq,
69 .mask = kev7a400_mask_cpld_irq,
70 .unmask = kev7a400_unmask_cpld_irq,
74 static void kev7a400_cpld_handler (unsigned int irq, struct irqdesc *desc,
77 u32 mask = CPLD_LATCHED_INTS;
78 irq = IRQ_KEV7A400_CPLD;
79 for (; mask; mask >>= 1, ++irq) {
81 desc[irq].handle (irq, desc, regs);
85 void __init lh7a40x_init_board_irq (void)
89 for (irq = IRQ_KEV7A400_CPLD;
90 irq < IRQ_KEV7A400_CPLD + NR_IRQ_BOARD; ++irq) {
91 set_irq_chip (irq, &kev7a400_cpld_chip);
92 set_irq_handler (irq, do_edge_IRQ);
93 set_irq_flags (irq, IRQF_VALID);
95 set_irq_chained_handler (IRQ_CPLD, kev7a400_cpld_handler);
97 /* Clear all CPLD interrupts */
98 CPLD_CL_INT = 0xff; /* CPLD_INTR_MMC_CD | CPLD_INTR_ETH_INT; */
100 GPIO_GPIOINTEN = 0; /* Disable all GPIO interrupts */
105 = (GPIO_INTR_PCC1_CD | GPIO_INTR_PCC1_CD); /* Edge trig. */
106 GPIO_INTTYPE2 = 0; /* Falling edge & low-level */
107 GPIO_GPIOFEOI = 0xff; /* Clear all GPIO interrupts */
108 GPIO_GPIOINTEN = 0xff; /* Enable all GPIO interrupts */
114 MACHINE_START (KEV7A400, "Sharp KEV7a400")
115 /* Maintainer: Marc Singer */
116 .phys_io = 0x80000000,
117 .io_pg_offst = ((io_p2v (0x80000000))>>18) & 0xfffc,
118 .boot_params = 0xc0000100,
119 .map_io = kev7a400_map_io,
120 .init_irq = lh7a400_init_irq,
121 .timer = &lh7a40x_timer,