From patchwork Fri May 3 14:32:11 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 16656 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f199.google.com (mail-ve0-f199.google.com [209.85.128.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B6B7B23905 for ; Fri, 3 May 2013 14:34:26 +0000 (UTC) Received: by mail-ve0-f199.google.com with SMTP id m1sf3029526ves.2 for ; Fri, 03 May 2013 07:34:17 -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=2mrX/7SsYGwdvjeARD07w9SzOMcj3YORdy8X4mdHG44=; b=U9PoX+My2yhOAamJvmtbV3jjLCtEyYsBOYIBeqm1PhVzWVZBr7CZ3rPSFHbnlLA+2U 2Rrxg5ODwWTQVW2X7lrSBCOrjbKUD+SETJbb1AGuVVXJsvmdESfcMAJzQosrK7TWu4HL skwYgFkRkVsXXa3Sxf42AXEZPs6LrMlI1GWnHeRhxYhTgN0HJ1NiRxnO7vTEivynloZi TPWFGEXv5g301DIYX9/mQImJ6/GolJL++sKGQFbkxLybgqKYFLQAV/WqzxmWYc//i9gv vQmI9Se/C/1+3vJJzYH7Qep5+9sXf/8a03xlRdzGW5Kyeck12+1CnodtTfiZG2jPqfyG zbuw== X-Received: by 10.236.133.98 with SMTP id p62mr8284549yhi.10.1367591656889; Fri, 03 May 2013 07:34:16 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.76.74 with SMTP id i10ls1952707qew.52.gmail; Fri, 03 May 2013 07:34:16 -0700 (PDT) X-Received: by 10.220.154.14 with SMTP id m14mr2198718vcw.21.1367591656635; Fri, 03 May 2013 07:34:16 -0700 (PDT) Received: from mail-vc0-f175.google.com (mail-vc0-f175.google.com [209.85.220.175]) by mx.google.com with ESMTPS id tq4si4105248vdc.66.2013.05.03.07.34.16 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 03 May 2013 07:34:16 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.175 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.175; Received: by mail-vc0-f175.google.com with SMTP id lf10so1451344vcb.6 for ; Fri, 03 May 2013 07:34:16 -0700 (PDT) X-Received: by 10.58.144.231 with SMTP id sp7mr3744176veb.34.1367591656549; Fri, 03 May 2013 07:34:16 -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 nf2csp25199veb; Fri, 3 May 2013 07:34:15 -0700 (PDT) X-Received: by 10.180.92.229 with SMTP id cp5mr40486786wib.20.1367591655504; Fri, 03 May 2013 07:34:15 -0700 (PDT) Received: from mail-we0-x231.google.com (mail-we0-x231.google.com [2a00:1450:400c:c03::231]) by mx.google.com with ESMTPS id cr8si3612090wjc.76.2013.05.03.07.34.15 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 03 May 2013 07:34:15 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:400c:c03::231 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=2a00:1450:400c:c03::231; Received: by mail-we0-f177.google.com with SMTP id u3so1339855wey.36 for ; Fri, 03 May 2013 07:34:15 -0700 (PDT) X-Received: by 10.180.185.207 with SMTP id fe15mr13578642wic.33.1367591655017; Fri, 03 May 2013 07:34:15 -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 ESMTPSA id o3sm17516019wia.2.2013.05.03.07.34.13 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 03 May 2013 07:34:14 -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, srinidhi.kasagar@stericsson.com, Lee Jones Subject: [PATCH 25/63] dmaengine: ste_dma40: Allow driver to be probe()able when DT is enabled Date: Fri, 3 May 2013 15:32:11 +0100 Message-Id: <1367591569-32197-26-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1367591569-32197-1-git-send-email-lee.jones@linaro.org> References: <1367591569-32197-1-git-send-email-lee.jones@linaro.org> X-Gm-Message-State: ALoCoQlNd1ak5k5OIU3yiosDDysD5REKwfd7jJmKZzskreq1CUqsI82pG3Fc+MjX5VXhZVel/s1M X-Original-Sender: lee.jones@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.175 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. Acked-by: Vinod Koul Acked-by: Arnd Bergmann Reviewed-by: Linus Walleij Signed-off-by: Lee Jones --- drivers/dma/ste_dma40.c | 46 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c index ba50561..d7c2397 100644 --- a/drivers/dma/ste_dma40.c +++ b/drivers/dma/ste_dma40.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -3465,17 +3466,52 @@ failure: return ret; } +static int __init d40_of_probe(struct platform_device *pdev, + struct device_node *np) +{ + struct stedma40_platform_data *pdata; + + /* + * 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. + */ + + pdata = devm_kzalloc(&pdev->dev, + sizeof(struct stedma40_platform_data), + GFP_KERNEL); + if (!pdata) + return -ENOMEM; + + pdev->dev.platform_data = pdata; + + 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; @@ -3649,11 +3685,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, }, };