swahren
Posts: 149
Joined: Mon Sep 19, 2016 5:24 pm
Location: Germany

Status of Raspberry Pi 4 in Mainline

Thu Aug 22, 2019 6:33 pm

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

swahren
Posts: 149
Joined: Mon Sep 19, 2016 5:24 pm
Location: Germany

Re: Status of Raspberry Pi 4 in Mainline

Thu Aug 29, 2019 7:05 pm

Today the relevant I2C changes has been applied to for-next:
https://marc.info/?l=linux-i2c&m=156692552019278

swahren
Posts: 149
Joined: Mon Sep 19, 2016 5:24 pm
Location: Germany

Re: Status of Raspberry Pi 4 in Mainline

Fri Oct 11, 2019 11:17 pm

Today i applied the initial Raspberry Pi 4 device tree:
https://marc.info/?l=linux-arm-kernel&m ... 825574&w=2

swahren
Posts: 149
Joined: Mon Sep 19, 2016 5:24 pm
Location: Germany

Re: Status of Raspberry Pi 4 in Mainline

Sat Nov 16, 2019 10:41 am

This week the GENET support has been applied to net-next:
https://lore.kernel.org/netdev/15735017 ... t@gmx.net/

User avatar
Gavinmc42
Posts: 4846
Joined: Wed Aug 28, 2013 3:31 am

Re: Status of Raspberry Pi 4 in Mainline

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.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

swahren
Posts: 149
Joined: Mon Sep 19, 2016 5:24 pm
Location: Germany

Re: Status of Raspberry Pi 4 in Mainline

Sun Nov 24, 2019 1:36 pm

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.

swahren
Posts: 149
Joined: Mon Sep 19, 2016 5:24 pm
Location: Germany

Re: Status of Raspberry Pi 4 in Mainline

Tue Jan 21, 2020 7:40 pm

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

User avatar
Gavinmc42
Posts: 4846
Joined: Wed Aug 28, 2013 3:31 am

Re: Status of Raspberry Pi 4 in Mainline

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?
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

swahren
Posts: 149
Joined: Mon Sep 19, 2016 5:24 pm
Location: Germany

Re: Status of Raspberry Pi 4 in Mainline

Wed Jan 22, 2020 8:37 pm

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.

User avatar
Gavinmc42
Posts: 4846
Joined: Wed Aug 28, 2013 3:31 am

Re: Status of Raspberry Pi 4 in Mainline

Thu Jan 23, 2020 2:37 am

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.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

swahren
Posts: 149
Joined: Mon Sep 19, 2016 5:24 pm
Location: Germany

Re: Status of Raspberry Pi 4 in Mainline

Wed Apr 15, 2020 7:59 pm

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.

cjan
Posts: 901
Joined: Sun May 06, 2012 12:00 am

Re: Status of Raspberry Pi 4 in Mainline

Thu Apr 16, 2020 10:31 am

swahren wrote:
Wed Apr 15, 2020 7:59 pm
Here are the upcoming features for Mainline Linux 5.7:
- F2FS Zstd compression support.

pihacker
Posts: 18
Joined: Sat May 30, 2020 8:44 pm

Re: Status of Raspberry Pi 4 in Mainline

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.

swahren
Posts: 149
Joined: Mon Sep 19, 2016 5:24 pm
Location: Germany

Re: Status of Raspberry Pi 4 in Mainline

Mon Jun 01, 2020 7:13 pm

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

User avatar
Gavinmc42
Posts: 4846
Joined: Wed Aug 28, 2013 3:31 am

Re: Status of Raspberry Pi 4 in Mainline

Tue Jun 02, 2020 4:43 am

extend pinctrl/gpio driver to support all 58 GPIOs of BCM2711
Compute modules coming? That would be handy
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

swahren
Posts: 149
Joined: Mon Sep 19, 2016 5:24 pm
Location: Germany

Re: Status of Raspberry Pi 4 in Mainline

Tue Jun 02, 2020 12:38 pm

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

pihacker
Posts: 18
Joined: Sat May 30, 2020 8:44 pm

Re: Status of Raspberry Pi 4 in Mainline

Thu Jun 04, 2020 2:59 pm

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?

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 3464
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Status of Raspberry Pi 4 in Mainline

Thu Jun 04, 2020 3:13 pm

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.

pihacker
Posts: 18
Joined: Sat May 30, 2020 8:44 pm

Re: Status of Raspberry Pi 4 in Mainline

Thu Jun 04, 2020 3:26 pm

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?

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 3464
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Status of Raspberry Pi 4 in Mainline

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.

pihacker
Posts: 18
Joined: Sat May 30, 2020 8:44 pm

Re: Status of Raspberry Pi 4 in Mainline

Thu Jun 04, 2020 4:15 pm

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.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 3464
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Status of Raspberry Pi 4 in Mainline

Thu Jun 04, 2020 4:17 pm

I'm sure @swahren will be able to help with that.

pihacker
Posts: 18
Joined: Sat May 30, 2020 8:44 pm

Re: Status of Raspberry Pi 4 in Mainline

Thu Jun 04, 2020 4:24 pm

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

swahren
Posts: 149
Joined: Mon Sep 19, 2016 5:24 pm
Location: Germany

Re: Status of Raspberry Pi 4 in Mainline

Thu Jun 04, 2020 5:27 pm

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.

pihacker
Posts: 18
Joined: Sat May 30, 2020 8:44 pm

Re: Status of Raspberry Pi 4 in Mainline

Fri Jun 05, 2020 9:04 am

@swahren moved discussion to a new thread -- viewtopic.php?f=71&t=276236

Return to “Linux Kernel”