aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLee Jones <lee.jones@linaro.org>2013-05-15 05:51:25 -0400
committerLinus Walleij <linus.walleij@linaro.org>2013-05-23 15:13:19 -0400
commit57e65ad77fef1b026f5bdf1cd417bb6346b24fdf (patch)
treec7683a8e0c9464bedd0cdea1d03c54a610e9c4e1
parent9778256b9810d2c758a7537a43825b7d81b5765f (diff)
dmaengine: ste_dma40: Remove unnecessary call to d40_phy_cfg()
The majority of configuration done in d40_phy_config() pertains to physical channels. Move the call over to runtime config which has different code paths for physical and logical channels already, and make it an exclusive physical channel config function as the name implies, and drop the is_log argument. Since we moved the call to runtime_config() it only gets called for device transfers, so encode the small snippet of configuration pertaining to memcpy channels into the d40_config_memcpy() function. Acked-by: Vinod Koul <vinod.koul@intel.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Lee Jones <lee.jones@linaro.org> [rewrote the commit message] Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r--drivers/dma/ste_dma40.c14
-rw-r--r--drivers/dma/ste_dma40_ll.c101
-rw-r--r--drivers/dma/ste_dma40_ll.h3
3 files changed, 58 insertions, 60 deletions
diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
index 759293e4a1cc..b7fe46bd6a8e 100644
--- a/drivers/dma/ste_dma40.c
+++ b/drivers/dma/ste_dma40.c
@@ -2043,6 +2043,14 @@ static int d40_config_memcpy(struct d40_chan *d40c)
2043 } else if (dma_has_cap(DMA_MEMCPY, cap) && 2043 } else if (dma_has_cap(DMA_MEMCPY, cap) &&
2044 dma_has_cap(DMA_SLAVE, cap)) { 2044 dma_has_cap(DMA_SLAVE, cap)) {
2045 d40c->dma_cfg = dma40_memcpy_conf_phy; 2045 d40c->dma_cfg = dma40_memcpy_conf_phy;
2046
2047 /* Generate interrrupt at end of transfer or relink. */
2048 d40c->dst_def_cfg |= BIT(D40_SREG_CFG_TIM_POS);
2049
2050 /* Generate interrupt on error. */
2051 d40c->src_def_cfg |= BIT(D40_SREG_CFG_EIM_POS);
2052 d40c->dst_def_cfg |= BIT(D40_SREG_CFG_EIM_POS);
2053
2046 } else { 2054 } else {
2047 chan_err(d40c, "No memcpy\n"); 2055 chan_err(d40c, "No memcpy\n");
2048 return -EINVAL; 2056 return -EINVAL;
@@ -2496,9 +2504,6 @@ static int d40_alloc_chan_resources(struct dma_chan *chan)
2496 } 2504 }
2497 2505
2498 pm_runtime_get_sync(d40c->base->dev); 2506 pm_runtime_get_sync(d40c->base->dev);
2499 /* Fill in basic CFG register values */
2500 d40_phy_cfg(&d40c->dma_cfg, &d40c->src_def_cfg,
2501 &d40c->dst_def_cfg, chan_is_logical(d40c));
2502 2507
2503 d40_set_prio_realtime(d40c); 2508 d40_set_prio_realtime(d40c);
2504 2509
@@ -2862,8 +2867,7 @@ static int d40_set_runtime_config(struct dma_chan *chan,
2862 if (chan_is_logical(d40c)) 2867 if (chan_is_logical(d40c))
2863 d40_log_cfg(cfg, &d40c->log_def.lcsp1, &d40c->log_def.lcsp3); 2868 d40_log_cfg(cfg, &d40c->log_def.lcsp1, &d40c->log_def.lcsp3);
2864 else 2869 else
2865 d40_phy_cfg(cfg, &d40c->src_def_cfg, 2870 d40_phy_cfg(cfg, &d40c->src_def_cfg, &d40c->dst_def_cfg);
2866 &d40c->dst_def_cfg, false);
2867 2871
2868 /* These settings will take precedence later */ 2872 /* These settings will take precedence later */
2869 d40c->runtime_addr = config_addr; 2873 d40c->runtime_addr = config_addr;
diff --git a/drivers/dma/ste_dma40_ll.c b/drivers/dma/ste_dma40_ll.c
index 435a223c891f..ab5a2a706f7a 100644
--- a/drivers/dma/ste_dma40_ll.c
+++ b/drivers/dma/ste_dma40_ll.c
@@ -50,63 +50,58 @@ void d40_log_cfg(struct stedma40_chan_cfg *cfg,
50 50
51} 51}
52 52
53/* Sets up SRC and DST CFG register for both logical and physical channels */ 53void d40_phy_cfg(struct stedma40_chan_cfg *cfg, u32 *src_cfg, u32 *dst_cfg)
54void d40_phy_cfg(struct stedma40_chan_cfg *cfg,
55 u32 *src_cfg, u32 *dst_cfg, bool is_log)
56{ 54{
57 u32 src = 0; 55 u32 src = 0;
58 u32 dst = 0; 56 u32 dst = 0;
59 57
60 if (!is_log) { 58 if ((cfg->dir == STEDMA40_PERIPH_TO_MEM) ||
61 /* Physical channel */ 59 (cfg->dir == STEDMA40_PERIPH_TO_PERIPH)) {
62 if ((cfg->dir == STEDMA40_PERIPH_TO_MEM) || 60 /* Set master port to 1 */
63 (cfg->dir == STEDMA40_PERIPH_TO_PERIPH)) { 61 src |= 1 << D40_SREG_CFG_MST_POS;
64 /* Set master port to 1 */ 62 src |= D40_TYPE_TO_EVENT(cfg->dev_type);
65 src |= 1 << D40_SREG_CFG_MST_POS; 63
66 src |= D40_TYPE_TO_EVENT(cfg->dev_type); 64 if (cfg->src_info.flow_ctrl == STEDMA40_NO_FLOW_CTRL)
67 65 src |= 1 << D40_SREG_CFG_PHY_TM_POS;
68 if (cfg->src_info.flow_ctrl == STEDMA40_NO_FLOW_CTRL) 66 else
69 src |= 1 << D40_SREG_CFG_PHY_TM_POS; 67 src |= 3 << D40_SREG_CFG_PHY_TM_POS;
70 else 68 }
71 src |= 3 << D40_SREG_CFG_PHY_TM_POS; 69 if ((cfg->dir == STEDMA40_MEM_TO_PERIPH) ||
72 } 70 (cfg->dir == STEDMA40_PERIPH_TO_PERIPH)) {
73 if ((cfg->dir == STEDMA40_MEM_TO_PERIPH) || 71 /* Set master port to 1 */
74 (cfg->dir == STEDMA40_PERIPH_TO_PERIPH)) { 72 dst |= 1 << D40_SREG_CFG_MST_POS;
75 /* Set master port to 1 */ 73 dst |= D40_TYPE_TO_EVENT(cfg->dev_type);
76 dst |= 1 << D40_SREG_CFG_MST_POS; 74
77 dst |= D40_TYPE_TO_EVENT(cfg->dev_type); 75 if (cfg->dst_info.flow_ctrl == STEDMA40_NO_FLOW_CTRL)
78 76 dst |= 1 << D40_SREG_CFG_PHY_TM_POS;
79 if (cfg->dst_info.flow_ctrl == STEDMA40_NO_FLOW_CTRL) 77 else
80 dst |= 1 << D40_SREG_CFG_PHY_TM_POS; 78 dst |= 3 << D40_SREG_CFG_PHY_TM_POS;
81 else 79 }
82 dst |= 3 << D40_SREG_CFG_PHY_TM_POS; 80 /* Interrupt on end of transfer for destination */
83 } 81 dst |= 1 << D40_SREG_CFG_TIM_POS;
84 /* Interrupt on end of transfer for destination */ 82
85 dst |= 1 << D40_SREG_CFG_TIM_POS; 83 /* Generate interrupt on error */
86 84 src |= 1 << D40_SREG_CFG_EIM_POS;
87 /* Generate interrupt on error */ 85 dst |= 1 << D40_SREG_CFG_EIM_POS;
88 src |= 1 << D40_SREG_CFG_EIM_POS; 86
89 dst |= 1 << D40_SREG_CFG_EIM_POS; 87 /* PSIZE */
90 88 if (cfg->src_info.psize != STEDMA40_PSIZE_PHY_1) {
91 /* PSIZE */ 89 src |= 1 << D40_SREG_CFG_PHY_PEN_POS;
92 if (cfg->src_info.psize != STEDMA40_PSIZE_PHY_1) { 90 src |= cfg->src_info.psize << D40_SREG_CFG_PSIZE_POS;
93 src |= 1 << D40_SREG_CFG_PHY_PEN_POS; 91 }
94 src |= cfg->src_info.psize << D40_SREG_CFG_PSIZE_POS; 92 if (cfg->dst_info.psize != STEDMA40_PSIZE_PHY_1) {
95 } 93 dst |= 1 << D40_SREG_CFG_PHY_PEN_POS;
96 if (cfg->dst_info.psize != STEDMA40_PSIZE_PHY_1) { 94 dst |= cfg->dst_info.psize << D40_SREG_CFG_PSIZE_POS;
97 dst |= 1 << D40_SREG_CFG_PHY_PEN_POS; 95 }
98 dst |= cfg->dst_info.psize << D40_SREG_CFG_PSIZE_POS; 96
99 } 97 /* Element size */
100 98 src |= cfg->src_info.data_width << D40_SREG_CFG_ESIZE_POS;
101 /* Element size */ 99 dst |= cfg->dst_info.data_width << D40_SREG_CFG_ESIZE_POS;
102 src |= cfg->src_info.data_width << D40_SREG_CFG_ESIZE_POS; 100
103 dst |= cfg->dst_info.data_width << D40_SREG_CFG_ESIZE_POS; 101 /* Set the priority bit to high for the physical channel */
104 102 if (cfg->high_priority) {
105 /* Set the priority bit to high for the physical channel */ 103 src |= 1 << D40_SREG_CFG_PRI_POS;
106 if (cfg->high_priority) { 104 dst |= 1 << D40_SREG_CFG_PRI_POS;
107 src |= 1 << D40_SREG_CFG_PRI_POS;
108 dst |= 1 << D40_SREG_CFG_PRI_POS;
109 }
110 } 105 }
111 106
112 if (cfg->src_info.big_endian) 107 if (cfg->src_info.big_endian)
diff --git a/drivers/dma/ste_dma40_ll.h b/drivers/dma/ste_dma40_ll.h
index fdde8ef77542..1b47312bc574 100644
--- a/drivers/dma/ste_dma40_ll.h
+++ b/drivers/dma/ste_dma40_ll.h
@@ -432,8 +432,7 @@ enum d40_lli_flags {
432 432
433void d40_phy_cfg(struct stedma40_chan_cfg *cfg, 433void d40_phy_cfg(struct stedma40_chan_cfg *cfg,
434 u32 *src_cfg, 434 u32 *src_cfg,
435 u32 *dst_cfg, 435 u32 *dst_cfg);
436 bool is_log);
437 436
438void d40_log_cfg(struct stedma40_chan_cfg *cfg, 437void d40_log_cfg(struct stedma40_chan_cfg *cfg,
439 u32 *lcsp1, 438 u32 *lcsp1,