openwrt/target/linux/bcm27xx/patches-5.4/950-0957-overlays-Add-spi0-1cs-and-spi0-2cs.patch
Álvaro Fernández Rojas 62b7f5931c bcm27xx: import latest patches from the RPi foundation
bcm2708: boot tested on RPi B+ v1.2
bcm2709: boot tested on RPi 3B v1.2 and RPi 4B v1.1 4G
bcm2710: boot tested on RPi 3B v1.2
bcm2711: boot tested on RPi 4B v1.1 4G

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
(cherry-picked from commit f07e572f64)
2021-02-19 07:17:21 +01:00

200 lines
4.7 KiB
Diff

From 692af7a59fd6d9d3b64edbf028cd75b0096ef8c7 Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Fri, 28 Aug 2020 12:55:41 +0100
Subject: [PATCH] overlays: Add spi0-1cs and spi0-2cs
The spi0-1cs overlay allows the SPI0 interface to be run with a single
CS line, which can be useful if GPIOs are in short supply. The no_miso
parameter is for write-only devices that don't need the return channel,
and again is there to free up a GPIO.
spi0-2cs is the new name for spi0-cs (now deprecated with a redirect
to spi0-2cs), but with the addedd no_miso parameter.
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
arch/arm/boot/dts/overlays/Makefile | 3 +-
arch/arm/boot/dts/overlays/README | 22 ++++++++--
arch/arm/boot/dts/overlays/overlay_map.dts | 4 ++
.../boot/dts/overlays/spi0-1cs-overlay.dts | 42 +++++++++++++++++++
...i0-cs-overlay.dts => spi0-2cs-overlay.dts} | 8 ++++
5 files changed, 75 insertions(+), 4 deletions(-)
create mode 100644 arch/arm/boot/dts/overlays/spi0-1cs-overlay.dts
rename arch/arm/boot/dts/overlays/{spi0-cs-overlay.dts => spi0-2cs-overlay.dts} (79%)
--- a/arch/arm/boot/dts/overlays/Makefile
+++ b/arch/arm/boot/dts/overlays/Makefile
@@ -161,7 +161,8 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \
spi-gpio35-39.dtbo \
spi-gpio40-45.dtbo \
spi-rtc.dtbo \
- spi0-cs.dtbo \
+ spi0-1cs.dtbo \
+ spi0-2cs.dtbo \
spi1-1cs.dtbo \
spi1-2cs.dtbo \
spi1-3cs.dtbo \
--- a/arch/arm/boot/dts/overlays/README
+++ b/arch/arm/boot/dts/overlays/README
@@ -2412,11 +2412,27 @@ Load: dtoverlay=spi-rtc,<param>=<val>
Params: pcf2123 Select the PCF2123 device
-Name: spi0-cs
-Info: Allows the (software) CS pins for SPI0 to be changed
-Load: dtoverlay=spi0-cs,<param>=<val>
+Name: spi0-1cs
+Info: Only use one CS pin for SPI0
+Load: dtoverlay=spi0-1cs,<param>=<val>
+Params: cs0_pin GPIO pin for CS0 (default 8)
+ no_miso Don't claim and use the MISO pin (9), freeing
+ it for other uses.
+
+
+Name: spi0-2cs
+Info: Change the CS pins for SPI0
+Load: dtoverlay=spi0-2cs,<param>=<val>
Params: cs0_pin GPIO pin for CS0 (default 8)
cs1_pin GPIO pin for CS1 (default 7)
+ no_miso Don't claim and use the MISO pin (9), freeing
+ it for other uses.
+
+
+Name: spi0-cs
+Info: This overlay has been renamed spi0-1cs, keeping spi0-cs as an
+ alias for backwards compatibility.
+Load: <Deprecated>
Name: spi0-hw-cs
--- 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-cs {
+ renamed = "spi0-2cs";
+ };
+
spi0-hw-cs {
deprecated = "no longer necessary";
};
--- /dev/null
+++ b/arch/arm/boot/dts/overlays/spi0-1cs-overlay.dts
@@ -0,0 +1,42 @@
+/dts-v1/;
+/plugin/;
+
+
+/ {
+ compatible = "brcm,bcm2835";
+
+ fragment@0 {
+ target = <&spi0_cs_pins>;
+ frag0: __overlay__ {
+ brcm,pins = <8>;
+ };
+ };
+
+ fragment@1 {
+ target = <&spi0>;
+ frag1: __overlay__ {
+ cs-gpios = <&gpio 8 1>;
+ status = "okay";
+ };
+ };
+
+ fragment@2 {
+ target = <&spidev1>;
+ __overlay__ {
+ status = "disabled";
+ };
+ };
+
+ fragment@3 {
+ target = <&spi0_pins>;
+ __dormant__ {
+ brcm,pins = <10 11>;
+ };
+ };
+
+ __overrides__ {
+ cs0_pin = <&frag0>,"brcm,pins:0",
+ <&frag1>,"cs-gpios:4";
+ no_miso = <0>,"=3";
+ };
+};
--- a/arch/arm/boot/dts/overlays/spi0-cs-overlay.dts
+++ /dev/null
@@ -1,29 +0,0 @@
-/dts-v1/;
-/plugin/;
-
-
-/ {
- compatible = "brcm,bcm2835";
-
- fragment@0 {
- target = <&spi0_cs_pins>;
- frag0: __overlay__ {
- brcm,pins = <8 7>;
- };
- };
-
- fragment@1 {
- target = <&spi0>;
- frag1: __overlay__ {
- cs-gpios = <&gpio 8 1>, <&gpio 7 1>;
- status = "okay";
- };
- };
-
- __overrides__ {
- cs0_pin = <&frag0>,"brcm,pins:0",
- <&frag1>,"cs-gpios:4";
- cs1_pin = <&frag0>,"brcm,pins:4",
- <&frag1>,"cs-gpios:16";
- };
-};
--- /dev/null
+++ b/arch/arm/boot/dts/overlays/spi0-2cs-overlay.dts
@@ -0,0 +1,37 @@
+/dts-v1/;
+/plugin/;
+
+
+/ {
+ compatible = "brcm,bcm2835";
+
+ fragment@0 {
+ target = <&spi0_cs_pins>;
+ frag0: __overlay__ {
+ brcm,pins = <8 7>;
+ };
+ };
+
+ fragment@1 {
+ target = <&spi0>;
+ frag1: __overlay__ {
+ cs-gpios = <&gpio 8 1>, <&gpio 7 1>;
+ status = "okay";
+ };
+ };
+
+ fragment@2 {
+ target = <&spi0_pins>;
+ __dormant__ {
+ brcm,pins = <10 11>;
+ };
+ };
+
+ __overrides__ {
+ cs0_pin = <&frag0>,"brcm,pins:0",
+ <&frag1>,"cs-gpios:4";
+ cs1_pin = <&frag0>,"brcm,pins:4",
+ <&frag1>,"cs-gpios:16";
+ no_miso = <0>,"=2";
+ };
+};