aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-tegra/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-tegra/common.c')
-rw-r--r--arch/arm/mach-tegra/common.c55
1 files changed, 42 insertions, 13 deletions
diff --git a/arch/arm/mach-tegra/common.c b/arch/arm/mach-tegra/common.c
index 690b888be506..72b666bd3043 100644
--- a/arch/arm/mach-tegra/common.c
+++ b/arch/arm/mach-tegra/common.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * arch/arm/mach-tegra/board-harmony.c 2 * arch/arm/mach-tegra/common.c
3 * 3 *
4 * Copyright (C) 2010 Google, Inc. 4 * Copyright (C) 2010 Google, Inc.
5 * 5 *
@@ -21,8 +21,10 @@
21#include <linux/io.h> 21#include <linux/io.h>
22#include <linux/clk.h> 22#include <linux/clk.h>
23#include <linux/delay.h> 23#include <linux/delay.h>
24#include <linux/of_irq.h>
24 25
25#include <asm/hardware/cache-l2x0.h> 26#include <asm/hardware/cache-l2x0.h>
27#include <asm/hardware/gic.h>
26 28
27#include <mach/iomap.h> 29#include <mach/iomap.h>
28#include <mach/system.h> 30#include <mach/system.h>
@@ -33,18 +35,31 @@
33 35
34void (*arch_reset)(char mode, const char *cmd) = tegra_assert_system_reset; 36void (*arch_reset)(char mode, const char *cmd) = tegra_assert_system_reset;
35 37
38#ifdef CONFIG_OF
39static const struct of_device_id tegra_dt_irq_match[] __initconst = {
40 { .compatible = "arm,cortex-a9-gic", .data = gic_of_init },
41 { }
42};
43
44void __init tegra_dt_init_irq(void)
45{
46 tegra_init_irq();
47 of_irq_init(tegra_dt_irq_match);
48}
49#endif
50
36void tegra_assert_system_reset(char mode, const char *cmd) 51void tegra_assert_system_reset(char mode, const char *cmd)
37{ 52{
38 void __iomem *reset = IO_ADDRESS(TEGRA_CLK_RESET_BASE + 0x04); 53 void __iomem *reset = IO_ADDRESS(TEGRA_PMC_BASE + 0);
39 u32 reg; 54 u32 reg;
40 55
41 /* use *_related to avoid spinlock since caches are off */
42 reg = readl_relaxed(reset); 56 reg = readl_relaxed(reset);
43 reg |= 0x04; 57 reg |= 0x10;
44 writel_relaxed(reg, reset); 58 writel_relaxed(reg, reset);
45} 59}
46 60
47static __initdata struct tegra_clk_init_table common_clk_init_table[] = { 61#ifdef CONFIG_ARCH_TEGRA_2x_SOC
62static __initdata struct tegra_clk_init_table tegra20_clk_init_table[] = {
48 /* name parent rate enabled */ 63 /* name parent rate enabled */
49 { "clk_m", NULL, 0, true }, 64 { "clk_m", NULL, 0, true },
50 { "pll_p", "clk_m", 216000000, true }, 65 { "pll_p", "clk_m", 216000000, true },
@@ -60,24 +75,38 @@ static __initdata struct tegra_clk_init_table common_clk_init_table[] = {
60 { "cpu", NULL, 0, true }, 75 { "cpu", NULL, 0, true },
61 { NULL, NULL, 0, 0}, 76 { NULL, NULL, 0, 0},
62}; 77};
78#endif
63 79
64static void __init tegra_init_cache(void) 80static void __init tegra_init_cache(u32 tag_latency, u32 data_latency)
65{ 81{
66#ifdef CONFIG_CACHE_L2X0 82#ifdef CONFIG_CACHE_L2X0
67 void __iomem *p = IO_ADDRESS(TEGRA_ARM_PERIF_BASE) + 0x3000; 83 void __iomem *p = IO_ADDRESS(TEGRA_ARM_PERIF_BASE) + 0x3000;
84 u32 aux_ctrl, cache_type;
85
86 writel_relaxed(tag_latency, p + L2X0_TAG_LATENCY_CTRL);
87 writel_relaxed(data_latency, p + L2X0_DATA_LATENCY_CTRL);
68 88
69 writel_relaxed(0x331, p + L2X0_TAG_LATENCY_CTRL); 89 cache_type = readl(p + L2X0_CACHE_TYPE);
70 writel_relaxed(0x441, p + L2X0_DATA_LATENCY_CTRL); 90 aux_ctrl = (cache_type & 0x700) << (17-8);
91 aux_ctrl |= 0x6C000001;
71 92
72 l2x0_init(p, 0x6C080001, 0x8200c3fe); 93 l2x0_init(p, aux_ctrl, 0x8200c3fe);
73#endif 94#endif
74 95
75} 96}
76 97
77void __init tegra_init_early(void) 98#ifdef CONFIG_ARCH_TEGRA_2x_SOC
99void __init tegra20_init_early(void)
78{ 100{
79 tegra_init_fuse(); 101 tegra_init_fuse();
80 tegra_init_clock(); 102 tegra2_init_clocks();
81 tegra_clk_init_from_table(common_clk_init_table); 103 tegra_clk_init_from_table(tegra20_clk_init_table);
82 tegra_init_cache(); 104 tegra_init_cache(0x331, 0x441);
105}
106#endif
107#ifdef CONFIG_ARCH_TEGRA_3x_SOC
108void __init tegra30_init_early(void)
109{
110 tegra_init_cache(0x441, 0x551);
83} 111}
112#endif