setup.c 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. /*
  2. * Copyright (C) 2006 PA Semi, Inc
  3. *
  4. * Authors: Kip Walker, PA Semi
  5. * Olof Johansson, PA Semi
  6. *
  7. * Maintained by: Olof Johansson <olof@lixom.net>
  8. *
  9. * Based on arch/powerpc/platforms/maple/setup.c
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License version 2 as
  13. * published by the Free Software Foundation.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  23. */
  24. #include <linux/config.h>
  25. #include <linux/errno.h>
  26. #include <linux/kernel.h>
  27. #include <linux/delay.h>
  28. #include <linux/console.h>
  29. #include <asm/prom.h>
  30. #include <asm/system.h>
  31. #include <asm/iommu.h>
  32. #include <asm/machdep.h>
  33. #include <asm/mpic.h>
  34. #include <asm/smp.h>
  35. #include <asm/time.h>
  36. #include "pasemi.h"
  37. static void pas_restart(char *cmd)
  38. {
  39. printk("restart unimplemented, looping...\n");
  40. for (;;) ;
  41. }
  42. static void pas_power_off(void)
  43. {
  44. printk("power off unimplemented, looping...\n");
  45. for (;;) ;
  46. }
  47. static void pas_halt(void)
  48. {
  49. pas_power_off();
  50. }
  51. #ifdef CONFIG_SMP
  52. struct smp_ops_t pas_smp_ops = {
  53. .probe = smp_mpic_probe,
  54. .message_pass = smp_mpic_message_pass,
  55. .kick_cpu = smp_generic_kick_cpu,
  56. .setup_cpu = smp_mpic_setup_cpu,
  57. .give_timebase = smp_generic_give_timebase,
  58. .take_timebase = smp_generic_take_timebase,
  59. };
  60. #endif /* CONFIG_SMP */
  61. void __init pas_setup_arch(void)
  62. {
  63. #ifdef CONFIG_SMP
  64. /* Setup SMP callback */
  65. smp_ops = &pas_smp_ops;
  66. #endif
  67. /* Lookup PCI hosts */
  68. pas_pci_init();
  69. #ifdef CONFIG_DUMMY_CONSOLE
  70. conswitchp = &dummy_con;
  71. #endif
  72. printk(KERN_DEBUG "Using default idle loop\n");
  73. }
  74. static void iommu_dev_setup_null(struct pci_dev *dev) { }
  75. static void iommu_bus_setup_null(struct pci_bus *bus) { }
  76. static void __init pas_init_early(void)
  77. {
  78. /* No iommu code yet */
  79. ppc_md.iommu_dev_setup = iommu_dev_setup_null;
  80. ppc_md.iommu_bus_setup = iommu_bus_setup_null;
  81. pci_direct_iommu_init();
  82. }
  83. /* No legacy IO on our parts */
  84. static int pas_check_legacy_ioport(unsigned int baseport)
  85. {
  86. return -ENODEV;
  87. }
  88. static __init void pas_init_IRQ(void)
  89. {
  90. struct device_node *np;
  91. struct device_node *root, *mpic_node;
  92. unsigned long openpic_addr;
  93. const unsigned int *opprop;
  94. int naddr, opplen;
  95. struct mpic *mpic;
  96. mpic_node = NULL;
  97. for_each_node_by_type(np, "interrupt-controller")
  98. if (device_is_compatible(np, "open-pic")) {
  99. mpic_node = np;
  100. break;
  101. }
  102. if (!mpic_node)
  103. for_each_node_by_type(np, "open-pic") {
  104. mpic_node = np;
  105. break;
  106. }
  107. if (!mpic_node) {
  108. printk(KERN_ERR
  109. "Failed to locate the MPIC interrupt controller\n");
  110. return;
  111. }
  112. /* Find address list in /platform-open-pic */
  113. root = of_find_node_by_path("/");
  114. naddr = prom_n_addr_cells(root);
  115. opprop = get_property(root, "platform-open-pic", &opplen);
  116. if (!opprop) {
  117. printk(KERN_ERR "No platform-open-pic property.\n");
  118. of_node_put(root);
  119. return;
  120. }
  121. openpic_addr = of_read_number(opprop, naddr);
  122. printk(KERN_DEBUG "OpenPIC addr: %lx\n", openpic_addr);
  123. of_node_put(root);
  124. mpic = mpic_alloc(mpic_node, openpic_addr, MPIC_PRIMARY, 0, 0,
  125. " PAS-OPIC ");
  126. BUG_ON(!mpic);
  127. mpic_assign_isu(mpic, 0, openpic_addr + 0x10000);
  128. mpic_init(mpic);
  129. of_node_put(mpic_node);
  130. of_node_put(root);
  131. }
  132. static void __init pas_progress(char *s, unsigned short hex)
  133. {
  134. printk("[%04x] : %s\n", hex, s ? s : "");
  135. }
  136. /*
  137. * Called very early, MMU is off, device-tree isn't unflattened
  138. */
  139. static int __init pas_probe(void)
  140. {
  141. unsigned long root = of_get_flat_dt_root();
  142. if (!of_flat_dt_is_compatible(root, "PA6T-1682M"))
  143. return 0;
  144. hpte_init_native();
  145. return 1;
  146. }
  147. define_machine(pas) {
  148. .name = "PA Semi PA6T-1682M",
  149. .probe = pas_probe,
  150. .setup_arch = pas_setup_arch,
  151. .init_early = pas_init_early,
  152. .init_IRQ = pas_init_IRQ,
  153. .get_irq = mpic_get_irq,
  154. .pcibios_fixup = pas_pcibios_fixup,
  155. .restart = pas_restart,
  156. .power_off = pas_power_off,
  157. .halt = pas_halt,
  158. .get_boot_time = pas_get_boot_time,
  159. .calibrate_decr = generic_calibrate_decr,
  160. .check_legacy_ioport = pas_check_legacy_ioport,
  161. .progress = pas_progress,
  162. };