mpc85xx_rdb.c 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. /*
  2. * MPC85xx RDB Board Setup
  3. *
  4. * Copyright 2009 Freescale Semiconductor Inc.
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms of the GNU General Public License as published by the
  8. * Free Software Foundation; either version 2 of the License, or (at your
  9. * option) any later version.
  10. */
  11. #include <linux/stddef.h>
  12. #include <linux/kernel.h>
  13. #include <linux/pci.h>
  14. #include <linux/kdev_t.h>
  15. #include <linux/delay.h>
  16. #include <linux/seq_file.h>
  17. #include <linux/interrupt.h>
  18. #include <linux/of_platform.h>
  19. #include <asm/system.h>
  20. #include <asm/time.h>
  21. #include <asm/machdep.h>
  22. #include <asm/pci-bridge.h>
  23. #include <mm/mmu_decl.h>
  24. #include <asm/prom.h>
  25. #include <asm/udbg.h>
  26. #include <asm/mpic.h>
  27. #include <sysdev/fsl_soc.h>
  28. #include <sysdev/fsl_pci.h>
  29. #include "smp.h"
  30. #include "mpc85xx.h"
  31. #undef DEBUG
  32. #ifdef DEBUG
  33. #define DBG(fmt, args...) printk(KERN_ERR "%s: " fmt, __func__, ## args)
  34. #else
  35. #define DBG(fmt, args...)
  36. #endif
  37. void __init mpc85xx_rdb_pic_init(void)
  38. {
  39. struct mpic *mpic;
  40. unsigned long root = of_get_flat_dt_root();
  41. if (of_flat_dt_is_compatible(root, "fsl,MPC85XXRDB-CAMP")) {
  42. mpic = mpic_alloc(NULL, 0,
  43. MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS |
  44. MPIC_SINGLE_DEST_CPU,
  45. 0, 256, " OpenPIC ");
  46. } else {
  47. mpic = mpic_alloc(NULL, 0,
  48. MPIC_WANTS_RESET |
  49. MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS |
  50. MPIC_SINGLE_DEST_CPU,
  51. 0, 256, " OpenPIC ");
  52. }
  53. BUG_ON(mpic == NULL);
  54. mpic_init(mpic);
  55. }
  56. /*
  57. * Setup the architecture
  58. */
  59. static void __init mpc85xx_rdb_setup_arch(void)
  60. {
  61. #ifdef CONFIG_PCI
  62. struct device_node *np;
  63. #endif
  64. if (ppc_md.progress)
  65. ppc_md.progress("mpc85xx_rdb_setup_arch()", 0);
  66. #ifdef CONFIG_PCI
  67. for_each_node_by_type(np, "pci") {
  68. if (of_device_is_compatible(np, "fsl,mpc8548-pcie"))
  69. fsl_add_bridge(np, 0);
  70. }
  71. #endif
  72. mpc85xx_smp_init();
  73. printk(KERN_INFO "MPC85xx RDB board from Freescale Semiconductor\n");
  74. }
  75. machine_device_initcall(p2020_rdb, mpc85xx_common_publish_devices);
  76. machine_device_initcall(p1020_rdb, mpc85xx_common_publish_devices);
  77. /*
  78. * Called very early, device-tree isn't unflattened
  79. */
  80. static int __init p2020_rdb_probe(void)
  81. {
  82. unsigned long root = of_get_flat_dt_root();
  83. if (of_flat_dt_is_compatible(root, "fsl,P2020RDB"))
  84. return 1;
  85. return 0;
  86. }
  87. static int __init p1020_rdb_probe(void)
  88. {
  89. unsigned long root = of_get_flat_dt_root();
  90. if (of_flat_dt_is_compatible(root, "fsl,P1020RDB"))
  91. return 1;
  92. return 0;
  93. }
  94. define_machine(p2020_rdb) {
  95. .name = "P2020 RDB",
  96. .probe = p2020_rdb_probe,
  97. .setup_arch = mpc85xx_rdb_setup_arch,
  98. .init_IRQ = mpc85xx_rdb_pic_init,
  99. #ifdef CONFIG_PCI
  100. .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
  101. #endif
  102. .get_irq = mpic_get_irq,
  103. .restart = fsl_rstcr_restart,
  104. .calibrate_decr = generic_calibrate_decr,
  105. .progress = udbg_progress,
  106. };
  107. define_machine(p1020_rdb) {
  108. .name = "P1020 RDB",
  109. .probe = p1020_rdb_probe,
  110. .setup_arch = mpc85xx_rdb_setup_arch,
  111. .init_IRQ = mpc85xx_rdb_pic_init,
  112. #ifdef CONFIG_PCI
  113. .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
  114. #endif
  115. .get_irq = mpic_get_irq,
  116. .restart = fsl_rstcr_restart,
  117. .calibrate_decr = generic_calibrate_decr,
  118. .progress = udbg_progress,
  119. };