p1010rdb.c 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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. #include "mpc85xx.h"
  28. void __init p1010_rdb_pic_init(void)
  29. {
  30. struct mpic *mpic;
  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. mpic = mpic_alloc(np, 0, MPIC_PRIMARY | MPIC_WANTS_RESET |
  38. MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS | MPIC_SINGLE_DEST_CPU,
  39. 0, 256, " OpenPIC ");
  40. BUG_ON(mpic == NULL);
  41. of_node_put(np);
  42. mpic_init(mpic);
  43. }
  44. /*
  45. * Setup the architecture
  46. */
  47. static void __init p1010_rdb_setup_arch(void)
  48. {
  49. #ifdef CONFIG_PCI
  50. struct device_node *np;
  51. #endif
  52. if (ppc_md.progress)
  53. ppc_md.progress("p1010_rdb_setup_arch()", 0);
  54. #ifdef CONFIG_PCI
  55. for_each_node_by_type(np, "pci") {
  56. if (of_device_is_compatible(np, "fsl,p1010-pcie"))
  57. fsl_add_bridge(np, 0);
  58. }
  59. #endif
  60. printk(KERN_INFO "P1010 RDB board from Freescale Semiconductor\n");
  61. }
  62. machine_device_initcall(p1010_rdb, mpc85xx_common_publish_devices);
  63. machine_arch_initcall(p1010_rdb, swiotlb_setup_bus_notifier);
  64. /*
  65. * Called very early, device-tree isn't unflattened
  66. */
  67. static int __init p1010_rdb_probe(void)
  68. {
  69. unsigned long root = of_get_flat_dt_root();
  70. if (of_flat_dt_is_compatible(root, "fsl,P1010RDB"))
  71. return 1;
  72. return 0;
  73. }
  74. define_machine(p1010_rdb) {
  75. .name = "P1010 RDB",
  76. .probe = p1010_rdb_probe,
  77. .setup_arch = p1010_rdb_setup_arch,
  78. .init_IRQ = p1010_rdb_pic_init,
  79. #ifdef CONFIG_PCI
  80. .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
  81. #endif
  82. .get_irq = mpic_get_irq,
  83. .restart = fsl_rstcr_restart,
  84. .calibrate_decr = generic_calibrate_decr,
  85. .progress = udbg_progress,
  86. };