config.c 3.7 KB

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