qpace_setup.c 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. /*
  2. * linux/arch/powerpc/platforms/cell/qpace_setup.c
  3. *
  4. * Copyright (C) 1995 Linus Torvalds
  5. * Adapted from 'alpha' version by Gary Thomas
  6. * Modified by Cort Dougan (cort@cs.nmt.edu)
  7. * Modified by PPC64 Team, IBM Corp
  8. * Modified by Cell Team, IBM Deutschland Entwicklung GmbH
  9. * Modified by Benjamin Krill <ben@codiert.org>, IBM Corp.
  10. *
  11. * This program is free software; you can redistribute it and/or
  12. * modify it under the terms of the GNU General Public License
  13. * as published by the Free Software Foundation; either version
  14. * 2 of the License, or (at your option) any later version.
  15. */
  16. #include <linux/sched.h>
  17. #include <linux/kernel.h>
  18. #include <linux/init.h>
  19. #include <linux/export.h>
  20. #include <linux/delay.h>
  21. #include <linux/irq.h>
  22. #include <linux/console.h>
  23. #include <linux/of_platform.h>
  24. #include <asm/mmu.h>
  25. #include <asm/processor.h>
  26. #include <asm/io.h>
  27. #include <asm/kexec.h>
  28. #include <asm/pgtable.h>
  29. #include <asm/prom.h>
  30. #include <asm/rtas.h>
  31. #include <asm/dma.h>
  32. #include <asm/machdep.h>
  33. #include <asm/time.h>
  34. #include <asm/cputable.h>
  35. #include <asm/irq.h>
  36. #include <asm/spu.h>
  37. #include <asm/spu_priv1.h>
  38. #include <asm/udbg.h>
  39. #include <asm/cell-regs.h>
  40. #include "interrupt.h"
  41. #include "pervasive.h"
  42. #include "ras.h"
  43. static void qpace_show_cpuinfo(struct seq_file *m)
  44. {
  45. struct device_node *root;
  46. const char *model = "";
  47. root = of_find_node_by_path("/");
  48. if (root)
  49. model = of_get_property(root, "model", NULL);
  50. seq_printf(m, "machine\t\t: CHRP %s\n", model);
  51. of_node_put(root);
  52. }
  53. static void qpace_progress(char *s, unsigned short hex)
  54. {
  55. printk("*** %04x : %s\n", hex, s ? s : "");
  56. }
  57. static const struct of_device_id qpace_bus_ids[] __initconst = {
  58. { .type = "soc", },
  59. { .compatible = "soc", },
  60. { .type = "spider", },
  61. { .type = "axon", },
  62. { .type = "plb5", },
  63. { .type = "plb4", },
  64. { .type = "opb", },
  65. { .type = "ebc", },
  66. {},
  67. };
  68. static int __init qpace_publish_devices(void)
  69. {
  70. int node;
  71. /* Publish OF platform devices for southbridge IOs */
  72. of_platform_bus_probe(NULL, qpace_bus_ids, NULL);
  73. /* There is no device for the MIC memory controller, thus we create
  74. * a platform device for it to attach the EDAC driver to.
  75. */
  76. for_each_online_node(node) {
  77. if (cbe_get_cpu_mic_tm_regs(cbe_node_to_cpu(node)) == NULL)
  78. continue;
  79. platform_device_register_simple("cbe-mic", node, NULL, 0);
  80. }
  81. return 0;
  82. }
  83. machine_subsys_initcall(qpace, qpace_publish_devices);
  84. static void __init qpace_setup_arch(void)
  85. {
  86. #ifdef CONFIG_SPU_BASE
  87. spu_priv1_ops = &spu_priv1_mmio_ops;
  88. spu_management_ops = &spu_management_of_ops;
  89. #endif
  90. cbe_regs_init();
  91. #ifdef CONFIG_CBE_RAS
  92. cbe_ras_init();
  93. #endif
  94. #ifdef CONFIG_SMP
  95. smp_init_cell();
  96. #endif
  97. /* init to some ~sane value until calibrate_delay() runs */
  98. loops_per_jiffy = 50000000;
  99. cbe_pervasive_init();
  100. #ifdef CONFIG_DUMMY_CONSOLE
  101. conswitchp = &dummy_con;
  102. #endif
  103. }
  104. static int __init qpace_probe(void)
  105. {
  106. unsigned long root = of_get_flat_dt_root();
  107. if (!of_flat_dt_is_compatible(root, "IBM,QPACE"))
  108. return 0;
  109. hpte_init_native();
  110. pm_power_off = rtas_power_off;
  111. return 1;
  112. }
  113. define_machine(qpace) {
  114. .name = "QPACE",
  115. .probe = qpace_probe,
  116. .setup_arch = qpace_setup_arch,
  117. .show_cpuinfo = qpace_show_cpuinfo,
  118. .restart = rtas_restart,
  119. .halt = rtas_halt,
  120. .get_boot_time = rtas_get_boot_time,
  121. .get_rtc_time = rtas_get_rtc_time,
  122. .set_rtc_time = rtas_set_rtc_time,
  123. .calibrate_decr = generic_calibrate_decr,
  124. .progress = qpace_progress,
  125. .init_IRQ = iic_init_IRQ,
  126. };