config.c 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /***************************************************************************/
  2. /*
  3. * linux/arch/m68knommu/platform/5206/config.c
  4. *
  5. * Copyright (C) 1999-2002, Greg Ungerer (gerg@snapgear.com)
  6. * Copyright (C) 2000-2001, Lineo Inc. (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/mcftimer.h>
  17. #include <asm/mcfsim.h>
  18. #include <asm/mcfdma.h>
  19. /***************************************************************************/
  20. void coldfire_reset(void);
  21. /***************************************************************************/
  22. /*
  23. * DMA channel base address table.
  24. */
  25. unsigned int dma_base_addr[MAX_M68K_DMA_CHANNELS] = {
  26. MCF_MBAR + MCFDMA_BASE0,
  27. MCF_MBAR + MCFDMA_BASE1,
  28. };
  29. unsigned int dma_device_address[MAX_M68K_DMA_CHANNELS];
  30. /***************************************************************************/
  31. void mcf_autovector(unsigned int vec)
  32. {
  33. volatile unsigned char *mbar;
  34. unsigned char icr;
  35. if ((vec >= 25) && (vec <= 31)) {
  36. vec -= 25;
  37. mbar = (volatile unsigned char *) MCF_MBAR;
  38. icr = MCFSIM_ICR_AUTOVEC | (vec << 3);
  39. *(mbar + MCFSIM_ICR1 + vec) = icr;
  40. vec = 0x1 << (vec + 1);
  41. mcf_setimr(mcf_getimr() & ~vec);
  42. }
  43. }
  44. /***************************************************************************/
  45. void mcf_settimericr(unsigned int timer, unsigned int level)
  46. {
  47. volatile unsigned char *icrp;
  48. unsigned int icr, imr;
  49. if (timer <= 2) {
  50. switch (timer) {
  51. case 2: icr = MCFSIM_TIMER2ICR; imr = MCFSIM_IMR_TIMER2; break;
  52. default: icr = MCFSIM_TIMER1ICR; imr = MCFSIM_IMR_TIMER1; break;
  53. }
  54. icrp = (volatile unsigned char *) (MCF_MBAR + icr);
  55. *icrp = MCFSIM_ICR_AUTOVEC | (level << 2) | MCFSIM_ICR_PRI3;
  56. mcf_setimr(mcf_getimr() & ~imr);
  57. }
  58. }
  59. /***************************************************************************/
  60. int mcf_timerirqpending(int timer)
  61. {
  62. unsigned int imr = 0;
  63. switch (timer) {
  64. case 1: imr = MCFSIM_IMR_TIMER1; break;
  65. case 2: imr = MCFSIM_IMR_TIMER2; break;
  66. default: break;
  67. }
  68. return (mcf_getipr() & imr);
  69. }
  70. /***************************************************************************/
  71. void config_BSP(char *commandp, int size)
  72. {
  73. mcf_setimr(MCFSIM_IMR_MASKALL);
  74. mach_reset = coldfire_reset;
  75. }
  76. /***************************************************************************/