config.c 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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/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. /***************************************************************************/
  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. };
  45. unsigned int dma_device_address[MAX_M68K_DMA_CHANNELS];
  46. /***************************************************************************/
  47. void mcf_disableall(void)
  48. {
  49. volatile unsigned long *icrp;
  50. icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR1);
  51. icrp[0] = 0x88888888;
  52. icrp[1] = 0x88888888;
  53. icrp[2] = 0x88888888;
  54. icrp[3] = 0x88888888;
  55. }
  56. /***************************************************************************/
  57. void mcf_autovector(unsigned int vec)
  58. {
  59. /* Everything is auto-vectored on the 5272 */
  60. }
  61. /***************************************************************************/
  62. void mcf_settimericr(int timer, int level)
  63. {
  64. volatile unsigned long *icrp;
  65. if ((timer >= 1 ) && (timer <= 4)) {
  66. icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR1);
  67. *icrp = (0x8 | level) << ((4 - timer) * 4);
  68. }
  69. }
  70. /***************************************************************************/
  71. int mcf_timerirqpending(int timer)
  72. {
  73. volatile unsigned long *icrp;
  74. if ((timer >= 1 ) && (timer <= 4)) {
  75. icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR1);
  76. return (*icrp & (0x8 << ((4 - timer) * 4)));
  77. }
  78. return 0;
  79. }
  80. /***************************************************************************/
  81. void config_BSP(char *commandp, int size)
  82. {
  83. #if defined (CONFIG_MOD5272)
  84. volatile unsigned char *pivrp;
  85. /* Set base of device vectors to be 64 */
  86. pivrp = (volatile unsigned char *) (MCF_MBAR + MCFSIM_PIVR);
  87. *pivrp = 0x40;
  88. #endif
  89. mcf_disableall();
  90. #if defined(CONFIG_BOOTPARAM)
  91. strncpy(commandp, CONFIG_BOOTPARAM_STRING, size);
  92. commandp[size-1] = 0;
  93. #elif defined(CONFIG_NETtel) || defined(CONFIG_SCALES)
  94. /* Copy command line from FLASH to local buffer... */
  95. memcpy(commandp, (char *) 0xf0004000, size);
  96. commandp[size-1] = 0;
  97. #elif defined(CONFIG_MTD_KeyTechnology)
  98. /* Copy command line from FLASH to local buffer... */
  99. memcpy(commandp, (char *) 0xffe06000, size);
  100. commandp[size-1] = 0;
  101. #elif defined(CONFIG_CANCam)
  102. /* Copy command line from FLASH to local buffer... */
  103. memcpy(commandp, (char *) 0xf0010000, size);
  104. commandp[size-1] = 0;
  105. #else
  106. memset(commandp, 0, size);
  107. #endif
  108. mcf_timervector = 69;
  109. mcf_profilevector = 70;
  110. mach_sched_init = coldfire_timer_init;
  111. mach_tick = coldfire_tick;
  112. mach_gettimeoffset = coldfire_timer_offset;
  113. mach_trap_init = coldfire_trap_init;
  114. mach_reset = coldfire_reset;
  115. }
  116. /***************************************************************************/