mpc834x_sys.c 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. /*
  2. * arch/powerpc/platforms/83xx/mpc834x_sys.c
  3. *
  4. * MPC834x SYS 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. #ifndef CONFIG_PCI
  38. unsigned long isa_io_base = 0;
  39. unsigned long isa_mem_base = 0;
  40. #endif
  41. /* ************************************************************************
  42. *
  43. * Setup the architecture
  44. *
  45. */
  46. static void __init mpc834x_sys_setup_arch(void)
  47. {
  48. struct device_node *np;
  49. if (ppc_md.progress)
  50. ppc_md.progress("mpc834x_sys_setup_arch()", 0);
  51. np = of_find_node_by_type(NULL, "cpu");
  52. if (np != 0) {
  53. const unsigned int *fp =
  54. get_property(np, "clock-frequency", NULL);
  55. if (fp != 0)
  56. loops_per_jiffy = *fp / HZ;
  57. else
  58. loops_per_jiffy = 50000000 / HZ;
  59. of_node_put(np);
  60. }
  61. #ifdef CONFIG_PCI
  62. for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
  63. add_bridge(np);
  64. ppc_md.pci_exclude_device = mpc83xx_exclude_device;
  65. #endif
  66. #ifdef CONFIG_ROOT_NFS
  67. ROOT_DEV = Root_NFS;
  68. #else
  69. ROOT_DEV = Root_HDA1;
  70. #endif
  71. }
  72. static void __init mpc834x_sys_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. }
  84. #if defined(CONFIG_I2C_MPC) && defined(CONFIG_SENSORS_DS1374)
  85. extern ulong ds1374_get_rtc_time(void);
  86. extern int ds1374_set_rtc_time(ulong);
  87. static int __init mpc834x_rtc_hookup(void)
  88. {
  89. struct timespec tv;
  90. ppc_md.get_rtc_time = ds1374_get_rtc_time;
  91. ppc_md.set_rtc_time = ds1374_set_rtc_time;
  92. tv.tv_nsec = 0;
  93. tv.tv_sec = (ppc_md.get_rtc_time) ();
  94. do_settimeofday(&tv);
  95. return 0;
  96. }
  97. late_initcall(mpc834x_rtc_hookup);
  98. #endif
  99. /*
  100. * Called very early, MMU is off, device-tree isn't unflattened
  101. */
  102. static int __init mpc834x_sys_probe(void)
  103. {
  104. /* We always match for now, eventually we should look at the flat
  105. dev tree to ensure this is the board we are suppose to run on
  106. */
  107. return 1;
  108. }
  109. define_machine(mpc834x_sys) {
  110. .name = "MPC834x SYS",
  111. .probe = mpc834x_sys_probe,
  112. .setup_arch = mpc834x_sys_setup_arch,
  113. .init_IRQ = mpc834x_sys_init_IRQ,
  114. .get_irq = ipic_get_irq,
  115. .restart = mpc83xx_restart,
  116. .time_init = mpc83xx_time_init,
  117. .calibrate_decr = generic_calibrate_decr,
  118. .progress = udbg_progress,
  119. };