linux icon indicating copy to clipboard operation
linux copied to clipboard

bcm2835-power: Timeout waiting for grafx power OK

Open lategoodbye opened this issue 7 years ago • 34 comments

Describe the bug Starting with Linux 5.1 there is a new power driver for BCM2835. The idea behind this is to have a better control about the V3D power domain. After rollout i got informed that some RPI boards (currently a handfull) have issues during enabling the V3D power domain. The ramp-up runs into a timeout (20 us), because we never get a PM_POWOK. I don't have a clue what causes this issue (timing, hardware tolerance, ...). Currently i don't have a board, which is affected.

To reproduce start the RPI with Mainline Kernel 5.1

Expected behaviour bcm2835-power succeeded to enable V3D power domain

Actual behaviour bcm2835-power failes to enable V3D power domain because PM_POWOK stays off

System

  • Which models of Raspberry Pi? RPI 2, RPI 3B and RPI 3B+
  • Which firmware version (vcgencmd version)? 2019-02-12, 2019-03-27
  • Which kernel version (uname -a)? Mainline Kernel / DTB 5.1

Logs

[   13.913771] bcm2835-power bcm2835-power: Timeout waiting for grafx power OK
[   13.918555] bcm2835-power bcm2835-power: Timeout waiting for grafx power OK

More info: https://github.com/anholt/linux/issues/153

Additional context Add any other relevant context for the problem.

lategoodbye avatar Jul 03 '19 14:07 lategoodbye

It seems that without these reverts, the GPU will also work, so maybe these reverts cause the X hang?

diff --git a/arch/arm/boot/dts/bcm283x.dtsi b/arch/arm/boot/dts/bcm283x.dtsi
index 2d191fc..b238567 100644
--- a/arch/arm/boot/dts/bcm283x.dtsi
+++ b/arch/arm/boot/dts/bcm283x.dtsi
@@ -3,7 +3,6 @@ 
 #include <dt-bindings/clock/bcm2835-aux.h>
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/interrupt-controller/irq.h>
-#include <dt-bindings/soc/bcm2835-pm.h>

 /* firmware-provided startup stubs live here, where the secondary CPUs are
  * spinning.
@@ -121,7 +120,7 @@ 
 			#interrupt-cells = <2>;
 		};

-		pm: watchdog@7e100000 {
+		watchdog@7e100000 {
 			compatible = "brcm,bcm2835-pm", "brcm,bcm2835-pm-wdt";
 			#power-domain-cells = <1>;
 			#reset-cells = <1>;
@@ -641,7 +640,6 @@ 
 			compatible = "brcm,bcm2835-v3d";
 			reg = <0x7ec00000 0x1000>;
 			interrupts = <1 10>;
-			power-domains = <&pm BCM2835_POWER_DOMAIN_GRAFX_V3D>;
 		};

 		vc4: gpu {

redchenjs avatar Nov 03 '19 09:11 redchenjs

It seems that without these reverts, the GPU will also work, so maybe these reverts cause the X hang?

Devicetree changes usually don't cause hangs, it's more a driver issue. According your change you combine the "best" of both power drivers. Unfortunately it's unsafe to handle the same register ranges with two Linux drivers. Currently i only see two options:

  1. Revert most of the BCM2835 power series
  2. Port parts of firmware power driver into the BCM2835 power driver

lategoodbye avatar Nov 04 '19 17:11 lategoodbye

Add these lines to the dts file, compile it, replace the dtb with the newly compiled one, then the gpu will start working.

&v3d {
	power-domains = <&power RPI_POWER_DOMAIN_V3D>;
};

bcm2837-rpi-3-b.dtb.zip

This solves it for me. I just replaced the old /boot/dtbs/broadcom/bcm2837-rpi-b.dtb with yours and it worked. Thanks @redchenjs (cfg: raspberry pi 3b + manjaro)

sankayop avatar Nov 23 '19 16:11 sankayop

A RPi3B+ of mine has not been used for a while. Yesterday I started with a new project and I setup the RPi.

I used a new SD card and prepared it with Arch Linux ARM AArch64. I run into the problem reported here.

I turned the RPi off yesterday evening and turned it on this morning. Same problem. As the RPi has been turned off for hours I don't think mine has been too hot on its first power up this morning.

So, if you need another board to get some diagnostic information, I can try to provide.

maggu2810 avatar Dec 17 '19 06:12 maggu2810

The consensus above is that this is caused by an incompatibility in the upstream/mainline 3B+ DTB. Edit the source file as described by @sankayop above and rebuild it (or download the prebuilt version they link to) and try with that.

pelwell avatar Dec 17 '19 10:12 pelwell

Thank you for your reply, will give it a try later...

Will the specific change that seems to be applied to all the fedora kernel versions make it upstream? I did not find it here https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts/bcm2835-rpi.dtsi

maggu2810 avatar Dec 17 '19 10:12 maggu2810

Currently for upstream i only see two "options":

  1. revert Eric's complete bcm2835-power series
  2. merge the working parts from raspberrypi-power into bcm2835-power

I'm not happy with both of them. @sankayop patch will enable both power driver for the same power domain. I consider this as a path to hell ...

lategoodbye avatar Dec 17 '19 13:12 lategoodbye

@lategoodbye Do you have a preference between 1 and 2? Is there something we can do to help?

pelwell avatar Dec 17 '19 13:12 pelwell

Number 1 isn't a real option, because we need this driver for Raspberry Pi 4. Number 2 should be do able for downstream, but would result more likely in a merge of both drivers for upstream.

The best option would be to ask someone with deeper understanding of BCM2835 why the rampup causes these random timeouts (timing issue, missing requirements, wrong order of power domain handling) and fix the bcm2835 power driver.

lategoodbye avatar Dec 17 '19 13:12 lategoodbye

Any updates on this?

cerebralmisfire avatar Jan 18 '20 07:01 cerebralmisfire

In the upstream kernel the suggested patch to revert has been applied. The hanging X issue was unrelated. https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?h=next-20200402&id=e7b7daeb48e0bf5d8412d77f11069750ee7032bb

lategoodbye avatar Apr 02 '20 17:04 lategoodbye

When booting up my Raspberry Pi 2 Model B with Arch Linux ARM, it seems one of two things happens:

  • The system boots up with the proper resolution I have specified in my config.txt. When I run startx to start LXDE, the DE launches, then almost immediately hangs.
    • The timeout log message is not present in my system journal.
  • The system boots up with a lower resolution. When I run startx, LXDE functions as expected.
    • The timeout log message is present multiple times.
    • There seems to be no GPU acceleration present.

In my testing, it does seem that the first occurrence is more likely when the Pi is cooled down, rather than right after rebooting. Most of these are things that have already been pointed out, but I wanted to provide a test case for anyone else having the issue.

Is the issue with X hanging being tracked anywhere?

CodingKoopa avatar May 04 '20 18:05 CodingKoopa

Is the issue with X hanging being tracked anywhere?

Here is the accepted fix: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?h=next-20200504&id=b1e7396a1d0e6af6806337fdaaa44098d6b3343c

lategoodbye avatar May 04 '20 18:05 lategoodbye

Seems the Pi 3 A+ has the same problem :-/

sixtyfive avatar Dec 07 '20 17:12 sixtyfive