mpc832x_rdb.c 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /*
  2. * arch/powerpc/platforms/83xx/mpc832x_rdb.c
  3. *
  4. * Copyright (C) Freescale Semiconductor, Inc. 2007. All rights reserved.
  5. *
  6. * Description:
  7. * MPC832x RDB board specific routines.
  8. * This file is based on mpc832x_mds.c and mpc8313_rdb.c
  9. * Author: Michael Barkowski <michael.barkowski@freescale.com>
  10. *
  11. * This program is free software; you can redistribute it and/or modify it
  12. * under the terms of the GNU General Public License as published by the
  13. * Free Software Foundation; either version 2 of the License, or (at your
  14. * option) any later version.
  15. */
  16. #include <linux/pci.h>
  17. #include <asm/of_platform.h>
  18. #include <asm/time.h>
  19. #include <asm/ipic.h>
  20. #include <asm/udbg.h>
  21. #include <asm/qe.h>
  22. #include <asm/qe_ic.h>
  23. #include "mpc83xx.h"
  24. #undef DEBUG
  25. #ifdef DEBUG
  26. #define DBG(fmt...) udbg_printf(fmt)
  27. #else
  28. #define DBG(fmt...)
  29. #endif
  30. /* ************************************************************************
  31. *
  32. * Setup the architecture
  33. *
  34. */
  35. static void __init mpc832x_rdb_setup_arch(void)
  36. {
  37. #if defined(CONFIG_PCI) || defined(CONFIG_QUICC_ENGINE)
  38. struct device_node *np;
  39. #endif
  40. if (ppc_md.progress)
  41. ppc_md.progress("mpc832x_rdb_setup_arch()", 0);
  42. #ifdef CONFIG_PCI
  43. for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
  44. mpc83xx_add_bridge(np);
  45. ppc_md.pci_exclude_device = mpc83xx_exclude_device;
  46. #endif
  47. #ifdef CONFIG_QUICC_ENGINE
  48. qe_reset();
  49. if ((np = of_find_node_by_name(np, "par_io")) != NULL) {
  50. par_io_init(np);
  51. of_node_put(np);
  52. for (np = NULL; (np = of_find_node_by_name(np, "ucc")) != NULL;)
  53. par_io_of_config(np);
  54. }
  55. #endif /* CONFIG_QUICC_ENGINE */
  56. }
  57. static struct of_device_id mpc832x_ids[] = {
  58. { .type = "soc", },
  59. { .compatible = "soc", },
  60. { .type = "qe", },
  61. {},
  62. };
  63. static int __init mpc832x_declare_of_platform_devices(void)
  64. {
  65. if (!machine_is(mpc832x_rdb))
  66. return 0;
  67. /* Publish the QE devices */
  68. of_platform_bus_probe(NULL, mpc832x_ids, NULL);
  69. return 0;
  70. }
  71. device_initcall(mpc832x_declare_of_platform_devices);
  72. void __init mpc832x_rdb_init_IRQ(void)
  73. {
  74. struct device_node *np;
  75. np = of_find_node_by_type(NULL, "ipic");
  76. if (!np)
  77. return;
  78. ipic_init(np, 0);
  79. /* Initialize the default interrupt mapping priorities,
  80. * in case the boot rom changed something on us.
  81. */
  82. ipic_set_default_priority();
  83. of_node_put(np);
  84. #ifdef CONFIG_QUICC_ENGINE
  85. np = of_find_node_by_type(NULL, "qeic");
  86. if (!np)
  87. return;
  88. qe_ic_init(np, 0);
  89. of_node_put(np);
  90. #endif /* CONFIG_QUICC_ENGINE */
  91. }
  92. /*
  93. * Called very early, MMU is off, device-tree isn't unflattened
  94. */
  95. static int __init mpc832x_rdb_probe(void)
  96. {
  97. unsigned long root = of_get_flat_dt_root();
  98. return of_flat_dt_is_compatible(root, "MPC832xRDB");
  99. }
  100. define_machine(mpc832x_rdb) {
  101. .name = "MPC832x RDB",
  102. .probe = mpc832x_rdb_probe,
  103. .setup_arch = mpc832x_rdb_setup_arch,
  104. .init_IRQ = mpc832x_rdb_init_IRQ,
  105. .get_irq = ipic_get_irq,
  106. .restart = mpc83xx_restart,
  107. .time_init = mpc83xx_time_init,
  108. .calibrate_decr = generic_calibrate_decr,
  109. .progress = udbg_progress,
  110. };