config.c 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /***************************************************************************/
  2. /*
  3. * linux/arch/m68knommu/platform/5206e/config.c
  4. *
  5. * Copyright (C) 1999-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/interrupt.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. #include <asm/irq.h>
  21. /***************************************************************************/
  22. void coldfire_tick(void);
  23. void coldfire_timer_init(irq_handler_t handler);
  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. };
  35. unsigned int dma_device_address[MAX_M68K_DMA_CHANNELS];
  36. /***************************************************************************/
  37. void mcf_autovector(unsigned int vec)
  38. {
  39. volatile unsigned char *mbar;
  40. unsigned char icr;
  41. if ((vec >= 25) && (vec <= 31)) {
  42. vec -= 25;
  43. mbar = (volatile unsigned char *) MCF_MBAR;
  44. icr = MCFSIM_ICR_AUTOVEC | (vec << 3);
  45. *(mbar + MCFSIM_ICR1 + vec) = icr;
  46. vec = 0x1 << (vec + 1);
  47. mcf_setimr(mcf_getimr() & ~vec);
  48. }
  49. }
  50. /***************************************************************************/
  51. void mcf_settimericr(unsigned int timer, unsigned int level)
  52. {
  53. volatile unsigned char *icrp;
  54. unsigned int icr, imr;
  55. if (timer <= 2) {
  56. switch (timer) {
  57. case 2: icr = MCFSIM_TIMER2ICR; imr = MCFSIM_IMR_TIMER2; break;
  58. default: icr = MCFSIM_TIMER1ICR; imr = MCFSIM_IMR_TIMER1; break;
  59. }
  60. icrp = (volatile unsigned char *) (MCF_MBAR + icr);
  61. *icrp = MCFSIM_ICR_AUTOVEC | (level << 2) | MCFSIM_ICR_PRI3;
  62. mcf_setimr(mcf_getimr() & ~imr);
  63. }
  64. }
  65. /***************************************************************************/
  66. int mcf_timerirqpending(int timer)
  67. {
  68. unsigned int imr = 0;
  69. switch (timer) {
  70. case 1: imr = MCFSIM_IMR_TIMER1; break;
  71. case 2: imr = MCFSIM_IMR_TIMER2; break;
  72. default: break;
  73. }
  74. return (mcf_getipr() & imr);
  75. }
  76. /***************************************************************************/
  77. void config_BSP(char *commandp, int size)
  78. {
  79. mcf_setimr(MCFSIM_IMR_MASKALL);
  80. #if defined(CONFIG_BOOTPARAM)
  81. strncpy(commandp, CONFIG_BOOTPARAM_STRING, size);
  82. commandp[size-1] = 0;
  83. #elif defined(CONFIG_NETtel)
  84. /* Copy command line from FLASH to local buffer... */
  85. memcpy(commandp, (char *) 0xf0004000, size);
  86. commandp[size-1] = 0;
  87. #else
  88. memset(commandp, 0, size);
  89. #endif /* CONFIG_NETtel */
  90. mach_sched_init = coldfire_timer_init;
  91. mach_tick = coldfire_tick;
  92. mach_gettimeoffset = coldfire_timer_offset;
  93. mach_trap_init = coldfire_trap_init;
  94. mach_reset = coldfire_reset;
  95. }
  96. /***************************************************************************/