Commit 80323742 authored by Roger Quadros's avatar Roger Quadros

ARM: OMAP2+: gpmc: Print error message in set_gpmc_timing_reg()

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.
Signed-off-by: default avatarRoger Quadros <rogerq@ti.com>
Signed-off-by: default avatarSekhar Nori <nsekhar@ti.com>
Acked-by: default avatarTony Lindgren <tony@atomide.com>
parent f114040e
...@@ -283,13 +283,8 @@ static void gpmc_cs_bool_timings(int cs, const struct gpmc_bool_timings *p) ...@@ -283,13 +283,8 @@ static void gpmc_cs_bool_timings(int cs, const struct gpmc_bool_timings *p)
p->cycle2cyclediffcsen); p->cycle2cyclediffcsen);
} }
#ifdef DEBUG
static int set_gpmc_timing_reg(int cs, int reg, int st_bit, int end_bit, static int set_gpmc_timing_reg(int cs, int reg, int st_bit, int end_bit,
int time, const char *name) 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; u32 l;
int ticks, mask, nr_bits; 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, ...@@ -299,15 +294,15 @@ static int set_gpmc_timing_reg(int cs, int reg, int st_bit, int end_bit,
else else
ticks = gpmc_ns_to_ticks(time); ticks = gpmc_ns_to_ticks(time);
nr_bits = end_bit - st_bit + 1; nr_bits = end_bit - st_bit + 1;
if (ticks >= 1 << nr_bits) { mask = (1 << nr_bits) - 1;
#ifdef DEBUG
printk(KERN_INFO "GPMC CS%d: %-10s* %3d ns, %3d ticks >= %d\n", if (ticks > mask) {
cs, name, time, ticks, 1 << nr_bits); pr_err("%s: GPMC error! CS%d: %s: %d ns, %d ticks > %d\n",
#endif __func__, cs, name, time, ticks, mask);
return -1; return -1;
} }
mask = (1 << nr_bits) - 1;
l = gpmc_cs_read_reg(cs, reg); l = gpmc_cs_read_reg(cs, reg);
#ifdef DEBUG #ifdef DEBUG
printk(KERN_INFO printk(KERN_INFO
...@@ -322,16 +317,10 @@ static int set_gpmc_timing_reg(int cs, int reg, int st_bit, int end_bit, ...@@ -322,16 +317,10 @@ static int set_gpmc_timing_reg(int cs, int reg, int st_bit, int end_bit,
return 0; return 0;
} }
#ifdef DEBUG
#define GPMC_SET_ONE(reg, st, end, field) \ #define GPMC_SET_ONE(reg, st, end, field) \
if (set_gpmc_timing_reg(cs, (reg), (st), (end), \ if (set_gpmc_timing_reg(cs, (reg), (st), (end), \
t->field, #field) < 0) \ t->field, #field) < 0) \
return -1 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) int gpmc_calc_divider(unsigned int sync_clk)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment