Page 1 of 2

Status of Raspberry Pi 4 in Mainline

Posted: Thu Aug 22, 2019 6:33 pm
by swahren
For those how are interested, Nicolas Saenz Julienne and i working on Mainline support for the Raspberry Pi 4. The plan was to introduce initial Raspberry Pi 4 support (only debug UART, no fancy stuff like GENET, V3D, USB 3.0 or arm64) for Linux 5.4. Unfortunately there were a lot of issues (especially DMA stuff) which delayed everything to the next release. At least the pinctrl and the mmc stuff has been merged and the clock will follow soon.

Here is the issue to keep track on this:
https://github.com/lategoodbye/rpi-zero/issues/43

Re: Status of Raspberry Pi 4 in Mainline

Posted: Thu Aug 29, 2019 7:05 pm
by swahren
Today the relevant I2C changes has been applied to for-next:
https://marc.info/?l=linux-i2c&m=156692552019278

Re: Status of Raspberry Pi 4 in Mainline

Posted: Fri Oct 11, 2019 11:17 pm
by swahren
Today i applied the initial Raspberry Pi 4 device tree:
https://marc.info/?l=linux-arm-kernel&m ... 825574&w=2

Re: Status of Raspberry Pi 4 in Mainline

Posted: Sat Nov 16, 2019 10:41 am
by swahren
This week the GENET support has been applied to net-next:
https://lore.kernel.org/netdev/15735017 ... t@gmx.net/

Re: Status of Raspberry Pi 4 in Mainline

Posted: Sat Nov 23, 2019 7:02 am
by Gavinmc42
I would have thought arm64 is the preferred mainline kernel.
Optimizing for Aarch64 would give a better future and minimize the support required.

Re: Status of Raspberry Pi 4 in Mainline

Posted: Sun Nov 24, 2019 1:36 pm
by swahren
Gavinmc42 wrote:
Sat Nov 23, 2019 7:02 am
I would have thought arm64 is the preferred mainline kernel.
Optimizing for Aarch64 would give a better future and minimize the support required.
From kernel perspective there is no preference. Both must work, but the BCM2711 / PCIe stuff needs some extra work for arm64. Nicolas Saenz Julienne takes care of this and hopefully in Linux 5.5 there will be basic arm64 support.

Re: Status of Raspberry Pi 4 in Mainline

Posted: Tue Jan 21, 2020 7:40 pm
by swahren
Linux 5.5 is almost ready, so a short update for the upcoming features in Mainline Linux 5.6:
- hwrng: iproc-rng200 - Add support for BCM2711
- thermal: Add BCM2711 thermal driver
- PCI: brcmstb: Add Broadcom STB PCIe host controller driver

Re: Status of Raspberry Pi 4 in Mainline

Posted: Wed Jan 22, 2020 12:33 am
by Gavinmc42
Nice, thanks for the update.
So it is looking like 5.6 will be the cross over point for Pi4 on mainstream?
Anything missing?

Re: Status of Raspberry Pi 4 in Mainline

Posted: Wed Jan 22, 2020 8:37 pm
by swahren
Gavinmc42 wrote:
Wed Jan 22, 2020 12:33 am
Nice, thanks for the update.
So it is looking like 5.6 will be the cross over point for Pi4 on mainstream?
Anything missing?
The whole graphics stuff (VC4, V3D), DMA engine and VCHIQ. I think they are more time consuming.

Re: Status of Raspberry Pi 4 in Mainline

Posted: Thu Jan 23, 2020 2:37 am
by Gavinmc42
The whole graphics stuff (VC4, V3D), DMA engine and VCHIQ. I think they are more time consuming.
Have you seen the new v3d stuff in mesa 19.3.0?
Compute Shaders yippee, er how do I use them :lol:

Yep camera, mmal stuff is not the job for mere mortals, need wizards for that.

Re: Status of Raspberry Pi 4 in Mainline

Posted: Wed Apr 15, 2020 7:59 pm
by swahren
Here are the upcoming features for Mainline Linux 5.7:
- 1920x1200@60Hz support for VC4 KMS of BCM283x
- power saving (LPM) support for VIA LABS VL805
- extend pinctrl/gpio driver to support all 58 GPIOs of BCM2711
- add GPIO labels for Raspberry Pi 4 board
- driver for Sony IMX219 sensor
- bcm2835aux-uart: Support RS485 software emulation

Additionally some patches for BCM2711 VC4 KMS and SD power (required for recent RPi 4 boards) has been merged, but are not functional.

Re: Status of Raspberry Pi 4 in Mainline

Posted: Thu Apr 16, 2020 10:31 am
by cjan
swahren wrote:
Wed Apr 15, 2020 7:59 pm
Here are the upcoming features for Mainline Linux 5.7:
- F2FS Zstd compression support.

Re: Status of Raspberry Pi 4 in Mainline

Posted: Sat May 30, 2020 8:49 pm
by pihacker
How can I try mainline linux kernel for rapsberry pi 4? Is there any instructions to compile mainline kernel? I've tried to compile it using this instructions - https://www.raspberrypi.org/documentati ... uilding.md, but my raspberry struck at loading with rainbow screen and noting on serial console. I tried to use default bootloader, not u-boot.

Re: Status of Raspberry Pi 4 in Mainline

Posted: Mon Jun 01, 2020 7:13 pm
by swahren
pihacker wrote:
Sat May 30, 2020 8:49 pm
How can I try mainline linux kernel for rapsberry pi 4? Is there any instructions to compile mainline kernel? I've tried to compile it using this instructions - https://www.raspberrypi.org/documentati ... uilding.md, but my raspberry struck at loading with rainbow screen and noting on serial console. I tried to use default bootloader, not u-boot.
I hope this Gist may help you a little bit: https://gist.github.com/lategoodbye/c73 ... aed8c68f75

Re: Status of Raspberry Pi 4 in Mainline

Posted: Tue Jun 02, 2020 4:43 am
by Gavinmc42
extend pinctrl/gpio driver to support all 58 GPIOs of BCM2711
Compute modules coming? That would be handy

Re: Status of Raspberry Pi 4 in Mainline

Posted: Tue Jun 02, 2020 12:38 pm
by swahren
Anyone who wants to test KMS for the RPi 4 could use Maxime Ripard's working branch:
https://git.kernel.org/pub/scm/linux/ke ... h=rpi4-kms

Re: Status of Raspberry Pi 4 in Mainline

Posted: Thu Jun 04, 2020 2:59 pm
by pihacker
swahren wrote:
Mon Jun 01, 2020 7:13 pm
I hope this Gist may help you a little bit: https://gist.github.com/lategoodbye/c73 ... aed8c68f75
Thank you a lot! I finally managed to compile and boot from mainline kernel!

I also faced a couple of issues:
  • RPI4 cannot startup from mmcblk0p2 since name of a block device is changed somehow to mmcblk1p2, it just throw me into rootfs emergency shell, so I needed to change cmdline.txt a bit
  • During boot, RPI stucks at systemd job "A start job is running for /dev/mmcblk0p1", so wrong block device name appears here again and I don't know where it comes from. Does it relate to initramfs in /boot? Since I didn't change it for one produced with kernel building.
  • Ethernet doesn't work. Should I add some config options before kernel building?
Could you please suggest me ways to solve this issues?

Re: Status of Raspberry Pi 4 in Mainline

Posted: Thu Jun 04, 2020 3:13 pm
by PhilE
As I understand, "upstream" are wanting to discourage people from using device names to identify partitions, preferring volume labels and UUIDs instead. That is why there is no way to force a particular mmcblk index (e.g. mmcblk0) to be used on a specific MMC interface. In the downstream rpi-* trees we include a patch that sets the index based on aliases found in the DTB. Try using a PARTUUID or PARTLABEL instead.

It's not clear what would be expecting there to be a Bluetooth device on one of the MMC/SDIO interfaces. The upstream .dts file declares a Bluetooth interface ("brcm,bcm43438", interestingly) on UART0.

Re: Status of Raspberry Pi 4 in Mainline

Posted: Thu Jun 04, 2020 3:26 pm
by pihacker
PhilE wrote:
Thu Jun 04, 2020 3:13 pm
It's not clear what would be expecting there to be a Bluetooth device on one of the MMC/SDIO interfaces. The upstream .dts file declares a Bluetooth interface ("brcm,bcm43438", interestingly) on UART0.
I'm sorry for a wrong error message, I've fixed my previous post. It actually was two unrelated messages -- one about bluetooth and second about mmcblk0p1, and rpi stuck for a 90 second during boot at that message.
The bigger problem is actually ethernet, I've looked into dmesg and found two messages:
could not attach to PHY
bcmgenet fd580000.ethernet eth0: failed to connect to PHY

What could that mean?

Re: Status of Raspberry Pi 4 in Mainline

Posted: Thu Jun 04, 2020 3:47 pm
by PhilE
What is the value of the phy-mode property in your bcm2711-rpi-4-b.dts? If it's "rgmii-rxid" then try changing it to "rgmii", and vice versa.

Re: Status of Raspberry Pi 4 in Mainline

Posted: Thu Jun 04, 2020 4:15 pm
by pihacker
PhilE wrote:
Thu Jun 04, 2020 3:47 pm
What is the value of the phy-mode property in your bcm2711-rpi-4-b.dts? If it's "rgmii-rxid" then try changing it to "rgmii", and vice versa.
I tried both with no success. I think I'm missing some .config parameters before compilation.

Re: Status of Raspberry Pi 4 in Mainline

Posted: Thu Jun 04, 2020 4:17 pm
by PhilE
I'm sure @swahren will be able to help with that.

Re: Status of Raspberry Pi 4 in Mainline

Posted: Thu Jun 04, 2020 4:24 pm
by pihacker
@PhilE thanks. It's even more strange because wifi works! But still missing ethernet :)

UPD: One more thing to notice is that I use almost empty config.txt. Maybe I should add some options to make eth working with mainline kernel?
UPD2: It seems that GPIO doesn't work too, because serial console doesn't show anything to me.

Re: Status of Raspberry Pi 4 in Mainline

Posted: Thu Jun 04, 2020 5:27 pm
by swahren
At first the intention of this thread wasn't to solve mainline kernel issues. This should be separate threads.

@pihacker You never mentioned the kernel version or the base of your kernel config you are using.

Did you overwrite the bcm2711-rpi-4-b.dtb on your sd card with the mainline version?
For ethernet you should use multi_v7_defconfig and make sure CONFIG_BROADCOM_PHY=y
For USB you also need to enable CONFIG_ARM_LPAE and CONFIG_PCIE_BRCMSTB.
In order to get a serial console, please replace serial0 with ttyS1 in the cmdline.txt.

Edit: For experiments with the mainline kernel, i strongly recommend to use Raspbian / Raspberry Pi OS as rootfs.

Re: Status of Raspberry Pi 4 in Mainline

Posted: Fri Jun 05, 2020 9:04 am
by pihacker
@swahren moved discussion to a new thread -- viewtopic.php?f=71&t=276236