config.c 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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/config.h>
  9. #include <linux/kernel.h>
  10. #include <linux/sched.h>
  11. #include <linux/param.h>
  12. #include <linux/interrupt.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. #include <asm/irq.h>
  22. /***************************************************************************/
  23. void coldfire_tick(void);
  24. void coldfire_timer_init(irqreturn_t (*handler)(int, void *, struct pt_regs *));
  25. unsigned long coldfire_timer_offset(void);
  26. void coldfire_trap_init(void);
  27. void coldfire_reset(void);
  28. /***************************************************************************/
  29. /*
  30. * DMA channel base address table.
  31. */
  32. unsigned int dma_base_addr[MAX_M68K_DMA_CHANNELS] = {
  33. MCF_MBAR + MCFDMA_BASE0,
  34. MCF_MBAR + MCFDMA_BASE1,
  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. unsigned char icr;
  42. if ((vec >= 25) && (vec <= 31)) {
  43. vec -= 25;
  44. mbar = (volatile unsigned char *) MCF_MBAR;
  45. icr = MCFSIM_ICR_AUTOVEC | (vec << 3);
  46. *(mbar + MCFSIM_ICR1 + vec) = icr;
  47. vec = 0x1 << (vec + 1);
  48. mcf_setimr(mcf_getimr() & ~vec);
  49. }
  50. }
  51. /***************************************************************************/
  52. void mcf_settimericr(unsigned int timer, unsigned int level)
  53. {
  54. volatile unsigned char *icrp;
  55. unsigned int icr, imr;
  56. if (timer <= 2) {
  57. switch (timer) {
  58. case 2: icr = MCFSIM_TIMER2ICR; imr = MCFSIM_IMR_TIMER2; break;
  59. default: icr = MCFSIM_TIMER1ICR; imr = MCFSIM_IMR_TIMER1; break;
  60. }
  61. icrp = (volatile unsigned char *) (MCF_MBAR + icr);
  62. *icrp = MCFSIM_ICR_AUTOVEC | (level << 2) | MCFSIM_ICR_PRI3;
  63. mcf_setimr(mcf_getimr() & ~imr);
  64. }
  65. }
  66. /***************************************************************************/
  67. int mcf_timerirqpending(int timer)
  68. {
  69. unsigned int imr = 0;
  70. switch (timer) {
  71. case 1: imr = MCFSIM_IMR_TIMER1; break;
  72. case 2: imr = MCFSIM_IMR_TIMER2; break;
  73. default: break;
  74. }
  75. return (mcf_getipr() & imr);
  76. }
  77. /***************************************************************************/
  78. void config_BSP(char *commandp, int size)
  79. {
  80. mcf_setimr(MCFSIM_IMR_MASKALL);
  81. #if defined(CONFIG_BOOTPARAM)
  82. strncpy(commandp, CONFIG_BOOTPARAM_STRING, size);
  83. commandp[size-1] = 0;
  84. #elif defined(CONFIG_NETtel)
  85. /* Copy command line from FLASH to local buffer... */
  86. memcpy(commandp, (char *) 0xf0004000, size);
  87. commandp[size-1] = 0;
  88. #else
  89. memset(commandp, 0, size);
  90. #endif /* CONFIG_NETtel */
  91. mach_sched_init = coldfire_timer_init;
  92. mach_tick = coldfire_tick;
  93. mach_gettimeoffset = coldfire_timer_offset;
  94. mach_trap_init = coldfire_trap_init;
  95. mach_reset = coldfire_reset;
  96. }
  97. /***************************************************************************/