config.c 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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 void __init m5307_uarts_init(void)
  26. {
  27. /* UART0 interrupt setup */
  28. writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR);
  29. writeb(MCF_IRQ_UART0, MCFUART_BASE0 + MCFUART_UIVR);
  30. mcf_mapirq2imr(MCF_IRQ_UART0, MCFINTC_UART0);
  31. /* UART1 interrupt setup */
  32. writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCF_MBAR + MCFSIM_UART2ICR);
  33. writeb(MCF_IRQ_UART1, MCFUART_BASE1 + MCFUART_UIVR);
  34. mcf_mapirq2imr(MCF_IRQ_UART1, MCFINTC_UART1);
  35. }
  36. /***************************************************************************/
  37. static void __init m5307_timers_init(void)
  38. {
  39. /* Timer1 is always used as system timer */
  40. writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI3,
  41. MCF_MBAR + MCFSIM_TIMER1ICR);
  42. mcf_mapirq2imr(MCF_IRQ_TIMER, MCFINTC_TIMER1);
  43. #ifdef CONFIG_HIGHPROFILE
  44. /* Timer2 is to be used as a high speed profile timer */
  45. writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL7 | MCFSIM_ICR_PRI3,
  46. MCF_MBAR + MCFSIM_TIMER2ICR);
  47. mcf_mapirq2imr(MCF_IRQ_PROFILER, MCFINTC_TIMER2);
  48. #endif
  49. }
  50. /***************************************************************************/
  51. void m5307_cpu_reset(void)
  52. {
  53. local_irq_disable();
  54. /* Set watchdog to soft reset, and enabled */
  55. __raw_writeb(0xc0, MCF_MBAR + MCFSIM_SYPCR);
  56. for (;;)
  57. /* wait for watchdog to timeout */;
  58. }
  59. /***************************************************************************/
  60. void __init config_BSP(char *commandp, int size)
  61. {
  62. #if defined(CONFIG_NETtel) || \
  63. defined(CONFIG_SECUREEDGEMP3) || defined(CONFIG_CLEOPATRA)
  64. /* Copy command line from FLASH to local buffer... */
  65. memcpy(commandp, (char *) 0xf0004000, size);
  66. commandp[size-1] = 0;
  67. #endif
  68. mach_reset = m5307_cpu_reset;
  69. mach_sched_init = hw_timer_init;
  70. m5307_timers_init();
  71. m5307_uarts_init();
  72. /* Only support the external interrupts on their primary level */
  73. mcf_mapirq2imr(25, MCFINTC_EINT1);
  74. mcf_mapirq2imr(27, MCFINTC_EINT3);
  75. mcf_mapirq2imr(29, MCFINTC_EINT5);
  76. mcf_mapirq2imr(31, MCFINTC_EINT7);
  77. #ifdef CONFIG_BDM_DISABLE
  78. /*
  79. * Disable the BDM clocking. This also turns off most of the rest of
  80. * the BDM device. This is good for EMC reasons. This option is not
  81. * incompatible with the memory protection option.
  82. */
  83. wdebug(MCFDEBUG_CSR, MCFDEBUG_CSR_PSTCLK);
  84. #endif
  85. }
  86. /***************************************************************************/