mpc82xx.c 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /*
  2. * MPC82xx setup and early boot code plus other random bits.
  3. *
  4. * Author: Vitaly Bordug <vbordug@ru.mvista.com>
  5. *
  6. * Copyright (c) 2006 MontaVista Software, 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/init.h>
  16. #include <linux/errno.h>
  17. #include <linux/reboot.h>
  18. #include <linux/pci.h>
  19. #include <linux/interrupt.h>
  20. #include <linux/kdev_t.h>
  21. #include <linux/major.h>
  22. #include <linux/console.h>
  23. #include <linux/delay.h>
  24. #include <linux/seq_file.h>
  25. #include <linux/root_dev.h>
  26. #include <linux/initrd.h>
  27. #include <linux/module.h>
  28. #include <linux/fsl_devices.h>
  29. #include <linux/fs_uart_pd.h>
  30. #include <asm/system.h>
  31. #include <asm/pgtable.h>
  32. #include <asm/page.h>
  33. #include <asm/atomic.h>
  34. #include <asm/time.h>
  35. #include <asm/io.h>
  36. #include <asm/machdep.h>
  37. #include <asm/bootinfo.h>
  38. #include <asm/pci-bridge.h>
  39. #include <asm/mpc8260.h>
  40. #include <asm/irq.h>
  41. #include <mm/mmu_decl.h>
  42. #include <asm/prom.h>
  43. #include <asm/cpm2.h>
  44. #include <asm/udbg.h>
  45. #include <asm/i8259.h>
  46. #include <linux/fs_enet_pd.h>
  47. #include <sysdev/fsl_soc.h>
  48. #include <sysdev/cpm2_pic.h>
  49. #include "pq2ads_pd.h"
  50. static int __init get_freq(char *name, unsigned long *val)
  51. {
  52. struct device_node *cpu;
  53. unsigned int *fp;
  54. int found = 0;
  55. /* The cpu node should have timebase and clock frequency properties */
  56. cpu = of_find_node_by_type(NULL, "cpu");
  57. if (cpu) {
  58. fp = (unsigned int *)get_property(cpu, name, NULL);
  59. if (fp) {
  60. found = 1;
  61. *val = *fp++;
  62. }
  63. of_node_put(cpu);
  64. }
  65. return found;
  66. }
  67. void __init m82xx_calibrate_decr(void)
  68. {
  69. ppc_tb_freq = 125000000;
  70. if (!get_freq("bus-frequency", &ppc_tb_freq)) {
  71. printk(KERN_ERR "WARNING: Estimating decrementer frequency "
  72. "(not found)\n");
  73. }
  74. ppc_tb_freq /= 4;
  75. ppc_proc_freq = 1000000000;
  76. if (!get_freq("clock-frequency", &ppc_proc_freq))
  77. printk(KERN_ERR "WARNING: Estimating processor frequency"
  78. "(not found)\n");
  79. }
  80. void mpc82xx_ads_show_cpuinfo(struct seq_file *m)
  81. {
  82. uint pvid, svid, phid1;
  83. uint memsize = total_memory;
  84. pvid = mfspr(SPRN_PVR);
  85. svid = mfspr(SPRN_SVR);
  86. seq_printf(m, "Vendor\t\t: Freescale Semiconductor\n");
  87. seq_printf(m, "Machine\t\t: %s\n", CPUINFO_MACHINE);
  88. seq_printf(m, "PVR\t\t: 0x%x\n", pvid);
  89. seq_printf(m, "SVR\t\t: 0x%x\n", svid);
  90. /* Display cpu Pll setting */
  91. phid1 = mfspr(SPRN_HID1);
  92. seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
  93. /* Display the amount of memory */
  94. seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024));
  95. }