Skip to content

Commit 5a74028

Browse files
dlan17Linus Walleij
authored andcommitted
pinctrl: spacemit: add clock support for K1 SoC
For SpacemiT K1 SoC's pinctrl, explicitly acquiring clocks in the driver instead of relying on bootloader or default hardware settings to enable it. Signed-off-by: Yixun Lan <dlan@gentoo.org> Reviewed-by: Alex Elder <elder@riscstar.com> Link: https://lore.kernel.org/20250416-02-k1-pinctrl-clk-v2-2-2b5fcbd4183c@gentoo.org Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
1 parent c665043 commit 5a74028

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

drivers/pinctrl/spacemit/pinctrl-k1.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
/* Copyright (c) 2024 Yixun Lan <dlan@gentoo.org> */
33

44
#include <linux/bits.h>
5+
#include <linux/clk.h>
56
#include <linux/cleanup.h>
67
#include <linux/io.h>
78
#include <linux/of.h>
@@ -721,6 +722,7 @@ static int spacemit_pinctrl_probe(struct platform_device *pdev)
721722
{
722723
struct device *dev = &pdev->dev;
723724
struct spacemit_pinctrl *pctrl;
725+
struct clk *func_clk, *bus_clk;
724726
const struct spacemit_pinctrl_data *pctrl_data;
725727
int ret;
726728

@@ -739,6 +741,14 @@ static int spacemit_pinctrl_probe(struct platform_device *pdev)
739741
if (IS_ERR(pctrl->regs))
740742
return PTR_ERR(pctrl->regs);
741743

744+
func_clk = devm_clk_get_enabled(dev, "func");
745+
if (IS_ERR(func_clk))
746+
return dev_err_probe(dev, PTR_ERR(func_clk), "failed to get func clock\n");
747+
748+
bus_clk = devm_clk_get_enabled(dev, "bus");
749+
if (IS_ERR(bus_clk))
750+
return dev_err_probe(dev, PTR_ERR(bus_clk), "failed to get bus clock\n");
751+
742752
pctrl->pdesc.name = dev_name(dev);
743753
pctrl->pdesc.pins = pctrl_data->pins;
744754
pctrl->pdesc.npins = pctrl_data->npins;

0 commit comments

Comments
 (0)