From 91eed5d9fb74e6c740291362ba12e11a2222a9fd Mon Sep 17 00:00:00 2001
From: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Date: Sat, 2 Oct 2021 17:36:48 +0200
Subject: [PATCH] rockchip: rename "Rock Pi 4" to "Rock Pi 4A"

Kernel has added the different variants of the Rock Pi 4 in commit
b5edb0467370 ("arm64: dts: rockchip: Mark rock-pi-4 as rock-pi-4a
dts"). The former Rock Pi 4 is now Rock Pi 4A.

For compatibility with kernel 5.4, this rename has been held back
so far. Having switched to kernel 5.10 now, we can finally apply
it in our tree as well.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
---
 package/boot/uboot-rockchip/Makefile          |  2 +-
 .../boot/dts/rockchip/rk3399-rock-pi-4.dts    | 19 -------------------
 target/linux/rockchip/image/armv8.mk          |  8 ++++----
 .../patches-5.10/105-rockchip-rock-pi-4.patch | 10 ----------
 4 files changed, 5 insertions(+), 34 deletions(-)
 delete mode 100644 target/linux/rockchip/files-5.10/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dts
 delete mode 100644 target/linux/rockchip/patches-5.10/105-rockchip-rock-pi-4.patch

diff --git a/package/boot/uboot-rockchip/Makefile b/package/boot/uboot-rockchip/Makefile
index f419ec6ca7..b886ef0122 100644
--- a/package/boot/uboot-rockchip/Makefile
+++ b/package/boot/uboot-rockchip/Makefile
@@ -52,7 +52,7 @@ define U-Boot/rock-pi-4-rk3399
   BUILD_SUBTARGET:=armv8
   NAME:=Rock Pi 4
   BUILD_DEVICES:= \
-    radxa_rock-pi-4
+    radxa_rock-pi-4a
   DEPENDS:=+PACKAGE_u-boot-rock-pi-4-rk3399:arm-trusted-firmware-rockchip
   PKG_BUILD_DEPENDS:=arm-trusted-firmware-rockchip
   ATF:=rk3399_bl31.elf
diff --git a/target/linux/rockchip/files-5.10/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dts b/target/linux/rockchip/files-5.10/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dts
deleted file mode 100644
index f6e7710a01..0000000000
--- a/target/linux/rockchip/files-5.10/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dts
+++ /dev/null
@@ -1,19 +0,0 @@
-// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
-/*
- * Copyright (c) 2019 Akash Gajjar <Akash_Gajjar@mentor.com>
- * Copyright (c) 2019 Pragnesh Patel <Pragnesh_Patel@mentor.com>
- */
-
-/* TODO
- * Delete this file and migrate RockPi 4 to RockPi 4A after
- * removing Kernel 5.4.
- */
-
-
-/dts-v1/;
-#include "rk3399-rock-pi-4.dtsi"
-
-/ {
-	model = "Radxa ROCK Pi 4";
-	compatible = "radxa,rockpi4", "rockchip,rk3399";
-};
diff --git a/target/linux/rockchip/image/armv8.mk b/target/linux/rockchip/image/armv8.mk
index ee411d266b..6cc31f1d8c 100644
--- a/target/linux/rockchip/image/armv8.mk
+++ b/target/linux/rockchip/image/armv8.mk
@@ -32,12 +32,12 @@ define Device/pine64_rockpro64
 endef
 TARGET_DEVICES += pine64_rockpro64
 
-define Device/radxa_rock-pi-4
+define Device/radxa_rock-pi-4a
   DEVICE_VENDOR := Radxa
-  DEVICE_MODEL := ROCK Pi 4
+  DEVICE_MODEL := ROCK Pi 4A
   SOC := rk3399
-  SUPPORTED_DEVICES := radxa,rockpi4
+  SUPPORTED_DEVICES := radxa,rockpi4a radxa,rockpi4
   UBOOT_DEVICE_NAME := rock-pi-4-rk3399
   IMAGE/sysupgrade.img.gz := boot-common | boot-script | pine64-img | gzip | append-metadata
 endef
-TARGET_DEVICES += radxa_rock-pi-4
+TARGET_DEVICES += radxa_rock-pi-4a
diff --git a/target/linux/rockchip/patches-5.10/105-rockchip-rock-pi-4.patch b/target/linux/rockchip/patches-5.10/105-rockchip-rock-pi-4.patch
deleted file mode 100644
index 404f64ab95..0000000000
--- a/target/linux/rockchip/patches-5.10/105-rockchip-rock-pi-4.patch
+++ /dev/null
@@ -1,10 +0,0 @@
---- a/arch/arm64/boot/dts/rockchip/Makefile
-+++ b/arch/arm64/boot/dts/rockchip/Makefile
-@@ -36,6 +36,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-pi
- dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-puma-haikou.dtb
- dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-roc-pc.dtb
- dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-roc-pc-mezzanine.dtb
-+dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-rock-pi-4.dtb
- dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-rock-pi-4a.dtb
- dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-rock-pi-4b.dtb
- dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-rock-pi-4c.dtb
-- 
2.30.2