From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mike Frysinger Date: Mon, 28 Jan 2008 15:00:34 -0500 Subject: [U-Boot-Users] [rfc] new spiflash subsystem Message-ID: <200801281500.34869.vapier@gentoo.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de this isnt against u-boot mainline, so there will be a few things that are out of date (like the CFG handling), so over look that part. what's up for comments here is the general architecture. ive omitted the env_spiflash.c portion as i think that'll be pretty cheesy. basically ive laid it out like so: - common/cmd_spiflash.c: provides the user interface of the spiflash subsystem. depends on these functions being implemented elsewhere: * spiflash_info() - ask the spiflash driver for info * spiflash_read() - ask the spiflash driver to read * spiflash_write() - ask the spiflash driver to write * spiflash_erase() - ask the spiflash driver to erase no validation occurs in the common code since it has no idea about sector sizes and such. i could add a spiflash_query() function and have it return a struct describing the spiflash and use that to validate, but i dont think it's really worth the effort. relevant defines: * CFG_CMD_SPIFLASH - include the "spiflash" command * CFG_SPIFLASH_MULTI - support multiple parts (via "cs" parameter) - drivers/mtd/spiflash_jedec.c: provides the spiflash driver functions needed by the common layer. detects and works with Spansion/ST/Atmel/Winbond parts. i've personally verified at least one part from each family, but obviously not every part ;). it depends on these functions being implemented elsewhere: * spiflash_on() - turn on the SPI * spiflash_off() - turn off the SPI * spiflash_cs_set() - assert/deassert the specified chip select * spiflash_exchange_byte() - send specified byte and return received byte relevant defines: * CFG_SPIFLASH_JEDEC_DRIVER - enable this driver * CFG_SPIFLASH_MULTI - disable a small runtime opt to avoid redetection - board/$BOARD/spiflash.c: provides the board / cpu specific spiflash functions. ive included the Blackfin one here as an example. -mike -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 827 bytes Desc: This is a digitally signed message part. Url : http://lists.denx.de/pipermail/u-boot/attachments/20080128/13afe397/attachment.pgp -------------- next part -------------- A non-text attachment was scrubbed... Name: cmd_spiflash.c Type: text/x-csrc Size: 2389 bytes Desc: not available Url : http://lists.denx.de/pipermail/u-boot/attachments/20080128/13afe397/attachment.c -------------- next part -------------- A non-text attachment was scrubbed... Name: spiflash_jedec.c Type: text/x-csrc Size: 11469 bytes Desc: not available Url : http://lists.denx.de/pipermail/u-boot/attachments/20080128/13afe397/attachment-0001.c -------------- next part -------------- A non-text attachment was scrubbed... Name: spiflash.c Type: text/x-csrc Size: 2052 bytes Desc: not available Url : http://lists.denx.de/pipermail/u-boot/attachments/20080128/13afe397/attachment-0002.c