diff mbox

[U-Boot,2/2] arc: use timer driver instead of arch/arc/lib/timer.c

Message ID 1478101495-9272-3-git-send-email-vzakhar@synopsys.com
State Superseded
Headers show

Commit Message

Zakharov Vlad Nov. 2, 2016, 3:44 p.m. UTC
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 adds CONFIG_TIMER and CONFIG_ARC_TIMER
config symbols to arc-specific defconfigs.

Signed-off-by: Vlad Zakharov <vzakhar@synopsys.com>
---
 arch/arc/dts/skeleton.dtsi    |  6 ++++++
 arch/arc/lib/Makefile         |  1 -
 arch/arc/lib/timer.c          | 24 ------------------------
 configs/axs101_defconfig      |  2 ++
 configs/axs103_defconfig      |  2 ++
 configs/nsim_700_defconfig    |  2 ++
 configs/nsim_700be_defconfig  |  2 ++
 configs/nsim_hs38_defconfig   |  2 ++
 configs/nsim_hs38be_defconfig |  2 ++
 configs/tb100_defconfig       |  2 ++
 include/configs/axs10x.h      |  2 --
 11 files changed, 20 insertions(+), 27 deletions(-)
 delete mode 100644 arch/arc/lib/timer.c

Comments

Simon Glass Nov. 2, 2016, 8:14 p.m. UTC | #1
Hi Vlad,

On 2 November 2016 at 09:44, Vlad Zakharov
<Vladislav.Zakharov@synopsys.com> wrote:
> 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 adds CONFIG_TIMER and CONFIG_ARC_TIMER
> config symbols to arc-specific defconfigs.
>
> Signed-off-by: Vlad Zakharov <vzakhar@synopsys.com>
> ---
>  arch/arc/dts/skeleton.dtsi    |  6 ++++++
>  arch/arc/lib/Makefile         |  1 -
>  arch/arc/lib/timer.c          | 24 ------------------------
>  configs/axs101_defconfig      |  2 ++
>  configs/axs103_defconfig      |  2 ++
>  configs/nsim_700_defconfig    |  2 ++
>  configs/nsim_700be_defconfig  |  2 ++
>  configs/nsim_hs38_defconfig   |  2 ++
>  configs/nsim_hs38be_defconfig |  2 ++
>  configs/tb100_defconfig       |  2 ++
>  include/configs/axs10x.h      |  2 --
>  11 files changed, 20 insertions(+), 27 deletions(-)
>  delete mode 100644 arch/arc/lib/timer.c

Reviewed-by: Simon Glass <sjg@chromium.org>

You might be able to add these to your arc Kconfig instead of adding
it to each board:

select CONFIG_TIMER
select CONFIG_ARC_TIMER

[..]
diff mbox

Patch

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@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/configs/axs101_defconfig b/configs/axs101_defconfig
index b8d8baf..2efe4c2 100644
--- a/configs/axs101_defconfig
+++ b/configs/axs101_defconfig
@@ -23,6 +23,8 @@  CONFIG_DM_ETH=y
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_DM_SERIAL=y
 CONFIG_SYS_NS16550=y
+CONFIG_TIMER=y
+CONFIG_ARC_TIMER=y
 CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_EHCI_HCD=y
diff --git a/configs/axs103_defconfig b/configs/axs103_defconfig
index 5e44633..0e4e2f1 100644
--- a/configs/axs103_defconfig
+++ b/configs/axs103_defconfig
@@ -23,6 +23,8 @@  CONFIG_DM_ETH=y
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_DM_SERIAL=y
 CONFIG_SYS_NS16550=y
+CONFIG_TIMER=y
+CONFIG_ARC_TIMER=y
 CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_OHCI_HCD=y
diff --git a/configs/nsim_700_defconfig b/configs/nsim_700_defconfig
index dab9bdf..00a9166 100644
--- a/configs/nsim_700_defconfig
+++ b/configs/nsim_700_defconfig
@@ -12,4 +12,6 @@  CONFIG_OF_CONTROL=y
 CONFIG_OF_EMBED=y
 CONFIG_DM=y
 CONFIG_DM_SERIAL=y
+CONFIG_TIMER=y
+CONFIG_ARC_TIMER=y
 CONFIG_USE_PRIVATE_LIBGCC=y
diff --git a/configs/nsim_700be_defconfig b/configs/nsim_700be_defconfig
index 6f0e348..c23a202 100644
--- a/configs/nsim_700be_defconfig
+++ b/configs/nsim_700be_defconfig
@@ -13,4 +13,6 @@  CONFIG_OF_CONTROL=y
 CONFIG_OF_EMBED=y
 CONFIG_DM=y
 CONFIG_DM_SERIAL=y
+CONFIG_TIMER=y
+CONFIG_ARC_TIMER=y
 CONFIG_USE_PRIVATE_LIBGCC=y
diff --git a/configs/nsim_hs38_defconfig b/configs/nsim_hs38_defconfig
index e35fe23..619fdf9 100644
--- a/configs/nsim_hs38_defconfig
+++ b/configs/nsim_hs38_defconfig
@@ -13,4 +13,6 @@  CONFIG_OF_CONTROL=y
 CONFIG_OF_EMBED=y
 CONFIG_DM=y
 CONFIG_DM_SERIAL=y
+CONFIG_TIMER=y
+CONFIG_ARC_TIMER=y
 CONFIG_USE_PRIVATE_LIBGCC=y
diff --git a/configs/nsim_hs38be_defconfig b/configs/nsim_hs38be_defconfig
index e0001b6..cd82eba 100644
--- a/configs/nsim_hs38be_defconfig
+++ b/configs/nsim_hs38be_defconfig
@@ -14,4 +14,6 @@  CONFIG_OF_CONTROL=y
 CONFIG_OF_EMBED=y
 CONFIG_DM=y
 CONFIG_DM_SERIAL=y
+CONFIG_TIMER=y
+CONFIG_ARC_TIMER=y
 CONFIG_USE_PRIVATE_LIBGCC=y
diff --git a/configs/tb100_defconfig b/configs/tb100_defconfig
index 6dc2242..830cc8c 100644
--- a/configs/tb100_defconfig
+++ b/configs/tb100_defconfig
@@ -17,4 +17,6 @@  CONFIG_NETDEVICES=y
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_DM_SERIAL=y
 CONFIG_SYS_NS16550=y
+CONFIG_TIMER=y
+CONFIG_ARC_TIMER=y
 CONFIG_USE_PRIVATE_LIBGCC=y
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)