sh_dma.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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/dmaengine.h>
  13. #include <linux/list.h>
  14. #include <linux/shdma-base.h>
  15. #include <linux/types.h>
  16. struct device;
  17. /* Used by slave DMA clients to request DMA to/from a specific peripheral */
  18. struct sh_dmae_slave {
  19. struct shdma_slave shdma_slave; /* Set by the platform */
  20. };
  21. /*
  22. * Supplied by platforms to specify, how a DMA channel has to be configured for
  23. * a certain peripheral
  24. */
  25. struct sh_dmae_slave_config {
  26. unsigned int slave_id;
  27. dma_addr_t addr;
  28. u32 chcr;
  29. char mid_rid;
  30. };
  31. struct sh_dmae_channel {
  32. unsigned int offset;
  33. unsigned int dmars;
  34. unsigned int dmars_bit;
  35. unsigned int chclr_offset;
  36. };
  37. struct sh_dmae_pdata {
  38. const struct sh_dmae_slave_config *slave;
  39. int slave_num;
  40. const struct sh_dmae_channel *channel;
  41. int channel_num;
  42. unsigned int ts_low_shift;
  43. unsigned int ts_low_mask;
  44. unsigned int ts_high_shift;
  45. unsigned int ts_high_mask;
  46. const unsigned int *ts_shift;
  47. int ts_shift_num;
  48. u16 dmaor_init;
  49. unsigned int chcr_offset;
  50. u32 chcr_ie_bit;
  51. unsigned int dmaor_is_32bit:1;
  52. unsigned int needs_tend_set:1;
  53. unsigned int no_dmars:1;
  54. unsigned int chclr_present:1;
  55. unsigned int slave_only:1;
  56. };
  57. /* DMA register */
  58. #define SAR 0x00
  59. #define DAR 0x04
  60. #define TCR 0x08
  61. #define CHCR 0x0C
  62. #define DMAOR 0x40
  63. #define TEND 0x18 /* USB-DMAC */
  64. /* DMAOR definitions */
  65. #define DMAOR_AE 0x00000004
  66. #define DMAOR_NMIF 0x00000002
  67. #define DMAOR_DME 0x00000001
  68. /* Definitions for the SuperH DMAC */
  69. #define REQ_L 0x00000000
  70. #define REQ_E 0x00080000
  71. #define RACK_H 0x00000000
  72. #define RACK_L 0x00040000
  73. #define ACK_R 0x00000000
  74. #define ACK_W 0x00020000
  75. #define ACK_H 0x00000000
  76. #define ACK_L 0x00010000
  77. #define DM_INC 0x00004000
  78. #define DM_DEC 0x00008000
  79. #define DM_FIX 0x0000c000
  80. #define SM_INC 0x00001000
  81. #define SM_DEC 0x00002000
  82. #define SM_FIX 0x00003000
  83. #define RS_IN 0x00000200
  84. #define RS_OUT 0x00000300
  85. #define TS_BLK 0x00000040
  86. #define TM_BUR 0x00000020
  87. #define CHCR_DE 0x00000001
  88. #define CHCR_TE 0x00000002
  89. #define CHCR_IE 0x00000004
  90. #endif