[OpenWrt-Devel] [PATCH 11/13] lantiq: Switch to the new SPI driver

Martin Blumenstingl martin.blumenstingl at googlemail.com
Sun Jan 17 07:30:16 EST 2016


Compared to the "old" driver:
- Each device must assign a pinctrl setting to the SPI node to allow the
  new SPI driver to configure the SPI pins.
  While here we are also using separate input and output settings so we
  are independent of whether the bootloader configures the pins correctly.
- We use the new "compatible" strings to make the driver choose the
  correct number of chip-selects for each SoC.
- The new driver starts counting the chip-selects at 1 (instead of 0, like
  the old one did). Thus we have to adjust the devices accordingly.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl at googlemail.com>
---
 target/linux/lantiq/dts/DGN1000B.dts      | 23 +++++++++++++++++------
 target/linux/lantiq/dts/DGN3500.dtsi      | 19 +++++++++++++++----
 target/linux/lantiq/dts/EASY80920.dtsi    | 23 +++++++++++++++++------
 target/linux/lantiq/dts/FRITZ3370.dts     | 23 +++++++++++++++++------
 target/linux/lantiq/dts/TDW89X0.dtsi      | 23 +++++++++++++++++------
 target/linux/lantiq/dts/amazonse.dtsi     |  4 +++-
 target/linux/lantiq/dts/ar9.dtsi          |  4 +++-
 target/linux/lantiq/dts/vr9.dtsi          |  4 +++-
 target/linux/lantiq/xrx200/config-default |  3 +--
 target/linux/lantiq/xway/config-default   |  3 +--
 10 files changed, 94 insertions(+), 35 deletions(-)

diff --git a/target/linux/lantiq/dts/DGN1000B.dts b/target/linux/lantiq/dts/DGN1000B.dts
index a6bd5a8..68415ca 100644
--- a/target/linux/lantiq/dts/DGN1000B.dts
+++ b/target/linux/lantiq/dts/DGN1000B.dts
@@ -28,10 +28,6 @@
 			pinctrl-0 = <&state_default>;
 
 			state_default: pinmux {
-				spi {
-					lantiq,groups = "spi", "spi_cs1";
-					lantiq,function = "spi";
-				};
 				asc {
 					lantiq,groups = "asc";
 					lantiq,function = "asc";
@@ -42,6 +38,18 @@
 					lantiq,open-drain = <1>;
 				};
 			};
+			pins_spi_default: pins_spi_default {
+				spi_in {
+					lantiq,groups = "spi_di";
+					lantiq,function = "spi";
+				};
+				spi_out {
+					lantiq,groups = "spi_do", "spi_clk",
+						"spi_cs1";
+					lantiq,function = "spi";
+					lantiq,output = <1>;
+				};
+			};
 		};
 
 		etop at E180000 {
@@ -50,11 +58,14 @@
 		};
 
 		spi at E100800 {
-			m25p80 at 0 {
+			pinctrl-names = "default";
+			pinctrl-0 = <&pins_spi_default>;
+
+			m25p80 at 1 {
 				#address-cells = <1>;
 				#size-cells = <1>;
 				compatible = "jedec,spi-nor";
-				reg = <0 0>;
+				reg = <1 0>;
 				spi-max-frequency = <5000000>;
 
 				partition at 0 {
diff --git a/target/linux/lantiq/dts/DGN3500.dtsi b/target/linux/lantiq/dts/DGN3500.dtsi
index d43da9d..48e2471e4 100644
--- a/target/linux/lantiq/dts/DGN3500.dtsi
+++ b/target/linux/lantiq/dts/DGN3500.dtsi
@@ -45,10 +45,18 @@
 					lantiq,output = <1>;
 					lantiq,pull = <0>;
 				};
-				spi {
-					lantiq,groups = "spi", "spi_cs4";
+			};
+			pins_spi_default: pins_spi_default {
+				spi_in {
+					lantiq,groups = "spi_di";
 					lantiq,function = "spi";
 				};
+				spi_out {
+					lantiq,groups = "spi_do", "spi_clk",
+						"spi_cs4";
+					lantiq,function = "spi";
+					lantiq,output = <1>;
+				};
 			};
 		};
 
@@ -150,13 +158,16 @@
 };
 
 &spi {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pins_spi_default>;
+
 	status = "ok";
 
-	m25p80 at 3 {
+	m25p80 at 4 {
 		#address-cells = <1>;
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
-		reg = <3 0>;
+		reg = <4 0>;
 		spi-max-frequency = <1000000>;
 
 		partition at 0 {
diff --git a/target/linux/lantiq/dts/EASY80920.dtsi b/target/linux/lantiq/dts/EASY80920.dtsi
index 56efe71..ad89ed9 100644
--- a/target/linux/lantiq/dts/EASY80920.dtsi
+++ b/target/linux/lantiq/dts/EASY80920.dtsi
@@ -53,10 +53,6 @@
 					lantiq,groups = "stp";
 					lantiq,function = "stp";
 				};
-				spi {
-					lantiq,groups = "spi", "spi_cs4";
-					lantiq,function = "spi";
-				};
 				nand {
 					lantiq,groups = "nand cle", "nand ale",
 							"nand rd", "nand rdy";
@@ -90,6 +86,18 @@
 					lantiq,pull = <2>;
 				};
 			};
+			pins_spi_default: pins_spi_default {
+				spi_in {
+					lantiq,groups = "spi_di";
+					lantiq,function = "spi";
+				};
+				spi_out {
+					lantiq,groups = "spi_do", "spi_clk",
+						"spi_cs4";
+					lantiq,function = "spi";
+					lantiq,output = <1>;
+				};
+			};
 		};
 
 		eth at E108000 {
@@ -297,13 +305,16 @@
 };
 
 &spi {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pins_spi_default>;
+
 	status = "ok";
 
-	m25p80 at 3 {
+	m25p80 at 4 {
 		#address-cells = <1>;
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
-		reg = <3 0>;
+		reg = <4 0>;
 		spi-max-frequency = <1000000>;
 
 		partition at 0 {
diff --git a/target/linux/lantiq/dts/FRITZ3370.dts b/target/linux/lantiq/dts/FRITZ3370.dts
index c6a593b..648e36b 100644
--- a/target/linux/lantiq/dts/FRITZ3370.dts
+++ b/target/linux/lantiq/dts/FRITZ3370.dts
@@ -66,10 +66,6 @@
 			pinctrl-0 = <&state_default>;
 
 			state_default: pinmux {
-				spi {
-					lantiq,groups = "spi", "spi_cs4";
-					lantiq,function = "spi";
-				};
 				mdio {
 					lantiq,groups = "mdio";
 					lantiq,function = "mdio";
@@ -92,6 +88,18 @@
 					lantiq,output = <1>;
 				};
 			};
+			pins_spi_default: pins_spi_default {
+				spi_in {
+					lantiq,groups = "spi_di";
+					lantiq,function = "spi";
+				};
+				spi_out {
+					lantiq,groups = "spi_do", "spi_clk",
+						"spi_cs4";
+					lantiq,function = "spi";
+					lantiq,output = <1>;
+				};
+			};
 		};
 
 		eth at E108000 {
@@ -239,13 +247,16 @@
 };
 
 &spi {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pins_spi_default>;
+
 	status = "ok";
 
-	m25p80 at 3 {
+	m25p80 at 4 {
 		#address-cells = <1>;
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
-		reg = <3 0>;
+		reg = <4 0>;
 		spi-max-frequency = <1000000>;
 
 		ath9k_cal: partition at 0 {
diff --git a/target/linux/lantiq/dts/TDW89X0.dtsi b/target/linux/lantiq/dts/TDW89X0.dtsi
index 30225d5..eabb980 100644
--- a/target/linux/lantiq/dts/TDW89X0.dtsi
+++ b/target/linux/lantiq/dts/TDW89X0.dtsi
@@ -43,16 +43,24 @@
 					lantiq,open-drain = <0>;
 					lantiq,output = <1>;
 				};
-				spi {
-					lantiq,groups = "spi", "spi_cs4";
-					lantiq,function = "spi";
-				};
 				pcie-rst {
 					lantiq,pins = "io38";
 					lantiq,pull = <0>;
 					lantiq,output = <1>;
 				};
 			};
+			pins_spi_default: pins_spi_default {
+				spi_in {
+					lantiq,groups = "spi_di";
+					lantiq,function = "spi";
+				};
+				spi_out {
+					lantiq,groups = "spi_do", "spi_clk",
+						"spi_cs4";
+					lantiq,function = "spi";
+					lantiq,output = <1>;
+				};
+			};
 		};
 
 		eth at E108000 {
@@ -211,13 +219,16 @@
 };
 
 &spi {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pins_spi_default>;
+
 	status = "ok";
 
-	m25p80 at 3 {
+	m25p80 at 4 {
 		#address-cells = <1>;
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
-		reg = <3 0>;
+		reg = <4 0>;
 		spi-max-frequency = <33250000>;
 		m25p,fast-read;
 
diff --git a/target/linux/lantiq/dts/amazonse.dtsi b/target/linux/lantiq/dts/amazonse.dtsi
index 5389446..c0bba43 100644
--- a/target/linux/lantiq/dts/amazonse.dtsi
+++ b/target/linux/lantiq/dts/amazonse.dtsi
@@ -73,10 +73,12 @@
 		reg = <0x10000000 0xEF00000>;
 
 		spi at E100800 {
-			compatible = "lantiq,spi-xway";
+			compatible = "lantiq,ase-spi";
 			reg = <0xE100800 0x100>;
 			interrupt-parent = <&icu0>;
 			interrupts = <24 25 26>;
+			interrupt-names = "spi_rx", "spi_tx", "spi_err",
+					"spi_frm";
 			#address-cells = <1>;
 			#size-cells = <1>;
 		};
diff --git a/target/linux/lantiq/dts/ar9.dtsi b/target/linux/lantiq/dts/ar9.dtsi
index 25b8346..0be95c3 100644
--- a/target/linux/lantiq/dts/ar9.dtsi
+++ b/target/linux/lantiq/dts/ar9.dtsi
@@ -101,10 +101,12 @@
 		};
 
 		spi: spi at E100800 {
-			compatible = "lantiq,spi-xway";
+			compatible = "lantiq,xrx100-spi";
 			reg = <0xE100800 0x100>;
 			interrupt-parent = <&icu0>;
 			interrupts = <22 23 24>;
+			interrupt-names = "spi_rx", "spi_tx", "spi_err",
+					"spi_frm";
 			#address-cells = <1>;
 			#size-cells = <1>;
 			status = "disabled";
diff --git a/target/linux/lantiq/dts/vr9.dtsi b/target/linux/lantiq/dts/vr9.dtsi
index e38541e..fce6f87 100644
--- a/target/linux/lantiq/dts/vr9.dtsi
+++ b/target/linux/lantiq/dts/vr9.dtsi
@@ -113,10 +113,12 @@
 		};
 
 		spi: spi at E100800 {
-			compatible = "lantiq,spi-xway";
+			compatible = "lantiq,xrx200-spi";
 			reg = <0xE100800 0x100>;
 			interrupt-parent = <&icu0>;
 			interrupts = <22 23 24>;
+			interrupt-names = "spi_rx", "spi_tx", "spi_err",
+					"spi_frm";
 			#address-cells = <1>;
 			#size-cells = <1>;
 			status = "disabled";
diff --git a/target/linux/lantiq/xrx200/config-default b/target/linux/lantiq/xrx200/config-default
index ece2706..1c9f5cc 100644
--- a/target/linux/lantiq/xrx200/config-default
+++ b/target/linux/lantiq/xrx200/config-default
@@ -56,9 +56,8 @@ CONFIG_RTL8366S_PHY=y
 CONFIG_RTL8367B_PHY=y
 CONFIG_RTL8367_PHY=y
 CONFIG_SPI=y
-CONFIG_SPI_BITBANG=y
+CONFIG_SPI_LANTIQ=y
 CONFIG_SPI_MASTER=y
-CONFIG_SPI_XWAY=y
 CONFIG_SYS_SUPPORTS_MIPS16=y
 CONFIG_UBIFS_FS=y
 CONFIG_UBIFS_FS_ADVANCED_COMPR=y
diff --git a/target/linux/lantiq/xway/config-default b/target/linux/lantiq/xway/config-default
index 974b06b..ae13f80 100644
--- a/target/linux/lantiq/xway/config-default
+++ b/target/linux/lantiq/xway/config-default
@@ -54,9 +54,8 @@ CONFIG_RTL8366S_PHY=y
 CONFIG_RTL8367B_PHY=y
 CONFIG_RTL8367_PHY=y
 CONFIG_SPI=y
-CONFIG_SPI_BITBANG=y
+CONFIG_SPI_LANTIQ=y
 CONFIG_SPI_MASTER=y
-CONFIG_SPI_XWAY=y
 CONFIG_SYS_SUPPORTS_MIPS16=y
 CONFIG_UBIFS_FS=y
 CONFIG_UBIFS_FS_ADVANCED_COMPR=y
-- 
2.7.0
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list