config.c 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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/sched.h>
  10. #include <linux/param.h>
  11. #include <linux/init.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(irqreturn_t (*handler)(int, void *, struct pt_regs *));
  23. unsigned long coldfire_timer_offset(void);
  24. void coldfire_trap_init(void);
  25. void coldfire_reset(void);
  26. /***************************************************************************/
  27. /*
  28. * DMA channel base address table.
  29. */
  30. unsigned int dma_base_addr[MAX_M68K_DMA_CHANNELS] = {
  31. MCF_MBAR + MCFDMA_BASE0,
  32. MCF_MBAR + MCFDMA_BASE1,
  33. MCF_MBAR + MCFDMA_BASE2,
  34. MCF_MBAR + MCFDMA_BASE3,
  35. };
  36. unsigned int dma_device_address[MAX_M68K_DMA_CHANNELS];
  37. /***************************************************************************/
  38. void mcf_autovector(unsigned int vec)
  39. {
  40. volatile unsigned char *mbar;
  41. if ((vec >= 25) && (vec <= 31)) {
  42. mbar = (volatile unsigned char *) MCF_MBAR;
  43. vec = 0x1 << (vec - 24);
  44. *(mbar + MCFSIM_AVR) |= vec;
  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_BOOTPARAM)
  79. strncpy(commandp, CONFIG_BOOTPARAM_STRING, size);
  80. commandp[size-1] = 0;
  81. #else
  82. memset(commandp, 0, size);
  83. #endif
  84. mach_sched_init = coldfire_timer_init;
  85. mach_tick = coldfire_tick;
  86. mach_gettimeoffset = coldfire_timer_offset;
  87. mach_trap_init = coldfire_trap_init;
  88. mach_reset = coldfire_reset;
  89. }
  90. /***************************************************************************/