config.c 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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. #include <asm/mcfuart.h>
  18. /***************************************************************************/
  19. static struct mcf_platform_uart m5206e_uart_platform[] = {
  20. {
  21. .mapbase = MCF_MBAR + MCFUART_BASE1,
  22. .irq = 73,
  23. },
  24. {
  25. .mapbase = MCF_MBAR + MCFUART_BASE2,
  26. .irq = 74,
  27. },
  28. { },
  29. };
  30. static struct platform_device m5206e_uart = {
  31. .name = "mcfuart",
  32. .id = 0,
  33. .dev.platform_data = m5206e_uart_platform,
  34. };
  35. static struct platform_device *m5206e_devices[] __initdata = {
  36. &m5206e_uart,
  37. };
  38. /***************************************************************************/
  39. static void __init m5206e_uart_init_line(int line, int irq)
  40. {
  41. if (line == 0) {
  42. writel(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR);
  43. writeb(irq, MCFUART_BASE1 + MCFUART_UIVR);
  44. mcf_clrimr(MCFINTC_UART0);
  45. } else if (line == 1) {
  46. writel(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCF_MBAR + MCFSIM_UART2ICR);
  47. writeb(irq, MCFUART_BASE2 + MCFUART_UIVR);
  48. mcf_clrimr(MCFINTC_UART1);
  49. }
  50. }
  51. static void __init m5206e_uarts_init(void)
  52. {
  53. const int nrlines = ARRAY_SIZE(m5206e_uart_platform);
  54. int line;
  55. for (line = 0; (line < nrlines); line++)
  56. m5206e_uart_init_line(line, m5206e_uart_platform[line].irq);
  57. }
  58. /***************************************************************************/
  59. void mcf_settimericr(unsigned int timer, unsigned int level)
  60. {
  61. volatile unsigned char *icrp;
  62. unsigned int icr, imr;
  63. if (timer <= 2) {
  64. switch (timer) {
  65. case 2: icr = MCFSIM_TIMER2ICR; imr = MCFINTC_TIMER2; break;
  66. default: icr = MCFSIM_TIMER1ICR; imr = MCFINTC_TIMER1; break;
  67. }
  68. icrp = (volatile unsigned char *) (MCF_MBAR + icr);
  69. *icrp = MCFSIM_ICR_AUTOVEC | (level << 2) | MCFSIM_ICR_PRI3;
  70. mcf_clrimr(imr);
  71. }
  72. }
  73. /***************************************************************************/
  74. void m5206e_cpu_reset(void)
  75. {
  76. local_irq_disable();
  77. /* Set watchdog to soft reset, and enabled */
  78. __raw_writeb(0xc0, MCF_MBAR + MCFSIM_SYPCR);
  79. for (;;)
  80. /* wait for watchdog to timeout */;
  81. }
  82. /***************************************************************************/
  83. void __init config_BSP(char *commandp, int size)
  84. {
  85. #if defined(CONFIG_NETtel)
  86. /* Copy command line from FLASH to local buffer... */
  87. memcpy(commandp, (char *) 0xf0004000, size);
  88. commandp[size-1] = 0;
  89. #endif /* CONFIG_NETtel */
  90. mach_reset = m5206e_cpu_reset;
  91. }
  92. /***************************************************************************/
  93. static int __init init_BSP(void)
  94. {
  95. m5206e_uarts_init();
  96. platform_add_devices(m5206e_devices, ARRAY_SIZE(m5206e_devices));
  97. return 0;
  98. }
  99. arch_initcall(init_BSP);
  100. /***************************************************************************/