p2041_rdb.c 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*
  2. * P2041 RDB Setup
  3. *
  4. * Copyright 2011 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 <linux/kdev_t.h>
  14. #include <linux/delay.h>
  15. #include <linux/interrupt.h>
  16. #include <linux/phy.h>
  17. #include <asm/time.h>
  18. #include <asm/machdep.h>
  19. #include <asm/pci-bridge.h>
  20. #include <mm/mmu_decl.h>
  21. #include <asm/prom.h>
  22. #include <asm/udbg.h>
  23. #include <asm/mpic.h>
  24. #include <linux/of_platform.h>
  25. #include <sysdev/fsl_soc.h>
  26. #include <sysdev/fsl_pci.h>
  27. #include <asm/ehv_pic.h>
  28. #include "corenet_ds.h"
  29. /*
  30. * Called very early, device-tree isn't unflattened
  31. */
  32. static int __init p2041_rdb_probe(void)
  33. {
  34. unsigned long root = of_get_flat_dt_root();
  35. #ifdef CONFIG_SMP
  36. extern struct smp_ops_t smp_85xx_ops;
  37. #endif
  38. if (of_flat_dt_is_compatible(root, "fsl,P2041RDB"))
  39. return 1;
  40. /* Check if we're running under the Freescale hypervisor */
  41. if (of_flat_dt_is_compatible(root, "fsl,P2041RDB-hv")) {
  42. ppc_md.init_IRQ = ehv_pic_init;
  43. ppc_md.get_irq = ehv_pic_get_irq;
  44. ppc_md.restart = fsl_hv_restart;
  45. ppc_md.power_off = fsl_hv_halt;
  46. ppc_md.halt = fsl_hv_halt;
  47. #ifdef CONFIG_SMP
  48. /*
  49. * Disable the timebase sync operations because we can't write
  50. * to the timebase registers under the hypervisor.
  51. */
  52. smp_85xx_ops.give_timebase = NULL;
  53. smp_85xx_ops.take_timebase = NULL;
  54. #endif
  55. return 1;
  56. }
  57. return 0;
  58. }
  59. define_machine(p2041_rdb) {
  60. .name = "P2041 RDB",
  61. .probe = p2041_rdb_probe,
  62. .setup_arch = corenet_ds_setup_arch,
  63. .init_IRQ = corenet_ds_pic_init,
  64. #ifdef CONFIG_PCI
  65. .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
  66. #endif
  67. .get_irq = mpic_get_coreint_irq,
  68. .restart = fsl_rstcr_restart,
  69. .calibrate_decr = generic_calibrate_decr,
  70. .progress = udbg_progress,
  71. .power_save = e500_idle,
  72. };
  73. machine_device_initcall(p2041_rdb, corenet_ds_publish_devices);
  74. #ifdef CONFIG_SWIOTLB
  75. machine_arch_initcall(p2041_rdb, swiotlb_setup_bus_notifier);
  76. #endif