sbc8641d.c 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /*
  2. * SBC8641D board specific routines
  3. *
  4. * Copyright 2008 Wind River Systems Inc.
  5. *
  6. * By Paul Gortmaker (see MAINTAINERS for contact information)
  7. *
  8. * Based largely on the 8641 HPCN support by Freescale Semiconductor Inc.
  9. *
  10. * This program is free software; you can redistribute it and/or modify it
  11. * under the terms of the GNU General Public License as published by the
  12. * Free Software Foundation; either version 2 of the License, or (at your
  13. * option) any later version.
  14. */
  15. #include <linux/stddef.h>
  16. #include <linux/kernel.h>
  17. #include <linux/pci.h>
  18. #include <linux/kdev_t.h>
  19. #include <linux/delay.h>
  20. #include <linux/seq_file.h>
  21. #include <linux/of_platform.h>
  22. #include <asm/time.h>
  23. #include <asm/machdep.h>
  24. #include <asm/pci-bridge.h>
  25. #include <asm/prom.h>
  26. #include <mm/mmu_decl.h>
  27. #include <asm/udbg.h>
  28. #include <asm/mpic.h>
  29. #include <sysdev/fsl_pci.h>
  30. #include <sysdev/fsl_soc.h>
  31. #include "mpc86xx.h"
  32. static void __init
  33. sbc8641_setup_arch(void)
  34. {
  35. #ifdef CONFIG_PCI
  36. struct device_node *np;
  37. #endif
  38. if (ppc_md.progress)
  39. ppc_md.progress("sbc8641_setup_arch()", 0);
  40. #ifdef CONFIG_PCI
  41. for_each_compatible_node(np, "pci", "fsl,mpc8641-pcie")
  42. fsl_add_bridge(np, 0);
  43. #endif
  44. printk("SBC8641 board from Wind River\n");
  45. #ifdef CONFIG_SMP
  46. mpc86xx_smp_init();
  47. #endif
  48. }
  49. static void
  50. sbc8641_show_cpuinfo(struct seq_file *m)
  51. {
  52. uint svid = mfspr(SPRN_SVR);
  53. seq_printf(m, "Vendor\t\t: Wind River Systems\n");
  54. seq_printf(m, "SVR\t\t: 0x%x\n", svid);
  55. }
  56. /*
  57. * Called very early, device-tree isn't unflattened
  58. */
  59. static int __init sbc8641_probe(void)
  60. {
  61. unsigned long root = of_get_flat_dt_root();
  62. if (of_flat_dt_is_compatible(root, "wind,sbc8641"))
  63. return 1; /* Looks good */
  64. return 0;
  65. }
  66. static long __init
  67. mpc86xx_time_init(void)
  68. {
  69. unsigned int temp;
  70. /* Set the time base to zero */
  71. mtspr(SPRN_TBWL, 0);
  72. mtspr(SPRN_TBWU, 0);
  73. temp = mfspr(SPRN_HID0);
  74. temp |= HID0_TBEN;
  75. mtspr(SPRN_HID0, temp);
  76. asm volatile("isync");
  77. return 0;
  78. }
  79. static __initdata struct of_device_id of_bus_ids[] = {
  80. { .compatible = "simple-bus", },
  81. { .compatible = "gianfar", },
  82. {},
  83. };
  84. static int __init declare_of_platform_devices(void)
  85. {
  86. of_platform_bus_probe(NULL, of_bus_ids, NULL);
  87. return 0;
  88. }
  89. machine_device_initcall(sbc8641, declare_of_platform_devices);
  90. define_machine(sbc8641) {
  91. .name = "SBC8641D",
  92. .probe = sbc8641_probe,
  93. .setup_arch = sbc8641_setup_arch,
  94. .init_IRQ = mpc86xx_init_irq,
  95. .show_cpuinfo = sbc8641_show_cpuinfo,
  96. .get_irq = mpic_get_irq,
  97. .restart = fsl_rstcr_restart,
  98. .time_init = mpc86xx_time_init,
  99. .calibrate_decr = generic_calibrate_decr,
  100. .progress = udbg_progress,
  101. #ifdef CONFIG_PCI
  102. .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
  103. #endif
  104. };