ppa8548.c 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /*
  2. * ppa8548 setup and early boot code.
  3. *
  4. * Copyright 2009 Prodrive B.V..
  5. *
  6. * By Stef van Os (see MAINTAINERS for contact information)
  7. *
  8. * Based on the SBC8548 support - Copyright 2007 Wind River Systems Inc.
  9. * Based on the MPC8548CDS support - Copyright 2005 Freescale Inc.
  10. *
  11. * This program is free software; you can redistribute it and/or modify it
  12. * under the terms of the GNU General Public License as published by the
  13. * Free Software Foundation; either version 2 of the License, or (at your
  14. * option) any later version.
  15. */
  16. #include <linux/stddef.h>
  17. #include <linux/kernel.h>
  18. #include <linux/init.h>
  19. #include <linux/reboot.h>
  20. #include <linux/seq_file.h>
  21. #include <linux/of_fdt.h>
  22. #include <linux/of_platform.h>
  23. #include <asm/machdep.h>
  24. #include <asm/udbg.h>
  25. #include <asm/mpic.h>
  26. #include <sysdev/fsl_soc.h>
  27. static void __init ppa8548_pic_init(void)
  28. {
  29. struct mpic *mpic = mpic_alloc(NULL, 0, MPIC_BIG_ENDIAN,
  30. 0, 256, " OpenPIC ");
  31. BUG_ON(mpic == NULL);
  32. mpic_init(mpic);
  33. }
  34. /*
  35. * Setup the architecture
  36. */
  37. static void __init ppa8548_setup_arch(void)
  38. {
  39. if (ppc_md.progress)
  40. ppc_md.progress("ppa8548_setup_arch()", 0);
  41. }
  42. static void ppa8548_show_cpuinfo(struct seq_file *m)
  43. {
  44. uint32_t svid, phid1;
  45. svid = mfspr(SPRN_SVR);
  46. seq_printf(m, "Vendor\t\t: Prodrive B.V.\n");
  47. seq_printf(m, "SVR\t\t: 0x%x\n", svid);
  48. /* Display cpu Pll setting */
  49. phid1 = mfspr(SPRN_HID1);
  50. seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
  51. }
  52. static const struct of_device_id of_bus_ids[] __initconst = {
  53. { .name = "soc", },
  54. { .type = "soc", },
  55. { .compatible = "simple-bus", },
  56. { .compatible = "gianfar", },
  57. { .compatible = "fsl,srio", },
  58. {},
  59. };
  60. static int __init declare_of_platform_devices(void)
  61. {
  62. of_platform_bus_probe(NULL, of_bus_ids, NULL);
  63. return 0;
  64. }
  65. machine_device_initcall(ppa8548, declare_of_platform_devices);
  66. /*
  67. * Called very early, device-tree isn't unflattened
  68. */
  69. static int __init ppa8548_probe(void)
  70. {
  71. unsigned long root = of_get_flat_dt_root();
  72. return of_flat_dt_is_compatible(root, "ppa8548");
  73. }
  74. define_machine(ppa8548) {
  75. .name = "ppa8548",
  76. .probe = ppa8548_probe,
  77. .setup_arch = ppa8548_setup_arch,
  78. .init_IRQ = ppa8548_pic_init,
  79. .show_cpuinfo = ppa8548_show_cpuinfo,
  80. .get_irq = mpic_get_irq,
  81. .restart = fsl_rstcr_restart,
  82. .calibrate_decr = generic_calibrate_decr,
  83. .progress = udbg_progress,
  84. };