ixdp2800.c 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. /*
  2. * arch/arm/mach-ixp2000/ixdp2800.c
  3. *
  4. * IXDP2800 platform support
  5. *
  6. * Original Author: Jeffrey Daly <jeffrey.daly@intel.com>
  7. * Maintainer: Deepak Saxena <dsaxena@plexity.net>
  8. *
  9. * Copyright (C) 2002 Intel Corp.
  10. * Copyright (C) 2003-2004 MontaVista Software, Inc.
  11. *
  12. * This program is free software; you can redistribute it and/or modify it
  13. * under the terms of the GNU General Public License as published by the
  14. * Free Software Foundation; either version 2 of the License, or (at your
  15. * option) any later version.
  16. */
  17. #include <linux/config.h>
  18. #include <linux/kernel.h>
  19. #include <linux/init.h>
  20. #include <linux/mm.h>
  21. #include <linux/sched.h>
  22. #include <linux/interrupt.h>
  23. #include <linux/device.h>
  24. #include <linux/bitops.h>
  25. #include <linux/pci.h>
  26. #include <linux/ioport.h>
  27. #include <linux/slab.h>
  28. #include <linux/delay.h>
  29. #include <asm/io.h>
  30. #include <asm/irq.h>
  31. #include <asm/pgtable.h>
  32. #include <asm/page.h>
  33. #include <asm/system.h>
  34. #include <asm/hardware.h>
  35. #include <asm/mach-types.h>
  36. #include <asm/mach/pci.h>
  37. #include <asm/mach/map.h>
  38. #include <asm/mach/irq.h>
  39. #include <asm/mach/time.h>
  40. #include <asm/mach/flash.h>
  41. #include <asm/mach/arch.h>
  42. void ixdp2400_init_irq(void)
  43. {
  44. ixdp2x00_init_irq(IXDP2800_CPLD_INT_STAT, IXDP2800_CPLD_INT_MASK, IXDP2400_NR_IRQS);
  45. }
  46. /*************************************************************************
  47. * IXDP2800 timer tick
  48. *************************************************************************/
  49. static void __init ixdp2800_timer_init(void)
  50. {
  51. ixp2000_init_time(50000000);
  52. }
  53. static struct sys_timer ixdp2800_timer = {
  54. .init = ixdp2800_timer_init,
  55. .offset = ixp2000_gettimeoffset,
  56. };
  57. /*************************************************************************
  58. * IXDP2800 PCI
  59. *************************************************************************/
  60. void __init ixdp2800_pci_preinit(void)
  61. {
  62. printk("ixdp2x00_pci_preinit called\n");
  63. *IXP2000_PCI_ADDR_EXT = 0x0000e000;
  64. *IXP2000_PCI_DRAM_BASE_ADDR_MASK = (0x40000000 - 1) & ~0xfffff;
  65. *IXP2000_PCI_SRAM_BASE_ADDR_MASK = (0x2000000 - 1) & ~0x3ffff;
  66. ixp2000_pci_preinit();
  67. }
  68. int ixdp2800_pci_setup(int nr, struct pci_sys_data *sys)
  69. {
  70. sys->mem_offset = 0x00000000;
  71. ixp2000_pci_setup(nr, sys);
  72. return 1;
  73. }
  74. static int __init ixdp2800_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
  75. {
  76. if (ixdp2x00_master_npu()) {
  77. /*
  78. * Root bus devices. Slave NPU is only one with interrupt.
  79. * Everything else, we just return -1 which is invalid.
  80. */
  81. if(!dev->bus->self) {
  82. if(dev->devfn == IXDP2X00_SLAVE_NPU_DEVFN )
  83. return IRQ_IXDP2800_INGRESS_NPU;
  84. return -1;
  85. }
  86. /*
  87. * Bridge behind the PMC slot.
  88. */
  89. if(dev->bus->self->devfn == IXDP2X00_PMC_DEVFN &&
  90. dev->bus->parent->self->devfn == IXDP2X00_P2P_DEVFN &&
  91. !dev->bus->parent->self->bus->parent)
  92. return IRQ_IXDP2800_PMC;
  93. /*
  94. * Device behind the first bridge
  95. */
  96. if(dev->bus->self->devfn == IXDP2X00_P2P_DEVFN) {
  97. switch(dev->devfn) {
  98. case IXDP2X00_PMC_DEVFN:
  99. return IRQ_IXDP2800_PMC;
  100. case IXDP2800_MASTER_ENET_DEVFN:
  101. return IRQ_IXDP2800_EGRESS_ENET;
  102. case IXDP2800_SWITCH_FABRIC_DEVFN:
  103. return IRQ_IXDP2800_FABRIC;
  104. }
  105. }
  106. return -1;
  107. } else return IRQ_IXP2000_PCIB; /* Slave NIC interrupt */
  108. }
  109. static void ixdp2800_pci_postinit(void)
  110. {
  111. struct pci_dev *dev;
  112. if (ixdp2x00_master_npu()) {
  113. dev = pci_find_slot(1, IXDP2800_SLAVE_ENET_DEVFN);
  114. pci_remove_bus_device(dev);
  115. } else {
  116. dev = pci_find_slot(1, IXDP2800_MASTER_ENET_DEVFN);
  117. pci_remove_bus_device(dev);
  118. ixdp2x00_slave_pci_postinit();
  119. }
  120. }
  121. struct hw_pci ixdp2800_pci __initdata = {
  122. .nr_controllers = 1,
  123. .setup = ixdp2800_pci_setup,
  124. .preinit = ixdp2800_pci_preinit,
  125. .postinit = ixdp2800_pci_postinit,
  126. .scan = ixp2000_pci_scan_bus,
  127. .map_irq = ixdp2800_pci_map_irq,
  128. };
  129. int __init ixdp2800_pci_init(void)
  130. {
  131. if (machine_is_ixdp2800())
  132. pci_common_init(&ixdp2800_pci);
  133. return 0;
  134. }
  135. subsys_initcall(ixdp2800_pci_init);
  136. void ixdp2800_init_irq(void)
  137. {
  138. ixdp2x00_init_irq(IXDP2800_CPLD_INT_STAT, IXDP2800_CPLD_INT_MASK, IXDP2800_NR_IRQS);
  139. }
  140. MACHINE_START(IXDP2800, "Intel IXDP2800 Development Platform")
  141. MAINTAINER("MontaVista Software, Inc.")
  142. BOOT_MEM(0x00000000, IXP2000_UART_PHYS_BASE, IXP2000_UART_VIRT_BASE)
  143. BOOT_PARAMS(0x00000100)
  144. MAPIO(ixdp2x00_map_io)
  145. INITIRQ(ixdp2800_init_irq)
  146. .timer = &ixdp2800_timer,
  147. INIT_MACHINE(ixdp2x00_init_machine)
  148. MACHINE_END