git: 9b3415e9ec55 - main - sys/dts: Add SD card overlays for the BananaPi-F3 SoC

Bojan Novković <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.src,gmane.os.freebsd.current.scm
Message-ID <[email protected]>
The branch main has been updated by bnovkov:

URL: https://cgit.FreeBSD.org/src/commit/?id=9b3415e9ec55ef8248b05750932eb0a247739413

commit 9b3415e9ec55ef8248b05750932eb0a247739413
Author:     Bojan Novković <[email protected]>
AuthorDate: 2026-05-19 21:05:28 +0000
Commit:     Bojan Novković <[email protected]>
CommitDate: 2026-08-16 17:15:08 +0000

    sys/dts: Add SD card overlays for the BananaPi-F3 SoC
    
    The K1 user manual lists three separate SDHCI devices but the
    upstream DTS file only defines the eMMC device.
    
    Create a temporary overlay to allow the BananaPi-F3 to boot from the
    SD card until this is addressed upstream.
    
    Differential Revision:  https://reviews.freebsd.org/D57177
    Reviewed by:    mhorne
---
 sys/dts/Makefile                             |  2 +-
 sys/dts/riscv/Makefile                       |  5 +++++
 sys/dts/riscv/Makefile.inc                   |  1 +
 sys/dts/riscv/overlays/Makefile              |  5 +++++
 sys/dts/riscv/overlays/spacemit-k1-mmc0.dtso | 32 ++++++++++++++++++++++++++++
 sys/modules/dtb/spacemit/Makefile            |  1 +
 6 files changed, 45 insertions(+), 1 deletion(-)

diff --git a/sys/dts/Makefile b/sys/dts/Makefile
index 99eb23c033cf..f62de06aa0ba 100644
--- a/sys/dts/Makefile
+++ b/sys/dts/Makefile
@@ -1,3 +1,3 @@
-SUBDIR=arm powerpc
+SUBDIR=arm powerpc riscv
 
 .include <bsd.subdir.mk>
diff --git a/sys/dts/riscv/Makefile b/sys/dts/riscv/Makefile
new file mode 100644
index 000000000000..a0cb93ec26d8
--- /dev/null
+++ b/sys/dts/riscv/Makefile
@@ -0,0 +1,5 @@
+DTS!=ls ${.CURDIR}/*.dts
+
+all: test-dts
+
+.include <bsd.init.mk>
diff --git a/sys/dts/riscv/Makefile.inc b/sys/dts/riscv/Makefile.inc
new file mode 100644
index 000000000000..01b5f23410c8
--- /dev/null
+++ b/sys/dts/riscv/Makefile.inc
@@ -0,0 +1 @@
+.include "../Makefile.inc"
diff --git a/sys/dts/riscv/overlays/Makefile b/sys/dts/riscv/overlays/Makefile
new file mode 100644
index 000000000000..c234bead7d1b
--- /dev/null
+++ b/sys/dts/riscv/overlays/Makefile
@@ -0,0 +1,5 @@
+DTSO!=ls ${.CURDIR}/*.dtso
+
+all: test-dtso
+
+.include <bsd.init.mk>
diff --git a/sys/dts/riscv/overlays/spacemit-k1-mmc0.dtso b/sys/dts/riscv/overlays/spacemit-k1-mmc0.dtso
new file mode 100644
index 000000000000..55abae64ca78
--- /dev/null
+++ b/sys/dts/riscv/overlays/spacemit-k1-mmc0.dtso
@@ -0,0 +1,32 @@
+#include <dt-bindings/clock/spacemit,k1-syscon.h>
+
+/dts-v1/;
+/plugin/;
+/ {
+	compatible = "bananapi,bpi-f3", "spacemit,k1";
+};
+
+&{/soc/storage-bus} {
+	sd: mmc@d4280000 {
+		compatible = "spacemit,k1-sdhci";
+		reg = <0x0 0xd4280000 0x0 0x200>;
+		clocks = <&syscon_apmu CLK_SDH_AXI>,
+			 <&syscon_apmu CLK_SDH0>;
+		clock-names = "core", "io";
+		resets = <&syscon_apmu RESET_SDH_AXI>,
+			 <&syscon_apmu RESET_SDH0>;
+		reset-names = "axi", "sdh";
+		interrupts = <99>;
+		status = "disabled";
+	};
+};
+
+&sd {
+	bus-width = <4>;
+	wp-inverted;
+	no-mmc;
+	no-sdio;
+	/* SD supports clock rates up to SDR104. */
+	max-frequency = <208000000>;
+	status = "okay";
+};
diff --git a/sys/modules/dtb/spacemit/Makefile b/sys/modules/dtb/spacemit/Makefile
index 78187cba25e1..d9b25db9f1f8 100644
--- a/sys/modules/dtb/spacemit/Makefile
+++ b/sys/modules/dtb/spacemit/Makefile
@@ -1,3 +1,4 @@
 DTS=	spacemit/k1-bananapi-f3.dts
+DTSO=	spacemit-k1-mmc0.dtso
 
 .include <bsd.dtb.mk>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.