* [PATCH v1 0/6] Fix RK3588 GPU domain
@ 2024-09-10 17:57 Sebastian Reichel
2024-09-10 17:57 ` [PATCH v1 1/6] pmdomain: rockchip: forward rockchip_do_pmu_set_power_domain errors Sebastian Reichel
` (7 more replies)
0 siblings, 8 replies; 17+ messages in thread
From: Sebastian Reichel @ 2024-09-10 17:57 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner,
Ulf Hansson
Cc: Elaine Zhang, Adrián Martínez Larumbe, Boris Brezillon,
devicetree, linux-rockchip, linux-kernel, linux-pm,
Sebastian Reichel, kernel
Hi,
I got a report, that the Linux kernel crashes on Rock 5B when the panthor
driver is loaded late after booting. The crash starts with the following
shortened error print:
rockchip-pm-domain fd8d8000.power-management:power-controller: failed to set domain 'gpu', val=0
rockchip-pm-domain fd8d8000.power-management:power-controller: failed to get ack on domain 'gpu', val=0xa9fff
SError Interrupt on CPU4, code 0x00000000be000411 -- SError
This series first does some cleanups in the Rockchip power domain
driver and changes the driver, so that it no longer tries to continue
when it fails to enable a domain. This gets rid of the SError interrupt
and long backtraces. But the kernel still hangs when it fails to enable
a power domain. I have not done further analysis to check if that can
be avoided.
Last but not least this provides a fix for the GPU power domain failing
to get enabled - after some testing from my side it seems to require the
GPU voltage supply to be enabled.
I'm not really happy about the hack to get a regulator for a sub-node
in the 5th patch, which I took over from the Mediatek driver. But to
get things going and open a discussion around it I thought it would be
best to send a first version as soon as possible.
Greetings,
-- Sebastian
Sebastian Reichel (6):
pmdomain: rockchip: forward rockchip_do_pmu_set_power_domain errors
pmdomain: rockchip: cleanup mutex handling in rockchip_pd_power
pmdomain: rockchip: reduce indention in rockchip_pd_power
dt-bindings: power: rockchip: add regulator support
pmdomain: rockchip: add regulator support
arm64: dts: rockchip: Add GPU power domain regulator dependency for
RK3588
.../power/rockchip,power-controller.yaml | 3 +
.../boot/dts/rockchip/rk3588-armsom-sige7.dts | 4 +
arch/arm64/boot/dts/rockchip/rk3588-base.dtsi | 2 +-
.../boot/dts/rockchip/rk3588-coolpi-cm5.dtsi | 4 +
.../rockchip/rk3588-friendlyelec-cm3588.dtsi | 4 +
.../arm64/boot/dts/rockchip/rk3588-jaguar.dts | 4 +
.../boot/dts/rockchip/rk3588-ok3588-c.dts | 4 +
.../boot/dts/rockchip/rk3588-rock-5-itx.dts | 4 +
.../boot/dts/rockchip/rk3588-rock-5b.dts | 4 +
.../arm64/boot/dts/rockchip/rk3588-tiger.dtsi | 4 +
.../boot/dts/rockchip/rk3588s-coolpi-4b.dts | 4 +
.../dts/rockchip/rk3588s-khadas-edge2.dts | 4 +
.../boot/dts/rockchip/rk3588s-orangepi-5.dts | 4 +
drivers/pmdomain/rockchip/pm-domains.c | 130 +++++++++++++-----
14 files changed, 144 insertions(+), 35 deletions(-)
--
2.45.2
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH v1 1/6] pmdomain: rockchip: forward rockchip_do_pmu_set_power_domain errors
2024-09-10 17:57 [PATCH v1 0/6] Fix RK3588 GPU domain Sebastian Reichel
@ 2024-09-10 17:57 ` Sebastian Reichel
2024-09-10 18:21 ` Heiko Stübner
2024-09-10 17:57 ` [PATCH v1 2/6] pmdomain: rockchip: cleanup mutex handling in rockchip_pd_power Sebastian Reichel
` (6 subsequent siblings)
7 siblings, 1 reply; 17+ messages in thread
From: Sebastian Reichel @ 2024-09-10 17:57 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner,
Ulf Hansson
Cc: Elaine Zhang, Adrián Martínez Larumbe, Boris Brezillon,
devicetree, linux-rockchip, linux-kernel, linux-pm,
Sebastian Reichel, kernel
Currently rockchip_do_pmu_set_power_domain prints a warning if there
have been errors turning on the power domain, but it does not return
any errors and rockchip_pd_power() tries to continue setting up the
QOS registers. This usually results in accessing unpowered registers,
which triggers an SError and a full system hang.
This improves the error handling by forwarding the error to avoid
kernel panics.
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
---
drivers/pmdomain/rockchip/pm-domains.c | 35 +++++++++++++++++---------
1 file changed, 23 insertions(+), 12 deletions(-)
diff --git a/drivers/pmdomain/rockchip/pm-domains.c b/drivers/pmdomain/rockchip/pm-domains.c
index 9b76b62869d0..0f44d698475b 100644
--- a/drivers/pmdomain/rockchip/pm-domains.c
+++ b/drivers/pmdomain/rockchip/pm-domains.c
@@ -488,16 +488,17 @@ static int rockchip_pmu_domain_mem_reset(struct rockchip_pm_domain *pd)
return ret;
}
-static void rockchip_do_pmu_set_power_domain(struct rockchip_pm_domain *pd,
- bool on)
+static int rockchip_do_pmu_set_power_domain(struct rockchip_pm_domain *pd,
+ bool on)
{
struct rockchip_pmu *pmu = pd->pmu;
struct generic_pm_domain *genpd = &pd->genpd;
u32 pd_pwr_offset = pd->info->pwr_offset;
bool is_on, is_mem_on = false;
+ int ret;
if (pd->info->pwr_mask == 0)
- return;
+ return 0;
if (on && pd->info->mem_status_mask)
is_mem_on = rockchip_pmu_domain_is_mem_on(pd);
@@ -512,16 +513,21 @@ static void rockchip_do_pmu_set_power_domain(struct rockchip_pm_domain *pd,
wmb();
- if (is_mem_on && rockchip_pmu_domain_mem_reset(pd))
- return;
+ if (is_mem_on) {
+ ret = rockchip_pmu_domain_mem_reset(pd);
+ if (ret)
+ return ret;
+ }
- if (readx_poll_timeout_atomic(rockchip_pmu_domain_is_on, pd, is_on,
- is_on == on, 0, 10000)) {
- dev_err(pmu->dev,
- "failed to set domain '%s', val=%d\n",
- genpd->name, is_on);
- return;
+ ret = readx_poll_timeout_atomic(rockchip_pmu_domain_is_on, pd, is_on,
+ is_on == on, 0, 10000);
+ if (ret) {
+ dev_err(pmu->dev, "failed to set domain '%s' %s, val=%d\n",
+ genpd->name, on ? "on" : "off", is_on);
+ return ret;
}
+
+ return 0;
}
static int rockchip_pd_power(struct rockchip_pm_domain *pd, bool power_on)
@@ -546,7 +552,12 @@ static int rockchip_pd_power(struct rockchip_pm_domain *pd, bool power_on)
rockchip_pmu_set_idle_request(pd, true);
}
- rockchip_do_pmu_set_power_domain(pd, power_on);
+ ret = rockchip_do_pmu_set_power_domain(pd, power_on);
+ if (ret < 0) {
+ clk_bulk_disable(pd->num_clks, pd->clks);
+ mutex_unlock(&pmu->mutex);
+ return ret;
+ }
if (power_on) {
/* if powering up, leave idle mode */
--
2.45.2
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH v1 2/6] pmdomain: rockchip: cleanup mutex handling in rockchip_pd_power
2024-09-10 17:57 [PATCH v1 0/6] Fix RK3588 GPU domain Sebastian Reichel
2024-09-10 17:57 ` [PATCH v1 1/6] pmdomain: rockchip: forward rockchip_do_pmu_set_power_domain errors Sebastian Reichel
@ 2024-09-10 17:57 ` Sebastian Reichel
2024-09-10 18:23 ` Heiko Stübner
2024-09-10 17:57 ` [PATCH v1 3/6] pmdomain: rockchip: reduce indention " Sebastian Reichel
` (5 subsequent siblings)
7 siblings, 1 reply; 17+ messages in thread
From: Sebastian Reichel @ 2024-09-10 17:57 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner,
Ulf Hansson
Cc: Elaine Zhang, Adrián Martínez Larumbe, Boris Brezillon,
devicetree, linux-rockchip, linux-kernel, linux-pm,
Sebastian Reichel, kernel
Use the cleanup infrastructure to handle the mutex, which
slightly improve code readability for this function.
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
---
drivers/pmdomain/rockchip/pm-domains.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/pmdomain/rockchip/pm-domains.c b/drivers/pmdomain/rockchip/pm-domains.c
index 0f44d698475b..5e5291dedd28 100644
--- a/drivers/pmdomain/rockchip/pm-domains.c
+++ b/drivers/pmdomain/rockchip/pm-domains.c
@@ -535,13 +535,12 @@ static int rockchip_pd_power(struct rockchip_pm_domain *pd, bool power_on)
struct rockchip_pmu *pmu = pd->pmu;
int ret;
- mutex_lock(&pmu->mutex);
+ guard(mutex)(&pmu->mutex);
if (rockchip_pmu_domain_is_on(pd) != power_on) {
ret = clk_bulk_enable(pd->num_clks, pd->clks);
if (ret < 0) {
dev_err(pmu->dev, "failed to enable clocks\n");
- mutex_unlock(&pmu->mutex);
return ret;
}
@@ -555,7 +554,6 @@ static int rockchip_pd_power(struct rockchip_pm_domain *pd, bool power_on)
ret = rockchip_do_pmu_set_power_domain(pd, power_on);
if (ret < 0) {
clk_bulk_disable(pd->num_clks, pd->clks);
- mutex_unlock(&pmu->mutex);
return ret;
}
@@ -569,7 +567,6 @@ static int rockchip_pd_power(struct rockchip_pm_domain *pd, bool power_on)
clk_bulk_disable(pd->num_clks, pd->clks);
}
- mutex_unlock(&pmu->mutex);
return 0;
}
--
2.45.2
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH v1 3/6] pmdomain: rockchip: reduce indention in rockchip_pd_power
2024-09-10 17:57 [PATCH v1 0/6] Fix RK3588 GPU domain Sebastian Reichel
2024-09-10 17:57 ` [PATCH v1 1/6] pmdomain: rockchip: forward rockchip_do_pmu_set_power_domain errors Sebastian Reichel
2024-09-10 17:57 ` [PATCH v1 2/6] pmdomain: rockchip: cleanup mutex handling in rockchip_pd_power Sebastian Reichel
@ 2024-09-10 17:57 ` Sebastian Reichel
2024-09-10 18:26 ` Heiko Stübner
2024-09-10 17:57 ` [PATCH v1 4/6] dt-bindings: power: rockchip: add regulator support Sebastian Reichel
` (4 subsequent siblings)
7 siblings, 1 reply; 17+ messages in thread
From: Sebastian Reichel @ 2024-09-10 17:57 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner,
Ulf Hansson
Cc: Elaine Zhang, Adrián Martínez Larumbe, Boris Brezillon,
devicetree, linux-rockchip, linux-kernel, linux-pm,
Sebastian Reichel, kernel
Rework the logic, so that the function exits early when the
power domain state is already correct to reduce code indention.
No functional change intended.
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
---
drivers/pmdomain/rockchip/pm-domains.c | 45 +++++++++++++-------------
1 file changed, 23 insertions(+), 22 deletions(-)
diff --git a/drivers/pmdomain/rockchip/pm-domains.c b/drivers/pmdomain/rockchip/pm-domains.c
index 5e5291dedd28..663d390faaeb 100644
--- a/drivers/pmdomain/rockchip/pm-domains.c
+++ b/drivers/pmdomain/rockchip/pm-domains.c
@@ -537,36 +537,37 @@ static int rockchip_pd_power(struct rockchip_pm_domain *pd, bool power_on)
guard(mutex)(&pmu->mutex);
- if (rockchip_pmu_domain_is_on(pd) != power_on) {
- ret = clk_bulk_enable(pd->num_clks, pd->clks);
- if (ret < 0) {
- dev_err(pmu->dev, "failed to enable clocks\n");
- return ret;
- }
+ if (rockchip_pmu_domain_is_on(pd) == power_on)
+ return 0;
- if (!power_on) {
- rockchip_pmu_save_qos(pd);
+ ret = clk_bulk_enable(pd->num_clks, pd->clks);
+ if (ret < 0) {
+ dev_err(pmu->dev, "failed to enable clocks\n");
+ return ret;
+ }
- /* if powering down, idle request to NIU first */
- rockchip_pmu_set_idle_request(pd, true);
- }
+ if (!power_on) {
+ rockchip_pmu_save_qos(pd);
- ret = rockchip_do_pmu_set_power_domain(pd, power_on);
- if (ret < 0) {
- clk_bulk_disable(pd->num_clks, pd->clks);
- return ret;
- }
+ /* if powering down, idle request to NIU first */
+ rockchip_pmu_set_idle_request(pd, true);
+ }
- if (power_on) {
- /* if powering up, leave idle mode */
- rockchip_pmu_set_idle_request(pd, false);
+ ret = rockchip_do_pmu_set_power_domain(pd, power_on);
+ if (ret < 0) {
+ clk_bulk_disable(pd->num_clks, pd->clks);
+ return ret;
+ }
- rockchip_pmu_restore_qos(pd);
- }
+ if (power_on) {
+ /* if powering up, leave idle mode */
+ rockchip_pmu_set_idle_request(pd, false);
- clk_bulk_disable(pd->num_clks, pd->clks);
+ rockchip_pmu_restore_qos(pd);
}
+ clk_bulk_disable(pd->num_clks, pd->clks);
+
return 0;
}
--
2.45.2
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH v1 4/6] dt-bindings: power: rockchip: add regulator support
2024-09-10 17:57 [PATCH v1 0/6] Fix RK3588 GPU domain Sebastian Reichel
` (2 preceding siblings ...)
2024-09-10 17:57 ` [PATCH v1 3/6] pmdomain: rockchip: reduce indention " Sebastian Reichel
@ 2024-09-10 17:57 ` Sebastian Reichel
2024-09-10 18:52 ` Heiko Stübner
2024-09-11 17:38 ` Rob Herring (Arm)
2024-09-10 17:57 ` [PATCH v1 5/6] pmdomain: " Sebastian Reichel
` (3 subsequent siblings)
7 siblings, 2 replies; 17+ messages in thread
From: Sebastian Reichel @ 2024-09-10 17:57 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner,
Ulf Hansson
Cc: Elaine Zhang, Adrián Martínez Larumbe, Boris Brezillon,
devicetree, linux-rockchip, linux-kernel, linux-pm,
Sebastian Reichel, kernel
Add optional support for a voltage supply required to enable a
power domain. The binding follows the way it is handled by the
Mediatek binding to keep things consistent.
This will initially be used by the RK3588 GPU power domain, which
fails to be enabled when the GPU regulator is not enabled.
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
---
.../devicetree/bindings/power/rockchip,power-controller.yaml | 3 +++
1 file changed, 3 insertions(+)
diff --git a/Documentation/devicetree/bindings/power/rockchip,power-controller.yaml b/Documentation/devicetree/bindings/power/rockchip,power-controller.yaml
index 0d5e999a58f1..0b4c5b174812 100644
--- a/Documentation/devicetree/bindings/power/rockchip,power-controller.yaml
+++ b/Documentation/devicetree/bindings/power/rockchip,power-controller.yaml
@@ -131,6 +131,9 @@ $defs:
A number of phandles to clocks that need to be enabled
while power domain switches state.
+ domain-supply:
+ description: domain regulator supply.
+
pm_qos:
$ref: /schemas/types.yaml#/definitions/phandle-array
items:
--
2.45.2
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH v1 5/6] pmdomain: rockchip: add regulator support
2024-09-10 17:57 [PATCH v1 0/6] Fix RK3588 GPU domain Sebastian Reichel
` (3 preceding siblings ...)
2024-09-10 17:57 ` [PATCH v1 4/6] dt-bindings: power: rockchip: add regulator support Sebastian Reichel
@ 2024-09-10 17:57 ` Sebastian Reichel
2024-09-11 9:46 ` Heiko Stübner
2024-09-16 12:37 ` Heiko Stuebner
2024-09-10 17:57 ` [PATCH v1 6/6] arm64: dts: rockchip: Add GPU power domain regulator dependency for RK3588 Sebastian Reichel
` (2 subsequent siblings)
7 siblings, 2 replies; 17+ messages in thread
From: Sebastian Reichel @ 2024-09-10 17:57 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner,
Ulf Hansson
Cc: Elaine Zhang, Adrián Martínez Larumbe, Boris Brezillon,
devicetree, linux-rockchip, linux-kernel, linux-pm,
Sebastian Reichel, kernel
Some power domains require extra voltages to be applied. For example
trying to enable the GPU domain on RK3588 fails when the SoC does not
have VDD GPU enabled.
The solution to temporarily change the device's device tree node has
been taken over from the Mediatek power domain driver.
The regulator is not acquired at probe time, since that creates circular
dependencies. The power domain driver must be probed early, since SoC
peripherals need it. Regulators on the other hand depend on SoC
peripherals like SPI, I2C or GPIO.
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
---
drivers/pmdomain/rockchip/pm-domains.c | 57 +++++++++++++++++++++++++-
1 file changed, 55 insertions(+), 2 deletions(-)
diff --git a/drivers/pmdomain/rockchip/pm-domains.c b/drivers/pmdomain/rockchip/pm-domains.c
index 663d390faaeb..ae6990897928 100644
--- a/drivers/pmdomain/rockchip/pm-domains.c
+++ b/drivers/pmdomain/rockchip/pm-domains.c
@@ -18,6 +18,7 @@
#include <linux/of_clk.h>
#include <linux/clk.h>
#include <linux/regmap.h>
+#include <linux/regulator/consumer.h>
#include <linux/mfd/syscon.h>
#include <soc/rockchip/pm_domains.h>
#include <dt-bindings/power/px30-power.h>
@@ -89,6 +90,8 @@ struct rockchip_pm_domain {
u32 *qos_save_regs[MAX_QOS_REGS_NUM];
int num_clks;
struct clk_bulk_data *clks;
+ struct device_node *node;
+ struct regulator *supply;
};
struct rockchip_pmu {
@@ -571,18 +574,67 @@ static int rockchip_pd_power(struct rockchip_pm_domain *pd, bool power_on)
return 0;
}
+static int rockchip_pd_regulator_disable(struct rockchip_pm_domain *pd)
+{
+ return pd->supply ? regulator_disable(pd->supply) : 0;
+}
+
+
+static int rockchip_pd_regulator_enable(struct rockchip_pm_domain *pd)
+{
+ struct rockchip_pmu *pmu = pd->pmu;
+ struct device_node *main_node;
+
+ if (!pd->supply) {
+ /*
+ * Find regulator in current power domain node.
+ * devm_regulator_get() finds regulator in a node and its child
+ * node, so set of_node to current power domain node then change
+ * back to original node after regulator is found for current
+ * power domain node.
+ */
+ main_node = pmu->dev->of_node;
+ pmu->dev->of_node = pd->node;
+ pd->supply = devm_regulator_get(pmu->dev, "domain");
+ pmu->dev->of_node = main_node;
+ if (IS_ERR(pd->supply)) {
+ pd->supply = NULL;
+ return 0;
+ }
+ }
+
+ return regulator_enable(pd->supply);
+}
+
static int rockchip_pd_power_on(struct generic_pm_domain *domain)
{
struct rockchip_pm_domain *pd = to_rockchip_pd(domain);
+ int ret;
+
+ ret = rockchip_pd_regulator_enable(pd);
+ if (ret) {
+ dev_err(pd->pmu->dev, "Failed to enable supply: %d\n", ret);
+ return ret;
+ }
- return rockchip_pd_power(pd, true);
+ ret = rockchip_pd_power(pd, true);
+ if (ret)
+ rockchip_pd_regulator_disable(pd);
+
+ return ret;
}
static int rockchip_pd_power_off(struct generic_pm_domain *domain)
{
struct rockchip_pm_domain *pd = to_rockchip_pd(domain);
+ int ret;
- return rockchip_pd_power(pd, false);
+ ret = rockchip_pd_power(pd, false);
+ if (ret)
+ return ret;
+
+ rockchip_pd_regulator_disable(pd);
+ return ret;
}
static int rockchip_pd_attach_dev(struct generic_pm_domain *genpd,
@@ -663,6 +715,7 @@ static int rockchip_pm_add_one_domain(struct rockchip_pmu *pmu,
pd->info = pd_info;
pd->pmu = pmu;
+ pd->node = node;
pd->num_clks = of_clk_get_parent_count(node);
if (pd->num_clks > 0) {
--
2.45.2
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH v1 6/6] arm64: dts: rockchip: Add GPU power domain regulator dependency for RK3588
2024-09-10 17:57 [PATCH v1 0/6] Fix RK3588 GPU domain Sebastian Reichel
` (4 preceding siblings ...)
2024-09-10 17:57 ` [PATCH v1 5/6] pmdomain: " Sebastian Reichel
@ 2024-09-10 17:57 ` Sebastian Reichel
2024-09-13 11:59 ` [PATCH v1 0/6] Fix RK3588 GPU domain Ulf Hansson
2024-09-16 15:45 ` Adrián Martínez Larumbe
7 siblings, 0 replies; 17+ messages in thread
From: Sebastian Reichel @ 2024-09-10 17:57 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner,
Ulf Hansson
Cc: Elaine Zhang, Adrián Martínez Larumbe, Boris Brezillon,
devicetree, linux-rockchip, linux-kernel, linux-pm,
Sebastian Reichel, kernel
Enabling the GPU power domain requires that the GPU regulator is
enabled. The regulator is enabled at boot time, but automatically
gets disabled when there are no users.
If the GPU driver is not probed at boot time or rebound while
the system is running the system will try to enable the power
domain before the regulator is enabled resulting in a failure
hanging the whole system. Avoid this by adding an explicit
dependency.
Reported-by: Adrián Martínez Larumbe <adrian.larumbe@collabora.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
---
arch/arm64/boot/dts/rockchip/rk3588-armsom-sige7.dts | 4 ++++
arch/arm64/boot/dts/rockchip/rk3588-base.dtsi | 2 +-
arch/arm64/boot/dts/rockchip/rk3588-coolpi-cm5.dtsi | 4 ++++
arch/arm64/boot/dts/rockchip/rk3588-friendlyelec-cm3588.dtsi | 4 ++++
arch/arm64/boot/dts/rockchip/rk3588-jaguar.dts | 4 ++++
arch/arm64/boot/dts/rockchip/rk3588-ok3588-c.dts | 4 ++++
arch/arm64/boot/dts/rockchip/rk3588-rock-5-itx.dts | 4 ++++
arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts | 4 ++++
arch/arm64/boot/dts/rockchip/rk3588-tiger.dtsi | 4 ++++
arch/arm64/boot/dts/rockchip/rk3588s-coolpi-4b.dts | 4 ++++
arch/arm64/boot/dts/rockchip/rk3588s-khadas-edge2.dts | 4 ++++
arch/arm64/boot/dts/rockchip/rk3588s-orangepi-5.dts | 4 ++++
12 files changed, 45 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/boot/dts/rockchip/rk3588-armsom-sige7.dts b/arch/arm64/boot/dts/rockchip/rk3588-armsom-sige7.dts
index c667704ba985..00a1cd96781d 100644
--- a/arch/arm64/boot/dts/rockchip/rk3588-armsom-sige7.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3588-armsom-sige7.dts
@@ -286,6 +286,10 @@ &pcie3x4 {
status = "okay";
};
+&pd_gpu {
+ domain-supply = <&vdd_gpu_s0>;
+};
+
&pinctrl {
hym8563 {
hym8563_int: hym8563-int {
diff --git a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
index d23c610dda02..214955a78a01 100644
--- a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
@@ -861,7 +861,7 @@ power-domain@RK3588_PD_NPU2 {
};
};
/* These power domains are grouped by VD_GPU */
- power-domain@RK3588_PD_GPU {
+ pd_gpu: power-domain@RK3588_PD_GPU {
reg = <RK3588_PD_GPU>;
clocks = <&cru CLK_GPU>,
<&cru CLK_GPU_COREGROUP>,
diff --git a/arch/arm64/boot/dts/rockchip/rk3588-coolpi-cm5.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-coolpi-cm5.dtsi
index fde8b228f2c7..cf9d75159ba6 100644
--- a/arch/arm64/boot/dts/rockchip/rk3588-coolpi-cm5.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3588-coolpi-cm5.dtsi
@@ -277,6 +277,10 @@ &pcie2x1l2 {
status = "okay";
};
+&pd_gpu {
+ domain-supply = <&vdd_gpu_s0>;
+};
+
&pinctrl {
hym8563 {
hym8563_int: hym8563-int {
diff --git a/arch/arm64/boot/dts/rockchip/rk3588-friendlyelec-cm3588.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-friendlyelec-cm3588.dtsi
index e3a9598b99fc..1af0a30866f6 100644
--- a/arch/arm64/boot/dts/rockchip/rk3588-friendlyelec-cm3588.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3588-friendlyelec-cm3588.dtsi
@@ -256,6 +256,10 @@ &pcie2x1l2 {
status = "okay";
};
+&pd_gpu {
+ domain-supply = <&vdd_gpu_s0>;
+};
+
&pinctrl {
gpio-leds {
led_sys_pin: led-sys-pin {
diff --git a/arch/arm64/boot/dts/rockchip/rk3588-jaguar.dts b/arch/arm64/boot/dts/rockchip/rk3588-jaguar.dts
index 31d2f8994f85..3cefaf830229 100644
--- a/arch/arm64/boot/dts/rockchip/rk3588-jaguar.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3588-jaguar.dts
@@ -403,6 +403,10 @@ &pcie3x4 {
status = "okay";
};
+&pd_gpu {
+ domain-supply = <&vdd_gpu_s0>;
+};
+
&pinctrl {
emmc {
emmc_reset: emmc-reset {
diff --git a/arch/arm64/boot/dts/rockchip/rk3588-ok3588-c.dts b/arch/arm64/boot/dts/rockchip/rk3588-ok3588-c.dts
index c2a08bdf09e8..a9c1fed929fd 100644
--- a/arch/arm64/boot/dts/rockchip/rk3588-ok3588-c.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3588-ok3588-c.dts
@@ -312,6 +312,10 @@ &pcie3x4 {
status = "okay";
};
+&pd_gpu {
+ domain-supply = <&vdd_gpu_s0>;
+};
+
&pinctrl {
pcie2 {
pcie2_0_rst: pcie2-0-rst {
diff --git a/arch/arm64/boot/dts/rockchip/rk3588-rock-5-itx.dts b/arch/arm64/boot/dts/rockchip/rk3588-rock-5-itx.dts
index d0b922b8d67e..0eadf4fb4ba4 100644
--- a/arch/arm64/boot/dts/rockchip/rk3588-rock-5-itx.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3588-rock-5-itx.dts
@@ -530,6 +530,10 @@ &pcie3x4 {
status = "okay";
};
+&pd_gpu {
+ domain-supply = <&vdd_gpu_s0>;
+};
+
&pinctrl {
hym8563 {
rtc_int: rtc-int {
diff --git a/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts b/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts
index 8f7a59918db7..717504383d46 100644
--- a/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts
@@ -465,6 +465,10 @@ &pcie3x4 {
status = "okay";
};
+&pd_gpu {
+ domain-supply = <&vdd_gpu_s0>;
+};
+
&pinctrl {
hdmirx {
hdmirx_hpd: hdmirx-5v-detection {
diff --git a/arch/arm64/boot/dts/rockchip/rk3588-tiger.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-tiger.dtsi
index 615094bb8ba3..1b5c4a7fd5c6 100644
--- a/arch/arm64/boot/dts/rockchip/rk3588-tiger.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3588-tiger.dtsi
@@ -317,6 +317,10 @@ &pcie3x4 {
reset-gpios = <&gpio3 RK_PB6 GPIO_ACTIVE_HIGH>;
};
+&pd_gpu {
+ domain-supply = <&vdd_gpu_s0>;
+};
+
&pinctrl {
emmc {
emmc_reset: emmc-reset {
diff --git a/arch/arm64/boot/dts/rockchip/rk3588s-coolpi-4b.dts b/arch/arm64/boot/dts/rockchip/rk3588s-coolpi-4b.dts
index 074c316a9a69..d938db0e2239 100644
--- a/arch/arm64/boot/dts/rockchip/rk3588s-coolpi-4b.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3588s-coolpi-4b.dts
@@ -329,6 +329,10 @@ &pcie2x1l2 {
status = "okay";
};
+&pd_gpu {
+ domain-supply = <&vdd_gpu_s0>;
+};
+
&pinctrl {
hym8563 {
hym8563_int: hym8563-int {
diff --git a/arch/arm64/boot/dts/rockchip/rk3588s-khadas-edge2.dts b/arch/arm64/boot/dts/rockchip/rk3588s-khadas-edge2.dts
index dbddfc3bb464..d29d404417ee 100644
--- a/arch/arm64/boot/dts/rockchip/rk3588s-khadas-edge2.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3588s-khadas-edge2.dts
@@ -233,6 +233,10 @@ hym8563: rtc@51 {
};
};
+&pd_gpu {
+ domain-supply = <&vdd_gpu_s0>;
+};
+
&pinctrl {
vdd_sd {
vdd_sd_en: vdd-sd-en {
diff --git a/arch/arm64/boot/dts/rockchip/rk3588s-orangepi-5.dts b/arch/arm64/boot/dts/rockchip/rk3588s-orangepi-5.dts
index feea6b20a6bf..ef3a721d1fc7 100644
--- a/arch/arm64/boot/dts/rockchip/rk3588s-orangepi-5.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3588s-orangepi-5.dts
@@ -297,6 +297,10 @@ &pcie2x1l2 {
status = "okay";
};
+&pd_gpu {
+ domain-supply = <&vdd_gpu_s0>;
+};
+
&pinctrl {
gpio-func {
leds_gpio: leds-gpio {
--
2.45.2
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH v1 1/6] pmdomain: rockchip: forward rockchip_do_pmu_set_power_domain errors
2024-09-10 17:57 ` [PATCH v1 1/6] pmdomain: rockchip: forward rockchip_do_pmu_set_power_domain errors Sebastian Reichel
@ 2024-09-10 18:21 ` Heiko Stübner
0 siblings, 0 replies; 17+ messages in thread
From: Heiko Stübner @ 2024-09-10 18:21 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Ulf Hansson,
Sebastian Reichel
Cc: Elaine Zhang, Adrián Martínez Larumbe, Boris Brezillon,
devicetree, linux-rockchip, linux-kernel, linux-pm,
Sebastian Reichel, kernel
Am Dienstag, 10. September 2024, 19:57:10 CEST schrieb Sebastian Reichel:
> Currently rockchip_do_pmu_set_power_domain prints a warning if there
> have been errors turning on the power domain, but it does not return
> any errors and rockchip_pd_power() tries to continue setting up the
> QOS registers. This usually results in accessing unpowered registers,
> which triggers an SError and a full system hang.
>
> This improves the error handling by forwarding the error to avoid
> kernel panics.
>
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
more error handling is always better :-)
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v1 2/6] pmdomain: rockchip: cleanup mutex handling in rockchip_pd_power
2024-09-10 17:57 ` [PATCH v1 2/6] pmdomain: rockchip: cleanup mutex handling in rockchip_pd_power Sebastian Reichel
@ 2024-09-10 18:23 ` Heiko Stübner
0 siblings, 0 replies; 17+ messages in thread
From: Heiko Stübner @ 2024-09-10 18:23 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Ulf Hansson,
Sebastian Reichel
Cc: Elaine Zhang, Adrián Martínez Larumbe, Boris Brezillon,
devicetree, linux-rockchip, linux-kernel, linux-pm,
Sebastian Reichel, kernel
Am Dienstag, 10. September 2024, 19:57:11 CEST schrieb Sebastian Reichel:
> Use the cleanup infrastructure to handle the mutex, which
> slightly improve code readability for this function.
>
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
I guess you could make the guard patch the 1st to not add and then
remove the mutex_unlock in the "forward errors" patch.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v1 3/6] pmdomain: rockchip: reduce indention in rockchip_pd_power
2024-09-10 17:57 ` [PATCH v1 3/6] pmdomain: rockchip: reduce indention " Sebastian Reichel
@ 2024-09-10 18:26 ` Heiko Stübner
0 siblings, 0 replies; 17+ messages in thread
From: Heiko Stübner @ 2024-09-10 18:26 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Ulf Hansson,
Sebastian Reichel
Cc: Elaine Zhang, Adrián Martínez Larumbe, Boris Brezillon,
devicetree, linux-rockchip, linux-kernel, linux-pm,
Sebastian Reichel, kernel
Am Dienstag, 10. September 2024, 19:57:12 CEST schrieb Sebastian Reichel:
> Rework the logic, so that the function exits early when the
> power domain state is already correct to reduce code indention.
indentation
both here and in the subject
change itself
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v1 4/6] dt-bindings: power: rockchip: add regulator support
2024-09-10 17:57 ` [PATCH v1 4/6] dt-bindings: power: rockchip: add regulator support Sebastian Reichel
@ 2024-09-10 18:52 ` Heiko Stübner
2024-09-11 17:38 ` Rob Herring (Arm)
1 sibling, 0 replies; 17+ messages in thread
From: Heiko Stübner @ 2024-09-10 18:52 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Ulf Hansson,
Sebastian Reichel
Cc: Elaine Zhang, Adrián Martínez Larumbe, Boris Brezillon,
devicetree, linux-rockchip, linux-kernel, linux-pm,
Sebastian Reichel, kernel
Am Dienstag, 10. September 2024, 19:57:13 CEST schrieb Sebastian Reichel:
> Add optional support for a voltage supply required to enable a
> power domain. The binding follows the way it is handled by the
> Mediatek binding to keep things consistent.
>
> This will initially be used by the RK3588 GPU power domain, which
> fails to be enabled when the GPU regulator is not enabled.
>
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
That we have regulators supplying internal components in the soc
is the case for all Rockchip SoCs, though it looks like thankfully this
hadn't bitten us before.
So having the ability to define those supplies makes a lot of sense
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
> ---
> .../devicetree/bindings/power/rockchip,power-controller.yaml | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/power/rockchip,power-controller.yaml b/Documentation/devicetree/bindings/power/rockchip,power-controller.yaml
> index 0d5e999a58f1..0b4c5b174812 100644
> --- a/Documentation/devicetree/bindings/power/rockchip,power-controller.yaml
> +++ b/Documentation/devicetree/bindings/power/rockchip,power-controller.yaml
> @@ -131,6 +131,9 @@ $defs:
> A number of phandles to clocks that need to be enabled
> while power domain switches state.
>
> + domain-supply:
> + description: domain regulator supply.
> +
> pm_qos:
> $ref: /schemas/types.yaml#/definitions/phandle-array
> items:
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v1 5/6] pmdomain: rockchip: add regulator support
2024-09-10 17:57 ` [PATCH v1 5/6] pmdomain: " Sebastian Reichel
@ 2024-09-11 9:46 ` Heiko Stübner
2024-09-16 12:37 ` Heiko Stuebner
1 sibling, 0 replies; 17+ messages in thread
From: Heiko Stübner @ 2024-09-11 9:46 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Ulf Hansson,
Sebastian Reichel
Cc: Elaine Zhang, Adrián Martínez Larumbe, Boris Brezillon,
devicetree, linux-rockchip, linux-kernel, linux-pm,
Sebastian Reichel, kernel, Chen-Yu Tsai
Am Dienstag, 10. September 2024, 19:57:14 CEST schrieb Sebastian Reichel:
> Some power domains require extra voltages to be applied. For example
> trying to enable the GPU domain on RK3588 fails when the SoC does not
> have VDD GPU enabled.
>
> The solution to temporarily change the device's device tree node has
> been taken over from the Mediatek power domain driver.
>
> The regulator is not acquired at probe time, since that creates circular
> dependencies. The power domain driver must be probed early, since SoC
> peripherals need it. Regulators on the other hand depend on SoC
> peripherals like SPI, I2C or GPIO.
>
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
It does look like Chen-Yu Tsai is working on a similar problem [0].
I.e. this really is a hack, so I started looking around the regulator API
and found of_regulator_bulk_get existing but unused that already
operates on a of-node.
Googling further I stumbled upon the linked patch from some days
ago ;-) . So maybe that could be a cleaner way forward?
[0] https://patchwork.kernel.org/project/linux-mediatek/patch/20240904090016.2841572-6-wenst@chromium.org/
> ---
> drivers/pmdomain/rockchip/pm-domains.c | 57 +++++++++++++++++++++++++-
> 1 file changed, 55 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pmdomain/rockchip/pm-domains.c b/drivers/pmdomain/rockchip/pm-domains.c
> index 663d390faaeb..ae6990897928 100644
> --- a/drivers/pmdomain/rockchip/pm-domains.c
> +++ b/drivers/pmdomain/rockchip/pm-domains.c
> @@ -18,6 +18,7 @@
> #include <linux/of_clk.h>
> #include <linux/clk.h>
> #include <linux/regmap.h>
> +#include <linux/regulator/consumer.h>
> #include <linux/mfd/syscon.h>
> #include <soc/rockchip/pm_domains.h>
> #include <dt-bindings/power/px30-power.h>
> @@ -89,6 +90,8 @@ struct rockchip_pm_domain {
> u32 *qos_save_regs[MAX_QOS_REGS_NUM];
> int num_clks;
> struct clk_bulk_data *clks;
> + struct device_node *node;
> + struct regulator *supply;
> };
>
> struct rockchip_pmu {
> @@ -571,18 +574,67 @@ static int rockchip_pd_power(struct rockchip_pm_domain *pd, bool power_on)
> return 0;
> }
>
> +static int rockchip_pd_regulator_disable(struct rockchip_pm_domain *pd)
> +{
> + return pd->supply ? regulator_disable(pd->supply) : 0;
> +}
> +
> +
> +static int rockchip_pd_regulator_enable(struct rockchip_pm_domain *pd)
> +{
> + struct rockchip_pmu *pmu = pd->pmu;
> + struct device_node *main_node;
> +
> + if (!pd->supply) {
> + /*
> + * Find regulator in current power domain node.
> + * devm_regulator_get() finds regulator in a node and its child
> + * node, so set of_node to current power domain node then change
> + * back to original node after regulator is found for current
> + * power domain node.
> + */
> + main_node = pmu->dev->of_node;
> + pmu->dev->of_node = pd->node;
> + pd->supply = devm_regulator_get(pmu->dev, "domain");
> + pmu->dev->of_node = main_node;
> + if (IS_ERR(pd->supply)) {
> + pd->supply = NULL;
> + return 0;
> + }
> + }
> +
> + return regulator_enable(pd->supply);
> +}
> +
> static int rockchip_pd_power_on(struct generic_pm_domain *domain)
> {
> struct rockchip_pm_domain *pd = to_rockchip_pd(domain);
> + int ret;
> +
> + ret = rockchip_pd_regulator_enable(pd);
> + if (ret) {
> + dev_err(pd->pmu->dev, "Failed to enable supply: %d\n", ret);
> + return ret;
> + }
>
> - return rockchip_pd_power(pd, true);
> + ret = rockchip_pd_power(pd, true);
> + if (ret)
> + rockchip_pd_regulator_disable(pd);
> +
> + return ret;
> }
>
> static int rockchip_pd_power_off(struct generic_pm_domain *domain)
> {
> struct rockchip_pm_domain *pd = to_rockchip_pd(domain);
> + int ret;
>
> - return rockchip_pd_power(pd, false);
> + ret = rockchip_pd_power(pd, false);
> + if (ret)
> + return ret;
> +
> + rockchip_pd_regulator_disable(pd);
> + return ret;
> }
>
> static int rockchip_pd_attach_dev(struct generic_pm_domain *genpd,
> @@ -663,6 +715,7 @@ static int rockchip_pm_add_one_domain(struct rockchip_pmu *pmu,
>
> pd->info = pd_info;
> pd->pmu = pmu;
> + pd->node = node;
>
> pd->num_clks = of_clk_get_parent_count(node);
> if (pd->num_clks > 0) {
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v1 4/6] dt-bindings: power: rockchip: add regulator support
2024-09-10 17:57 ` [PATCH v1 4/6] dt-bindings: power: rockchip: add regulator support Sebastian Reichel
2024-09-10 18:52 ` Heiko Stübner
@ 2024-09-11 17:38 ` Rob Herring (Arm)
1 sibling, 0 replies; 17+ messages in thread
From: Rob Herring (Arm) @ 2024-09-11 17:38 UTC (permalink / raw)
To: Sebastian Reichel
Cc: Ulf Hansson, devicetree, Heiko Stuebner,
Adrián Martínez Larumbe, kernel, Conor Dooley,
linux-kernel, Boris Brezillon, Krzysztof Kozlowski,
linux-rockchip, linux-pm, Elaine Zhang
On Tue, 10 Sep 2024 19:57:13 +0200, Sebastian Reichel wrote:
> Add optional support for a voltage supply required to enable a
> power domain. The binding follows the way it is handled by the
> Mediatek binding to keep things consistent.
>
> This will initially be used by the RK3588 GPU power domain, which
> fails to be enabled when the GPU regulator is not enabled.
>
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> ---
> .../devicetree/bindings/power/rockchip,power-controller.yaml | 3 +++
> 1 file changed, 3 insertions(+)
>
Acked-by: Rob Herring (Arm) <robh@kernel.org>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v1 0/6] Fix RK3588 GPU domain
2024-09-10 17:57 [PATCH v1 0/6] Fix RK3588 GPU domain Sebastian Reichel
` (5 preceding siblings ...)
2024-09-10 17:57 ` [PATCH v1 6/6] arm64: dts: rockchip: Add GPU power domain regulator dependency for RK3588 Sebastian Reichel
@ 2024-09-13 11:59 ` Ulf Hansson
2024-09-19 9:05 ` Sebastian Reichel
2024-09-16 15:45 ` Adrián Martínez Larumbe
7 siblings, 1 reply; 17+ messages in thread
From: Ulf Hansson @ 2024-09-13 11:59 UTC (permalink / raw)
To: Sebastian Reichel
Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner,
Elaine Zhang, Adrián Martínez Larumbe, Boris Brezillon,
devicetree, linux-rockchip, linux-kernel, linux-pm, kernel
On Tue, 10 Sept 2024 at 20:05, Sebastian Reichel
<sebastian.reichel@collabora.com> wrote:
>
> Hi,
>
> I got a report, that the Linux kernel crashes on Rock 5B when the panthor
> driver is loaded late after booting. The crash starts with the following
> shortened error print:
>
> rockchip-pm-domain fd8d8000.power-management:power-controller: failed to set domain 'gpu', val=0
> rockchip-pm-domain fd8d8000.power-management:power-controller: failed to get ack on domain 'gpu', val=0xa9fff
> SError Interrupt on CPU4, code 0x00000000be000411 -- SError
>
> This series first does some cleanups in the Rockchip power domain
> driver and changes the driver, so that it no longer tries to continue
> when it fails to enable a domain. This gets rid of the SError interrupt
> and long backtraces. But the kernel still hangs when it fails to enable
> a power domain. I have not done further analysis to check if that can
> be avoided.
>
> Last but not least this provides a fix for the GPU power domain failing
> to get enabled - after some testing from my side it seems to require the
> GPU voltage supply to be enabled.
>
> I'm not really happy about the hack to get a regulator for a sub-node
> in the 5th patch, which I took over from the Mediatek driver. But to
> get things going and open a discussion around it I thought it would be
> best to send a first version as soon as possible.
That creates a circular dependency from the fw_devlink point of view.
I assume that isn't a problem and fw_devlink takes care of this, so
the GPU power domain still can probe?
Other than this, I think this looks okay to me.
Kind regards
Uffe
>
> Greetings,
>
> -- Sebastian
> Sebastian Reichel (6):
> pmdomain: rockchip: forward rockchip_do_pmu_set_power_domain errors
> pmdomain: rockchip: cleanup mutex handling in rockchip_pd_power
> pmdomain: rockchip: reduce indention in rockchip_pd_power
> dt-bindings: power: rockchip: add regulator support
> pmdomain: rockchip: add regulator support
> arm64: dts: rockchip: Add GPU power domain regulator dependency for
> RK3588
>
> .../power/rockchip,power-controller.yaml | 3 +
> .../boot/dts/rockchip/rk3588-armsom-sige7.dts | 4 +
> arch/arm64/boot/dts/rockchip/rk3588-base.dtsi | 2 +-
> .../boot/dts/rockchip/rk3588-coolpi-cm5.dtsi | 4 +
> .../rockchip/rk3588-friendlyelec-cm3588.dtsi | 4 +
> .../arm64/boot/dts/rockchip/rk3588-jaguar.dts | 4 +
> .../boot/dts/rockchip/rk3588-ok3588-c.dts | 4 +
> .../boot/dts/rockchip/rk3588-rock-5-itx.dts | 4 +
> .../boot/dts/rockchip/rk3588-rock-5b.dts | 4 +
> .../arm64/boot/dts/rockchip/rk3588-tiger.dtsi | 4 +
> .../boot/dts/rockchip/rk3588s-coolpi-4b.dts | 4 +
> .../dts/rockchip/rk3588s-khadas-edge2.dts | 4 +
> .../boot/dts/rockchip/rk3588s-orangepi-5.dts | 4 +
> drivers/pmdomain/rockchip/pm-domains.c | 130 +++++++++++++-----
> 14 files changed, 144 insertions(+), 35 deletions(-)
>
> --
> 2.45.2
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v1 5/6] pmdomain: rockchip: add regulator support
2024-09-10 17:57 ` [PATCH v1 5/6] pmdomain: " Sebastian Reichel
2024-09-11 9:46 ` Heiko Stübner
@ 2024-09-16 12:37 ` Heiko Stuebner
1 sibling, 0 replies; 17+ messages in thread
From: Heiko Stuebner @ 2024-09-16 12:37 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Ulf Hansson,
Sebastian Reichel
Cc: Elaine Zhang, Adrián Martínez Larumbe, Boris Brezillon,
devicetree, linux-rockchip, linux-kernel, linux-pm,
Sebastian Reichel, kernel
Am Dienstag, 10. September 2024, 19:57:14 CEST schrieb Sebastian Reichel:
> Some power domains require extra voltages to be applied. For example
> trying to enable the GPU domain on RK3588 fails when the SoC does not
> have VDD GPU enabled.
>
> The solution to temporarily change the device's device tree node has
> been taken over from the Mediatek power domain driver.
>
> The regulator is not acquired at probe time, since that creates circular
> dependencies. The power domain driver must be probed early, since SoC
> peripherals need it. Regulators on the other hand depend on SoC
> peripherals like SPI, I2C or GPIO.
>
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> ---
> drivers/pmdomain/rockchip/pm-domains.c | 57 +++++++++++++++++++++++++-
> 1 file changed, 55 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pmdomain/rockchip/pm-domains.c b/drivers/pmdomain/rockchip/pm-domains.c
> index 663d390faaeb..ae6990897928 100644
> --- a/drivers/pmdomain/rockchip/pm-domains.c
> +++ b/drivers/pmdomain/rockchip/pm-domains.c
> @@ -18,6 +18,7 @@
> #include <linux/of_clk.h>
> #include <linux/clk.h>
> #include <linux/regmap.h>
> +#include <linux/regulator/consumer.h>
> #include <linux/mfd/syscon.h>
> #include <soc/rockchip/pm_domains.h>
> #include <dt-bindings/power/px30-power.h>
> @@ -89,6 +90,8 @@ struct rockchip_pm_domain {
> u32 *qos_save_regs[MAX_QOS_REGS_NUM];
> int num_clks;
> struct clk_bulk_data *clks;
> + struct device_node *node;
> + struct regulator *supply;
> };
>
> struct rockchip_pmu {
> @@ -571,18 +574,67 @@ static int rockchip_pd_power(struct rockchip_pm_domain *pd, bool power_on)
> return 0;
> }
>
> +static int rockchip_pd_regulator_disable(struct rockchip_pm_domain *pd)
> +{
> + return pd->supply ? regulator_disable(pd->supply) : 0;
> +}
> +
> +
nit: double-empty line
other than that, this looks ok for the time being and as Sebastian
mentioned in Vienna, this also blocks actually testing
the Panthor-GPU driver right now.
So while we will likely convert to the hopefully soon existing
regulator stuff, this change is helpful for right now
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v1 0/6] Fix RK3588 GPU domain
2024-09-10 17:57 [PATCH v1 0/6] Fix RK3588 GPU domain Sebastian Reichel
` (6 preceding siblings ...)
2024-09-13 11:59 ` [PATCH v1 0/6] Fix RK3588 GPU domain Ulf Hansson
@ 2024-09-16 15:45 ` Adrián Martínez Larumbe
7 siblings, 0 replies; 17+ messages in thread
From: Adrián Martínez Larumbe @ 2024-09-16 15:45 UTC (permalink / raw)
To: Sebastian Reichel
Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner,
Ulf Hansson, Elaine Zhang, Boris Brezillon, devicetree,
linux-rockchip, linux-kernel, linux-pm, kernel
Hi, Sebastian, thanks for the patches.
I've tested it on a Rockchip 5b board and now I can reload the driver at any time.
Tested-by: Adrian Larumbe <adrian.larumbe@collabora.com>
On 10.09.2024 19:57, Sebastian Reichel wrote:
> Hi,
>
> I got a report, that the Linux kernel crashes on Rock 5B when the panthor
> driver is loaded late after booting. The crash starts with the following
> shortened error print:
>
> rockchip-pm-domain fd8d8000.power-management:power-controller: failed to set domain 'gpu', val=0
> rockchip-pm-domain fd8d8000.power-management:power-controller: failed to get ack on domain 'gpu', val=0xa9fff
> SError Interrupt on CPU4, code 0x00000000be000411 -- SError
>
> This series first does some cleanups in the Rockchip power domain
> driver and changes the driver, so that it no longer tries to continue
> when it fails to enable a domain. This gets rid of the SError interrupt
> and long backtraces. But the kernel still hangs when it fails to enable
> a power domain. I have not done further analysis to check if that can
> be avoided.
>
> Last but not least this provides a fix for the GPU power domain failing
> to get enabled - after some testing from my side it seems to require the
> GPU voltage supply to be enabled.
>
> I'm not really happy about the hack to get a regulator for a sub-node
> in the 5th patch, which I took over from the Mediatek driver. But to
> get things going and open a discussion around it I thought it would be
> best to send a first version as soon as possible.
>
> Greetings,
>
> -- Sebastian
> Sebastian Reichel (6):
> pmdomain: rockchip: forward rockchip_do_pmu_set_power_domain errors
> pmdomain: rockchip: cleanup mutex handling in rockchip_pd_power
> pmdomain: rockchip: reduce indention in rockchip_pd_power
> dt-bindings: power: rockchip: add regulator support
> pmdomain: rockchip: add regulator support
> arm64: dts: rockchip: Add GPU power domain regulator dependency for
> RK3588
>
> .../power/rockchip,power-controller.yaml | 3 +
> .../boot/dts/rockchip/rk3588-armsom-sige7.dts | 4 +
> arch/arm64/boot/dts/rockchip/rk3588-base.dtsi | 2 +-
> .../boot/dts/rockchip/rk3588-coolpi-cm5.dtsi | 4 +
> .../rockchip/rk3588-friendlyelec-cm3588.dtsi | 4 +
> .../arm64/boot/dts/rockchip/rk3588-jaguar.dts | 4 +
> .../boot/dts/rockchip/rk3588-ok3588-c.dts | 4 +
> .../boot/dts/rockchip/rk3588-rock-5-itx.dts | 4 +
> .../boot/dts/rockchip/rk3588-rock-5b.dts | 4 +
> .../arm64/boot/dts/rockchip/rk3588-tiger.dtsi | 4 +
> .../boot/dts/rockchip/rk3588s-coolpi-4b.dts | 4 +
> .../dts/rockchip/rk3588s-khadas-edge2.dts | 4 +
> .../boot/dts/rockchip/rk3588s-orangepi-5.dts | 4 +
> drivers/pmdomain/rockchip/pm-domains.c | 130 +++++++++++++-----
> 14 files changed, 144 insertions(+), 35 deletions(-)
>
> --
> 2.45.2
Adrian Larumbe
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v1 0/6] Fix RK3588 GPU domain
2024-09-13 11:59 ` [PATCH v1 0/6] Fix RK3588 GPU domain Ulf Hansson
@ 2024-09-19 9:05 ` Sebastian Reichel
0 siblings, 0 replies; 17+ messages in thread
From: Sebastian Reichel @ 2024-09-19 9:05 UTC (permalink / raw)
To: Ulf Hansson
Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner,
Elaine Zhang, Adrián Martínez Larumbe, Boris Brezillon,
devicetree, linux-rockchip, linux-kernel, linux-pm, kernel
[-- Attachment #1: Type: text/plain, Size: 1996 bytes --]
Hi,
On Fri, Sep 13, 2024 at 01:59:10PM GMT, Ulf Hansson wrote:
> On Tue, 10 Sept 2024 at 20:05, Sebastian Reichel
> <sebastian.reichel@collabora.com> wrote:
> > I got a report, that the Linux kernel crashes on Rock 5B when the panthor
> > driver is loaded late after booting. The crash starts with the following
> > shortened error print:
> >
> > rockchip-pm-domain fd8d8000.power-management:power-controller: failed to set domain 'gpu', val=0
> > rockchip-pm-domain fd8d8000.power-management:power-controller: failed to get ack on domain 'gpu', val=0xa9fff
> > SError Interrupt on CPU4, code 0x00000000be000411 -- SError
> >
> > This series first does some cleanups in the Rockchip power domain
> > driver and changes the driver, so that it no longer tries to continue
> > when it fails to enable a domain. This gets rid of the SError interrupt
> > and long backtraces. But the kernel still hangs when it fails to enable
> > a power domain. I have not done further analysis to check if that can
> > be avoided.
> >
> > Last but not least this provides a fix for the GPU power domain failing
> > to get enabled - after some testing from my side it seems to require the
> > GPU voltage supply to be enabled.
> >
> > I'm not really happy about the hack to get a regulator for a sub-node
> > in the 5th patch, which I took over from the Mediatek driver. But to
> > get things going and open a discussion around it I thought it would be
> > best to send a first version as soon as possible.
>
> That creates a circular dependency from the fw_devlink point of view.
Yes.
> I assume that isn't a problem and fw_devlink takes care of this, so
> the GPU power domain still can probe?
This has been tested on Radxa Rock 5B and RK3588 EVB1. It properly
probes the GPU power domain and fixes late probing of the GPU driver :)
> Other than this, I think this looks okay to me.
I will send a V2 with the minor things pointed out.
Greetings,
-- Sebastian
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2024-09-19 9:06 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-10 17:57 [PATCH v1 0/6] Fix RK3588 GPU domain Sebastian Reichel
2024-09-10 17:57 ` [PATCH v1 1/6] pmdomain: rockchip: forward rockchip_do_pmu_set_power_domain errors Sebastian Reichel
2024-09-10 18:21 ` Heiko Stübner
2024-09-10 17:57 ` [PATCH v1 2/6] pmdomain: rockchip: cleanup mutex handling in rockchip_pd_power Sebastian Reichel
2024-09-10 18:23 ` Heiko Stübner
2024-09-10 17:57 ` [PATCH v1 3/6] pmdomain: rockchip: reduce indention " Sebastian Reichel
2024-09-10 18:26 ` Heiko Stübner
2024-09-10 17:57 ` [PATCH v1 4/6] dt-bindings: power: rockchip: add regulator support Sebastian Reichel
2024-09-10 18:52 ` Heiko Stübner
2024-09-11 17:38 ` Rob Herring (Arm)
2024-09-10 17:57 ` [PATCH v1 5/6] pmdomain: " Sebastian Reichel
2024-09-11 9:46 ` Heiko Stübner
2024-09-16 12:37 ` Heiko Stuebner
2024-09-10 17:57 ` [PATCH v1 6/6] arm64: dts: rockchip: Add GPU power domain regulator dependency for RK3588 Sebastian Reichel
2024-09-13 11:59 ` [PATCH v1 0/6] Fix RK3588 GPU domain Ulf Hansson
2024-09-19 9:05 ` Sebastian Reichel
2024-09-16 15:45 ` Adrián Martínez Larumbe
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).