config.c 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. /***************************************************************************/
  2. /*
  3. * linux/arch/m68knommu/platform/5307/config.c
  4. *
  5. * Copyright (C) 1999-2002, Greg Ungerer (gerg@snapgear.com)
  6. * Copyright (C) 2000, Lineo (www.lineo.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. #include <asm/mcfwdebug.h>
  19. /***************************************************************************/
  20. void coldfire_reset(void);
  21. extern unsigned int mcf_timervector;
  22. extern unsigned int mcf_profilevector;
  23. extern unsigned int mcf_timerlevel;
  24. /***************************************************************************/
  25. /*
  26. * Some platforms need software versions of the GPIO data registers.
  27. */
  28. unsigned short ppdata;
  29. unsigned char ledbank = 0xff;
  30. /***************************************************************************/
  31. static struct mcf_platform_uart m5307_uart_platform[] = {
  32. {
  33. .mapbase = MCF_MBAR + MCFUART_BASE1,
  34. .irq = 73,
  35. },
  36. {
  37. .mapbase = MCF_MBAR + MCFUART_BASE2,
  38. .irq = 74,
  39. },
  40. { },
  41. };
  42. static struct platform_device m5307_uart = {
  43. .name = "mcfuart",
  44. .id = 0,
  45. .dev.platform_data = m5307_uart_platform,
  46. };
  47. static struct platform_device *m5307_devices[] __initdata = {
  48. &m5307_uart,
  49. };
  50. /***************************************************************************/
  51. static void __init m5307_uart_init_line(int line, int irq)
  52. {
  53. if (line == 0) {
  54. writel(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR);
  55. writeb(irq, MCFUART_BASE1 + MCFUART_UIVR);
  56. mcf_setimr(mcf_getimr() & ~MCFSIM_IMR_UART1);
  57. } else if (line == 1) {
  58. writel(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCF_MBAR + MCFSIM_UART2ICR);
  59. writeb(irq, MCFUART_BASE2 + MCFUART_UIVR);
  60. mcf_setimr(mcf_getimr() & ~MCFSIM_IMR_UART2);
  61. }
  62. }
  63. static void __init m5307_uarts_init(void)
  64. {
  65. const int nrlines = ARRAY_SIZE(m5307_uart_platform);
  66. int line;
  67. for (line = 0; (line < nrlines); line++)
  68. m5307_uart_init_line(line, m5307_uart_platform[line].irq);
  69. }
  70. /***************************************************************************/
  71. void mcf_autovector(unsigned int vec)
  72. {
  73. volatile unsigned char *mbar;
  74. if ((vec >= 25) && (vec <= 31)) {
  75. mbar = (volatile unsigned char *) MCF_MBAR;
  76. vec = 0x1 << (vec - 24);
  77. *(mbar + MCFSIM_AVR) |= vec;
  78. mcf_setimr(mcf_getimr() & ~vec);
  79. }
  80. }
  81. /***************************************************************************/
  82. void mcf_settimericr(unsigned int timer, unsigned int level)
  83. {
  84. volatile unsigned char *icrp;
  85. unsigned int icr, imr;
  86. if (timer <= 2) {
  87. switch (timer) {
  88. case 2: icr = MCFSIM_TIMER2ICR; imr = MCFSIM_IMR_TIMER2; break;
  89. default: icr = MCFSIM_TIMER1ICR; imr = MCFSIM_IMR_TIMER1; break;
  90. }
  91. icrp = (volatile unsigned char *) (MCF_MBAR + icr);
  92. *icrp = MCFSIM_ICR_AUTOVEC | (level << 2) | MCFSIM_ICR_PRI3;
  93. mcf_setimr(mcf_getimr() & ~imr);
  94. }
  95. }
  96. /***************************************************************************/
  97. void __init config_BSP(char *commandp, int size)
  98. {
  99. mcf_setimr(MCFSIM_IMR_MASKALL);
  100. #if defined(CONFIG_NETtel) || defined(CONFIG_eLIA) || \
  101. defined(CONFIG_SECUREEDGEMP3) || defined(CONFIG_CLEOPATRA)
  102. /* Copy command line from FLASH to local buffer... */
  103. memcpy(commandp, (char *) 0xf0004000, size);
  104. commandp[size-1] = 0;
  105. /* Different timer setup - to prevent device clash */
  106. mcf_timervector = 30;
  107. mcf_profilevector = 31;
  108. mcf_timerlevel = 6;
  109. #endif
  110. mach_reset = coldfire_reset;
  111. #ifdef CONFIG_BDM_DISABLE
  112. /*
  113. * Disable the BDM clocking. This also turns off most of the rest of
  114. * the BDM device. This is good for EMC reasons. This option is not
  115. * incompatible with the memory protection option.
  116. */
  117. wdebug(MCFDEBUG_CSR, MCFDEBUG_CSR_PSTCLK);
  118. #endif
  119. }
  120. /***************************************************************************/
  121. static int __init init_BSP(void)
  122. {
  123. m5307_uarts_init();
  124. platform_add_devices(m5307_devices, ARRAY_SIZE(m5307_devices));
  125. return 0;
  126. }
  127. arch_initcall(init_BSP);
  128. /***************************************************************************/