config.c 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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/io.h>
  13. #include <asm/machdep.h>
  14. #include <asm/coldfire.h>
  15. #include <asm/mcfsim.h>
  16. #include <asm/mcfuart.h>
  17. #include <asm/mcfwdebug.h>
  18. /***************************************************************************/
  19. /*
  20. * Some platforms need software versions of the GPIO data registers.
  21. */
  22. unsigned short ppdata;
  23. unsigned char ledbank = 0xff;
  24. /***************************************************************************/
  25. static struct mcf_platform_uart m5307_uart_platform[] = {
  26. {
  27. .mapbase = MCF_MBAR + MCFUART_BASE1,
  28. .irq = 73,
  29. },
  30. {
  31. .mapbase = MCF_MBAR + MCFUART_BASE2,
  32. .irq = 74,
  33. },
  34. { },
  35. };
  36. static struct platform_device m5307_uart = {
  37. .name = "mcfuart",
  38. .id = 0,
  39. .dev.platform_data = m5307_uart_platform,
  40. };
  41. static struct platform_device *m5307_devices[] __initdata = {
  42. &m5307_uart,
  43. };
  44. /***************************************************************************/
  45. static void __init m5307_uart_init_line(int line, int irq)
  46. {
  47. if (line == 0) {
  48. writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR);
  49. writeb(irq, MCF_MBAR + MCFUART_BASE1 + MCFUART_UIVR);
  50. mcf_mapirq2imr(irq, MCFINTC_UART0);
  51. } else if (line == 1) {
  52. writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCF_MBAR + MCFSIM_UART2ICR);
  53. writeb(irq, MCF_MBAR + MCFUART_BASE2 + MCFUART_UIVR);
  54. mcf_mapirq2imr(irq, MCFINTC_UART1);
  55. }
  56. }
  57. static void __init m5307_uarts_init(void)
  58. {
  59. const int nrlines = ARRAY_SIZE(m5307_uart_platform);
  60. int line;
  61. for (line = 0; (line < nrlines); line++)
  62. m5307_uart_init_line(line, m5307_uart_platform[line].irq);
  63. }
  64. /***************************************************************************/
  65. static void __init m5307_timers_init(void)
  66. {
  67. /* Timer1 is always used as system timer */
  68. writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI3,
  69. MCF_MBAR + MCFSIM_TIMER1ICR);
  70. mcf_mapirq2imr(MCF_IRQ_TIMER, MCFINTC_TIMER1);
  71. #ifdef CONFIG_HIGHPROFILE
  72. /* Timer2 is to be used as a high speed profile timer */
  73. writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL7 | MCFSIM_ICR_PRI3,
  74. MCF_MBAR + MCFSIM_TIMER2ICR);
  75. mcf_mapirq2imr(MCF_IRQ_PROFILER, MCFINTC_TIMER2);
  76. #endif
  77. }
  78. /***************************************************************************/
  79. void m5307_cpu_reset(void)
  80. {
  81. local_irq_disable();
  82. /* Set watchdog to soft reset, and enabled */
  83. __raw_writeb(0xc0, MCF_MBAR + MCFSIM_SYPCR);
  84. for (;;)
  85. /* wait for watchdog to timeout */;
  86. }
  87. /***************************************************************************/
  88. void __init config_BSP(char *commandp, int size)
  89. {
  90. #if defined(CONFIG_NETtel) || \
  91. defined(CONFIG_SECUREEDGEMP3) || defined(CONFIG_CLEOPATRA)
  92. /* Copy command line from FLASH to local buffer... */
  93. memcpy(commandp, (char *) 0xf0004000, size);
  94. commandp[size-1] = 0;
  95. #endif
  96. mach_reset = m5307_cpu_reset;
  97. m5307_timers_init();
  98. m5307_uarts_init();
  99. /* Only support the external interrupts on their primary level */
  100. mcf_mapirq2imr(25, MCFINTC_EINT1);
  101. mcf_mapirq2imr(27, MCFINTC_EINT3);
  102. mcf_mapirq2imr(29, MCFINTC_EINT5);
  103. mcf_mapirq2imr(31, MCFINTC_EINT7);
  104. #ifdef CONFIG_BDM_DISABLE
  105. /*
  106. * Disable the BDM clocking. This also turns off most of the rest of
  107. * the BDM device. This is good for EMC reasons. This option is not
  108. * incompatible with the memory protection option.
  109. */
  110. wdebug(MCFDEBUG_CSR, MCFDEBUG_CSR_PSTCLK);
  111. #endif
  112. }
  113. /***************************************************************************/
  114. static int __init init_BSP(void)
  115. {
  116. platform_add_devices(m5307_devices, ARRAY_SIZE(m5307_devices));
  117. return 0;
  118. }
  119. arch_initcall(init_BSP);
  120. /***************************************************************************/