All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vlad Zakharov <Vladislav.Zakharov@synopsys.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 2/2] arc: use timer driver instead of arch/arc/lib/timer.c
Date: Thu, 17 Nov 2016 16:44:16 +0300	[thread overview]
Message-ID: <1479390256-14716-3-git-send-email-vzakhar@synopsys.com> (raw)
In-Reply-To: <1479390256-14716-1-git-send-email-vzakhar@synopsys.com>

This commit replaces legacy timer code with usage of arc timer
driver.

Also it adds timer0 device tree node with corresponding
"clock-frequency" property.

Therefore we remove legacy CONFIG_SYS_TIMER_RATE config symbol
that is not longer required.

Furthermore the commit selects CONFIG_TIMER and CONFIG_ARC_TIMER
by default when selecting ARC architecture.

Signed-off-by: Vlad Zakharov <vzakhar@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org> 
---
No changes compared to v2

 arch/Kconfig               |  2 ++
 arch/arc/dts/skeleton.dtsi |  6 ++++++
 arch/arc/lib/Makefile      |  1 -
 arch/arc/lib/timer.c       | 24 ------------------------
 include/configs/axs10x.h   |  2 --
 5 files changed, 8 insertions(+), 27 deletions(-)
 delete mode 100644 arch/arc/lib/timer.c

diff --git a/arch/Kconfig b/arch/Kconfig
index ffc7b45..56fa70e 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -12,6 +12,8 @@ config ARC
 	bool "ARC architecture"
 	select HAVE_PRIVATE_LIBGCC
 	select SUPPORT_OF_CONTROL
+	select TIMER
+	select ARC_TIMER
 
 config ARM
 	bool "ARM architecture"
diff --git a/arch/arc/dts/skeleton.dtsi b/arch/arc/dts/skeleton.dtsi
index b41d241..3e93d697 100644
--- a/arch/arc/dts/skeleton.dtsi
+++ b/arch/arc/dts/skeleton.dtsi
@@ -10,4 +10,10 @@
 	chosen { };
 	aliases { };
 	memory { device_type = "memory"; reg = <0 0>; };
+
+	timer at 0 {
+			compatible = "snps,arc-timer";
+			clock-frequency = <100000000>;
+			reg = <0>;
+	};
 };
diff --git a/arch/arc/lib/Makefile b/arch/arc/lib/Makefile
index eb62b3c..12097bf 100644
--- a/arch/arc/lib/Makefile
+++ b/arch/arc/lib/Makefile
@@ -18,7 +18,6 @@ obj-y += memcmp.o
 obj-y += memcpy-700.o
 obj-y += memset.o
 obj-y += reset.o
-obj-y += timer.o
 obj-y += ints_low.o
 obj-y += init_helpers.o
 
diff --git a/arch/arc/lib/timer.c b/arch/arc/lib/timer.c
deleted file mode 100644
index a0acbbc..0000000
--- a/arch/arc/lib/timer.c
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
- *
- * SPDX-License-Identifier:	GPL-2.0+
- */
-
-#include <asm/arcregs.h>
-
-#define NH_MODE	(1 << 1)	/* Disable timer if CPU is halted */
-
-int timer_init(void)
-{
-	write_aux_reg(ARC_AUX_TIMER0_CTRL, NH_MODE);
-	/* Set max value for counter/timer */
-	write_aux_reg(ARC_AUX_TIMER0_LIMIT, 0xffffffff);
-	/* Set initial count value and restart counter/timer */
-	write_aux_reg(ARC_AUX_TIMER0_CNT, 0);
-	return 0;
-}
-
-unsigned long timer_read_counter(void)
-{
-	return read_aux_reg(ARC_AUX_TIMER0_CNT);
-}
diff --git a/include/configs/axs10x.h b/include/configs/axs10x.h
index 3546c8d..0476223 100644
--- a/include/configs/axs10x.h
+++ b/include/configs/axs10x.h
@@ -11,8 +11,6 @@
 /*
  *  CPU configuration
  */
-#define CONFIG_SYS_TIMER_RATE		CONFIG_SYS_CLK_FREQ
-
 #define ARC_FPGA_PERIPHERAL_BASE	0xE0000000
 #define ARC_APB_PERIPHERAL_BASE		0xF0000000
 #define ARC_DWMMC_BASE			(ARC_FPGA_PERIPHERAL_BASE + 0x15000)
-- 
2.7.4

      parent reply	other threads:[~2016-11-17 13:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-17 13:44 [U-Boot] [PATCH v3 0/2] drivers: timer: inroduce ARC timer driver Vlad Zakharov
2016-11-17 13:44 ` [U-Boot] [PATCH v3 1/2] drivers: timer: Introduce " Vlad Zakharov
2016-11-17 13:44 ` Vlad Zakharov [this message]

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=1479390256-14716-3-git-send-email-vzakhar@synopsys.com \
    --to=vladislav.zakharov@synopsys.com \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.