sh_dma.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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 SH_DMA_H
  11. #define SH_DMA_H
  12. #include <linux/list.h>
  13. #include <linux/dmaengine.h>
  14. /* Used by slave DMA clients to request DMA to/from a specific peripheral */
  15. struct sh_dmae_slave {
  16. unsigned int slave_id; /* Set by the platform */
  17. struct device *dma_dev; /* Set by the platform */
  18. const struct sh_dmae_slave_config *config; /* Set by the driver */
  19. };
  20. struct sh_dmae_regs {
  21. u32 sar; /* SAR / source address */
  22. u32 dar; /* DAR / destination address */
  23. u32 tcr; /* TCR / transfer count */
  24. };
  25. struct sh_desc {
  26. struct sh_dmae_regs hw;
  27. struct list_head node;
  28. struct dma_async_tx_descriptor async_tx;
  29. enum dma_data_direction direction;
  30. dma_cookie_t cookie;
  31. size_t partial;
  32. int chunks;
  33. int mark;
  34. };
  35. struct sh_dmae_slave_config {
  36. unsigned int slave_id;
  37. dma_addr_t addr;
  38. u32 chcr;
  39. char mid_rid;
  40. };
  41. struct sh_dmae_channel {
  42. unsigned int offset;
  43. unsigned int dmars;
  44. unsigned int dmars_bit;
  45. };
  46. struct sh_dmae_pdata {
  47. const struct sh_dmae_slave_config *slave;
  48. int slave_num;
  49. const struct sh_dmae_channel *channel;
  50. int channel_num;
  51. unsigned int ts_low_shift;
  52. unsigned int ts_low_mask;
  53. unsigned int ts_high_shift;
  54. unsigned int ts_high_mask;
  55. const unsigned int *ts_shift;
  56. int ts_shift_num;
  57. u16 dmaor_init;
  58. unsigned int chcr_offset;
  59. u32 chcr_ie_bit;
  60. unsigned int dmaor_is_32bit:1;
  61. unsigned int needs_tend_set:1;
  62. unsigned int no_dmars:1;
  63. };
  64. /* DMA register */
  65. #define SAR 0x00
  66. #define DAR 0x04
  67. #define TCR 0x08
  68. #define CHCR 0x0C
  69. #define DMAOR 0x40
  70. #define TEND 0x18 /* USB-DMAC */
  71. /* DMAOR definitions */
  72. #define DMAOR_AE 0x00000004
  73. #define DMAOR_NMIF 0x00000002
  74. #define DMAOR_DME 0x00000001
  75. /* Definitions for the SuperH DMAC */
  76. #define REQ_L 0x00000000
  77. #define REQ_E 0x00080000
  78. #define RACK_H 0x00000000
  79. #define RACK_L 0x00040000
  80. #define ACK_R 0x00000000
  81. #define ACK_W 0x00020000
  82. #define ACK_H 0x00000000
  83. #define ACK_L 0x00010000
  84. #define DM_INC 0x00004000
  85. #define DM_DEC 0x00008000
  86. #define DM_FIX 0x0000c000
  87. #define SM_INC 0x00001000
  88. #define SM_DEC 0x00002000
  89. #define SM_FIX 0x00003000
  90. #define RS_IN 0x00000200
  91. #define RS_OUT 0x00000300
  92. #define TS_BLK 0x00000040
  93. #define TM_BUR 0x00000020
  94. #define CHCR_DE 0x00000001
  95. #define CHCR_TE 0x00000002
  96. #define CHCR_IE 0x00000004
  97. #endif