From patchwork Fri Jan 11 15:45:29 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 13993 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 7666723E57 for ; Fri, 11 Jan 2013 15:45:47 +0000 (UTC) Received: from mail-vb0-f46.google.com (mail-vb0-f46.google.com [209.85.212.46]) by fiordland.canonical.com (Postfix) with ESMTP id 0BD8DA19465 for ; Fri, 11 Jan 2013 15:45:46 +0000 (UTC) Received: by mail-vb0-f46.google.com with SMTP id b13so1565258vby.33 for ; Fri, 11 Jan 2013 07:45:46 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=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; bh=H2YSD8fhIQo4aupLyuD8PvJe6e97swNx3tdrejWNyU8=; b=itryctImMlyX2vrlGV4A0Cd7XP6tQqeaNgkAaMNnVMsx+BukAkYn4Tjk/XP+df2F/F xZGs1r9AZ43G4+EkVl0ZlNdQ/wO0f/UqQTo7wwleS7G6evipspXZaHai0ID2hQP2DZYB yvs1kPzqj14IUZiy4aTXmvFYAPKESR0mkzIIahHBGt8QKWA6qxSbJOICCYf929HesE5r sYd/Q/3E5D8wsWrM9pk6fQ5kxAd1h+BvWaoVg+YTT3Y6ATsRrbdTFMOduqcsu/BOvC+E AkLAFm1eyz+OAZ8Xtb++Xowtzaq0UTuRABToAxENNvXiBU1odC6UjG2zfNqzAfYR8EvT sGGQ== X-Received: by 10.52.18.207 with SMTP id y15mr81816905vdd.8.1357919146490; Fri, 11 Jan 2013 07:45:46 -0800 (PST) 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.58.145.101 with SMTP id st5csp118505veb; Fri, 11 Jan 2013 07:45:39 -0800 (PST) X-Received: by 10.112.98.134 with SMTP id ei6mr30954565lbb.62.1357919139082; Fri, 11 Jan 2013 07:45:39 -0800 (PST) Received: from mail-wi0-f175.google.com (mail-wi0-f175.google.com [209.85.212.175]) by mx.google.com with ESMTPS id bq5si9437655wib.37.2013.01.11.07.45.38 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 11 Jan 2013 07:45:38 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.175 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=209.85.212.175; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.175 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-wi0-f175.google.com with SMTP id hm11so2028897wib.14 for ; Fri, 11 Jan 2013 07:45:38 -0800 (PST) X-Received: by 10.194.20.231 with SMTP id q7mr121440238wje.44.1357919138408; Fri, 11 Jan 2013 07:45:38 -0800 (PST) Received: from localhost.localdomain (cpc1-aztw13-0-0-cust473.18-1.cable.virginmedia.com. [77.102.241.218]) by mx.google.com with ESMTPS id u6sm7811302wif.2.2013.01.11.07.45.36 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 11 Jan 2013 07:45:37 -0800 (PST) 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 Subject: [PATCH 2/2] pinctrl: nomadik: Allow prcm_base to be extracted from Device Tree Date: Fri, 11 Jan 2013 15:45:29 +0000 Message-Id: <1357919129-1928-2-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1357919129-1928-1-git-send-email-lee.jones@linaro.org> References: <1357919129-1928-1-git-send-email-lee.jones@linaro.org> X-Gm-Message-State: ALoCoQlSe2WSUffM7g8lJXFxvhKr8bQMbP4GbGVKsQizFKMVUWOxM8bzbewnn7yf5hld3ifWQEvP The Nomadik Pinctrl driver requires access to some PRCMU registers in order to run with full functionality. When Device Tree is disabled the required PRCMU base address is passed in via platform data, so in order for Device Tree booting to be as functional, we need a similar mechanism to fetch it from Device Tree. The new semantics goes like this: Parse the Device Tree and look for the PRCMU node using a provided Phandle. Obtain the ioremaped address from that node. If one was supplied via platform data over-write it with anything found in Device Tree. Fail if either the prcm_base can't be found if we're running on anything other than an STN8815 ASIC. Signed-off-by: Lee Jones --- drivers/pinctrl/pinctrl-nomadik.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/drivers/pinctrl/pinctrl-nomadik.c b/drivers/pinctrl/pinctrl-nomadik.c index 292c909..4954302 100644 --- a/drivers/pinctrl/pinctrl-nomadik.c +++ b/drivers/pinctrl/pinctrl-nomadik.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -1856,6 +1857,7 @@ static int nmk_pinctrl_probe(struct platform_device *pdev) { const struct platform_device_id *platid = platform_get_device_id(pdev); struct device_node *np = pdev->dev.of_node; + struct device_node *prcm_np; struct nmk_pinctrl *npct; struct resource *res; unsigned int version = 0; @@ -1884,21 +1886,26 @@ static int nmk_pinctrl_probe(struct platform_device *pdev) if (version == PINCTRL_NMK_DB8540) nmk_pinctrl_db8540_init(&npct->soc); + if (np) { + prcm_np = of_parse_phandle(np, "prcm", 0); + if (prcm_np) + npct->prcm_base = of_iomap(prcm_np, 0); + } + + /* Allow platform passed information to over-write DT. */ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (res) { + if (res) npct->prcm_base = devm_ioremap(&pdev->dev, res->start, resource_size(res)); - if (!npct->prcm_base) { - dev_err(&pdev->dev, - "failed to ioremap PRCM registers\n"); - return -ENOMEM; + if (!npct->prcm_base) { + if (version == PINCTRL_NMK_STN8815) { + dev_info(&pdev->dev, + "No PRCM base, " + "assuming no ALT-Cx control is available\n"); + } else { + dev_err(&pdev->dev, "missing PRCM base address\n"); + return -EINVAL; } - } else if (version == PINCTRL_NMK_STN8815) { - dev_info(&pdev->dev, - "No PRCM base, assume no ALT-Cx control is available\n"); - } else { - dev_err(&pdev->dev, "missing PRCM base address\n"); - return -EINVAL; } /*