Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 342399
b: refs/heads/master
c: 3a04931
h: refs/heads/master
i:
  342397: ace977d
  342395: b643c54
  342391: e5deb38
  342383: 0836e99
  342367: 70361ac
  342335: 28bee2b
  342271: 70e9c8a
v: v3
  • Loading branch information
Stephen Warren committed Nov 16, 2012
1 parent 9d70d2d commit 40c8d4b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 56415480e90a6ba31e9fdda2cc860c3fcaa80acc
refs/heads/master: 3a04931e3b6230926ebe200192545a8d952d787d
32 changes: 28 additions & 4 deletions trunk/arch/arm/mach-tegra/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,14 @@
#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>
#include <asm/smp_twd.h>
#include <asm/sched_clock.h>

#include "board.h"
#include "clock.h"
#include "iomap.h"

#define RTC_SECONDS 0x08
#define RTC_SHADOW_SECONDS 0x0c
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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");
Expand All @@ -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
Expand Down

0 comments on commit 40c8d4b

Please sign in to comment.