Skip to contentSkip to conversation

soc: amlogic: add support for Meson GX VPU Domains

PATCH RESEND Superseded Neil Armstrong 3 participants 6 messages Oct 28, 2017 – Oct 30, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover soc: amlogic: add support for Meson GX VPU Domains

[Resent with linux-pm in CC]

On the Amlogic Gx SoCs (GXBB, GXL & GXM), the VPU power domain is initialized by the vendor U-Boot code, but running mainline U-boot has been possible on these SoCs. But lacking such init made the system lock at kernel boot.

This patchset adds the Video Processing Unit power domain driver to enable the same power-on and power-down sequences and was designed to allow booting with the power domain already initialized or not.

This driver has been tested on :
- Odroid-C2 (GXBB) with Vendor and Mainline U-Boot
- P212 (GXL) with Vendor and Mainline U-Boot
- Khadas Vim (GXL) with Vendor U-Boot
- Khadas Vim2 with (GXM) Vendor U-Boot

Changes since v1:
- fixed bindings compatible string

Neil Armstrong (2):
soc: amlogic: add Meson GX VPU Domains driver
dt-bindings: power: add amlogic meson power domain bindings

 .../bindings/power/amlogic,meson-gx-pwrc.txt       |  61 ++++++
 drivers/soc/amlogic/Kconfig                        |  10 +
 drivers/soc/amlogic/Makefile                       |   1 +
 drivers/soc/amlogic/meson-gx-pwrc-vpu.c            | 234 +++++++++++++++++++++
 4 files changed, 306 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/power/amlogic,meson-gx-pwrc.txt
 create mode 100644 drivers/soc/amlogic/meson-gx-pwrc-vpu.c
Signature · 1 line
2.7.4
#1 lore raw

PATCH RESEND v2 1/2 soc: amlogic: add Meson GX VPU Domains driver

The Video Processing Unit needs a specific Power Domain powering scheme this driver handles this as a PM Power Domain driver.

---
 drivers/soc/amlogic/Kconfig             |  10 ++
 drivers/soc/amlogic/Makefile            |   1 +
 drivers/soc/amlogic/meson-gx-pwrc-vpu.c | 234 ++++++++++++++++++++++++++++++++
 3 files changed, 245 insertions(+)
 create mode 100644 drivers/soc/amlogic/meson-gx-pwrc-vpu.c
drivers/soc/amlogic/Kconfig +10 -0
index ef0b8f6..1621bb2 100644
@@ -9,6 +9,16 @@ config MESON_GX_SOCINFO
 	  Say yes to support decoding of Amlogic Meson GX SoC family
 	  information about the type, package and version.
 
+config MESON_GX_PM_DOMAINS
+	bool "Amlogic Meson GX Power Domains driver"
+	depends on ARCH_MESON || COMPILE_TEST
+	default ARCH_MESON
+	select PM_GENERIC_DOMAINS
+	select PM_GENERIC_DOMAINS_OF
+	help
+	  Say yes to expose Amlogic Meson GX Power Domains as
+	  Generic Power Domains.
+
 config MESON_MX_SOCINFO
 	bool "Amlogic Meson MX SoC Information driver"
 	depends on ARCH_MESON || COMPILE_TEST
drivers/soc/amlogic/Makefile +1 -0
index 1f5df50..8fa3218 100644
@@ -1,2 +1,3 @@
 obj-$(CONFIG_MESON_GX_SOCINFO) += meson-gx-socinfo.o
+obj-$(CONFIG_MESON_GX_PM_DOMAINS) += meson-gx-pwrc-vpu.o
 obj-$(CONFIG_MESON_MX_SOCINFO) += meson-mx-socinfo.o
drivers/soc/amlogic/meson-gx-pwrc-vpu.c new file +234 -0

234 lines not on this page · raw message

Signature · 1 line
2.7.4
#5 lore raw

PATCH RESEND v2 2/2 dt-bindings: power: add amlogic meson power domain bindings

In reply to Neil Armstrong
---
 .../bindings/power/amlogic,meson-gx-pwrc.txt       | 61 ++++++++++++++++++++++
 1 file changed, 61 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/power/amlogic,meson-gx-pwrc.txt
Documentation/devicetree/bindings/power/amlogic,meson-gx-pwrc.txt new file +61 -0
new file mode 100644
index 0000000..95ec49a
@@ -0,0 +1,61 @@
+Amlogic Meson Power Controller
+==============================
+
+The Amlogic Meson SoCs embeds an internal Power domain controller.
+
+VPU Power Domain
+----------------
+
+The Video Processing Unit power domain is controlled by this power controller,
+but the domain requires some external resources to meet the correct power
+sequences.
+The bindings must respect the power domain bindings as described in the file
+power_domain.txt
+
+Device Tree Bindings:
+---------------------
+
+Required properties:
+- compatible: should be "amlogic,meson-gx-pwrc-vpu" for the Meson GX SoCs
+- #power-domain-cells: should be 0
+- amlogic,hhi-sysctrl: phandle to the HHI sysctrl node
+- resets: phandles to the reset lines needed for this power demain sequence
+	as described in ../reset/reset.txt
+- clocks: from common clock binding: handle to VPU and VAPB clocks
+- clock-names: from common clock binding: must contain "vpu", "vapb"
+	corresponding to entry in the clocks property.
+
+Parent node should have the following properties :
+- compatible: "amlogic,meson-gx-ao-sysctrl", "syscon", "simple-mfd"
+- reg: base address and size of the AO system control register space.
+
+Example:
+-------
+
+ao_sysctrl: sys-ctrl at 0 {
+	compatible = "amlogic,meson-gx-ao-sysctrl", "syscon", "simple-mfd";
+	reg =  <0x0 0x0 0x0 0x100>;
+
+	pwrc_vpu: power-controller-vpu {
+		compatible = "amlogic,meson-gx-pwrc-vpu";
+		#power-domain-cells = <0>;
+		amlogic,hhi-sysctrl = <&sysctrl>;
+		resets = <&reset RESET_VIU>,
+			 <&reset RESET_VENC>,
+			 <&reset RESET_VCBUS>,
+			 <&reset RESET_BT656>,
+			 <&reset RESET_DVIN_RESET>,
+			 <&reset RESET_RDMA>,
+			 <&reset RESET_VENCI>,
+			 <&reset RESET_VENCP>,
+		 	 <&reset RESET_VDAC>,
+		 	 <&reset RESET_VDI6>,
+		 	 <&reset RESET_VENCL>,
+			 <&reset RESET_VID_LOCK>;
+		clocks = <&clkc CLKID_VPU>,
+			 <&clkc CLKID_VAPB>;
+		clock-names = "vpu", "vapb";
+	};
+};
+
+
Signature · 1 line
2.7.4
#2 lore raw

Re: [RESEND PATCH v2 1/2] soc: amlogic: add Meson GX VPU Domains driver

In reply to Neil Armstrong

Hi Neil,

[...]

drivers/soc/amlogic/meson-gx-pwrc-vpu.c line 210

Quoted 4 lines
drivers/soc/amlogic/meson-gx-pwrc-vpu.c new file +4 -0
+
+       pm_genpd_init(&vpu_hdmi_pd.genpd, &simple_qos_governor,
+                     meson_gx_pwrc_vpu_get_power(&vpu_hdmi_pd));
+

This means that you may initialize the genpd in powered on state.

For that scenario, I think you will hit a clock unprepare/disable in-balance issue when genpd calls your ->power_off() callback, simply because you didn't call clk_prepare_enable() for the clocks first.

[...]

Kind regards
Uffe

#3 lore raw

Re: [RESEND PATCH v2 1/2] soc: amlogic: add Meson GX VPU Domains driver

Quoted 11 lines · Ulf Hansson

Hi Neil,

[...]

drivers/soc/amlogic/meson-gx-pwrc-vpu.c line 210

Quoted 4 lines
drivers/soc/amlogic/meson-gx-pwrc-vpu.c new file +4 -0
+
+       pm_genpd_init(&vpu_hdmi_pd.genpd, &simple_qos_governor,
+                     meson_gx_pwrc_vpu_get_power(&vpu_hdmi_pd));
+

This means that you may initialize the genpd in powered on state.

Quoted 9 lines

For that scenario, I think you will hit a clock unprepare/disable in-balance issue when genpd calls your ->power_off() callback, simply because you didn't call clk_prepare_enable() for the clocks first.

[...]

Kind regards
Uffe

Hi,

I added a "powered" attribute to trace if power-on was done by the driver, but I only protected the shutdown call.... I should indeed protect it in the power_off call instead.

Neil

maintainer
#4 lore raw

Re: [RESEND PATCH v2 1/2] soc: amlogic: add Meson GX VPU Domains driver

In reply to Ulf Hansson
Quoted 11 lines · Ulf Hansson

Hi Neil,

[...]

drivers/soc/amlogic/meson-gx-pwrc-vpu.c line 210

Quoted 4 lines
drivers/soc/amlogic/meson-gx-pwrc-vpu.c new file +4 -0
+
+       pm_genpd_init(&vpu_hdmi_pd.genpd, &simple_qos_governor,
+                     meson_gx_pwrc_vpu_get_power(&vpu_hdmi_pd));
+

This means that you may initialize the genpd in powered on state.

Quoted 3 lines

For that scenario, I think you will hit a clock unprepare/disable in-balance issue when genpd calls your ->power_off() callback, simply because you didn't call clk_prepare_enable() for the clocks first.

Yup, in my testing, I definitely hit this.

Kevin