psr2.c 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /*
  2. * Copyright 2008-2011, IBM Corporation
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation; either version
  7. * 2 of the License, or (at your option) any later version.
  8. */
  9. #include <linux/delay.h>
  10. #include <linux/init.h>
  11. #include <linux/irq.h>
  12. #include <linux/kernel.h>
  13. #include <linux/mm.h>
  14. #include <linux/of.h>
  15. #include <linux/smp.h>
  16. #include <asm/machdep.h>
  17. #include <asm/system.h>
  18. #include <asm/time.h>
  19. #include <asm/udbg.h>
  20. #include "ics.h"
  21. #include "wsp.h"
  22. static void psr2_spin(void)
  23. {
  24. hard_irq_disable();
  25. for (;;) ;
  26. }
  27. static void psr2_restart(char *cmd)
  28. {
  29. psr2_spin();
  30. }
  31. static int psr2_probe_devices(void)
  32. {
  33. struct device_node *np;
  34. /* Our RTC is a ds1500. It seems to be programatically compatible
  35. * with the ds1511 for which we have a driver so let's use that
  36. */
  37. np = of_find_compatible_node(NULL, NULL, "dallas,ds1500");
  38. if (np != NULL) {
  39. struct resource res;
  40. if (of_address_to_resource(np, 0, &res) == 0)
  41. platform_device_register_simple("ds1511", 0, &res, 1);
  42. }
  43. return 0;
  44. }
  45. machine_arch_initcall(psr2_md, psr2_probe_devices);
  46. static void __init psr2_setup_arch(void)
  47. {
  48. /* init to some ~sane value until calibrate_delay() runs */
  49. loops_per_jiffy = 50000000;
  50. scom_init_wsp();
  51. /* Setup SMP callback */
  52. #ifdef CONFIG_SMP
  53. a2_setup_smp();
  54. #endif
  55. #ifdef CONFIG_PCI
  56. wsp_setup_pci();
  57. #endif
  58. }
  59. static int __init psr2_probe(void)
  60. {
  61. unsigned long root = of_get_flat_dt_root();
  62. if (!of_flat_dt_is_compatible(root, "ibm,psr2"))
  63. return 0;
  64. return 1;
  65. }
  66. static void __init psr2_init_irq(void)
  67. {
  68. wsp_init_irq();
  69. opb_pic_init();
  70. }
  71. define_machine(psr2_md) {
  72. .name = "PSR2 A2",
  73. .probe = psr2_probe,
  74. .setup_arch = psr2_setup_arch,
  75. .restart = psr2_restart,
  76. .power_off = psr2_spin,
  77. .halt = psr2_spin,
  78. .calibrate_decr = generic_calibrate_decr,
  79. .init_IRQ = psr2_init_irq,
  80. .progress = udbg_progress,
  81. .power_save = book3e_idle,
  82. };