config.c 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  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. /***************************************************************************/
  20. /*
  21. * Some platforms need software versions of the GPIO data registers.
  22. */
  23. unsigned short ppdata;
  24. unsigned char ledbank = 0xff;
  25. /***************************************************************************/
  26. static struct mcf_platform_uart m5272_uart_platform[] = {
  27. {
  28. .mapbase = MCFUART_BASE0,
  29. .irq = MCF_IRQ_UART0,
  30. },
  31. {
  32. .mapbase = MCFUART_BASE1,
  33. .irq = MCF_IRQ_UART1,
  34. },
  35. { },
  36. };
  37. static struct platform_device m5272_uart = {
  38. .name = "mcfuart",
  39. .id = 0,
  40. .dev.platform_data = m5272_uart_platform,
  41. };
  42. static struct resource m5272_fec_resources[] = {
  43. {
  44. .start = MCF_MBAR + 0x840,
  45. .end = MCF_MBAR + 0x840 + 0x1cf,
  46. .flags = IORESOURCE_MEM,
  47. },
  48. {
  49. .start = MCF_IRQ_ERX,
  50. .end = MCF_IRQ_ERX,
  51. .flags = IORESOURCE_IRQ,
  52. },
  53. {
  54. .start = MCF_IRQ_ETX,
  55. .end = MCF_IRQ_ETX,
  56. .flags = IORESOURCE_IRQ,
  57. },
  58. {
  59. .start = MCF_IRQ_ENTC,
  60. .end = MCF_IRQ_ENTC,
  61. .flags = IORESOURCE_IRQ,
  62. },
  63. };
  64. static struct platform_device m5272_fec = {
  65. .name = "fec",
  66. .id = 0,
  67. .num_resources = ARRAY_SIZE(m5272_fec_resources),
  68. .resource = m5272_fec_resources,
  69. };
  70. static struct platform_device *m5272_devices[] __initdata = {
  71. &m5272_uart,
  72. &m5272_fec,
  73. };
  74. /***************************************************************************/
  75. static void __init m5272_uarts_init(void)
  76. {
  77. u32 v;
  78. /* Enable the output lines for the serial ports */
  79. v = readl(MCF_MBAR + MCFSIM_PBCNT);
  80. v = (v & ~0x000000ff) | 0x00000055;
  81. writel(v, MCF_MBAR + MCFSIM_PBCNT);
  82. v = readl(MCF_MBAR + MCFSIM_PDCNT);
  83. v = (v & ~0x000003fc) | 0x000002a8;
  84. writel(v, MCF_MBAR + MCFSIM_PDCNT);
  85. }
  86. /***************************************************************************/
  87. static void m5272_cpu_reset(void)
  88. {
  89. local_irq_disable();
  90. /* Set watchdog to reset, and enabled */
  91. __raw_writew(0, MCF_MBAR + MCFSIM_WIRR);
  92. __raw_writew(1, MCF_MBAR + MCFSIM_WRRR);
  93. __raw_writew(0, MCF_MBAR + MCFSIM_WCR);
  94. for (;;)
  95. /* wait for watchdog to timeout */;
  96. }
  97. /***************************************************************************/
  98. void __init config_BSP(char *commandp, int size)
  99. {
  100. #if defined (CONFIG_MOD5272)
  101. volatile unsigned char *pivrp;
  102. /* Set base of device vectors to be 64 */
  103. pivrp = (volatile unsigned char *) (MCF_MBAR + MCFSIM_PIVR);
  104. *pivrp = 0x40;
  105. #endif
  106. #if defined(CONFIG_NETtel) || defined(CONFIG_SCALES)
  107. /* Copy command line from FLASH to local buffer... */
  108. memcpy(commandp, (char *) 0xf0004000, size);
  109. commandp[size-1] = 0;
  110. #elif defined(CONFIG_CANCam)
  111. /* Copy command line from FLASH to local buffer... */
  112. memcpy(commandp, (char *) 0xf0010000, size);
  113. commandp[size-1] = 0;
  114. #endif
  115. mach_reset = m5272_cpu_reset;
  116. mach_sched_init = hw_timer_init;
  117. }
  118. /***************************************************************************/
  119. /*
  120. * Some 5272 based boards have the FEC ethernet diectly connected to
  121. * an ethernet switch. In this case we need to use the fixed phy type,
  122. * and we need to declare it early in boot.
  123. */
  124. static struct fixed_phy_status nettel_fixed_phy_status __initdata = {
  125. .link = 1,
  126. .speed = 100,
  127. .duplex = 0,
  128. };
  129. /***************************************************************************/
  130. static int __init init_BSP(void)
  131. {
  132. m5272_uarts_init();
  133. fixed_phy_add(PHY_POLL, 0, &nettel_fixed_phy_status);
  134. platform_add_devices(m5272_devices, ARRAY_SIZE(m5272_devices));
  135. return 0;
  136. }
  137. arch_initcall(init_BSP);
  138. /***************************************************************************/