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>
This commit is contained in:
Yixun Lan 2025-04-16 08:15:28 +08:00 committed by Linus Walleij
parent c6650433ea
commit 5a740280de

View file

@ -2,6 +2,7 @@
/* Copyright (c) 2024 Yixun Lan <dlan@gentoo.org> */
#include <linux/bits.h>
#include <linux/clk.h>
#include <linux/cleanup.h>
#include <linux/io.h>
#include <linux/of.h>
@ -721,6 +722,7 @@ static int spacemit_pinctrl_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct spacemit_pinctrl *pctrl;
struct clk *func_clk, *bus_clk;
const struct spacemit_pinctrl_data *pctrl_data;
int ret;
@ -739,6 +741,14 @@ static int spacemit_pinctrl_probe(struct platform_device *pdev)
if (IS_ERR(pctrl->regs))
return PTR_ERR(pctrl->regs);
func_clk = devm_clk_get_enabled(dev, "func");
if (IS_ERR(func_clk))
return dev_err_probe(dev, PTR_ERR(func_clk), "failed to get func clock\n");
bus_clk = devm_clk_get_enabled(dev, "bus");
if (IS_ERR(bus_clk))
return dev_err_probe(dev, PTR_ERR(bus_clk), "failed to get bus clock\n");
pctrl->pdesc.name = dev_name(dev);
pctrl->pdesc.pins = pctrl_data->pins;
pctrl->pdesc.npins = pctrl_data->npins;