b4_qds.c 2.6 KB

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