[JUST RFC] ARM: DIGIC: add csrc-dummy

Sascha Hauer s.hauer at pengutronix.de
Mon Dec 16 02:41:59 EST 2013

On Sun, Dec 15, 2013 at 07:02:05PM +0400, Antony Pavlov wrote:
> The clocksource csrc-timer driver that uses DIGIC
> hardware TIMER2 perfectrly works on Canon A1100,
> but does not works on Canon EOS 600D.
> IMHO we need additional timer initialisation.
> This patch introduces a quick-and-dirty termporary
> solution for this situation: a clocksource driver that
> does not use any hardware at all.
> Also this driver is very handy for running barebox
> on Magic Lantern EOS qemu-based emulator as
> the emulator does not realize timer counter register at all!
> Signed-off-by: Antony Pavlov <antonynpavlov at gmail.com>
> ---
> +static uint64_t dummy_cs_read(void)
> +{
> +	dummy_counter += 2000;
> +	return dummy_counter;
> +}

I also played with the same approach. In my case it was more a fallback
when the initialization order was wrong so that the time functions were
used before the real clocksource was initialized. Without it time never
advanced and every udelay() locked up the system (or it crashed because
we didn't check for the clocksource being NULL, can't remember).

Maybe it would be possible to add this clocksource unconditionally on
every build, but let a real clocksource take over.

To do this and not silently fall back to a dummy console I suggest a:

static uint64_t dummy_cs_read(void)
	static int first;

	if (!first) {
		pr_warn("Warning: Using dummy clocksource\n");
		first = 0;

	dummy_counter += 2000;
	return dummy_counter;


Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

More information about the barebox mailing list