roadrunner.c 4.2 KB

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