m5272.c 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. /***************************************************************************/
  2. /*
  3. * linux/arch/m68knommu/platform/5272/config.c
  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(fec0, "fec.0", MCF_BUSCLK);
  36. struct clk *mcf_clks[] = {
  37. &clk_pll,
  38. &clk_sys,
  39. &clk_mcftmr0,
  40. &clk_mcftmr1,
  41. &clk_mcftmr2,
  42. &clk_mcftmr3,
  43. &clk_mcfuart0,
  44. &clk_mcfuart1,
  45. &clk_fec0,
  46. NULL
  47. };
  48. /***************************************************************************/
  49. static void __init m5272_uarts_init(void)
  50. {
  51. u32 v;
  52. /* Enable the output lines for the serial ports */
  53. v = readl(MCFSIM_PBCNT);
  54. v = (v & ~0x000000ff) | 0x00000055;
  55. writel(v, MCFSIM_PBCNT);
  56. v = readl(MCFSIM_PDCNT);
  57. v = (v & ~0x000003fc) | 0x000002a8;
  58. writel(v, MCFSIM_PDCNT);
  59. }
  60. /***************************************************************************/
  61. static void m5272_cpu_reset(void)
  62. {
  63. local_irq_disable();
  64. /* Set watchdog to reset, and enabled */
  65. __raw_writew(0, MCFSIM_WIRR);
  66. __raw_writew(1, MCFSIM_WRRR);
  67. __raw_writew(0, MCFSIM_WCR);
  68. for (;;)
  69. /* wait for watchdog to timeout */;
  70. }
  71. /***************************************************************************/
  72. void __init config_BSP(char *commandp, int size)
  73. {
  74. #if defined (CONFIG_MOD5272)
  75. /* Set base of device vectors to be 64 */
  76. writeb(0x40, MCFSIM_PIVR);
  77. #endif
  78. #if defined(CONFIG_NETtel) || defined(CONFIG_SCALES)
  79. /* Copy command line from FLASH to local buffer... */
  80. memcpy(commandp, (char *) 0xf0004000, size);
  81. commandp[size-1] = 0;
  82. #elif defined(CONFIG_CANCam)
  83. /* Copy command line from FLASH to local buffer... */
  84. memcpy(commandp, (char *) 0xf0010000, size);
  85. commandp[size-1] = 0;
  86. #endif
  87. mach_reset = m5272_cpu_reset;
  88. mach_sched_init = hw_timer_init;
  89. }
  90. /***************************************************************************/
  91. /*
  92. * Some 5272 based boards have the FEC ethernet diectly connected to
  93. * an ethernet switch. In this case we need to use the fixed phy type,
  94. * and we need to declare it early in boot.
  95. */
  96. static struct fixed_phy_status nettel_fixed_phy_status __initdata = {
  97. .link = 1,
  98. .speed = 100,
  99. .duplex = 0,
  100. };
  101. /***************************************************************************/
  102. static int __init init_BSP(void)
  103. {
  104. m5272_uarts_init();
  105. fixed_phy_add(PHY_POLL, 0, &nettel_fixed_phy_status);
  106. return 0;
  107. }
  108. arch_initcall(init_BSP);
  109. /***************************************************************************/