m5272.c 3.5 KB

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