mpc85xx_ads.c 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  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/config.h>
  14. #include <linux/stddef.h>
  15. #include <linux/kernel.h>
  16. #include <linux/pci.h>
  17. #include <linux/kdev_t.h>
  18. #include <linux/delay.h>
  19. #include <linux/seq_file.h>
  20. #include <linux/root_dev.h>
  21. #include <asm/system.h>
  22. #include <asm/time.h>
  23. #include <asm/machdep.h>
  24. #include <asm/pci-bridge.h>
  25. #include <asm/mpc85xx.h>
  26. #include <asm/prom.h>
  27. #include <asm/mpic.h>
  28. #include <mm/mmu_decl.h>
  29. #include <asm/udbg.h>
  30. #include <sysdev/fsl_soc.h>
  31. #include "mpc85xx.h"
  32. #ifndef CONFIG_PCI
  33. unsigned long isa_io_base = 0;
  34. unsigned long isa_mem_base = 0;
  35. #endif
  36. /*
  37. * Internal interrupts are all Level Sensitive, and Positive Polarity
  38. *
  39. * Note: Likely, this table and the following function should be
  40. * obtained and derived from the OF Device Tree.
  41. */
  42. static u_char mpc85xx_ads_openpic_initsenses[] __initdata = {
  43. MPC85XX_INTERNAL_IRQ_SENSES,
  44. 0x0, /* External 0: */
  45. #if defined(CONFIG_PCI)
  46. (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext 1: PCI slot 0 */
  47. (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext 2: PCI slot 1 */
  48. (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext 3: PCI slot 2 */
  49. (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext 4: PCI slot 3 */
  50. #else
  51. 0x0, /* External 1: */
  52. 0x0, /* External 2: */
  53. 0x0, /* External 3: */
  54. 0x0, /* External 4: */
  55. #endif
  56. (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 5: PHY */
  57. 0x0, /* External 6: */
  58. (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 7: PHY */
  59. 0x0, /* External 8: */
  60. 0x0, /* External 9: */
  61. 0x0, /* External 10: */
  62. 0x0, /* External 11: */
  63. };
  64. void __init mpc85xx_ads_pic_init(void)
  65. {
  66. struct mpic *mpic1;
  67. phys_addr_t OpenPIC_PAddr;
  68. /* Determine the Physical Address of the OpenPIC regs */
  69. OpenPIC_PAddr = get_immrbase() + MPC85xx_OPENPIC_OFFSET;
  70. mpic1 = mpic_alloc(OpenPIC_PAddr,
  71. MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,
  72. 4, MPC85xx_OPENPIC_IRQ_OFFSET, 0, 250,
  73. mpc85xx_ads_openpic_initsenses,
  74. sizeof(mpc85xx_ads_openpic_initsenses),
  75. " OpenPIC ");
  76. BUG_ON(mpic1 == NULL);
  77. mpic_assign_isu(mpic1, 0, OpenPIC_PAddr + 0x10200);
  78. mpic_assign_isu(mpic1, 1, OpenPIC_PAddr + 0x10280);
  79. mpic_assign_isu(mpic1, 2, OpenPIC_PAddr + 0x10300);
  80. mpic_assign_isu(mpic1, 3, OpenPIC_PAddr + 0x10380);
  81. mpic_assign_isu(mpic1, 4, OpenPIC_PAddr + 0x10400);
  82. mpic_assign_isu(mpic1, 5, OpenPIC_PAddr + 0x10480);
  83. mpic_assign_isu(mpic1, 6, OpenPIC_PAddr + 0x10500);
  84. mpic_assign_isu(mpic1, 7, OpenPIC_PAddr + 0x10580);
  85. /* dummy mappings to get to 48 */
  86. mpic_assign_isu(mpic1, 8, OpenPIC_PAddr + 0x10600);
  87. mpic_assign_isu(mpic1, 9, OpenPIC_PAddr + 0x10680);
  88. mpic_assign_isu(mpic1, 10, OpenPIC_PAddr + 0x10700);
  89. mpic_assign_isu(mpic1, 11, OpenPIC_PAddr + 0x10780);
  90. /* External ints */
  91. mpic_assign_isu(mpic1, 12, OpenPIC_PAddr + 0x10000);
  92. mpic_assign_isu(mpic1, 13, OpenPIC_PAddr + 0x10080);
  93. mpic_assign_isu(mpic1, 14, OpenPIC_PAddr + 0x10100);
  94. mpic_init(mpic1);
  95. }
  96. /*
  97. * Setup the architecture
  98. */
  99. static void __init mpc85xx_ads_setup_arch(void)
  100. {
  101. struct device_node *cpu;
  102. if (ppc_md.progress)
  103. ppc_md.progress("mpc85xx_ads_setup_arch()", 0);
  104. cpu = of_find_node_by_type(NULL, "cpu");
  105. if (cpu != 0) {
  106. unsigned int *fp;
  107. fp = (int *)get_property(cpu, "clock-frequency", NULL);
  108. if (fp != 0)
  109. loops_per_jiffy = *fp / HZ;
  110. else
  111. loops_per_jiffy = 50000000 / HZ;
  112. of_node_put(cpu);
  113. }
  114. #ifdef CONFIG_ROOT_NFS
  115. ROOT_DEV = Root_NFS;
  116. #else
  117. ROOT_DEV = Root_HDA1;
  118. #endif
  119. }
  120. void mpc85xx_ads_show_cpuinfo(struct seq_file *m)
  121. {
  122. uint pvid, svid, phid1;
  123. uint memsize = total_memory;
  124. pvid = mfspr(SPRN_PVR);
  125. svid = mfspr(SPRN_SVR);
  126. seq_printf(m, "Vendor\t\t: Freescale Semiconductor\n");
  127. seq_printf(m, "Machine\t\t: mpc85xx\n");
  128. seq_printf(m, "PVR\t\t: 0x%x\n", pvid);
  129. seq_printf(m, "SVR\t\t: 0x%x\n", svid);
  130. /* Display cpu Pll setting */
  131. phid1 = mfspr(SPRN_HID1);
  132. seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
  133. /* Display the amount of memory */
  134. seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024));
  135. }
  136. void __init platform_init(void)
  137. {
  138. ppc_md.setup_arch = mpc85xx_ads_setup_arch;
  139. ppc_md.show_cpuinfo = mpc85xx_ads_show_cpuinfo;
  140. ppc_md.init_IRQ = mpc85xx_ads_pic_init;
  141. ppc_md.get_irq = mpic_get_irq;
  142. ppc_md.restart = mpc85xx_restart;
  143. ppc_md.power_off = NULL;
  144. ppc_md.halt = NULL;
  145. ppc_md.time_init = NULL;
  146. ppc_md.set_rtc_time = NULL;
  147. ppc_md.get_rtc_time = NULL;
  148. ppc_md.calibrate_decr = generic_calibrate_decr;
  149. ppc_md.progress = udbg_progress;
  150. if (ppc_md.progress)
  151. ppc_md.progress("mpc85xx_ads platform_init(): exit", 0);
  152. }