From 9fcbc40311f8de3f7a0a27155f310ff19e150d76 Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Thu, 30 Jul 2020 18:06:24 +0100
Subject: [PATCH] overlays: Delete spi0-hw-cs

The spi0-hw-cs overlay is unnecessary (and actually harmful) with the
current kernels. Delete it, leaving a note in the README and a
deprecation message from the firmware:

    dterror: overlay 'spi0-hw-cs' is deprecated: no longer necessary

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
 arch/arm/boot/dts/overlays/Makefile           |  1 -
 arch/arm/boot/dts/overlays/README             |  6 ++---
 arch/arm/boot/dts/overlays/overlay_map.dts    |  4 +++
 .../boot/dts/overlays/spi0-hw-cs-overlay.dts  | 26 -------------------
 4 files changed, 7 insertions(+), 30 deletions(-)
 delete mode 100644 arch/arm/boot/dts/overlays/spi0-hw-cs-overlay.dts

--- a/arch/arm/boot/dts/overlays/Makefile
+++ b/arch/arm/boot/dts/overlays/Makefile
@@ -159,7 +159,6 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \
 	spi-gpio40-45.dtbo \
 	spi-rtc.dtbo \
 	spi0-cs.dtbo \
-	spi0-hw-cs.dtbo \
 	spi1-1cs.dtbo \
 	spi1-2cs.dtbo \
 	spi1-3cs.dtbo \
--- a/arch/arm/boot/dts/overlays/README
+++ b/arch/arm/boot/dts/overlays/README
@@ -2346,9 +2346,9 @@ Params: cs0_pin                 GPIO pin
 
 
 Name:   spi0-hw-cs
-Info:   Re-enables hardware CS/CE (chip selects) for SPI0
-Load:   dtoverlay=spi0-hw-cs
-Params: <None>
+Info:   This overlay has been deprecated and removed because it is no longer
+        necessary and has been seen to prevent spi0 from working.
+Load:   <Deprecated>
 
 
 Name:   spi1-1cs
--- a/arch/arm/boot/dts/overlays/overlay_map.dts
+++ b/arch/arm/boot/dts/overlays/overlay_map.dts
@@ -61,6 +61,10 @@
 		deprecated = "use sdio,bus_width=1,gpios_22_25";
 	};
 
+	spi0-hw-cs {
+		deprecated = "no longer necessary";
+	};
+
 	spi3-1cs {
 		bcm2711;
 	};
--- a/arch/arm/boot/dts/overlays/spi0-hw-cs-overlay.dts
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Device tree overlay to re-enable hardware CS for SPI0
- */
-
-/dts-v1/;
-/plugin/;
-
-/ {
-	compatible = "brcm,bcm2835";
-
-	fragment@0 {
-		target = <&spi0>;
-		__overlay__ {
-			cs-gpios = <0>, <0>;
-			status = "okay";
-		};
-	};
-
-	fragment@1 {
-		target = <&spi0_cs_pins>;
-		__overlay__ {
-			brcm,pins = <8 7>;
-			brcm,function = <4>; /* alt0 */
-		};
-	};
-};
