config.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /***************************************************************************/
  2. /*
  3. * linux/arch/m68knommu/platform/5206e/config.c
  4. *
  5. * Copyright (C) 1999-2002, Greg Ungerer (gerg@snapgear.com)
  6. */
  7. /***************************************************************************/
  8. #include <linux/kernel.h>
  9. #include <linux/sched.h>
  10. #include <linux/param.h>
  11. #include <linux/interrupt.h>
  12. #include <asm/irq.h>
  13. #include <asm/dma.h>
  14. #include <asm/traps.h>
  15. #include <asm/machdep.h>
  16. #include <asm/coldfire.h>
  17. #include <asm/mcftimer.h>
  18. #include <asm/mcfsim.h>
  19. #include <asm/mcfdma.h>
  20. /***************************************************************************/
  21. void coldfire_tick(void);
  22. void coldfire_timer_init(irq_handler_t handler);
  23. unsigned long coldfire_timer_offset(void);
  24. void coldfire_reset(void);
  25. /***************************************************************************/
  26. /*
  27. * DMA channel base address table.
  28. */
  29. unsigned int dma_base_addr[MAX_M68K_DMA_CHANNELS] = {
  30. MCF_MBAR + MCFDMA_BASE0,
  31. MCF_MBAR + MCFDMA_BASE1,
  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. unsigned char icr;
  39. if ((vec >= 25) && (vec <= 31)) {
  40. vec -= 25;
  41. mbar = (volatile unsigned char *) MCF_MBAR;
  42. icr = MCFSIM_ICR_AUTOVEC | (vec << 3);
  43. *(mbar + MCFSIM_ICR1 + vec) = icr;
  44. vec = 0x1 << (vec + 1);
  45. mcf_setimr(mcf_getimr() & ~vec);
  46. }
  47. }
  48. /***************************************************************************/
  49. void mcf_settimericr(unsigned int timer, unsigned int level)
  50. {
  51. volatile unsigned char *icrp;
  52. unsigned int icr, imr;
  53. if (timer <= 2) {
  54. switch (timer) {
  55. case 2: icr = MCFSIM_TIMER2ICR; imr = MCFSIM_IMR_TIMER2; break;
  56. default: icr = MCFSIM_TIMER1ICR; imr = MCFSIM_IMR_TIMER1; break;
  57. }
  58. icrp = (volatile unsigned char *) (MCF_MBAR + icr);
  59. *icrp = MCFSIM_ICR_AUTOVEC | (level << 2) | MCFSIM_ICR_PRI3;
  60. mcf_setimr(mcf_getimr() & ~imr);
  61. }
  62. }
  63. /***************************************************************************/
  64. int mcf_timerirqpending(int timer)
  65. {
  66. unsigned int imr = 0;
  67. switch (timer) {
  68. case 1: imr = MCFSIM_IMR_TIMER1; break;
  69. case 2: imr = MCFSIM_IMR_TIMER2; break;
  70. default: break;
  71. }
  72. return (mcf_getipr() & imr);
  73. }
  74. /***************************************************************************/
  75. void config_BSP(char *commandp, int size)
  76. {
  77. mcf_setimr(MCFSIM_IMR_MASKALL);
  78. #if defined(CONFIG_NETtel)
  79. /* Copy command line from FLASH to local buffer... */
  80. memcpy(commandp, (char *) 0xf0004000, size);
  81. commandp[size-1] = 0;
  82. #endif /* CONFIG_NETtel */
  83. mach_sched_init = coldfire_timer_init;
  84. mach_tick = coldfire_tick;
  85. mach_gettimeoffset = coldfire_timer_offset;
  86. mach_reset = coldfire_reset;
  87. }
  88. /***************************************************************************/