Re: [U-Boot] [PATCH v3 02/17] sf: Add bank address register reading support

2013-06-12 Thread Simon Glass
On Tue, Jun 11, 2013 at 12:23 PM, Jagannadha Sutradharudu Teki 
jagannadha.sutradharudu-t...@xilinx.com wrote:

 This patch provides support to read a flash bank address register.

 reading extended/bank address register will give whether the flash
 is operated on extended/bank addressing or normal addressing in
 3-byte address mode.

 Currently added an extended/bank address register reading support
 for spansion flashes.

 reff' the spec for more details about bank addr register
 in Page-63, Table 8.16
 http://www.spansion.com/Support/Datasheets/S25FL128S_256S_00.pdf

 Signed-off-by: Jagannadha Sutradharudu Teki jaga...@xilinx.com


Reviewed-by: Simon Glass s...@chromium.org

(same comment as previous patch)

---
 Changes for v3:
 - none
 Changes for v2:
 - none

  drivers/mtd/spi/spi_flash.c  | 15 +++
  drivers/mtd/spi/spi_flash_internal.h |  4 
  2 files changed, 19 insertions(+)

 diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
 index 7aba520..193de42 100644
 --- a/drivers/mtd/spi/spi_flash.c
 +++ b/drivers/mtd/spi/spi_flash.c
 @@ -312,6 +312,21 @@ int spi_flash_cmd_bankaddr_write(struct spi_flash
 *flash, u8 bank_sel)
 return 0;
  }

 +int spi_flash_cmd_bankaddr_read(struct spi_flash *flash, void *data)
 +{
 +   u8 cmd;
 +   u8 idcode0 = flash-idcode0;
 +
 +   if (idcode0 == 0x01) {
 +   cmd = CMD_BANKADDR_BRRD;
 +   } else {
 +   printf(SF: Unsupported bank addr read %02x\n, idcode0);
 +   return -1;
 +   }
 +
 +   return spi_flash_read_common(flash, cmd, 1, data, 1);
 +}
 +
  #ifdef CONFIG_OF_CONTROL
  int spi_flash_decode_fdt(const void *blob, struct spi_flash *flash)
  {
 diff --git a/drivers/mtd/spi/spi_flash_internal.h
 b/drivers/mtd/spi/spi_flash_internal.h
 index 6e38494..2567bbc 100644
 --- a/drivers/mtd/spi/spi_flash_internal.h
 +++ b/drivers/mtd/spi/spi_flash_internal.h
 @@ -30,6 +30,7 @@

  /* Bank addr acess commands */
  #define CMD_BANKADDR_BRWR  0x17
 +#define CMD_BANKADDR_BRRD  0x16

  /* Common status */
  #define STATUS_WIP 0x01
 @@ -83,6 +84,9 @@ int spi_flash_cmd_write_status(struct spi_flash *flash,
 u8 sr);
  /* Program the bank address register */
  int spi_flash_cmd_bankaddr_write(struct spi_flash *flash, u8 bank_sel);

 +/* Read the bank address register */
 +int spi_flash_cmd_bankaddr_read(struct spi_flash *flash, void *data);
 +
  /*
   * Same as spi_flash_cmd_read() except it also claims/releases the SPI
   * bus. Used as common part of the -read() operation.
 --
 1.8.3



___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3 02/17] sf: Add bank address register reading support

2013-06-11 Thread Jagannadha Sutradharudu Teki
This patch provides support to read a flash bank address register.

reading extended/bank address register will give whether the flash
is operated on extended/bank addressing or normal addressing in
3-byte address mode.

Currently added an extended/bank address register reading support
for spansion flashes.

reff' the spec for more details about bank addr register
in Page-63, Table 8.16
http://www.spansion.com/Support/Datasheets/S25FL128S_256S_00.pdf

Signed-off-by: Jagannadha Sutradharudu Teki jaga...@xilinx.com
---
Changes for v3:
- none
Changes for v2:
- none

 drivers/mtd/spi/spi_flash.c  | 15 +++
 drivers/mtd/spi/spi_flash_internal.h |  4 
 2 files changed, 19 insertions(+)

diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
index 7aba520..193de42 100644
--- a/drivers/mtd/spi/spi_flash.c
+++ b/drivers/mtd/spi/spi_flash.c
@@ -312,6 +312,21 @@ int spi_flash_cmd_bankaddr_write(struct spi_flash *flash, 
u8 bank_sel)
return 0;
 }
 
+int spi_flash_cmd_bankaddr_read(struct spi_flash *flash, void *data)
+{
+   u8 cmd;
+   u8 idcode0 = flash-idcode0;
+
+   if (idcode0 == 0x01) {
+   cmd = CMD_BANKADDR_BRRD;
+   } else {
+   printf(SF: Unsupported bank addr read %02x\n, idcode0);
+   return -1;
+   }
+
+   return spi_flash_read_common(flash, cmd, 1, data, 1);
+}
+
 #ifdef CONFIG_OF_CONTROL
 int spi_flash_decode_fdt(const void *blob, struct spi_flash *flash)
 {
diff --git a/drivers/mtd/spi/spi_flash_internal.h 
b/drivers/mtd/spi/spi_flash_internal.h
index 6e38494..2567bbc 100644
--- a/drivers/mtd/spi/spi_flash_internal.h
+++ b/drivers/mtd/spi/spi_flash_internal.h
@@ -30,6 +30,7 @@
 
 /* Bank addr acess commands */
 #define CMD_BANKADDR_BRWR  0x17
+#define CMD_BANKADDR_BRRD  0x16
 
 /* Common status */
 #define STATUS_WIP 0x01
@@ -83,6 +84,9 @@ int spi_flash_cmd_write_status(struct spi_flash *flash, u8 
sr);
 /* Program the bank address register */
 int spi_flash_cmd_bankaddr_write(struct spi_flash *flash, u8 bank_sel);
 
+/* Read the bank address register */
+int spi_flash_cmd_bankaddr_read(struct spi_flash *flash, void *data);
+
 /*
  * Same as spi_flash_cmd_read() except it also claims/releases the SPI
  * bus. Used as common part of the -read() operation.
-- 
1.8.3


___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot