config.c 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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/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. /***************************************************************************/
  23. void coldfire_tick(void);
  24. void coldfire_timer_init(irq_handler_t handler);
  25. unsigned long coldfire_timer_offset(void);
  26. void coldfire_reset(void);
  27. /***************************************************************************/
  28. /*
  29. * DMA channel base address table.
  30. */
  31. unsigned int dma_base_addr[MAX_M68K_DMA_CHANNELS] = {
  32. MCF_MBAR + MCFDMA_BASE0,
  33. MCF_MBAR + MCFDMA_BASE1,
  34. };
  35. unsigned int dma_device_address[MAX_M68K_DMA_CHANNELS];
  36. /***************************************************************************/
  37. void mcf_autovector(unsigned int vec)
  38. {
  39. volatile unsigned char *mbar;
  40. unsigned char icr;
  41. if ((vec >= 25) && (vec <= 31)) {
  42. vec -= 25;
  43. mbar = (volatile unsigned char *) MCF_MBAR;
  44. icr = MCFSIM_ICR_AUTOVEC | (vec << 3);
  45. *(mbar + MCFSIM_ICR1 + vec) = icr;
  46. vec = 0x1 << (vec + 1);
  47. mcf_setimr(mcf_getimr() & ~vec);
  48. }
  49. }
  50. /***************************************************************************/
  51. void mcf_settimericr(unsigned int timer, unsigned int level)
  52. {
  53. volatile unsigned char *icrp;
  54. unsigned int icr, imr;
  55. if (timer <= 2) {
  56. switch (timer) {
  57. case 2: icr = MCFSIM_TIMER2ICR; imr = MCFSIM_IMR_TIMER2; break;
  58. default: icr = MCFSIM_TIMER1ICR; imr = MCFSIM_IMR_TIMER1; break;
  59. }
  60. icrp = (volatile unsigned char *) (MCF_MBAR + icr);
  61. *icrp = MCFSIM_ICR_AUTOVEC | (level << 2) | MCFSIM_ICR_PRI3;
  62. mcf_setimr(mcf_getimr() & ~imr);
  63. }
  64. }
  65. /***************************************************************************/
  66. int mcf_timerirqpending(int timer)
  67. {
  68. unsigned int imr = 0;
  69. switch (timer) {
  70. case 1: imr = MCFSIM_IMR_TIMER1; break;
  71. case 2: imr = MCFSIM_IMR_TIMER2; break;
  72. default: break;
  73. }
  74. return (mcf_getipr() & imr);
  75. }
  76. /***************************************************************************/
  77. void config_BSP(char *commandp, int size)
  78. {
  79. mcf_setimr(MCFSIM_IMR_MASKALL);
  80. mach_sched_init = coldfire_timer_init;
  81. mach_tick = coldfire_tick;
  82. mach_gettimeoffset = coldfire_timer_offset;
  83. mach_reset = coldfire_reset;
  84. }
  85. /***************************************************************************/