From patchwork Fri May 4 18:23:19 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 8408 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 7651123EAB for ; Fri, 4 May 2012 18:24:11 +0000 (UTC) Received: from mail-gy0-f180.google.com (mail-gh0-f180.google.com [209.85.160.180]) by fiordland.canonical.com (Postfix) with ESMTP id 3F53CA18068 for ; Fri, 4 May 2012 18:24:11 +0000 (UTC) Received: by mail-gy0-f180.google.com with SMTP id z12so974947ghb.11 for ; Fri, 04 May 2012 11:24:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=YIKSCZ884E6eCW8OwjfFR8XR9BJVaLA128ivMBidBXA=; b=csymvHZOhitHxetZA/x6XJJqqd8Le2N7L6o0XYs0twuEl2BnZMmeOpCV0FZ0WjrY99 il15xrvCmtpawjUb+i1gk4cs9IcMau+kA8smdS6RnylcKUNLvqV9YJO11XaYk7TwH4xQ GGH1AC2JlD9h8NAB6CbsiqXjb+WBl/G3O9SVWA/IuFaHygzgCiSueDpKUHVQOpbxN7s6 NBfacHrvQKA5Xf7THoiuf+nIp5IcT4PxqV6YPS6Uxo439hwG2jrbl5rTjjGza1YjeWgq 167pJRIyNpM8LOCInRrML3ZJZM3MdL25+c9s1Q3uzJxYtnbTFZDt65WpAg1yEI+Lv7WH mTFA== Received: by 10.50.160.225 with SMTP id xn1mr620882igb.3.1336155850943; Fri, 04 May 2012 11:24:10 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.137.198 with SMTP id x6csp106278ibt; Fri, 4 May 2012 11:24:10 -0700 (PDT) Received: by 10.216.131.78 with SMTP id l56mr4389663wei.94.1336155849643; Fri, 04 May 2012 11:24:09 -0700 (PDT) Received: from mail-we0-f178.google.com (mail-we0-f178.google.com [74.125.82.178]) by mx.google.com with ESMTPS id d7si7080116wid.26.2012.05.04.11.24.08 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 04 May 2012 11:24:09 -0700 (PDT) Received-SPF: neutral (google.com: 74.125.82.178 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=74.125.82.178; Authentication-Results: mx.google.com; spf=neutral (google.com: 74.125.82.178 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) smtp.mail=lee.jones@linaro.org Received: by mail-we0-f178.google.com with SMTP id a13so2626931wer.37 for ; Fri, 04 May 2012 11:24:08 -0700 (PDT) Received: by 10.180.105.69 with SMTP id gk5mr17432438wib.3.1336155848689; Fri, 04 May 2012 11:24:08 -0700 (PDT) Received: from localhost.localdomain ([89.192.128.60]) by mx.google.com with ESMTPS id fn2sm17590123wib.0.2012.05.04.11.24.05 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 04 May 2012 11:24:08 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org Cc: arnd@arndb.de, linus.walleij@stericsson.com, grant.likely@secretlab.ca, cjb@laptop.org, ben-linux@fluff.org, linux-i2c@vger.kernel.org, broonie@opensource.wolfsonmicro.com, sameo@linux.intel.com, Lee Jones Subject: [PATCH 09/15] drivers/mfd: Enable Device Tree support for the db8500-prcmu Date: Fri, 4 May 2012 19:23:19 +0100 Message-Id: <1336155805-18554-10-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1336155805-18554-1-git-send-email-lee.jones@linaro.org> References: <1336155805-18554-1-git-send-email-lee.jones@linaro.org> X-Gm-Message-State: ALoCoQmSoMPuYhOOiJMglSEBlvH9Dm6lhtuPQaI+G0GPehKFTiLr0Uisk/XkETpU0xj6kYgPmH4F This patch will enable probing to occur during a Device Tree enabled boot. The IRQ base is expected to be located in and will be fetched from the DT itself. We also prevent any of the db8500 regulators from being registered here, as they will be enabled via DT instead. Signed-off-by: Lee Jones --- drivers/mfd/db8500-prcmu.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/drivers/mfd/db8500-prcmu.c b/drivers/mfd/db8500-prcmu.c index 7a83bf0..9bc75a8 100644 --- a/drivers/mfd/db8500-prcmu.c +++ b/drivers/mfd/db8500-prcmu.c @@ -2960,7 +2960,8 @@ static struct mfd_cell db8500_prcmu_devs[] = { */ static int __devinit db8500_prcmu_probe(struct platform_device *pdev) { - int err = 0; + struct device_node *np = pdev->dev.of_node; + int irq = 0, err = 0; if (ux500_is_svp()) return -ENODEV; @@ -2970,8 +2971,14 @@ static int __devinit db8500_prcmu_probe(struct platform_device *pdev) /* Clean up the mailbox interrupts after pre-kernel code. */ writel(ALL_MBOX_BITS, PRCM_ARM_IT1_CLR); - err = request_threaded_irq(IRQ_DB8500_PRCMU1, prcmu_irq_handler, - prcmu_irq_thread_fn, IRQF_NO_SUSPEND, "prcmu", NULL); + if (np) + irq = platform_get_irq(pdev, 0); + + if (!np || irq <= 0) + irq = IRQ_DB8500_PRCMU1; + + err = request_threaded_irq(irq, prcmu_irq_handler, + prcmu_irq_thread_fn, IRQF_NO_SUSPEND, "prcmu", NULL); if (err < 0) { pr_err("prcmu: Failed to allocate IRQ_DB8500_PRCMU1.\n"); err = -EBUSY; @@ -2981,14 +2988,16 @@ static int __devinit db8500_prcmu_probe(struct platform_device *pdev) if (cpu_is_u8500v20_or_later()) prcmu_config_esram0_deep_sleep(ESRAM0_DEEP_SLEEP_STATE_RET); - err = mfd_add_devices(&pdev->dev, 0, db8500_prcmu_devs, - ARRAY_SIZE(db8500_prcmu_devs), NULL, - 0); + if (!np) { + err = mfd_add_devices(&pdev->dev, 0, db8500_prcmu_devs, + ARRAY_SIZE(db8500_prcmu_devs), NULL, 0); + if (err) { + pr_err("prcmu: Failed to add subdevices\n"); + return err; + } + } - if (err) - pr_err("prcmu: Failed to add subdevices\n"); - else - pr_info("DB8500 PRCMU initialized\n"); + pr_info("DB8500 PRCMU initialized\n"); no_irq_return: return err;