aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-tegra
diff options
context:
space:
mode:
authorStephen Warren <swarren@nvidia.com>2013-08-20 17:47:38 -0400
committerStephen Warren <swarren@nvidia.com>2013-09-17 15:44:21 -0400
commit51100bdc067706624f0ffe285e63a6099336e11a (patch)
treef70ecaf8beced713834dc492badea9ae2384b7ec /arch/arm/mach-tegra
parentd2207071b3c74b144a860cbe6a46496a44963972 (diff)
ARM: tegra: remove common.c
common.c was create to contain code shared across the various Tegra board files. There is now only one board file, tegra.c. So, move the code there. One exception is the PMC reboot routine, which moves to pmc.c, and now takes advantage of the 'standard' tegra_pmc_readl/writel functions. Signed-off-by: Stephen Warren <swarren@nvidia.com>
Diffstat (limited to 'arch/arm/mach-tegra')
-rw-r--r--arch/arm/mach-tegra/Makefile1
-rw-r--r--arch/arm/mach-tegra/board.h6
-rw-r--r--arch/arm/mach-tegra/common.c113
-rw-r--r--arch/arm/mach-tegra/pmc.c9
-rw-r--r--arch/arm/mach-tegra/pmc.h4
-rw-r--r--arch/arm/mach-tegra/tegra.c67
6 files changed, 78 insertions, 122 deletions
diff --git a/arch/arm/mach-tegra/Makefile b/arch/arm/mach-tegra/Makefile
index e7e5f45c6558..97eb48e977e5 100644
--- a/arch/arm/mach-tegra/Makefile
+++ b/arch/arm/mach-tegra/Makefile
@@ -1,6 +1,5 @@
1asflags-y += -march=armv7-a 1asflags-y += -march=armv7-a
2 2
3obj-y += common.o
4obj-y += io.o 3obj-y += io.o
5obj-y += irq.o 4obj-y += irq.o
6obj-y += fuse.o 5obj-y += fuse.o
diff --git a/arch/arm/mach-tegra/board.h b/arch/arm/mach-tegra/board.h
index db6810dc0b3d..7b9a5bddc0be 100644
--- a/arch/arm/mach-tegra/board.h
+++ b/arch/arm/mach-tegra/board.h
@@ -25,14 +25,8 @@
25#include <linux/types.h> 25#include <linux/types.h>
26#include <linux/reboot.h> 26#include <linux/reboot.h>
27 27
28void tegra_assert_system_reset(enum reboot_mode mode, const char *cmd);
29
30void __init tegra_init_early(void);
31void __init tegra_map_common_io(void); 28void __init tegra_map_common_io(void);
32void __init tegra_init_irq(void); 29void __init tegra_init_irq(void);
33void __init tegra_dt_init_irq(void);
34
35void tegra_init_late(void);
36 30
37#ifdef CONFIG_DEBUG_FS 31#ifdef CONFIG_DEBUG_FS
38int tegra_clk_debugfs_init(void); 32int tegra_clk_debugfs_init(void);
diff --git a/arch/arm/mach-tegra/common.c b/arch/arm/mach-tegra/common.c
deleted file mode 100644
index 58dc91c56ccb..000000000000
--- a/arch/arm/mach-tegra/common.c
+++ /dev/null
@@ -1,113 +0,0 @@
1/*
2 * arch/arm/mach-tegra/common.c
3 *
4 * Copyright (c) 2013 NVIDIA Corporation. All rights reserved.
5 * Copyright (C) 2010 Google, Inc.
6 *
7 * Author:
8 * Colin Cross <ccross@android.com>
9 *
10 * This software is licensed under the terms of the GNU General Public
11 * License version 2, as published by the Free Software Foundation, and
12 * may be copied, distributed, and modified under those terms.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 */
20
21#include <linux/init.h>
22#include <linux/io.h>
23#include <linux/clk.h>
24#include <linux/delay.h>
25#include <linux/reboot.h>
26#include <linux/irqchip.h>
27
28#include <asm/hardware/cache-l2x0.h>
29
30#include "board.h"
31#include "common.h"
32#include "cpuidle.h"
33#include "fuse.h"
34#include "iomap.h"
35#include "irq.h"
36#include "pmc.h"
37#include "apbio.h"
38#include "sleep.h"
39#include "pm.h"
40#include "reset.h"
41
42/*
43 * Storage for debug-macro.S's state.
44 *
45 * This must be in .data not .bss so that it gets initialized each time the
46 * kernel is loaded. The data is declared here rather than debug-macro.S so
47 * that multiple inclusions of debug-macro.S point at the same data.
48 */
49u32 tegra_uart_config[4] = {
50 /* Debug UART initialization required */
51 1,
52 /* Debug UART physical address */
53 0,
54 /* Debug UART virtual address */
55 0,
56 /* Scratch space for debug macro */
57 0,
58};
59
60#ifdef CONFIG_OF
61void __init tegra_dt_init_irq(void)
62{
63 tegra_pmc_init_irq();
64 tegra_init_irq();
65 irqchip_init();
66 tegra_legacy_irq_syscore_init();
67}
68#endif
69
70void tegra_assert_system_reset(enum reboot_mode mode, const char *cmd)
71{
72 void __iomem *reset = IO_ADDRESS(TEGRA_PMC_BASE + 0);
73 u32 reg;
74
75 reg = readl_relaxed(reset);
76 reg |= 0x10;
77 writel_relaxed(reg, reset);
78}
79
80static void __init tegra_init_cache(void)
81{
82#ifdef CONFIG_CACHE_L2X0
83 int ret;
84 void __iomem *p = IO_ADDRESS(TEGRA_ARM_PERIF_BASE) + 0x3000;
85 u32 aux_ctrl, cache_type;
86
87 cache_type = readl(p + L2X0_CACHE_TYPE);
88 aux_ctrl = (cache_type & 0x700) << (17-8);
89 aux_ctrl |= 0x7C400001;
90
91 ret = l2x0_of_init(aux_ctrl, 0x8200c3fe);
92 if (!ret)
93 l2x0_saved_regs_addr = virt_to_phys(&l2x0_saved_regs);
94#endif
95
96}
97
98void __init tegra_init_early(void)
99{
100 tegra_cpu_reset_handler_init();
101 tegra_apb_io_init();
102 tegra_init_fuse();
103 tegra_init_cache();
104 tegra_powergate_init();
105 tegra_hotplug_init();
106}
107
108void __init tegra_init_late(void)
109{
110 tegra_init_suspend();
111 tegra_cpuidle_init();
112 tegra_powergate_debugfs_init();
113}
diff --git a/arch/arm/mach-tegra/pmc.c b/arch/arm/mach-tegra/pmc.c
index 7916ff91f969..93a4dbcde27e 100644
--- a/arch/arm/mach-tegra/pmc.c
+++ b/arch/arm/mach-tegra/pmc.c
@@ -166,6 +166,15 @@ int tegra_pmc_cpu_remove_clamping(int cpuid)
166 return tegra_pmc_powergate_remove_clamping(id); 166 return tegra_pmc_powergate_remove_clamping(id);
167} 167}
168 168
169void tegra_pmc_restart(enum reboot_mode mode, const char *cmd)
170{
171 u32 val;
172
173 val = tegra_pmc_readl(0);
174 val |= 0x10;
175 tegra_pmc_writel(val, 0);
176}
177
169#ifdef CONFIG_PM_SLEEP 178#ifdef CONFIG_PM_SLEEP
170static void set_power_timers(u32 us_on, u32 us_off, unsigned long rate) 179static void set_power_timers(u32 us_on, u32 us_off, unsigned long rate)
171{ 180{
diff --git a/arch/arm/mach-tegra/pmc.h b/arch/arm/mach-tegra/pmc.h
index 4d5f8f32225c..59e19c344298 100644
--- a/arch/arm/mach-tegra/pmc.h
+++ b/arch/arm/mach-tegra/pmc.h
@@ -18,6 +18,8 @@
18#ifndef __MACH_TEGRA_PMC_H 18#ifndef __MACH_TEGRA_PMC_H
19#define __MACH_TEGRA_PMC_H 19#define __MACH_TEGRA_PMC_H
20 20
21#include <linux/reboot.h>
22
21enum tegra_suspend_mode { 23enum tegra_suspend_mode {
22 TEGRA_SUSPEND_NONE = 0, 24 TEGRA_SUSPEND_NONE = 0,
23 TEGRA_SUSPEND_LP2, /* CPU voltage off */ 25 TEGRA_SUSPEND_LP2, /* CPU voltage off */
@@ -39,6 +41,8 @@ bool tegra_pmc_cpu_is_powered(int cpuid);
39int tegra_pmc_cpu_power_on(int cpuid); 41int tegra_pmc_cpu_power_on(int cpuid);
40int tegra_pmc_cpu_remove_clamping(int cpuid); 42int tegra_pmc_cpu_remove_clamping(int cpuid);
41 43
44void tegra_pmc_restart(enum reboot_mode mode, const char *cmd);
45
42void tegra_pmc_init_irq(void); 46void tegra_pmc_init_irq(void);
43void tegra_pmc_init(void); 47void tegra_pmc_init(void);
44 48
diff --git a/arch/arm/mach-tegra/tegra.c b/arch/arm/mach-tegra/tegra.c
index 4da271df2e6c..40b031c42299 100644
--- a/arch/arm/mach-tegra/tegra.c
+++ b/arch/arm/mach-tegra/tegra.c
@@ -35,17 +35,78 @@
35#include <linux/usb/tegra_usb_phy.h> 35#include <linux/usb/tegra_usb_phy.h>
36#include <linux/clk-provider.h> 36#include <linux/clk-provider.h>
37#include <linux/clk/tegra.h> 37#include <linux/clk/tegra.h>
38#include <linux/irqchip.h>
38 39
40#include <asm/hardware/cache-l2x0.h>
39#include <asm/mach-types.h> 41#include <asm/mach-types.h>
40#include <asm/mach/arch.h> 42#include <asm/mach/arch.h>
41#include <asm/mach/time.h> 43#include <asm/mach/time.h>
42#include <asm/setup.h> 44#include <asm/setup.h>
43 45
46#include "apbio.h"
44#include "board.h" 47#include "board.h"
45#include "common.h" 48#include "common.h"
49#include "cpuidle.h"
46#include "fuse.h" 50#include "fuse.h"
47#include "iomap.h" 51#include "iomap.h"
52#include "irq.h"
48#include "pmc.h" 53#include "pmc.h"
54#include "pm.h"
55#include "reset.h"
56#include "sleep.h"
57
58/*
59 * Storage for debug-macro.S's state.
60 *
61 * This must be in .data not .bss so that it gets initialized each time the
62 * kernel is loaded. The data is declared here rather than debug-macro.S so
63 * that multiple inclusions of debug-macro.S point at the same data.
64 */
65u32 tegra_uart_config[4] = {
66 /* Debug UART initialization required */
67 1,
68 /* Debug UART physical address */
69 0,
70 /* Debug UART virtual address */
71 0,
72 /* Scratch space for debug macro */
73 0,
74};
75
76static void __init tegra_init_cache(void)
77{
78#ifdef CONFIG_CACHE_L2X0
79 int ret;
80 void __iomem *p = IO_ADDRESS(TEGRA_ARM_PERIF_BASE) + 0x3000;
81 u32 aux_ctrl, cache_type;
82
83 cache_type = readl(p + L2X0_CACHE_TYPE);
84 aux_ctrl = (cache_type & 0x700) << (17-8);
85 aux_ctrl |= 0x7C400001;
86
87 ret = l2x0_of_init(aux_ctrl, 0x8200c3fe);
88 if (!ret)
89 l2x0_saved_regs_addr = virt_to_phys(&l2x0_saved_regs);
90#endif
91}
92
93static void __init tegra_init_early(void)
94{
95 tegra_cpu_reset_handler_init();
96 tegra_apb_io_init();
97 tegra_init_fuse();
98 tegra_init_cache();
99 tegra_powergate_init();
100 tegra_hotplug_init();
101}
102
103static void __init tegra_dt_init_irq(void)
104{
105 tegra_pmc_init_irq();
106 tegra_init_irq();
107 irqchip_init();
108 tegra_legacy_irq_syscore_init();
109}
49 110
50static void __init tegra_dt_init(void) 111static void __init tegra_dt_init(void)
51{ 112{
@@ -107,7 +168,9 @@ static void __init tegra_dt_init_late(void)
107{ 168{
108 int i; 169 int i;
109 170
110 tegra_init_late(); 171 tegra_init_suspend();
172 tegra_cpuidle_init();
173 tegra_powergate_debugfs_init();
111 174
112 for (i = 0; i < ARRAY_SIZE(board_init_funcs); i++) { 175 for (i = 0; i < ARRAY_SIZE(board_init_funcs); i++) {
113 if (of_machine_is_compatible(board_init_funcs[i].machine)) { 176 if (of_machine_is_compatible(board_init_funcs[i].machine)) {
@@ -132,6 +195,6 @@ DT_MACHINE_START(TEGRA_DT, "NVIDIA Tegra SoC (Flattened Device Tree)")
132 .init_time = tegra_dt_init_time, 195 .init_time = tegra_dt_init_time,
133 .init_machine = tegra_dt_init, 196 .init_machine = tegra_dt_init,
134 .init_late = tegra_dt_init_late, 197 .init_late = tegra_dt_init_late,
135 .restart = tegra_assert_system_reset, 198 .restart = tegra_pmc_restart,
136 .dt_compat = tegra_dt_board_compat, 199 .dt_compat = tegra_dt_board_compat,
137MACHINE_END 200MACHINE_END