config.c 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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/sched.h>
  11. #include <linux/param.h>
  12. #include <linux/init.h>
  13. #include <linux/interrupt.h>
  14. #include <asm/irq.h>
  15. #include <asm/dma.h>
  16. #include <asm/traps.h>
  17. #include <asm/machdep.h>
  18. #include <asm/coldfire.h>
  19. #include <asm/mcftimer.h>
  20. #include <asm/mcfsim.h>
  21. #include <asm/mcfdma.h>
  22. #include <asm/mcfwdebug.h>
  23. /***************************************************************************/
  24. void coldfire_tick(void);
  25. void coldfire_timer_init(irq_handler_t handler);
  26. unsigned long coldfire_timer_offset(void);
  27. void coldfire_reset(void);
  28. extern unsigned int mcf_timervector;
  29. extern unsigned int mcf_profilevector;
  30. extern unsigned int mcf_timerlevel;
  31. /***************************************************************************/
  32. /*
  33. * Some platforms need software versions of the GPIO data registers.
  34. */
  35. unsigned short ppdata;
  36. unsigned char ledbank = 0xff;
  37. /***************************************************************************/
  38. /*
  39. * DMA channel base address table.
  40. */
  41. unsigned int dma_base_addr[MAX_M68K_DMA_CHANNELS] = {
  42. MCF_MBAR + MCFDMA_BASE0,
  43. MCF_MBAR + MCFDMA_BASE1,
  44. MCF_MBAR + MCFDMA_BASE2,
  45. MCF_MBAR + MCFDMA_BASE3,
  46. };
  47. unsigned int dma_device_address[MAX_M68K_DMA_CHANNELS];
  48. /***************************************************************************/
  49. void mcf_autovector(unsigned int vec)
  50. {
  51. volatile unsigned char *mbar;
  52. if ((vec >= 25) && (vec <= 31)) {
  53. mbar = (volatile unsigned char *) MCF_MBAR;
  54. vec = 0x1 << (vec - 24);
  55. *(mbar + MCFSIM_AVR) |= vec;
  56. mcf_setimr(mcf_getimr() & ~vec);
  57. }
  58. }
  59. /***************************************************************************/
  60. void mcf_settimericr(unsigned int timer, unsigned int level)
  61. {
  62. volatile unsigned char *icrp;
  63. unsigned int icr, imr;
  64. if (timer <= 2) {
  65. switch (timer) {
  66. case 2: icr = MCFSIM_TIMER2ICR; imr = MCFSIM_IMR_TIMER2; break;
  67. default: icr = MCFSIM_TIMER1ICR; imr = MCFSIM_IMR_TIMER1; break;
  68. }
  69. icrp = (volatile unsigned char *) (MCF_MBAR + icr);
  70. *icrp = MCFSIM_ICR_AUTOVEC | (level << 2) | MCFSIM_ICR_PRI3;
  71. mcf_setimr(mcf_getimr() & ~imr);
  72. }
  73. }
  74. /***************************************************************************/
  75. int mcf_timerirqpending(int timer)
  76. {
  77. unsigned int imr = 0;
  78. switch (timer) {
  79. case 1: imr = MCFSIM_IMR_TIMER1; break;
  80. case 2: imr = MCFSIM_IMR_TIMER2; break;
  81. default: break;
  82. }
  83. return (mcf_getipr() & imr);
  84. }
  85. /***************************************************************************/
  86. void config_BSP(char *commandp, int size)
  87. {
  88. mcf_setimr(MCFSIM_IMR_MASKALL);
  89. #if defined(CONFIG_NETtel) || defined(CONFIG_eLIA) || \
  90. defined(CONFIG_DISKtel) || defined(CONFIG_SECUREEDGEMP3) || \
  91. defined(CONFIG_CLEOPATRA)
  92. /* Copy command line from FLASH to local buffer... */
  93. memcpy(commandp, (char *) 0xf0004000, size);
  94. commandp[size-1] = 0;
  95. /* Different timer setup - to prevent device clash */
  96. mcf_timervector = 30;
  97. mcf_profilevector = 31;
  98. mcf_timerlevel = 6;
  99. #endif
  100. mach_sched_init = coldfire_timer_init;
  101. mach_tick = coldfire_tick;
  102. mach_gettimeoffset = coldfire_timer_offset;
  103. mach_reset = coldfire_reset;
  104. #ifdef MCF_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. /***************************************************************************/