config.c 3.2 KB

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