linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: Roger Quadros <rogerq@ti.com>
Cc: pekon@pek-sem.com, javier@dowhile0.org,
	linux-omap@vger.kernel.org, Sekhar Nori <nsekhar@ti.com>
Subject: Re: [PATCH 1/5] ARM: OMAP2+: gpmc: Print error message in set_gpmc_timing_reg()
Date: Tue, 28 Oct 2014 15:23:50 -0700	[thread overview]
Message-ID: <20141028222349.GV2542@atomide.com> (raw)
In-Reply-To: <1413895309-9152-2-git-send-email-rogerq@ti.com>

* Roger Quadros <rogerq@ti.com> [141021 05:43]:
> Simplify set_gpmc_timing_reg() and always print error message
> if the requested timing cannot be achieved due to a too fast
> GPMC functional clock, irrespective if whether DEBUG is defined
> or not. This should help us debug timing configuration issues,
> which were otherwise simply not being displayed in the kernel log.

I think some newer versions of GPMC have a divider in the
GPMC_CONFIG regs somewhere but we're not currently using it.
Probably does not affect this patch, just FYI.

Regards,

Tony
 
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> Signed-off-by: Sekhar Nori <nsekhar@ti.com>
> ---
>  arch/arm/mach-omap2/gpmc.c | 23 ++++++-----------------
>  1 file changed, 6 insertions(+), 17 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
> index 5fa3755..45f680f 100644
> --- a/arch/arm/mach-omap2/gpmc.c
> +++ b/arch/arm/mach-omap2/gpmc.c
> @@ -283,13 +283,8 @@ static void gpmc_cs_bool_timings(int cs, const struct gpmc_bool_timings *p)
>  			   p->cycle2cyclediffcsen);
>  }
>  
> -#ifdef DEBUG
>  static int set_gpmc_timing_reg(int cs, int reg, int st_bit, int end_bit,
>  			       int time, const char *name)
> -#else
> -static int set_gpmc_timing_reg(int cs, int reg, int st_bit, int end_bit,
> -			       int time)
> -#endif
>  {
>  	u32 l;
>  	int ticks, mask, nr_bits;
> @@ -299,15 +294,15 @@ static int set_gpmc_timing_reg(int cs, int reg, int st_bit, int end_bit,
>  	else
>  		ticks = gpmc_ns_to_ticks(time);
>  	nr_bits = end_bit - st_bit + 1;
> -	if (ticks >= 1 << nr_bits) {
> -#ifdef DEBUG
> -		printk(KERN_INFO "GPMC CS%d: %-10s* %3d ns, %3d ticks >= %d\n",
> -				cs, name, time, ticks, 1 << nr_bits);
> -#endif
> +	mask = (1 << nr_bits) - 1;
> +
> +	if (ticks > mask) {
> +		pr_err("%s: GPMC error! CS%d: %s: %d ns, %d ticks > %d\n",
> +		       __func__, cs, name, time, ticks, mask);
> +
>  		return -1;
>  	}
>  
> -	mask = (1 << nr_bits) - 1;
>  	l = gpmc_cs_read_reg(cs, reg);
>  #ifdef DEBUG
>  	printk(KERN_INFO
> @@ -322,16 +317,10 @@ static int set_gpmc_timing_reg(int cs, int reg, int st_bit, int end_bit,
>  	return 0;
>  }
>  
> -#ifdef DEBUG
>  #define GPMC_SET_ONE(reg, st, end, field) \
>  	if (set_gpmc_timing_reg(cs, (reg), (st), (end),		\
>  			t->field, #field) < 0)			\
>  		return -1
> -#else
> -#define GPMC_SET_ONE(reg, st, end, field) \
> -	if (set_gpmc_timing_reg(cs, (reg), (st), (end), t->field) < 0) \
> -		return -1
> -#endif
>  
>  int gpmc_calc_divider(unsigned int sync_clk)
>  {
> -- 
> 1.8.3.2
> 

  reply	other threads:[~2014-10-28 22:25 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-21 12:41 [PATCH 0/5] ARM: OMAP2+: gpmc: configuration enhancements Roger Quadros
2014-10-21 12:41 ` [PATCH 1/5] ARM: OMAP2+: gpmc: Print error message in set_gpmc_timing_reg() Roger Quadros
2014-10-28 22:23   ` Tony Lindgren [this message]
2014-10-29  8:50     ` Roger Quadros
2014-10-29 14:13       ` Tony Lindgren
2014-11-04 19:59   ` pekon
2014-10-21 12:41 ` [PATCH 2/5] ARM: OMAP2+: gpmc: Error out if timings fail in gpmc_probe_generic_child() Roger Quadros
2014-11-04  0:45   ` Tony Lindgren
2014-11-04  1:14     ` Tony Lindgren
2014-11-04  9:03       ` Roger Quadros
2014-11-04 15:51         ` Tony Lindgren
2014-10-21 12:41 ` [PATCH 3/5] ARM: OMAP2+: gpmc: Always enable A26-A11 for non NAND devices Roger Quadros
2014-10-21 12:41 ` [PATCH 4/5] ARM: OMAP2+: gpmc: Keep Chip Select disabled while configuring it Roger Quadros
2014-10-21 12:41 ` [PATCH 5/5] ARM: OMAP2+: gpmc: Sanity check GPMC fck on probe Roger Quadros
2014-10-30 15:10 ` [PATCH 0/5] ARM: OMAP2+: gpmc: configuration enhancements Tony Lindgren
2014-10-30 15:24   ` Roger Quadros
2014-11-04 17:49     ` Tony Lindgren
2014-11-05 12:46       ` Roger Quadros
2014-11-05 16:09         ` Tony Lindgren

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=20141028222349.GV2542@atomide.com \
    --to=tony@atomide.com \
    --cc=javier@dowhile0.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=nsekhar@ti.com \
    --cc=pekon@pek-sem.com \
    --cc=rogerq@ti.com \
    /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;
as well as URLs for NNTP newsgroup(s).