[PATCH 7/7] dmaengine: ste_dma40: support fixed physical channel allocation

2012-12-12 Thread Fabio Baltieri
From: Gerald Baeza 

This patch makes existing use_fixed_channel field (of stedma40_chan_cfg
structure) applicable to physical channels.

Signed-off-by: Gerald Baeza 
Tested-by: Yannick Fertre 
Reviewed-by: Per Forlin 
Acked-by: Linus Walleij 
Signed-off-by: Fabio Baltieri 
---
 drivers/dma/ste_dma40.c | 13 +++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
index f871df6..efe8be7 100644
--- a/drivers/dma/ste_dma40.c
+++ b/drivers/dma/ste_dma40.c
@@ -1712,10 +1712,12 @@ static int d40_allocate_channel(struct d40_chan *d40c, 
bool *first_phy_user)
int i;
int j;
int log_num;
+   int num_phy_chans;
bool is_src;
bool is_log = d40c->dma_cfg.mode == STEDMA40_MODE_LOGICAL;
 
phys = d40c->base->phy_res;
+   num_phy_chans = d40c->base->num_phy_chans;
 
if (d40c->dma_cfg.dir == STEDMA40_PERIPH_TO_MEM) {
dev_type = d40c->dma_cfg.src_dev_type;
@@ -1736,12 +1738,19 @@ static int d40_allocate_channel(struct d40_chan *d40c, 
bool *first_phy_user)
if (!is_log) {
if (d40c->dma_cfg.dir == STEDMA40_MEM_TO_MEM) {
/* Find physical half channel */
-   for (i = 0; i < d40c->base->num_phy_chans; i++) {
-
+   if (d40c->dma_cfg.use_fixed_channel) {
+   i = d40c->dma_cfg.phy_channel;
if (d40_alloc_mask_set([i], is_src,
   0, is_log,
   first_phy_user))
goto found_phy;
+   } else {
+   for (i = 0; i < num_phy_chans; i++) {
+   if (d40_alloc_mask_set([i], is_src,
+  0, is_log,
+  first_phy_user))
+   goto found_phy;
+   }
}
} else
for (j = 0; j < d40c->base->num_phy_chans; j += 8) {
-- 
1.7.12.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 7/7] dmaengine: ste_dma40: support fixed physical channel allocation

2012-12-12 Thread Fabio Baltieri
From: Gerald Baeza gerald.ba...@stericsson.com

This patch makes existing use_fixed_channel field (of stedma40_chan_cfg
structure) applicable to physical channels.

Signed-off-by: Gerald Baeza gerald.ba...@stericsson.com
Tested-by: Yannick Fertre yannick.fer...@stericsson.com
Reviewed-by: Per Forlin per.for...@stericsson.com
Acked-by: Linus Walleij linus.wall...@linaro.org
Signed-off-by: Fabio Baltieri fabio.balti...@linaro.org
---
 drivers/dma/ste_dma40.c | 13 +++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
index f871df6..efe8be7 100644
--- a/drivers/dma/ste_dma40.c
+++ b/drivers/dma/ste_dma40.c
@@ -1712,10 +1712,12 @@ static int d40_allocate_channel(struct d40_chan *d40c, 
bool *first_phy_user)
int i;
int j;
int log_num;
+   int num_phy_chans;
bool is_src;
bool is_log = d40c-dma_cfg.mode == STEDMA40_MODE_LOGICAL;
 
phys = d40c-base-phy_res;
+   num_phy_chans = d40c-base-num_phy_chans;
 
if (d40c-dma_cfg.dir == STEDMA40_PERIPH_TO_MEM) {
dev_type = d40c-dma_cfg.src_dev_type;
@@ -1736,12 +1738,19 @@ static int d40_allocate_channel(struct d40_chan *d40c, 
bool *first_phy_user)
if (!is_log) {
if (d40c-dma_cfg.dir == STEDMA40_MEM_TO_MEM) {
/* Find physical half channel */
-   for (i = 0; i  d40c-base-num_phy_chans; i++) {
-
+   if (d40c-dma_cfg.use_fixed_channel) {
+   i = d40c-dma_cfg.phy_channel;
if (d40_alloc_mask_set(phys[i], is_src,
   0, is_log,
   first_phy_user))
goto found_phy;
+   } else {
+   for (i = 0; i  num_phy_chans; i++) {
+   if (d40_alloc_mask_set(phys[i], is_src,
+  0, is_log,
+  first_phy_user))
+   goto found_phy;
+   }
}
} else
for (j = 0; j  d40c-base-num_phy_chans; j += 8) {
-- 
1.7.12.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/