[PATCH linux dev-4.13 2/3] misc: aspeed-lpc: Enable clock
Joel Stanley
joel at jms.id.au
Thu Feb 8 16:37:44 AEDT 2018
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>
---
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;
}
--
2.15.1
More information about the openbmc
mailing list