config.c 2.9 KB

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