public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Scott Wood <scottwood@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH] mips: tolerate the MIPS 'CFG_HZ' values in	the MHZ range for NAND delays
Date: Mon, 19 May 2008 15:26:54 -0500	[thread overview]
Message-ID: <4831E28E.5060005@freescale.com> (raw)
In-Reply-To: <20080519201124.6F09D10376@mcmullan-linux.hq.netapp.com>

Jason McMullan wrote:
> Rewrite the nand_wait() FL_ERASING case to handle CFG_HZ values in the
> MHZ range. This is needed for mips processors, as the timer's timebase
> ticks at CPU clock frequency.

Even though it's MIPS that needs it, it should be flagged as a NAND 
patch since that's the code it touches.

> diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
> index 2da1d46..ac690ac 100644
> --- a/drivers/mtd/nand/nand_base.c
> +++ b/drivers/mtd/nand/nand_base.c
> @@ -837,10 +837,17 @@ static int nand_wait(struct mtd_info *mtd, struct nand_chip *this, int state)
>  {
>  	unsigned long	timeo;
>  
> +#if CFG_HZ > 100000
> +	if (state == FL_ERASING)
> + 		timeo = (CFG_HZ / 1000) * 400;
> +	else
> +		timeo = (CFG_HZ / 1000) * 20;
> +#else
>  	if (state == FL_ERASING)
>   		timeo = (CFG_HZ * 400) / 1000;
>  	else
>  		timeo = (CFG_HZ * 20) / 1000;
> +#endif


How about this?

if (state == FL_ERASING)
	timeo = CFG_HZ * 2 / 5;
else
	timeo = CFG_HZ / 50

If we have CFG_HZ values that are within a factor of 2 of wrapping 
around, the platform should probably do some downward scaling (or we 
should think about 64-bit timestamps)...

-Scott

  reply	other threads:[~2008-05-19 20:26 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-16 18:24 [U-Boot-Users] [PATCH] mips: tolerate the MIPS 'CFG_HZ' values in the MHZ range for NAND delays Jason McMullan
2008-05-19 20:26 ` Scott Wood [this message]
2008-05-19 20:31   ` [U-Boot-Users] [PATCH] mips: tolerate the MIPS 'CFG_HZ' valuesin " McMullan, Jason
2008-05-19 20:36     ` Scott Wood
2008-05-19 20:39   ` [U-Boot-Users] [PATCH] mips: tolerate the MIPS 'CFG_HZ' values in " Wolfgang Denk
2008-05-19 20:43     ` Scott Wood
2008-05-19 20:51       ` Wolfgang Denk
2008-05-19 21:15         ` Scott Wood
2008-06-11 23:02           ` Wolfgang Denk
2008-05-19 20:38 ` Wolfgang Denk
2008-05-20  8:27   ` Haavard Skinnemoen
2008-05-20  8:34     ` Wolfgang Denk
2008-05-20  9:22       ` Haavard Skinnemoen
2008-05-20  9:31         ` Wolfgang Denk
2008-05-19 20:44 ` Alessandro Rubini
2008-05-19 20:53   ` Wolfgang Denk
2008-05-19 21:04     ` Alessandro Rubini
2008-05-19 21:14       ` Wolfgang Denk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4831E28E.5060005@freescale.com \
    --to=scottwood@freescale.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox