shdma-r8a73a4.c 2.0 KB

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