p2020.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. /*
  3. * Freescale P2020 board Setup
  4. *
  5. * Copyright 2007,2009,2012-2013 Freescale Semiconductor Inc.
  6. * Copyright 2022-2023 Pali Rohár <pali@kernel.org>
  7. */
  8. #include <linux/stddef.h>
  9. #include <linux/kernel.h>
  10. #include <linux/of.h>
  11. #include <asm/machdep.h>
  12. #include <asm/udbg.h>
  13. #include <asm/mpic.h>
  14. #include <asm/swiotlb.h>
  15. #include <asm/ppc-pci.h>
  16. #include <sysdev/fsl_pci.h>
  17. #include "smp.h"
  18. #include "mpc85xx.h"
  19. static void __init p2020_pic_init(void)
  20. {
  21. struct mpic *mpic;
  22. int flags = MPIC_BIG_ENDIAN | MPIC_SINGLE_DEST_CPU;
  23. mpic = mpic_alloc(NULL, 0, flags, 0, 256, " OpenPIC ");
  24. if (WARN_ON(!mpic))
  25. return;
  26. mpic_init(mpic);
  27. mpc85xx_8259_init();
  28. }
  29. /*
  30. * Setup the architecture
  31. */
  32. static void __init p2020_setup_arch(void)
  33. {
  34. swiotlb_detect_4g();
  35. fsl_pci_assign_primary();
  36. uli_init();
  37. mpc85xx_smp_init();
  38. mpc85xx_qe_par_io_init();
  39. }
  40. /*
  41. * Called very early, device-tree isn't unflattened
  42. */
  43. static int __init p2020_probe(void)
  44. {
  45. struct device_node *p2020_cpu;
  46. /*
  47. * There is no common compatible string for all P2020 boards.
  48. * The only common thing is "PowerPC,P2020@0" cpu node.
  49. * So check for P2020 board via this cpu node.
  50. */
  51. p2020_cpu = of_find_node_by_path("/cpus/PowerPC,P2020@0");
  52. of_node_put(p2020_cpu);
  53. return !!p2020_cpu;
  54. }
  55. machine_arch_initcall(p2020, mpc85xx_common_publish_devices);
  56. define_machine(p2020) {
  57. .name = "Freescale P2020",
  58. .probe = p2020_probe,
  59. .setup_arch = p2020_setup_arch,
  60. .init_IRQ = p2020_pic_init,
  61. #ifdef CONFIG_PCI
  62. .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
  63. .pcibios_fixup_phb = fsl_pcibios_fixup_phb,
  64. #endif
  65. .get_irq = mpic_get_irq,
  66. .progress = udbg_progress,
  67. };