From patchwork Thu Apr 18 10:12:05 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 16211 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vb0-f69.google.com (mail-vb0-f69.google.com [209.85.212.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B9F2D23974 for ; Thu, 18 Apr 2013 10:13:52 +0000 (UTC) Received: by mail-vb0-f69.google.com with SMTP id p12sf4369556vbe.4 for ; Thu, 18 Apr 2013 03:13:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:x-beenthere:x-received:received-spf :x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=ACxOS4PGePfP8C3A3IpVbmtAJbinYg0cN8ZHAM8ft8w=; b=Pp6MPtGOTgH+aVnIe6UOnBQYsuPG3Uq/g98XOsIkcJeoBkQDR0idm4WVCG1fPgYB+4 7/0/L6hmYj+v1FBlNM5xI8pP5K86szxkLw0kxWRHN4aDah7g1YJmPtgq8bmXD51NJigd LhqYMEma+9D04yEp4cTVUrGFfYxwgW/DTpg8yyZ2g0N6BT7M/jkct5Zre2vUep2acxep 6TrQrx3hqDJoNuWVO2KyIJ85attzWca+mQNnIZg2wjf/ut7HEZ9f4Zrl4wD2PbZgIG7K pqOJMliH5/yGKNdpRw6iSou/e+MfZQlatfju9OGEtoqGVHt6WfE1NGgJfg6coE1dgX8x bSxQ== X-Received: by 10.236.138.80 with SMTP id z56mr4352068yhi.29.1366279995672; Thu, 18 Apr 2013 03:13:15 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.1.4 with SMTP id 4ls1494161qei.68.gmail; Thu, 18 Apr 2013 03:13:15 -0700 (PDT) X-Received: by 10.52.178.161 with SMTP id cz1mr6424678vdc.7.1366279995473; Thu, 18 Apr 2013 03:13:15 -0700 (PDT) Received: from mail-vb0-x22c.google.com (mail-vb0-x22c.google.com [2607:f8b0:400c:c02::22c]) by mx.google.com with ESMTPS id o16si6243214vcw.33.2013.04.18.03.13.15 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 18 Apr 2013 03:13:15 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c02::22c is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c02::22c; Received: by mail-vb0-f44.google.com with SMTP id e12so2157119vbg.17 for ; Thu, 18 Apr 2013 03:13:15 -0700 (PDT) X-Received: by 10.220.242.73 with SMTP id lh9mr7580611vcb.49.1366279995355; Thu, 18 Apr 2013 03:13:15 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.58.127.98 with SMTP id nf2csp115760veb; Thu, 18 Apr 2013 03:13:14 -0700 (PDT) X-Received: by 10.180.185.239 with SMTP id ff15mr32235946wic.2.1366279994330; Thu, 18 Apr 2013 03:13:14 -0700 (PDT) Received: from mail-wi0-x22f.google.com (mail-wi0-x22f.google.com [2a00:1450:400c:c05::22f]) by mx.google.com with ESMTPS id n16si3429140wij.91.2013.04.18.03.13.14 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 18 Apr 2013 03:13:14 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:400c:c05::22f is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=2a00:1450:400c:c05::22f; Received: by mail-wi0-f175.google.com with SMTP id h11so1595629wiv.14 for ; Thu, 18 Apr 2013 03:13:14 -0700 (PDT) X-Received: by 10.180.74.146 with SMTP id t18mr3548337wiv.26.1366279993940; Thu, 18 Apr 2013 03:13:13 -0700 (PDT) Received: from localhost.localdomain (cpc34-aztw25-2-0-cust250.18-1.cable.virginmedia.com. [86.16.136.251]) by mx.google.com with ESMTPS id t7sm30483773wij.2.2013.04.18.03.13.12 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 18 Apr 2013 03:13:13 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: arnd@arndb.de, linus.walleij@stericsson.com, Lee Jones , Vinod Koul , Dan Williams , Per Forlin , Rabin Vincent Subject: [PATCH 23/32] dmaengine: ste_dma40: Allow driver to be probe()able when DT is enabled Date: Thu, 18 Apr 2013 11:12:05 +0100 Message-Id: <1366279934-30761-24-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1366279934-30761-1-git-send-email-lee.jones@linaro.org> References: <1366279934-30761-1-git-send-email-lee.jones@linaro.org> X-Gm-Message-State: ALoCoQl8f6UoGjXhyzS/wKOLs93VLJO0GzjgjmGhiDW3ag1VOWmiz+sigBc/40qgY3NoJULCS1D4 X-Original-Sender: lee.jones@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c02::22c is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , When booting using Device Tree, devices aren't registered in the normal way. Instead, they need to be provided with a compatible string which is held in an OF Match Table for comparison during start-up. Here we provide the compatible string and prepare the driver to not receive a platform data pointer. Cc: Vinod Koul Cc: Dan Williams Cc: Per Forlin Cc: Rabin Vincent Signed-off-by: Lee Jones --- drivers/dma/ste_dma40.c | 42 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c index 6f9f801..4782ee7 100644 --- a/drivers/dma/ste_dma40.c +++ b/drivers/dma/ste_dma40.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -3452,17 +3453,48 @@ failure: return ret; } +static int __init d40_of_probe(struct platform_device *pdev, + struct device_node *np) +{ + /* + * FIXME: Fill in this routine as more support is added. + * First platform enabled (u8500) doens't need any extra + * properties to run, so this is fairly sparce currently. + */ + pdev->dev.platform_data = + devm_kzalloc(&pdev->dev, + sizeof(struct stedma40_platform_data), + GFP_KERNEL); + if (!pdev->dev.platform_data) + return -ENOMEM; + + return 0; +} + static int __init d40_probe(struct platform_device *pdev) { + struct stedma40_platform_data *plat_data = pdev->dev.platform_data; + struct device_node *np = pdev->dev.of_node; int err; int ret = -ENOENT; - struct d40_base *base; + struct d40_base *base = NULL; struct resource *res = NULL; int num_reserved_chans; u32 val; - base = d40_hw_detect_init(pdev); + if (!plat_data) { + if (np) { + if(d40_of_probe(pdev, np)) { + ret = -ENOMEM; + goto failure; + } + } else { + d40_err(&pdev->dev, "No pdata or Device Tree provided\n"); + goto failure; + } + } + base = d40_hw_detect_init(pdev); if (!base) goto failure; @@ -3636,11 +3668,17 @@ failure: return ret; } +static const struct of_device_id d40_match[] = { + { .compatible = "stericsson,dma40", }, + {} +}; + static struct platform_driver d40_driver = { .driver = { .owner = THIS_MODULE, .name = D40_NAME, .pm = DMA40_PM_OPS, + .of_match_table = d40_match, }, };