aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/devicetree/bindings/dma/snps-dma.txt4
-rw-r--r--MAINTAINERS4
-rw-r--r--drivers/dma/dw/core.c2
-rw-r--r--drivers/dma/dw/platform.c6
-rw-r--r--drivers/dma/dw/regs.h4
-rw-r--r--include/dt-bindings/dma/dw-dmac.h14
-rw-r--r--include/linux/platform_data/dma-dw.h6
7 files changed, 39 insertions, 1 deletions
diff --git a/Documentation/devicetree/bindings/dma/snps-dma.txt b/Documentation/devicetree/bindings/dma/snps-dma.txt
index 39e2b26be344..db757df7057d 100644
--- a/Documentation/devicetree/bindings/dma/snps-dma.txt
+++ b/Documentation/devicetree/bindings/dma/snps-dma.txt
@@ -27,6 +27,10 @@ Optional properties:
27 general purpose DMA channel allocator. False if not passed. 27 general purpose DMA channel allocator. False if not passed.
28- multi-block: Multi block transfers supported by hardware. Array property with 28- multi-block: Multi block transfers supported by hardware. Array property with
29 one cell per channel. 0: not supported, 1 (default): supported. 29 one cell per channel. 0: not supported, 1 (default): supported.
30- snps,dma-protection-control: AHB HPROT[3:1] protection setting.
31 The default value is 0 (for non-cacheable, non-buffered,
32 unprivileged data access).
33 Refer to include/dt-bindings/dma/dw-dmac.h for possible values.
30 34
31Example: 35Example:
32 36
diff --git a/MAINTAINERS b/MAINTAINERS
index f4855974f325..dc041fe9b3af 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -14363,9 +14363,11 @@ SYNOPSYS DESIGNWARE DMAC DRIVER
14363M: Viresh Kumar <vireshk@kernel.org> 14363M: Viresh Kumar <vireshk@kernel.org>
14364R: Andy Shevchenko <andriy.shevchenko@linux.intel.com> 14364R: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
14365S: Maintained 14365S: Maintained
14366F: Documentation/devicetree/bindings/dma/snps-dma.txt
14367F: drivers/dma/dw/
14368F: include/dt-bindings/dma/dw-dmac.h
14366F: include/linux/dma/dw.h 14369F: include/linux/dma/dw.h
14367F: include/linux/platform_data/dma-dw.h 14370F: include/linux/platform_data/dma-dw.h
14368F: drivers/dma/dw/
14369 14371
14370SYNOPSYS DESIGNWARE ENTERPRISE ETHERNET DRIVER 14372SYNOPSYS DESIGNWARE ENTERPRISE ETHERNET DRIVER
14371M: Jose Abreu <Jose.Abreu@synopsys.com> 14373M: Jose Abreu <Jose.Abreu@synopsys.com>
diff --git a/drivers/dma/dw/core.c b/drivers/dma/dw/core.c
index d0c3e50b39fb..2c5ca1961256 100644
--- a/drivers/dma/dw/core.c
+++ b/drivers/dma/dw/core.c
@@ -160,12 +160,14 @@ static void dwc_initialize_chan_idma32(struct dw_dma_chan *dwc)
160 160
161static void dwc_initialize_chan_dw(struct dw_dma_chan *dwc) 161static void dwc_initialize_chan_dw(struct dw_dma_chan *dwc)
162{ 162{
163 struct dw_dma *dw = to_dw_dma(dwc->chan.device);
163 u32 cfghi = DWC_CFGH_FIFO_MODE; 164 u32 cfghi = DWC_CFGH_FIFO_MODE;
164 u32 cfglo = DWC_CFGL_CH_PRIOR(dwc->priority); 165 u32 cfglo = DWC_CFGL_CH_PRIOR(dwc->priority);
165 bool hs_polarity = dwc->dws.hs_polarity; 166 bool hs_polarity = dwc->dws.hs_polarity;
166 167
167 cfghi |= DWC_CFGH_DST_PER(dwc->dws.dst_id); 168 cfghi |= DWC_CFGH_DST_PER(dwc->dws.dst_id);
168 cfghi |= DWC_CFGH_SRC_PER(dwc->dws.src_id); 169 cfghi |= DWC_CFGH_SRC_PER(dwc->dws.src_id);
170 cfghi |= DWC_CFGH_PROTCTL(dw->pdata->protctl);
169 171
170 /* Set polarity of handshake interface */ 172 /* Set polarity of handshake interface */
171 cfglo |= hs_polarity ? DWC_CFGL_HS_DST_POL | DWC_CFGL_HS_SRC_POL : 0; 173 cfglo |= hs_polarity ? DWC_CFGL_HS_DST_POL | DWC_CFGL_HS_SRC_POL : 0;
diff --git a/drivers/dma/dw/platform.c b/drivers/dma/dw/platform.c
index f01b2c173fa6..31ff8113c3de 100644
--- a/drivers/dma/dw/platform.c
+++ b/drivers/dma/dw/platform.c
@@ -162,6 +162,12 @@ dw_dma_parse_dt(struct platform_device *pdev)
162 pdata->multi_block[tmp] = 1; 162 pdata->multi_block[tmp] = 1;
163 } 163 }
164 164
165 if (!of_property_read_u32(np, "snps,dma-protection-control", &tmp)) {
166 if (tmp > CHAN_PROTCTL_MASK)
167 return NULL;
168 pdata->protctl = tmp;
169 }
170
165 return pdata; 171 return pdata;
166} 172}
167#else 173#else
diff --git a/drivers/dma/dw/regs.h b/drivers/dma/dw/regs.h
index 09e7dfdbb790..646c9c960c07 100644
--- a/drivers/dma/dw/regs.h
+++ b/drivers/dma/dw/regs.h
@@ -200,6 +200,10 @@ enum dw_dma_msize {
200#define DWC_CFGH_FCMODE (1 << 0) 200#define DWC_CFGH_FCMODE (1 << 0)
201#define DWC_CFGH_FIFO_MODE (1 << 1) 201#define DWC_CFGH_FIFO_MODE (1 << 1)
202#define DWC_CFGH_PROTCTL(x) ((x) << 2) 202#define DWC_CFGH_PROTCTL(x) ((x) << 2)
203#define DWC_CFGH_PROTCTL_DATA (0 << 2) /* data access - always set */
204#define DWC_CFGH_PROTCTL_PRIV (1 << 2) /* privileged -> AHB HPROT[1] */
205#define DWC_CFGH_PROTCTL_BUFFER (2 << 2) /* bufferable -> AHB HPROT[2] */
206#define DWC_CFGH_PROTCTL_CACHE (4 << 2) /* cacheable -> AHB HPROT[3] */
203#define DWC_CFGH_DS_UPD_EN (1 << 5) 207#define DWC_CFGH_DS_UPD_EN (1 << 5)
204#define DWC_CFGH_SS_UPD_EN (1 << 6) 208#define DWC_CFGH_SS_UPD_EN (1 << 6)
205#define DWC_CFGH_SRC_PER(x) ((x) << 7) 209#define DWC_CFGH_SRC_PER(x) ((x) << 7)
diff --git a/include/dt-bindings/dma/dw-dmac.h b/include/dt-bindings/dma/dw-dmac.h
new file mode 100644
index 000000000000..d1ca705c95b3
--- /dev/null
+++ b/include/dt-bindings/dma/dw-dmac.h
@@ -0,0 +1,14 @@
1/* SPDX-License-Identifier: (GPL-2.0 OR MIT) */
2
3#ifndef __DT_BINDINGS_DMA_DW_DMAC_H__
4#define __DT_BINDINGS_DMA_DW_DMAC_H__
5
6/*
7 * Protection Control bits provide protection against illegal transactions.
8 * The protection bits[0:2] are one-to-one mapped to AHB HPROT[3:1] signals.
9 */
10#define DW_DMAC_HPROT1_PRIVILEGED_MODE (1 << 0) /* Privileged Mode */
11#define DW_DMAC_HPROT2_BUFFERABLE (1 << 1) /* DMA is bufferable */
12#define DW_DMAC_HPROT3_CACHEABLE (1 << 2) /* DMA is cacheable */
13
14#endif /* __DT_BINDINGS_DMA_DW_DMAC_H__ */
diff --git a/include/linux/platform_data/dma-dw.h b/include/linux/platform_data/dma-dw.h
index 896cb71a382c..1a1d58ebffbf 100644
--- a/include/linux/platform_data/dma-dw.h
+++ b/include/linux/platform_data/dma-dw.h
@@ -49,6 +49,7 @@ struct dw_dma_slave {
49 * @data_width: Maximum data width supported by hardware per AHB master 49 * @data_width: Maximum data width supported by hardware per AHB master
50 * (in bytes, power of 2) 50 * (in bytes, power of 2)
51 * @multi_block: Multi block transfers supported by hardware per channel. 51 * @multi_block: Multi block transfers supported by hardware per channel.
52 * @protctl: Protection control signals setting per channel.
52 */ 53 */
53struct dw_dma_platform_data { 54struct dw_dma_platform_data {
54 unsigned int nr_channels; 55 unsigned int nr_channels;
@@ -65,6 +66,11 @@ struct dw_dma_platform_data {
65 unsigned char nr_masters; 66 unsigned char nr_masters;
66 unsigned char data_width[DW_DMA_MAX_NR_MASTERS]; 67 unsigned char data_width[DW_DMA_MAX_NR_MASTERS];
67 unsigned char multi_block[DW_DMA_MAX_NR_CHANNELS]; 68 unsigned char multi_block[DW_DMA_MAX_NR_CHANNELS];
69#define CHAN_PROTCTL_PRIVILEGED BIT(0)
70#define CHAN_PROTCTL_BUFFERABLE BIT(1)
71#define CHAN_PROTCTL_CACHEABLE BIT(2)
72#define CHAN_PROTCTL_MASK GENMASK(2, 0)
73 unsigned char protctl;
68}; 74};
69 75
70#endif /* _PLATFORM_DATA_DMA_DW_H */ 76#endif /* _PLATFORM_DATA_DMA_DW_H */