[PATCH] arm: rockchip: add support for the xulong orangepi 5 plus

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

 



Add basic support for the Xulong OrangePi 5 Plus (featuring the
Rockchip RK3588 SoC). It should be noted that barebox boots and
one Ethernet port is functional, but apart from that several
features do not work yet (PMIC, SPI flash, USB, other PCIe
peripherals such as the second Ethernet port, ...).

Signed-off-by: Michael Riesch <michael.riesch@xxxxxxxxxxxxxx>
---
 arch/arm/boards/Makefile                           |  1 +
 arch/arm/boards/xunlong-orangepi-5-plus/.gitignore |  1 +
 arch/arm/boards/xunlong-orangepi-5-plus/Makefile   |  3 +
 arch/arm/boards/xunlong-orangepi-5-plus/board.c    | 39 +++++++++++
 arch/arm/boards/xunlong-orangepi-5-plus/lowlevel.c | 25 +++++++
 arch/arm/dts/Makefile                              |  1 +
 arch/arm/dts/rk3588-orangepi-5-plus.dts            | 77 ++++++++++++++++++++++
 arch/arm/mach-rockchip/Kconfig                     |  6 ++
 images/Makefile.rockchip                           |  1 +
 9 files changed, 154 insertions(+)

diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile
index e0dc27cb3d..67d91616f6 100644
--- a/arch/arm/boards/Makefile
+++ b/arch/arm/boards/Makefile
@@ -179,3 +179,4 @@ obj-$(CONFIG_MACH_VARISCITE_DT8MCUSTOMBOARD_IMX8MP)	+= variscite-dt8mcustomboard
 obj-$(CONFIG_MACH_RADXA_CM3)			+= radxa-cm3/
 obj-$(CONFIG_MACH_TQMA93XX)			+= tqma93xx/
 obj-$(CONFIG_MACH_WOLFVISION_PF5)		+= wolfvision-pf5/
+obj-$(CONFIG_MACH_XUNLONG_ORANGEPI_5_PLUS)	+= xunlong-orangepi-5-plus/
diff --git a/arch/arm/boards/xunlong-orangepi-5-plus/.gitignore b/arch/arm/boards/xunlong-orangepi-5-plus/.gitignore
new file mode 100644
index 0000000000..f458f794b5
--- /dev/null
+++ b/arch/arm/boards/xunlong-orangepi-5-plus/.gitignore
@@ -0,0 +1 @@
+sdram-init.bin
diff --git a/arch/arm/boards/xunlong-orangepi-5-plus/Makefile b/arch/arm/boards/xunlong-orangepi-5-plus/Makefile
new file mode 100644
index 0000000000..b37b6c870b
--- /dev/null
+++ b/arch/arm/boards/xunlong-orangepi-5-plus/Makefile
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
+obj-y += board.o
+lwl-y += lowlevel.o
diff --git a/arch/arm/boards/xunlong-orangepi-5-plus/board.c b/arch/arm/boards/xunlong-orangepi-5-plus/board.c
new file mode 100644
index 0000000000..e211af8ecc
--- /dev/null
+++ b/arch/arm/boards/xunlong-orangepi-5-plus/board.c
@@ -0,0 +1,39 @@
+// SPDX-License-Identifier: GPL-2.0-only
+#include <bootsource.h>
+#include <common.h>
+#include <deep-probe.h>
+#include <init.h>
+#include <mach/rockchip/bbu.h>
+
+static int orangepi_5_plus_probe(struct device *dev)
+{
+	enum bootsource bootsource = bootsource_get();
+	int instance = bootsource_get_instance();
+
+	if (bootsource == BOOTSOURCE_MMC && instance == 1)
+		of_device_enable_path("/chosen/environment-sd");
+	else
+		of_device_enable_path("/chosen/environment-emmc");
+
+	rockchip_bbu_mmc_register("emmc", BBU_HANDLER_FLAG_DEFAULT,
+				  "/dev/mmc0");
+	rockchip_bbu_mmc_register("sd", 0, "/dev/mmc1");
+
+	return 0;
+}
+
+static const struct of_device_id orangepi_5_plus_of_match[] = {
+	{
+		.compatible = "xunlong,orangepi-5-plus",
+	},
+	{ /* sentinel */ },
+};
+
+static struct driver orangepi_5_plus_board_driver = {
+	.name = "board-orangepi-5-plus",
+	.probe = orangepi_5_plus_probe,
+	.of_compatible = orangepi_5_plus_of_match,
+};
+coredevice_platform_driver(orangepi_5_plus_board_driver);
+
+BAREBOX_DEEP_PROBE_ENABLE(orangepi_5_plus_of_match);
diff --git a/arch/arm/boards/xunlong-orangepi-5-plus/lowlevel.c b/arch/arm/boards/xunlong-orangepi-5-plus/lowlevel.c
new file mode 100644
index 0000000000..2fa921eee0
--- /dev/null
+++ b/arch/arm/boards/xunlong-orangepi-5-plus/lowlevel.c
@@ -0,0 +1,25 @@
+// SPDX-License-Identifier: GPL-2.0-only
+#include <common.h>
+#include <linux/sizes.h>
+#include <asm/barebox-arm-head.h>
+#include <asm/barebox-arm.h>
+#include <mach/rockchip/hardware.h>
+#include <mach/rockchip/atf.h>
+#include <debug_ll.h>
+#include <mach/rockchip/rockchip.h>
+
+extern char __dtb_rk3588_orangepi_5_plus_start[];
+
+ENTRY_FUNCTION(start_orangepi_5_plus, r0, r1, r2)
+{
+	putc_ll('>');
+
+	if (current_el() == 3)
+		relocate_to_adr_full(RK3588_BAREBOX_LOAD_ADDRESS);
+	else
+		relocate_to_current_adr();
+
+	setup_c();
+
+	rk3588_barebox_entry(__dtb_rk3588_orangepi_5_plus_start);
+}
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 68585e1e4b..6c9c23a834 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -186,6 +186,7 @@ lwl-$(CONFIG_MACH_VF610_TWR) += vf610-twr.dtb.o
 lwl-$(CONFIG_MACH_WEBASTO_CCBV2) += imx6ul-webasto-ccbv2.dtb.o
 lwl-$(CONFIG_MACH_WEBASTO_CCBV2) += imx6ul-webasto-marvel.dtb.o
 lwl-$(CONFIG_MACH_WOLFVISION_PF5) += rk3568-wolfvision-pf5.dtb.o
+lwl-$(CONFIG_MACH_XUNLONG_ORANGEPI_5_PLUS) += rk3588-orangepi-5-plus.dtb.o
 lwl-$(CONFIG_MACH_ZII_RDU1) +=	\
 	imx51-zii-rdu1.dtb.o		\
 	imx51-zii-scu2-mezz.dtb.o	\
diff --git a/arch/arm/dts/rk3588-orangepi-5-plus.dts b/arch/arm/dts/rk3588-orangepi-5-plus.dts
new file mode 100644
index 0000000000..8c765a853c
--- /dev/null
+++ b/arch/arm/dts/rk3588-orangepi-5-plus.dts
@@ -0,0 +1,77 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+
+/dts-v1/;
+
+#include <arm64/rockchip/rk3588-orangepi-5-plus.dts>
+#include "rk3588.dtsi"
+
+/ {
+	chosen: chosen {
+		environment-emmc {
+			compatible = "barebox,environment";
+			device-path = &environment_emmc;
+			status = "disabled";
+		};
+
+		environment-sd {
+			compatible = "barebox,environment";
+			device-path = &environment_sd;
+			status = "disabled";
+		};
+	};
+};
+
+&sdhci {
+	partitions {
+		compatible = "fixed-partitions";
+		#address-cells = <2>;
+		#size-cells = <2>;
+
+		environment_emmc: partition@408000 {
+			label = "barebox-environment";
+			reg = <0x0 0x408000 0x0 0x8000>;
+		};
+	};
+};
+
+&sdmmc {
+	partitions {
+		compatible = "fixed-partitions";
+		#address-cells = <2>;
+		#size-cells = <2>;
+
+		environment_sd: partition@408000 {
+			label = "barebox-environment";
+			reg = <0x0 0x408000 0x0 0x8000>;
+		};
+	};
+};
+
+&pcie3x4 {
+	/* Does not work in barebox (missing phy driver) */
+	status = "disabled";
+};
+
+&pcie30phy {
+	status = "disabled";
+};
+
+&pcie2x1l0 {
+	/* Does not work in barebox */
+	status = "disabled";
+};
+
+&pcie2x1l1 {
+	/* Does not work in barebox */
+	status = "disabled";
+};
+
+&usb_host0_ehci {
+	/* Does not work in barebox (missing phy driver) */
+	status = "disabled";
+};
+
+&usb_host1_ehci {
+	/* Does not work in barebox (missing phy driver) */
+	status = "disabled";
+};
diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index ebf937dd78..ddaab7c284 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -116,6 +116,12 @@ config MACH_WOLFVISION_PF5
 	help
 	  Say Y here if you are using a WolfVision PF5 mainboard
 
+config MACH_XUNLONG_ORANGEPI_5_PLUS
+       select ARCH_RK3588
+       bool "Xunlong Orange Pi 5 Plus"
+       help
+         Say Y here if you are using a Xunlong Orange Pi 5 Plus
+
 endif
 
 comment "select board features:"
diff --git a/images/Makefile.rockchip b/images/Makefile.rockchip
index e344e893a0..6619beae73 100644
--- a/images/Makefile.rockchip
+++ b/images/Makefile.rockchip
@@ -37,3 +37,4 @@ $(call build_rockchip_image, CONFIG_MACH_RADXA_ROCK3, start_rock3a, radxa-rock3/
 $(call build_rockchip_image, CONFIG_MACH_RADXA_ROCK5, start_rock5b, radxa-rock5/sdram-init.bin, rock5b)
 $(call build_rockchip_image, CONFIG_MACH_RADXA_CM3, start_radxa_cm3_io, radxa-cm3/sdram-init.bin, radxa-cm3-io)
 $(call build_rockchip_image, CONFIG_MACH_WOLFVISION_PF5, start_rk3568_wolfvision_pf5, wolfvision-pf5/sdram-init.bin, rk3568-wolfvision-pf5)
+$(call build_rockchip_image, CONFIG_MACH_XUNLONG_ORANGEPI_5_PLUS, start_orangepi_5_plus, xunlong-orangepi-5-plus/sdram-init.bin, orangepi_5_plus)

---
base-commit: efe529757debe7209398cbb495c69c640954d0d5
change-id: 20240918-feature-orange-pi-5-plus-97556db98395

Best regards,
-- 
Michael Riesch <michael.riesch@xxxxxxxxxxxxxx>





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux