config.c 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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/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. /***************************************************************************/
  19. void coldfire_reset(void);
  20. extern unsigned int mcf_timervector;
  21. extern unsigned int mcf_profilevector;
  22. extern unsigned int mcf_timerlevel;
  23. /***************************************************************************/
  24. /*
  25. * DMA channel base address table.
  26. */
  27. unsigned int dma_base_addr[MAX_M68K_DMA_CHANNELS] = {
  28. MCF_MBAR + MCFDMA_BASE0,
  29. MCF_MBAR + MCFDMA_BASE1,
  30. MCF_MBAR + MCFDMA_BASE2,
  31. MCF_MBAR + MCFDMA_BASE3,
  32. };
  33. unsigned int dma_device_address[MAX_M68K_DMA_CHANNELS];
  34. /***************************************************************************/
  35. void mcf_autovector(unsigned int vec)
  36. {
  37. volatile unsigned char *mbar;
  38. if ((vec >= 25) && (vec <= 31)) {
  39. mbar = (volatile unsigned char *) MCF_MBAR;
  40. vec = 0x1 << (vec - 24);
  41. *(mbar + MCFSIM_AVR) |= vec;
  42. mcf_setimr(mcf_getimr() & ~vec);
  43. }
  44. }
  45. /***************************************************************************/
  46. void mcf_settimericr(unsigned int timer, unsigned int level)
  47. {
  48. volatile unsigned char *icrp;
  49. unsigned int icr, imr;
  50. if (timer <= 2) {
  51. switch (timer) {
  52. case 2: icr = MCFSIM_TIMER2ICR; imr = MCFSIM_IMR_TIMER2; break;
  53. default: icr = MCFSIM_TIMER1ICR; imr = MCFSIM_IMR_TIMER1; break;
  54. }
  55. icrp = (volatile unsigned char *) (MCF_MBAR + icr);
  56. *icrp = MCFSIM_ICR_AUTOVEC | (level << 2) | MCFSIM_ICR_PRI3;
  57. mcf_setimr(mcf_getimr() & ~imr);
  58. }
  59. }
  60. /***************************************************************************/
  61. int mcf_timerirqpending(int timer)
  62. {
  63. unsigned int imr = 0;
  64. switch (timer) {
  65. case 1: imr = MCFSIM_IMR_TIMER1; break;
  66. case 2: imr = MCFSIM_IMR_TIMER2; break;
  67. default: break;
  68. }
  69. return (mcf_getipr() & imr);
  70. }
  71. /***************************************************************************/
  72. void config_BSP(char *commandp, int size)
  73. {
  74. mcf_setimr(MCFSIM_IMR_MASKALL);
  75. #if defined(CONFIG_CLEOPATRA)
  76. /* Different timer setup - to prevent device clash */
  77. mcf_timervector = 30;
  78. mcf_profilevector = 31;
  79. mcf_timerlevel = 6;
  80. #endif
  81. mach_reset = coldfire_reset;
  82. }
  83. /***************************************************************************/