[PATCH linux dev-4.13 2/3] misc: aspeed-lpc: Enable clock
Andrew Jeffery
andrew at aj.id.au
Thu Feb 8 18:46:52 AEDT 2018
On Thu, 2018-02-08 at 16:07 +1030, Joel Stanley wrote:
> The LPC device needs to ensure it's clock is enabled before it can do
> anything.
>
> Signed-off-by: Joel Stanley <joel at jms.id.au>
Reviewed-by: Andrew Jeffery <andrew at aj.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;
> + }
> +
> 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 part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: This is a digitally signed message part
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20180208/f109295a/attachment.sig>
More information about the openbmc
mailing list