* [PATCH 1/3] ARM: timer: fix checkpatch warnings
@ 2012-10-23 18:28 Stephen Warren
2012-10-23 18:28 ` [PATCH 2/3] ARM: tegra: enhance timer.c to get IO address from device tree Stephen Warren
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Stephen Warren @ 2012-10-23 18:28 UTC (permalink / raw)
To: linux-arm-kernel
From: Stephen Warren <swarren@nvidia.com>
This prevents checkpatch complaining when this file is moved in a later
patch.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
arch/arm/mach-tegra/timer.c | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/arch/arm/mach-tegra/timer.c b/arch/arm/mach-tegra/timer.c
index e5deb54..026bad4 100644
--- a/arch/arm/mach-tegra/timer.c
+++ b/arch/arm/mach-tegra/timer.c
@@ -185,8 +185,7 @@ static void __init tegra_init_timer(void)
clk = clk_get_sys("timer", NULL);
if (IS_ERR(clk)) {
- pr_warn("Unable to get timer clock."
- " Assuming 12Mhz input clock.\n");
+ pr_warn("Unable to get timer clock. Assuming 12Mhz input clock.\n");
rate = 12000000;
} else {
clk_prepare_enable(clk);
@@ -226,13 +225,13 @@ static void __init tegra_init_timer(void)
if (clocksource_mmio_init(timer_reg_base + TIMERUS_CNTR_1US,
"timer_us", 1000000, 300, 32, clocksource_mmio_readl_up)) {
- printk(KERN_ERR "Failed to register clocksource\n");
+ pr_err("Failed to register clocksource\n");
BUG();
}
ret = setup_irq(tegra_timer_irq.irq, &tegra_timer_irq);
if (ret) {
- printk(KERN_ERR "Failed to register timer IRQ: %d\n", ret);
+ pr_err("Failed to register timer IRQ: %d\n", ret);
BUG();
}
--
1.7.0.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/3] ARM: tegra: enhance timer.c to get IO address from device tree
2012-10-23 18:28 [PATCH 1/3] ARM: timer: fix checkpatch warnings Stephen Warren
@ 2012-10-23 18:28 ` Stephen Warren
2012-10-23 18:28 ` [PATCH 3/3] ARM: tegra: move timer.c to drivers/clocksource/ Stephen Warren
2012-10-29 17:06 ` [PATCH 1/3] ARM: timer: fix checkpatch warnings Stephen Warren
2 siblings, 0 replies; 4+ messages in thread
From: Stephen Warren @ 2012-10-23 18:28 UTC (permalink / raw)
To: linux-arm-kernel
From: Stephen Warren <swarren@nvidia.com>
Modify Tegra's timer code to parse the IO address from device tree,
hence removing the dependency on <mach/iomap.h>. This will allow the
driver to be moved to drivers/clocksource/.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
arch/arm/mach-tegra/timer.c | 32 ++++++++++++++++++++++++++++----
1 files changed, 28 insertions(+), 4 deletions(-)
diff --git a/arch/arm/mach-tegra/timer.c b/arch/arm/mach-tegra/timer.c
index 026bad4..e4863f3 100644
--- a/arch/arm/mach-tegra/timer.c
+++ b/arch/arm/mach-tegra/timer.c
@@ -26,6 +26,7 @@
#include <linux/clocksource.h>
#include <linux/clk.h>
#include <linux/io.h>
+#include <linux/of_address.h>
#include <linux/of_irq.h>
#include <asm/mach/time.h>
@@ -33,8 +34,6 @@
#include <asm/sched_clock.h>
#include "board.h"
-#include "clock.h"
-#include "iomap.h"
#define RTC_SECONDS 0x08
#define RTC_SHADOW_SECONDS 0x0c
@@ -52,8 +51,8 @@
#define TIMER_PTV 0x0
#define TIMER_PCR 0x4
-static void __iomem *timer_reg_base = IO_ADDRESS(TEGRA_TMR1_BASE);
-static void __iomem *rtc_base = IO_ADDRESS(TEGRA_RTC_BASE);
+static void __iomem *timer_reg_base;
+static void __iomem *rtc_base;
static struct timespec persistent_ts;
static u64 persistent_ms, last_persistent_ms;
@@ -164,6 +163,11 @@ static const struct of_device_id timer_match[] __initconst = {
{}
};
+static const struct of_device_id rtc_match[] __initconst = {
+ { .compatible = "nvidia,tegra20-rtc" },
+ {}
+};
+
static void __init tegra_init_timer(void)
{
struct device_node *np;
@@ -177,6 +181,12 @@ static void __init tegra_init_timer(void)
BUG();
}
+ timer_reg_base = of_iomap(np, 0);
+ if (!timer_reg_base) {
+ pr_err("Can't map timer registers");
+ BUG();
+ }
+
tegra_timer_irq.irq = irq_of_parse_and_map(np, 2);
if (tegra_timer_irq.irq <= 0) {
pr_err("Failed to map timer IRQ\n");
@@ -192,6 +202,20 @@ static void __init tegra_init_timer(void)
rate = clk_get_rate(clk);
}
+ of_node_put(np);
+
+ np = of_find_matching_node(NULL, rtc_match);
+ if (!np) {
+ pr_err("Failed to find RTC DT node\n");
+ BUG();
+ }
+
+ rtc_base = of_iomap(np, 0);
+ if (!rtc_base) {
+ pr_err("Can't map RTC registers");
+ BUG();
+ }
+
/*
* rtc registers are used by read_persistent_clock, keep the rtc clock
* enabled
--
1.7.0.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 3/3] ARM: tegra: move timer.c to drivers/clocksource/
2012-10-23 18:28 [PATCH 1/3] ARM: timer: fix checkpatch warnings Stephen Warren
2012-10-23 18:28 ` [PATCH 2/3] ARM: tegra: enhance timer.c to get IO address from device tree Stephen Warren
@ 2012-10-23 18:28 ` Stephen Warren
2012-10-29 17:06 ` [PATCH 1/3] ARM: timer: fix checkpatch warnings Stephen Warren
2 siblings, 0 replies; 4+ messages in thread
From: Stephen Warren @ 2012-10-23 18:28 UTC (permalink / raw)
To: linux-arm-kernel
From: Stephen Warren <swarren@nvidia.com>
Move arch/arm/mach-tegra/timer.c to drivers/clocksource/tegra20_timer.c
so that the code is co-located with other clocksource drivers, and to
reduce the size of the mach-tegra directory.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
arch/arm/mach-tegra/Makefile | 1 -
arch/arm/mach-tegra/board-dt-tegra20.c | 3 +-
arch/arm/mach-tegra/board-dt-tegra30.c | 3 +-
arch/arm/mach-tegra/board.h | 1 -
drivers/clocksource/Makefile | 1 +
.../timer.c => drivers/clocksource/tegra20_timer.c | 7 +----
include/linux/tegra20_timer.h | 24 ++++++++++++++++++++
7 files changed, 31 insertions(+), 9 deletions(-)
rename arch/arm/mach-tegra/timer.c => drivers/clocksource/tegra20_timer.c (98%)
create mode 100644 include/linux/tegra20_timer.h
diff --git a/arch/arm/mach-tegra/Makefile b/arch/arm/mach-tegra/Makefile
index 9aa653b..4a59038 100644
--- a/arch/arm/mach-tegra/Makefile
+++ b/arch/arm/mach-tegra/Makefile
@@ -2,7 +2,6 @@ obj-y += common.o
obj-y += io.o
obj-y += irq.o
obj-y += clock.o
-obj-y += timer.o
obj-y += fuse.o
obj-y += pmc.o
obj-y += flowctrl.o
diff --git a/arch/arm/mach-tegra/board-dt-tegra20.c b/arch/arm/mach-tegra/board-dt-tegra20.c
index 0419056..b66f7e7 100644
--- a/arch/arm/mach-tegra/board-dt-tegra20.c
+++ b/arch/arm/mach-tegra/board-dt-tegra20.c
@@ -33,6 +33,7 @@
#include <linux/i2c.h>
#include <linux/i2c-tegra.h>
#include <linux/usb/tegra_usb_phy.h>
+#include <linux/tegra20_timer.h>
#include <asm/hardware/gic.h>
#include <asm/mach-types.h>
@@ -184,7 +185,7 @@ DT_MACHINE_START(TEGRA_DT, "nVidia Tegra20 (Flattened Device Tree)")
.init_early = tegra20_init_early,
.init_irq = tegra_dt_init_irq,
.handle_irq = gic_handle_irq,
- .timer = &tegra_sys_timer,
+ .timer = &tegra20_sys_timer,
.init_machine = tegra_dt_init,
.init_late = tegra_dt_init_late,
.restart = tegra_assert_system_reset,
diff --git a/arch/arm/mach-tegra/board-dt-tegra30.c b/arch/arm/mach-tegra/board-dt-tegra30.c
index 7368ebd..a47d19e 100644
--- a/arch/arm/mach-tegra/board-dt-tegra30.c
+++ b/arch/arm/mach-tegra/board-dt-tegra30.c
@@ -29,6 +29,7 @@
#include <linux/of_fdt.h>
#include <linux/of_irq.h>
#include <linux/of_platform.h>
+#include <linux/tegra20_timer.h>
#include <asm/mach/arch.h>
#include <asm/hardware/gic.h>
@@ -92,7 +93,7 @@ DT_MACHINE_START(TEGRA30_DT, "NVIDIA Tegra30 (Flattened Device Tree)")
.init_early = tegra30_init_early,
.init_irq = tegra_dt_init_irq,
.handle_irq = gic_handle_irq,
- .timer = &tegra_sys_timer,
+ .timer = &tegra20_sys_timer,
.init_machine = tegra30_dt_init,
.init_late = tegra_init_late,
.restart = tegra_assert_system_reset,
diff --git a/arch/arm/mach-tegra/board.h b/arch/arm/mach-tegra/board.h
index 91fbe73..da8f5a3 100644
--- a/arch/arm/mach-tegra/board.h
+++ b/arch/arm/mach-tegra/board.h
@@ -55,5 +55,4 @@ static inline int harmony_pcie_init(void) { return 0; }
void __init tegra_paz00_wifikill_init(void);
-extern struct sys_timer tegra_sys_timer;
#endif
diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile
index 603be36..a09c598 100644
--- a/drivers/clocksource/Makefile
+++ b/drivers/clocksource/Makefile
@@ -14,5 +14,6 @@ obj-$(CONFIG_DW_APB_TIMER_OF) += dw_apb_timer_of.o
obj-$(CONFIG_CLKSRC_DBX500_PRCMU) += clksrc-dbx500-prcmu.o
obj-$(CONFIG_ARMADA_370_XP_TIMER) += time-armada-370-xp.o
obj-$(CONFIG_ARCH_BCM2835) += bcm2835_timer.o
+obj-$(CONFIG_ARCH_TEGRA) += tegra20_timer.o
obj-$(CONFIG_CLKSRC_ARM_GENERIC) += arm_generic.o
diff --git a/arch/arm/mach-tegra/timer.c b/drivers/clocksource/tegra20_timer.c
similarity index 98%
rename from arch/arm/mach-tegra/timer.c
rename to drivers/clocksource/tegra20_timer.c
index e4863f3..996ceb8 100644
--- a/arch/arm/mach-tegra/timer.c
+++ b/drivers/clocksource/tegra20_timer.c
@@ -1,6 +1,4 @@
/*
- * arch/arch/mach-tegra/timer.c
- *
* Copyright (C) 2010 Google, Inc.
*
* Author:
@@ -17,6 +15,7 @@
*
*/
+#include <linux/tegra20_timer.h>
#include <linux/init.h>
#include <linux/err.h>
#include <linux/time.h>
@@ -33,8 +32,6 @@
#include <asm/smp_twd.h>
#include <asm/sched_clock.h>
-#include "board.h"
-
#define RTC_SECONDS 0x08
#define RTC_SHADOW_SECONDS 0x0c
#define RTC_MILLISECONDS 0x10
@@ -273,7 +270,7 @@ static void __init tegra_init_timer(void)
register_persistent_clock(NULL, tegra_read_persistent_clock);
}
-struct sys_timer tegra_sys_timer = {
+struct sys_timer tegra20_sys_timer = {
.init = tegra_init_timer,
};
diff --git a/include/linux/tegra20_timer.h b/include/linux/tegra20_timer.h
new file mode 100644
index 0000000..aa9b9c4
--- /dev/null
+++ b/include/linux/tegra20_timer.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __TEGRA20_TIMER_H
+#define __TEGRA20_TIMER_H
+
+#include <asm/mach/time.h>
+
+extern struct sys_timer tegra20_sys_timer;
+
+#endif
--
1.7.0.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 1/3] ARM: timer: fix checkpatch warnings
2012-10-23 18:28 [PATCH 1/3] ARM: timer: fix checkpatch warnings Stephen Warren
2012-10-23 18:28 ` [PATCH 2/3] ARM: tegra: enhance timer.c to get IO address from device tree Stephen Warren
2012-10-23 18:28 ` [PATCH 3/3] ARM: tegra: move timer.c to drivers/clocksource/ Stephen Warren
@ 2012-10-29 17:06 ` Stephen Warren
2 siblings, 0 replies; 4+ messages in thread
From: Stephen Warren @ 2012-10-29 17:06 UTC (permalink / raw)
To: linux-arm-kernel
On 10/23/2012 12:28 PM, Stephen Warren wrote:
> This prevents checkpatch complaining when this file is moved in a later
> patch.
I have applied patches 1 and 2 to Tegra's tree for 3.8. I'll hold off on
patch 3 for a bit. I need to see if it could benefit from similar rework
that drivers/irqchip recently received from Thomas Petazzoni.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-10-29 17:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-23 18:28 [PATCH 1/3] ARM: timer: fix checkpatch warnings Stephen Warren
2012-10-23 18:28 ` [PATCH 2/3] ARM: tegra: enhance timer.c to get IO address from device tree Stephen Warren
2012-10-23 18:28 ` [PATCH 3/3] ARM: tegra: move timer.c to drivers/clocksource/ Stephen Warren
2012-10-29 17:06 ` [PATCH 1/3] ARM: timer: fix checkpatch warnings Stephen Warren
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).