dmaengine.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*
  2. * Header for the new SH dmaengine driver
  3. *
  4. * Copyright (C) 2010 Guennadi Liakhovetski <g.liakhovetski@gmx.de>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. */
  10. #ifndef ASM_DMAENGINE_H
  11. #define ASM_DMAENGINE_H
  12. #include <linux/dmaengine.h>
  13. #include <linux/list.h>
  14. #include <asm/dma-register.h>
  15. #define SH_DMAC_MAX_CHANNELS 6
  16. enum {
  17. SHDMA_SLAVE_SCIF0_TX,
  18. SHDMA_SLAVE_SCIF0_RX,
  19. SHDMA_SLAVE_SCIF1_TX,
  20. SHDMA_SLAVE_SCIF1_RX,
  21. SHDMA_SLAVE_SCIF2_TX,
  22. SHDMA_SLAVE_SCIF2_RX,
  23. SHDMA_SLAVE_SCIF3_TX,
  24. SHDMA_SLAVE_SCIF3_RX,
  25. SHDMA_SLAVE_SCIF4_TX,
  26. SHDMA_SLAVE_SCIF4_RX,
  27. SHDMA_SLAVE_SCIF5_TX,
  28. SHDMA_SLAVE_SCIF5_RX,
  29. SHDMA_SLAVE_SIUA_TX,
  30. SHDMA_SLAVE_SIUA_RX,
  31. SHDMA_SLAVE_SIUB_TX,
  32. SHDMA_SLAVE_SIUB_RX,
  33. };
  34. struct sh_dmae_slave_config {
  35. unsigned int slave_id;
  36. dma_addr_t addr;
  37. u32 chcr;
  38. char mid_rid;
  39. };
  40. struct sh_dmae_channel {
  41. unsigned int offset;
  42. unsigned int dmars;
  43. unsigned int dmars_bit;
  44. };
  45. struct sh_dmae_pdata {
  46. struct sh_dmae_slave_config *slave;
  47. int slave_num;
  48. struct sh_dmae_channel *channel;
  49. int channel_num;
  50. unsigned int ts_low_shift;
  51. unsigned int ts_low_mask;
  52. unsigned int ts_high_shift;
  53. unsigned int ts_high_mask;
  54. unsigned int *ts_shift;
  55. int ts_shift_num;
  56. u16 dmaor_init;
  57. };
  58. struct device;
  59. /* Used by slave DMA clients to request DMA to/from a specific peripheral */
  60. struct sh_dmae_slave {
  61. unsigned int slave_id; /* Set by the platform */
  62. struct device *dma_dev; /* Set by the platform */
  63. struct sh_dmae_slave_config *config; /* Set by the driver */
  64. };
  65. struct sh_dmae_regs {
  66. u32 sar; /* SAR / source address */
  67. u32 dar; /* DAR / destination address */
  68. u32 tcr; /* TCR / transfer count */
  69. };
  70. struct sh_desc {
  71. struct sh_dmae_regs hw;
  72. struct list_head node;
  73. struct dma_async_tx_descriptor async_tx;
  74. enum dma_data_direction direction;
  75. dma_cookie_t cookie;
  76. size_t partial;
  77. int chunks;
  78. int mark;
  79. };
  80. #endif