* [JUST RFC] add hardware independent clock source
@ 2013-12-15 15:02 Antony Pavlov
2013-12-15 15:02 ` [JUST RFC] ARM: DIGIC: add csrc-dummy Antony Pavlov
0 siblings, 1 reply; 11+ messages in thread
From: Antony Pavlov @ 2013-12-15 15:02 UTC (permalink / raw)
To: barebox
Then porting barebox to a new SoC/board it is possible
a situation then clocksource is broken or not yet present.
In the broken/absent clocksource situation serial barebox
console can't work correctly. Working on barebox for a DIGIC
chip I have faced this situation. To overcome the problem
I introduced the software-only clocksource.
The sample of hardware independent clock source is
in the following patch:
[JUST RFC] ARM: DIGIC: add csrc-dummy
Please comment on this approach!
May be there is some ready receipt for broken clocksource case?
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 11+ messages in thread
* [JUST RFC] ARM: DIGIC: add csrc-dummy
2013-12-15 15:02 [JUST RFC] add hardware independent clock source Antony Pavlov
@ 2013-12-15 15:02 ` Antony Pavlov
2013-12-15 18:08 ` Alexander Shiyan
` (2 more replies)
0 siblings, 3 replies; 11+ messages in thread
From: Antony Pavlov @ 2013-12-15 15:02 UTC (permalink / raw)
To: barebox
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@gmail.com>
---
arch/arm/mach-digic/Kconfig | 3 +++
arch/arm/mach-digic/Makefile | 1 +
arch/arm/mach-digic/csrc-dummy.c | 49 ++++++++++++++++++++++++++++++++++++++++
3 files changed, 53 insertions(+)
create mode 100644 arch/arm/mach-digic/csrc-dummy.c
diff --git a/arch/arm/mach-digic/Kconfig b/arch/arm/mach-digic/Kconfig
index 557cad4..d0524bc 100644
--- a/arch/arm/mach-digic/Kconfig
+++ b/arch/arm/mach-digic/Kconfig
@@ -16,4 +16,7 @@ config ARCH_TEXT_BASE
config DIGIC_CSRC_TIMER
bool
+config DIGIC_CSRC_DUMMY
+ bool
+
endif
diff --git a/arch/arm/mach-digic/Makefile b/arch/arm/mach-digic/Makefile
index 1d7cb72..31e5ac1 100644
--- a/arch/arm/mach-digic/Makefile
+++ b/arch/arm/mach-digic/Makefile
@@ -1,2 +1,3 @@
obj-y += core.o
obj-$(CONFIG_DIGIC_CSRC_TIMER) += csrc-timer.o
+obj-$(CONFIG_DIGIC_CSRC_DUMMY) += csrc-dummy.o
diff --git a/arch/arm/mach-digic/csrc-dummy.c b/arch/arm/mach-digic/csrc-dummy.c
new file mode 100644
index 0000000..68c68a3
--- /dev/null
+++ b/arch/arm/mach-digic/csrc-dummy.c
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2013 Antony Pavlov <antonynpavlov@gmail.com>
+ *
+ * This file is part of barebox.
+ * See file CREDITS for list of people who contributed to this project.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <init.h>
+#include <clock.h>
+
+#include <stdio.h>
+
+static uint64_t dummy_counter;
+
+static uint64_t dummy_cs_read(void)
+{
+ dummy_counter += 2000;
+ return dummy_counter;
+}
+
+static struct clocksource dummy_cs = {
+ .read = dummy_cs_read,
+ .mask = CLOCKSOURCE_MASK(32),
+};
+
+static int clocksource_init(void)
+{
+ dummy_counter = 0;
+
+ clocks_calc_mult_shift(&dummy_cs.mult, &dummy_cs.shift,
+ 100000000, NSEC_PER_SEC, 10);
+
+ printf("clocksource_init: mult=%08x, shift=%08x\n",
+ dummy_cs.mult, dummy_cs.shift);
+ init_clock(&dummy_cs);
+
+ return 0;
+}
+core_initcall(clocksource_init);
--
1.8.5
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [JUST RFC] ARM: DIGIC: add csrc-dummy
2013-12-15 15:02 ` [JUST RFC] ARM: DIGIC: add csrc-dummy Antony Pavlov
@ 2013-12-15 18:08 ` Alexander Shiyan
2013-12-15 18:52 ` Antony Pavlov
2013-12-15 19:30 ` Alexander Aring
2013-12-16 7:41 ` Sascha Hauer
2 siblings, 1 reply; 11+ messages in thread
From: Alexander Shiyan @ 2013-12-15 18:08 UTC (permalink / raw)
To: Antony Pavlov; +Cc: barebox
> 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@gmail.com>
...
> + printf("clocksource_init: mult=%08x, shift=%08x\n",
> + dummy_cs.mult, dummy_cs.shift);
No reason to spam into console. Put this into pr_debug.
---
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [JUST RFC] ARM: DIGIC: add csrc-dummy
2013-12-15 18:52 ` Antony Pavlov
@ 2013-12-15 18:50 ` Alexander Shiyan
0 siblings, 0 replies; 11+ messages in thread
From: Alexander Shiyan @ 2013-12-15 18:50 UTC (permalink / raw)
To: Antony Pavlov; +Cc: barebox
> On Sun, 15 Dec 2013 22:08:00 +0400
> Alexander Shiyan <shc_work@mail.ru> 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@gmail.com>
> > ...
> > > + printf("clocksource_init: mult=%08x, shift=%08x\n",
> > > + dummy_cs.mult, dummy_cs.shift);
> >
> > No reason to spam into console. Put this into pr_debug.
> >
>
> Of cause there is no reason to spam into console!
>
> This patch is mailed only for illustration of the concept,
> it even can't be applyed.
>
> Have you any comments on the concept itself?
I am not a guru, sorry :)
---
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [JUST RFC] ARM: DIGIC: add csrc-dummy
2013-12-15 18:08 ` Alexander Shiyan
@ 2013-12-15 18:52 ` Antony Pavlov
2013-12-15 18:50 ` Alexander Shiyan
0 siblings, 1 reply; 11+ messages in thread
From: Antony Pavlov @ 2013-12-15 18:52 UTC (permalink / raw)
To: Alexander Shiyan; +Cc: barebox
On Sun, 15 Dec 2013 22:08:00 +0400
Alexander Shiyan <shc_work@mail.ru> 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@gmail.com>
> ...
> > + printf("clocksource_init: mult=%08x, shift=%08x\n",
> > + dummy_cs.mult, dummy_cs.shift);
>
> No reason to spam into console. Put this into pr_debug.
>
Of cause there is no reason to spam into console!
This patch is mailed only for illustration of the concept,
it even can't be applyed.
Have you any comments on the concept itself?
--
Best regards,
Antony Pavlov
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [JUST RFC] ARM: DIGIC: add csrc-dummy
2013-12-15 15:02 ` [JUST RFC] ARM: DIGIC: add csrc-dummy Antony Pavlov
2013-12-15 18:08 ` Alexander Shiyan
@ 2013-12-15 19:30 ` Alexander Aring
2013-12-15 20:40 ` Antony Pavlov
2013-12-16 7:41 ` Sascha Hauer
2 siblings, 1 reply; 11+ messages in thread
From: Alexander Aring @ 2013-12-15 19:30 UTC (permalink / raw)
To: Antony Pavlov; +Cc: barebox
Hi Antony,
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@gmail.com>
> ---
> arch/arm/mach-digic/Kconfig | 3 +++
> arch/arm/mach-digic/Makefile | 1 +
> arch/arm/mach-digic/csrc-dummy.c | 49 ++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 53 insertions(+)
> create mode 100644 arch/arm/mach-digic/csrc-dummy.c
>
> diff --git a/arch/arm/mach-digic/Kconfig b/arch/arm/mach-digic/Kconfig
> index 557cad4..d0524bc 100644
> --- a/arch/arm/mach-digic/Kconfig
> +++ b/arch/arm/mach-digic/Kconfig
> @@ -16,4 +16,7 @@ config ARCH_TEXT_BASE
> config DIGIC_CSRC_TIMER
> bool
>
> +config DIGIC_CSRC_DUMMY
> + bool
> +
> endif
> diff --git a/arch/arm/mach-digic/Makefile b/arch/arm/mach-digic/Makefile
> index 1d7cb72..31e5ac1 100644
> --- a/arch/arm/mach-digic/Makefile
> +++ b/arch/arm/mach-digic/Makefile
> @@ -1,2 +1,3 @@
> obj-y += core.o
> obj-$(CONFIG_DIGIC_CSRC_TIMER) += csrc-timer.o
> +obj-$(CONFIG_DIGIC_CSRC_DUMMY) += csrc-dummy.o
> diff --git a/arch/arm/mach-digic/csrc-dummy.c b/arch/arm/mach-digic/csrc-dummy.c
> new file mode 100644
> index 0000000..68c68a3
> --- /dev/null
> +++ b/arch/arm/mach-digic/csrc-dummy.c
> @@ -0,0 +1,49 @@
> +/*
> + * Copyright (C) 2013 Antony Pavlov <antonynpavlov@gmail.com>
> + *
> + * This file is part of barebox.
> + * See file CREDITS for list of people who contributed to this project.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2
> + * as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + *
> + */
> +
> +#include <init.h>
> +#include <clock.h>
> +
> +#include <stdio.h>
> +
> +static uint64_t dummy_counter;
> +
> +static uint64_t dummy_cs_read(void)
> +{
> + dummy_counter += 2000;
> + return dummy_counter;
> +}
> +
So if I understand it right, you assume here that the instructions to
read this value will take 0.02 ms?
- Alex
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [JUST RFC] ARM: DIGIC: add csrc-dummy
2013-12-15 19:30 ` Alexander Aring
@ 2013-12-15 20:40 ` Antony Pavlov
2013-12-15 21:17 ` Alexander Aring
0 siblings, 1 reply; 11+ messages in thread
From: Antony Pavlov @ 2013-12-15 20:40 UTC (permalink / raw)
To: Alexander Aring; +Cc: barebox
On Sun, 15 Dec 2013 20:30:16 +0100
Alexander Aring <alex.aring@gmail.com> wrote:
> Hi Antony,
>
> 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@gmail.com>
> > ---
> > arch/arm/mach-digic/Kconfig | 3 +++
> > arch/arm/mach-digic/Makefile | 1 +
> > arch/arm/mach-digic/csrc-dummy.c | 49 ++++++++++++++++++++++++++++++++++++++++
> > 3 files changed, 53 insertions(+)
> > create mode 100644 arch/arm/mach-digic/csrc-dummy.c
> >
> > diff --git a/arch/arm/mach-digic/Kconfig b/arch/arm/mach-digic/Kconfig
> > index 557cad4..d0524bc 100644
> > --- a/arch/arm/mach-digic/Kconfig
> > +++ b/arch/arm/mach-digic/Kconfig
> > @@ -16,4 +16,7 @@ config ARCH_TEXT_BASE
> > config DIGIC_CSRC_TIMER
> > bool
> >
> > +config DIGIC_CSRC_DUMMY
> > + bool
> > +
> > endif
> > diff --git a/arch/arm/mach-digic/Makefile b/arch/arm/mach-digic/Makefile
> > index 1d7cb72..31e5ac1 100644
> > --- a/arch/arm/mach-digic/Makefile
> > +++ b/arch/arm/mach-digic/Makefile
> > @@ -1,2 +1,3 @@
> > obj-y += core.o
> > obj-$(CONFIG_DIGIC_CSRC_TIMER) += csrc-timer.o
> > +obj-$(CONFIG_DIGIC_CSRC_DUMMY) += csrc-dummy.o
> > diff --git a/arch/arm/mach-digic/csrc-dummy.c b/arch/arm/mach-digic/csrc-dummy.c
> > new file mode 100644
> > index 0000000..68c68a3
> > --- /dev/null
> > +++ b/arch/arm/mach-digic/csrc-dummy.c
> > @@ -0,0 +1,49 @@
> > +/*
> > + * Copyright (C) 2013 Antony Pavlov <antonynpavlov@gmail.com>
> > + *
> > + * This file is part of barebox.
> > + * See file CREDITS for list of people who contributed to this project.
> > + *
> > + * This program is free software; you can redistribute it and/or modify
> > + * it under the terms of the GNU General Public License version 2
> > + * as published by the Free Software Foundation.
> > + *
> > + * This program is distributed in the hope that it will be useful,
> > + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> > + * GNU General Public License for more details.
> > + *
> > + */
> > +
> > +#include <init.h>
> > +#include <clock.h>
> > +
> > +#include <stdio.h>
> > +
> > +static uint64_t dummy_counter;
> > +
> > +static uint64_t dummy_cs_read(void)
> > +{
> > + dummy_counter += 2000;
> > + return dummy_counter;
> > +}
> > +
> So if I understand it right, you assume here that the instructions to
> read this value will take 0.02 ms?
It is not quite. I don't assume initially the time to read this value.
This value ("2000") was a suboptimal value for __specific board__
under the __specific circumstances__.
I have selected this value after several experiments.
--
Best regards,
Antony Pavlov
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [JUST RFC] ARM: DIGIC: add csrc-dummy
2013-12-15 20:40 ` Antony Pavlov
@ 2013-12-15 21:17 ` Alexander Aring
0 siblings, 0 replies; 11+ messages in thread
From: Alexander Aring @ 2013-12-15 21:17 UTC (permalink / raw)
To: Antony Pavlov; +Cc: barebox
On Mon, Dec 16, 2013 at 12:40:13AM +0400, Antony Pavlov wrote:
> On Sun, 15 Dec 2013 20:30:16 +0100
> Alexander Aring <alex.aring@gmail.com> wrote:
>
> > Hi Antony,
> >
> > 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@gmail.com>
> > > ---
> > > arch/arm/mach-digic/Kconfig | 3 +++
> > > arch/arm/mach-digic/Makefile | 1 +
> > > arch/arm/mach-digic/csrc-dummy.c | 49 ++++++++++++++++++++++++++++++++++++++++
> > > 3 files changed, 53 insertions(+)
> > > create mode 100644 arch/arm/mach-digic/csrc-dummy.c
> > >
> > > diff --git a/arch/arm/mach-digic/Kconfig b/arch/arm/mach-digic/Kconfig
> > > index 557cad4..d0524bc 100644
> > > --- a/arch/arm/mach-digic/Kconfig
> > > +++ b/arch/arm/mach-digic/Kconfig
> > > @@ -16,4 +16,7 @@ config ARCH_TEXT_BASE
> > > config DIGIC_CSRC_TIMER
> > > bool
> > >
> > > +config DIGIC_CSRC_DUMMY
> > > + bool
> > > +
> > > endif
> > > diff --git a/arch/arm/mach-digic/Makefile b/arch/arm/mach-digic/Makefile
> > > index 1d7cb72..31e5ac1 100644
> > > --- a/arch/arm/mach-digic/Makefile
> > > +++ b/arch/arm/mach-digic/Makefile
> > > @@ -1,2 +1,3 @@
> > > obj-y += core.o
> > > obj-$(CONFIG_DIGIC_CSRC_TIMER) += csrc-timer.o
> > > +obj-$(CONFIG_DIGIC_CSRC_DUMMY) += csrc-dummy.o
> > > diff --git a/arch/arm/mach-digic/csrc-dummy.c b/arch/arm/mach-digic/csrc-dummy.c
> > > new file mode 100644
> > > index 0000000..68c68a3
> > > --- /dev/null
> > > +++ b/arch/arm/mach-digic/csrc-dummy.c
> > > @@ -0,0 +1,49 @@
> > > +/*
> > > + * Copyright (C) 2013 Antony Pavlov <antonynpavlov@gmail.com>
> > > + *
> > > + * This file is part of barebox.
> > > + * See file CREDITS for list of people who contributed to this project.
> > > + *
> > > + * This program is free software; you can redistribute it and/or modify
> > > + * it under the terms of the GNU General Public License version 2
> > > + * as published by the Free Software Foundation.
> > > + *
> > > + * This program is distributed in the hope that it will be useful,
> > > + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> > > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> > > + * GNU General Public License for more details.
> > > + *
> > > + */
> > > +
> > > +#include <init.h>
> > > +#include <clock.h>
> > > +
> > > +#include <stdio.h>
> > > +
> > > +static uint64_t dummy_counter;
> > > +
> > > +static uint64_t dummy_cs_read(void)
> > > +{
> > > + dummy_counter += 2000;
> > > + return dummy_counter;
> > > +}
> > > +
> > So if I understand it right, you assume here that the instructions to
> > read this value will take 0.02 ms?
>
> It is not quite. I don't assume initially the time to read this value.
> This value ("2000") was a suboptimal value for __specific board__
> under the __specific circumstances__.
> I have selected this value after several experiments.
>
mhh, I am thinking maybe about some calculation with clock ticks. Maybe
some "nop" operations and inline assembler. In the processor datasheet
should stand how long one "nop" instruction will take. Then you can
increase the dummy_counter intervall and waits longer, that should
deincrease the amount of failure (I think).
The current solution has the smallest clock resolution (because you
don't make any "nops" instructions).
It isn't a quite solution as well and I don't know if this still works
with your qemu emulation. It's just a notice for an alternative and an
idea. It's the same idea like you already have...
Another question:
How do the original firmware do this? I think there are some date/time
information. Is there any additional hardware?
- Alex
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [JUST RFC] ARM: DIGIC: add csrc-dummy
2013-12-15 15:02 ` [JUST RFC] ARM: DIGIC: add csrc-dummy Antony Pavlov
2013-12-15 18:08 ` Alexander Shiyan
2013-12-15 19:30 ` Alexander Aring
@ 2013-12-16 7:41 ` Sascha Hauer
2013-12-16 7:46 ` Alexander Aring
2013-12-16 7:48 ` Alexander Shiyan
2 siblings, 2 replies; 11+ messages in thread
From: Sascha Hauer @ 2013-12-16 7:41 UTC (permalink / raw)
To: Antony Pavlov; +Cc: barebox
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@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;
}
Sascha
--
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 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [JUST RFC] ARM: DIGIC: add csrc-dummy
2013-12-16 7:41 ` Sascha Hauer
@ 2013-12-16 7:46 ` Alexander Aring
2013-12-16 7:48 ` Alexander Shiyan
1 sibling, 0 replies; 11+ messages in thread
From: Alexander Aring @ 2013-12-16 7:46 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
On Mon, Dec 16, 2013 at 08:41:59AM +0100, Sascha Hauer wrote:
> 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@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;
first = 1;
:-)
- Alex
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [JUST RFC] ARM: DIGIC: add csrc-dummy
2013-12-16 7:41 ` Sascha Hauer
2013-12-16 7:46 ` Alexander Aring
@ 2013-12-16 7:48 ` Alexander Shiyan
1 sibling, 0 replies; 11+ messages in thread
From: Alexander Shiyan @ 2013-12-16 7:48 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
> 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!
...
> 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;
first =1;
---
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2013-12-16 7:49 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-15 15:02 [JUST RFC] add hardware independent clock source Antony Pavlov
2013-12-15 15:02 ` [JUST RFC] ARM: DIGIC: add csrc-dummy Antony Pavlov
2013-12-15 18:08 ` Alexander Shiyan
2013-12-15 18:52 ` Antony Pavlov
2013-12-15 18:50 ` Alexander Shiyan
2013-12-15 19:30 ` Alexander Aring
2013-12-15 20:40 ` Antony Pavlov
2013-12-15 21:17 ` Alexander Aring
2013-12-16 7:41 ` Sascha Hauer
2013-12-16 7:46 ` Alexander Aring
2013-12-16 7:48 ` Alexander Shiyan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox