config.c 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /***************************************************************************/
  2. /*
  3. * linux/arch/m68knommu/platform/5407/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. /***************************************************************************/
  18. static void __init m5407_uarts_init(void)
  19. {
  20. /* UART0 interrupt setup */
  21. writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR);
  22. writeb(MCF_IRQ_UART0, MCFUART_BASE0 + MCFUART_UIVR);
  23. mcf_mapirq2imr(MCF_IRQ_UART0, MCFINTC_UART0);
  24. /* UART1 interrupt setup */
  25. writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCF_MBAR + MCFSIM_UART2ICR);
  26. writeb(MCF_IRQ_UART1, MCFUART_BASE1 + MCFUART_UIVR);
  27. mcf_mapirq2imr(MCF_IRQ_UART1, MCFINTC_UART1);
  28. }
  29. /***************************************************************************/
  30. static void __init m5407_timers_init(void)
  31. {
  32. /* Timer1 is always used as system timer */
  33. writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI3,
  34. MCF_MBAR + MCFSIM_TIMER1ICR);
  35. mcf_mapirq2imr(MCF_IRQ_TIMER, MCFINTC_TIMER1);
  36. #ifdef CONFIG_HIGHPROFILE
  37. /* Timer2 is to be used as a high speed profile timer */
  38. writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL7 | MCFSIM_ICR_PRI3,
  39. MCF_MBAR + MCFSIM_TIMER2ICR);
  40. mcf_mapirq2imr(MCF_IRQ_PROFILER, MCFINTC_TIMER2);
  41. #endif
  42. }
  43. /***************************************************************************/
  44. void m5407_cpu_reset(void)
  45. {
  46. local_irq_disable();
  47. /* set watchdog to soft reset, and enabled */
  48. __raw_writeb(0xc0, MCF_MBAR + MCFSIM_SYPCR);
  49. for (;;)
  50. /* wait for watchdog to timeout */;
  51. }
  52. /***************************************************************************/
  53. void __init config_BSP(char *commandp, int size)
  54. {
  55. mach_reset = m5407_cpu_reset;
  56. mach_sched_init = hw_timer_init;
  57. m5407_timers_init();
  58. m5407_uarts_init();
  59. /* Only support the external interrupts on their primary level */
  60. mcf_mapirq2imr(25, MCFINTC_EINT1);
  61. mcf_mapirq2imr(27, MCFINTC_EINT3);
  62. mcf_mapirq2imr(29, MCFINTC_EINT5);
  63. mcf_mapirq2imr(31, MCFINTC_EINT7);
  64. }
  65. /***************************************************************************/