cancel
Showing results for 
Search instead for 
Did you mean: 

stm32mp157c nand flash u-boot configuration

aliMesut
Associate III

I am using stm32mp157c and working initialize mtd nand flash w25n512.

i was able to run it on kernel mode. Kernel device tree is;

aliases {
		spinand0 = &qspi;
	};
...
 
&qspi {
	pinctrl-names = "default";
	pinctrl-0 = <&quadspi_pins_mx>;
	num-cs = <0x1>;                   
        #address-cells = <1>;
	#size-cells = <0>;
    
         status = "okay";
 
	flash0: w25n512@0 {
		compatible = "spi-nand";
		reg = <0x0>;
		
		spi-rx-bus-width = <2>;
                spi-tx-bus-width = <2>;
		spi-max-frequency = <166000000>;
		
		#address-cells = <1>;
		#size-cells = <1>;
	};
};
...
 
&pinctrl {
	quadspi_pins_mx: quadspi_mx-0 {
		pins1 {
			pinmux = <STM32_PINMUX('B', 6, AF10)>, /* QUADSPI_BK1_NCS */
					 <STM32_PINMUX('F', 8, AF10)>, /* QUADSPI_BK1_IO0 */
					 <STM32_PINMUX('F', 9, AF10)>; /* QUADSPI_BK1_IO1 */
			bias-disable;
			drive-push-pull;
			slew-rate = <1>;
		};
		pins2 {
			pinmux = <STM32_PINMUX('F', 10, AF9)>; /* QUADSPI_CLK */
			bias-disable;
			drive-push-pull;
			slew-rate = <2>;
		};
	};
        ...
 
};

The mtd files appear under /dev list and i called the

cat /sys/class/mtd/mtd0/size

5242880

it is working. Likewise when i add to u-boot configuration it didn't work.

In u-boot mode is active, i called sf probe 0:0 0 0 or sf probe 0:1 0 0

Invalid bus 0 (err=-19)

Failed to initialize SPI flash at 0:0 (errror -19)

error occured.

Where can i wrong?

Best Regards

Ali Mesut Ince

2 REPLIES 2
krjdev
Associate II

Hi @aliMesut​ !

Error code -19 means no such devices. This is not a clear error code from U-Boot.

Seems the current SPI U-Boot driver doesn't support the STM32MP157C.

I run into the same issue on a none-ST SoC with U-Boot and released a patch series at the U-Boot mailing list later:

https://stackoverflow.com/questions/61862722/u-boot-2020-04-probing-spi-flash-fails-invalid-bus-0-err-19

Here you can read what if have done, do get SPI work with U-Boot. Should also similar work with the STM32MP157C.

EDIT:

Which U-Boot version do you use?

I have looked in the U-Boot sources and QSPI should work at least with U-Boot version v2022.01 on STM32? But not verified that...

aliMesut
Associate III

Hi @krjdev​,

Thank you for your helping. I'll look at the link you sent and try to add it.

U-Boot version: 2020.10

Best Regards

Ali Mesut Ince