From patchwork Mon Feb 12 07:08:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 127941 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp2942342ljc; Sun, 11 Feb 2018 23:09:22 -0800 (PST) X-Google-Smtp-Source: AH8x225bu3dA0meUb3Fn7TNz37QvN19WO9+ahpjc3IpZ+I40l4rrShXbd/miYpieYo8fd/iLSeGL X-Received: by 2002:a17:902:b410:: with SMTP id x16-v6mr10230014plr.157.1518419362557; Sun, 11 Feb 2018 23:09:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518419362; cv=none; d=google.com; s=arc-20160816; b=HItUn9jJ+hNf2o66zx07raulHnqrc+AqVz+T0zNMVqbP0mVOxVVOHthvzi0i3NJq97 jmcBXn+bHrxWh0lH29i+QDyfBYBbNzDraN5YebHECisI9L7WQQqg3pMesgMAAGR4ZsuC rk/lAs0omKKAYefM9ax76OKD5ZXPp1/eowaiRqQNW7jEFkGz1evg00HEsES5dUCF3KZl ffjsDaThQ+xj0jyXgLlpWUBBX3JrqsMCPttNBeFCIex7G/vbqirqrIsYcEcmXlMr71+j v6D8eZ8xfjsr8wleSpjGuIuhbzsu4c/hXWSjEPrbOe/N7MKQPKgknq0PQEinDzjc8fkK vbZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=NwL7A4hTUadKcUHHkqCgS88GiYok4oil6lnWHhgTt2o=; b=rmabwDYF9iLCedhb5ZlDOtRo6jn1KqvVA8B1rMV+4fMDY4BhNUEaAWoJyQLfszYe1x 935kiwXbPpgjMjG25PXj84vRHrjz4wAVmJEj1aa47syU4aOchIgeHJpJyCP6NXKSh/iw R22wpv9r8nulDwVJbDZBi63awoqd77u5uNXR+qoVZF5MpsG+YfWjW894BEDcRTFiZ9fs ki/+/ew7nyz0kV0wK4t2Gr93dkpQJRJbI7fNDZOwUQGXwOA50QGjQSVz+frNGov5YP44 aNvL6RoIhf1REk2r1TAUz/PTLx0HxGFsbIP/Cbqv8LMhLlrdzP8bYtTlr5OFyrPQfhiv xpCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=RzFA6AUh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h68si2361484pfc.35.2018.02.11.23.09.22; Sun, 11 Feb 2018 23:09:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=RzFA6AUh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932961AbeBLHJS (ORCPT + 13 others); Mon, 12 Feb 2018 02:09:18 -0500 Received: from mail-pl0-f66.google.com ([209.85.160.66]:36267 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932568AbeBLHJQ (ORCPT ); Mon, 12 Feb 2018 02:09:16 -0500 Received: by mail-pl0-f66.google.com with SMTP id v3so4636516plg.3; Sun, 11 Feb 2018 23:09:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=NwL7A4hTUadKcUHHkqCgS88GiYok4oil6lnWHhgTt2o=; b=RzFA6AUhHiq8OkWJZcN4oQDjqLfKJBwRZ1Cy5uOWUZNvxKX46zuY27DONXD2M+p3ZN qz6iSqaWJrz4bMu6sI0fJ0AFhCJBZ8mUqXFL1XZ4Bs5kLB/GkOpNGvw7ewkDLB2t7kbs gazVj4Z7kM8X8ZWasnK+UsUEFGZFB8czYq6e15w4otmrS+3jMoa3EFfw3GJzqy2CXBCU 6++g3ceVUYa3LplG+z5ZiSdTkdjUQPqzZRV8v/7x5WkMR/9ufvyR8ELCcSHTtCCLs6Uy B+Q9etMo9xqbc6Lq2Bf6L2lQUFo3cfmhShuPu2P3wsaGxeDen1WjDix83n3RcM+ZZD5Z ST2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=NwL7A4hTUadKcUHHkqCgS88GiYok4oil6lnWHhgTt2o=; b=QiqDsrLClNs2q+o1L5CpmfNKJxNcrYX/wY0ZPqQm8NxUGDHgnFaG7Weim48cPUMnHO kkEhduJj2hs1lSf17JFDXqEc7EpxlUWT0izp+/I8RFipxkae4HlYp5pvx/i/CLHs2py0 UxqEHkVOvBvEpv89la541/TxmM7Ws3yPAUreRLbumCsv6yj6XjC5kPjTKOEC40cTP0Se gcPRyCO1grK0ag8+1HYH/rimD9dqKNPEvSRg9a8c62ishr9EPT6AIiKfChTkQrC48PC2 32ssgj43xhcApmw9XVeFKMOBSzTwAJ661RuyxVGu42bK7N5zL5jurSmu7g+WusySO5cW vTEA== X-Gm-Message-State: APf1xPC5oB/CstmHAaUvTmBEjBlW8yDWH5NSqGdCk2rZAOw2ddJFwlhm p436eQMr0V6SW+80mkzyoM4= X-Received: by 2002:a17:902:868f:: with SMTP id g15-v6mr10064341plo.137.1518419355709; Sun, 11 Feb 2018 23:09:15 -0800 (PST) Received: from aurora.jms.id.au ([203.0.153.9]) by smtp.gmail.com with ESMTPSA id l10sm27934066pfc.133.2018.02.11.23.09.10 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 11 Feb 2018 23:09:15 -0800 (PST) Received: by aurora.jms.id.au (sSMTP sendmail emulation); Mon, 12 Feb 2018 17:39:07 +1030 From: Joel Stanley To: Lee Jones , Rob Herring , Mark Rutland Cc: Arnd Bergmann , Greg Kroah-Hartman , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Andrew Jeffery , Cyril Bur , Benjamin Herrenschmidt , Ryan Chen , Lei YU Subject: [PATCH 2/3] misc: aspeed-lpc: Request and enable LPC clock Date: Mon, 12 Feb 2018 17:38:46 +1030 Message-Id: <20180212070847.32387-3-joel@jms.id.au> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180212070847.32387-1-joel@jms.id.au> References: <20180212070847.32387-1-joel@jms.id.au> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The LPC device needs to ensure it's clock is enabled before it can do anything. In the past the clock was enabled and left running by u-boot, however Linux now has an upstream clock driver that disables unused clocks. Tested-by: Lei YU Reviewed-by: Andrew Jeffery Signed-off-by: Joel Stanley --- drivers/misc/aspeed-lpc-ctrl.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) -- 2.15.1 diff --git a/drivers/misc/aspeed-lpc-ctrl.c b/drivers/misc/aspeed-lpc-ctrl.c index b5439643f54b..1827b7aa6674 100644 --- a/drivers/misc/aspeed-lpc-ctrl.c +++ b/drivers/misc/aspeed-lpc-ctrl.c @@ -7,6 +7,7 @@ * 2 of the License, or (at your option) any later version. */ +#include #include #include #include @@ -26,6 +27,7 @@ struct aspeed_lpc_ctrl { struct miscdevice miscdev; struct regmap *regmap; + struct clk *clk; phys_addr_t mem_base; resource_size_t mem_size; u32 pnor_size; @@ -221,16 +223,33 @@ static int aspeed_lpc_ctrl_probe(struct platform_device *pdev) return -ENODEV; } + lpc_ctrl->clk = devm_clk_get(dev, NULL); + if (IS_ERR(lpc_ctrl->clk)) { + dev_err(dev, "couldn't get clock\n"); + return PTR_ERR(lpc_ctrl->clk); + } + rc = clk_prepare_enable(lpc_ctrl->clk); + if (rc) { + dev_err(dev, "couldn't enable clock\n"); + return rc; + } + lpc_ctrl->miscdev.minor = MISC_DYNAMIC_MINOR; lpc_ctrl->miscdev.name = DEVICE_NAME; lpc_ctrl->miscdev.fops = &aspeed_lpc_ctrl_fops; lpc_ctrl->miscdev.parent = dev; rc = misc_register(&lpc_ctrl->miscdev); - if (rc) + if (rc) { dev_err(dev, "Unable to register device\n"); - else - dev_info(dev, "Loaded at %pr\n", &resm); + goto err; + } + + dev_info(dev, "Loaded at %pr\n", &resm); + + return 0; +err: + clk_disable_unprepare(lpc_ctrl->clk); return rc; } @@ -239,6 +258,7 @@ static int aspeed_lpc_ctrl_remove(struct platform_device *pdev) struct aspeed_lpc_ctrl *lpc_ctrl = dev_get_drvdata(&pdev->dev); misc_deregister(&lpc_ctrl->miscdev); + clk_disable_unprepare(lpc_ctrl->clk); return 0; }