mpc85xx_ads.c 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. /*
  2. * MPC85xx setup and early boot code plus other random bits.
  3. *
  4. * Maintained by Kumar Gala (see MAINTAINERS for contact information)
  5. *
  6. * Copyright 2005 Freescale Semiconductor Inc.
  7. *
  8. * This program is free software; you can redistribute it and/or modify it
  9. * under the terms of the GNU General Public License as published by the
  10. * Free Software Foundation; either version 2 of the License, or (at your
  11. * option) any later version.
  12. */
  13. #include <linux/stddef.h>
  14. #include <linux/kernel.h>
  15. #include <linux/pci.h>
  16. #include <linux/kdev_t.h>
  17. #include <linux/delay.h>
  18. #include <linux/seq_file.h>
  19. #include <linux/root_dev.h>
  20. #include <asm/system.h>
  21. #include <asm/time.h>
  22. #include <asm/machdep.h>
  23. #include <asm/pci-bridge.h>
  24. #include <asm/mpc85xx.h>
  25. #include <asm/prom.h>
  26. #include <asm/mpic.h>
  27. #include <mm/mmu_decl.h>
  28. #include <asm/udbg.h>
  29. #include <sysdev/fsl_soc.h>
  30. #include "mpc85xx.h"
  31. #ifndef CONFIG_PCI
  32. unsigned long isa_io_base = 0;
  33. unsigned long isa_mem_base = 0;
  34. #endif
  35. #ifdef CONFIG_PCI
  36. int
  37. mpc85xx_exclude_device(u_char bus, u_char devfn)
  38. {
  39. if (bus == 0 && PCI_SLOT(devfn) == 0)
  40. return PCIBIOS_DEVICE_NOT_FOUND;
  41. else
  42. return PCIBIOS_SUCCESSFUL;
  43. }
  44. void __init
  45. mpc85xx_pcibios_fixup(void)
  46. {
  47. struct pci_dev *dev = NULL;
  48. for_each_pci_dev(dev)
  49. pci_read_irq_line(dev);
  50. }
  51. #endif /* CONFIG_PCI */
  52. void __init mpc85xx_ads_pic_init(void)
  53. {
  54. struct mpic *mpic;
  55. struct resource r;
  56. struct device_node *np = NULL;
  57. np = of_find_node_by_type(np, "open-pic");
  58. if (np == NULL) {
  59. printk(KERN_ERR "Could not find open-pic node\n");
  60. return;
  61. }
  62. if(of_address_to_resource(np, 0, &r)) {
  63. printk(KERN_ERR "Could not map mpic register space\n");
  64. of_node_put(np);
  65. return;
  66. }
  67. mpic = mpic_alloc(np, r.start,
  68. MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,
  69. 4, 0, " OpenPIC ");
  70. BUG_ON(mpic == NULL);
  71. of_node_put(np);
  72. mpic_assign_isu(mpic, 0, r.start + 0x10200);
  73. mpic_assign_isu(mpic, 1, r.start + 0x10280);
  74. mpic_assign_isu(mpic, 2, r.start + 0x10300);
  75. mpic_assign_isu(mpic, 3, r.start + 0x10380);
  76. mpic_assign_isu(mpic, 4, r.start + 0x10400);
  77. mpic_assign_isu(mpic, 5, r.start + 0x10480);
  78. mpic_assign_isu(mpic, 6, r.start + 0x10500);
  79. mpic_assign_isu(mpic, 7, r.start + 0x10580);
  80. /* Unused on this platform (leave room for 8548) */
  81. mpic_assign_isu(mpic, 8, r.start + 0x10600);
  82. mpic_assign_isu(mpic, 9, r.start + 0x10680);
  83. mpic_assign_isu(mpic, 10, r.start + 0x10700);
  84. mpic_assign_isu(mpic, 11, r.start + 0x10780);
  85. /* External Interrupts */
  86. mpic_assign_isu(mpic, 12, r.start + 0x10000);
  87. mpic_assign_isu(mpic, 13, r.start + 0x10080);
  88. mpic_assign_isu(mpic, 14, r.start + 0x10100);
  89. mpic_init(mpic);
  90. }
  91. /*
  92. * Setup the architecture
  93. */
  94. static void __init mpc85xx_ads_setup_arch(void)
  95. {
  96. struct device_node *cpu;
  97. #ifdef CONFIG_PCI
  98. struct device_node *np;
  99. #endif
  100. if (ppc_md.progress)
  101. ppc_md.progress("mpc85xx_ads_setup_arch()", 0);
  102. cpu = of_find_node_by_type(NULL, "cpu");
  103. if (cpu != 0) {
  104. const unsigned int *fp;
  105. fp = get_property(cpu, "clock-frequency", NULL);
  106. if (fp != 0)
  107. loops_per_jiffy = *fp / HZ;
  108. else
  109. loops_per_jiffy = 50000000 / HZ;
  110. of_node_put(cpu);
  111. }
  112. #ifdef CONFIG_PCI
  113. for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
  114. add_bridge(np);
  115. ppc_md.pcibios_fixup = mpc85xx_pcibios_fixup;
  116. ppc_md.pci_exclude_device = mpc85xx_exclude_device;
  117. #endif
  118. #ifdef CONFIG_ROOT_NFS
  119. ROOT_DEV = Root_NFS;
  120. #else
  121. ROOT_DEV = Root_HDA1;
  122. #endif
  123. }
  124. void mpc85xx_ads_show_cpuinfo(struct seq_file *m)
  125. {
  126. uint pvid, svid, phid1;
  127. uint memsize = total_memory;
  128. pvid = mfspr(SPRN_PVR);
  129. svid = mfspr(SPRN_SVR);
  130. seq_printf(m, "Vendor\t\t: Freescale Semiconductor\n");
  131. seq_printf(m, "Machine\t\t: mpc85xx\n");
  132. seq_printf(m, "PVR\t\t: 0x%x\n", pvid);
  133. seq_printf(m, "SVR\t\t: 0x%x\n", svid);
  134. /* Display cpu Pll setting */
  135. phid1 = mfspr(SPRN_HID1);
  136. seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
  137. /* Display the amount of memory */
  138. seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024));
  139. }
  140. /*
  141. * Called very early, device-tree isn't unflattened
  142. */
  143. static int __init mpc85xx_ads_probe(void)
  144. {
  145. /* We always match for now, eventually we should look at the flat
  146. dev tree to ensure this is the board we are suppose to run on
  147. */
  148. return 1;
  149. }
  150. define_machine(mpc85xx_ads) {
  151. .name = "MPC85xx ADS",
  152. .probe = mpc85xx_ads_probe,
  153. .setup_arch = mpc85xx_ads_setup_arch,
  154. .init_IRQ = mpc85xx_ads_pic_init,
  155. .show_cpuinfo = mpc85xx_ads_show_cpuinfo,
  156. .get_irq = mpic_get_irq,
  157. .restart = mpc85xx_restart,
  158. .calibrate_decr = generic_calibrate_decr,
  159. .progress = udbg_progress,
  160. };