diff mbox

[v3,5/7] dmaengine: omap-dma: Take DMA request number from DT if it is available

Message ID 1427459213-14611-6-git-send-email-peter.ujfalusi@ti.com (mailing list archive)
State New, archived
Headers show

Commit Message

Peter Ujfalusi March 27, 2015, 12:26 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 | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

Comments

Russell King - ARM Linux March 27, 2015, 8:24 p.m. UTC | #1
On Fri, Mar 27, 2015 at 02:26:51PM +0200, Peter Ujfalusi wrote:
> +	if (!pdev->dev.of_node || of_property_read_u32(pdev->dev.of_node,
> +						       "dma-requests",
> +						       &od->dma_requests)) {
> +		dev_info(&pdev->dev,
> +			 "Missing dma-requests property, using %u.\n",
> +			 OMAP_SDMA_REQUESTS);
> +		od->dma_requests = OMAP_SDMA_REQUESTS;
> +	}

Are all OMAPs including OMAP1 being converted to DT?  If not, don't
introduce noisy printks for which a platform can't do anything about.
Think about this please - if there's no of_node, then why complain
about a missing OF property?
Peter Ujfalusi March 31, 2015, 2:47 p.m. UTC | #2
On 03/27/2015 10:24 PM, Russell King - ARM Linux wrote:
> On Fri, Mar 27, 2015 at 02:26:51PM +0200, Peter Ujfalusi wrote:
>> +	if (!pdev->dev.of_node || of_property_read_u32(pdev->dev.of_node,
>> +						       "dma-requests",
>> +						       &od->dma_requests)) {
>> +		dev_info(&pdev->dev,
>> +			 "Missing dma-requests property, using %u.\n",
>> +			 OMAP_SDMA_REQUESTS);
>> +		od->dma_requests = OMAP_SDMA_REQUESTS;
>> +	}
> 
> Are all OMAPs including OMAP1 being converted to DT?  If not, don't
> introduce noisy printks for which a platform can't do anything about.
> Think about this please - if there's no of_node, then why complain
> about a missing OF property?

Yes, you are perfectly right on this. Will fix it up.

Thanks,
Péter
diff mbox

Patch

diff --git a/drivers/dma/omap-dma.c b/drivers/dma/omap-dma.c
index 56c33e93dd24..2b30acaa721f 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,16 @@  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,
+			 "Missing dma-requests property, using %u.\n",
+			 OMAP_SDMA_REQUESTS);
+		od->dma_requests = OMAP_SDMA_REQUESTS;
+	}
+
+	for (i = 0; i < od->dma_requests; i++) {
 		rc = omap_dma_chan_init(od, i);
 		if (rc) {
 			omap_dma_free(od);