dma-rcar-hpbdma.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /*
  2. * Copyright (C) 2011-2013 Renesas Electronics Corporation
  3. * Copyright (C) 2013 Cogent Embedded, Inc.
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License version 2
  7. * as published by the Free Software Foundation.
  8. */
  9. #ifndef __DMA_RCAR_HPBDMA_H
  10. #define __DMA_RCAR_HPBDMA_H
  11. #include <linux/bitops.h>
  12. #include <linux/types.h>
  13. /* Transmit sizes and respective register values */
  14. enum {
  15. XMIT_SZ_8BIT = 0,
  16. XMIT_SZ_16BIT = 1,
  17. XMIT_SZ_32BIT = 2,
  18. XMIT_SZ_MAX
  19. };
  20. /* DMA control register (DCR) bits */
  21. #define HPB_DMAE_DCR_DTAMD (1u << 26)
  22. #define HPB_DMAE_DCR_DTAC (1u << 25)
  23. #define HPB_DMAE_DCR_DTAU (1u << 24)
  24. #define HPB_DMAE_DCR_DTAU1 (1u << 23)
  25. #define HPB_DMAE_DCR_SWMD (1u << 22)
  26. #define HPB_DMAE_DCR_BTMD (1u << 21)
  27. #define HPB_DMAE_DCR_PKMD (1u << 20)
  28. #define HPB_DMAE_DCR_CT (1u << 18)
  29. #define HPB_DMAE_DCR_ACMD (1u << 17)
  30. #define HPB_DMAE_DCR_DIP (1u << 16)
  31. #define HPB_DMAE_DCR_SMDL (1u << 13)
  32. #define HPB_DMAE_DCR_SPDAM (1u << 12)
  33. #define HPB_DMAE_DCR_SDRMD_MASK (3u << 10)
  34. #define HPB_DMAE_DCR_SDRMD_MOD (0u << 10)
  35. #define HPB_DMAE_DCR_SDRMD_AUTO (1u << 10)
  36. #define HPB_DMAE_DCR_SDRMD_TIMER (2u << 10)
  37. #define HPB_DMAE_DCR_SPDS_MASK (3u << 8)
  38. #define HPB_DMAE_DCR_SPDS_8BIT (0u << 8)
  39. #define HPB_DMAE_DCR_SPDS_16BIT (1u << 8)
  40. #define HPB_DMAE_DCR_SPDS_32BIT (2u << 8)
  41. #define HPB_DMAE_DCR_DMDL (1u << 5)
  42. #define HPB_DMAE_DCR_DPDAM (1u << 4)
  43. #define HPB_DMAE_DCR_DDRMD_MASK (3u << 2)
  44. #define HPB_DMAE_DCR_DDRMD_MOD (0u << 2)
  45. #define HPB_DMAE_DCR_DDRMD_AUTO (1u << 2)
  46. #define HPB_DMAE_DCR_DDRMD_TIMER (2u << 2)
  47. #define HPB_DMAE_DCR_DPDS_MASK (3u << 0)
  48. #define HPB_DMAE_DCR_DPDS_8BIT (0u << 0)
  49. #define HPB_DMAE_DCR_DPDS_16BIT (1u << 0)
  50. #define HPB_DMAE_DCR_DPDS_32BIT (2u << 0)
  51. /* Asynchronous reset register (ASYNCRSTR) bits */
  52. #define HPB_DMAE_ASYNCRSTR_ASRST41 BIT(10)
  53. #define HPB_DMAE_ASYNCRSTR_ASRST40 BIT(9)
  54. #define HPB_DMAE_ASYNCRSTR_ASRST39 BIT(8)
  55. #define HPB_DMAE_ASYNCRSTR_ASRST27 BIT(7)
  56. #define HPB_DMAE_ASYNCRSTR_ASRST26 BIT(6)
  57. #define HPB_DMAE_ASYNCRSTR_ASRST25 BIT(5)
  58. #define HPB_DMAE_ASYNCRSTR_ASRST24 BIT(4)
  59. #define HPB_DMAE_ASYNCRSTR_ASRST23 BIT(3)
  60. #define HPB_DMAE_ASYNCRSTR_ASRST22 BIT(2)
  61. #define HPB_DMAE_ASYNCRSTR_ASRST21 BIT(1)
  62. #define HPB_DMAE_ASYNCRSTR_ASRST20 BIT(0)
  63. struct hpb_dmae_slave_config {
  64. unsigned int id;
  65. dma_addr_t addr;
  66. u32 dcr;
  67. u32 port;
  68. u32 rstr;
  69. u32 mdr;
  70. u32 mdm;
  71. u32 flags;
  72. #define HPB_DMAE_SET_ASYNC_RESET BIT(0)
  73. #define HPB_DMAE_SET_ASYNC_MODE BIT(1)
  74. u32 dma_ch;
  75. };
  76. #define HPB_DMAE_CHANNEL(_irq, _s_id) \
  77. { \
  78. .ch_irq = _irq, \
  79. .s_id = _s_id, \
  80. }
  81. struct hpb_dmae_channel {
  82. unsigned int ch_irq;
  83. unsigned int s_id;
  84. };
  85. struct hpb_dmae_pdata {
  86. const struct hpb_dmae_slave_config *slaves;
  87. int num_slaves;
  88. const struct hpb_dmae_channel *channels;
  89. int num_channels;
  90. const unsigned int ts_shift[XMIT_SZ_MAX];
  91. int num_hw_channels;
  92. };
  93. #endif