dma.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * LPC32xx DMA Controller Interface
  4. *
  5. * Copyright (C) 2008 by NXP Semiconductors
  6. * @Author: Kevin Wells
  7. * @Descr: Definitions for LPC3250 chip
  8. * @References: NXP LPC3250 User's Guide
  9. */
  10. #ifndef _LPC32XX_DMA_H
  11. #define _LPC32XX_DMA_H
  12. #include <common.h>
  13. /*
  14. * DMA linked list structure used with a channel's LLI register;
  15. * refer to UM10326, "LPC32x0 and LPC32x0/01 User manual" - Rev. 3
  16. * tables 84, 85, 86 & 87 for details.
  17. */
  18. struct lpc32xx_dmac_ll {
  19. u32 dma_src;
  20. u32 dma_dest;
  21. u32 next_lli;
  22. u32 next_ctrl;
  23. };
  24. /* control register definitions */
  25. #define DMAC_CHAN_INT_TC_EN (1 << 31) /* channel terminal count interrupt */
  26. #define DMAC_CHAN_DEST_AUTOINC (1 << 27) /* automatic destination increment */
  27. #define DMAC_CHAN_SRC_AUTOINC (1 << 26) /* automatic source increment */
  28. #define DMAC_CHAN_DEST_AHB1 (1 << 25) /* AHB1 master for dest. transfer */
  29. #define DMAC_CHAN_DEST_WIDTH_32 (1 << 22) /* Destination data width selection */
  30. #define DMAC_CHAN_SRC_WIDTH_32 (1 << 19) /* Source data width selection */
  31. #define DMAC_CHAN_DEST_BURST_1 0
  32. #define DMAC_CHAN_DEST_BURST_4 (1 << 15) /* Destination data burst size */
  33. #define DMAC_CHAN_SRC_BURST_1 0
  34. #define DMAC_CHAN_SRC_BURST_4 (1 << 12) /* Source data burst size */
  35. /*
  36. * config_ch register definitions
  37. * DMAC_CHAN_FLOW_D_xxx: flow control with DMA as the controller
  38. * DMAC_DEST_PERIP: Macro for loading destination peripheral
  39. * DMAC_SRC_PERIP: Macro for loading source peripheral
  40. */
  41. #define DMAC_CHAN_FLOW_D_M2P (0x1 << 11)
  42. #define DMAC_CHAN_FLOW_D_P2M (0x2 << 11)
  43. #define DMAC_DEST_PERIP(n) (((n) & 0x1F) << 6)
  44. #define DMAC_SRC_PERIP(n) (((n) & 0x1F) << 1)
  45. /*
  46. * config_ch register definitions
  47. * (source and destination peripheral ID numbers).
  48. * These can be used with the DMAC_DEST_PERIP and DMAC_SRC_PERIP macros.
  49. */
  50. #define DMA_PERID_NAND1 1
  51. /* Channel enable bit */
  52. #define DMAC_CHAN_ENABLE (1 << 0)
  53. int lpc32xx_dma_get_channel(void);
  54. int lpc32xx_dma_start_xfer(unsigned int channel,
  55. const struct lpc32xx_dmac_ll *desc, u32 config);
  56. int lpc32xx_dma_wait_status(unsigned int channel);
  57. #endif /* _LPC32XX_DMA_H */