mpc86xx_hpcn.c 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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. unsigned long root = of_get_flat_dt_root();
  77. if (of_flat_dt_is_compatible(root, "fsl,mpc8641hpcn"))
  78. return 1; /* Looks good */
  79. /* Be nice and don't give silent boot death. Delete this in 2.6.27 */
  80. if (of_flat_dt_is_compatible(root, "mpc86xx")) {
  81. pr_warning("WARNING: your dts/dtb is old. You must update before the next kernel release\n");
  82. return 1;
  83. }
  84. return 0;
  85. }
  86. static long __init
  87. mpc86xx_time_init(void)
  88. {
  89. unsigned int temp;
  90. /* Set the time base to zero */
  91. mtspr(SPRN_TBWL, 0);
  92. mtspr(SPRN_TBWU, 0);
  93. temp = mfspr(SPRN_HID0);
  94. temp |= HID0_TBEN;
  95. mtspr(SPRN_HID0, temp);
  96. asm volatile("isync");
  97. return 0;
  98. }
  99. static const struct of_device_id of_bus_ids[] __initconst = {
  100. { .compatible = "simple-bus", },
  101. { .compatible = "fsl,srio", },
  102. { .compatible = "gianfar", },
  103. { .compatible = "fsl,mpc8641-pcie", },
  104. {},
  105. };
  106. static int __init declare_of_platform_devices(void)
  107. {
  108. of_platform_bus_probe(NULL, of_bus_ids, NULL);
  109. return 0;
  110. }
  111. machine_arch_initcall(mpc86xx_hpcn, declare_of_platform_devices);
  112. machine_arch_initcall(mpc86xx_hpcn, swiotlb_setup_bus_notifier);
  113. define_machine(mpc86xx_hpcn) {
  114. .name = "MPC86xx HPCN",
  115. .probe = mpc86xx_hpcn_probe,
  116. .setup_arch = mpc86xx_hpcn_setup_arch,
  117. .init_IRQ = mpc86xx_init_irq,
  118. .show_cpuinfo = mpc86xx_hpcn_show_cpuinfo,
  119. .get_irq = mpic_get_irq,
  120. .restart = fsl_rstcr_restart,
  121. .time_init = mpc86xx_time_init,
  122. .calibrate_decr = generic_calibrate_decr,
  123. .progress = udbg_progress,
  124. #ifdef CONFIG_PCI
  125. .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
  126. #endif
  127. };