From patchwork Sat Jun 8 16:35:38 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: R Sricharan X-Patchwork-Id: 2692691 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 761F3DF24C for ; Sat, 8 Jun 2013 16:36:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752111Ab3FHQg2 (ORCPT ); Sat, 8 Jun 2013 12:36:28 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:60626 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751875Ab3FHQg2 (ORCPT ); Sat, 8 Jun 2013 12:36:28 -0400 Received: from dbdlxv05.itg.ti.com ([172.24.171.60]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id r58GZoJb031373; Sat, 8 Jun 2013 11:35:51 -0500 Received: from DBDE72.ent.ti.com (dbde72.ent.ti.com [172.24.171.97]) by dbdlxv05.itg.ti.com (8.14.3/8.13.8) with ESMTP id r58GZiQ0026887; Sat, 8 Jun 2013 11:35:46 -0500 Received: from dbdp32.itg.ti.com (172.24.170.251) by DBDE72.ent.ti.com (172.24.171.97) with Microsoft SMTP Server id 14.2.342.3; Sun, 9 Jun 2013 00:35:44 +0800 Received: from uda0393807.apr.dhcp.ti.com (smtpvbd.itg.ti.com [172.24.170.250]) by dbdp32.itg.ti.com (8.13.8/8.13.8) with ESMTP id r58GZdIj025529; Sat, 8 Jun 2013 22:05:39 +0530 From: Sricharan R To: , CC: , , , , , , Subject: [PATCH] spi: omap2-mcspi: Skip platform_get_resource_byname() for dt case Date: Sat, 8 Jun 2013 22:05:38 +0530 Message-ID: <1370709338-19810-1-git-send-email-r.sricharan@ti.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org McSPI driver probe will abort for DT case because of failed platform_get_resource_byname() lookup. Fix it by skipping resource byname lookup for device tree build. Issue comes out when dma entries are removed from the hwmod data. Signed-off-by: Sricharan R --- drivers/spi/spi-omap2-mcspi.c | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c index e4829aa..99172d2 100644 --- a/drivers/spi/spi-omap2-mcspi.c +++ b/drivers/spi/spi-omap2-mcspi.c @@ -1275,25 +1275,31 @@ static int omap2_mcspi_probe(struct platform_device *pdev) struct resource *dma_res; sprintf(dma_rx_ch_name, "rx%d", i); - dma_res = platform_get_resource_byname(pdev, IORESOURCE_DMA, - dma_rx_ch_name); - if (!dma_res) { - dev_dbg(&pdev->dev, "cannot get DMA RX channel\n"); - status = -ENODEV; - break; + + if (!pdev->dev.of_node) { + dma_res = platform_get_resource_byname(pdev, + IORESOURCE_DMA, dma_rx_ch_name); + if (!dma_res) { + dev_dbg(&pdev->dev, "cannot get DMA RX channel\n"); + status = -ENODEV; + break; + } + mcspi->dma_channels[i].dma_rx_sync_dev = dma_res->start; } - mcspi->dma_channels[i].dma_rx_sync_dev = dma_res->start; sprintf(dma_tx_ch_name, "tx%d", i); - dma_res = platform_get_resource_byname(pdev, IORESOURCE_DMA, - dma_tx_ch_name); - if (!dma_res) { - dev_dbg(&pdev->dev, "cannot get DMA TX channel\n"); - status = -ENODEV; - break; - } - mcspi->dma_channels[i].dma_tx_sync_dev = dma_res->start; + if (!pdev->dev.of_node) { + dma_res = platform_get_resource_byname(pdev, + IORESOURCE_DMA, dma_tx_ch_name); + + if (!dma_res) { + dev_dbg(&pdev->dev, "cannot get DMA TX channel\n"); + status = -ENODEV; + break; + } + mcspi->dma_channels[i].dma_tx_sync_dev = dma_res->start; + } } if (status < 0)