config.c 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /***************************************************************************/
  2. /*
  3. * linux/arch/m68knommu/platform/5206e/config.c
  4. *
  5. * Copyright (C) 1999-2002, Greg Ungerer (gerg@snapgear.com)
  6. */
  7. /***************************************************************************/
  8. #include <linux/kernel.h>
  9. #include <linux/param.h>
  10. #include <linux/interrupt.h>
  11. #include <asm/dma.h>
  12. #include <asm/machdep.h>
  13. #include <asm/coldfire.h>
  14. #include <asm/mcfsim.h>
  15. #include <asm/mcfdma.h>
  16. /***************************************************************************/
  17. void coldfire_reset(void);
  18. /***************************************************************************/
  19. /*
  20. * DMA channel base address table.
  21. */
  22. unsigned int dma_base_addr[MAX_M68K_DMA_CHANNELS] = {
  23. MCF_MBAR + MCFDMA_BASE0,
  24. MCF_MBAR + MCFDMA_BASE1,
  25. };
  26. unsigned int dma_device_address[MAX_M68K_DMA_CHANNELS];
  27. /***************************************************************************/
  28. void mcf_autovector(unsigned int vec)
  29. {
  30. volatile unsigned char *mbar;
  31. unsigned char icr;
  32. if ((vec >= 25) && (vec <= 31)) {
  33. vec -= 25;
  34. mbar = (volatile unsigned char *) MCF_MBAR;
  35. icr = MCFSIM_ICR_AUTOVEC | (vec << 3);
  36. *(mbar + MCFSIM_ICR1 + vec) = icr;
  37. vec = 0x1 << (vec + 1);
  38. mcf_setimr(mcf_getimr() & ~vec);
  39. }
  40. }
  41. /***************************************************************************/
  42. void mcf_settimericr(unsigned int timer, unsigned int level)
  43. {
  44. volatile unsigned char *icrp;
  45. unsigned int icr, imr;
  46. if (timer <= 2) {
  47. switch (timer) {
  48. case 2: icr = MCFSIM_TIMER2ICR; imr = MCFSIM_IMR_TIMER2; break;
  49. default: icr = MCFSIM_TIMER1ICR; imr = MCFSIM_IMR_TIMER1; break;
  50. }
  51. icrp = (volatile unsigned char *) (MCF_MBAR + icr);
  52. *icrp = MCFSIM_ICR_AUTOVEC | (level << 2) | MCFSIM_ICR_PRI3;
  53. mcf_setimr(mcf_getimr() & ~imr);
  54. }
  55. }
  56. /***************************************************************************/
  57. int mcf_timerirqpending(int timer)
  58. {
  59. unsigned int imr = 0;
  60. switch (timer) {
  61. case 1: imr = MCFSIM_IMR_TIMER1; break;
  62. case 2: imr = MCFSIM_IMR_TIMER2; break;
  63. default: break;
  64. }
  65. return (mcf_getipr() & imr);
  66. }
  67. /***************************************************************************/
  68. void config_BSP(char *commandp, int size)
  69. {
  70. mcf_setimr(MCFSIM_IMR_MASKALL);
  71. #if defined(CONFIG_NETtel)
  72. /* Copy command line from FLASH to local buffer... */
  73. memcpy(commandp, (char *) 0xf0004000, size);
  74. commandp[size-1] = 0;
  75. #endif /* CONFIG_NETtel */
  76. mach_reset = coldfire_reset;
  77. }
  78. /***************************************************************************/