From cf6b11dcda2f13d1c05c2f20e2a1735a833a41fe Mon Sep 17 00:00:00 2001 From: Jagannadha Sutradharudu Teki Date: Wed, 19 Jun 2013 15:31:23 +0530 Subject: sf: Discover the bank addr commands Bank/Extended addr commands are specific to particular flash vendor so discover them based on the idocode0. Assign the discovered bank commands to spi_flash members so-that the bank read/write will use their specific operations. Signed-off-by: Jagannadha Sutradharudu Teki --- include/spi_flash.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include') diff --git a/include/spi_flash.h b/include/spi_flash.h index 3b6a44edce..38587c2de4 100644 --- a/include/spi_flash.h +++ b/include/spi_flash.h @@ -38,6 +38,10 @@ struct spi_flash { u32 page_size; /* Erase (sector) size */ u32 sector_size; + /* Bank read cmd */ + u8 bank_read_cmd; + /* Bank write cmd */ + u8 bank_write_cmd; void *memory_map; /* Address of read-only SPI flash access */ int (*read)(struct spi_flash *flash, u32 offset, -- cgit From e612ddf5939ba257f2933c7539ee39a3f760e8ce Mon Sep 17 00:00:00 2001 From: Jagannadha Sutradharudu Teki Date: Wed, 19 Jun 2013 15:37:09 +0530 Subject: sf: Read flash bank addr register at probe time Read the flash bank addr register to get the state of bank in a perticular flash. and also bank write happens only when there is a change in bank selection from user. bank read only valid for flashes which has > 16Mbytes those are opearted in 3-byte addr mode, each bank occupies 16Mytes. Suppose if the flash has 64Mbytes size consists of 4 banks like bank0, bank1, bank2 and bank3. Signed-off-by: Jagannadha Sutradharudu Teki Reviewed-by: Simon Glass --- include/spi_flash.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/spi_flash.h b/include/spi_flash.h index 38587c2de4..91b43ee9df 100644 --- a/include/spi_flash.h +++ b/include/spi_flash.h @@ -42,6 +42,8 @@ struct spi_flash { u8 bank_read_cmd; /* Bank write cmd */ u8 bank_write_cmd; + /* Current flash bank */ + u8 bank_curr; void *memory_map; /* Address of read-only SPI flash access */ int (*read)(struct spi_flash *flash, u32 offset, -- cgit From 1dcd6d03811d4f30052a5e24377b378867211b05 Mon Sep 17 00:00:00 2001 From: Jagannadha Sutradharudu Teki Date: Wed, 19 Jun 2013 15:33:58 +0530 Subject: sf: Add bank addr code in CONFIG_SPI_FLASH_BAR Defined bank addr code on CONFIG_SPI_FLASH_BAR macro, to reduce the size for existing boards which has < 16Mbytes SPI flashes. It's upto user which has provision to use the bank addr code for flashes which has > 16Mbytes. Signed-off-by: Jagannadha Sutradharudu Teki Reviewed-by: Simon Glass --- include/spi_flash.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/spi_flash.h b/include/spi_flash.h index 91b43ee9df..e22d698af4 100644 --- a/include/spi_flash.h +++ b/include/spi_flash.h @@ -38,13 +38,14 @@ struct spi_flash { u32 page_size; /* Erase (sector) size */ u32 sector_size; +#ifdef CONFIG_SPI_FLASH_BAR /* Bank read cmd */ u8 bank_read_cmd; /* Bank write cmd */ u8 bank_write_cmd; /* Current flash bank */ u8 bank_curr; - +#endif void *memory_map; /* Address of read-only SPI flash access */ int (*read)(struct spi_flash *flash, u32 offset, size_t len, void *buf); -- cgit From 615a1561673a9a1b863f905d40f084f36edb9022 Mon Sep 17 00:00:00 2001 From: Jagannadha Sutradharudu Teki Date: Fri, 21 Jun 2013 15:56:30 +0530 Subject: sf: Add flag status register polling support Flag status register polling is required for micron 512Mb flash devices onwards, for performing erase/program operations. Like polling for WIP(Write-In-Progress) bit in read status register, spi_flash_cmd_wait_ready will poll for PEC(Program-Erase-Control) bit in flag status register. Signed-off-by: Jagannadha Sutradharudu Teki Reviewed-by: Simon Glass --- include/spi_flash.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include') diff --git a/include/spi_flash.h b/include/spi_flash.h index e22d698af4..e80785f55e 100644 --- a/include/spi_flash.h +++ b/include/spi_flash.h @@ -46,6 +46,9 @@ struct spi_flash { /* Current flash bank */ u8 bank_curr; #endif + /* Poll cmd - for flash erase/program */ + u8 poll_cmd; + void *memory_map; /* Address of read-only SPI flash access */ int (*read)(struct spi_flash *flash, u32 offset, size_t len, void *buf); -- cgit