/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c

http://github.com/mirrors/linux · C · 134 lines · 92 code · 29 blank · 13 comment · 7 complexity · 0bf45a95c9264918420b889c676d2594 MD5 · raw file

  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. /*
  3. * MPC86xx HPCN board specific routines
  4. *
  5. * Recode: ZHANG WEI <wei.zhang@freescale.com>
  6. * Initial author: Xianghua Xiao <x.xiao@freescale.com>
  7. *
  8. * Copyright 2006 Freescale Semiconductor Inc.
  9. */
  10. #include <linux/stddef.h>
  11. #include <linux/kernel.h>
  12. #include <linux/pci.h>
  13. #include <linux/kdev_t.h>
  14. #include <linux/delay.h>
  15. #include <linux/seq_file.h>
  16. #include <linux/of_platform.h>
  17. #include <asm/time.h>
  18. #include <asm/machdep.h>
  19. #include <asm/pci-bridge.h>
  20. #include <asm/prom.h>
  21. #include <mm/mmu_decl.h>
  22. #include <asm/udbg.h>
  23. #include <asm/swiotlb.h>
  24. #include <asm/mpic.h>
  25. #include <sysdev/fsl_pci.h>
  26. #include <sysdev/fsl_soc.h>
  27. #include "mpc86xx.h"
  28. #undef DEBUG
  29. #ifdef DEBUG
  30. #define DBG(fmt...) do { printk(KERN_ERR fmt); } while(0)
  31. #else
  32. #define DBG(fmt...) do { } while(0)
  33. #endif
  34. #ifdef CONFIG_PCI
  35. extern int uli_exclude_device(struct pci_controller *hose,
  36. u_char bus, u_char devfn);
  37. static int mpc86xx_exclude_device(struct pci_controller *hose,
  38. u_char bus, u_char devfn)
  39. {
  40. if (hose->dn == fsl_pci_primary)
  41. return uli_exclude_device(hose, bus, devfn);
  42. return PCIBIOS_SUCCESSFUL;
  43. }
  44. #endif /* CONFIG_PCI */
  45. static void __init
  46. mpc86xx_hpcn_setup_arch(void)
  47. {
  48. if (ppc_md.progress)
  49. ppc_md.progress("mpc86xx_hpcn_setup_arch()", 0);
  50. #ifdef CONFIG_PCI
  51. ppc_md.pci_exclude_device = mpc86xx_exclude_device;
  52. #endif
  53. printk("MPC86xx HPCN board from Freescale Semiconductor\n");
  54. #ifdef CONFIG_SMP
  55. mpc86xx_smp_init();
  56. #endif
  57. fsl_pci_assign_primary();
  58. swiotlb_detect_4g();
  59. }
  60. static void
  61. mpc86xx_hpcn_show_cpuinfo(struct seq_file *m)
  62. {
  63. uint svid = mfspr(SPRN_SVR);
  64. seq_printf(m, "Vendor\t\t: Freescale Semiconductor\n");
  65. seq_printf(m, "SVR\t\t: 0x%x\n", svid);
  66. }
  67. /*
  68. * Called very early, device-tree isn't unflattened
  69. */
  70. static int __init mpc86xx_hpcn_probe(void)
  71. {
  72. if (of_machine_is_compatible("fsl,mpc8641hpcn"))
  73. return 1; /* Looks good */
  74. /* Be nice and don't give silent boot death. Delete this in 2.6.27 */
  75. if (of_machine_is_compatible("mpc86xx")) {
  76. pr_warn("WARNING: your dts/dtb is old. You must update before the next kernel release.\n");
  77. return 1;
  78. }
  79. return 0;
  80. }
  81. static const struct of_device_id of_bus_ids[] __initconst = {
  82. { .compatible = "fsl,srio", },
  83. {},
  84. };
  85. static int __init declare_of_platform_devices(void)
  86. {
  87. mpc86xx_common_publish_devices();
  88. of_platform_bus_probe(NULL, of_bus_ids, NULL);
  89. return 0;
  90. }
  91. machine_arch_initcall(mpc86xx_hpcn, declare_of_platform_devices);
  92. define_machine(mpc86xx_hpcn) {
  93. .name = "MPC86xx HPCN",
  94. .probe = mpc86xx_hpcn_probe,
  95. .setup_arch = mpc86xx_hpcn_setup_arch,
  96. .init_IRQ = mpc86xx_init_irq,
  97. .show_cpuinfo = mpc86xx_hpcn_show_cpuinfo,
  98. .get_irq = mpic_get_irq,
  99. .time_init = mpc86xx_time_init,
  100. .calibrate_decr = generic_calibrate_decr,
  101. .progress = udbg_progress,
  102. #ifdef CONFIG_PCI
  103. .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
  104. #endif
  105. };