openwrt/target/linux/bcm27xx/patches-6.1/950-0797-overlays-jedec-spi-nor-Add-speed-parameter.patch

309 lines
9.5 KiB
Diff
Raw Normal View History

From 76c457e7e2920342637b1955fbaadf2aae282f05 Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Fri, 23 Jun 2023 09:48:59 +0100
Subject: [PATCH] overlays: jedec-spi-nor: Add speed parameter
Add a speed parameter to the jedec-spi-nor overlay to allow much
faster accesses, taking the opportunity to simplify the internals.
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
arch/arm/boot/dts/overlays/README | 8 +-
.../dts/overlays/jedec-spi-nor-overlay.dts | 245 +++---------------
2 files changed, 41 insertions(+), 212 deletions(-)
--- a/arch/arm/boot/dts/overlays/README
+++ b/arch/arm/boot/dts/overlays/README
@@ -2557,9 +2557,11 @@ Name: jedec-spi-nor
Info: Adds support for JEDEC-compliant SPI NOR flash devices. (Note: The
"jedec,spi-nor" kernel driver was formerly known as "m25p80".)
Load: dtoverlay=jedec-spi-nor,<param>=<val>
-Params: flash-spi<n>-<m> Enables flash device on SPI<n>, CS#<m>.
- flash-fastr-spi<n>-<m> Enables flash device with fast read capability
- on SPI<n>, CS#<m>.
+Params: spi<n>-<m> Enable flash device on SPI<n>, CS#<m>
+ fastr Add fast read capability to the flash device
+ speed Maximum SPI frequency (Hz)
+ flash-spi<n>-<m> Same as spi<n>-<m> (deprecated)
+ flash-fastr-spi<n>-<m> Same as spi<n>->m>,fastr (deprecated)
Name: justboom-both
--- a/arch/arm/boot/dts/overlays/jedec-spi-nor-overlay.dts
+++ b/arch/arm/boot/dts/overlays/jedec-spi-nor-overlay.dts
@@ -3,6 +3,7 @@
// dtparams:
// flash-spi<n>-<m> - Enables flash device on SPI<n>, CS#<m>.
// flash-fastr-spi<n>-<m> - Enables flash device with fast read capability on SPI<n>, CS#<m>.
+// speed - Set the SPI clock speed in Hz
//
// If devices are present on SPI1 or SPI2, those interfaces must be enabled with one of the spi1-1/2/3cs and/or spi2-1/2/3cs overlays.
//
@@ -79,50 +80,23 @@
};
};
- // enable flash on spi0.0
+ // Enable fast read for device
+ // Use default active low interrupt signalling.
fragment@8 {
- target = <&spi0>;
+ target = <&spi_nor>;
__dormant__ {
- status = "okay";
- #address-cells = <1>;
- #size-cells = <0>;
- spi_nor_00: spi_nor@0 {
- #address-cells = <1>;
- #size-cells = <1>;
- compatible = "jedec,spi-nor";
- reg = <0>;
- spi-max-frequency = <500000>;
- };
+ m25p,fast-read;
};
};
- // enable flash on spi0.1
- fragment@9 {
+ payload: fragment@100 {
target = <&spi0>;
- __dormant__ {
+ __overlay__ {
status = "okay";
- #address-cells = <1>;
- #size-cells = <0>;
- spi_nor_01: spi_nor@1 {
- #address-cells = <1>;
- #size-cells = <1>;
- compatible = "jedec,spi-nor";
- reg = <1>;
- spi-max-frequency = <500000>;
- };
- };
- };
+ #address-cells = <1>;
+ #size-cells = <0>;
- // enable flash on spi1.0
- fragment@10 {
- target = <&spi1>;
- __dormant__ {
- status = "okay";
- #address-cells = <1>;
- #size-cells = <0>;
- spi_nor_10: spi_nor@0 {
- #address-cells = <1>;
- #size-cells = <1>;
+ spi_nor: spi_nor@0 {
compatible = "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <500000>;
@@ -130,180 +104,33 @@
};
};
- // enable flash on spi1.1
- fragment@11 {
- target = <&spi1>;
- __dormant__ {
- status = "okay";
- #address-cells = <1>;
- #size-cells = <0>;
- spi_nor_11: spi_nor@1 {
- #address-cells = <1>;
- #size-cells = <1>;
- compatible = "jedec,spi-nor";
- reg = <1>;
- spi-max-frequency = <500000>;
- };
- };
- };
-
- // enable flash on spi1.2
- fragment@12 {
- target = <&spi1>;
- __dormant__ {
- status = "okay";
- #address-cells = <1>;
- #size-cells = <0>;
- spi_nor_12: spi_nor@2 {
- #address-cells = <1>;
- #size-cells = <1>;
- compatible = "jedec,spi-nor";
- reg = <2>;
- spi-max-frequency = <500000>;
- };
- };
- };
-
- // enable flash on spi2.0
- fragment@13 {
- target = <&spi2>;
- __dormant__ {
- status = "okay";
- #address-cells = <1>;
- #size-cells = <0>;
- spi_nor_20: spi_nor@0 {
- #address-cells = <1>;
- #size-cells = <1>;
- compatible = "jedec,spi-nor";
- reg = <0>;
- spi-max-frequency = <500000>;
- };
- };
- };
-
- // enable flash on spi2.1
- fragment@14 {
- target = <&spi2>;
- __dormant__ {
- status = "okay";
- #address-cells = <1>;
- #size-cells = <0>;
- spi_nor_21: spi_nor@1 {
- #address-cells = <1>;
- #size-cells = <1>;
- compatible = "jedec,spi-nor";
- reg = <1>;
- spi-max-frequency = <500000>;
- };
- };
- };
-
- // enable flash on spi2.2
- fragment@15 {
- target = <&spi2>;
- __dormant__ {
- status = "okay";
- #address-cells = <1>;
- #size-cells = <0>;
- spi_nor_22: spi_nor@2 {
- #address-cells = <1>;
- #size-cells = <1>;
- compatible = "jedec,spi-nor";
- reg = <2>;
- spi-max-frequency = <500000>;
- };
- };
- };
-
- // Enable fast read for device on spi0.0.
- // Use default active low interrupt signalling.
- fragment@16 {
- target = <&spi_nor_00>;
- __dormant__ {
- m25p,fast-read;
- };
- };
-
- // Enable fast read for device on spi0.1.
- // Use default active low interrupt signalling.
- fragment@17 {
- target = <&spi_nor_01>;
- __dormant__ {
- m25p,fast-read;
- };
- };
-
- // Enable fast read for device on spi1.0.
- // Use default active low interrupt signalling.
- fragment@18 {
- target = <&spi_nor_10>;
- __dormant__ {
- m25p,fast-read;
- };
- };
-
- // Enable fast read for device on spi1.1.
- // Use default active low interrupt signalling.
- fragment@19 {
- target = <&spi_nor_11>;
- __dormant__ {
- m25p,fast-read;
- };
- };
-
- // Enable fast read for device on spi1.2.
- // Use default active low interrupt signalling.
- fragment@20 {
- target = <&spi_nor_12>;
- __dormant__ {
- m25p,fast-read;
- };
- };
-
- // Enable fast read for device on spi2.0.
- // Use default active low interrupt signalling.
- fragment@21 {
- target = <&spi_nor_20>;
- __dormant__ {
- m25p,fast-read;
- };
- };
-
- // Enable fast read for device on spi2.1.
- // Use default active low interrupt signalling.
- fragment@22 {
- target = <&spi_nor_21>;
- __dormant__ {
- m25p,fast-read;
- };
- };
-
- // Enable fast read for device on spi2.2.
- // Use default active low interrupt signalling.
- fragment@23 {
- target = <&spi_nor_22>;
- __dormant__ {
- m25p,fast-read;
- };
- };
-
__overrides__ {
- flash-spi0-0 = <0>,"+0+8";
- flash-spi0-1 = <0>,"+1+9";
- flash-spi1-0 = <0>,"+2+10";
- flash-spi1-1 = <0>,"+3+11";
- flash-spi1-2 = <0>,"+4+12";
- flash-spi2-0 = <0>,"+5+13";
- flash-spi2-1 = <0>,"+6+14";
- flash-spi2-2 = <0>,"+7+15";
- flash-fastr-spi0-0 = <0>,"+0+8+16";
- flash-fastr-spi0-1 = <0>,"+1+9+17";
- flash-fastr-spi1-0 = <0>,"+2+10+18";
- flash-fastr-spi1-1 = <0>,"+3+11+19";
- flash-fastr-spi1-2 = <0>,"+4+12+20";
- flash-fastr-spi2-0 = <0>,"+5+13+21";
- flash-fastr-spi2-1 = <0>,"+6+14+22";
- flash-fastr-spi2-2 = <0>,"+7+15+23";
+ spi0-0 = <0>,"+0", <&payload>,"target:0=",<&spi0>, <&spi_nor>,"reg:0=0";
+ spi0-1 = <0>,"+1", <&payload>,"target:0=",<&spi0>, <&spi_nor>,"reg:0=1";
+ spi1-0 = <0>,"+2", <&payload>,"target:0=",<&spi1>, <&spi_nor>,"reg:0=0";
+ spi1-1 = <0>,"+3", <&payload>,"target:0=",<&spi1>, <&spi_nor>,"reg:0=1";
+ spi1-2 = <0>,"+4", <&payload>,"target:0=",<&spi1>, <&spi_nor>,"reg:0=2";
+ spi2-0 = <0>,"+5", <&payload>,"target:0=",<&spi2>, <&spi_nor>,"reg:0=0";
+ spi2-1 = <0>,"+6", <&payload>,"target:0=",<&spi2>, <&spi_nor>,"reg:0=1";
+ spi2-2 = <0>,"+7", <&payload>,"target:0=",<&spi2>, <&spi_nor>,"reg:0=2";
+ flash-spi0-0 = <0>,"+0", <&payload>,"target:0=",<&spi0>, <&spi_nor>,"reg:0=0";
+ flash-spi0-1 = <0>,"+1", <&payload>,"target:0=",<&spi0>, <&spi_nor>,"reg:0=1";
+ flash-spi1-0 = <0>,"+2", <&payload>,"target:0=",<&spi1>, <&spi_nor>,"reg:0=0";
+ flash-spi1-1 = <0>,"+3", <&payload>,"target:0=",<&spi1>, <&spi_nor>,"reg:0=1";
+ flash-spi1-2 = <0>,"+4", <&payload>,"target:0=",<&spi1>, <&spi_nor>,"reg:0=2";
+ flash-spi2-0 = <0>,"+5", <&payload>,"target:0=",<&spi2>, <&spi_nor>,"reg:0=0";
+ flash-spi2-1 = <0>,"+6", <&payload>,"target:0=",<&spi2>, <&spi_nor>,"reg:0=1";
+ flash-spi2-2 = <0>,"+7", <&payload>,"target:0=",<&spi2>, <&spi_nor>,"reg:0=2";
+ flash-fastr-spi0-0 = <0>,"+0+8", <&payload>,"target:0=",<&spi0>, <&spi_nor>,"reg:0=0";
+ flash-fastr-spi0-1 = <0>,"+1+8", <&payload>,"target:0=",<&spi0>, <&spi_nor>,"reg:0=1";
+ flash-fastr-spi1-0 = <0>,"+2+8", <&payload>,"target:0=",<&spi1>, <&spi_nor>,"reg:0=0";
+ flash-fastr-spi1-1 = <0>,"+3+8", <&payload>,"target:0=",<&spi1>, <&spi_nor>,"reg:0=1";
+ flash-fastr-spi1-2 = <0>,"+4+8", <&payload>,"target:0=",<&spi1>, <&spi_nor>,"reg:0=2";
+ flash-fastr-spi2-0 = <0>,"+5+8", <&payload>,"target:0=",<&spi2>, <&spi_nor>,"reg:0=0";
+ flash-fastr-spi2-1 = <0>,"+6+8", <&payload>,"target:0=",<&spi2>, <&spi_nor>,"reg:0=1";
+ flash-fastr-spi2-2 = <0>,"+7+8", <&payload>,"target:0=",<&spi2>, <&spi_nor>,"reg:0=2";
+ fastr = <0>,"+8";
+ speed = <&spi_nor>, "spi-max-frequency:0";
};
};