gef_sbc610.c 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. /*
  2. * GE Fanuc SBC610 board support
  3. *
  4. * Author: Martyn Welch <martyn.welch@gefanuc.com>
  5. *
  6. * Copyright 2008 GE Fanuc Intelligent Platforms Embedded Systems, Inc.
  7. *
  8. * This program is free software; you can redistribute it and/or modify it
  9. * under the terms of the GNU General Public License as published by the
  10. * Free Software Foundation; either version 2 of the License, or (at your
  11. * option) any later version.
  12. *
  13. * Based on: mpc86xx_hpcn.c (MPC86xx HPCN board specific routines)
  14. * Copyright 2006 Freescale Semiconductor Inc.
  15. */
  16. #include <linux/stddef.h>
  17. #include <linux/kernel.h>
  18. #include <linux/pci.h>
  19. #include <linux/kdev_t.h>
  20. #include <linux/delay.h>
  21. #include <linux/seq_file.h>
  22. #include <linux/of_platform.h>
  23. #include <asm/system.h>
  24. #include <asm/time.h>
  25. #include <asm/machdep.h>
  26. #include <asm/pci-bridge.h>
  27. #include <asm/mpc86xx.h>
  28. #include <asm/prom.h>
  29. #include <mm/mmu_decl.h>
  30. #include <asm/udbg.h>
  31. #include <asm/mpic.h>
  32. #include <sysdev/fsl_pci.h>
  33. #include <sysdev/fsl_soc.h>
  34. #include "mpc86xx.h"
  35. #undef DEBUG
  36. #ifdef DEBUG
  37. #define DBG (fmt...) do { printk(KERN_ERR "SBC610: " fmt); } while (0)
  38. #else
  39. #define DBG (fmt...) do { } while (0)
  40. #endif
  41. static void __init gef_sbc610_setup_arch(void)
  42. {
  43. #ifdef CONFIG_PCI
  44. struct device_node *np;
  45. for_each_compatible_node(np, "pci", "fsl,mpc8641-pcie") {
  46. fsl_add_bridge(np, 1);
  47. }
  48. #endif
  49. printk(KERN_INFO "GE Fanuc Intelligent Platforms SBC610 6U VPX SBC\n");
  50. #ifdef CONFIG_SMP
  51. mpc86xx_smp_init();
  52. #endif
  53. }
  54. static void gef_sbc610_show_cpuinfo(struct seq_file *m)
  55. {
  56. struct device_node *root;
  57. uint memsize = total_memory;
  58. const char *model = "";
  59. uint svid = mfspr(SPRN_SVR);
  60. seq_printf(m, "Vendor\t\t: GE Fanuc Intelligent Platforms\n");
  61. root = of_find_node_by_path("/");
  62. if (root)
  63. model = of_get_property(root, "model", NULL);
  64. seq_printf(m, "Machine\t\t: %s\n", model);
  65. of_node_put(root);
  66. seq_printf(m, "SVR\t\t: 0x%x\n", svid);
  67. seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024));
  68. }
  69. /*
  70. * Called very early, device-tree isn't unflattened
  71. *
  72. * This function is called to determine whether the BSP is compatible with the
  73. * supplied device-tree, which is assumed to be the correct one for the actual
  74. * board. It is expected thati, in the future, a kernel may support multiple
  75. * boards.
  76. */
  77. static int __init gef_sbc610_probe(void)
  78. {
  79. unsigned long root = of_get_flat_dt_root();
  80. if (of_flat_dt_is_compatible(root, "gef,sbc610"))
  81. return 1;
  82. return 0;
  83. }
  84. static long __init mpc86xx_time_init(void)
  85. {
  86. unsigned int temp;
  87. /* Set the time base to zero */
  88. mtspr(SPRN_TBWL, 0);
  89. mtspr(SPRN_TBWU, 0);
  90. temp = mfspr(SPRN_HID0);
  91. temp |= HID0_TBEN;
  92. mtspr(SPRN_HID0, temp);
  93. asm volatile("isync");
  94. return 0;
  95. }
  96. static __initdata struct of_device_id of_bus_ids[] = {
  97. { .compatible = "simple-bus", },
  98. {},
  99. };
  100. static int __init declare_of_platform_devices(void)
  101. {
  102. printk(KERN_DEBUG "Probe platform devices\n");
  103. of_platform_bus_probe(NULL, of_bus_ids, NULL);
  104. return 0;
  105. }
  106. machine_device_initcall(gef_sbc610, declare_of_platform_devices);
  107. define_machine(gef_sbc610) {
  108. .name = "GE Fanuc SBC610",
  109. .probe = gef_sbc610_probe,
  110. .setup_arch = gef_sbc610_setup_arch,
  111. .init_IRQ = mpc86xx_init_irq,
  112. .show_cpuinfo = gef_sbc610_show_cpuinfo,
  113. .get_irq = mpic_get_irq,
  114. .restart = fsl_rstcr_restart,
  115. .time_init = mpc86xx_time_init,
  116. .calibrate_decr = generic_calibrate_decr,
  117. .progress = udbg_progress,
  118. #ifdef CONFIG_PCI
  119. .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
  120. #endif
  121. };