mpc832x_mds.c 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. /*
  2. * Copyright 2006 Freescale Semiconductor, Inc. All rights reserved.
  3. *
  4. * Description:
  5. * MPC832xE MDS board specific routines.
  6. *
  7. * This program is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License as published by the
  9. * Free Software Foundation; either version 2 of the License, or (at your
  10. * option) any later version.
  11. */
  12. #include <linux/stddef.h>
  13. #include <linux/kernel.h>
  14. #include <linux/init.h>
  15. #include <linux/errno.h>
  16. #include <linux/reboot.h>
  17. #include <linux/pci.h>
  18. #include <linux/kdev_t.h>
  19. #include <linux/major.h>
  20. #include <linux/console.h>
  21. #include <linux/delay.h>
  22. #include <linux/seq_file.h>
  23. #include <linux/root_dev.h>
  24. #include <linux/initrd.h>
  25. #include <linux/of_platform.h>
  26. #include <linux/of_device.h>
  27. #include <linux/atomic.h>
  28. #include <asm/time.h>
  29. #include <asm/io.h>
  30. #include <asm/machdep.h>
  31. #include <asm/ipic.h>
  32. #include <asm/irq.h>
  33. #include <asm/prom.h>
  34. #include <asm/udbg.h>
  35. #include <sysdev/fsl_soc.h>
  36. #include <sysdev/fsl_pci.h>
  37. #include <asm/qe.h>
  38. #include <asm/qe_ic.h>
  39. #include "mpc83xx.h"
  40. #undef DEBUG
  41. #ifdef DEBUG
  42. #define DBG(fmt...) udbg_printf(fmt)
  43. #else
  44. #define DBG(fmt...)
  45. #endif
  46. /* ************************************************************************
  47. *
  48. * Setup the architecture
  49. *
  50. */
  51. static void __init mpc832x_sys_setup_arch(void)
  52. {
  53. struct device_node *np;
  54. u8 __iomem *bcsr_regs = NULL;
  55. if (ppc_md.progress)
  56. ppc_md.progress("mpc832x_sys_setup_arch()", 0);
  57. /* Map BCSR area */
  58. np = of_find_node_by_name(NULL, "bcsr");
  59. if (np) {
  60. struct resource res;
  61. of_address_to_resource(np, 0, &res);
  62. bcsr_regs = ioremap(res.start, resource_size(&res));
  63. of_node_put(np);
  64. }
  65. mpc83xx_setup_pci();
  66. #ifdef CONFIG_QUICC_ENGINE
  67. qe_reset();
  68. if ((np = of_find_node_by_name(NULL, "par_io")) != NULL) {
  69. par_io_init(np);
  70. of_node_put(np);
  71. for (np = NULL; (np = of_find_node_by_name(np, "ucc")) != NULL;)
  72. par_io_of_config(np);
  73. }
  74. if ((np = of_find_compatible_node(NULL, "network", "ucc_geth"))
  75. != NULL){
  76. /* Reset the Ethernet PHYs */
  77. #define BCSR8_FETH_RST 0x50
  78. clrbits8(&bcsr_regs[8], BCSR8_FETH_RST);
  79. udelay(1000);
  80. setbits8(&bcsr_regs[8], BCSR8_FETH_RST);
  81. iounmap(bcsr_regs);
  82. of_node_put(np);
  83. }
  84. #endif /* CONFIG_QUICC_ENGINE */
  85. }
  86. machine_device_initcall(mpc832x_mds, mpc83xx_declare_of_platform_devices);
  87. /*
  88. * Called very early, MMU is off, device-tree isn't unflattened
  89. */
  90. static int __init mpc832x_sys_probe(void)
  91. {
  92. unsigned long root = of_get_flat_dt_root();
  93. return of_flat_dt_is_compatible(root, "MPC832xMDS");
  94. }
  95. define_machine(mpc832x_mds) {
  96. .name = "MPC832x MDS",
  97. .probe = mpc832x_sys_probe,
  98. .setup_arch = mpc832x_sys_setup_arch,
  99. .init_IRQ = mpc83xx_ipic_and_qe_init_IRQ,
  100. .get_irq = ipic_get_irq,
  101. .restart = mpc83xx_restart,
  102. .time_init = mpc83xx_time_init,
  103. .calibrate_decr = generic_calibrate_decr,
  104. .progress = udbg_progress,
  105. };