config.c 3.4 KB

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