mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Antony Pavlov <antonynpavlov@gmail.com>
To: barebox@lists.infradead.org
Subject: [RFC 6/8] ARM: DIGIC: add csrc-dummy
Date: Mon, 26 Aug 2013 08:57:15 +0400	[thread overview]
Message-ID: <1377493037-2229-7-git-send-email-antonynpavlov@gmail.com> (raw)
In-Reply-To: <1377493037-2229-1-git-send-email-antonynpavlov@gmail.com>

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      |  4 ++++
 arch/arm/mach-digic/Makefile     |  1 +
 arch/arm/mach-digic/csrc-dummy.c | 49 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 54 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..b3de2d9 100644
--- a/arch/arm/mach-digic/Kconfig
+++ b/arch/arm/mach-digic/Kconfig
@@ -13,7 +13,11 @@ config ARCH_TEXT_BASE
 	hex
 	default 0x00001900 if MACH_CANON_A1100
 
+
 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.4.rc3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2013-08-26  5:00 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-26  4:57 [RFC 0/8] barebox on Canon cameras: serial console and dts support Antony Pavlov
2013-08-26  4:57 ` [RFC 1/8] ARM: add very initial support for Canon DIGIC chips Antony Pavlov
2013-08-26 13:20   ` Jason Cooper
2013-08-26 18:51     ` Antony Pavlov
2013-08-26 19:47       ` Jason Cooper
2013-08-26 23:32         ` Sebastian Hesselbarth
2013-08-27  1:46           ` Jason Cooper
2013-08-27  4:57             ` Antony Pavlov
2013-08-27  7:00           ` Jürgen Beisert
2013-08-26  4:57 ` [RFC 2/8] serial: add driver for Canon DIGIC UART Antony Pavlov
2013-08-26 13:28   ` Jason Cooper
2013-08-26  4:57 ` [RFC 3/8] gpio: add driver for Canon DIGIC Antony Pavlov
2013-08-26  4:57 ` [RFC 4/8] ARM: DIGIC: add Canon PowerShot A1100 IS support Antony Pavlov
2013-08-26  4:57 ` [RFC 5/8] ARM: DIGIC: add canon-a1100_defconfig Antony Pavlov
2013-08-26  4:57 ` Antony Pavlov [this message]
2013-08-26  4:57 ` [RFC 7/8] ARM: DIGIC: add Canon EOS 600D support Antony Pavlov
2013-08-26  4:57 ` [RFC 8/8] ARM: DIGIC: add canon-600d_defconfig Antony Pavlov

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=1377493037-2229-7-git-send-email-antonynpavlov@gmail.com \
    --to=antonynpavlov@gmail.com \
    --cc=barebox@lists.infradead.org \
    /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