diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-26 12:24:48 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-26 12:24:48 -0500 |
| commit | 5115f3c19d17851aaff5a857f55b4a019c908775 (patch) | |
| tree | 0d02cf01e12e86365f4f5e3b234f986daef181a7 /include/linux | |
| parent | c41b3810c09e60664433548c5218cc6ece6a8903 (diff) | |
| parent | 17166a3b6e88b93189e6be5f7e1335a3cc4fa965 (diff) | |
Merge branch 'next' of git://git.infradead.org/users/vkoul/slave-dma
Pull slave-dmaengine updates from Vinod Koul:
"This is fairly big pull by my standards as I had missed last merge
window. So we have the support for device tree for slave-dmaengine,
large updates to dw_dmac driver from Andy for reusing on different
architectures. Along with this we have fixes on bunch of the drivers"
Fix up trivial conflicts, usually due to #include line movement next to
each other.
* 'next' of git://git.infradead.org/users/vkoul/slave-dma: (111 commits)
Revert "ARM: SPEAr13xx: Pass DW DMAC platform data from DT"
ARM: dts: pl330: Add #dma-cells for generic dma binding support
DMA: PL330: Register the DMA controller with the generic DMA helpers
DMA: PL330: Add xlate function
DMA: PL330: Add new pl330 filter for DT case.
dma: tegra20-apb-dma: remove unnecessary assignment
edma: do not waste memory for dma_mask
dma: coh901318: set residue only if dma is in progress
dma: coh901318: avoid unbalanced locking
dmaengine.h: remove redundant else keyword
dma: of-dma: protect list write operation by spin_lock
dmaengine: ste_dma40: do not remove descriptors for cyclic transfers
dma: of-dma.c: fix memory leakage
dw_dmac: apply default dma_mask if needed
dmaengine: ioat - fix spare sparse complain
dmaengine: move drivers/of/dma.c -> drivers/dma/of-dma.c
ioatdma: fix race between updating ioat->head and IOAT_COMPLETION_PENDING
dw_dmac: add support for Lynxpoint DMA controllers
dw_dmac: return proper residue value
dw_dmac: fill individual length of descriptor
...
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/amba/pl080.h | 146 | ||||
| -rw-r--r-- | include/linux/dmaengine.h | 48 | ||||
| -rw-r--r-- | include/linux/dw_dmac.h | 45 | ||||
| -rw-r--r-- | include/linux/of_dma.h | 74 | ||||
| -rw-r--r-- | include/linux/platform_data/dma-ste-dma40.h | 13 |
5 files changed, 285 insertions, 41 deletions
diff --git a/include/linux/amba/pl080.h b/include/linux/amba/pl080.h new file mode 100644 index 000000000000..3e7b62fbefbd --- /dev/null +++ b/include/linux/amba/pl080.h | |||
| @@ -0,0 +1,146 @@ | |||
| 1 | /* include/linux/amba/pl080.h | ||
| 2 | * | ||
| 3 | * Copyright 2008 Openmoko, Inc. | ||
| 4 | * Copyright 2008 Simtec Electronics | ||
| 5 | * http://armlinux.simtec.co.uk/ | ||
| 6 | * Ben Dooks <ben@simtec.co.uk> | ||
| 7 | * | ||
| 8 | * ARM PrimeCell PL080 DMA controller | ||
| 9 | * | ||
| 10 | * This program is free software; you can redistribute it and/or modify | ||
| 11 | * it under the terms of the GNU General Public License version 2 as | ||
| 12 | * published by the Free Software Foundation. | ||
| 13 | */ | ||
| 14 | |||
| 15 | /* Note, there are some Samsung updates to this controller block which | ||
| 16 | * make it not entierly compatible with the PL080 specification from | ||
| 17 | * ARM. When in doubt, check the Samsung documentation first. | ||
| 18 | * | ||
| 19 | * The Samsung defines are PL080S, and add an extra control register, | ||
| 20 | * the ability to move more than 2^11 counts of data and some extra | ||
| 21 | * OneNAND features. | ||
| 22 | */ | ||
| 23 | |||
| 24 | #ifndef ASM_PL080_H | ||
| 25 | #define ASM_PL080_H | ||
| 26 | |||
| 27 | #define PL080_INT_STATUS (0x00) | ||
| 28 | #define PL080_TC_STATUS (0x04) | ||
| 29 | #define PL080_TC_CLEAR (0x08) | ||
| 30 | #define PL080_ERR_STATUS (0x0C) | ||
| 31 | #define PL080_ERR_CLEAR (0x10) | ||
| 32 | #define PL080_RAW_TC_STATUS (0x14) | ||
| 33 | #define PL080_RAW_ERR_STATUS (0x18) | ||
| 34 | #define PL080_EN_CHAN (0x1c) | ||
| 35 | #define PL080_SOFT_BREQ (0x20) | ||
| 36 | #define PL080_SOFT_SREQ (0x24) | ||
| 37 | #define PL080_SOFT_LBREQ (0x28) | ||
| 38 | #define PL080_SOFT_LSREQ (0x2C) | ||
| 39 | |||
| 40 | #define PL080_CONFIG (0x30) | ||
| 41 | #define PL080_CONFIG_M2_BE (1 << 2) | ||
| 42 | #define PL080_CONFIG_M1_BE (1 << 1) | ||
| 43 | #define PL080_CONFIG_ENABLE (1 << 0) | ||
| 44 | |||
| 45 | #define PL080_SYNC (0x34) | ||
| 46 | |||
| 47 | /* Per channel configuration registers */ | ||
| 48 | |||
| 49 | #define PL080_Cx_STRIDE (0x20) | ||
| 50 | #define PL080_Cx_BASE(x) ((0x100 + (x * 0x20))) | ||
| 51 | #define PL080_Cx_SRC_ADDR(x) ((0x100 + (x * 0x20))) | ||
| 52 | #define PL080_Cx_DST_ADDR(x) ((0x104 + (x * 0x20))) | ||
| 53 | #define PL080_Cx_LLI(x) ((0x108 + (x * 0x20))) | ||
| 54 | #define PL080_Cx_CONTROL(x) ((0x10C + (x * 0x20))) | ||
| 55 | #define PL080_Cx_CONFIG(x) ((0x110 + (x * 0x20))) | ||
| 56 | #define PL080S_Cx_CONTROL2(x) ((0x110 + (x * 0x20))) | ||
| 57 | #define PL080S_Cx_CONFIG(x) ((0x114 + (x * 0x20))) | ||
| 58 | |||
| 59 | #define PL080_CH_SRC_ADDR (0x00) | ||
| 60 | #define PL080_CH_DST_ADDR (0x04) | ||
| 61 | #define PL080_CH_LLI (0x08) | ||
| 62 | #define PL080_CH_CONTROL (0x0C) | ||
| 63 | #define PL080_CH_CONFIG (0x10) | ||
| 64 | #define PL080S_CH_CONTROL2 (0x10) | ||
| 65 | #define PL080S_CH_CONFIG (0x14) | ||
| 66 | |||
| 67 | #define PL080_LLI_ADDR_MASK (0x3fffffff << 2) | ||
| 68 | #define PL080_LLI_ADDR_SHIFT (2) | ||
| 69 | #define PL080_LLI_LM_AHB2 (1 << 0) | ||
| 70 | |||
| 71 | #define PL080_CONTROL_TC_IRQ_EN (1 << 31) | ||
| 72 | #define PL080_CONTROL_PROT_MASK (0x7 << 28) | ||
| 73 | #define PL080_CONTROL_PROT_SHIFT (28) | ||
| 74 | #define PL080_CONTROL_PROT_CACHE (1 << 30) | ||
| 75 | #define PL080_CONTROL_PROT_BUFF (1 << 29) | ||
| 76 | #define PL080_CONTROL_PROT_SYS (1 << 28) | ||
| 77 | #define PL080_CONTROL_DST_INCR (1 << 27) | ||
| 78 | #define PL080_CONTROL_SRC_INCR (1 << 26) | ||
| 79 | #define PL080_CONTROL_DST_AHB2 (1 << 25) | ||
| 80 | #define PL080_CONTROL_SRC_AHB2 (1 << 24) | ||
| 81 | #define PL080_CONTROL_DWIDTH_MASK (0x7 << 21) | ||
| 82 | #define PL080_CONTROL_DWIDTH_SHIFT (21) | ||
| 83 | #define PL080_CONTROL_SWIDTH_MASK (0x7 << 18) | ||
| 84 | #define PL080_CONTROL_SWIDTH_SHIFT (18) | ||
| 85 | #define PL080_CONTROL_DB_SIZE_MASK (0x7 << 15) | ||
| 86 | #define PL080_CONTROL_DB_SIZE_SHIFT (15) | ||
| 87 | #define PL080_CONTROL_SB_SIZE_MASK (0x7 << 12) | ||
| 88 | #define PL080_CONTROL_SB_SIZE_SHIFT (12) | ||
| 89 | #define PL080_CONTROL_TRANSFER_SIZE_MASK (0xfff << 0) | ||
| 90 | #define PL080_CONTROL_TRANSFER_SIZE_SHIFT (0) | ||
| 91 | |||
| 92 | #define PL080_BSIZE_1 (0x0) | ||
| 93 | #define PL080_BSIZE_4 (0x1) | ||
| 94 | #define PL080_BSIZE_8 (0x2) | ||
| 95 | #define PL080_BSIZE_16 (0x3) | ||
| 96 | #define PL080_BSIZE_32 (0x4) | ||
| 97 | #define PL080_BSIZE_64 (0x5) | ||
| 98 | #define PL080_BSIZE_128 (0x6) | ||
| 99 | #define PL080_BSIZE_256 (0x7) | ||
| 100 | |||
| 101 | #define PL080_WIDTH_8BIT (0x0) | ||
| 102 | #define PL080_WIDTH_16BIT (0x1) | ||
| 103 | #define PL080_WIDTH_32BIT (0x2) | ||
| 104 | |||
| 105 | #define PL080N_CONFIG_ITPROT (1 << 20) | ||
| 106 | #define PL080N_CONFIG_SECPROT (1 << 19) | ||
| 107 | #define PL080_CONFIG_HALT (1 << 18) | ||
| 108 | #define PL080_CONFIG_ACTIVE (1 << 17) /* RO */ | ||
| 109 | #define PL080_CONFIG_LOCK (1 << 16) | ||
| 110 | #define PL080_CONFIG_TC_IRQ_MASK (1 << 15) | ||
| 111 | #define PL080_CONFIG_ERR_IRQ_MASK (1 << 14) | ||
| 112 | #define PL080_CONFIG_FLOW_CONTROL_MASK (0x7 << 11) | ||
| 113 | #define PL080_CONFIG_FLOW_CONTROL_SHIFT (11) | ||
| 114 | #define PL080_CONFIG_DST_SEL_MASK (0xf << 6) | ||
| 115 | #define PL080_CONFIG_DST_SEL_SHIFT (6) | ||
| 116 | #define PL080_CONFIG_SRC_SEL_MASK (0xf << 1) | ||
| 117 | #define PL080_CONFIG_SRC_SEL_SHIFT (1) | ||
| 118 | #define PL080_CONFIG_ENABLE (1 << 0) | ||
| 119 | |||
| 120 | #define PL080_FLOW_MEM2MEM (0x0) | ||
| 121 | #define PL080_FLOW_MEM2PER (0x1) | ||
| 122 | #define PL080_FLOW_PER2MEM (0x2) | ||
| 123 | #define PL080_FLOW_SRC2DST (0x3) | ||
| 124 | #define PL080_FLOW_SRC2DST_DST (0x4) | ||
| 125 | #define PL080_FLOW_MEM2PER_PER (0x5) | ||
| 126 | #define PL080_FLOW_PER2MEM_PER (0x6) | ||
| 127 | #define PL080_FLOW_SRC2DST_SRC (0x7) | ||
| 128 | |||
| 129 | /* DMA linked list chain structure */ | ||
| 130 | |||
| 131 | struct pl080_lli { | ||
| 132 | u32 src_addr; | ||
| 133 | u32 dst_addr; | ||
| 134 | u32 next_lli; | ||
| 135 | u32 control0; | ||
| 136 | }; | ||
| 137 | |||
| 138 | struct pl080s_lli { | ||
| 139 | u32 src_addr; | ||
| 140 | u32 dst_addr; | ||
| 141 | u32 next_lli; | ||
| 142 | u32 control0; | ||
| 143 | u32 control1; | ||
| 144 | }; | ||
| 145 | |||
| 146 | #endif /* ASM_PL080_H */ | ||
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h index d3201e438d16..f5939999cb65 100644 --- a/include/linux/dmaengine.h +++ b/include/linux/dmaengine.h | |||
| @@ -608,7 +608,10 @@ static inline int dmaengine_device_control(struct dma_chan *chan, | |||
| 608 | enum dma_ctrl_cmd cmd, | 608 | enum dma_ctrl_cmd cmd, |
| 609 | unsigned long arg) | 609 | unsigned long arg) |
| 610 | { | 610 | { |
| 611 | return chan->device->device_control(chan, cmd, arg); | 611 | if (chan->device->device_control) |
| 612 | return chan->device->device_control(chan, cmd, arg); | ||
| 613 | |||
| 614 | return -ENOSYS; | ||
| 612 | } | 615 | } |
| 613 | 616 | ||
| 614 | static inline int dmaengine_slave_config(struct dma_chan *chan, | 617 | static inline int dmaengine_slave_config(struct dma_chan *chan, |
| @@ -618,6 +621,11 @@ static inline int dmaengine_slave_config(struct dma_chan *chan, | |||
| 618 | (unsigned long)config); | 621 | (unsigned long)config); |
| 619 | } | 622 | } |
| 620 | 623 | ||
| 624 | static inline bool is_slave_direction(enum dma_transfer_direction direction) | ||
| 625 | { | ||
| 626 | return (direction == DMA_MEM_TO_DEV) || (direction == DMA_DEV_TO_MEM); | ||
| 627 | } | ||
| 628 | |||
| 621 | static inline struct dma_async_tx_descriptor *dmaengine_prep_slave_single( | 629 | static inline struct dma_async_tx_descriptor *dmaengine_prep_slave_single( |
| 622 | struct dma_chan *chan, dma_addr_t buf, size_t len, | 630 | struct dma_chan *chan, dma_addr_t buf, size_t len, |
| 623 | enum dma_transfer_direction dir, unsigned long flags) | 631 | enum dma_transfer_direction dir, unsigned long flags) |
| @@ -660,6 +668,13 @@ static inline struct dma_async_tx_descriptor *dmaengine_prep_dma_cyclic( | |||
| 660 | period_len, dir, flags, NULL); | 668 | period_len, dir, flags, NULL); |
| 661 | } | 669 | } |
| 662 | 670 | ||
| 671 | static inline struct dma_async_tx_descriptor *dmaengine_prep_interleaved_dma( | ||
| 672 | struct dma_chan *chan, struct dma_interleaved_template *xt, | ||
| 673 | unsigned long flags) | ||
| 674 | { | ||
| 675 | return chan->device->device_prep_interleaved_dma(chan, xt, flags); | ||
| 676 | } | ||
| 677 | |||
| 663 | static inline int dmaengine_terminate_all(struct dma_chan *chan) | 678 | static inline int dmaengine_terminate_all(struct dma_chan *chan) |
| 664 | { | 679 | { |
| 665 | return dmaengine_device_control(chan, DMA_TERMINATE_ALL, 0); | 680 | return dmaengine_device_control(chan, DMA_TERMINATE_ALL, 0); |
| @@ -849,20 +864,6 @@ static inline bool async_tx_test_ack(struct dma_async_tx_descriptor *tx) | |||
| 849 | return (tx->flags & DMA_CTRL_ACK) == DMA_CTRL_ACK; | 864 | return (tx->flags & DMA_CTRL_ACK) == DMA_CTRL_ACK; |
| 850 | } | 865 | } |
| 851 | 866 | ||
| 852 | #define first_dma_cap(mask) __first_dma_cap(&(mask)) | ||
| 853 | static inline int __first_dma_cap(const dma_cap_mask_t *srcp) | ||
| 854 | { | ||
| 855 | return min_t(int, DMA_TX_TYPE_END, | ||
| 856 | find_first_bit(srcp->bits, DMA_TX_TYPE_END)); | ||
| 857 | } | ||
| 858 | |||
| 859 | #define next_dma_cap(n, mask) __next_dma_cap((n), &(mask)) | ||
| 860 | static inline int __next_dma_cap(int n, const dma_cap_mask_t *srcp) | ||
| 861 | { | ||
| 862 | return min_t(int, DMA_TX_TYPE_END, | ||
| 863 | find_next_bit(srcp->bits, DMA_TX_TYPE_END, n+1)); | ||
| 864 | } | ||
| 865 | |||
| 866 | #define dma_cap_set(tx, mask) __dma_cap_set((tx), &(mask)) | 867 | #define dma_cap_set(tx, mask) __dma_cap_set((tx), &(mask)) |
| 867 | static inline void | 868 | static inline void |
| 868 | __dma_cap_set(enum dma_transaction_type tx_type, dma_cap_mask_t *dstp) | 869 | __dma_cap_set(enum dma_transaction_type tx_type, dma_cap_mask_t *dstp) |
| @@ -891,9 +892,7 @@ __dma_has_cap(enum dma_transaction_type tx_type, dma_cap_mask_t *srcp) | |||
| 891 | } | 892 | } |
| 892 | 893 | ||
| 893 | #define for_each_dma_cap_mask(cap, mask) \ | 894 | #define for_each_dma_cap_mask(cap, mask) \ |
| 894 | for ((cap) = first_dma_cap(mask); \ | 895 | for_each_set_bit(cap, mask.bits, DMA_TX_TYPE_END) |
| 895 | (cap) < DMA_TX_TYPE_END; \ | ||
| 896 | (cap) = next_dma_cap((cap), (mask))) | ||
| 897 | 896 | ||
| 898 | /** | 897 | /** |
| 899 | * dma_async_issue_pending - flush pending transactions to HW | 898 | * dma_async_issue_pending - flush pending transactions to HW |
| @@ -907,8 +906,6 @@ static inline void dma_async_issue_pending(struct dma_chan *chan) | |||
| 907 | chan->device->device_issue_pending(chan); | 906 | chan->device->device_issue_pending(chan); |
| 908 | } | 907 | } |
| 909 | 908 | ||
| 910 | #define dma_async_memcpy_issue_pending(chan) dma_async_issue_pending(chan) | ||
| 911 | |||
| 912 | /** | 909 | /** |
| 913 | * dma_async_is_tx_complete - poll for transaction completion | 910 | * dma_async_is_tx_complete - poll for transaction completion |
| 914 | * @chan: DMA channel | 911 | * @chan: DMA channel |
| @@ -934,16 +931,13 @@ static inline enum dma_status dma_async_is_tx_complete(struct dma_chan *chan, | |||
| 934 | return status; | 931 | return status; |
| 935 | } | 932 | } |
| 936 | 933 | ||
| 937 | #define dma_async_memcpy_complete(chan, cookie, last, used)\ | ||
| 938 | dma_async_is_tx_complete(chan, cookie, last, used) | ||
| 939 | |||
| 940 | /** | 934 | /** |
| 941 | * dma_async_is_complete - test a cookie against chan state | 935 | * dma_async_is_complete - test a cookie against chan state |
| 942 | * @cookie: transaction identifier to test status of | 936 | * @cookie: transaction identifier to test status of |
| 943 | * @last_complete: last know completed transaction | 937 | * @last_complete: last know completed transaction |
| 944 | * @last_used: last cookie value handed out | 938 | * @last_used: last cookie value handed out |
| 945 | * | 939 | * |
| 946 | * dma_async_is_complete() is used in dma_async_memcpy_complete() | 940 | * dma_async_is_complete() is used in dma_async_is_tx_complete() |
| 947 | * the test logic is separated for lightweight testing of multiple cookies | 941 | * the test logic is separated for lightweight testing of multiple cookies |
| 948 | */ | 942 | */ |
| 949 | static inline enum dma_status dma_async_is_complete(dma_cookie_t cookie, | 943 | static inline enum dma_status dma_async_is_complete(dma_cookie_t cookie, |
| @@ -974,6 +968,7 @@ enum dma_status dma_sync_wait(struct dma_chan *chan, dma_cookie_t cookie); | |||
| 974 | enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx); | 968 | enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx); |
| 975 | void dma_issue_pending_all(void); | 969 | void dma_issue_pending_all(void); |
| 976 | struct dma_chan *__dma_request_channel(dma_cap_mask_t *mask, dma_filter_fn fn, void *fn_param); | 970 | struct dma_chan *__dma_request_channel(dma_cap_mask_t *mask, dma_filter_fn fn, void *fn_param); |
| 971 | struct dma_chan *dma_request_slave_channel(struct device *dev, char *name); | ||
| 977 | void dma_release_channel(struct dma_chan *chan); | 972 | void dma_release_channel(struct dma_chan *chan); |
| 978 | #else | 973 | #else |
| 979 | static inline enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx) | 974 | static inline enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx) |
| @@ -988,6 +983,11 @@ static inline struct dma_chan *__dma_request_channel(dma_cap_mask_t *mask, | |||
| 988 | { | 983 | { |
| 989 | return NULL; | 984 | return NULL; |
| 990 | } | 985 | } |
| 986 | static inline struct dma_chan *dma_request_slave_channel(struct device *dev, | ||
| 987 | char *name) | ||
| 988 | { | ||
| 989 | return NULL; | ||
| 990 | } | ||
| 991 | static inline void dma_release_channel(struct dma_chan *chan) | 991 | static inline void dma_release_channel(struct dma_chan *chan) |
| 992 | { | 992 | { |
| 993 | } | 993 | } |
diff --git a/include/linux/dw_dmac.h b/include/linux/dw_dmac.h index e1c8c9e919ac..41766de66e33 100644 --- a/include/linux/dw_dmac.h +++ b/include/linux/dw_dmac.h | |||
| @@ -15,14 +15,38 @@ | |||
| 15 | #include <linux/dmaengine.h> | 15 | #include <linux/dmaengine.h> |
| 16 | 16 | ||
| 17 | /** | 17 | /** |
| 18 | * struct dw_dma_slave - Controller-specific information about a slave | ||
| 19 | * | ||
| 20 | * @dma_dev: required DMA master device. Depricated. | ||
| 21 | * @bus_id: name of this device channel, not just a device name since | ||
| 22 | * devices may have more than one channel e.g. "foo_tx" | ||
| 23 | * @cfg_hi: Platform-specific initializer for the CFG_HI register | ||
| 24 | * @cfg_lo: Platform-specific initializer for the CFG_LO register | ||
| 25 | * @src_master: src master for transfers on allocated channel. | ||
| 26 | * @dst_master: dest master for transfers on allocated channel. | ||
| 27 | */ | ||
| 28 | struct dw_dma_slave { | ||
| 29 | struct device *dma_dev; | ||
| 30 | const char *bus_id; | ||
| 31 | u32 cfg_hi; | ||
| 32 | u32 cfg_lo; | ||
| 33 | u8 src_master; | ||
| 34 | u8 dst_master; | ||
| 35 | }; | ||
| 36 | |||
| 37 | /** | ||
| 18 | * struct dw_dma_platform_data - Controller configuration parameters | 38 | * struct dw_dma_platform_data - Controller configuration parameters |
| 19 | * @nr_channels: Number of channels supported by hardware (max 8) | 39 | * @nr_channels: Number of channels supported by hardware (max 8) |
| 20 | * @is_private: The device channels should be marked as private and not for | 40 | * @is_private: The device channels should be marked as private and not for |
| 21 | * by the general purpose DMA channel allocator. | 41 | * by the general purpose DMA channel allocator. |
| 42 | * @chan_allocation_order: Allocate channels starting from 0 or 7 | ||
| 43 | * @chan_priority: Set channel priority increasing from 0 to 7 or 7 to 0. | ||
| 22 | * @block_size: Maximum block size supported by the controller | 44 | * @block_size: Maximum block size supported by the controller |
| 23 | * @nr_masters: Number of AHB masters supported by the controller | 45 | * @nr_masters: Number of AHB masters supported by the controller |
| 24 | * @data_width: Maximum data width supported by hardware per AHB master | 46 | * @data_width: Maximum data width supported by hardware per AHB master |
| 25 | * (0 - 8bits, 1 - 16bits, ..., 5 - 256bits) | 47 | * (0 - 8bits, 1 - 16bits, ..., 5 - 256bits) |
| 48 | * @sd: slave specific data. Used for configuring channels | ||
| 49 | * @sd_count: count of slave data structures passed. | ||
| 26 | */ | 50 | */ |
| 27 | struct dw_dma_platform_data { | 51 | struct dw_dma_platform_data { |
| 28 | unsigned int nr_channels; | 52 | unsigned int nr_channels; |
| @@ -36,6 +60,9 @@ struct dw_dma_platform_data { | |||
| 36 | unsigned short block_size; | 60 | unsigned short block_size; |
| 37 | unsigned char nr_masters; | 61 | unsigned char nr_masters; |
| 38 | unsigned char data_width[4]; | 62 | unsigned char data_width[4]; |
| 63 | |||
| 64 | struct dw_dma_slave *sd; | ||
| 65 | unsigned int sd_count; | ||
| 39 | }; | 66 | }; |
| 40 | 67 | ||
| 41 | /* bursts size */ | 68 | /* bursts size */ |
| @@ -50,23 +77,6 @@ enum dw_dma_msize { | |||
| 50 | DW_DMA_MSIZE_256, | 77 | DW_DMA_MSIZE_256, |
| 51 | }; | 78 | }; |
| 52 | 79 | ||
| 53 | /** | ||
| 54 | * struct dw_dma_slave - Controller-specific information about a slave | ||
| 55 | * | ||
| 56 | * @dma_dev: required DMA master device | ||
| 57 | * @cfg_hi: Platform-specific initializer for the CFG_HI register | ||
| 58 | * @cfg_lo: Platform-specific initializer for the CFG_LO register | ||
| 59 | * @src_master: src master for transfers on allocated channel. | ||
| 60 | * @dst_master: dest master for transfers on allocated channel. | ||
| 61 | */ | ||
| 62 | struct dw_dma_slave { | ||
| 63 | struct device *dma_dev; | ||
| 64 | u32 cfg_hi; | ||
| 65 | u32 cfg_lo; | ||
| 66 | u8 src_master; | ||
| 67 | u8 dst_master; | ||
| 68 | }; | ||
| 69 | |||
| 70 | /* Platform-configurable bits in CFG_HI */ | 80 | /* Platform-configurable bits in CFG_HI */ |
| 71 | #define DWC_CFGH_FCMODE (1 << 0) | 81 | #define DWC_CFGH_FCMODE (1 << 0) |
| 72 | #define DWC_CFGH_FIFO_MODE (1 << 1) | 82 | #define DWC_CFGH_FIFO_MODE (1 << 1) |
| @@ -104,5 +114,6 @@ void dw_dma_cyclic_stop(struct dma_chan *chan); | |||
| 104 | dma_addr_t dw_dma_get_src_addr(struct dma_chan *chan); | 114 | dma_addr_t dw_dma_get_src_addr(struct dma_chan *chan); |
| 105 | 115 | ||
| 106 | dma_addr_t dw_dma_get_dst_addr(struct dma_chan *chan); | 116 | dma_addr_t dw_dma_get_dst_addr(struct dma_chan *chan); |
| 117 | bool dw_dma_generic_filter(struct dma_chan *chan, void *param); | ||
| 107 | 118 | ||
| 108 | #endif /* DW_DMAC_H */ | 119 | #endif /* DW_DMAC_H */ |
diff --git a/include/linux/of_dma.h b/include/linux/of_dma.h new file mode 100644 index 000000000000..d15073e080dd --- /dev/null +++ b/include/linux/of_dma.h | |||
| @@ -0,0 +1,74 @@ | |||
| 1 | /* | ||
| 2 | * OF helpers for DMA request / controller | ||
| 3 | * | ||
| 4 | * Based on of_gpio.h | ||
| 5 | * | ||
| 6 | * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/ | ||
| 7 | * | ||
| 8 | * This program is free software; you can redistribute it and/or modify | ||
| 9 | * it under the terms of the GNU General Public License version 2 as | ||
| 10 | * published by the Free Software Foundation. | ||
| 11 | */ | ||
| 12 | |||
| 13 | #ifndef __LINUX_OF_DMA_H | ||
| 14 | #define __LINUX_OF_DMA_H | ||
| 15 | |||
| 16 | #include <linux/of.h> | ||
| 17 | #include <linux/dmaengine.h> | ||
| 18 | |||
| 19 | struct device_node; | ||
| 20 | |||
| 21 | struct of_dma { | ||
| 22 | struct list_head of_dma_controllers; | ||
| 23 | struct device_node *of_node; | ||
| 24 | int of_dma_nbcells; | ||
| 25 | struct dma_chan *(*of_dma_xlate) | ||
| 26 | (struct of_phandle_args *, struct of_dma *); | ||
| 27 | void *of_dma_data; | ||
| 28 | int use_count; | ||
| 29 | }; | ||
| 30 | |||
| 31 | struct of_dma_filter_info { | ||
| 32 | dma_cap_mask_t dma_cap; | ||
| 33 | dma_filter_fn filter_fn; | ||
| 34 | }; | ||
| 35 | |||
| 36 | #ifdef CONFIG_OF | ||
| 37 | extern int of_dma_controller_register(struct device_node *np, | ||
| 38 | struct dma_chan *(*of_dma_xlate) | ||
| 39 | (struct of_phandle_args *, struct of_dma *), | ||
| 40 | void *data); | ||
| 41 | extern int of_dma_controller_free(struct device_node *np); | ||
| 42 | extern struct dma_chan *of_dma_request_slave_channel(struct device_node *np, | ||
| 43 | char *name); | ||
| 44 | extern struct dma_chan *of_dma_simple_xlate(struct of_phandle_args *dma_spec, | ||
| 45 | struct of_dma *ofdma); | ||
| 46 | #else | ||
| 47 | static inline int of_dma_controller_register(struct device_node *np, | ||
| 48 | struct dma_chan *(*of_dma_xlate) | ||
| 49 | (struct of_phandle_args *, struct of_dma *), | ||
| 50 | void *data) | ||
| 51 | { | ||
| 52 | return -ENODEV; | ||
| 53 | } | ||
| 54 | |||
| 55 | static inline int of_dma_controller_free(struct device_node *np) | ||
| 56 | { | ||
| 57 | return -ENODEV; | ||
| 58 | } | ||
| 59 | |||
| 60 | static inline struct dma_chan *of_dma_request_slave_channel(struct device_node *np, | ||
| 61 | char *name) | ||
| 62 | { | ||
| 63 | return NULL; | ||
| 64 | } | ||
| 65 | |||
| 66 | static inline struct dma_chan *of_dma_simple_xlate(struct of_phandle_args *dma_spec, | ||
| 67 | struct of_dma *ofdma) | ||
| 68 | { | ||
| 69 | return NULL; | ||
| 70 | } | ||
| 71 | |||
| 72 | #endif | ||
| 73 | |||
| 74 | #endif /* __LINUX_OF_DMA_H */ | ||
diff --git a/include/linux/platform_data/dma-ste-dma40.h b/include/linux/platform_data/dma-ste-dma40.h index 9ff93b065686..4b781014b0a0 100644 --- a/include/linux/platform_data/dma-ste-dma40.h +++ b/include/linux/platform_data/dma-ste-dma40.h | |||
| @@ -147,6 +147,16 @@ struct stedma40_chan_cfg { | |||
| 147 | * @memcpy_conf_log: default configuration of logical channel memcpy | 147 | * @memcpy_conf_log: default configuration of logical channel memcpy |
| 148 | * @disabled_channels: A vector, ending with -1, that marks physical channels | 148 | * @disabled_channels: A vector, ending with -1, that marks physical channels |
| 149 | * that are for different reasons not available for the driver. | 149 | * that are for different reasons not available for the driver. |
| 150 | * @soft_lli_chans: A vector, that marks physical channels will use LLI by SW | ||
| 151 | * which avoids HW bug that exists in some versions of the controller. | ||
| 152 | * SoftLLI introduces relink overhead that could impact performace for | ||
| 153 | * certain use cases. | ||
| 154 | * @num_of_soft_lli_chans: The number of channels that needs to be configured | ||
| 155 | * to use SoftLLI. | ||
| 156 | * @use_esram_lcla: flag for mapping the lcla into esram region | ||
| 157 | * @num_of_phy_chans: The number of physical channels implemented in HW. | ||
| 158 | * 0 means reading the number of channels from DMA HW but this is only valid | ||
| 159 | * for 'multiple of 4' channels, like 8. | ||
| 150 | */ | 160 | */ |
| 151 | struct stedma40_platform_data { | 161 | struct stedma40_platform_data { |
| 152 | u32 dev_len; | 162 | u32 dev_len; |
| @@ -157,7 +167,10 @@ struct stedma40_platform_data { | |||
| 157 | struct stedma40_chan_cfg *memcpy_conf_phy; | 167 | struct stedma40_chan_cfg *memcpy_conf_phy; |
| 158 | struct stedma40_chan_cfg *memcpy_conf_log; | 168 | struct stedma40_chan_cfg *memcpy_conf_log; |
| 159 | int disabled_channels[STEDMA40_MAX_PHYS]; | 169 | int disabled_channels[STEDMA40_MAX_PHYS]; |
| 170 | int *soft_lli_chans; | ||
| 171 | int num_of_soft_lli_chans; | ||
| 160 | bool use_esram_lcla; | 172 | bool use_esram_lcla; |
| 173 | int num_of_phy_chans; | ||
| 161 | }; | 174 | }; |
| 162 | 175 | ||
| 163 | #ifdef CONFIG_STE_DMA40 | 176 | #ifdef CONFIG_STE_DMA40 |
