From 835ee8baed06f752b2c04fde6f328b1e0a27b985 Mon Sep 17 00:00:00 2001
From: Jonathan Bell <jonathan@raspberrypi.com>
Date: Wed, 8 Nov 2023 16:14:25 +0000
Subject: [PATCH 0719/1085] arm: dts: change RP1 SDHCI controller compatible
 string

Also add a sdio-pi5 overlay which enables mmc0 on GPIOs 22-27, as was
possible with earlier models of Pi.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
---
 arch/arm/boot/dts/broadcom/rp1.dtsi           |  4 ++--
 arch/arm/boot/dts/overlays/Makefile           |  1 +
 arch/arm/boot/dts/overlays/README             |  7 ++++++
 arch/arm/boot/dts/overlays/overlay_map.dts    |  4 ++++
 .../boot/dts/overlays/sdio-pi5-overlay.dts    | 24 +++++++++++++++++++
 5 files changed, 38 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/boot/dts/overlays/sdio-pi5-overlay.dts

--- a/arch/arm/boot/dts/broadcom/rp1.dtsi
+++ b/arch/arm/boot/dts/broadcom/rp1.dtsi
@@ -962,7 +962,7 @@
 
 		rp1_mmc0: mmc@180000 {
 			reg = <0xc0 0x40180000  0x0 0x100>;
-			compatible = "snps,dwcmshc-sdhci";
+			compatible = "raspberrypi,rp1-dwcmshc";
 			interrupts = <RP1_INT_SDIO0 IRQ_TYPE_LEVEL_HIGH>;
 			clocks = <&rp1_clocks RP1_CLK_SYS &sdhci_core
 			          &rp1_clocks RP1_CLK_SDIO_TIMER
@@ -978,7 +978,7 @@
 
 		rp1_mmc1: mmc@184000 {
 			reg = <0xc0 0x40184000  0x0 0x100>;
-			compatible = "snps,dwcmshc-sdhci";
+			compatible = "raspberrypi,rp1-dwcmshc";
 			interrupts = <RP1_INT_SDIO1 IRQ_TYPE_LEVEL_HIGH>;
 			clocks = <&rp1_clocks RP1_CLK_SYS &sdhci_core
 			          &rp1_clocks RP1_CLK_SDIO_TIMER
--- a/arch/arm/boot/dts/overlays/Makefile
+++ b/arch/arm/boot/dts/overlays/Makefile
@@ -225,6 +225,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \
 	sc16is752-spi1.dtbo \
 	sdhost.dtbo \
 	sdio.dtbo \
+	sdio-pi5.dtbo \
 	seeed-can-fd-hat-v1.dtbo \
 	seeed-can-fd-hat-v2.dtbo \
 	sh1106-spi.dtbo \
--- a/arch/arm/boot/dts/overlays/README
+++ b/arch/arm/boot/dts/overlays/README
@@ -3932,6 +3932,13 @@ Info:   This overlay is now deprecated.
 Load:   <Deprecated>
 
 
+Name:   sdio-pi5
+Info:   Selects the rp1_mmc0 interface and enables it on GPIOs 22-27.
+        Pi 5 only.
+Load:   dtoverlay=sdio-pi5
+Params: <None>
+
+
 Name:   sdtweak
 Info:   This overlay is now deprecated. Use the sd_* dtparams in the
         base DTB, e.g. "dtoverlay=sdtweak,poll_once" becomes
--- a/arch/arm/boot/dts/overlays/overlay_map.dts
+++ b/arch/arm/boot/dts/overlays/overlay_map.dts
@@ -250,6 +250,10 @@
 		deprecated = "use sdio,bus_width=1,gpios_22_25";
 	};
 
+	sdio-pi5 {
+		bcm2712;
+	};
+
 	sdtweak {
 		deprecated = "use 'dtparam=sd_poll_once' etc.";
 	};
--- /dev/null
+++ b/arch/arm/boot/dts/overlays/sdio-pi5-overlay.dts
@@ -0,0 +1,24 @@
+/dts-v1/;
+/plugin/;
+
+/* SDIO/SD/MMC on RP1 bank 0 */
+
+/{
+	compatible = "brcm,bcm2712";
+
+	fragment@0 {
+		target = <&rp1_mmc0>;
+		frag0: __overlay__ {
+			status = "okay";
+			pinctrl-0 = <&rp1_sdio0_22_27>;
+			pinctrl-names = "default";
+		};
+	};
+
+	fragment@1 {
+		target = <&rp1_sdio_clk0>;
+		frag1: __overlay__ {
+			status = "okay";
+		};
+	};
+};
