m5272.c 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. /***************************************************************************/
  2. /*
  3. * m5272.c -- platform support for ColdFire 5272 based boards
  4. *
  5. * Copyright (C) 1999-2002, Greg Ungerer (gerg@snapgear.com)
  6. * Copyright (C) 2001-2002, SnapGear Inc. (www.snapgear.com)
  7. */
  8. /***************************************************************************/
  9. #include <linux/kernel.h>
  10. #include <linux/param.h>
  11. #include <linux/init.h>
  12. #include <linux/io.h>
  13. #include <linux/phy.h>
  14. #include <linux/phy_fixed.h>
  15. #include <asm/machdep.h>
  16. #include <asm/coldfire.h>
  17. #include <asm/mcfsim.h>
  18. #include <asm/mcfuart.h>
  19. #include <asm/mcfclk.h>
  20. /***************************************************************************/
  21. /*
  22. * Some platforms need software versions of the GPIO data registers.
  23. */
  24. unsigned short ppdata;
  25. unsigned char ledbank = 0xff;
  26. /***************************************************************************/
  27. DEFINE_CLK(pll, "pll.0", MCF_CLK);
  28. DEFINE_CLK(sys, "sys.0", MCF_BUSCLK);
  29. DEFINE_CLK(mcftmr0, "mcftmr.0", MCF_BUSCLK);
  30. DEFINE_CLK(mcftmr1, "mcftmr.1", MCF_BUSCLK);
  31. DEFINE_CLK(mcftmr2, "mcftmr.2", MCF_BUSCLK);
  32. DEFINE_CLK(mcftmr3, "mcftmr.3", MCF_BUSCLK);
  33. DEFINE_CLK(mcfuart0, "mcfuart.0", MCF_BUSCLK);
  34. DEFINE_CLK(mcfuart1, "mcfuart.1", MCF_BUSCLK);
  35. DEFINE_CLK(mcfqspi0, "mcfqspi.0", MCF_BUSCLK);
  36. DEFINE_CLK(fec0, "fec.0", MCF_BUSCLK);
  37. struct clk *mcf_clks[] = {
  38. &clk_pll,
  39. &clk_sys,
  40. &clk_mcftmr0,
  41. &clk_mcftmr1,
  42. &clk_mcftmr2,
  43. &clk_mcftmr3,
  44. &clk_mcfuart0,
  45. &clk_mcfuart1,
  46. &clk_mcfqspi0,
  47. &clk_fec0,
  48. NULL
  49. };
  50. /***************************************************************************/
  51. static void __init m5272_uarts_init(void)
  52. {
  53. u32 v;
  54. /* Enable the output lines for the serial ports */
  55. v = readl(MCFSIM_PBCNT);
  56. v = (v & ~0x000000ff) | 0x00000055;
  57. writel(v, MCFSIM_PBCNT);
  58. v = readl(MCFSIM_PDCNT);
  59. v = (v & ~0x000003fc) | 0x000002a8;
  60. writel(v, MCFSIM_PDCNT);
  61. }
  62. /***************************************************************************/
  63. static void m5272_cpu_reset(void)
  64. {
  65. local_irq_disable();
  66. /* Set watchdog to reset, and enabled */
  67. __raw_writew(0, MCFSIM_WIRR);
  68. __raw_writew(1, MCFSIM_WRRR);
  69. __raw_writew(0, MCFSIM_WCR);
  70. for (;;)
  71. /* wait for watchdog to timeout */;
  72. }
  73. /***************************************************************************/
  74. void __init config_BSP(char *commandp, int size)
  75. {
  76. #if defined (CONFIG_MOD5272)
  77. /* Set base of device vectors to be 64 */
  78. writeb(0x40, MCFSIM_PIVR);
  79. #endif
  80. #if defined(CONFIG_NETtel) || defined(CONFIG_SCALES)
  81. /* Copy command line from FLASH to local buffer... */
  82. memcpy(commandp, (char *) 0xf0004000, size);
  83. commandp[size-1] = 0;
  84. #elif defined(CONFIG_CANCam)
  85. /* Copy command line from FLASH to local buffer... */
  86. memcpy(commandp, (char *) 0xf0010000, size);
  87. commandp[size-1] = 0;
  88. #endif
  89. mach_reset = m5272_cpu_reset;
  90. mach_sched_init = hw_timer_init;
  91. }
  92. /***************************************************************************/
  93. /*
  94. * Some 5272 based boards have the FEC ethernet directly connected to
  95. * an ethernet switch. In this case we need to use the fixed phy type,
  96. * and we need to declare it early in boot.
  97. */
  98. static struct fixed_phy_status nettel_fixed_phy_status __initdata = {
  99. .link = 1,
  100. .speed = 100,
  101. .duplex = 0,
  102. };
  103. /***************************************************************************/
  104. static int __init init_BSP(void)
  105. {
  106. m5272_uarts_init();
  107. fixed_phy_add(PHY_POLL, 0, &nettel_fixed_phy_status, -1);
  108. return 0;
  109. }
  110. arch_initcall(init_BSP);
  111. /***************************************************************************/