m5272.c 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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/mcfgpio.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. struct mcf_gpio_chip mcf_gpio_chips[] = {
  28. MCFGPS(PA, 0, 16, MCFSIM_PADDR, MCFSIM_PADAT, MCFSIM_PADAT),
  29. MCFGPS(PB, 16, 16, MCFSIM_PBDDR, MCFSIM_PBDAT, MCFSIM_PBDAT),
  30. MCFGPS(Pc, 32, 16, MCFSIM_PCDDR, MCFSIM_PCDAT, MCFSIM_PCDAT),
  31. };
  32. unsigned int mcf_gpio_chips_size = ARRAY_SIZE(mcf_gpio_chips);
  33. /***************************************************************************/
  34. static void __init m5272_uarts_init(void)
  35. {
  36. u32 v;
  37. /* Enable the output lines for the serial ports */
  38. v = readl(MCF_MBAR + MCFSIM_PBCNT);
  39. v = (v & ~0x000000ff) | 0x00000055;
  40. writel(v, MCF_MBAR + MCFSIM_PBCNT);
  41. v = readl(MCF_MBAR + MCFSIM_PDCNT);
  42. v = (v & ~0x000003fc) | 0x000002a8;
  43. writel(v, MCF_MBAR + MCFSIM_PDCNT);
  44. }
  45. /***************************************************************************/
  46. static void m5272_cpu_reset(void)
  47. {
  48. local_irq_disable();
  49. /* Set watchdog to reset, and enabled */
  50. __raw_writew(0, MCF_MBAR + MCFSIM_WIRR);
  51. __raw_writew(1, MCF_MBAR + MCFSIM_WRRR);
  52. __raw_writew(0, MCF_MBAR + MCFSIM_WCR);
  53. for (;;)
  54. /* wait for watchdog to timeout */;
  55. }
  56. /***************************************************************************/
  57. void __init config_BSP(char *commandp, int size)
  58. {
  59. #if defined (CONFIG_MOD5272)
  60. volatile unsigned char *pivrp;
  61. /* Set base of device vectors to be 64 */
  62. pivrp = (volatile unsigned char *) (MCF_MBAR + MCFSIM_PIVR);
  63. *pivrp = 0x40;
  64. #endif
  65. #if defined(CONFIG_NETtel) || defined(CONFIG_SCALES)
  66. /* Copy command line from FLASH to local buffer... */
  67. memcpy(commandp, (char *) 0xf0004000, size);
  68. commandp[size-1] = 0;
  69. #elif defined(CONFIG_CANCam)
  70. /* Copy command line from FLASH to local buffer... */
  71. memcpy(commandp, (char *) 0xf0010000, size);
  72. commandp[size-1] = 0;
  73. #endif
  74. mach_reset = m5272_cpu_reset;
  75. mach_sched_init = hw_timer_init;
  76. }
  77. /***************************************************************************/
  78. /*
  79. * Some 5272 based boards have the FEC ethernet diectly connected to
  80. * an ethernet switch. In this case we need to use the fixed phy type,
  81. * and we need to declare it early in boot.
  82. */
  83. static struct fixed_phy_status nettel_fixed_phy_status __initdata = {
  84. .link = 1,
  85. .speed = 100,
  86. .duplex = 0,
  87. };
  88. /***************************************************************************/
  89. static int __init init_BSP(void)
  90. {
  91. m5272_uarts_init();
  92. fixed_phy_add(PHY_POLL, 0, &nettel_fixed_phy_status);
  93. return 0;
  94. }
  95. arch_initcall(init_BSP);
  96. /***************************************************************************/