sbc8641d.c 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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/system.h>
  23. #include <asm/time.h>
  24. #include <asm/machdep.h>
  25. #include <asm/pci-bridge.h>
  26. #include <asm/mpc86xx.h>
  27. #include <asm/prom.h>
  28. #include <mm/mmu_decl.h>
  29. #include <asm/udbg.h>
  30. #include <asm/mpic.h>
  31. #include <sysdev/fsl_pci.h>
  32. #include <sysdev/fsl_soc.h>
  33. #include "mpc86xx.h"
  34. static void __init
  35. sbc8641_init_irq(void)
  36. {
  37. struct mpic *mpic1;
  38. struct device_node *np;
  39. struct resource res;
  40. /* Determine PIC address. */
  41. np = of_find_node_by_type(NULL, "open-pic");
  42. if (np == NULL)
  43. return;
  44. of_address_to_resource(np, 0, &res);
  45. /* Alloc mpic structure and per isu has 16 INT entries. */
  46. mpic1 = mpic_alloc(np, res.start,
  47. MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,
  48. 0, 256, " MPIC ");
  49. of_node_put(np);
  50. BUG_ON(mpic1 == NULL);
  51. mpic_init(mpic1);
  52. }
  53. static void __init
  54. sbc8641_setup_arch(void)
  55. {
  56. #ifdef CONFIG_PCI
  57. struct device_node *np;
  58. #endif
  59. if (ppc_md.progress)
  60. ppc_md.progress("sbc8641_setup_arch()", 0);
  61. #ifdef CONFIG_PCI
  62. for_each_compatible_node(np, "pci", "fsl,mpc8641-pcie")
  63. fsl_add_bridge(np, 0);
  64. #endif
  65. printk("SBC8641 board from Wind River\n");
  66. #ifdef CONFIG_SMP
  67. mpc86xx_smp_init();
  68. #endif
  69. }
  70. static void
  71. sbc8641_show_cpuinfo(struct seq_file *m)
  72. {
  73. struct device_node *root;
  74. uint memsize = total_memory;
  75. const char *model = "";
  76. uint svid = mfspr(SPRN_SVR);
  77. seq_printf(m, "Vendor\t\t: Wind River Systems\n");
  78. root = of_find_node_by_path("/");
  79. if (root)
  80. model = of_get_property(root, "model", NULL);
  81. seq_printf(m, "Machine\t\t: %s\n", model);
  82. of_node_put(root);
  83. seq_printf(m, "SVR\t\t: 0x%x\n", svid);
  84. seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024));
  85. }
  86. /*
  87. * Called very early, device-tree isn't unflattened
  88. */
  89. static int __init sbc8641_probe(void)
  90. {
  91. unsigned long root = of_get_flat_dt_root();
  92. if (of_flat_dt_is_compatible(root, "wind,sbc8641"))
  93. return 1; /* Looks good */
  94. return 0;
  95. }
  96. static long __init
  97. mpc86xx_time_init(void)
  98. {
  99. unsigned int temp;
  100. /* Set the time base to zero */
  101. mtspr(SPRN_TBWL, 0);
  102. mtspr(SPRN_TBWU, 0);
  103. temp = mfspr(SPRN_HID0);
  104. temp |= HID0_TBEN;
  105. mtspr(SPRN_HID0, temp);
  106. asm volatile("isync");
  107. return 0;
  108. }
  109. static __initdata struct of_device_id of_bus_ids[] = {
  110. { .compatible = "simple-bus", },
  111. {},
  112. };
  113. static int __init declare_of_platform_devices(void)
  114. {
  115. of_platform_bus_probe(NULL, of_bus_ids, NULL);
  116. return 0;
  117. }
  118. machine_device_initcall(sbc8641, declare_of_platform_devices);
  119. define_machine(sbc8641) {
  120. .name = "SBC8641D",
  121. .probe = sbc8641_probe,
  122. .setup_arch = sbc8641_setup_arch,
  123. .init_IRQ = sbc8641_init_irq,
  124. .show_cpuinfo = sbc8641_show_cpuinfo,
  125. .get_irq = mpic_get_irq,
  126. .restart = fsl_rstcr_restart,
  127. .time_init = mpc86xx_time_init,
  128. .calibrate_decr = generic_calibrate_decr,
  129. .progress = udbg_progress,
  130. #ifdef CONFIG_PCI
  131. .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
  132. #endif
  133. };