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>
15 #include <asm/hardware.h>
16 #include <asm/setup.h>
17 #include <asm/mach-types.h>
18 #include <asm/mach/arch.h>
19 #include <asm/hardware.h> /* io_p2v() */
21 #include <asm/mach/irq.h>
22 #include <asm/mach/map.h>
24 #include <linux/interrupt.h>
26 /* This function calls the board specific IRQ initialization function. */
27 extern void lh7a400_init_irq (void);
28 extern void lh7a40x_init_time (void);
30 static struct map_desc kev7a400_io_desc[] __initdata = {
31 { IO_VIRT, IO_PHYS, IO_SIZE, MT_DEVICE },
32 { CPLD_VIRT, CPLD_PHYS, CPLD_SIZE, MT_DEVICE },
35 void __init kev7a400_map_io(void)
37 iotable_init (kev7a400_io_desc, ARRAY_SIZE (kev7a400_io_desc));
40 static u16 CPLD_IRQ_mask; /* Mask for CPLD IRQs, 1 == unmasked */
42 static void kev7a400_ack_cpld_irq (u32 irq)
44 CPLD_CL_INT = 1 << (irq - IRQ_KEV7A400_CPLD);
47 static void kev7a400_mask_cpld_irq (u32 irq)
49 CPLD_IRQ_mask &= ~(1 << (irq - IRQ_KEV7A400_CPLD));
50 CPLD_WR_PB_INT_MASK = CPLD_IRQ_mask;
53 static void kev7a400_unmask_cpld_irq (u32 irq)
55 CPLD_IRQ_mask |= 1 << (irq - IRQ_KEV7A400_CPLD);
56 CPLD_WR_PB_INT_MASK = CPLD_IRQ_mask;
59 static struct irqchip kev7a400_cpld_chip = {
60 .ack = kev7a400_ack_cpld_irq,
61 .mask = kev7a400_mask_cpld_irq,
62 .unmask = kev7a400_unmask_cpld_irq,
66 static void kev7a400_cpld_handler (unsigned int irq, struct irqdesc *desc,
69 u32 mask = CPLD_LATCHED_INTS;
70 irq = IRQ_KEV7A400_CPLD;
71 for (; mask; mask >>= 1, ++irq) {
73 desc[irq].handle (irq, desc, regs);
77 void __init lh7a40x_init_board_irq (void)
81 for (irq = IRQ_KEV7A400_CPLD;
82 irq < IRQ_KEV7A400_CPLD + NR_IRQ_BOARD; ++irq) {
83 set_irq_chip (irq, &kev7a400_cpld_chip);
84 set_irq_handler (irq, do_edge_IRQ);
85 set_irq_flags (irq, IRQF_VALID);
87 set_irq_chained_handler (IRQ_CPLD, kev7a400_cpld_handler);
89 /* Clear all CPLD interrupts */
90 CPLD_CL_INT = 0xff; /* CPLD_INTR_MMC_CD | CPLD_INTR_ETH_INT; */
92 GPIO_GPIOINTEN = 0; /* Disable all GPIO interrupts */
97 = (GPIO_INTR_PCC1_CD | GPIO_INTR_PCC1_CD); /* Edge trig. */
98 GPIO_INTTYPE2 = 0; /* Falling edge & low-level */
99 GPIO_GPIOFEOI = 0xff; /* Clear all GPIO interrupts */
100 GPIO_GPIOINTEN = 0xff; /* Enable all GPIO interrupts */
106 MACHINE_START (KEV7A400, "Sharp KEV7a400")
107 MAINTAINER ("Marc Singer")
108 BOOT_MEM (0xc0000000, 0x80000000, io_p2v (0x80000000))
109 BOOT_PARAMS (0xc0000100)
110 MAPIO (kev7a400_map_io)
111 INITIRQ (lh7a400_init_irq)
112 INITTIME (lh7a40x_init_time)