psr2.c 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. }
  56. static int __init psr2_probe(void)
  57. {
  58. unsigned long root = of_get_flat_dt_root();
  59. if (!of_flat_dt_is_compatible(root, "ibm,psr2"))
  60. return 0;
  61. return 1;
  62. }
  63. static void __init psr2_init_irq(void)
  64. {
  65. wsp_init_irq();
  66. opb_pic_init();
  67. }
  68. define_machine(psr2_md) {
  69. .name = "PSR2 A2",
  70. .probe = psr2_probe,
  71. .setup_arch = psr2_setup_arch,
  72. .restart = psr2_restart,
  73. .power_off = psr2_spin,
  74. .halt = psr2_spin,
  75. .calibrate_decr = generic_calibrate_decr,
  76. .init_IRQ = psr2_init_irq,
  77. .progress = udbg_progress,
  78. .power_save = book3e_idle,
  79. };