config.c 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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/interrupt.h>
  13. #include <linux/io.h>
  14. #include <asm/machdep.h>
  15. #include <asm/coldfire.h>
  16. #include <asm/mcfsim.h>
  17. #include <asm/mcfuart.h>
  18. /***************************************************************************/
  19. void coldfire_reset(void);
  20. extern unsigned int mcf_timervector;
  21. extern unsigned int mcf_profilevector;
  22. extern unsigned int mcf_timerlevel;
  23. /***************************************************************************/
  24. /*
  25. * Some platforms need software versions of the GPIO data registers.
  26. */
  27. unsigned short ppdata;
  28. unsigned char ledbank = 0xff;
  29. /***************************************************************************/
  30. static struct mcf_platform_uart m5272_uart_platform[] = {
  31. {
  32. .mapbase = MCF_MBAR + MCFUART_BASE1,
  33. .irq = 73,
  34. },
  35. {
  36. .mapbase = MCF_MBAR + MCFUART_BASE2,
  37. .irq = 74,
  38. },
  39. { },
  40. };
  41. static struct platform_device m5272_uart = {
  42. .name = "mcfuart",
  43. .id = 0,
  44. .dev.platform_data = m5272_uart_platform,
  45. };
  46. static struct platform_device *m5272_devices[] __initdata = {
  47. &m5272_uart,
  48. };
  49. /***************************************************************************/
  50. static void __init m5272_uart_init_line(int line, int irq)
  51. {
  52. u32 v;
  53. if ((line >= 0) && (line < 2)) {
  54. v = (line) ? 0x0e000000 : 0xe0000000;
  55. writel(v, MCF_MBAR + MCFSIM_ICR2);
  56. /* Enable the output lines for the serial ports */
  57. v = readl(MCF_MBAR + MCFSIM_PBCNT);
  58. v = (v & ~0x000000ff) | 0x00000055;
  59. writel(v, MCF_MBAR + MCFSIM_PBCNT);
  60. v = readl(MCF_MBAR + MCFSIM_PDCNT);
  61. v = (v & ~0x000003fc) | 0x000002a8;
  62. writel(v, MCF_MBAR + MCFSIM_PDCNT);
  63. }
  64. }
  65. static void __init m5272_uarts_init(void)
  66. {
  67. const int nrlines = ARRAY_SIZE(m5272_uart_platform);
  68. int line;
  69. for (line = 0; (line < nrlines); line++)
  70. m5272_uart_init_line(line, m5272_uart_platform[line].irq);
  71. }
  72. /***************************************************************************/
  73. void mcf_disableall(void)
  74. {
  75. volatile unsigned long *icrp;
  76. icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR1);
  77. icrp[0] = 0x88888888;
  78. icrp[1] = 0x88888888;
  79. icrp[2] = 0x88888888;
  80. icrp[3] = 0x88888888;
  81. }
  82. /***************************************************************************/
  83. void mcf_autovector(unsigned int vec)
  84. {
  85. /* Everything is auto-vectored on the 5272 */
  86. }
  87. /***************************************************************************/
  88. void mcf_settimericr(int timer, int level)
  89. {
  90. volatile unsigned long *icrp;
  91. if ((timer >= 1 ) && (timer <= 4)) {
  92. icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR1);
  93. *icrp = (0x8 | level) << ((4 - timer) * 4);
  94. }
  95. }
  96. /***************************************************************************/
  97. void __init config_BSP(char *commandp, int size)
  98. {
  99. #if defined (CONFIG_MOD5272)
  100. volatile unsigned char *pivrp;
  101. /* Set base of device vectors to be 64 */
  102. pivrp = (volatile unsigned char *) (MCF_MBAR + MCFSIM_PIVR);
  103. *pivrp = 0x40;
  104. #endif
  105. mcf_disableall();
  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. mcf_timervector = 69;
  116. mcf_profilevector = 70;
  117. mach_reset = coldfire_reset;
  118. }
  119. /***************************************************************************/
  120. static int __init init_BSP(void)
  121. {
  122. m5272_uarts_init();
  123. platform_add_devices(m5272_devices, ARRAY_SIZE(m5272_devices));
  124. return 0;
  125. }
  126. arch_initcall(init_BSP);
  127. /***************************************************************************/