* [PATCH v2 0/2] pinctrl: spacemit: add clock/reset support
@ 2025-04-16 0:15 Yixun Lan
2025-04-16 0:15 ` [PATCH v2 1/2] dt-bindings: pinctrl: spacemit: add clock and reset property Yixun Lan
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Yixun Lan @ 2025-04-16 0:15 UTC (permalink / raw)
To: Linus Walleij, Rob Herring, Krzysztof Kozlowski, Conor Dooley
Cc: linux-gpio, devicetree, linux-riscv, spacemit, linux-kernel,
Yixun Lan
SpacemiT K1 pinctrl requires two clocks in order to be functional,
also one reset line from hardware persepective.
In this series, adding clock property in dt-binding, and activate
them in the driver. But for reset, making it optional for now.
For DT part patch, I plan to submit after clock driver merged.
This may result dtb warnings in this version due to the mising
clock property in pinctrl dt node.
Signed-off-by: Yixun Lan <dlan@gentoo.org>
---
Changes in v2:
- fix typo
- drop the _optional_ API
- Link to v1: https://lore.kernel.org/r/20250412-02-k1-pinctrl-clk-v1-0-e39734419a2d@gentoo.org
---
Yixun Lan (2):
dt-bindings: pinctrl: spacemit: add clock and reset property
pinctrl: spacemit: add clock support for K1 SoC
.../bindings/pinctrl/spacemit,k1-pinctrl.yaml | 18 ++++++++++++++++++
drivers/pinctrl/spacemit/pinctrl-k1.c | 10 ++++++++++
2 files changed, 28 insertions(+)
---
base-commit: 0af2f6be1b4281385b618cb86ad946eded089ac8
change-id: 20250412-02-k1-pinctrl-clk-9649d6ad22c4
Best regards,
--
Yixun Lan
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2 1/2] dt-bindings: pinctrl: spacemit: add clock and reset property
2025-04-16 0:15 [PATCH v2 0/2] pinctrl: spacemit: add clock/reset support Yixun Lan
@ 2025-04-16 0:15 ` Yixun Lan
2025-04-21 19:11 ` Alex Elder
2025-04-21 19:11 ` Rob Herring (Arm)
2025-04-16 0:15 ` [PATCH v2 2/2] pinctrl: spacemit: add clock support for K1 SoC Yixun Lan
` (2 subsequent siblings)
3 siblings, 2 replies; 8+ messages in thread
From: Yixun Lan @ 2025-04-16 0:15 UTC (permalink / raw)
To: Linus Walleij, Rob Herring, Krzysztof Kozlowski, Conor Dooley
Cc: linux-gpio, devicetree, linux-riscv, spacemit, linux-kernel,
Yixun Lan
SpacemiT K1 SoC's pinctrl controller requires two clocks in order
to work properly, also has one reset line from hardware perspective.
Signed-off-by: Yixun Lan <dlan@gentoo.org>
---
.../bindings/pinctrl/spacemit,k1-pinctrl.yaml | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/Documentation/devicetree/bindings/pinctrl/spacemit,k1-pinctrl.yaml b/Documentation/devicetree/bindings/pinctrl/spacemit,k1-pinctrl.yaml
index b01ecd83b71b5e9f47256adde23bc8b183bef05e..d80e88aa07b45f4a3d90e8217caf93d32655927d 100644
--- a/Documentation/devicetree/bindings/pinctrl/spacemit,k1-pinctrl.yaml
+++ b/Documentation/devicetree/bindings/pinctrl/spacemit,k1-pinctrl.yaml
@@ -17,6 +17,19 @@ properties:
items:
- description: pinctrl io memory base
+ clocks:
+ items:
+ - description: Functional Clock
+ - description: Bus Clock
+
+ clock-names:
+ items:
+ - const: func
+ - const: bus
+
+ resets:
+ maxItems: 1
+
patternProperties:
'-cfg$':
type: object
@@ -94,6 +107,8 @@ patternProperties:
required:
- compatible
- reg
+ - clocks
+ - clock-names
additionalProperties: false
@@ -108,6 +123,9 @@ examples:
pinctrl@d401e000 {
compatible = "spacemit,k1-pinctrl";
reg = <0x0 0xd401e000 0x0 0x400>;
+ clocks = <&syscon_apbc 42>,
+ <&syscon_apbc 94>;
+ clock-names = "func", "bus";
uart0_2_cfg: uart0-2-cfg {
uart0-2-pins {
--
2.49.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2 2/2] pinctrl: spacemit: add clock support for K1 SoC
2025-04-16 0:15 [PATCH v2 0/2] pinctrl: spacemit: add clock/reset support Yixun Lan
2025-04-16 0:15 ` [PATCH v2 1/2] dt-bindings: pinctrl: spacemit: add clock and reset property Yixun Lan
@ 2025-04-16 0:15 ` Yixun Lan
2025-04-21 19:11 ` Alex Elder
2025-04-18 23:59 ` [PATCH v2 0/2] pinctrl: spacemit: add clock/reset support Yixun Lan
2025-04-23 8:39 ` Linus Walleij
3 siblings, 1 reply; 8+ messages in thread
From: Yixun Lan @ 2025-04-16 0:15 UTC (permalink / raw)
To: Linus Walleij, Rob Herring, Krzysztof Kozlowski, Conor Dooley
Cc: linux-gpio, devicetree, linux-riscv, spacemit, linux-kernel,
Yixun Lan
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>
---
drivers/pinctrl/spacemit/pinctrl-k1.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/pinctrl/spacemit/pinctrl-k1.c b/drivers/pinctrl/spacemit/pinctrl-k1.c
index 67e867b04a02ea1887d93aedfdea5bda037f88b1..9996b1c4a07e72f2a3832b759feddcd4e07f2159 100644
--- a/drivers/pinctrl/spacemit/pinctrl-k1.c
+++ b/drivers/pinctrl/spacemit/pinctrl-k1.c
@@ -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;
--
2.49.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v2 0/2] pinctrl: spacemit: add clock/reset support
2025-04-16 0:15 [PATCH v2 0/2] pinctrl: spacemit: add clock/reset support Yixun Lan
2025-04-16 0:15 ` [PATCH v2 1/2] dt-bindings: pinctrl: spacemit: add clock and reset property Yixun Lan
2025-04-16 0:15 ` [PATCH v2 2/2] pinctrl: spacemit: add clock support for K1 SoC Yixun Lan
@ 2025-04-18 23:59 ` Yixun Lan
2025-04-23 8:39 ` Linus Walleij
3 siblings, 0 replies; 8+ messages in thread
From: Yixun Lan @ 2025-04-18 23:59 UTC (permalink / raw)
To: Linus Walleij, Rob Herring, Krzysztof Kozlowski, Conor Dooley
Cc: linux-gpio, devicetree, linux-riscv, spacemit, linux-kernel
Hi Linus,
On 08:15 Wed 16 Apr , Yixun Lan wrote:
> SpacemiT K1 pinctrl requires two clocks in order to be functional,
> also one reset line from hardware persepective.
>
> In this series, adding clock property in dt-binding, and activate
> them in the driver. But for reset, making it optional for now.
>
> For DT part patch, I plan to submit after clock driver merged.
> This may result dtb warnings in this version due to the mising
> clock property in pinctrl dt node.
>
> Signed-off-by: Yixun Lan <dlan@gentoo.org>
> ---
> Changes in v2:
> - fix typo
> - drop the _optional_ API
> - Link to v1: https://lore.kernel.org/r/20250412-02-k1-pinctrl-clk-v1-0-e39734419a2d@gentoo.org
>
> ---
> Yixun Lan (2):
> dt-bindings: pinctrl: spacemit: add clock and reset property
> pinctrl: spacemit: add clock support for K1 SoC
>
> .../bindings/pinctrl/spacemit,k1-pinctrl.yaml | 18 ++++++++++++++++++
> drivers/pinctrl/spacemit/pinctrl-k1.c | 10 ++++++++++
> 2 files changed, 28 insertions(+)
> ---
> base-commit: 0af2f6be1b4281385b618cb86ad946eded089ac8
> change-id: 20250412-02-k1-pinctrl-clk-9649d6ad22c4
>
I think this series is good to go, can you queue for 6.16,
we need it along with clock merged (see link below)..
thanks
https://lore.kernel.org/r/174484549885.160158.3249067849153986093.b4-ty@gentoo.org
--
Yixun Lan (dlan)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 1/2] dt-bindings: pinctrl: spacemit: add clock and reset property
2025-04-16 0:15 ` [PATCH v2 1/2] dt-bindings: pinctrl: spacemit: add clock and reset property Yixun Lan
@ 2025-04-21 19:11 ` Alex Elder
2025-04-21 19:11 ` Rob Herring (Arm)
1 sibling, 0 replies; 8+ messages in thread
From: Alex Elder @ 2025-04-21 19:11 UTC (permalink / raw)
To: Yixun Lan, Linus Walleij, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: linux-gpio, devicetree, linux-riscv, spacemit, linux-kernel
On 4/15/25 7:15 PM, Yixun Lan wrote:
> SpacemiT K1 SoC's pinctrl controller requires two clocks in order
> to work properly, also has one reset line from hardware perspective.
You mention the reset line here but that isn't implemented
by this patch (or the next).
I assume the reset series will be merged soon, and if that's
the case, maybe you can add two more patches to incorporate
that in the next version of this series.
Other than the description, this looks good to me. You'll
want one of the DT maintainers to sign off, though.
-Alex
>
> Signed-off-by: Yixun Lan <dlan@gentoo.org>
> ---
> .../bindings/pinctrl/spacemit,k1-pinctrl.yaml | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/pinctrl/spacemit,k1-pinctrl.yaml b/Documentation/devicetree/bindings/pinctrl/spacemit,k1-pinctrl.yaml
> index b01ecd83b71b5e9f47256adde23bc8b183bef05e..d80e88aa07b45f4a3d90e8217caf93d32655927d 100644
> --- a/Documentation/devicetree/bindings/pinctrl/spacemit,k1-pinctrl.yaml
> +++ b/Documentation/devicetree/bindings/pinctrl/spacemit,k1-pinctrl.yaml
> @@ -17,6 +17,19 @@ properties:
> items:
> - description: pinctrl io memory base
>
> + clocks:
> + items:
> + - description: Functional Clock
> + - description: Bus Clock
> +
> + clock-names:
> + items:
> + - const: func
> + - const: bus
> +
> + resets:
> + maxItems: 1
> +
> patternProperties:
> '-cfg$':
> type: object
> @@ -94,6 +107,8 @@ patternProperties:
> required:
> - compatible
> - reg
> + - clocks
> + - clock-names
>
> additionalProperties: false
>
> @@ -108,6 +123,9 @@ examples:
> pinctrl@d401e000 {
> compatible = "spacemit,k1-pinctrl";
> reg = <0x0 0xd401e000 0x0 0x400>;
> + clocks = <&syscon_apbc 42>,
> + <&syscon_apbc 94>;
> + clock-names = "func", "bus";
>
> uart0_2_cfg: uart0-2-cfg {
> uart0-2-pins {
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 2/2] pinctrl: spacemit: add clock support for K1 SoC
2025-04-16 0:15 ` [PATCH v2 2/2] pinctrl: spacemit: add clock support for K1 SoC Yixun Lan
@ 2025-04-21 19:11 ` Alex Elder
0 siblings, 0 replies; 8+ messages in thread
From: Alex Elder @ 2025-04-21 19:11 UTC (permalink / raw)
To: Yixun Lan, Linus Walleij, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: linux-gpio, devicetree, linux-riscv, spacemit, linux-kernel
On 4/15/25 7:15 PM, Yixun Lan wrote:
> 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>
It might be nice at some point to set the clock rates
to whatever is preferred. But this looks good to me.
Reviewed-by: Alex Elder <elder@riscstar.com>
> ---
> drivers/pinctrl/spacemit/pinctrl-k1.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/drivers/pinctrl/spacemit/pinctrl-k1.c b/drivers/pinctrl/spacemit/pinctrl-k1.c
> index 67e867b04a02ea1887d93aedfdea5bda037f88b1..9996b1c4a07e72f2a3832b759feddcd4e07f2159 100644
> --- a/drivers/pinctrl/spacemit/pinctrl-k1.c
> +++ b/drivers/pinctrl/spacemit/pinctrl-k1.c
> @@ -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;
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 1/2] dt-bindings: pinctrl: spacemit: add clock and reset property
2025-04-16 0:15 ` [PATCH v2 1/2] dt-bindings: pinctrl: spacemit: add clock and reset property Yixun Lan
2025-04-21 19:11 ` Alex Elder
@ 2025-04-21 19:11 ` Rob Herring (Arm)
1 sibling, 0 replies; 8+ messages in thread
From: Rob Herring (Arm) @ 2025-04-21 19:11 UTC (permalink / raw)
To: Yixun Lan
Cc: Conor Dooley, spacemit, Krzysztof Kozlowski, Linus Walleij,
linux-gpio, devicetree, linux-riscv, linux-kernel
On Wed, 16 Apr 2025 08:15:27 +0800, Yixun Lan wrote:
> SpacemiT K1 SoC's pinctrl controller requires two clocks in order
> to work properly, also has one reset line from hardware perspective.
>
> Signed-off-by: Yixun Lan <dlan@gentoo.org>
> ---
> .../bindings/pinctrl/spacemit,k1-pinctrl.yaml | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 0/2] pinctrl: spacemit: add clock/reset support
2025-04-16 0:15 [PATCH v2 0/2] pinctrl: spacemit: add clock/reset support Yixun Lan
` (2 preceding siblings ...)
2025-04-18 23:59 ` [PATCH v2 0/2] pinctrl: spacemit: add clock/reset support Yixun Lan
@ 2025-04-23 8:39 ` Linus Walleij
3 siblings, 0 replies; 8+ messages in thread
From: Linus Walleij @ 2025-04-23 8:39 UTC (permalink / raw)
To: Yixun Lan
Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, linux-gpio,
devicetree, linux-riscv, spacemit, linux-kernel
On Wed, Apr 16, 2025 at 2:15 AM Yixun Lan <dlan@gentoo.org> wrote:
> SpacemiT K1 pinctrl requires two clocks in order to be functional,
> also one reset line from hardware persepective.
>
> In this series, adding clock property in dt-binding, and activate
> them in the driver. But for reset, making it optional for now.
>
> For DT part patch, I plan to submit after clock driver merged.
> This may result dtb warnings in this version due to the mising
> clock property in pinctrl dt node.
>
> Signed-off-by: Yixun Lan <dlan@gentoo.org>
Patches applied!
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2025-04-23 8:39 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-16 0:15 [PATCH v2 0/2] pinctrl: spacemit: add clock/reset support Yixun Lan
2025-04-16 0:15 ` [PATCH v2 1/2] dt-bindings: pinctrl: spacemit: add clock and reset property Yixun Lan
2025-04-21 19:11 ` Alex Elder
2025-04-21 19:11 ` Rob Herring (Arm)
2025-04-16 0:15 ` [PATCH v2 2/2] pinctrl: spacemit: add clock support for K1 SoC Yixun Lan
2025-04-21 19:11 ` Alex Elder
2025-04-18 23:59 ` [PATCH v2 0/2] pinctrl: spacemit: add clock/reset support Yixun Lan
2025-04-23 8:39 ` Linus Walleij
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).