Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Lee Jones and committed by
Linus Walleij
57e65ad7 9778256b

+52 -54
+9 -5
drivers/dma/ste_dma40.c
··· 2043 2043 } else if (dma_has_cap(DMA_MEMCPY, cap) && 2044 2044 dma_has_cap(DMA_SLAVE, cap)) { 2045 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 2054 } else { 2047 2055 chan_err(d40c, "No memcpy\n"); 2048 2056 return -EINVAL; ··· 2504 2496 } 2505 2497 2506 2498 pm_runtime_get_sync(d40c->base->dev); 2507 - /* Fill in basic CFG register values */ 2508 - d40_phy_cfg(&d40c->dma_cfg, &d40c->src_def_cfg, 2509 - &d40c->dst_def_cfg, chan_is_logical(d40c)); 2510 2499 2511 2500 d40_set_prio_realtime(d40c); 2512 2501 ··· 2867 2862 if (chan_is_logical(d40c)) 2868 2863 d40_log_cfg(cfg, &d40c->log_def.lcsp1, &d40c->log_def.lcsp3); 2869 2864 else 2870 - d40_phy_cfg(cfg, &d40c->src_def_cfg, 2871 - &d40c->dst_def_cfg, false); 2865 + d40_phy_cfg(cfg, &d40c->src_def_cfg, &d40c->dst_def_cfg); 2872 2866 2873 2867 /* These settings will take precedence later */ 2874 2868 d40c->runtime_addr = config_addr;
+42 -47
drivers/dma/ste_dma40_ll.c
··· 50 50 51 51 } 52 52 53 - /* Sets up SRC and DST CFG register for both logical and physical channels */ 54 - void d40_phy_cfg(struct stedma40_chan_cfg *cfg, 55 - u32 *src_cfg, u32 *dst_cfg, bool is_log) 53 + void d40_phy_cfg(struct stedma40_chan_cfg *cfg, u32 *src_cfg, u32 *dst_cfg) 56 54 { 57 55 u32 src = 0; 58 56 u32 dst = 0; 59 57 60 - if (!is_log) { 61 - /* Physical channel */ 62 - if ((cfg->dir == STEDMA40_PERIPH_TO_MEM) || 63 - (cfg->dir == STEDMA40_PERIPH_TO_PERIPH)) { 64 - /* Set master port to 1 */ 65 - src |= 1 << D40_SREG_CFG_MST_POS; 66 - src |= D40_TYPE_TO_EVENT(cfg->dev_type); 58 + if ((cfg->dir == STEDMA40_PERIPH_TO_MEM) || 59 + (cfg->dir == STEDMA40_PERIPH_TO_PERIPH)) { 60 + /* Set master port to 1 */ 61 + src |= 1 << D40_SREG_CFG_MST_POS; 62 + src |= D40_TYPE_TO_EVENT(cfg->dev_type); 67 63 68 - if (cfg->src_info.flow_ctrl == STEDMA40_NO_FLOW_CTRL) 69 - src |= 1 << D40_SREG_CFG_PHY_TM_POS; 70 - else 71 - src |= 3 << D40_SREG_CFG_PHY_TM_POS; 72 - } 73 - if ((cfg->dir == STEDMA40_MEM_TO_PERIPH) || 74 - (cfg->dir == STEDMA40_PERIPH_TO_PERIPH)) { 75 - /* Set master port to 1 */ 76 - dst |= 1 << D40_SREG_CFG_MST_POS; 77 - dst |= D40_TYPE_TO_EVENT(cfg->dev_type); 64 + if (cfg->src_info.flow_ctrl == STEDMA40_NO_FLOW_CTRL) 65 + src |= 1 << D40_SREG_CFG_PHY_TM_POS; 66 + else 67 + src |= 3 << D40_SREG_CFG_PHY_TM_POS; 68 + } 69 + if ((cfg->dir == STEDMA40_MEM_TO_PERIPH) || 70 + (cfg->dir == STEDMA40_PERIPH_TO_PERIPH)) { 71 + /* Set master port to 1 */ 72 + dst |= 1 << D40_SREG_CFG_MST_POS; 73 + dst |= D40_TYPE_TO_EVENT(cfg->dev_type); 78 74 79 - if (cfg->dst_info.flow_ctrl == STEDMA40_NO_FLOW_CTRL) 80 - dst |= 1 << D40_SREG_CFG_PHY_TM_POS; 81 - else 82 - dst |= 3 << D40_SREG_CFG_PHY_TM_POS; 83 - } 84 - /* Interrupt on end of transfer for destination */ 85 - dst |= 1 << D40_SREG_CFG_TIM_POS; 75 + if (cfg->dst_info.flow_ctrl == STEDMA40_NO_FLOW_CTRL) 76 + dst |= 1 << D40_SREG_CFG_PHY_TM_POS; 77 + else 78 + dst |= 3 << D40_SREG_CFG_PHY_TM_POS; 79 + } 80 + /* Interrupt on end of transfer for destination */ 81 + dst |= 1 << D40_SREG_CFG_TIM_POS; 86 82 87 - /* Generate interrupt on error */ 88 - src |= 1 << D40_SREG_CFG_EIM_POS; 89 - dst |= 1 << D40_SREG_CFG_EIM_POS; 83 + /* Generate interrupt on error */ 84 + src |= 1 << D40_SREG_CFG_EIM_POS; 85 + dst |= 1 << D40_SREG_CFG_EIM_POS; 90 86 91 - /* PSIZE */ 92 - if (cfg->src_info.psize != STEDMA40_PSIZE_PHY_1) { 93 - src |= 1 << D40_SREG_CFG_PHY_PEN_POS; 94 - src |= cfg->src_info.psize << D40_SREG_CFG_PSIZE_POS; 95 - } 96 - if (cfg->dst_info.psize != STEDMA40_PSIZE_PHY_1) { 97 - dst |= 1 << D40_SREG_CFG_PHY_PEN_POS; 98 - dst |= cfg->dst_info.psize << D40_SREG_CFG_PSIZE_POS; 99 - } 87 + /* PSIZE */ 88 + if (cfg->src_info.psize != STEDMA40_PSIZE_PHY_1) { 89 + src |= 1 << D40_SREG_CFG_PHY_PEN_POS; 90 + src |= cfg->src_info.psize << D40_SREG_CFG_PSIZE_POS; 91 + } 92 + if (cfg->dst_info.psize != STEDMA40_PSIZE_PHY_1) { 93 + dst |= 1 << D40_SREG_CFG_PHY_PEN_POS; 94 + dst |= cfg->dst_info.psize << D40_SREG_CFG_PSIZE_POS; 95 + } 100 96 101 - /* Element size */ 102 - src |= cfg->src_info.data_width << D40_SREG_CFG_ESIZE_POS; 103 - dst |= cfg->dst_info.data_width << D40_SREG_CFG_ESIZE_POS; 97 + /* Element size */ 98 + src |= cfg->src_info.data_width << D40_SREG_CFG_ESIZE_POS; 99 + dst |= cfg->dst_info.data_width << D40_SREG_CFG_ESIZE_POS; 104 100 105 - /* Set the priority bit to high for the physical channel */ 106 - if (cfg->high_priority) { 107 - src |= 1 << D40_SREG_CFG_PRI_POS; 108 - dst |= 1 << D40_SREG_CFG_PRI_POS; 109 - } 101 + /* Set the priority bit to high for the physical channel */ 102 + if (cfg->high_priority) { 103 + src |= 1 << D40_SREG_CFG_PRI_POS; 104 + dst |= 1 << D40_SREG_CFG_PRI_POS; 110 105 } 111 106 112 107 if (cfg->src_info.big_endian)
+1 -2
drivers/dma/ste_dma40_ll.h
··· 432 432 433 433 void d40_phy_cfg(struct stedma40_chan_cfg *cfg, 434 434 u32 *src_cfg, 435 - u32 *dst_cfg, 436 - bool is_log); 435 + u32 *dst_cfg); 437 436 438 437 void d40_log_cfg(struct stedma40_chan_cfg *cfg, 439 438 u32 *lcsp1,