2023-01-19 10:35:44

by Walker Chen

[permalink] [raw]
Subject: [PATCH v4 0/2] JH7110 PMU Support

Hello,

This patchset adds PMU (Power Management Unit) controller driver for the
StarFive JH7110 SoC. In order to meet low power requirements, PMU is
designed for including multiple PM domains that can be used for power
gating of selected IP blocks for power saving by reduced leakage
current. The first patch adds device tree binding for PM domain provider
and consumer. The second patch adds pmu driver and support JH7110 SoC.

The series has been tested on the VisionFive 2 boards which equip with
JH7110 SoC and works normally.

Changes since v3:
- Rebased on Linux 6.2-rc4.
- Dropped the statement that 'is_on' is set in error case in
jh71xx_pmu_get_state().
- Replaced dev_info() with dev_dbg() at the bottom of
jh71xx_pmu_probe().
- Added '.suppress_bind_attrs = true,' for jh71xx_pmu_driver structure.
- Dropped patch 3, which is about device tree node of pmu for jh7110.
Because it depends on the submission of others, it will be upstream
separately later.

v3: https://lore.kernel.org/all/[email protected]/

Changes since v2:
- Rebased on Linux 6.1.
- Renamed the dt-bindings 'starfive,jh71xx-power.yaml' to
'starfive,jh7110-pmu.yaml' which is matching compatible.
- Fixed wrong indentation and error when running 'make dt_binding_check'
in dt-bindings.
- Changed the license of the dt-bindings header to be same with
dt-bindings.
- Changed a little bit on dependency conditions in Kconfig of driver.
- Dropped some macros that are temporarily useless.
- Simplified the definition of macro 'JH71XX_PMU_INT_ALL_MASK'.
- Changed the sorting of structure members, such as 'struct
jh71xx_domain_info', 'struct jh71xx_pmu', etc.
- Modified detailed comment about controlling power domain.
- Dropped useless comment when running 'platform_get_irq'.

v2: https://lore.kernel.org/all/[email protected]/

Changes since v1:
- Squashed 1st patch (dt-bindings header) into 2nd which is related to
dt-bindings stuff.
- Renamed the dt-bindings header 'jh7110-power.h' to
'starfive,jh7110-pmu.h' and used dual license for it.
- Renamed the dt-bindings 'starfive,jh71xx-power.yaml' to
'starfive,jh71xx-pmu.yaml', dropped items from properties.
- Change of MAINTAINERS: added the entry of 'starfive soc drivers';
changed status to 'Supported' for the entry of
'STARFIVE JH71XX PMU CONTROLLER DRIVER' and sorted the lines alphabetically.
- Dropped the header file 'include/soc/starfive/pm_domains.h'.
- Dropped starfive_pmu_hw_event_turn_on() and starfive_pmu_hw_event_turn_off().
- Added 'default SOC_STARFIVE' and expanded help text in the Kconfig.
- Added a JH71XX_PMU_ prefix to those macro definitions in driver.
- Replaced the data type 'uint8_t / uint32_t' with 'u8 / u32'.
- Fixed some complains by using checkpatch.pl
- Added spinlock to jh71xx_pmu_int_enable().
- Dropped spinlock from jh71xx_pmu_interrupt().
- Used jh71xx_pmu_ as prefix to all functions.
- Replaced io accessors '__raw_readl / __raw_writel' with 'readl / writel'.
- Added jh71xx_pmu_get_state() to the beginning of jh71xx_pmu_set_state().
- Added more detailed comment about controlling power domain.
- Simplified the usage of loop when performing pm_genpd_init() to register
power domain.
- Added more detailed description about the features of power domain
hardware to commit message in 2nd patch.
- Replaced dev_info() with dev_dbg() in jh71xx_pmu_set_state().
- Decreased the timeout numbers of polling power status when switching
power mode.

v1: https://lore.kernel.org/all/[email protected]/

Best regards,
Walker

Walker Chen (2):
dt-bindings: power: Add starfive,jh7110-pmu
soc: starfive: Add StarFive JH71XX pmu driver

.../bindings/power/starfive,jh7110-pmu.yaml | 45 ++
MAINTAINERS | 14 +
drivers/soc/Kconfig | 1 +
drivers/soc/Makefile | 1 +
drivers/soc/starfive/Kconfig | 12 +
drivers/soc/starfive/Makefile | 3 +
drivers/soc/starfive/jh71xx_pmu.c | 383 ++++++++++++++++++
.../dt-bindings/power/starfive,jh7110-pmu.h | 17 +
8 files changed, 476 insertions(+)
create mode 100644 Documentation/devicetree/bindings/power/starfive,jh7110-pmu.yaml
create mode 100644 drivers/soc/starfive/Kconfig
create mode 100644 drivers/soc/starfive/Makefile
create mode 100644 drivers/soc/starfive/jh71xx_pmu.c
create mode 100644 include/dt-bindings/power/starfive,jh7110-pmu.h


base-commit: 5dc4c995db9eb45f6373a956eb1f69460e69e6d4
--
2.17.1


2023-01-19 10:56:27

by Walker Chen

[permalink] [raw]
Subject: [PATCH v4 1/2] dt-bindings: power: Add starfive,jh7110-pmu

Add bindings for the Power Management Unit on the StarFive JH7110 SoC.

Signed-off-by: Walker Chen <[email protected]>
Reviewed-by: Krzysztof Kozlowski <[email protected]>
---
.../bindings/power/starfive,jh7110-pmu.yaml | 45 +++++++++++++++++++
.../dt-bindings/power/starfive,jh7110-pmu.h | 17 +++++++
2 files changed, 62 insertions(+)
create mode 100644 Documentation/devicetree/bindings/power/starfive,jh7110-pmu.yaml
create mode 100644 include/dt-bindings/power/starfive,jh7110-pmu.h

diff --git a/Documentation/devicetree/bindings/power/starfive,jh7110-pmu.yaml b/Documentation/devicetree/bindings/power/starfive,jh7110-pmu.yaml
new file mode 100644
index 000000000000..98eb8b4110e7
--- /dev/null
+++ b/Documentation/devicetree/bindings/power/starfive,jh7110-pmu.yaml
@@ -0,0 +1,45 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/power/starfive,jh7110-pmu.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: StarFive JH7110 Power Management Unit
+
+maintainers:
+ - Walker Chen <[email protected]>
+
+description: |
+ StarFive JH7110 SoC includes support for multiple power domains which can be
+ powered on/off by software based on different application scenes to save power.
+
+properties:
+ compatible:
+ enum:
+ - starfive,jh7110-pmu
+
+ reg:
+ maxItems: 1
+
+ interrupts:
+ maxItems: 1
+
+ "#power-domain-cells":
+ const: 1
+
+required:
+ - compatible
+ - reg
+ - interrupts
+ - "#power-domain-cells"
+
+additionalProperties: false
+
+examples:
+ - |
+ pwrc: power-controller@17030000 {
+ compatible = "starfive,jh7110-pmu";
+ reg = <0x17030000 0x10000>;
+ interrupts = <111>;
+ #power-domain-cells = <1>;
+ };
diff --git a/include/dt-bindings/power/starfive,jh7110-pmu.h b/include/dt-bindings/power/starfive,jh7110-pmu.h
new file mode 100644
index 000000000000..132bfe401fc8
--- /dev/null
+++ b/include/dt-bindings/power/starfive,jh7110-pmu.h
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
+/*
+ * Copyright (C) 2022 StarFive Technology Co., Ltd.
+ * Author: Walker Chen <[email protected]>
+ */
+#ifndef __DT_BINDINGS_POWER_JH7110_POWER_H__
+#define __DT_BINDINGS_POWER_JH7110_POWER_H__
+
+#define JH7110_PD_SYSTOP 0
+#define JH7110_PD_CPU 1
+#define JH7110_PD_GPUA 2
+#define JH7110_PD_VDEC 3
+#define JH7110_PD_VOUT 4
+#define JH7110_PD_ISP 5
+#define JH7110_PD_VENC 6
+
+#endif
--
2.17.1

2023-01-19 12:19:00

by Heiko Stübner

[permalink] [raw]
Subject: Re: [PATCH v4 1/2] dt-bindings: power: Add starfive,jh7110-pmu

Am Donnerstag, 19. Januar 2023, 10:44:46 CET schrieb Walker Chen:
> Add bindings for the Power Management Unit on the StarFive JH7110 SoC.
>
> Signed-off-by: Walker Chen <[email protected]>
> Reviewed-by: Krzysztof Kozlowski <[email protected]>

Reviewed-by: Heiko Stuebner <[email protected]>


2023-01-19 12:21:55

by Conor Dooley

[permalink] [raw]
Subject: Re: [PATCH v4 1/2] dt-bindings: power: Add starfive,jh7110-pmu

Hey Walker,

On Thu, Jan 19, 2023 at 05:44:46PM +0800, Walker Chen wrote:
> Add bindings for the Power Management Unit on the StarFive JH7110 SoC.
>
> Signed-off-by: Walker Chen <[email protected]>
> Reviewed-by: Krzysztof Kozlowski <[email protected]>

Just FYI, an R-b given against the cover letter can usually be applied
to all patches in the series, unless otherwise stated.
So here's mine from v3:
Reviewed-by: Conor Dooley <[email protected]>

Whenever you re-submit the dts patch, you can send that with my R-b
already applied there too.
I'll give this a day or two for the build bots to look at it before
applying it.

Thanks,
Conor.

> ---
> .../bindings/power/starfive,jh7110-pmu.yaml | 45 +++++++++++++++++++
> .../dt-bindings/power/starfive,jh7110-pmu.h | 17 +++++++
> 2 files changed, 62 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/power/starfive,jh7110-pmu.yaml
> create mode 100644 include/dt-bindings/power/starfive,jh7110-pmu.h
>
> diff --git a/Documentation/devicetree/bindings/power/starfive,jh7110-pmu.yaml b/Documentation/devicetree/bindings/power/starfive,jh7110-pmu.yaml
> new file mode 100644
> index 000000000000..98eb8b4110e7
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/power/starfive,jh7110-pmu.yaml
> @@ -0,0 +1,45 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/power/starfive,jh7110-pmu.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: StarFive JH7110 Power Management Unit
> +
> +maintainers:
> + - Walker Chen <[email protected]>
> +
> +description: |
> + StarFive JH7110 SoC includes support for multiple power domains which can be
> + powered on/off by software based on different application scenes to save power.
> +
> +properties:
> + compatible:
> + enum:
> + - starfive,jh7110-pmu
> +
> + reg:
> + maxItems: 1
> +
> + interrupts:
> + maxItems: 1
> +
> + "#power-domain-cells":
> + const: 1
> +
> +required:
> + - compatible
> + - reg
> + - interrupts
> + - "#power-domain-cells"
> +
> +additionalProperties: false
> +
> +examples:
> + - |
> + pwrc: power-controller@17030000 {
> + compatible = "starfive,jh7110-pmu";
> + reg = <0x17030000 0x10000>;
> + interrupts = <111>;
> + #power-domain-cells = <1>;
> + };
> diff --git a/include/dt-bindings/power/starfive,jh7110-pmu.h b/include/dt-bindings/power/starfive,jh7110-pmu.h
> new file mode 100644
> index 000000000000..132bfe401fc8
> --- /dev/null
> +++ b/include/dt-bindings/power/starfive,jh7110-pmu.h
> @@ -0,0 +1,17 @@
> +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
> +/*
> + * Copyright (C) 2022 StarFive Technology Co., Ltd.
> + * Author: Walker Chen <[email protected]>
> + */
> +#ifndef __DT_BINDINGS_POWER_JH7110_POWER_H__
> +#define __DT_BINDINGS_POWER_JH7110_POWER_H__
> +
> +#define JH7110_PD_SYSTOP 0
> +#define JH7110_PD_CPU 1
> +#define JH7110_PD_GPUA 2
> +#define JH7110_PD_VDEC 3
> +#define JH7110_PD_VOUT 4
> +#define JH7110_PD_ISP 5
> +#define JH7110_PD_VENC 6
> +
> +#endif
> --
> 2.17.1
>
>


Attachments:
(No filename) (3.23 kB)
signature.asc (235.00 B)
Download all attachments

2023-01-20 22:30:55

by Conor Dooley

[permalink] [raw]
Subject: Re: [PATCH v4 0/2] JH7110 PMU Support

From: Conor Dooley <[email protected]>

On Thu, 19 Jan 2023 17:44:45 +0800, Walker Chen wrote:
> This patchset adds PMU (Power Management Unit) controller driver for the
> StarFive JH7110 SoC. In order to meet low power requirements, PMU is
> designed for including multiple PM domains that can be used for power
> gating of selected IP blocks for power saving by reduced leakage
> current. The first patch adds device tree binding for PM domain provider
> and consumer. The second patch adds pmu driver and support JH7110 SoC.
>
> [...]

Applied to riscv-soc-for-next, thanks!

[1/2] dt-bindings: power: Add starfive,jh7110-pmu
https://git.kernel.org/conor/c/1fc7606d5083f79a20eb9cfd77c0dbd9299421c1
[2/2] soc: starfive: Add StarFive JH71XX pmu driver
https://git.kernel.org/conor/c/08b9a94e8654d402bfd1f5496b077503d69aa2cf

I modified the MAINTAINERS entry to remove the include directory that
was deleted along the way.

Thanks,
Conor.

2023-01-24 05:20:41

by Walker Chen

[permalink] [raw]
Subject: Re: [PATCH v4 0/2] JH7110 PMU Support

On 2023/1/21 6:21, Conor Dooley wrote:
> From: Conor Dooley <[email protected]>
>
> On Thu, 19 Jan 2023 17:44:45 +0800, Walker Chen wrote:
>> This patchset adds PMU (Power Management Unit) controller driver for the
>> StarFive JH7110 SoC. In order to meet low power requirements, PMU is
>> designed for including multiple PM domains that can be used for power
>> gating of selected IP blocks for power saving by reduced leakage
>> current. The first patch adds device tree binding for PM domain provider
>> and consumer. The second patch adds pmu driver and support JH7110 SoC.
>>
>> [...]
>
> Applied to riscv-soc-for-next, thanks!
>
> [1/2] dt-bindings: power: Add starfive,jh7110-pmu
> https://git.kernel.org/conor/c/1fc7606d5083f79a20eb9cfd77c0dbd9299421c1
> [2/2] soc: starfive: Add StarFive JH71XX pmu driver
> https://git.kernel.org/conor/c/08b9a94e8654d402bfd1f5496b077503d69aa2cf
>
> I modified the MAINTAINERS entry to remove the include directory that
> was deleted along the way.

Thank you so much for your support, Conor, Krzysztof, Emil, Heiko, Rob Herring, etc.
Hopefully more and more drivers & modules of StarFive SoC will upstream to the open source community.


2023-01-24 05:25:17

by Walker Chen

[permalink] [raw]
Subject: Re: [PATCH v4 0/2] JH7110 PMU Support

On 2023/1/21 6:21, Conor Dooley wrote:
> From: Conor Dooley <[email protected]>
>
> On Thu, 19 Jan 2023 17:44:45 +0800, Walker Chen wrote:
>> This patchset adds PMU (Power Management Unit) controller driver for the
>> StarFive JH7110 SoC. In order to meet low power requirements, PMU is
>> designed for including multiple PM domains that can be used for power
>> gating of selected IP blocks for power saving by reduced leakage
>> current. The first patch adds device tree binding for PM domain provider
>> and consumer. The second patch adds pmu driver and support JH7110 SoC.
>>
>> [...]
>
> Applied to riscv-soc-for-next, thanks!
>
> [1/2] dt-bindings: power: Add starfive,jh7110-pmu
> https://git.kernel.org/conor/c/1fc7606d5083f79a20eb9cfd77c0dbd9299421c1
> [2/2] soc: starfive: Add StarFive JH71XX pmu driver
> https://git.kernel.org/conor/c/08b9a94e8654d402bfd1f5496b077503d69aa2cf
>
> I modified the MAINTAINERS entry to remove the include directory that
> was deleted along the way.

Great news!

Thank you so much for your support, Conor, Krzysztof, Emil, Heiko, Rob Herring and so on.
Hopefully more and more drivers & modules of StarFive SoC will upstream to the open source community.

Best regards,
Walker Chen


2023-01-24 05:28:02

by Walker Chen

[permalink] [raw]
Subject: Re: [PATCH v4 1/2] dt-bindings: power: Add starfive,jh7110-pmu

On 2023/1/19 19:59, Heiko Stuebner wrote:
> Am Donnerstag, 19. Januar 2023, 10:44:46 CET schrieb Walker Chen:
>> Add bindings for the Power Management Unit on the StarFive JH7110 SoC.
>>
>> Signed-off-by: Walker Chen <[email protected]>
>> Reviewed-by: Krzysztof Kozlowski <[email protected]>
>
> Reviewed-by: Heiko Stuebner <[email protected]>

Thank you very much for your support!

Best regards,
Walker