diff options
author | Lee Jones <lee.jones@linaro.org> | 2013-05-15 05:51:54 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2013-06-04 05:12:08 -0400 |
commit | 2c2b62d5d911da10c0fc37c31458baf4047d531c (patch) | |
tree | 72902f7994bfd5cbfc5e63ab5de4b0e26e2a6bb4 /drivers/dma/ste_dma40.c | |
parent | 98b68ab5ce2a8d1b98a375f9bed66724222ef9b4 (diff) |
dmaengine: ste_dma40: Replace ST-E's home-brew DMA direction defs with generic ones
STEDMA40_*_TO_* direction definitions are identical in all but name to
the pre-defined generic DMA_*_TO_* ones. Let's make things easy by not
duplicating such things.
Cc: Dan Williams <djbw@fb.com>
Cc: Per Forlin <per.forlin@stericsson.com>
Cc: Rabin Vincent <rabin@rab.in>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/dma/ste_dma40.c')
-rw-r--r-- | drivers/dma/ste_dma40.c | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c index 08bc58ae4ceb..483da1660eae 100644 --- a/drivers/dma/ste_dma40.c +++ b/drivers/dma/ste_dma40.c | |||
@@ -78,7 +78,7 @@ static int dma40_memcpy_channels[] = { | |||
78 | /* Default configuration for physcial memcpy */ | 78 | /* Default configuration for physcial memcpy */ |
79 | struct stedma40_chan_cfg dma40_memcpy_conf_phy = { | 79 | struct stedma40_chan_cfg dma40_memcpy_conf_phy = { |
80 | .mode = STEDMA40_MODE_PHYSICAL, | 80 | .mode = STEDMA40_MODE_PHYSICAL, |
81 | .dir = STEDMA40_MEM_TO_MEM, | 81 | .dir = DMA_MEM_TO_MEM, |
82 | 82 | ||
83 | .src_info.data_width = STEDMA40_BYTE_WIDTH, | 83 | .src_info.data_width = STEDMA40_BYTE_WIDTH, |
84 | .src_info.psize = STEDMA40_PSIZE_PHY_1, | 84 | .src_info.psize = STEDMA40_PSIZE_PHY_1, |
@@ -92,7 +92,7 @@ struct stedma40_chan_cfg dma40_memcpy_conf_phy = { | |||
92 | /* Default configuration for logical memcpy */ | 92 | /* Default configuration for logical memcpy */ |
93 | struct stedma40_chan_cfg dma40_memcpy_conf_log = { | 93 | struct stedma40_chan_cfg dma40_memcpy_conf_log = { |
94 | .mode = STEDMA40_MODE_LOGICAL, | 94 | .mode = STEDMA40_MODE_LOGICAL, |
95 | .dir = STEDMA40_MEM_TO_MEM, | 95 | .dir = DMA_MEM_TO_MEM, |
96 | 96 | ||
97 | .src_info.data_width = STEDMA40_BYTE_WIDTH, | 97 | .src_info.data_width = STEDMA40_BYTE_WIDTH, |
98 | .src_info.psize = STEDMA40_PSIZE_LOG_1, | 98 | .src_info.psize = STEDMA40_PSIZE_LOG_1, |
@@ -843,7 +843,7 @@ static void d40_log_lli_to_lcxa(struct d40_chan *chan, struct d40_desc *desc) | |||
843 | * that uses linked lists. | 843 | * that uses linked lists. |
844 | */ | 844 | */ |
845 | if (!(chan->phy_chan->use_soft_lli && | 845 | if (!(chan->phy_chan->use_soft_lli && |
846 | chan->dma_cfg.dir == STEDMA40_PERIPH_TO_MEM)) | 846 | chan->dma_cfg.dir == DMA_DEV_TO_MEM)) |
847 | curr_lcla = d40_lcla_alloc_one(chan, desc); | 847 | curr_lcla = d40_lcla_alloc_one(chan, desc); |
848 | 848 | ||
849 | first_lcla = curr_lcla; | 849 | first_lcla = curr_lcla; |
@@ -1311,12 +1311,12 @@ static void d40_config_set_event(struct d40_chan *d40c, | |||
1311 | u32 event = D40_TYPE_TO_EVENT(d40c->dma_cfg.dev_type); | 1311 | u32 event = D40_TYPE_TO_EVENT(d40c->dma_cfg.dev_type); |
1312 | 1312 | ||
1313 | /* Enable event line connected to device (or memcpy) */ | 1313 | /* Enable event line connected to device (or memcpy) */ |
1314 | if ((d40c->dma_cfg.dir == STEDMA40_PERIPH_TO_MEM) || | 1314 | if ((d40c->dma_cfg.dir == DMA_DEV_TO_MEM) || |
1315 | (d40c->dma_cfg.dir == STEDMA40_PERIPH_TO_PERIPH)) | 1315 | (d40c->dma_cfg.dir == DMA_DEV_TO_DEV)) |
1316 | __d40_config_set_event(d40c, event_type, event, | 1316 | __d40_config_set_event(d40c, event_type, event, |
1317 | D40_CHAN_REG_SSLNK); | 1317 | D40_CHAN_REG_SSLNK); |
1318 | 1318 | ||
1319 | if (d40c->dma_cfg.dir != STEDMA40_PERIPH_TO_MEM) | 1319 | if (d40c->dma_cfg.dir != DMA_DEV_TO_MEM) |
1320 | __d40_config_set_event(d40c, event_type, event, | 1320 | __d40_config_set_event(d40c, event_type, event, |
1321 | D40_CHAN_REG_SDLNK); | 1321 | D40_CHAN_REG_SDLNK); |
1322 | } | 1322 | } |
@@ -1774,7 +1774,7 @@ static int d40_validate_conf(struct d40_chan *d40c, | |||
1774 | res = -EINVAL; | 1774 | res = -EINVAL; |
1775 | } | 1775 | } |
1776 | 1776 | ||
1777 | if (conf->dir == STEDMA40_PERIPH_TO_PERIPH) { | 1777 | if (conf->dir == DMA_DEV_TO_DEV) { |
1778 | /* | 1778 | /* |
1779 | * DMAC HW supports it. Will be added to this driver, | 1779 | * DMAC HW supports it. Will be added to this driver, |
1780 | * in case any dma client requires it. | 1780 | * in case any dma client requires it. |
@@ -1905,11 +1905,11 @@ static int d40_allocate_channel(struct d40_chan *d40c, bool *first_phy_user) | |||
1905 | phys = d40c->base->phy_res; | 1905 | phys = d40c->base->phy_res; |
1906 | num_phy_chans = d40c->base->num_phy_chans; | 1906 | num_phy_chans = d40c->base->num_phy_chans; |
1907 | 1907 | ||
1908 | if (d40c->dma_cfg.dir == STEDMA40_PERIPH_TO_MEM) { | 1908 | if (d40c->dma_cfg.dir == DMA_DEV_TO_MEM) { |
1909 | log_num = 2 * dev_type; | 1909 | log_num = 2 * dev_type; |
1910 | is_src = true; | 1910 | is_src = true; |
1911 | } else if (d40c->dma_cfg.dir == STEDMA40_MEM_TO_PERIPH || | 1911 | } else if (d40c->dma_cfg.dir == DMA_MEM_TO_DEV || |
1912 | d40c->dma_cfg.dir == STEDMA40_MEM_TO_MEM) { | 1912 | d40c->dma_cfg.dir == DMA_MEM_TO_MEM) { |
1913 | /* dst event lines are used for logical memcpy */ | 1913 | /* dst event lines are used for logical memcpy */ |
1914 | log_num = 2 * dev_type + 1; | 1914 | log_num = 2 * dev_type + 1; |
1915 | is_src = false; | 1915 | is_src = false; |
@@ -1920,7 +1920,7 @@ static int d40_allocate_channel(struct d40_chan *d40c, bool *first_phy_user) | |||
1920 | event_line = D40_TYPE_TO_EVENT(dev_type); | 1920 | event_line = D40_TYPE_TO_EVENT(dev_type); |
1921 | 1921 | ||
1922 | if (!is_log) { | 1922 | if (!is_log) { |
1923 | if (d40c->dma_cfg.dir == STEDMA40_MEM_TO_MEM) { | 1923 | if (d40c->dma_cfg.dir == DMA_MEM_TO_MEM) { |
1924 | /* Find physical half channel */ | 1924 | /* Find physical half channel */ |
1925 | if (d40c->dma_cfg.use_fixed_channel) { | 1925 | if (d40c->dma_cfg.use_fixed_channel) { |
1926 | i = d40c->dma_cfg.phy_channel; | 1926 | i = d40c->dma_cfg.phy_channel; |
@@ -2068,10 +2068,10 @@ static int d40_free_dma(struct d40_chan *d40c) | |||
2068 | return -EINVAL; | 2068 | return -EINVAL; |
2069 | } | 2069 | } |
2070 | 2070 | ||
2071 | if (d40c->dma_cfg.dir == STEDMA40_MEM_TO_PERIPH || | 2071 | if (d40c->dma_cfg.dir == DMA_MEM_TO_DEV || |
2072 | d40c->dma_cfg.dir == STEDMA40_MEM_TO_MEM) | 2072 | d40c->dma_cfg.dir == DMA_MEM_TO_MEM) |
2073 | is_src = false; | 2073 | is_src = false; |
2074 | else if (d40c->dma_cfg.dir == STEDMA40_PERIPH_TO_MEM) | 2074 | else if (d40c->dma_cfg.dir == DMA_DEV_TO_MEM) |
2075 | is_src = true; | 2075 | is_src = true; |
2076 | else { | 2076 | else { |
2077 | chan_err(d40c, "Unknown direction\n"); | 2077 | chan_err(d40c, "Unknown direction\n"); |
@@ -2133,10 +2133,10 @@ static bool d40_is_paused(struct d40_chan *d40c) | |||
2133 | goto _exit; | 2133 | goto _exit; |
2134 | } | 2134 | } |
2135 | 2135 | ||
2136 | if (d40c->dma_cfg.dir == STEDMA40_MEM_TO_PERIPH || | 2136 | if (d40c->dma_cfg.dir == DMA_MEM_TO_DEV || |
2137 | d40c->dma_cfg.dir == STEDMA40_MEM_TO_MEM) { | 2137 | d40c->dma_cfg.dir == DMA_MEM_TO_MEM) { |
2138 | status = readl(chanbase + D40_CHAN_REG_SDLNK); | 2138 | status = readl(chanbase + D40_CHAN_REG_SDLNK); |
2139 | } else if (d40c->dma_cfg.dir == STEDMA40_PERIPH_TO_MEM) { | 2139 | } else if (d40c->dma_cfg.dir == DMA_DEV_TO_MEM) { |
2140 | status = readl(chanbase + D40_CHAN_REG_SSLNK); | 2140 | status = readl(chanbase + D40_CHAN_REG_SSLNK); |
2141 | } else { | 2141 | } else { |
2142 | chan_err(d40c, "Unknown direction\n"); | 2142 | chan_err(d40c, "Unknown direction\n"); |
@@ -2387,12 +2387,12 @@ static void d40_set_prio_realtime(struct d40_chan *d40c) | |||
2387 | if (d40c->base->rev < 3) | 2387 | if (d40c->base->rev < 3) |
2388 | return; | 2388 | return; |
2389 | 2389 | ||
2390 | if ((d40c->dma_cfg.dir == STEDMA40_PERIPH_TO_MEM) || | 2390 | if ((d40c->dma_cfg.dir == DMA_DEV_TO_MEM) || |
2391 | (d40c->dma_cfg.dir == STEDMA40_PERIPH_TO_PERIPH)) | 2391 | (d40c->dma_cfg.dir == DMA_DEV_TO_DEV)) |
2392 | __d40_set_prio_rt(d40c, d40c->dma_cfg.dev_type, true); | 2392 | __d40_set_prio_rt(d40c, d40c->dma_cfg.dev_type, true); |
2393 | 2393 | ||
2394 | if ((d40c->dma_cfg.dir == STEDMA40_MEM_TO_PERIPH) || | 2394 | if ((d40c->dma_cfg.dir == DMA_MEM_TO_DEV) || |
2395 | (d40c->dma_cfg.dir == STEDMA40_PERIPH_TO_PERIPH)) | 2395 | (d40c->dma_cfg.dir == DMA_DEV_TO_DEV)) |
2396 | __d40_set_prio_rt(d40c, d40c->dma_cfg.dev_type, false); | 2396 | __d40_set_prio_rt(d40c, d40c->dma_cfg.dev_type, false); |
2397 | } | 2397 | } |
2398 | 2398 | ||
@@ -2423,11 +2423,11 @@ static struct dma_chan *d40_xlate(struct of_phandle_args *dma_spec, | |||
2423 | 2423 | ||
2424 | switch (D40_DT_FLAGS_DIR(flags)) { | 2424 | switch (D40_DT_FLAGS_DIR(flags)) { |
2425 | case 0: | 2425 | case 0: |
2426 | cfg.dir = STEDMA40_MEM_TO_PERIPH; | 2426 | cfg.dir = DMA_MEM_TO_DEV; |
2427 | cfg.dst_info.big_endian = D40_DT_FLAGS_BIG_ENDIAN(flags); | 2427 | cfg.dst_info.big_endian = D40_DT_FLAGS_BIG_ENDIAN(flags); |
2428 | break; | 2428 | break; |
2429 | case 1: | 2429 | case 1: |
2430 | cfg.dir = STEDMA40_PERIPH_TO_MEM; | 2430 | cfg.dir = DMA_DEV_TO_MEM; |
2431 | cfg.src_info.big_endian = D40_DT_FLAGS_BIG_ENDIAN(flags); | 2431 | cfg.src_info.big_endian = D40_DT_FLAGS_BIG_ENDIAN(flags); |
2432 | break; | 2432 | break; |
2433 | } | 2433 | } |
@@ -2473,7 +2473,7 @@ static int d40_alloc_chan_resources(struct dma_chan *chan) | |||
2473 | d40_set_prio_realtime(d40c); | 2473 | d40_set_prio_realtime(d40c); |
2474 | 2474 | ||
2475 | if (chan_is_logical(d40c)) { | 2475 | if (chan_is_logical(d40c)) { |
2476 | if (d40c->dma_cfg.dir == STEDMA40_PERIPH_TO_MEM) | 2476 | if (d40c->dma_cfg.dir == DMA_DEV_TO_MEM) |
2477 | d40c->lcpa = d40c->base->lcpa_base + | 2477 | d40c->lcpa = d40c->base->lcpa_base + |
2478 | d40c->dma_cfg.dev_type * D40_LCPA_CHAN_SIZE; | 2478 | d40c->dma_cfg.dev_type * D40_LCPA_CHAN_SIZE; |
2479 | else | 2479 | else |
@@ -2746,12 +2746,12 @@ static int d40_set_runtime_config(struct dma_chan *chan, | |||
2746 | if (config->direction == DMA_DEV_TO_MEM) { | 2746 | if (config->direction == DMA_DEV_TO_MEM) { |
2747 | config_addr = config->src_addr; | 2747 | config_addr = config->src_addr; |
2748 | 2748 | ||
2749 | if (cfg->dir != STEDMA40_PERIPH_TO_MEM) | 2749 | if (cfg->dir != DMA_DEV_TO_MEM) |
2750 | dev_dbg(d40c->base->dev, | 2750 | dev_dbg(d40c->base->dev, |
2751 | "channel was not configured for peripheral " | 2751 | "channel was not configured for peripheral " |
2752 | "to memory transfer (%d) overriding\n", | 2752 | "to memory transfer (%d) overriding\n", |
2753 | cfg->dir); | 2753 | cfg->dir); |
2754 | cfg->dir = STEDMA40_PERIPH_TO_MEM; | 2754 | cfg->dir = DMA_DEV_TO_MEM; |
2755 | 2755 | ||
2756 | /* Configure the memory side */ | 2756 | /* Configure the memory side */ |
2757 | if (dst_addr_width == DMA_SLAVE_BUSWIDTH_UNDEFINED) | 2757 | if (dst_addr_width == DMA_SLAVE_BUSWIDTH_UNDEFINED) |
@@ -2762,12 +2762,12 @@ static int d40_set_runtime_config(struct dma_chan *chan, | |||
2762 | } else if (config->direction == DMA_MEM_TO_DEV) { | 2762 | } else if (config->direction == DMA_MEM_TO_DEV) { |
2763 | config_addr = config->dst_addr; | 2763 | config_addr = config->dst_addr; |
2764 | 2764 | ||
2765 | if (cfg->dir != STEDMA40_MEM_TO_PERIPH) | 2765 | if (cfg->dir != DMA_MEM_TO_DEV) |
2766 | dev_dbg(d40c->base->dev, | 2766 | dev_dbg(d40c->base->dev, |
2767 | "channel was not configured for memory " | 2767 | "channel was not configured for memory " |
2768 | "to peripheral transfer (%d) overriding\n", | 2768 | "to peripheral transfer (%d) overriding\n", |
2769 | cfg->dir); | 2769 | cfg->dir); |
2770 | cfg->dir = STEDMA40_MEM_TO_PERIPH; | 2770 | cfg->dir = DMA_MEM_TO_DEV; |
2771 | 2771 | ||
2772 | /* Configure the memory side */ | 2772 | /* Configure the memory side */ |
2773 | if (src_addr_width == DMA_SLAVE_BUSWIDTH_UNDEFINED) | 2773 | if (src_addr_width == DMA_SLAVE_BUSWIDTH_UNDEFINED) |