From dbea6f979e2cfb3b6b313aa8ed66be69c2d9eea8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@c0d3.blue>
Date: Fri, 10 Nov 2023 05:38:48 +0100
Subject: [PATCH] bcm27xx-bcm2711: add (broken) support for the Raspberry Pi 4
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Known issues:

* 11s is not working
* has no reset button, only SSH access, serial access or an external SD
  card update can return it to config mode at the moment
* LED: generally the red sys LED is working, including boot and failsafe
  blink patters, but:
  * sometimes not lit after boot
  * not blinking in config mode; instead sometimes either persistently on
    and sometimes persistently off after booting into config mode

Therefore adding it as broken.

However, due to its CPU power and small size still interesting as a VPN
offloader or WiFi rooftop core node (e.g. to Gluon'ify 5+60GHz devices).

Manifest aliases are added for upgrades from unreleased Gluon builds
and can be removed again at some point in the future.

Tested on a Raspberry Pi 4 Model B Rev 1.1.

Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
---
 .github/filters.yml     | 11 +++++++++++
 targets/bcm27xx-bcm2711 | 11 +++++++++++
 targets/targets.mk      |  1 +
 3 files changed, 23 insertions(+)
 create mode 100644 targets/bcm27xx-bcm2711

diff --git a/.github/filters.yml b/.github/filters.yml
index aae15ef36..2f634f354 100644
--- a/.github/filters.yml
+++ b/.github/filters.yml
@@ -281,6 +281,17 @@
     "targets/targets.mk",
     "targets/bcm27xx.inc"
   ],
+  "bcm27xx-bcm2711": [
+    "targets/bcm27xx-bcm2711",
+    ".github/workflows/build-gluon.yml",
+    "modules",
+    "Makefile",
+    "patches/**",
+    "scripts/**",
+    "targets/generic",
+    "targets/targets.mk",
+    "targets/bcm27xx.inc"
+  ],
   "mvebu-cortexa9": [
     "targets/mvebu-cortexa9",
     ".github/workflows/build-gluon.yml",
diff --git a/targets/bcm27xx-bcm2711 b/targets/bcm27xx-bcm2711
new file mode 100644
index 000000000..84fb1087c
--- /dev/null
+++ b/targets/bcm27xx-bcm2711
@@ -0,0 +1,11 @@
+include 'bcm27xx.inc'
+
+device('raspberrypi-4-model-b', 'rpi-4', {
+	manifest_aliases = {
+		-- from Gluon 2023.1 and older
+		'raspberry-pi-4-model-b-rev-1.1',
+		'raspberry-pi-4-model-b-rev-1.2', -- untested
+		'raspberry-pi-4-model-b-rev-1.4', -- untested
+		'raspberry-pi-4-model-b-rev-1.5', -- untested
+	},
+})
diff --git a/targets/targets.mk b/targets/targets.mk
index 30c024f2f..149551341 100644
--- a/targets/targets.mk
+++ b/targets/targets.mk
@@ -28,5 +28,6 @@ $(eval $(call GluonTarget,x86,64))
 
 ifeq ($(BROKEN),1)
 $(eval $(call GluonTarget,bcm27xx,bcm2710)) # BROKEN: Untested
+$(eval $(call GluonTarget,bcm27xx,bcm2711)) # BROKEN: No 11s support, no reset button, sys LED issues
 $(eval $(call GluonTarget,mvebu,cortexa9)) # BROKEN: No 11s support
 endif
-- 
GitLab