roadrunner.c 4.3 KB

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