roadrunner.c 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. /*
  2. * arch/arm/mach-ixp23xx/roadrunner.c
  3. *
  4. * RoadRunner board-specific routines
  5. *
  6. * Author: Deepak Saxena <dsaxena@plexity.net>
  7. *
  8. * Copyright 2005 (c) MontaVista Software, Inc.
  9. *
  10. * Based on 2.4 code Copyright 2005 (c) ADI Engineering Corporation
  11. *
  12. * This file is licensed under the terms of the GNU General Public
  13. * License version 2. This program is licensed "as is" without any
  14. * warranty of any kind, whether express or implied.
  15. */
  16. #include <linux/config.h>
  17. #include <linux/kernel.h>
  18. #include <linux/init.h>
  19. #include <linux/spinlock.h>
  20. #include <linux/sched.h>
  21. #include <linux/interrupt.h>
  22. #include <linux/serial.h>
  23. #include <linux/tty.h>
  24. #include <linux/bitops.h>
  25. #include <linux/ioport.h>
  26. #include <linux/serial.h>
  27. #include <linux/serial_8250.h>
  28. #include <linux/serial_core.h>
  29. #include <linux/device.h>
  30. #include <linux/mm.h>
  31. #include <linux/pci.h>
  32. #include <linux/mtd/physmap.h>
  33. #include <asm/types.h>
  34. #include <asm/setup.h>
  35. #include <asm/memory.h>
  36. #include <asm/hardware.h>
  37. #include <asm/mach-types.h>
  38. #include <asm/irq.h>
  39. #include <asm/system.h>
  40. #include <asm/tlbflush.h>
  41. #include <asm/pgtable.h>
  42. #include <asm/mach/map.h>
  43. #include <asm/mach/irq.h>
  44. #include <asm/mach/arch.h>
  45. #include <asm/mach/irq.h>
  46. #include <asm/mach/pci.h>
  47. /*
  48. * Interrupt mapping
  49. */
  50. #define INTA IRQ_ROADRUNNER_PCI_INTA
  51. #define INTB IRQ_ROADRUNNER_PCI_INTB
  52. #define INTC IRQ_ROADRUNNER_PCI_INTC
  53. #define INTD IRQ_ROADRUNNER_PCI_INTD
  54. #define INTC_PIN IXP23XX_GPIO_PIN_11
  55. #define INTD_PIN IXP23XX_GPIO_PIN_12
  56. static int __init roadrunner_map_irq(struct pci_dev *dev, u8 idsel, u8 pin)
  57. {
  58. static int pci_card_slot_irq[] = {INTB, INTC, INTD, INTA};
  59. static int pmc_card_slot_irq[] = {INTA, INTB, INTC, INTD};
  60. static int usb_irq[] = {INTB, INTC, INTD, -1};
  61. static int mini_pci_1_irq[] = {INTB, INTC, -1, -1};
  62. static int mini_pci_2_irq[] = {INTC, INTD, -1, -1};
  63. switch(dev->bus->number) {
  64. case 0:
  65. switch(dev->devfn) {
  66. case 0x0: // PCI-PCI bridge
  67. break;
  68. case 0x8: // PCI Card Slot
  69. return pci_card_slot_irq[pin - 1];
  70. case 0x10: // PMC Slot
  71. return pmc_card_slot_irq[pin - 1];
  72. case 0x18: // PMC Slot Secondary Agent
  73. break;
  74. case 0x20: // IXP Processor
  75. break;
  76. default:
  77. return NO_IRQ;
  78. }
  79. break;
  80. case 1:
  81. switch(dev->devfn) {
  82. case 0x0: // IDE Controller
  83. return (pin == 1) ? INTC : -1;
  84. case 0x8: // USB fun 0
  85. case 0x9: // USB fun 1
  86. case 0xa: // USB fun 2
  87. return usb_irq[pin - 1];
  88. case 0x10: // Mini PCI 1
  89. return mini_pci_1_irq[pin-1];
  90. case 0x18: // Mini PCI 2
  91. return mini_pci_2_irq[pin-1];
  92. case 0x20: // MEM slot
  93. return (pin == 1) ? INTA : -1;
  94. default:
  95. return NO_IRQ;
  96. }
  97. break;
  98. default:
  99. return NO_IRQ;
  100. }
  101. return NO_IRQ;
  102. }
  103. static void roadrunner_pci_preinit(void)
  104. {
  105. set_irq_type(IRQ_ROADRUNNER_PCI_INTC, IRQT_LOW);
  106. set_irq_type(IRQ_ROADRUNNER_PCI_INTD, IRQT_LOW);
  107. ixp23xx_pci_preinit();
  108. }
  109. static struct hw_pci roadrunner_pci __initdata = {
  110. .nr_controllers = 1,
  111. .preinit = roadrunner_pci_preinit,
  112. .setup = ixp23xx_pci_setup,
  113. .scan = ixp23xx_pci_scan_bus,
  114. .map_irq = roadrunner_map_irq,
  115. };
  116. static int __init roadrunner_pci_init(void)
  117. {
  118. if (machine_is_roadrunner())
  119. pci_common_init(&roadrunner_pci);
  120. return 0;
  121. };
  122. subsys_initcall(roadrunner_pci_init);
  123. static struct physmap_flash_data roadrunner_flash_data = {
  124. .width = 2,
  125. };
  126. static struct resource roadrunner_flash_resource = {
  127. .start = 0x90000000,
  128. .end = 0x94000000,
  129. .flags = IORESOURCE_MEM,
  130. };
  131. static struct platform_device roadrunner_flash = {
  132. .name = "physmap-flash",
  133. .id = 0,
  134. .dev = {
  135. .platform_data = &roadrunner_flash_data,
  136. },
  137. .num_resources = 1,
  138. .resource = &roadrunner_flash_resource,
  139. };
  140. static void __init roadrunner_init(void)
  141. {
  142. platform_device_register(&roadrunner_flash);
  143. /*
  144. * Mark flash as writeable
  145. */
  146. IXP23XX_EXP_CS0[0] |= IXP23XX_FLASH_WRITABLE;
  147. IXP23XX_EXP_CS0[1] |= IXP23XX_FLASH_WRITABLE;
  148. IXP23XX_EXP_CS0[2] |= IXP23XX_FLASH_WRITABLE;
  149. IXP23XX_EXP_CS0[3] |= IXP23XX_FLASH_WRITABLE;
  150. ixp23xx_sys_init();
  151. }
  152. MACHINE_START(ROADRUNNER, "ADI Engineering RoadRunner Development Platform")
  153. /* Maintainer: Deepak Saxena */
  154. .phys_io = IXP23XX_PERIPHERAL_PHYS,
  155. .io_pg_offst = ((IXP23XX_PERIPHERAL_VIRT >> 18)) & 0xfffc,
  156. .map_io = ixp23xx_map_io,
  157. .init_irq = ixp23xx_init_irq,
  158. .timer = &ixp23xx_timer,
  159. .boot_params = 0x00000100,
  160. .init_machine = roadrunner_init,
  161. MACHINE_END