mpc86xx_hpcn.c 3.1 KB

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