From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marek Vasut Date: Wed, 19 Aug 2015 22:10:33 +0200 Subject: [U-Boot] [PATCH v2 7/7] sf: Add FSR support to spi_flash_cmd_wait_ready In-Reply-To: References: <1439807574-26767-1-git-send-email-jteki@openedev.com> <201508190939.10021.marex@denx.de> Message-ID: <201508192210.33414.marex@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Wednesday, August 19, 2015 at 10:17:59 AM, Jagan Teki wrote: > On 19 August 2015 at 13:09, Marek Vasut wrote: > > On Wednesday, August 19, 2015 at 09:35:32 AM, Jagan Teki wrote: > >> On 19 August 2015 at 04:28, Marek Vasut wrote: > >> > On Wednesday, August 19, 2015 at 12:36:40 AM, Jagan Teki wrote: > >> >> On 19 August 2015 at 03:33, Marek Vasut wrote: > >> >> > On Monday, August 17, 2015 at 12:32:54 PM, Jagan Teki wrote: > >> >> >> This patch adds flag status register reading support to > >> >> >> spi_flash_cmd_wait_ready. > >> >> >> > >> >> >> Signed-off-by: Jagan Teki > >> >> >> Cc: Simon Glass > >> >> >> Cc: Marek Vasut > >> >> >> Cc: Michal Simek > >> >> >> Cc: Siva Durga Prasad Paladugu > >> >> >> Cc: Stefan Roese > >> >> >> Cc: Tom Warren > >> >> >> Cc: Bin Meng > >> >> >> Cc: Tom Rini > >> >> >> Cc: Hou Zhiqiang > >> >> >> Tested-by: Jagan Teki > >> >> >> --- > >> >> >> > >> >> >> drivers/mtd/spi/sf_internal.h | 1 + > >> >> >> drivers/mtd/spi/sf_ops.c | 66 > >> >> >> > >> >> >> +++++++++++++++++++++++++++++++++++++++---- > >> >> >> drivers/mtd/spi/sf_probe.c > >> >> >> > >> >> >> | 4 +-- > >> >> >> > >> >> >> include/spi_flash.h | 2 -- > >> >> >> 4 files changed, 62 insertions(+), 11 deletions(-) > >> >> >> > >> >> >> diff --git a/drivers/mtd/spi/sf_internal.h > >> >> >> b/drivers/mtd/spi/sf_internal.h index e97c716..4ecfd0c 100644 > >> >> >> --- a/drivers/mtd/spi/sf_internal.h > >> >> >> +++ b/drivers/mtd/spi/sf_internal.h > >> >> >> @@ -49,6 +49,7 @@ enum { > >> >> >> > >> >> >> enum spi_nor_option_flags { > >> >> >> > >> >> >> SNOR_F_SST_WR = (1 << 0), > >> >> >> > >> >> >> + SNOR_F_USE_FSR = (1 << 1), > >> >> >> > >> >> >> }; > >> >> >> > >> >> >> #define SPI_FLASH_3B_ADDR_LEN 3 > >> >> >> > >> >> >> diff --git a/drivers/mtd/spi/sf_ops.c b/drivers/mtd/spi/sf_ops.c > >> >> >> index 7d7c264..a5487ad 100644 > >> >> >> --- a/drivers/mtd/spi/sf_ops.c > >> >> >> +++ b/drivers/mtd/spi/sf_ops.c > >> >> >> @@ -40,6 +40,21 @@ int spi_flash_cmd_read_status(struct spi_flash > >> >> >> *flash, u8 *rs) return 0; > >> >> >> > >> >> >> } > >> >> >> > >> >> >> +static int read_fsr(struct spi_flash *flash, u8 *fsr) > >> >> >> +{ > >> >> >> + int ret; > >> >> >> + u8 cmd; > >> >> >> + > >> >> >> + cmd = CMD_FLAG_STATUS; > >> >> >> + ret = spi_flash_read_common(flash, &cmd, 1, fsr, 1); > >> >> >> + if (ret < 0) { > >> >> >> + debug("SF: fail to read flag status register\n"); > >> >> >> + return ret; > >> >> >> + } > >> >> >> + > >> >> >> + return 0; > >> >> >> +} > >> >> >> + > >> >> >> > >> >> >> int spi_flash_cmd_write_status(struct spi_flash *flash, u8 ws) > >> >> >> { > >> >> >> > >> >> >> u8 cmd; > >> >> >> > >> >> >> @@ -138,24 +153,63 @@ static void spi_flash_dual_flash(struct > >> >> >> spi_flash *flash, u32 *addr) } > >> >> >> > >> >> >> #endif > >> >> >> > >> >> >> +static inline int spi_flash_sr_ready(struct spi_flash *flash) > >> >> >> +{ > >> >> >> + u8 sr; > >> >> >> + int ret; > >> >> >> + > >> >> >> + ret = spi_flash_cmd_read_status(flash, &sr); > >> >> >> + if (ret < 0) > >> >> >> + return ret; > >> >> >> + > >> >> >> + if (sr < 0) > >> >> > > >> >> > Have you ever seen u8 value that's < 0 ? :-) > >> >> > >> >> Yes, over looked, It's been fixed on next patches as well. > >> > > >> > Please don't apply broken code, fix this and repost. > >> > >> I don't know what your talking about, there is patch already submitted > >> with this fix and even you're CCed [1] > >> > >> [1] https://patchwork.ozlabs.org/patch/508166/ > > > > I am talking about not applying patches which are known to be defective. > > If you plan to apply this particular patch, make sure to fix it, repost > > it and then apply this. Do NOT apply a patch which is broken only to > > apply another patch which repairs the breakage, that's just nonsense. > > Sorry, we are not here to apply broken patches, that you must > understand clearly. I'm stopping this discussion here, sorry. > And we haven't re-post the series yet, if you have any concerns just wait > for next series and comment. Any applied patches before I have re-posted > to ML then only applied. Sorry, I don't understand this sentence. > thanks!