Ipq8064: SPI attached NOR flash probe failes with error -22

I'm trying to add support for a new device: ipq8064 base Linksys e8350.

Flash-Chips SPI MX25U3235F + NAND S34MS01G2
Flash sizes 4 MiB SPI + 128 MiB NAND

Since kernel is in UBI, i can boot and all fine, unfortunately mac addresses are stored in ART, and exactly NOR flash where it is stored not mapping after v22 release.

On current main branch I'm getting this:

[    0.052099] qcom-smem 1a280000.spi:m25p80@0:partitions: No memory-region specified
[    0.052115] qcom-smem: probe of 1a280000.spi:m25p80@0:partitions failed with error -22
....
[    1.751995] spi_qup 1a280000.spi: IN:block:16, fifo:64, OUT:block:16, fifo:64
[    1.752240] m25p80@0 enforce active low on GPIO handle
[    1.761132] spi-nor spi0.0: mx25u3235f (4096 Kbytes)
...

on the older kernel it works as expected:

[    4.135759] spi_qup 1a280000.spi: IN:block:16, fifo:64, OUT:block:16, fifo:64
[    4.141447] spi-nor spi0.0: mx25u3235f (4096 Kbytes)
[    4.141976] 15 qcom-smem partitions found on MTD device spi0.0
[    4.146922] Creating 15 MTD partitions on "spi0.0":
[    4.152676] 0x000000000000-0x000000010000 : "0:SBL1"
[    4.158782] 0x000000010000-0x000000030000 : "0:MIBIB"
[    4.163927] 0x000000030000-0x000000050000 : "0:SBL2"
[    4.168762] 0x000000050000-0x000000080000 : "0:SBL3"
[    4.173898] 0x000000080000-0x000000090000 : "0:DDRCONFIG"
[    4.178766] 0x000000090000-0x0000000a0000 : "0:SSD"
[    4.184135] 0x0000000a0000-0x0000000d0000 : "0:TZ"
[    4.188722] 0x0000000d0000-0x0000000f0000 : "0:RPM"
[    4.193716] 0x0000000f0000-0x000000130000 : "0:OLDAPPSBL"
[    4.198378] 0x000000130000-0x000000170000 : "0:APPSBLENV"
[    4.204039] 0x000000170000-0x000000190000 : "0:ART"
[    4.209328] 0x000000190000-0x0000001e0000 : "0:APPSBL"
[    4.214139] 0x0000001e0000-0x000000200000 : "0:NSS1"
[    4.219204] 0x000000200000-0x000000220000 : "0:NVRAM"
[    4.224454] 0x000000220000-0x000000400000 : "0:HLOS"
Works in v21/v22, default spi_pins from dtsi
&gsbi5 {
	qcom,mode = <GSBI_PROT_SPI>;
	status = "okay";

	spi5: spi@1a280000 {
		status = "okay";

		pinctrl-0 = <&spi_pins>;
		pinctrl-names = "default";

		cs-gpios = <&qcom_pinmux 20 GPIO_ACTIVE_HIGH>;

		m25p80@0 {
			compatible = "jedec,spi-nor";
			spi-max-frequency = <51200000>;
			reg = <0>;

			partitions {
				compatible = "qcom,smem";
			};
		};
	};
};

What I have already tried without effect:

  1. Using fixed-partitions
  2. Adding #address-cells = <1>; and #size-cells = <1>; before partitions
  3. Overriding pins to ones used in other ipq8064 DTS files. Also, the definition of pins in base dtsi file is the same (qcom-ipq8064.dtsi) in v21 and main.
custom spi_pins
&qcom_pinmux {
	spi_pins: spi_pins {
		mux {
			pins = "gpio18", "gpio19";
			function = "gsbi5";
			drive-strength = <10>;
			bias-pull-down;
		};

		clk {
			pins = "gpio21";
			function = "gsbi5";
			drive-strength = <12>;
			bias-pull-down;
		};

		cs {
			pins = "gpio20";
			function = "gpio";
			drive-strength = <10>;
			bias-pull-up;
		};
	};
...
  1. Moving and adding spi-max-frequency (both spi and flash definitions) and playing with it's value (50000000/51200000).
Full DTS of the latest experiments
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
#include "qcom-ipq8064-v2.0-smb208.dtsi"

#include <dt-bindings/input/input.h>
#include <dt-bindings/soc/qcom,tcsr.h>

/ {
	model = "Linksys E8350 V1 WiFi Router";
	compatible = "linksys,e8350-v1", "qcom,ipq8064";
	
	memory@0 {
		reg = <0x42000000 0x1e000000>;
		device_type = "memory";
	};
	
	aliases {
		serial0 = &gsbi4_serial;
		
		led-boot = &led_power;
		led-failsafe = &led_power;
		led-running = &led_power;
		led-upgrade = &led_power;
	};
	
	keys {
		compatible = "gpio-keys";
		pinctrl-0 = <&button_pins>;
		pinctrl-names = "default";
		
		reset {
			label = "reset";
			gpios = <&qcom_pinmux 68 GPIO_ACTIVE_LOW>;
			linux,code = <KEY_RESTART>;
			debounce-interval = <60>;
			wakeup-source;
		};
		
		wps {
			label = "wps";
			gpios = <&qcom_pinmux 65 GPIO_ACTIVE_LOW>;
			linux,code = <KEY_WPS_BUTTON>;
			debounce-interval = <60>;
			wakeup-source;
		};
		
		wifi {
			label = "wifi";
			gpios = <&qcom_pinmux 67 GPIO_ACTIVE_LOW>;
			linux,code = <KEY_RFKILL>;
			debounce-interval = <60>;
			wakeup-source;
		};
	};
	
	leds {
		compatible = "gpio-leds";
		pinctrl-0 = <&led_pins>;
		pinctrl-names = "default";
		
		led_power: power {
			label = "green:power";
			gpios = <&qcom_pinmux 26 GPIO_ACTIVE_HIGH>;
			default-state = "keep";
		};
		
		wps {
			label = "green:wps";
			gpios = <&qcom_pinmux 53 GPIO_ACTIVE_HIGH>;
		};
		
		wifi {
			label = "green:wifi";
			gpios = <&qcom_pinmux 54 GPIO_ACTIVE_HIGH>;
		};
	};
};

&nand {
	status = "okay";
	
	nand@0 {
		reg = <0>;
		
		nand-ecc-strength = <4>;
		nand-bus-width = <8>;
		
		partitions {
			compatible = "fixed-partitions";
			#address-cells = <1>;
			#size-cells = <1>;
			
			partition@0 {
				label = "ubi";
				reg = <0 0x4000000>;
			};
			
			partition@4000000 {
				label = "extra";
				reg = <0x4000000 0x4000000>;
			};
		};
	};
};

&qcom_pinmux {

	spi_pins: spi_pins {
		mux {
			pins = "gpio18", "gpio19";
			function = "gsbi5";
			drive-strength = <10>;
			bias-pull-down;
		};

		clk {
			pins = "gpio21";
			function = "gsbi5";
			drive-strength = <12>;
			bias-pull-down;
		};

		cs {
			pins = "gpio20";
			function = "gpio";
			drive-strength = <10>;
			bias-pull-up;
		};
	};

	button_pins: button_pins {
		mux {
			pins = "gpio68","gpio65", "gpio67";
			function = "gpio";
			drive-strength = <2>;
			bias-pull-up;
		};
	};
	
	led_pins: led_pins {
		mux {
			pins = "gpio26","gpio53", "gpio54";
			function = "gpio";
			drive-strength = <2>;
			bias-pull-up;
		};
	};
	
	switch_reset: switch_reset_pins {
		mux {
			pins = "gpio63";
			function = "gpio";
			drive-strength = <12>;
			bias-pull-up;
		};
	};
};

&gsbi5 {
	qcom,mode = <GSBI_PROT_SPI>;
	status = "okay";

	spi5: spi@1a280000 {
		status = "okay";
		spi-max-frequency = <50000000>;

		pinctrl-0 = <&spi_pins>;
		pinctrl-names = "default";

		cs-gpios = <&qcom_pinmux 20 GPIO_ACTIVE_HIGH>;

		m25p80@0 {
			compatible = "jedec,spi-nor";
			#address-cells = <1>;
			#size-cells = <1>;
			spi-max-frequency = <50000000>;
			reg = <0>;

			partitions {
				compatible = "qcom,smem";
			};
		};
	};
};

&hs_phy_0 {
	status = "okay";
};

&ss_phy_0 {
	status = "okay";
};

&usb3_0 {
	status = "okay";
};

&hs_phy_1 {
	status = "okay";
};

&ss_phy_1 {
	status = "okay";
};

&usb3_1 {
	status = "okay";
};

&pcie0 {
	status = "okay";
	
	max-link-speed = <1>;
};

&pcie1 {
	status = "okay";
};

&mdio0 {
	status = "okay";
	
	pinctrl-0 = <&mdio0_pins>;
	pinctrl-names = "default";
	
	/* Switch from documentation require at least 12ms for reset */
	reset-gpios = <&qcom_pinmux 63 GPIO_ACTIVE_HIGH>;
	reset-post-delay-us = <12000>;
	
	switch@10 {
		compatible = "qca,qca8337";
		#address-cells = <1>;
		#size-cells = <0>;
		reg = <0x10>;
		
		ports {
			#address-cells = <1>;
			#size-cells = <0>;
			
			port@0 {
				reg = <0>;
				label = "cpu";
				ethernet = <&gmac1>;
				phy-mode = "rgmii";
				tx-internal-delay-ps = <1000>;
				rx-internal-delay-ps = <1000>;
				
				fixed-link {
					speed = <1000>;
					full-duplex;
				};
			};
			
			port@1 {
				reg = <1>;
				label = "lan1";
				phy-mode = "internal";
				phy-handle = <&phy_port1>;
			};
			
			port@2 {
				reg = <2>;
				label = "lan2";
				phy-mode = "internal";
				phy-handle = <&phy_port2>;
			};
			
			port@3 {
				reg = <3>;
				label = "lan3";
				phy-mode = "internal";
				phy-handle = <&phy_port3>;
			};
			
			port@4 {
				reg = <4>;
				label = "lan4";
				phy-mode = "internal";
				phy-handle = <&phy_port4>;
			};
			
			port@5 {
				reg = <5>;
				label = "wan";
				phy-mode = "internal";
				phy-handle = <&phy_port5>;
			};
			
			port@6 {
				reg = <6>;
				label = "cpu";
				ethernet = <&gmac2>;
				phy-mode = "sgmii";
				qca,sgmii-enable-pll;
				
				fixed-link {
					speed = <1000>;
					full-duplex;
				};
			};
		};
		
		mdio {
			#address-cells = <1>;
			#size-cells = <0>;
			
			phy_port1: phy@0 {
				reg = <0>;
			};
			
			phy_port2: phy@1 {
				reg = <1>;
			};
			
			phy_port3: phy@2 {
				reg = <2>;
			};
			
			phy_port4: phy@3 {
				reg = <3>;
			};
			
			phy_port5: phy@4 {
				reg = <4>;
			};
		};
	};
};

&gmac1 {
	status = "okay";
	
	phy-mode = "rgmii";
	qcom,id = <1>;
	
	pinctrl-0 = <&rgmii2_pins>;
	pinctrl-names = "default";
	
	fixed-link {
		speed = <1000>;
		full-duplex;
	};
};

&gmac2 {
	status = "okay";
	
	phy-mode = "sgmii";
	qcom,id = <2>;
	
	fixed-link {
		speed = <1000>;
		full-duplex;
	};
};

&tcsr {
	qcom,usb-ctrl-select = <TCSR_USB_SELECT_USB3_DUAL>;
	compatible = "qcom,tcsr";
};

&adm_dma {
	status = "okay";
};

At this point I'm running out of ideas and would appreciate any help.

@Ansuel Hi there, I've noticed you may have the biggest chances of knowing what am I doing wrong. Could you please take a look at this topic?
P.S. I'm using downloaded GPL sources for this device to find out how original firmware was doing it, but still no clues on what is wrong now.

OK, seems like the issue was that even tho OpenWrt UI said firmware was flashed, it wasn't actually.
After flashing over recovery mode with "fixed" partitions all works fine (qcom,smem still error -22).
If someone has similar issue, here is the DTS part I've ended up using:

gsbi5 DTS part
&gsbi5 {
	qcom,mode = <GSBI_PROT_SPI>;
	status = "okay";
	
	spi5: spi@1a280000 {
		status = "okay";
		
		pinctrl-0 = <&spi_pins>;
		pinctrl-names = "default";
		
		cs-gpios = <&qcom_pinmux 20 GPIO_ACTIVE_HIGH>;
		
		m25p80@0 {
			compatible = "jedec,spi-nor";
			spi-max-frequency = <51200000>;
			reg = <0>;
			
			partitions {
				compatible = "fixed-partitions";
				#address-cells = <1>;
				#size-cells = <1>;
				
				partition@0 {
					label = "sbl1";
					reg = <0x0000000 0x0010000>;
					read-only;
				};
				
				partition@10000 {
					label = "mibib";
					reg = <0x0010000 0x0020000>;
					read-only;
				};
				
				partition@30000 {
					label = "sbl2";
					reg = <0x0030000 0x0020000>;
					read-only;
				};
				
				partition@50000 {
					label = "sbl3";
					reg = <0x0050000 0x0030000>;
					read-only;
				};
				
				partition@80000 {
					label = "ddrconfig";
					reg = <0x0080000 0x0010000>;
					read-only;
				};
				
				partition@90000 {
					label = "ssd";
					reg = <0x0090000 0x0010000>;
					read-only;
				};
				
				partition@a0000 {
					label = "tz";
					reg = <0x00a0000 0x0030000>;
					read-only;
				};
				
				partition@d0000 {
					label = "rpm";
					reg = <0x00d0000 0x0020000>;
					read-only;
				};
				
				partition@f0000 {
					label = "oldappsbl";
					reg = <0x00f0000 0x0040000>;
					read-only;
				};
				
				partition@130000 {
					label = "appsblenv";
					reg = <0x0130000 0x0040000>;
				};
				
				art: partition@170000 {
					label = "ART";
					reg = <0x0170000 0x0020000>;
					read-only;
					
					// nvmem-layout {
					// 	compatible = "fixed-layout";
					// 	#address-cells = <1>;
					// 	#size-cells = <1>;
						
					// 	macaddr_art_0: macaddr@0 {
					// 		reg = <0x0 0x6>;
					// 	};
						
					// 	macaddr_art_6: macaddr@6 {
					// 		reg = <0x6 0x6>;
					// 	};
					// };
				};
				
				partition@190000 {
					label = "uboot";
					reg = <0x0190000 0x0050000>;
					read-only;
				};
				
				partition@1e0000 {
					label = "oldnss1";
					reg = <0x01e0000 0x0020000>;
					read-only;
				};
				
				partition@200000 {
					label = "nvram";
					reg = <0x0200000 0x0020000>;
					read-only;
				};
				
				partition@220000 {
					label = "oldkernel";
					reg = <0x0220000 0x01e0000>;
					read-only;
				};
			};
		};
	};
};

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.