mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Renaud Barbier <renaud.barbier@ge.com>
To: barebox@lists.infradead.org
Subject: [PATCH 2/9] Define clock source shift and mask.
Date: Tue, 24 Jan 2012 12:33:56 +0000	[thread overview]
Message-ID: <1327408443-3519-3-git-send-email-renaud.barbier@ge.com> (raw)
In-Reply-To: <1327408443-3519-1-git-send-email-renaud.barbier@ge.com>

* Define clock source shift and mask in mach/clock_config.h.
* Rename ppc/lib/time.c to ppc/lib/time-mpc5200.c.
* Update lib/Makefile to reflect change.

Signed-off-by: Renaud Barbier <renaud.barbier@ge.com>
---
 arch/ppc/lib/Makefile                             |    2 +-
 arch/ppc/lib/time-mpc5200.c                       |   75 +++++++++++++++++++++
 arch/ppc/lib/time.c                               |   74 --------------------
 arch/ppc/mach-mpc5xxx/include/mach/clock_config.h |    7 ++
 4 files changed, 83 insertions(+), 75 deletions(-)
 create mode 100644 arch/ppc/lib/time-mpc5200.c
 delete mode 100644 arch/ppc/lib/time.c
 create mode 100644 arch/ppc/mach-mpc5xxx/include/mach/clock_config.h

diff --git a/arch/ppc/lib/Makefile b/arch/ppc/lib/Makefile
index b611ddf..2af000a 100644
--- a/arch/ppc/lib/Makefile
+++ b/arch/ppc/lib/Makefile
@@ -4,7 +4,7 @@ obj-y += extable.o
 obj-y += kgdb.o
 obj-y += ppcstring.o
 obj-y += ticks.o
-obj-y += time.o
+obj-$(CONFIG_MPC5200) += time-mpc5200.o
 obj-y += misc.o
 obj-$(CONFIG_CMD_BOOTM) += ppclinux.o
 obj-y += board_data.o
diff --git a/arch/ppc/lib/time-mpc5200.c b/arch/ppc/lib/time-mpc5200.c
new file mode 100644
index 0000000..11f08a7
--- /dev/null
+++ b/arch/ppc/lib/time-mpc5200.c
@@ -0,0 +1,75 @@
+/*
+ * (C) Copyright 2000, 2001
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ *
+ * 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 as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <clock.h>
+#include <init.h>
+#include <mach/clocks.h>
+#include <mach/clock_config.h>
+#include <asm/common.h>
+
+/* ------------------------------------------------------------------------- */
+
+static int init_timebase (void)
+{
+#if defined(CONFIG_5xx) || defined(CONFIG_8xx)
+	volatile immap_t *immap = (immap_t *) CFG_IMMR;
+
+	/* unlock */
+	immap->im_sitk.sitk_tbk = KAPWR_KEY;
+#endif
+
+	/* reset */
+	asm ("li 3,0 ; mttbu 3 ; mttbl 3 ;");
+
+#if defined(CONFIG_5xx) || defined(CONFIG_8xx)
+	/* enable */
+	immap->im_sit.sit_tbscr |= TBSCR_TBE;
+#endif
+	return (0);
+}
+/* ------------------------------------------------------------------------- */
+
+uint64_t ppc_clocksource_read(void)
+{
+	return get_ticks();
+}
+
+static struct clocksource cs = {
+	.read	= ppc_clocksource_read,
+	.mask	= CLOCKSOURCE_MASK(CONFIG_CLOCKSOURCE_MASK),
+	.shift	= CONFIG_CLOCKSOURCE_SHIFT,
+};
+
+static int clocksource_init (void)
+{
+	init_timebase();
+
+	cs.mult = clocksource_hz2mult(get_timebase_clock(), cs.shift);
+
+	init_clock(&cs);
+
+	return 0;
+}
+
+core_initcall(clocksource_init);
diff --git a/arch/ppc/lib/time.c b/arch/ppc/lib/time.c
deleted file mode 100644
index 04c71df..0000000
--- a/arch/ppc/lib/time.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * (C) Copyright 2000, 2001
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * 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 as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <clock.h>
-#include <init.h>
-#include <mach/clocks.h>
-#include <asm/common.h>
-
-/* ------------------------------------------------------------------------- */
-
-static int init_timebase (void)
-{
-#if defined(CONFIG_5xx) || defined(CONFIG_8xx)
-	volatile immap_t *immap = (immap_t *) CFG_IMMR;
-
-	/* unlock */
-	immap->im_sitk.sitk_tbk = KAPWR_KEY;
-#endif
-
-	/* reset */
-	asm ("li 3,0 ; mttbu 3 ; mttbl 3 ;");
-
-#if defined(CONFIG_5xx) || defined(CONFIG_8xx)
-	/* enable */
-	immap->im_sit.sit_tbscr |= TBSCR_TBE;
-#endif
-	return (0);
-}
-/* ------------------------------------------------------------------------- */
-
-uint64_t ppc_clocksource_read(void)
-{
-	return get_ticks();
-}
-
-static struct clocksource cs = {
-	.read	= ppc_clocksource_read,
-	.mask	= CLOCKSOURCE_MASK(32),
-	.shift	= 15,
-};
-
-static int clocksource_init (void)
-{
-	init_timebase();
-
-	cs.mult = clocksource_hz2mult(get_timebase_clock(), cs.shift);
-
-	init_clock(&cs);
-
-	return 0;
-}
-
-core_initcall(clocksource_init);
diff --git a/arch/ppc/mach-mpc5xxx/include/mach/clock_config.h b/arch/ppc/mach-mpc5xxx/include/mach/clock_config.h
new file mode 100644
index 0000000..ee39199
--- /dev/null
+++ b/arch/ppc/mach-mpc5xxx/include/mach/clock_config.h
@@ -0,0 +1,7 @@
+#ifndef __ASM_ARCH_CLOCK_CONFIG_H
+#define __ASM_ARCH_CLOCK_CONFIG_H
+
+#define CONFIG_CLOCKSOURCE_MASK     32
+#define CONFIG_CLOCKSOURCE_SHIFT    15
+
+#endif /* __ASM_ARCH_CLOCK_CONFIG_H */
-- 
1.7.1


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

  parent reply	other threads:[~2012-01-24 12:34 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-24 12:33 [PATCH 0/9] MPC8xxx support Renaud Barbier
2012-01-24 12:33 ` [PATCH 1/9] Preparation stage to support multiple PPC architectures Renaud Barbier
2012-01-25 17:33   ` Sascha Hauer
2012-01-24 12:33 ` Renaud Barbier [this message]
2012-01-25 17:36   ` [PATCH 2/9] Define clock source shift and mask Sascha Hauer
2012-01-24 12:33 ` [PATCH 3/9] Added support for the mpc8xxx architecture Renaud Barbier
2012-01-24 12:33 ` [PATCH 4/9] Header files added to support " Renaud Barbier
2012-01-24 12:33 ` [PATCH 5/9] Update to existing header files Renaud Barbier
2012-01-24 12:34 ` [PATCH 6/9] Add file and compilation of strmhz Renaud Barbier
2012-01-24 12:34 ` [PATCH 7/9] Add-ons to the PPC library to support the mpc8xxx Renaud Barbier
2012-01-24 12:34 ` [PATCH 8/9] Update (ppc) Makefile and Kconfig Renaud Barbier
2012-01-24 12:34 ` [PATCH 9/9] P1_P2 platform support code and configuratin file for the P2020RDB Renaud Barbier
2012-01-25 19:33 ` [PATCH 0/9] MPC8xxx support Sascha Hauer

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=1327408443-3519-3-git-send-email-renaud.barbier@ge.com \
    --to=renaud.barbier@ge.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