Skip to contentSkip to conversation

JH7110 PMU Support

PATCH Applied Walker Chen 4 participants 9 messages Jan 19, 2023 – Jan 24, 2023 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

Walker Chen

author maintainer
#0 lore raw

v4 cover 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

Signature · 1 line
2.17.1
author maintainer
#6 lore raw

PATCH v4 2/2 soc: starfive: Add StarFive JH71XX pmu driver

Add pmu driver for the StarFive JH71XX SoC.

As the power domains provider, the Power Management Unit (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. It accepts software encourage command to switch the power mode of SoC.

---
 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 ++++++++++++++++++++++++++++++
 6 files changed, 414 insertions(+)
 create mode 100644 drivers/soc/starfive/Kconfig
 create mode 100644 drivers/soc/starfive/Makefile
 create mode 100644 drivers/soc/starfive/jh71xx_pmu.c
MAINTAINERS +14 -0
index 42fc47c6edfd..8366e1de5030 100644
@@ -19914,6 +19914,20 @@ F:	Documentation/devicetree/bindings/reset/starfive,jh7100-reset.yaml
 F:	drivers/reset/reset-starfive-jh7100.c
 F:	include/dt-bindings/reset/starfive-jh7100.h
 
+STARFIVE SOC DRIVER
+M:	Conor Dooley <[email protected]>
+S:	Maintained
+T:	git https://git.kernel.org/pub/scm/linux/kernel/git/conor/linux.git/
+F:	drivers/soc/starfive/
+F:	include/soc/starfive/
+
+STARFIVE JH71XX PMU CONTROLLER DRIVER
+M:	Walker Chen <[email protected]>
+S:	Supported
+F:	Documentation/devicetree/bindings/power/starfive*
+F:	drivers/soc/starfive/jh71xx_pmu.c
+F:	include/dt-bindings/power/starfive,jh7110-pmu.h
+
 STATIC BRANCH/CALL
 M:	Peter Zijlstra <[email protected]>
 M:	Josh Poimboeuf <[email protected]>
drivers/soc/Kconfig +1 -0
index 5dbb09f843f7..81ae4f77974b 100644
@@ -22,6 +22,7 @@ source "drivers/soc/renesas/Kconfig"
 source "drivers/soc/rockchip/Kconfig"
 source "drivers/soc/samsung/Kconfig"
 source "drivers/soc/sifive/Kconfig"
+source "drivers/soc/starfive/Kconfig"
 source "drivers/soc/sunxi/Kconfig"
 source "drivers/soc/tegra/Kconfig"
 source "drivers/soc/ti/Kconfig"
drivers/soc/Makefile +1 -0
index fff513bd522d..bc7491d9e1ed 100644
@@ -28,6 +28,7 @@ obj-y				+= renesas/
 obj-y				+= rockchip/
 obj-$(CONFIG_SOC_SAMSUNG)	+= samsung/
 obj-$(CONFIG_SOC_SIFIVE)	+= sifive/
+obj-$(CONFIG_SOC_STARFIVE)	+= starfive/
 obj-y				+= sunxi/
 obj-$(CONFIG_ARCH_TEGRA)	+= tegra/
 obj-y				+= ti/
drivers/soc/starfive/Kconfig new file +12 -0
new file mode 100644
index 000000000000..bdb96dc4c989
@@ -0,0 +1,12 @@
+# SPDX-License-Identifier: GPL-2.0
+
+config JH71XX_PMU
+	bool "Support PMU for StarFive JH71XX Soc"
+	depends on PM
+	depends on SOC_STARFIVE || COMPILE_TEST
+	default SOC_STARFIVE
+	select PM_GENERIC_DOMAINS
+	help
+	  Say 'y' here to enable support power domain support.
+	  In order to meet low power requirements, a Power Management Unit (PMU)
+	  is designed for controlling power resources in StarFive JH71XX SoCs.
drivers/soc/starfive/Makefile new file +3 -0
new file mode 100644
index 000000000000..13b589d6b5f3
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0
+
+obj-$(CONFIG_JH71XX_PMU)	+= jh71xx_pmu.o
drivers/soc/starfive/jh71xx_pmu.c new file +383 -0

383 lines not on this page · raw message

Signature · 1 line
2.17.1
author maintainer
#1 lore raw

PATCH v4 1/2 dt-bindings: power: Add starfive,jh7110-pmu

In reply to Walker Chen

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

---
 .../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
Documentation/devicetree/bindings/power/starfive,jh7110-pmu.yaml new file +45 -0
new file mode 100644
index 000000000000..98eb8b4110e7
@@ -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>;
+    };
include/dt-bindings/power/starfive,jh7110-pmu.h new file +17 -0
new file mode 100644
index 000000000000..132bfe401fc8
@@ -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
Signature · 1 line
2.17.1
Reviewed-by on v4 1/2
#2 lore raw

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

Hey Walker,

Quoted 4 lines · Walker Chen

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

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:

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.

Quoted 85 lines
---
 .../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
Documentation/devicetree/bindings/power/starfive,jh7110-pmu.yaml new file +45 -0
new file mode 100644
index 000000000000..98eb8b4110e7
@@ -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>;
+    };
include/dt-bindings/power/starfive,jh7110-pmu.h new file +17 -0
new file mode 100644
index 000000000000..132bfe401fc8
@@ -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
Signature · 1 line
2.17.1
Applied
#7 lore raw
In reply to Walker Chen

From: Conor Dooley <[email protected]>

Quoted 8 lines · Walker Chen

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.

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

author maintainer
#8 lore raw
Quoted 14 lines · Conor Dooley

From: Conor Dooley <[email protected]>

Quoted 8 lines · Walker Chen

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!

Quoted 7 lines

[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.

author maintainer
#9 lore raw
In reply to Conor Dooley
Quoted 14 lines · Conor Dooley

From: Conor Dooley <[email protected]>

Quoted 8 lines · Walker Chen

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!

Quoted 7 lines

[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

author maintainer
#5 lore raw

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

In reply to a message not in the archive
Quoted 7 lines · Heiko Stuebner

Am Donnerstag, 19. Januar 2023, 10:44:46 CET schrieb Walker Chen:

Quoted 4 lines

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

Thank you very much for your support!

Best regards,
Walker