config.c 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /***************************************************************************/
  2. /*
  3. * linux/arch/m68knommu/platform/5249/config.c
  4. *
  5. * Copyright (C) 2002, Greg Ungerer (gerg@snapgear.com)
  6. */
  7. /***************************************************************************/
  8. #include <linux/kernel.h>
  9. #include <linux/param.h>
  10. #include <linux/init.h>
  11. #include <linux/interrupt.h>
  12. #include <asm/dma.h>
  13. #include <asm/machdep.h>
  14. #include <asm/coldfire.h>
  15. #include <asm/mcfsim.h>
  16. #include <asm/mcfdma.h>
  17. /***************************************************************************/
  18. void coldfire_reset(void);
  19. /***************************************************************************/
  20. /*
  21. * DMA channel base address table.
  22. */
  23. unsigned int dma_base_addr[MAX_M68K_DMA_CHANNELS] = {
  24. MCF_MBAR + MCFDMA_BASE0,
  25. MCF_MBAR + MCFDMA_BASE1,
  26. MCF_MBAR + MCFDMA_BASE2,
  27. MCF_MBAR + MCFDMA_BASE3,
  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. if ((vec >= 25) && (vec <= 31)) {
  35. mbar = (volatile unsigned char *) MCF_MBAR;
  36. vec = 0x1 << (vec - 24);
  37. *(mbar + MCFSIM_AVR) |= vec;
  38. mcf_setimr(mcf_getimr() & ~vec);
  39. }
  40. }
  41. /***************************************************************************/
  42. void mcf_settimericr(unsigned int timer, unsigned int level)
  43. {
  44. volatile unsigned char *icrp;
  45. unsigned int icr, imr;
  46. if (timer <= 2) {
  47. switch (timer) {
  48. case 2: icr = MCFSIM_TIMER2ICR; imr = MCFSIM_IMR_TIMER2; break;
  49. default: icr = MCFSIM_TIMER1ICR; imr = MCFSIM_IMR_TIMER1; break;
  50. }
  51. icrp = (volatile unsigned char *) (MCF_MBAR + icr);
  52. *icrp = MCFSIM_ICR_AUTOVEC | (level << 2) | MCFSIM_ICR_PRI3;
  53. mcf_setimr(mcf_getimr() & ~imr);
  54. }
  55. }
  56. /***************************************************************************/
  57. int mcf_timerirqpending(int timer)
  58. {
  59. unsigned int imr = 0;
  60. switch (timer) {
  61. case 1: imr = MCFSIM_IMR_TIMER1; break;
  62. case 2: imr = MCFSIM_IMR_TIMER2; break;
  63. default: break;
  64. }
  65. return (mcf_getipr() & imr);
  66. }
  67. /***************************************************************************/
  68. void config_BSP(char *commandp, int size)
  69. {
  70. mcf_setimr(MCFSIM_IMR_MASKALL);
  71. mach_reset = coldfire_reset;
  72. }
  73. /***************************************************************************/