mpc834x_mds.c 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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 <asm/system.h>
  26. #include <asm/atomic.h>
  27. #include <asm/time.h>
  28. #include <asm/io.h>
  29. #include <asm/machdep.h>
  30. #include <asm/ipic.h>
  31. #include <asm/bootinfo.h>
  32. #include <asm/irq.h>
  33. #include <asm/prom.h>
  34. #include <asm/udbg.h>
  35. #include <sysdev/fsl_soc.h>
  36. #include "mpc83xx.h"
  37. #define BCSR5_INT_USB 0x02
  38. static int mpc834xemds_usb_cfg(void)
  39. {
  40. struct device_node *np;
  41. void __iomem *bcsr_regs = NULL;
  42. u8 bcsr5;
  43. mpc834x_usb_cfg();
  44. /* Map BCSR area */
  45. np = of_find_node_by_name(NULL, "bcsr");
  46. if (np) {
  47. struct resource res;
  48. of_address_to_resource(np, 0, &res);
  49. bcsr_regs = ioremap(res.start, res.end - res.start + 1);
  50. of_node_put(np);
  51. }
  52. if (!bcsr_regs)
  53. return -1;
  54. /*
  55. * if Processor Board is plugged into PIB board,
  56. * force to use the PHY on Processor Board
  57. */
  58. bcsr5 = in_8(bcsr_regs + 5);
  59. if (!(bcsr5 & BCSR5_INT_USB))
  60. out_8(bcsr_regs + 5, (bcsr5 | BCSR5_INT_USB));
  61. iounmap(bcsr_regs);
  62. return 0;
  63. }
  64. /* ************************************************************************
  65. *
  66. * Setup the architecture
  67. *
  68. */
  69. static void __init mpc834x_mds_setup_arch(void)
  70. {
  71. #ifdef CONFIG_PCI
  72. struct device_node *np;
  73. #endif
  74. if (ppc_md.progress)
  75. ppc_md.progress("mpc834x_mds_setup_arch()", 0);
  76. #ifdef CONFIG_PCI
  77. for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
  78. mpc83xx_add_bridge(np);
  79. ppc_md.pci_exclude_device = mpc83xx_exclude_device;
  80. #endif
  81. mpc834xemds_usb_cfg();
  82. }
  83. static void __init mpc834x_mds_init_IRQ(void)
  84. {
  85. struct device_node *np;
  86. np = of_find_node_by_type(NULL, "ipic");
  87. if (!np)
  88. return;
  89. ipic_init(np, 0);
  90. /* Initialize the default interrupt mapping priorities,
  91. * in case the boot rom changed something on us.
  92. */
  93. ipic_set_default_priority();
  94. }
  95. #if defined(CONFIG_I2C_MPC) && defined(CONFIG_SENSORS_DS1374)
  96. extern ulong ds1374_get_rtc_time(void);
  97. extern int ds1374_set_rtc_time(ulong);
  98. static int __init mpc834x_rtc_hookup(void)
  99. {
  100. struct timespec tv;
  101. if (!machine_is(mpc834x_mds))
  102. return 0;
  103. ppc_md.get_rtc_time = ds1374_get_rtc_time;
  104. ppc_md.set_rtc_time = ds1374_set_rtc_time;
  105. tv.tv_nsec = 0;
  106. tv.tv_sec = (ppc_md.get_rtc_time) ();
  107. do_settimeofday(&tv);
  108. return 0;
  109. }
  110. late_initcall(mpc834x_rtc_hookup);
  111. #endif
  112. /*
  113. * Called very early, MMU is off, device-tree isn't unflattened
  114. */
  115. static int __init mpc834x_mds_probe(void)
  116. {
  117. unsigned long root = of_get_flat_dt_root();
  118. return of_flat_dt_is_compatible(root, "MPC834xMDS");
  119. }
  120. define_machine(mpc834x_mds) {
  121. .name = "MPC834x MDS",
  122. .probe = mpc834x_mds_probe,
  123. .setup_arch = mpc834x_mds_setup_arch,
  124. .init_IRQ = mpc834x_mds_init_IRQ,
  125. .get_irq = ipic_get_irq,
  126. .restart = mpc83xx_restart,
  127. .time_init = mpc83xx_time_init,
  128. .calibrate_decr = generic_calibrate_decr,
  129. .progress = udbg_progress,
  130. };