diff mbox

[4/6] dmaengine: omap-dma: Take DMA request number from DT if it is available

Message ID 1424787683-19151-5-git-send-email-peter.ujfalusi@ti.com (mailing list archive)
State New, archived
Headers show

Commit Message

Peter Ujfalusi Feb. 24, 2015, 2:21 p.m. UTC
Use the dma-requests property from DT to get the number of DMA requests.
In case of legacy boot or failure to find the property, use the default
127 as number of requests.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
 drivers/dma/omap-dma.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

Comments

Russell King - ARM Linux Feb. 24, 2015, 2:25 p.m. UTC | #1
On Tue, Feb 24, 2015 at 04:21:21PM +0200, Peter Ujfalusi wrote:
> Use the dma-requests property from DT to get the number of DMA requests.
> In case of legacy boot or failure to find the property, use the default
> 127 as number of requests.
> 
> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
> ---
>  drivers/dma/omap-dma.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/dma/omap-dma.c b/drivers/dma/omap-dma.c
> index 56c33e93dd24..7def31c919f4 100644
> --- a/drivers/dma/omap-dma.c
> +++ b/drivers/dma/omap-dma.c
> @@ -34,6 +34,7 @@ struct omap_dmadev {
>  	const struct omap_dma_reg *reg_map;
>  	struct omap_system_dma_plat_info *plat;
>  	bool legacy;
> +	unsigned dma_requests;
>  	spinlock_t irq_lock;
>  	uint32_t irq_enable_mask;
>  	struct omap_chan *lch_map[OMAP_SDMA_CHANNELS];
> @@ -1118,7 +1119,15 @@ static int omap_dma_probe(struct platform_device *pdev)
>  
>  	tasklet_init(&od->task, omap_dma_sched, (unsigned long)od);
>  
> -	for (i = 0; i < OMAP_SDMA_REQUESTS; i++) {
> +	if (!pdev->dev.of_node || of_property_read_u32(pdev->dev.of_node,
> +						       "dma-requests",
> +						       &od->dma_requests)) {
> +		dev_info(&pdev->dev,
> +			 "DMA request lines not specified, using 127\n");
> +		od->dma_requests = 127;

What happened to OMAP_SDMA_REQUESTS?

If you're not going to use OMAP_SDMA_REQUESTS, then don't add it.  If
you are going to use it, please also change the dev_info() line to use
that macro too.

Thanks.
Peter Ujfalusi Feb. 24, 2015, 2:28 p.m. UTC | #2
On 02/24/2015 04:25 PM, Russell King - ARM Linux wrote:
> On Tue, Feb 24, 2015 at 04:21:21PM +0200, Peter Ujfalusi wrote:
>> Use the dma-requests property from DT to get the number of DMA requests.
>> In case of legacy boot or failure to find the property, use the default
>> 127 as number of requests.
>>
>> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
>> ---
>>  drivers/dma/omap-dma.c | 11 ++++++++++-
>>  1 file changed, 10 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/dma/omap-dma.c b/drivers/dma/omap-dma.c
>> index 56c33e93dd24..7def31c919f4 100644
>> --- a/drivers/dma/omap-dma.c
>> +++ b/drivers/dma/omap-dma.c
>> @@ -34,6 +34,7 @@ struct omap_dmadev {
>>  	const struct omap_dma_reg *reg_map;
>>  	struct omap_system_dma_plat_info *plat;
>>  	bool legacy;
>> +	unsigned dma_requests;
>>  	spinlock_t irq_lock;
>>  	uint32_t irq_enable_mask;
>>  	struct omap_chan *lch_map[OMAP_SDMA_CHANNELS];
>> @@ -1118,7 +1119,15 @@ static int omap_dma_probe(struct platform_device *pdev)
>>  
>>  	tasklet_init(&od->task, omap_dma_sched, (unsigned long)od);
>>  
>> -	for (i = 0; i < OMAP_SDMA_REQUESTS; i++) {
>> +	if (!pdev->dev.of_node || of_property_read_u32(pdev->dev.of_node,
>> +						       "dma-requests",
>> +						       &od->dma_requests)) {
>> +		dev_info(&pdev->dev,
>> +			 "DMA request lines not specified, using 127\n");
>> +		od->dma_requests = 127;
> 
> What happened to OMAP_SDMA_REQUESTS?
> 
> If you're not going to use OMAP_SDMA_REQUESTS, then don't add it.  If
> you are going to use it, please also change the dev_info() line to use
> that macro too.

Aargh, yes you are right. Will fix this up in v2.
diff mbox

Patch

diff --git a/drivers/dma/omap-dma.c b/drivers/dma/omap-dma.c
index 56c33e93dd24..7def31c919f4 100644
--- a/drivers/dma/omap-dma.c
+++ b/drivers/dma/omap-dma.c
@@ -34,6 +34,7 @@  struct omap_dmadev {
 	const struct omap_dma_reg *reg_map;
 	struct omap_system_dma_plat_info *plat;
 	bool legacy;
+	unsigned dma_requests;
 	spinlock_t irq_lock;
 	uint32_t irq_enable_mask;
 	struct omap_chan *lch_map[OMAP_SDMA_CHANNELS];
@@ -1118,7 +1119,15 @@  static int omap_dma_probe(struct platform_device *pdev)
 
 	tasklet_init(&od->task, omap_dma_sched, (unsigned long)od);
 
-	for (i = 0; i < OMAP_SDMA_REQUESTS; i++) {
+	if (!pdev->dev.of_node || of_property_read_u32(pdev->dev.of_node,
+						       "dma-requests",
+						       &od->dma_requests)) {
+		dev_info(&pdev->dev,
+			 "DMA request lines not specified, using 127\n");
+		od->dma_requests = 127;
+	}
+
+	for (i = 0; i < od->dma_requests; i++) {
 		rc = omap_dma_chan_init(od, i);
 		if (rc) {
 			omap_dma_free(od);