config.c 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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/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(irqreturn_t (*handler)(int, void *, struct pt_regs *));
  25. unsigned long coldfire_timer_offset(void);
  26. void coldfire_trap_init(void);
  27. void coldfire_reset(void);
  28. extern unsigned int mcf_timervector;
  29. extern unsigned int mcf_profilevector;
  30. extern unsigned int mcf_timerlevel;
  31. /***************************************************************************/
  32. /*
  33. * DMA channel base address table.
  34. */
  35. unsigned int dma_base_addr[MAX_M68K_DMA_CHANNELS] = {
  36. MCF_MBAR + MCFDMA_BASE0,
  37. MCF_MBAR + MCFDMA_BASE1,
  38. MCF_MBAR + MCFDMA_BASE2,
  39. MCF_MBAR + MCFDMA_BASE3,
  40. };
  41. unsigned int dma_device_address[MAX_M68K_DMA_CHANNELS];
  42. /***************************************************************************/
  43. void mcf_autovector(unsigned int vec)
  44. {
  45. volatile unsigned char *mbar;
  46. if ((vec >= 25) && (vec <= 31)) {
  47. mbar = (volatile unsigned char *) MCF_MBAR;
  48. vec = 0x1 << (vec - 24);
  49. *(mbar + MCFSIM_AVR) |= vec;
  50. mcf_setimr(mcf_getimr() & ~vec);
  51. }
  52. }
  53. /***************************************************************************/
  54. void mcf_settimericr(unsigned int timer, unsigned int level)
  55. {
  56. volatile unsigned char *icrp;
  57. unsigned int icr, imr;
  58. if (timer <= 2) {
  59. switch (timer) {
  60. case 2: icr = MCFSIM_TIMER2ICR; imr = MCFSIM_IMR_TIMER2; break;
  61. default: icr = MCFSIM_TIMER1ICR; imr = MCFSIM_IMR_TIMER1; break;
  62. }
  63. icrp = (volatile unsigned char *) (MCF_MBAR + icr);
  64. *icrp = MCFSIM_ICR_AUTOVEC | (level << 2) | MCFSIM_ICR_PRI3;
  65. mcf_setimr(mcf_getimr() & ~imr);
  66. }
  67. }
  68. /***************************************************************************/
  69. int mcf_timerirqpending(int timer)
  70. {
  71. unsigned int imr = 0;
  72. switch (timer) {
  73. case 1: imr = MCFSIM_IMR_TIMER1; break;
  74. case 2: imr = MCFSIM_IMR_TIMER2; break;
  75. default: break;
  76. }
  77. return (mcf_getipr() & imr);
  78. }
  79. /***************************************************************************/
  80. void config_BSP(char *commandp, int size)
  81. {
  82. mcf_setimr(MCFSIM_IMR_MASKALL);
  83. #if defined(CONFIG_BOOTPARAM)
  84. strncpy(commandp, CONFIG_BOOTPARAM_STRING, size);
  85. commandp[size-1] = 0;
  86. #else
  87. memset(commandp, 0, size);
  88. #endif
  89. #if defined(CONFIG_CLEOPATRA)
  90. /* Different timer setup - to prevent device clash */
  91. mcf_timervector = 30;
  92. mcf_profilevector = 31;
  93. mcf_timerlevel = 6;
  94. #endif
  95. mach_sched_init = coldfire_timer_init;
  96. mach_tick = coldfire_tick;
  97. mach_gettimeoffset = coldfire_timer_offset;
  98. mach_trap_init = coldfire_trap_init;
  99. mach_reset = coldfire_reset;
  100. }
  101. /***************************************************************************/