From: Cyril Bur <cyrilbur@gmail.com>
To: Joel Stanley <joel@jms.id.au>, openbmc@lists.ozlabs.org
Cc: Lei YU <mine260309@gmail.com>, Andrew Jeffery <andrew@aj.id.au>
Subject: Re: [PATCH linux dev-4.13 v2 2/4] misc: aspeed-lpc: Request and enable LPC clock
Date: Mon, 12 Feb 2018 09:55:51 +1100 [thread overview]
Message-ID: <1518389751.6054.5.camel@gmail.com> (raw)
In-Reply-To: <20180209051158.32354-3-joel@jms.id.au>
On Fri, 2018-02-09 at 15:41 +1030, Joel Stanley wrote:
> The LPC device needs to ensure it's clock is enabled before it can do
> anything.
>
> Tested-by: Lei YU <mine260309@gmail.com>
> Reviewed-by: Andrew Jeffery <andrew@aj.id.au>
> Signed-off-by: Joel Stanley <joel@jms.id.au>
> ---
> drivers/misc/aspeed-lpc-ctrl.c | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/drivers/misc/aspeed-lpc-ctrl.c b/drivers/misc/aspeed-lpc-ctrl.c
> index b5439643f54b..4a818ad3827e 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 <linux/clk.h>
> #include <linux/mfd/syscon.h>
> #include <linux/miscdevice.h>
> #include <linux/mm.h>
> @@ -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;
> @@ -180,6 +182,17 @@ static int aspeed_lpc_ctrl_probe(struct platform_device *pdev)
> if (!lpc_ctrl)
> return -ENOMEM;
>
> + 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;
> + }
> +
Hi Joel,
Shouldn't you be calling clk_disable_unprepare() on error cases in the
rest of aspeed_lpc_ctrl_probe()?
Cyril
> node = of_parse_phandle(dev->of_node, "flash", 0);
> if (!node) {
> dev_err(dev, "Didn't find host pnor flash node\n");
> @@ -239,6 +252,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;
> }
next prev parent reply other threads:[~2018-02-11 22:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-09 5:11 [PATCH linux dev-4.13 v2 0/4] LPC fixes Joel Stanley
2018-02-09 5:11 ` [PATCH linux dev-4.13 v2 1/4] ARM: dts: aspeed: Add LPC clock phandles Joel Stanley
2018-02-09 5:11 ` [PATCH linux dev-4.13 v2 2/4] misc: aspeed-lpc: Request and enable LPC clock Joel Stanley
2018-02-11 22:55 ` Cyril Bur [this message]
2018-02-09 5:11 ` [PATCH linux dev-4.13 v2 3/4] dt-bindings: aspeed-lpc: Document LPC Host Interface Controller Joel Stanley
2018-02-12 0:05 ` Andrew Jeffery
2018-02-09 5:11 ` [PATCH linux dev-4.13 v2 4/4] misc: aspeed-lpc-ctrl: Enable FWH and A2H bridge cycles Joel Stanley
2018-02-12 0:06 ` Andrew Jeffery
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1518389751.6054.5.camel@gmail.com \
--to=cyrilbur@gmail.com \
--cc=andrew@aj.id.au \
--cc=joel@jms.id.au \
--cc=mine260309@gmail.com \
--cc=openbmc@lists.ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.