mpc834x_mds.c 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /*
  2. * arch/powerpc/platforms/83xx/mpc834x_mds.c
  3. *
  4. * MPC834x MDS board specific routines
  5. *
  6. * Maintainer: Kumar Gala <galak@kernel.crashing.org>
  7. *
  8. * This program is free software; you can redistribute it and/or modify it
  9. * under the terms of the GNU General Public License as published by the
  10. * Free Software Foundation; either version 2 of the License, or (at your
  11. * option) any later version.
  12. */
  13. #include <linux/stddef.h>
  14. #include <linux/kernel.h>
  15. #include <linux/init.h>
  16. #include <linux/errno.h>
  17. #include <linux/reboot.h>
  18. #include <linux/pci.h>
  19. #include <linux/kdev_t.h>
  20. #include <linux/major.h>
  21. #include <linux/console.h>
  22. #include <linux/delay.h>
  23. #include <linux/seq_file.h>
  24. #include <linux/root_dev.h>
  25. #include <linux/of_platform.h>
  26. #include <asm/system.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 "mpc83xx.h"
  38. #define BCSR5_INT_USB 0x02
  39. static int mpc834xemds_usb_cfg(void)
  40. {
  41. struct device_node *np;
  42. void __iomem *bcsr_regs = NULL;
  43. u8 bcsr5;
  44. mpc834x_usb_cfg();
  45. /* Map BCSR area */
  46. np = of_find_node_by_name(NULL, "bcsr");
  47. if (np) {
  48. struct resource res;
  49. of_address_to_resource(np, 0, &res);
  50. bcsr_regs = ioremap(res.start, resource_size(&res));
  51. of_node_put(np);
  52. }
  53. if (!bcsr_regs)
  54. return -1;
  55. /*
  56. * if Processor Board is plugged into PIB board,
  57. * force to use the PHY on Processor Board
  58. */
  59. bcsr5 = in_8(bcsr_regs + 5);
  60. if (!(bcsr5 & BCSR5_INT_USB))
  61. out_8(bcsr_regs + 5, (bcsr5 | BCSR5_INT_USB));
  62. iounmap(bcsr_regs);
  63. return 0;
  64. }
  65. /* ************************************************************************
  66. *
  67. * Setup the architecture
  68. *
  69. */
  70. static void __init mpc834x_mds_setup_arch(void)
  71. {
  72. if (ppc_md.progress)
  73. ppc_md.progress("mpc834x_mds_setup_arch()", 0);
  74. mpc83xx_setup_pci();
  75. mpc834xemds_usb_cfg();
  76. }
  77. machine_device_initcall(mpc834x_mds, mpc83xx_declare_of_platform_devices);
  78. /*
  79. * Called very early, MMU is off, device-tree isn't unflattened
  80. */
  81. static int __init mpc834x_mds_probe(void)
  82. {
  83. unsigned long root = of_get_flat_dt_root();
  84. return of_flat_dt_is_compatible(root, "MPC834xMDS");
  85. }
  86. define_machine(mpc834x_mds) {
  87. .name = "MPC834x MDS",
  88. .probe = mpc834x_mds_probe,
  89. .setup_arch = mpc834x_mds_setup_arch,
  90. .init_IRQ = mpc83xx_ipic_init_IRQ,
  91. .get_irq = ipic_get_irq,
  92. .restart = mpc83xx_restart,
  93. .time_init = mpc83xx_time_init,
  94. .calibrate_decr = generic_calibrate_decr,
  95. .progress = udbg_progress,
  96. };