Message ID | 20140716180423.GV7537@ld-irv-0074 |
---|---|
State | Accepted |
Commit | 6534e6809e6c9d48114b537afe03bee3fd33bf01 |
Headers | show |
> Hi Bean, >> + cfi->chips[i].buffer_write_time_max = >> + ((cfi->chips[i].buffer_write_time_max>= 2000) >> + ? cfi->chips[i].buffer_write_time_max : 2000); > > This should just use the 'max()' macro, from <linux/kernel.h>. > I have just fixed up your patch myself, to use max() and to improve some > of the language. Let me know if the below works for you. hi,Brian Thanks once again.I test and it works Ok.It can be accepted now?
On Thu, Jul 17, 2014 at 12:54:17AM +0000, Bean Huo wrote: > > I have just fixed up your patch myself, to use max() and to improve some > > of the language. Let me know if the below works for you. > > hi,Brian > Thanks once again.I test and it works Ok.It can be accepted now? Yes. Pushed to l2-mtd.git. Please be more diligent next time to follow CodingStyle and email submission practices next time. Even if your company email gives trouble, I'm sure you can find some way to send patches properly. For instance, a quick search shows me that your outlook.com email supports sending email via SMTP: http://windows.microsoft.com/en-us/windows/outlook/send-receive-from-app That means you can, for instance, use git-send-email to send patches. Brian
>From: Brian Norris >>On Thu, Jul 17, 2014 at 12:54:17AM +0000, Bean Huo wrote: >> > I have just fixed up your patch myself, to use max() and to improve some >> > of the language. Let me know if the below works for you. >> >> hi,Brian >> Thanks once again.I test and it works Ok.It can be accepted now? > >Yes. Pushed to l2-mtd.git. > This works well with Spansion NOR device (S29GL512S10) present on J6-EVM, using http://patchwork.ozlabs.org/patch/372866/. Though it's already accepted in l2-mtd.git, but just for record. Tested-by: Pekon Gupta <pekon@ti.com> with regards, pekon
diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c index bf313be6ee26..5a4bfe33112a 100644 --- a/drivers/mtd/chips/cfi_cmdset_0002.c +++ b/drivers/mtd/chips/cfi_cmdset_0002.c @@ -645,6 +645,23 @@ struct mtd_info *cfi_cmdset_0002(struct map_info *map, int primary) cfi->chips[i].word_write_time = 1<<cfi->cfiq->WordWriteTimeoutTyp; cfi->chips[i].buffer_write_time = 1<<cfi->cfiq->BufWriteTimeoutTyp; cfi->chips[i].erase_time = 1<<cfi->cfiq->BlockEraseTimeoutTyp; + /* + * First calculate the timeout max according to timeout field + * of struct cfi_ident that probed from chip's CFI aera, if + * available. Specify a minimum of 2000us, in case the CFI data + * is wrong. + */ + if (cfi->cfiq->BufWriteTimeoutTyp && + cfi->cfiq->BufWriteTimeoutMax) + cfi->chips[i].buffer_write_time_max = + 1 << (cfi->cfiq->BufWriteTimeoutTyp + + cfi->cfiq->BufWriteTimeoutMax); + else + cfi->chips[i].buffer_write_time_max = 0; + + cfi->chips[i].buffer_write_time_max = + max(cfi->chips[i].buffer_write_time_max, 2000); + cfi->chips[i].ref_point_counter = 0; init_waitqueue_head(&(cfi->chips[i].wq)); } @@ -1774,8 +1791,12 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip, { struct cfi_private *cfi = map->fldrv_priv; unsigned long timeo = jiffies + HZ; - /* see comments in do_write_oneword() regarding uWriteTimeo. */ - unsigned long uWriteTimeout = ( HZ / 1000 ) + 1; + /* + * Timeout is calculated according to CFI data, if available. + * See more comments in cfi_cmdset_0002(). + */ + unsigned long uWriteTimeout = + usecs_to_jiffies(chip->buffer_write_time_max); int ret = -EIO; unsigned long cmd_adr; int z, words;