[U-Boot] Macronix NOR_SPI and Quad I/O

Champ, Andy andycham at amazon.co.uk
Mon Nov 28 18:47:29 CET 2016


Hi Radu,

It seems to me there are two approaches:
- Set a different flag for this different command
- Check the manufacturer ID before selecting the command.
Either way the data we'd need is in the params variable, nicely to hand.

The code I've been working on is for write protecting Macronix and WInbond NOR-SPI devices; I'll publish that at some point. The write protect code has callbacks, which probably makes sense when the handling is more complex - the commands, and the areas you can protect, are both different on a per-manufacturer basis.

A flag is nice and simple, which is good given that nobody needs this right now. I do wonder if quad writes are worth doing at all - in which case the fix is /really/ simple. Remove the code, and the flag!

As I said, I don't need this - it's just that I don't like to see broken code lying around.

Thanks
Andy Champ

-----Original Message-----
From: Bacrau, Dumitru [mailto:dumitru.bacrau at intel.com] 
Sent: 28 November 2016 17:33
To: Champ, Andy <andycham at amazon.co.uk>; Jagan Teki <jagan at openedev.com>
Cc: u-boot at lists.denx.de; jteki at openedev.com; radu.bacrau at gmail.com; clsee at altera.com
Subject: RE: [U-Boot] Macronix NOR_SPI and Quad I/O

Hi Andy,

I have double-checked the datasheets and indeed the Quad Page Program opcode for Macronix is 0x38 and not 0x32 like the U-Boot code has defined in CMD_QUAD_PAGE_PROGRAM.

My version of the code is similar to the current u-boot mainline, and it also has the WR_QPP flag. But its usage depends on another flag that never gets set, so basically I have never used Quad mode for writing in my testing.

In the latest U-Boot code from u-boot-spi the situation is similar, except the above parameter is retrieved from the U-Boot device tree parameter  "spi-tx-bus-width". But none of the device trees set that parameter to '4' so again the Quad mode is never used for writing anyway.

Note that Quad mode is very useful for reading, where it effectively quadruples the speed. But in case of writing, it only speeds up data transmission to the flash device, which then starts writing, and the host keeps polling it for completion. Because of this, there is not a lot to gain from using quad mode for writing.

Ideally we would need a way to convey that the Macronix devices use a different instruction opcode for quad writing. This could be in spi_flash_info structure or somewhere in the device tree.

Regards,
Radu


More information about the U-Boot mailing list