config.c 3.6 KB

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