diff options
author | Robert ABEL <rabel@cit-ec.uni-bielefeld.de> | 2015-02-27 10:56:51 -0500 |
---|---|---|
committer | Roger Quadros <rogerq@ti.com> | 2015-03-06 05:34:28 -0500 |
commit | 563dbb260d74dbd49d66f9a07e0311563c62c8ff (patch) | |
tree | 5fdcd29b23edefbdc95a2a98822ad1cbcd95cbb6 | |
parent | 2affc816df6163c063d47f722191aa3bc542c22a (diff) |
ARM OMAP2+ GPMC: change get_gpmc_timing_reg output for DTS
DTS output was formatted to require additional work when copy-pasting into DTS.
Nano-second timings were replaced with interval of values that produce the same
number of clock ticks.
Signed-off-by: Robert ABEL <rabel@cit-ec.uni-bielefeld.de>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Roger Quadros <rogerq@ti.com>
-rw-r--r-- | drivers/memory/omap-gpmc.c | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c index 92898687181c..6a35971cb724 100644 --- a/drivers/memory/omap-gpmc.c +++ b/drivers/memory/omap-gpmc.c | |||
@@ -346,32 +346,50 @@ static void gpmc_cs_bool_timings(int cs, const struct gpmc_bool_timings *p) | |||
346 | } | 346 | } |
347 | 347 | ||
348 | #ifdef DEBUG | 348 | #ifdef DEBUG |
349 | /** | ||
350 | * get_gpmc_timing_reg - read a timing parameter and print DTS settings for it. | ||
351 | * @cs: Chip Select Region | ||
352 | * @reg: GPMC_CS_CONFIGn register offset. | ||
353 | * @st_bit: Start Bit | ||
354 | * @end_bit: End Bit. Must be >= @st_bit. | ||
355 | * @name: DTS node name, w/o "gpmc," | ||
356 | * @raw: Raw Format Option. | ||
357 | * raw format: gpmc,name = <value> | ||
358 | * tick format: gpmc,name = <value> /‍* x ns -- y ns; x ticks *‍/ | ||
359 | * Where x ns -- y ns result in the same tick value. | ||
360 | * @noval: Parameter values equal to 0 are not printed. | ||
361 | * @shift: Parameter value left shifts @shift, which is then printed instead of value. | ||
362 | * @return: Specified timing parameter (after optional @shift). | ||
363 | * | ||
364 | */ | ||
349 | static int get_gpmc_timing_reg(int cs, int reg, int st_bit, int end_bit, | 365 | static int get_gpmc_timing_reg(int cs, int reg, int st_bit, int end_bit, |
350 | bool raw, bool noval, int shift, | 366 | bool raw, bool noval, int shift, |
351 | const char *name) | 367 | const char *name) |
352 | { | 368 | { |
353 | u32 l; | 369 | u32 l; |
354 | int nr_bits, max_value, mask; | 370 | int nr_bits; |
371 | int mask; | ||
355 | 372 | ||
356 | l = gpmc_cs_read_reg(cs, reg); | 373 | l = gpmc_cs_read_reg(cs, reg); |
357 | nr_bits = end_bit - st_bit + 1; | 374 | nr_bits = end_bit - st_bit + 1; |
358 | max_value = (1 << nr_bits) - 1; | 375 | mask = (1 << nr_bits) - 1; |
359 | mask = max_value << st_bit; | 376 | l = (l >> st_bit) & mask; |
360 | l = (l & mask) >> st_bit; | ||
361 | if (shift) | 377 | if (shift) |
362 | l = (shift << l); | 378 | l = (shift << l); |
363 | if (noval && (l == 0)) | 379 | if (noval && (l == 0)) |
364 | return 0; | 380 | return 0; |
365 | if (!raw) { | 381 | if (!raw) { |
366 | unsigned int time_ns_min, time_ns, time_ns_max; | 382 | /* DTS tick format for timings in ns */ |
383 | unsigned int time_ns; | ||
384 | unsigned int time_ns_min = 0; | ||
367 | 385 | ||
368 | time_ns_min = gpmc_ticks_to_ns(l ? l - 1 : 0); | 386 | if (l) |
387 | time_ns_min = gpmc_ticks_to_ns(l - 1) + 1; | ||
369 | time_ns = gpmc_ticks_to_ns(l); | 388 | time_ns = gpmc_ticks_to_ns(l); |
370 | time_ns_max = gpmc_ticks_to_ns(l + 1 > max_value ? | 389 | pr_info("gpmc,%s = <%u> /* %u ns - %u ns; %i ticks */\n", |
371 | max_value : l + 1); | 390 | name, time_ns, time_ns_min, time_ns, l); |
372 | pr_info("gpmc,%s = <%u> (%u - %u ns, %i ticks)\n", | ||
373 | name, time_ns, time_ns_min, time_ns_max, l); | ||
374 | } else { | 391 | } else { |
392 | /* raw format */ | ||
375 | pr_info("gpmc,%s = <%u>\n", name, l); | 393 | pr_info("gpmc,%s = <%u>\n", name, l); |
376 | } | 394 | } |
377 | 395 | ||