pl08x.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*
  2. * linux/amba/pl08x.h - ARM PrimeCell DMA Controller driver
  3. *
  4. * Copyright (C) 2005 ARM Ltd
  5. * Copyright (C) 2010 ST-Ericsson SA
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. *
  11. * pl08x information required by platform code
  12. *
  13. * Please credit ARM.com
  14. * Documentation: ARM DDI 0196D
  15. */
  16. #ifndef AMBA_PL08X_H
  17. #define AMBA_PL08X_H
  18. /* We need sizes of structs from this header */
  19. #include <linux/dmaengine.h>
  20. #include <linux/interrupt.h>
  21. struct pl08x_driver_data;
  22. struct pl08x_phy_chan;
  23. struct pl08x_txd;
  24. /* Bitmasks for selecting AHB ports for DMA transfers */
  25. enum {
  26. PL08X_AHB1 = (1 << 0),
  27. PL08X_AHB2 = (1 << 1)
  28. };
  29. /**
  30. * struct pl08x_channel_data - data structure to pass info between
  31. * platform and PL08x driver regarding channel configuration
  32. * @bus_id: name of this device channel, not just a device name since
  33. * devices may have more than one channel e.g. "foo_tx"
  34. * @min_signal: the minimum DMA signal number to be muxed in for this
  35. * channel (for platforms supporting muxed signals). If you have
  36. * static assignments, make sure this is set to the assigned signal
  37. * number, PL08x have 16 possible signals in number 0 thru 15 so
  38. * when these are not enough they often get muxed (in hardware)
  39. * disabling simultaneous use of the same channel for two devices.
  40. * @max_signal: the maximum DMA signal number to be muxed in for
  41. * the channel. Set to the same as min_signal for
  42. * devices with static assignments
  43. * @muxval: a number usually used to poke into some mux regiser to
  44. * mux in the signal to this channel
  45. * @cctl_memcpy: options for the channel control register for memcpy
  46. * *** not used for slave channels ***
  47. * @addr: source/target address in physical memory for this DMA channel,
  48. * can be the address of a FIFO register for burst requests for example.
  49. * This can be left undefined if the PrimeCell API is used for configuring
  50. * this.
  51. * @single: the device connected to this channel will request single DMA
  52. * transfers, not bursts. (Bursts are default.)
  53. * @periph_buses: the device connected to this channel is accessible via
  54. * these buses (use PL08X_AHB1 | PL08X_AHB2).
  55. */
  56. struct pl08x_channel_data {
  57. const char *bus_id;
  58. int min_signal;
  59. int max_signal;
  60. u32 muxval;
  61. u32 cctl_memcpy;
  62. dma_addr_t addr;
  63. bool single;
  64. u8 periph_buses;
  65. };
  66. /**
  67. * struct pl08x_platform_data - the platform configuration for the PL08x
  68. * PrimeCells.
  69. * @slave_channels: the channels defined for the different devices on the
  70. * platform, all inclusive, including multiplexed channels. The available
  71. * physical channels will be multiplexed around these signals as they are
  72. * requested, just enumerate all possible channels.
  73. * @get_xfer_signal: request a physical signal to be used for a DMA transfer
  74. * immediately: if there is some multiplexing or similar blocking the use
  75. * of the channel the transfer can be denied by returning less than zero,
  76. * else it returns the allocated signal number
  77. * @put_xfer_signal: indicate to the platform that this physical signal is not
  78. * running any DMA transfer and multiplexing can be recycled
  79. * @lli_buses: buses which LLIs can be fetched from: PL08X_AHB1 | PL08X_AHB2
  80. * @mem_buses: buses which memory can be accessed from: PL08X_AHB1 | PL08X_AHB2
  81. */
  82. struct pl08x_platform_data {
  83. const struct pl08x_channel_data *slave_channels;
  84. unsigned int num_slave_channels;
  85. struct pl08x_channel_data memcpy_channel;
  86. int (*get_xfer_signal)(const struct pl08x_channel_data *);
  87. void (*put_xfer_signal)(const struct pl08x_channel_data *, int);
  88. u8 lli_buses;
  89. u8 mem_buses;
  90. };
  91. #ifdef CONFIG_AMBA_PL08X
  92. bool pl08x_filter_id(struct dma_chan *chan, void *chan_id);
  93. #else
  94. static inline bool pl08x_filter_id(struct dma_chan *chan, void *chan_id)
  95. {
  96. return false;
  97. }
  98. #endif
  99. #endif /* AMBA_PL08X_H */