Page 1 of 1

Changing spi-nand flash type in device tree

Posted: 2024-12-13 11:54
by 14Og
Hello! I want to update spi-nand flash on my luckfox pico mini b board. I don't understand where can i reconfigure this parameter in your buildroot sdk. I found device tree node that is responsible for it:

Code: Select all

/**********SFC**********/
&sfc {
	status = "okay";
	flash@0 {
		compatible = "spi-nand";
		reg = <0>;
		spi-max-frequency = <75000000>;
		spi-rx-bus-width = <4>;
		spi-tx-bus-width = <1>;
	};
};
and i also found my new nand flash description in kernel source code:

Code: Select all

	SPINAND_INFO("W25N04KV",
		     SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xAA, 0x23),
		     NAND_MEMORG(1, 2048, 128, 64, 4096, 40, 1, 1, 1),
		     NAND_ECCREQ(8, 512),
		     SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
					      &write_cache_variants,
					      &update_cache_variants),
		     0,
		     SPINAND_ECCINFO(&w25n02kv_ooblayout,
				     w25n02kv_ecc_get_status)),
But i dont understand how can i pick proper device type. Which parameter in device tree should be added or changed to let linux kernel know about my new flash? Or maybe it has to be done outside of dts?

Re: Changing spi-nand flash type in device tree

Posted: 2024-12-14 2:48
by Crocodile
Hello, there is a set of common source code for Kenel's source code to drive spi-nand, theoretically if you are using spi-nand instead of spi-nor, then the relevant dts do not need to be modified

Re: Changing spi-nand flash type in device tree

Posted: 2024-12-17 8:26
by 14Og
Yep, i found out that bootrom automatically detects nand-flash's id and then kernel also detects it. The problem was that i misinterpreted dmesg output. Thank you!