config.c 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /***************************************************************************/
  2. /*
  3. * linux/arch/m68knommu/platform/5206e/config.c
  4. *
  5. * Copyright (C) 1999-2002, Greg Ungerer (gerg@snapgear.com)
  6. */
  7. /***************************************************************************/
  8. #include <linux/kernel.h>
  9. #include <linux/param.h>
  10. #include <linux/init.h>
  11. #include <linux/io.h>
  12. #include <asm/machdep.h>
  13. #include <asm/coldfire.h>
  14. #include <asm/mcfsim.h>
  15. #include <asm/mcfuart.h>
  16. #include <asm/mcfdma.h>
  17. /***************************************************************************/
  18. static struct mcf_platform_uart m5206e_uart_platform[] = {
  19. {
  20. .mapbase = MCF_MBAR + MCFUART_BASE1,
  21. .irq = 73,
  22. },
  23. {
  24. .mapbase = MCF_MBAR + MCFUART_BASE2,
  25. .irq = 74,
  26. },
  27. { },
  28. };
  29. static struct platform_device m5206e_uart = {
  30. .name = "mcfuart",
  31. .id = 0,
  32. .dev.platform_data = m5206e_uart_platform,
  33. };
  34. static struct platform_device *m5206e_devices[] __initdata = {
  35. &m5206e_uart,
  36. };
  37. /***************************************************************************/
  38. static void __init m5206e_uart_init_line(int line, int irq)
  39. {
  40. if (line == 0) {
  41. writel(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR);
  42. writeb(irq, MCFUART_BASE1 + MCFUART_UIVR);
  43. mcf_mapirq2imr(irq, MCFINTC_UART0);
  44. } else if (line == 1) {
  45. writel(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCF_MBAR + MCFSIM_UART2ICR);
  46. writeb(irq, MCFUART_BASE2 + MCFUART_UIVR);
  47. mcf_mapirq2imr(irq, MCFINTC_UART1);
  48. }
  49. }
  50. static void __init m5206e_uarts_init(void)
  51. {
  52. const int nrlines = ARRAY_SIZE(m5206e_uart_platform);
  53. int line;
  54. for (line = 0; (line < nrlines); line++)
  55. m5206e_uart_init_line(line, m5206e_uart_platform[line].irq);
  56. }
  57. /***************************************************************************/
  58. static void __init m5206e_timers_init(void)
  59. {
  60. /* Timer1 is always used as system timer */
  61. writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI3,
  62. MCF_MBAR + MCFSIM_TIMER1ICR);
  63. mcf_mapirq2imr(MCF_IRQ_TIMER, MCFINTC_TIMER1);
  64. #ifdef CONFIG_HIGHPROFILE
  65. /* Timer2 is to be used as a high speed profile timer */
  66. writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL7 | MCFSIM_ICR_PRI3,
  67. MCF_MBAR + MCFSIM_TIMER2ICR);
  68. mcf_mapirq2imr(MCF_IRQ_PROFILER, MCFINTC_TIMER2);
  69. #endif
  70. }
  71. /***************************************************************************/
  72. void m5206e_cpu_reset(void)
  73. {
  74. local_irq_disable();
  75. /* Set watchdog to soft reset, and enabled */
  76. __raw_writeb(0xc0, MCF_MBAR + MCFSIM_SYPCR);
  77. for (;;)
  78. /* wait for watchdog to timeout */;
  79. }
  80. /***************************************************************************/
  81. void __init config_BSP(char *commandp, int size)
  82. {
  83. #if defined(CONFIG_NETtel)
  84. /* Copy command line from FLASH to local buffer... */
  85. memcpy(commandp, (char *) 0xf0004000, size);
  86. commandp[size-1] = 0;
  87. #endif /* CONFIG_NETtel */
  88. mach_reset = m5206e_cpu_reset;
  89. m5206e_timers_init();
  90. m5206e_uarts_init();
  91. /* Only support the external interrupts on their primary level */
  92. mcf_mapirq2imr(25, MCFINTC_EINT1);
  93. mcf_mapirq2imr(28, MCFINTC_EINT4);
  94. mcf_mapirq2imr(31, MCFINTC_EINT7);
  95. }
  96. /***************************************************************************/
  97. static int __init init_BSP(void)
  98. {
  99. platform_add_devices(m5206e_devices, ARRAY_SIZE(m5206e_devices));
  100. return 0;
  101. }
  102. arch_initcall(init_BSP);
  103. /***************************************************************************/