config.c 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. /***************************************************************************/
  2. /*
  3. * linux/arch/m68knommu/platform/5307/config.c
  4. *
  5. * Copyright (C) 1999-2002, Greg Ungerer (gerg@snapgear.com)
  6. * Copyright (C) 2000, Lineo (www.lineo.com)
  7. */
  8. /***************************************************************************/
  9. #include <linux/kernel.h>
  10. #include <linux/sched.h>
  11. #include <linux/param.h>
  12. #include <linux/init.h>
  13. #include <linux/interrupt.h>
  14. #include <asm/irq.h>
  15. #include <asm/dma.h>
  16. #include <asm/traps.h>
  17. #include <asm/machdep.h>
  18. #include <asm/coldfire.h>
  19. #include <asm/mcftimer.h>
  20. #include <asm/mcfsim.h>
  21. #include <asm/mcfdma.h>
  22. #include <asm/mcfwdebug.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. extern unsigned int mcf_timervector;
  30. extern unsigned int mcf_profilevector;
  31. extern unsigned int mcf_timerlevel;
  32. /***************************************************************************/
  33. /*
  34. * Some platforms need software versions of the GPIO data registers.
  35. */
  36. unsigned short ppdata;
  37. unsigned char ledbank = 0xff;
  38. /***************************************************************************/
  39. /*
  40. * DMA channel base address table.
  41. */
  42. unsigned int dma_base_addr[MAX_M68K_DMA_CHANNELS] = {
  43. MCF_MBAR + MCFDMA_BASE0,
  44. MCF_MBAR + MCFDMA_BASE1,
  45. MCF_MBAR + MCFDMA_BASE2,
  46. MCF_MBAR + MCFDMA_BASE3,
  47. };
  48. unsigned int dma_device_address[MAX_M68K_DMA_CHANNELS];
  49. /***************************************************************************/
  50. void mcf_autovector(unsigned int vec)
  51. {
  52. volatile unsigned char *mbar;
  53. if ((vec >= 25) && (vec <= 31)) {
  54. mbar = (volatile unsigned char *) MCF_MBAR;
  55. vec = 0x1 << (vec - 24);
  56. *(mbar + MCFSIM_AVR) |= vec;
  57. mcf_setimr(mcf_getimr() & ~vec);
  58. }
  59. }
  60. /***************************************************************************/
  61. void mcf_settimericr(unsigned int timer, unsigned int level)
  62. {
  63. volatile unsigned char *icrp;
  64. unsigned int icr, imr;
  65. if (timer <= 2) {
  66. switch (timer) {
  67. case 2: icr = MCFSIM_TIMER2ICR; imr = MCFSIM_IMR_TIMER2; break;
  68. default: icr = MCFSIM_TIMER1ICR; imr = MCFSIM_IMR_TIMER1; break;
  69. }
  70. icrp = (volatile unsigned char *) (MCF_MBAR + icr);
  71. *icrp = MCFSIM_ICR_AUTOVEC | (level << 2) | MCFSIM_ICR_PRI3;
  72. mcf_setimr(mcf_getimr() & ~imr);
  73. }
  74. }
  75. /***************************************************************************/
  76. int mcf_timerirqpending(int timer)
  77. {
  78. unsigned int imr = 0;
  79. switch (timer) {
  80. case 1: imr = MCFSIM_IMR_TIMER1; break;
  81. case 2: imr = MCFSIM_IMR_TIMER2; break;
  82. default: break;
  83. }
  84. return (mcf_getipr() & imr);
  85. }
  86. /***************************************************************************/
  87. void config_BSP(char *commandp, int size)
  88. {
  89. mcf_setimr(MCFSIM_IMR_MASKALL);
  90. #if defined(CONFIG_BOOTPARAM)
  91. strncpy(commandp, CONFIG_BOOTPARAM_STRING, size);
  92. commandp[size-1] = 0;
  93. #elif defined(CONFIG_NETtel) || defined(CONFIG_eLIA) || \
  94. defined(CONFIG_DISKtel) || defined(CONFIG_SECUREEDGEMP3) || \
  95. defined(CONFIG_CLEOPATRA)
  96. /* Copy command line from FLASH to local buffer... */
  97. memcpy(commandp, (char *) 0xf0004000, size);
  98. commandp[size-1] = 0;
  99. /* Different timer setup - to prevent device clash */
  100. mcf_timervector = 30;
  101. mcf_profilevector = 31;
  102. mcf_timerlevel = 6;
  103. #else
  104. memset(commandp, 0, size);
  105. #endif
  106. mach_sched_init = coldfire_timer_init;
  107. mach_tick = coldfire_tick;
  108. mach_gettimeoffset = coldfire_timer_offset;
  109. mach_trap_init = coldfire_trap_init;
  110. mach_reset = coldfire_reset;
  111. #ifdef MCF_BDM_DISABLE
  112. /*
  113. * Disable the BDM clocking. This also turns off most of the rest of
  114. * the BDM device. This is good for EMC reasons. This option is not
  115. * incompatible with the memory protection option.
  116. */
  117. wdebug(MCFDEBUG_CSR, MCFDEBUG_CSR_PSTCLK);
  118. #endif
  119. }
  120. /***************************************************************************/