shdma-arm.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * Renesas SuperH DMA Engine support
  3. *
  4. * Copyright (C) 2013 Renesas Electronics, Inc.
  5. *
  6. * This is free software; you can redistribute it and/or modify it under the
  7. * terms of version 2 the GNU General Public License as published by the Free
  8. * Software Foundation.
  9. */
  10. #ifndef SHDMA_ARM_H
  11. #define SHDMA_ARM_H
  12. #include "shdma.h"
  13. /* Transmit sizes and respective CHCR register values */
  14. enum {
  15. XMIT_SZ_8BIT = 0,
  16. XMIT_SZ_16BIT = 1,
  17. XMIT_SZ_32BIT = 2,
  18. XMIT_SZ_64BIT = 7,
  19. XMIT_SZ_128BIT = 3,
  20. XMIT_SZ_256BIT = 4,
  21. XMIT_SZ_512BIT = 5,
  22. };
  23. /* log2(size / 8) - used to calculate number of transfers */
  24. #define SH_DMAE_TS_SHIFT { \
  25. [XMIT_SZ_8BIT] = 0, \
  26. [XMIT_SZ_16BIT] = 1, \
  27. [XMIT_SZ_32BIT] = 2, \
  28. [XMIT_SZ_64BIT] = 3, \
  29. [XMIT_SZ_128BIT] = 4, \
  30. [XMIT_SZ_256BIT] = 5, \
  31. [XMIT_SZ_512BIT] = 6, \
  32. }
  33. #define TS_LOW_BIT 0x3 /* --xx */
  34. #define TS_HI_BIT 0xc /* xx-- */
  35. #define TS_LOW_SHIFT (3)
  36. #define TS_HI_SHIFT (20 - 2) /* 2 bits for shifted low TS */
  37. #define TS_INDEX2VAL(i) \
  38. ((((i) & TS_LOW_BIT) << TS_LOW_SHIFT) |\
  39. (((i) & TS_HI_BIT) << TS_HI_SHIFT))
  40. #define CHCR_TX(xmit_sz) (DM_FIX | SM_INC | RS_ERS | TS_INDEX2VAL((xmit_sz)))
  41. #define CHCR_RX(xmit_sz) (DM_INC | SM_FIX | RS_ERS | TS_INDEX2VAL((xmit_sz)))
  42. #endif