config.c 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /***************************************************************************/
  2. /*
  3. * linux/arch/m68knommu/platform/5206/config.c
  4. *
  5. * Copyright (C) 1999-2002, Greg Ungerer (gerg@snapgear.com)
  6. * Copyright (C) 2000-2001, Lineo Inc. (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. /***************************************************************************/
  30. /*
  31. * DMA channel base address table.
  32. */
  33. unsigned int dma_base_addr[MAX_M68K_DMA_CHANNELS] = {
  34. MCF_MBAR + MCFDMA_BASE0,
  35. MCF_MBAR + MCFDMA_BASE1,
  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. unsigned char icr;
  43. if ((vec >= 25) && (vec <= 31)) {
  44. vec -= 25;
  45. mbar = (volatile unsigned char *) MCF_MBAR;
  46. icr = MCFSIM_ICR_AUTOVEC | (vec << 3);
  47. *(mbar + MCFSIM_ICR1 + vec) = icr;
  48. vec = 0x1 << (vec + 1);
  49. mcf_setimr(mcf_getimr() & ~vec);
  50. }
  51. }
  52. /***************************************************************************/
  53. void mcf_settimericr(unsigned int timer, unsigned int level)
  54. {
  55. volatile unsigned char *icrp;
  56. unsigned int icr, imr;
  57. if (timer <= 2) {
  58. switch (timer) {
  59. case 2: icr = MCFSIM_TIMER2ICR; imr = MCFSIM_IMR_TIMER2; break;
  60. default: icr = MCFSIM_TIMER1ICR; imr = MCFSIM_IMR_TIMER1; break;
  61. }
  62. icrp = (volatile unsigned char *) (MCF_MBAR + icr);
  63. *icrp = MCFSIM_ICR_AUTOVEC | (level << 2) | MCFSIM_ICR_PRI3;
  64. mcf_setimr(mcf_getimr() & ~imr);
  65. }
  66. }
  67. /***************************************************************************/
  68. int mcf_timerirqpending(int timer)
  69. {
  70. unsigned int imr = 0;
  71. switch (timer) {
  72. case 1: imr = MCFSIM_IMR_TIMER1; break;
  73. case 2: imr = MCFSIM_IMR_TIMER2; break;
  74. default: break;
  75. }
  76. return (mcf_getipr() & imr);
  77. }
  78. /***************************************************************************/
  79. void config_BSP(char *commandp, int size)
  80. {
  81. mcf_setimr(MCFSIM_IMR_MASKALL);
  82. #if defined(CONFIG_BOOTPARAM)
  83. strncpy(commandp, CONFIG_BOOTPARAM_STRING, size);
  84. commandp[size-1] = 0;
  85. #else
  86. memset(commandp, 0, size);
  87. #endif
  88. mach_sched_init = coldfire_timer_init;
  89. mach_tick = coldfire_tick;
  90. mach_gettimeoffset = coldfire_timer_offset;
  91. mach_trap_init = coldfire_trap_init;
  92. mach_reset = coldfire_reset;
  93. }
  94. /***************************************************************************/