qpace_setup.c 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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/delay.h>
  20. #include <linux/irq.h>
  21. #include <linux/console.h>
  22. #include <linux/of_platform.h>
  23. #include <asm/mmu.h>
  24. #include <asm/processor.h>
  25. #include <asm/io.h>
  26. #include <asm/kexec.h>
  27. #include <asm/pgtable.h>
  28. #include <asm/prom.h>
  29. #include <asm/rtas.h>
  30. #include <asm/dma.h>
  31. #include <asm/machdep.h>
  32. #include <asm/time.h>
  33. #include <asm/cputable.h>
  34. #include <asm/irq.h>
  35. #include <asm/spu.h>
  36. #include <asm/spu_priv1.h>
  37. #include <asm/udbg.h>
  38. #include <asm/cell-regs.h>
  39. #include "interrupt.h"
  40. #include "pervasive.h"
  41. #include "ras.h"
  42. static void qpace_show_cpuinfo(struct seq_file *m)
  43. {
  44. struct device_node *root;
  45. const char *model = "";
  46. root = of_find_node_by_path("/");
  47. if (root)
  48. model = of_get_property(root, "model", NULL);
  49. seq_printf(m, "machine\t\t: CHRP %s\n", model);
  50. of_node_put(root);
  51. }
  52. static void qpace_progress(char *s, unsigned short hex)
  53. {
  54. printk("*** %04x : %s\n", hex, s ? s : "");
  55. }
  56. static const struct of_device_id qpace_bus_ids[] __initdata = {
  57. { .type = "soc", },
  58. { .compatible = "soc", },
  59. { .type = "spider", },
  60. { .type = "axon", },
  61. { .type = "plb5", },
  62. { .type = "plb4", },
  63. { .type = "opb", },
  64. { .type = "ebc", },
  65. {},
  66. };
  67. static int __init qpace_publish_devices(void)
  68. {
  69. int node;
  70. /* Publish OF platform devices for southbridge IOs */
  71. of_platform_bus_probe(NULL, qpace_bus_ids, NULL);
  72. /* There is no device for the MIC memory controller, thus we create
  73. * a platform device for it to attach the EDAC driver to.
  74. */
  75. for_each_online_node(node) {
  76. if (cbe_get_cpu_mic_tm_regs(cbe_node_to_cpu(node)) == NULL)
  77. continue;
  78. platform_device_register_simple("cbe-mic", node, NULL, 0);
  79. }
  80. return 0;
  81. }
  82. machine_subsys_initcall(qpace, qpace_publish_devices);
  83. static void __init qpace_setup_arch(void)
  84. {
  85. #ifdef CONFIG_SPU_BASE
  86. spu_priv1_ops = &spu_priv1_mmio_ops;
  87. spu_management_ops = &spu_management_of_ops;
  88. #endif
  89. cbe_regs_init();
  90. #ifdef CONFIG_CBE_RAS
  91. cbe_ras_init();
  92. #endif
  93. #ifdef CONFIG_SMP
  94. smp_init_cell();
  95. #endif
  96. /* init to some ~sane value until calibrate_delay() runs */
  97. loops_per_jiffy = 50000000;
  98. cbe_pervasive_init();
  99. #ifdef CONFIG_DUMMY_CONSOLE
  100. conswitchp = &dummy_con;
  101. #endif
  102. }
  103. static int __init qpace_probe(void)
  104. {
  105. unsigned long root = of_get_flat_dt_root();
  106. if (!of_flat_dt_is_compatible(root, "IBM,QPACE"))
  107. return 0;
  108. hpte_init_native();
  109. return 1;
  110. }
  111. define_machine(qpace) {
  112. .name = "QPACE",
  113. .probe = qpace_probe,
  114. .setup_arch = qpace_setup_arch,
  115. .show_cpuinfo = qpace_show_cpuinfo,
  116. .restart = rtas_restart,
  117. .power_off = rtas_power_off,
  118. .halt = rtas_halt,
  119. .get_boot_time = rtas_get_boot_time,
  120. .get_rtc_time = rtas_get_rtc_time,
  121. .set_rtc_time = rtas_set_rtc_time,
  122. .calibrate_decr = generic_calibrate_decr,
  123. .progress = qpace_progress,
  124. .init_IRQ = iic_init_IRQ,
  125. };