Tested on real hardware, works fine. Tested-by: Jagannadha Sutradharudu Teki <[email protected]>
Thanks, Jagan. On Wed, Dec 19, 2012 at 9:57 PM, Jagannadha Sutradharudu Teki <[email protected]> wrote: > This patch provides support to read a flash config register. > > Config register contains a control bits used to verify > the different configurations and security features of a device. > > User need to get the data through spi_flash_cmd_read_config() > based on their usage. > > Signed-off-by: Jagannadha Sutradharudu Teki <[email protected]> > --- > Changes in v2: none > > drivers/mtd/spi/spi_flash.c | 15 +++++++++++++++ > drivers/mtd/spi/spi_flash_internal.h | 4 ++++ > 2 files changed, 19 insertions(+), 0 deletions(-) > > diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c > index cad6c40..5bddde4 100644 > --- a/drivers/mtd/spi/spi_flash.c > +++ b/drivers/mtd/spi/spi_flash.c > @@ -314,6 +314,21 @@ int spi_flash_cmd_write_config(struct spi_flash *flash, > u8 cr) > return 0; > } > > +int spi_flash_cmd_read_config(struct spi_flash *flash, void *data) > +{ > + u8 cmd; > + int ret; > + > + cmd = CMD_READ_CONFIG; > + ret = spi_flash_read_common(flash, &cmd, sizeof(cmd), (void *)data, > 1); > + if (ret < 0) { > + debug("SF: fail to read config register\n"); > + return ret; > + } > + > + return 0; > +} > + > /* > * The following table holds all device probe functions > * > diff --git a/drivers/mtd/spi/spi_flash_internal.h > b/drivers/mtd/spi/spi_flash_internal.h > index 825b398..844e82e 100644 > --- a/drivers/mtd/spi/spi_flash_internal.h > +++ b/drivers/mtd/spi/spi_flash_internal.h > @@ -22,6 +22,7 @@ > #define CMD_PAGE_PROGRAM 0x02 > #define CMD_WRITE_DISABLE 0x04 > #define CMD_READ_STATUS 0x05 > +#define CMD_READ_CONFIG 0x35 > #define CMD_WRITE_ENABLE 0x06 > #define CMD_ERASE_4K 0x20 > #define CMD_ERASE_32K 0x52 > @@ -83,6 +84,9 @@ int spi_flash_cmd_read_status(struct spi_flash *flash, void > *data); > /* Program the config register. */ > int spi_flash_cmd_write_config(struct spi_flash *flash, u8 cr); > > +/* Read the config register */ > +int spi_flash_cmd_read_config(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.7.0.4 > _______________________________________________ U-Boot mailing list [email protected] http://lists.denx.de/mailman/listinfo/u-boot

