p5040_ds.c 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*
  2. * P5040 DS Setup
  3. *
  4. * Copyright 2009-2010 Freescale Semiconductor Inc.
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms of the GNU General Public License as published by the
  8. * Free Software Foundation; either version 2 of the License, or (at your
  9. * option) any later version.
  10. */
  11. #include <linux/kernel.h>
  12. #include <linux/pci.h>
  13. #include <asm/machdep.h>
  14. #include <asm/udbg.h>
  15. #include <asm/mpic.h>
  16. #include <linux/of_fdt.h>
  17. #include <sysdev/fsl_soc.h>
  18. #include <sysdev/fsl_pci.h>
  19. #include <asm/ehv_pic.h>
  20. #include "corenet_ds.h"
  21. /*
  22. * Called very early, device-tree isn't unflattened
  23. */
  24. static int __init p5040_ds_probe(void)
  25. {
  26. unsigned long root = of_get_flat_dt_root();
  27. #ifdef CONFIG_SMP
  28. extern struct smp_ops_t smp_85xx_ops;
  29. #endif
  30. if (of_flat_dt_is_compatible(root, "fsl,P5040DS"))
  31. return 1;
  32. /* Check if we're running under the Freescale hypervisor */
  33. if (of_flat_dt_is_compatible(root, "fsl,P5040DS-hv")) {
  34. ppc_md.init_IRQ = ehv_pic_init;
  35. ppc_md.get_irq = ehv_pic_get_irq;
  36. ppc_md.restart = fsl_hv_restart;
  37. ppc_md.power_off = fsl_hv_halt;
  38. ppc_md.halt = fsl_hv_halt;
  39. #ifdef CONFIG_SMP
  40. /*
  41. * Disable the timebase sync operations because we can't write
  42. * to the timebase registers under the hypervisor.
  43. */
  44. smp_85xx_ops.give_timebase = NULL;
  45. smp_85xx_ops.take_timebase = NULL;
  46. #endif
  47. return 1;
  48. }
  49. return 0;
  50. }
  51. define_machine(p5040_ds) {
  52. .name = "P5040 DS",
  53. .probe = p5040_ds_probe,
  54. .setup_arch = corenet_ds_setup_arch,
  55. .init_IRQ = corenet_ds_pic_init,
  56. #ifdef CONFIG_PCI
  57. .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
  58. #endif
  59. /* coreint doesn't play nice with lazy EE, use legacy mpic for now */
  60. #ifdef CONFIG_PPC64
  61. .get_irq = mpic_get_irq,
  62. #else
  63. .get_irq = mpic_get_coreint_irq,
  64. #endif
  65. .restart = fsl_rstcr_restart,
  66. .calibrate_decr = generic_calibrate_decr,
  67. .progress = udbg_progress,
  68. #ifdef CONFIG_PPC64
  69. .power_save = book3e_idle,
  70. #else
  71. .power_save = e500_idle,
  72. #endif
  73. };
  74. machine_arch_initcall(p5040_ds, corenet_ds_publish_devices);
  75. #ifdef CONFIG_SWIOTLB
  76. machine_arch_initcall(p5040_ds, swiotlb_setup_bus_notifier);
  77. #endif