Configuration of custom flash memory for standard zephyr driver

Hello!

I have a device on which the S25HL01GT memory is soldered. The problem is that I don’t understand how I should work with .dts in order for this memory to work with the standard driver from zephyr.

I added the following to the .overlay:

&qspi {
	status = "okay";
	pinctrl-0 = <&qspi_default>;
	pinctrl-1 = <&qspi_sleep>;
	pinctrl-names = "default", "sleep";
	s25h: s25hl01gt@0 {
		compatible = "nordic,qspi-nor";
		reg = <0>;
		/* MX25R64 supports only pp and pp4io */
		writeoc = "pp4io";
		/* MX25R64 supports all readoc options */
		readoc = "read4io";
		sck-frequency = <8000000>;
		jedec-id = [34 2B 1B 0F 03 90];
		sfdp-bfp = [
			e5 20 f1 ff  ff ff ff 03  44 eb 08 6b  08 3b 04 bb
			ee ff ff ff  ff ff 00 ff  ff ff 00 ff  0c 20 0f 52
			10 d8 00 ff  23 72 f5 00  82 ed 04 cc  44 83 68 44
			30 b0 30 b0  f7 c4 d5 5c  00 be 29 ff  f0 d0 ff ff
		];
		size = <67108864>;
		has-dpd;
		t-enter-dpd = <10000>;
		t-exit-dpd = <35000>;
	};
};

...

	aliases {
		spi-flash0 = &s25h;
	};

And I use the following code:

  const struct device *flash_dev = DEVICE_DT_GET(DT_ALIAS(spi_flash0));
	if (!device_is_ready(flash_dev)) {
		printk("%s: device not ready.\n", flash_dev->name);
		return 0;
	}

But it doesn't work and I don't understand how to debug such problems. I'm not even sure that the jedec-id is correct. When compiling into zephyr.dts, I see that for qspi there are two mx25r64 flash memories and my s25h is also in the list, is this bad? I tried to delete it via /delete-node/mx25r6435f; in &qspi but it didn't work.

Thanks in advance!

Related