mpc8536_ds.c 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /*
  2. * MPC8536 DS Board Setup
  3. *
  4. * Copyright 2008 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. void __init mpc8536_ds_pic_init(void)
  30. {
  31. struct mpic *mpic;
  32. struct resource r;
  33. struct device_node *np;
  34. np = of_find_node_by_type(NULL, "open-pic");
  35. if (np == NULL) {
  36. printk(KERN_ERR "Could not find open-pic node\n");
  37. return;
  38. }
  39. if (of_address_to_resource(np, 0, &r)) {
  40. printk(KERN_ERR "Failed to map mpic register space\n");
  41. of_node_put(np);
  42. return;
  43. }
  44. mpic = mpic_alloc(np, r.start,
  45. MPIC_PRIMARY | MPIC_WANTS_RESET |
  46. MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS,
  47. 0, 256, " OpenPIC ");
  48. BUG_ON(mpic == NULL);
  49. of_node_put(np);
  50. mpic_init(mpic);
  51. }
  52. /*
  53. * Setup the architecture
  54. */
  55. static void __init mpc8536_ds_setup_arch(void)
  56. {
  57. #ifdef CONFIG_PCI
  58. struct device_node *np;
  59. #endif
  60. if (ppc_md.progress)
  61. ppc_md.progress("mpc8536_ds_setup_arch()", 0);
  62. #ifdef CONFIG_PCI
  63. for_each_node_by_type(np, "pci") {
  64. if (of_device_is_compatible(np, "fsl,mpc8540-pci") ||
  65. of_device_is_compatible(np, "fsl,mpc8548-pcie")) {
  66. struct resource rsrc;
  67. of_address_to_resource(np, 0, &rsrc);
  68. if ((rsrc.start & 0xfffff) == 0x8000)
  69. fsl_add_bridge(np, 1);
  70. else
  71. fsl_add_bridge(np, 0);
  72. }
  73. }
  74. #endif
  75. printk("MPC8536 DS board from Freescale Semiconductor\n");
  76. }
  77. static struct of_device_id __initdata mpc8536_ds_ids[] = {
  78. { .type = "soc", },
  79. { .compatible = "soc", },
  80. { .compatible = "simple-bus", },
  81. { .compatible = "gianfar", },
  82. {},
  83. };
  84. static int __init mpc8536_ds_publish_devices(void)
  85. {
  86. return of_platform_bus_probe(NULL, mpc8536_ds_ids, NULL);
  87. }
  88. machine_device_initcall(mpc8536_ds, mpc8536_ds_publish_devices);
  89. /*
  90. * Called very early, device-tree isn't unflattened
  91. */
  92. static int __init mpc8536_ds_probe(void)
  93. {
  94. unsigned long root = of_get_flat_dt_root();
  95. return of_flat_dt_is_compatible(root, "fsl,mpc8536ds");
  96. }
  97. define_machine(mpc8536_ds) {
  98. .name = "MPC8536 DS",
  99. .probe = mpc8536_ds_probe,
  100. .setup_arch = mpc8536_ds_setup_arch,
  101. .init_IRQ = mpc8536_ds_pic_init,
  102. #ifdef CONFIG_PCI
  103. .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
  104. #endif
  105. .get_irq = mpic_get_irq,
  106. .restart = fsl_rstcr_restart,
  107. .calibrate_decr = generic_calibrate_decr,
  108. .progress = udbg_progress,
  109. };