shdma-r8a73a4.c 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Renesas SuperH DMA Engine support for r8a73a4 (APE6) SoCs
  4. *
  5. * Copyright (C) 2013 Renesas Electronics, Inc.
  6. */
  7. #include <linux/sh_dma.h>
  8. #include "shdma-arm.h"
  9. static const unsigned int dma_ts_shift[] = SH_DMAE_TS_SHIFT;
  10. static const struct sh_dmae_slave_config dma_slaves[] = {
  11. {
  12. .chcr = CHCR_TX(XMIT_SZ_32BIT),
  13. .mid_rid = 0xd1, /* MMC0 Tx */
  14. }, {
  15. .chcr = CHCR_RX(XMIT_SZ_32BIT),
  16. .mid_rid = 0xd2, /* MMC0 Rx */
  17. }, {
  18. .chcr = CHCR_TX(XMIT_SZ_32BIT),
  19. .mid_rid = 0xe1, /* MMC1 Tx */
  20. }, {
  21. .chcr = CHCR_RX(XMIT_SZ_32BIT),
  22. .mid_rid = 0xe2, /* MMC1 Rx */
  23. },
  24. };
  25. #define DMAE_CHANNEL(a, b) \
  26. { \
  27. .offset = (a) - 0x20, \
  28. .dmars = (a) - 0x20 + 0x40, \
  29. .chclr_bit = (b), \
  30. .chclr_offset = 0x80 - 0x20, \
  31. }
  32. static const struct sh_dmae_channel dma_channels[] = {
  33. DMAE_CHANNEL(0x8000, 0),
  34. DMAE_CHANNEL(0x8080, 1),
  35. DMAE_CHANNEL(0x8100, 2),
  36. DMAE_CHANNEL(0x8180, 3),
  37. DMAE_CHANNEL(0x8200, 4),
  38. DMAE_CHANNEL(0x8280, 5),
  39. DMAE_CHANNEL(0x8300, 6),
  40. DMAE_CHANNEL(0x8380, 7),
  41. DMAE_CHANNEL(0x8400, 8),
  42. DMAE_CHANNEL(0x8480, 9),
  43. DMAE_CHANNEL(0x8500, 10),
  44. DMAE_CHANNEL(0x8580, 11),
  45. DMAE_CHANNEL(0x8600, 12),
  46. DMAE_CHANNEL(0x8680, 13),
  47. DMAE_CHANNEL(0x8700, 14),
  48. DMAE_CHANNEL(0x8780, 15),
  49. DMAE_CHANNEL(0x8800, 16),
  50. DMAE_CHANNEL(0x8880, 17),
  51. DMAE_CHANNEL(0x8900, 18),
  52. DMAE_CHANNEL(0x8980, 19),
  53. };
  54. const struct sh_dmae_pdata r8a73a4_dma_pdata = {
  55. .slave = dma_slaves,
  56. .slave_num = ARRAY_SIZE(dma_slaves),
  57. .channel = dma_channels,
  58. .channel_num = ARRAY_SIZE(dma_channels),
  59. .ts_low_shift = TS_LOW_SHIFT,
  60. .ts_low_mask = TS_LOW_BIT << TS_LOW_SHIFT,
  61. .ts_high_shift = TS_HI_SHIFT,
  62. .ts_high_mask = TS_HI_BIT << TS_HI_SHIFT,
  63. .ts_shift = dma_ts_shift,
  64. .ts_shift_num = ARRAY_SIZE(dma_ts_shift),
  65. .dmaor_init = DMAOR_DME,
  66. .chclr_present = 1,
  67. .chclr_bitwise = 1,
  68. };