arch-kev7a400.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /* arch/arm/mach-lh7a40x/arch-kev7a400.c
  2. *
  3. * Copyright (C) 2004 Logic Product Development
  4. *
  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.
  8. *
  9. */
  10. #include <linux/tty.h>
  11. #include <linux/init.h>
  12. #include <linux/device.h>
  13. #include <linux/interrupt.h>
  14. #include <asm/hardware.h>
  15. #include <asm/setup.h>
  16. #include <asm/mach-types.h>
  17. #include <asm/mach/arch.h>
  18. #include <asm/irq.h>
  19. #include <asm/mach/irq.h>
  20. #include <asm/mach/map.h>
  21. #include "common.h"
  22. /* This function calls the board specific IRQ initialization function. */
  23. static struct map_desc kev7a400_io_desc[] __initdata = {
  24. { IO_VIRT, IO_PHYS, IO_SIZE, MT_DEVICE },
  25. { CPLD_VIRT, CPLD_PHYS, CPLD_SIZE, MT_DEVICE },
  26. };
  27. void __init kev7a400_map_io(void)
  28. {
  29. iotable_init (kev7a400_io_desc, ARRAY_SIZE (kev7a400_io_desc));
  30. }
  31. static u16 CPLD_IRQ_mask; /* Mask for CPLD IRQs, 1 == unmasked */
  32. static void kev7a400_ack_cpld_irq (u32 irq)
  33. {
  34. CPLD_CL_INT = 1 << (irq - IRQ_KEV7A400_CPLD);
  35. }
  36. static void kev7a400_mask_cpld_irq (u32 irq)
  37. {
  38. CPLD_IRQ_mask &= ~(1 << (irq - IRQ_KEV7A400_CPLD));
  39. CPLD_WR_PB_INT_MASK = CPLD_IRQ_mask;
  40. }
  41. static void kev7a400_unmask_cpld_irq (u32 irq)
  42. {
  43. CPLD_IRQ_mask |= 1 << (irq - IRQ_KEV7A400_CPLD);
  44. CPLD_WR_PB_INT_MASK = CPLD_IRQ_mask;
  45. }
  46. static struct irqchip kev7a400_cpld_chip = {
  47. .ack = kev7a400_ack_cpld_irq,
  48. .mask = kev7a400_mask_cpld_irq,
  49. .unmask = kev7a400_unmask_cpld_irq,
  50. };
  51. static void kev7a400_cpld_handler (unsigned int irq, struct irqdesc *desc,
  52. struct pt_regs *regs)
  53. {
  54. u32 mask = CPLD_LATCHED_INTS;
  55. irq = IRQ_KEV7A400_CPLD;
  56. for (; mask; mask >>= 1, ++irq) {
  57. if (mask & 1)
  58. desc[irq].handle (irq, desc, regs);
  59. }
  60. }
  61. void __init lh7a40x_init_board_irq (void)
  62. {
  63. int irq;
  64. for (irq = IRQ_KEV7A400_CPLD;
  65. irq < IRQ_KEV7A400_CPLD + NR_IRQ_BOARD; ++irq) {
  66. set_irq_chip (irq, &kev7a400_cpld_chip);
  67. set_irq_handler (irq, do_edge_IRQ);
  68. set_irq_flags (irq, IRQF_VALID);
  69. }
  70. set_irq_chained_handler (IRQ_CPLD, kev7a400_cpld_handler);
  71. /* Clear all CPLD interrupts */
  72. CPLD_CL_INT = 0xff; /* CPLD_INTR_MMC_CD | CPLD_INTR_ETH_INT; */
  73. GPIO_GPIOINTEN = 0; /* Disable all GPIO interrupts */
  74. barrier();
  75. #if 0
  76. GPIO_INTTYPE1
  77. = (GPIO_INTR_PCC1_CD | GPIO_INTR_PCC1_CD); /* Edge trig. */
  78. GPIO_INTTYPE2 = 0; /* Falling edge & low-level */
  79. GPIO_GPIOFEOI = 0xff; /* Clear all GPIO interrupts */
  80. GPIO_GPIOINTEN = 0xff; /* Enable all GPIO interrupts */
  81. init_FIQ();
  82. #endif
  83. }
  84. MACHINE_START (KEV7A400, "Sharp KEV7a400")
  85. /* Maintainer: Marc Singer */
  86. .phys_ram = 0xc0000000,
  87. .phys_io = 0x80000000,
  88. .io_pg_offst = ((io_p2v (0x80000000))>>18) & 0xfffc,
  89. .boot_params = 0xc0000100,
  90. .map_io = kev7a400_map_io,
  91. .init_irq = lh7a400_init_irq,
  92. .timer = &lh7a40x_timer,
  93. MACHINE_END