dma-mx1-mx2.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /*
  2. * linux/arch/arm/plat-mxc/include/mach/dma-mx1-mx2.h
  3. *
  4. * i.MX DMA registration and IRQ dispatching
  5. *
  6. * Copyright 2006 Pavel Pisa <pisa@cmp.felk.cvut.cz>
  7. * Copyright 2008 Juergen Beisert, <kernel@pengutronix.de>
  8. * Copyright 2008 Sascha Hauer, <s.hauer@pengutronix.de>
  9. *
  10. * This program is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU General Public License
  12. * as published by the Free Software Foundation; either version 2
  13. * of the License, or (at your option) any later version.
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  22. * MA 02110-1301, USA.
  23. */
  24. #ifndef __ASM_ARCH_MXC_DMA_H
  25. #define __ASM_ARCH_MXC_DMA_H
  26. #define IMX_DMA_CHANNELS 16
  27. #define DMA_MODE_READ 0
  28. #define DMA_MODE_WRITE 1
  29. #define DMA_MODE_MASK 1
  30. #define MX1_DMA_REG(offset) MX1_IO_ADDRESS(MX1_DMA_BASE_ADDR + (offset))
  31. /* DMA Interrupt Mask Register */
  32. #define MX1_DMA_DIMR MX1_DMA_REG(0x08)
  33. /* Channel Control Register */
  34. #define MX1_DMA_CCR(x) MX1_DMA_REG(0x8c + ((x) << 6))
  35. #define IMX_DMA_MEMSIZE_32 (0 << 4)
  36. #define IMX_DMA_MEMSIZE_8 (1 << 4)
  37. #define IMX_DMA_MEMSIZE_16 (2 << 4)
  38. #define IMX_DMA_TYPE_LINEAR (0 << 10)
  39. #define IMX_DMA_TYPE_2D (1 << 10)
  40. #define IMX_DMA_TYPE_FIFO (2 << 10)
  41. #define IMX_DMA_ERR_BURST (1 << 0)
  42. #define IMX_DMA_ERR_REQUEST (1 << 1)
  43. #define IMX_DMA_ERR_TRANSFER (1 << 2)
  44. #define IMX_DMA_ERR_BUFFER (1 << 3)
  45. #define IMX_DMA_ERR_TIMEOUT (1 << 4)
  46. int
  47. imx_dma_config_channel(int channel, unsigned int config_port,
  48. unsigned int config_mem, unsigned int dmareq, int hw_chaining);
  49. void
  50. imx_dma_config_burstlen(int channel, unsigned int burstlen);
  51. int
  52. imx_dma_setup_single(int channel, dma_addr_t dma_address,
  53. unsigned int dma_length, unsigned int dev_addr,
  54. unsigned int dmamode);
  55. /*
  56. * Use this flag as the dma_length argument to imx_dma_setup_sg()
  57. * to create an endless running dma loop. The end of the scatterlist
  58. * must be linked to the beginning for this to work.
  59. */
  60. #define IMX_DMA_LENGTH_LOOP ((unsigned int)-1)
  61. int
  62. imx_dma_setup_sg(int channel, struct scatterlist *sg,
  63. unsigned int sgcount, unsigned int dma_length,
  64. unsigned int dev_addr, unsigned int dmamode);
  65. int
  66. imx_dma_setup_handlers(int channel,
  67. void (*irq_handler) (int, void *),
  68. void (*err_handler) (int, void *, int), void *data);
  69. int
  70. imx_dma_setup_progression_handler(int channel,
  71. void (*prog_handler) (int, void*, struct scatterlist*));
  72. void imx_dma_enable(int channel);
  73. void imx_dma_disable(int channel);
  74. int imx_dma_request(int channel, const char *name);
  75. void imx_dma_free(int channel);
  76. enum imx_dma_prio {
  77. DMA_PRIO_HIGH = 0,
  78. DMA_PRIO_MEDIUM = 1,
  79. DMA_PRIO_LOW = 2
  80. };
  81. int imx_dma_request_by_prio(const char *name, enum imx_dma_prio prio);
  82. #endif /* _ASM_ARCH_MXC_DMA_H */