Port-arm archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Raspberry Pi 4 support on aarch64 FDT boot (without ACPI)



Hi,

Currently Raspberry Pi 4B seems working even on FDT boot
(without ACPI) with serial console, but framebuffer is not recognized:
 https://dmesgd.nycbug.org/index.cgi?do=view&id=8834

This is because:

(1) Pi4 framebuffer reports "format" as "a8r8g8b8"
    but simplefb(4) doesn't handle it

(2) Pi4 framebuffer is under /chosen node, but /chosen reports
    "compatible" value as "simple_bus" (not expected "simple-bus")
    so it doesn't match as fdtbus/simplebus(4)

Furthermore, as noted in the NetBSD/evbarm Raspberry Pi wiki,
 https://wiki.netbsd.org/ports/evbarm/raspberry_pi/#index13h2
currently evbarm/conf/GENERIC64 doesn't have bcm2838pcie
(and bcm2838rng).

The following simple changes just make evbarm GENERIC64 kernel
work on my Raspberry Pi 4B 1.5 (including framebuffer and USB keyboard)
without extra ACPI settings (diff is also attached):
 https://github.com/tsutsui/netbsd-src/compare/trunk...tsutsui:netbsd-src:rpi4-fdt

dmesg is here:
 https://dmesgd.nycbug.org/index.cgi?do=view&id=8860

However it looks simplefb(4) conflicts genfb(4) provided by ACPI
and this modified GENERIC64 kernel booted from UEFI/ACPI bootloader
gets silent reboot during probing devices (I cannot see what's
actually going on since I have not checked how I can enable
serial console on UEFI/ACPI boot).

How can we handle such ACPI/FDT conflicts?

---
diff --git a/sys/arch/arm/fdt/arm_simplefb.c b/sys/arch/arm/fdt/arm_simplefb.c
index 23f17ecd1730..cc8f213e6523 100644
--- a/sys/arch/arm/fdt/arm_simplefb.c
+++ b/sys/arch/arm/fdt/arm_simplefb.c
@@ -213,7 +213,8 @@ arm_simplefb_preattach(void)
 		return;
 
 	if (strcmp(format, "a8b8g8r8") == 0 ||
-	    strcmp(format, "x8r8g8b8") == 0) {
+	    strcmp(format, "x8r8g8b8") == 0 ||
+	    strcmp(format, "a8r8g8b8") == 0) {
 		depth = 32;
 	} else if (strcmp(format, "r8g8b8a8") == 0 ||
 		   strcmp(format, "b8g8r8x8") == 0) {
diff --git a/sys/arch/evbarm/conf/GENERIC64 b/sys/arch/evbarm/conf/GENERIC64
index edc031dfc4fc..2deea3c50668 100644
--- a/sys/arch/evbarm/conf/GENERIC64
+++ b/sys/arch/evbarm/conf/GENERIC64
@@ -275,6 +275,7 @@ tegra210xphy*	at tegra210xpad?
 applepcie*	at fdt?			# Apple PCIe
 pcihost*	at fdt?			# Generic PCI host controller
 acpipchb*	at acpi?		# ACPI PCIe host bridge
+bcm2838pcie*	at fdt?			# STB PCIe host controller
 rkpcie* 	at fdt?			# Rockchip AXI PCIE
 rkpciephy*	at fdt? pass 9		# Rockchip AXI PCIE PHY
 tegrapcie0	at fdt?			# NVIDIA Tegra PCIE
@@ -407,7 +408,8 @@ applepmgr* 	at fdt? pass 0
 # Random number generators and security devices
 amdccp* 	at fdt?			# AMD Cryptographic Coprocessor RNG
 amdccp* 	at acpi?
-bcmrng* 	at fdt?			# Broadcom BCM283x RNG
+bcmrng* 	at fdt?			# Broadcom BCM2835/6/7 RNG
+bcm2838rng*	at fdt?			# Broadcom BCM2838 RNG
 mesonrng*	at fdt?			# Amlogic Meson RNG
 rkv1crypto* 	at fdt?			# Rockchip Crypto v1
 sun8icrypto* 	at fdt?			# Allwinner Crypto Engine
diff --git a/sys/dev/fdt/fdtbus.c b/sys/dev/fdt/fdtbus.c
index e557b0c6479a..fc244ef1e88a 100644
--- a/sys/dev/fdt/fdtbus.c
+++ b/sys/dev/fdt/fdtbus.c
@@ -90,6 +90,7 @@ static void	fdt_post_attach(struct fdt_node *);
 static const struct device_compatible_entry compat_data[] = {
 	{ .compat = "simple-bus" },
 	{ .compat = "simple-pm-bus" },
+	{ .compat = "simple_bus" },
 	DEVICE_COMPAT_EOL
 };
 
diff --git a/sys/dev/fdt/simplefb.c b/sys/dev/fdt/simplefb.c
index a39646ea6e0b..cc05b13659a1 100644
--- a/sys/dev/fdt/simplefb.c
+++ b/sys/dev/fdt/simplefb.c
@@ -157,7 +157,8 @@ simplefb_attach_genfb(struct simplefb_softc *sc)
 	}
 
 	if (strcmp(format, "a8b8g8r8") == 0 ||
-	    strcmp(format, "x8r8g8b8") == 0) {
+	    strcmp(format, "x8r8g8b8") == 0 ||
+	    strcmp(format, "a8r8g8b8") == 0) {
 		depth = 32;
 	} else if (strcmp(format, "r8g8b8a8") == 0 ||
 		   strcmp(format, "b8g8r8x8") == 0) {
---

Thanks,
---
Izumi Tsutsui


Home | Main Index | Thread Index | Old Index