mpc832x_rdb.c 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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. #endif
  46. #ifdef CONFIG_QUICC_ENGINE
  47. qe_reset();
  48. if ((np = of_find_node_by_name(np, "par_io")) != NULL) {
  49. par_io_init(np);
  50. of_node_put(np);
  51. for (np = NULL; (np = of_find_node_by_name(np, "ucc")) != NULL;)
  52. par_io_of_config(np);
  53. }
  54. #endif /* CONFIG_QUICC_ENGINE */
  55. }
  56. static struct of_device_id mpc832x_ids[] = {
  57. { .type = "soc", },
  58. { .compatible = "soc", },
  59. { .type = "qe", },
  60. {},
  61. };
  62. static int __init mpc832x_declare_of_platform_devices(void)
  63. {
  64. if (!machine_is(mpc832x_rdb))
  65. return 0;
  66. /* Publish the QE devices */
  67. of_platform_bus_probe(NULL, mpc832x_ids, NULL);
  68. return 0;
  69. }
  70. device_initcall(mpc832x_declare_of_platform_devices);
  71. void __init mpc832x_rdb_init_IRQ(void)
  72. {
  73. struct device_node *np;
  74. np = of_find_node_by_type(NULL, "ipic");
  75. if (!np)
  76. return;
  77. ipic_init(np, 0);
  78. /* Initialize the default interrupt mapping priorities,
  79. * in case the boot rom changed something on us.
  80. */
  81. ipic_set_default_priority();
  82. of_node_put(np);
  83. #ifdef CONFIG_QUICC_ENGINE
  84. np = of_find_node_by_type(NULL, "qeic");
  85. if (!np)
  86. return;
  87. qe_ic_init(np, 0);
  88. of_node_put(np);
  89. #endif /* CONFIG_QUICC_ENGINE */
  90. }
  91. /*
  92. * Called very early, MMU is off, device-tree isn't unflattened
  93. */
  94. static int __init mpc832x_rdb_probe(void)
  95. {
  96. unsigned long root = of_get_flat_dt_root();
  97. return of_flat_dt_is_compatible(root, "MPC832xRDB");
  98. }
  99. define_machine(mpc832x_rdb) {
  100. .name = "MPC832x RDB",
  101. .probe = mpc832x_rdb_probe,
  102. .setup_arch = mpc832x_rdb_setup_arch,
  103. .init_IRQ = mpc832x_rdb_init_IRQ,
  104. .get_irq = ipic_get_irq,
  105. .restart = mpc83xx_restart,
  106. .time_init = mpc83xx_time_init,
  107. .calibrate_decr = generic_calibrate_decr,
  108. .progress = udbg_progress,
  109. };