config.c 4.0 KB

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