config.c 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. /***************************************************************************/
  2. /*
  3. * linux/arch/m68knommu/platform/5272/config.c
  4. *
  5. * Copyright (C) 1999-2002, Greg Ungerer (gerg@snapgear.com)
  6. * Copyright (C) 2001-2002, SnapGear Inc. (www.snapgear.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. /***************************************************************************/
  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. extern unsigned int mcf_timervector;
  29. extern unsigned int mcf_profilevector;
  30. extern unsigned int mcf_timerlevel;
  31. /***************************************************************************/
  32. /*
  33. * Some platforms need software versions of the GPIO data registers.
  34. */
  35. unsigned short ppdata;
  36. unsigned char ledbank = 0xff;
  37. /***************************************************************************/
  38. /*
  39. * DMA channel base address table.
  40. */
  41. unsigned int dma_base_addr[MAX_M68K_DMA_CHANNELS] = {
  42. MCF_MBAR + MCFDMA_BASE0,
  43. };
  44. unsigned int dma_device_address[MAX_M68K_DMA_CHANNELS];
  45. /***************************************************************************/
  46. void mcf_disableall(void)
  47. {
  48. volatile unsigned long *icrp;
  49. icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR1);
  50. icrp[0] = 0x88888888;
  51. icrp[1] = 0x88888888;
  52. icrp[2] = 0x88888888;
  53. icrp[3] = 0x88888888;
  54. }
  55. /***************************************************************************/
  56. void mcf_autovector(unsigned int vec)
  57. {
  58. /* Everything is auto-vectored on the 5272 */
  59. }
  60. /***************************************************************************/
  61. void mcf_settimericr(int timer, int level)
  62. {
  63. volatile unsigned long *icrp;
  64. if ((timer >= 1 ) && (timer <= 4)) {
  65. icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR1);
  66. *icrp = (0x8 | level) << ((4 - timer) * 4);
  67. }
  68. }
  69. /***************************************************************************/
  70. int mcf_timerirqpending(int timer)
  71. {
  72. volatile unsigned long *icrp;
  73. if ((timer >= 1 ) && (timer <= 4)) {
  74. icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR1);
  75. return (*icrp & (0x8 << ((4 - timer) * 4)));
  76. }
  77. return 0;
  78. }
  79. /***************************************************************************/
  80. void config_BSP(char *commandp, int size)
  81. {
  82. #if defined (CONFIG_MOD5272)
  83. volatile unsigned char *pivrp;
  84. /* Set base of device vectors to be 64 */
  85. pivrp = (volatile unsigned char *) (MCF_MBAR + MCFSIM_PIVR);
  86. *pivrp = 0x40;
  87. #endif
  88. mcf_disableall();
  89. #if defined(CONFIG_BOOTPARAM)
  90. strncpy(commandp, CONFIG_BOOTPARAM_STRING, size);
  91. commandp[size-1] = 0;
  92. #elif defined(CONFIG_NETtel) || defined(CONFIG_SCALES)
  93. /* Copy command line from FLASH to local buffer... */
  94. memcpy(commandp, (char *) 0xf0004000, size);
  95. commandp[size-1] = 0;
  96. #elif defined(CONFIG_MTD_KeyTechnology)
  97. /* Copy command line from FLASH to local buffer... */
  98. memcpy(commandp, (char *) 0xffe06000, size);
  99. commandp[size-1] = 0;
  100. #elif defined(CONFIG_CANCam)
  101. /* Copy command line from FLASH to local buffer... */
  102. memcpy(commandp, (char *) 0xf0010000, size);
  103. commandp[size-1] = 0;
  104. #else
  105. memset(commandp, 0, size);
  106. #endif
  107. mcf_timervector = 69;
  108. mcf_profilevector = 70;
  109. mach_sched_init = coldfire_timer_init;
  110. mach_tick = coldfire_tick;
  111. mach_gettimeoffset = coldfire_timer_offset;
  112. mach_trap_init = coldfire_trap_init;
  113. mach_reset = coldfire_reset;
  114. }
  115. /***************************************************************************/