From patchwork Wed Mar 22 17:00:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jon Hunter X-Patchwork-Id: 9639531 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A04A6601E9 for ; Wed, 22 Mar 2017 17:10:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9C2F127D5D for ; Wed, 22 Mar 2017 17:10:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8E63028474; Wed, 22 Mar 2017 17:10:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1316927D5D for ; Wed, 22 Mar 2017 17:10:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=iUkNaT/YCxdH+zdOuMbj6TS9nLIEfGJElIdUv9IFrMg=; b=PmYQvKAZFbpebn 9373RBuFkfvlYVqQZuOs31ODJDNgo8bNtun2/ln37PhNRehDidmHaNnms0BOcmU7QXWIA90uowrMi FjlQ/ie5L1fWnCWMq9C7SOqZ8VYmscykWQDhp2VE9FX46/6Hvt0+MOzSPL53qUR69bpPGyt6AiswP 6snQAu6EbM/CY7bm5oEO49utDJHbRvJsJK0xXHl/ryvZhUWnACqO9re6wVVt1RSP/qMld0hpwIkRv RfB6gYhJNf79rBaQ8z4M3Yi9tiS6wQZwn1/w0ozTTp6ERZhr7cD34NJ3aewVwXrhlyLr2vLvhYeMU tkE/C6mfDwv0ZU/Zpyyg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cqjlx-0006xr-MZ; Wed, 22 Mar 2017 17:10:09 +0000 Received: from casper.infradead.org ([85.118.1.10]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cqjl6-0006FZ-Et for linux-arm-kernel@bombadil.infradead.org; Wed, 22 Mar 2017 17:09:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=F+LuZKA04y9D1LK08ReBUJlpLaleMV/tjJBfGzoQQzI=; b=iOhTGyvVCkKuR+k/G6vcnXllQ IueQbrf/cJXkfqUVtQgR70eqlrhSCgyWc0OBQXAwpqLz4mOGu+nQ2KMBto5m/GAIBNbiyUMHmA9FU KTcJh9CPGAsK4XXhwKAGSadkZ3DtPqD+klBfLMjIdJ8qvHfpclujCe2q/Kei6oIAmT6z3DgsJvG+z rOhsL1oGsk2jio75jDajsxvVt522g71jR++XI4/CL1JqOjowLkKq2Np7T+zRjxet3hhOV2+VQB9xX 3T8ztCcXxob7esuhJWZMd5hIDxWvFtfLj5yjRMYw/LTLhu9oT2nnsc7BaQA9qzFdC5mOfcVMqwoFh Yt/4DodGg==; Received: from hqemgate16.nvidia.com ([216.228.121.65]) by casper.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cqjdb-0000L9-UO for linux-arm-kernel@lists.infradead.org; Wed, 22 Mar 2017 17:01:35 +0000 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate16.nvidia.com id ; Wed, 22 Mar 2017 10:00:34 -0700 Received: from HQMAIL105.nvidia.com ([172.20.13.39]) by hqpgpgate101.nvidia.com (PGP Universal service); Wed, 22 Mar 2017 10:01:07 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Wed, 22 Mar 2017 10:01:07 -0700 Received: from HQMAIL110.nvidia.com (172.18.146.15) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1263.5; Wed, 22 Mar 2017 17:01:07 +0000 Received: from HQMAIL107.nvidia.com (172.20.187.13) by hqmail110.nvidia.com (172.18.146.15) with Microsoft SMTP Server (TLS) id 15.0.1263.5; Wed, 22 Mar 2017 17:01:07 +0000 Received: from hqnvemgw01.nvidia.com (172.20.150.20) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server id 15.0.1263.5 via Frontend Transport; Wed, 22 Mar 2017 17:01:07 +0000 Received: from goldfinger.nvidia.com (Not Verified[10.21.132.151]) by hqnvemgw01.nvidia.com with Trustwave SEG (v7, 5, 5, 8150) id ; Wed, 22 Mar 2017 10:01:06 -0700 From: Jon Hunter To: Thierry Reding Subject: [PATCH V2 3/5] soc/tegra: flowctrl: Add basic platform driver Date: Wed, 22 Mar 2017 17:00:54 +0000 Message-ID: <1490202056-13040-4-git-send-email-jonathanh@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1490202056-13040-1-git-send-email-jonathanh@nvidia.com> References: <1490202056-13040-1-git-send-email-jonathanh@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170322_170132_261920_80A8A8E0 X-CRM114-Status: GOOD ( 20.80 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , devicetree@vger.kernel.org, Russell King , Jon Hunter , Rob Herring , linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add a simple platform driver for the flowctrl module so that it gets registered as a proper device. Signed-off-by: Jon Hunter --- drivers/soc/tegra/flowctrl.c | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/drivers/soc/tegra/flowctrl.c b/drivers/soc/tegra/flowctrl.c index 3a5a1cb9ae90..25eddfc8475d 100644 --- a/drivers/soc/tegra/flowctrl.c +++ b/drivers/soc/tegra/flowctrl.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -47,7 +48,7 @@ static void __iomem *tegra_flowctrl_base; static void flowctrl_update(u8 offset, u32 value) { - if (WARN_ONCE(!tegra_flowctrl_base, + if (WARN_ONCE(IS_ERR_OR_NULL(tegra_flowctrl_base), "Tegra flowctrl not initialised!\n")) return; @@ -62,7 +63,7 @@ u32 flowctrl_read_cpu_csr(unsigned int cpuid) { u8 offset = flowctrl_offset_cpu_csr[cpuid]; - if (WARN_ONCE(!tegra_flowctrl_base, + if (WARN_ONCE(IS_ERR_OR_NULL(tegra_flowctrl_base), "Tegra flowctrl not initialised!\n")) return 0; @@ -148,7 +149,22 @@ void flowctrl_cpu_suspend_exit(unsigned int cpuid) flowctrl_write_cpu_csr(cpuid, reg); } -static const struct of_device_id matches[] __initconst = { +static int tegra_flowctrl_probe(struct platform_device *pdev) +{ + void __iomem *base = tegra_flowctrl_base; + struct resource *res; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + tegra_flowctrl_base = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(tegra_flowctrl_base)) + return PTR_ERR(base); + + iounmap(base); + + return 0; +} + +static const struct of_device_id tegra_flowctrl_match[] = { { .compatible = "nvidia,tegra124-flowctrl" }, { .compatible = "nvidia,tegra114-flowctrl" }, { .compatible = "nvidia,tegra30-flowctrl" }, @@ -156,6 +172,16 @@ static const struct of_device_id matches[] __initconst = { { } }; +static struct platform_driver tegra_flowctrl_driver = { + .driver = { + .name = "tegra-flowctrl", + .suppress_bind_attrs = true, + .of_match_table = tegra_flowctrl_match, + }, + .probe = tegra_flowctrl_probe, +}; +builtin_platform_driver(tegra_flowctrl_driver); + static int __init tegra_flowctrl_init(void) { /* hardcoded fallback if device tree node is missing */ @@ -166,7 +192,7 @@ static int __init tegra_flowctrl_init(void) if (!soc_is_tegra()) return 0; - np = of_find_matching_node(NULL, matches); + np = of_find_matching_node(NULL, tegra_flowctrl_match); if (np) { struct resource res;