p1010rdb.c 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. /*
  2. * P1010RDB Board Setup
  3. *
  4. * Copyright 2011 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/delay.h>
  15. #include <linux/interrupt.h>
  16. #include <linux/of_platform.h>
  17. #include <asm/system.h>
  18. #include <asm/time.h>
  19. #include <asm/machdep.h>
  20. #include <asm/pci-bridge.h>
  21. #include <mm/mmu_decl.h>
  22. #include <asm/prom.h>
  23. #include <asm/udbg.h>
  24. #include <asm/mpic.h>
  25. #include <sysdev/fsl_soc.h>
  26. #include <sysdev/fsl_pci.h>
  27. void __init p1010_rdb_pic_init(void)
  28. {
  29. struct mpic *mpic;
  30. struct resource r;
  31. struct device_node *np;
  32. np = of_find_node_by_type(NULL, "open-pic");
  33. if (np == NULL) {
  34. printk(KERN_ERR "Could not find open-pic node\n");
  35. return;
  36. }
  37. if (of_address_to_resource(np, 0, &r)) {
  38. printk(KERN_ERR "Failed to map mpic register space\n");
  39. of_node_put(np);
  40. return;
  41. }
  42. mpic = mpic_alloc(np, r.start, MPIC_PRIMARY | MPIC_WANTS_RESET |
  43. MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS | MPIC_SINGLE_DEST_CPU,
  44. 0, 256, " OpenPIC ");
  45. BUG_ON(mpic == NULL);
  46. of_node_put(np);
  47. mpic_init(mpic);
  48. }
  49. /*
  50. * Setup the architecture
  51. */
  52. static void __init p1010_rdb_setup_arch(void)
  53. {
  54. #ifdef CONFIG_PCI
  55. struct device_node *np;
  56. #endif
  57. if (ppc_md.progress)
  58. ppc_md.progress("p1010_rdb_setup_arch()", 0);
  59. #ifdef CONFIG_PCI
  60. for_each_node_by_type(np, "pci") {
  61. if (of_device_is_compatible(np, "fsl,p1010-pcie"))
  62. fsl_add_bridge(np, 0);
  63. }
  64. #endif
  65. printk(KERN_INFO "P1010 RDB board from Freescale Semiconductor\n");
  66. }
  67. static struct of_device_id __initdata p1010rdb_ids[] = {
  68. { .type = "soc", },
  69. { .compatible = "soc", },
  70. { .compatible = "simple-bus", },
  71. {},
  72. };
  73. static int __init p1010rdb_publish_devices(void)
  74. {
  75. return of_platform_bus_probe(NULL, p1010rdb_ids, NULL);
  76. }
  77. machine_device_initcall(p1010_rdb, p1010rdb_publish_devices);
  78. machine_arch_initcall(p1010_rdb, swiotlb_setup_bus_notifier);
  79. /*
  80. * Called very early, device-tree isn't unflattened
  81. */
  82. static int __init p1010_rdb_probe(void)
  83. {
  84. unsigned long root = of_get_flat_dt_root();
  85. if (of_flat_dt_is_compatible(root, "fsl,P1010RDB"))
  86. return 1;
  87. return 0;
  88. }
  89. define_machine(p1010_rdb) {
  90. .name = "P1010 RDB",
  91. .probe = p1010_rdb_probe,
  92. .setup_arch = p1010_rdb_setup_arch,
  93. .init_IRQ = p1010_rdb_pic_init,
  94. #ifdef CONFIG_PCI
  95. .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
  96. #endif
  97. .get_irq = mpic_get_irq,
  98. .restart = fsl_rstcr_restart,
  99. .calibrate_decr = generic_calibrate_decr,
  100. .progress = udbg_progress,
  101. };