aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-tegra
diff options
context:
space:
mode:
authorJoseph Lo <josephl@nvidia.com>2013-05-20 06:39:24 -0400
committerStephen Warren <swarren@nvidia.com>2013-05-22 17:19:21 -0400
commit4b3e2edacf4344cdf7863b6fae64ccb8b02fe9f5 (patch)
tree27d0a82998abce335dd155cbcc3ac1b6195349df /arch/arm/mach-tegra
parentb39f38c4d27f04fbc3ee8ce9a5fb04673047d5a0 (diff)
ARM: tegra: add an assembly marco to check Tegra SoC ID
There are some Tegra SoC ID checking code around the low level assembly code. Adding a marco to replace them. For the single image to support all the Tegra series, we may also need the marco in other common code. So we make it become a marco for the usage. Signed-off-by: Joseph Lo <josephl@nvidia.com> Signed-off-by: Stephen Warren <swarren@nvidia.com>
Diffstat (limited to 'arch/arm/mach-tegra')
-rw-r--r--arch/arm/mach-tegra/fuse.h22
-rw-r--r--arch/arm/mach-tegra/reset-handler.S25
-rw-r--r--arch/arm/mach-tegra/sleep.h9
3 files changed, 30 insertions, 26 deletions
diff --git a/arch/arm/mach-tegra/fuse.h b/arch/arm/mach-tegra/fuse.h
index aacc00d05980..def79683bef6 100644
--- a/arch/arm/mach-tegra/fuse.h
+++ b/arch/arm/mach-tegra/fuse.h
@@ -19,16 +19,6 @@
19#ifndef __MACH_TEGRA_FUSE_H 19#ifndef __MACH_TEGRA_FUSE_H
20#define __MACH_TEGRA_FUSE_H 20#define __MACH_TEGRA_FUSE_H
21 21
22enum tegra_revision {
23 TEGRA_REVISION_UNKNOWN = 0,
24 TEGRA_REVISION_A01,
25 TEGRA_REVISION_A02,
26 TEGRA_REVISION_A03,
27 TEGRA_REVISION_A03p,
28 TEGRA_REVISION_A04,
29 TEGRA_REVISION_MAX,
30};
31
32#define SKU_ID_T20 8 22#define SKU_ID_T20 8
33#define SKU_ID_T25SE 20 23#define SKU_ID_T25SE 20
34#define SKU_ID_AP25 23 24#define SKU_ID_AP25 23
@@ -40,6 +30,17 @@ enum tegra_revision {
40#define TEGRA30 0x30 30#define TEGRA30 0x30
41#define TEGRA114 0x35 31#define TEGRA114 0x35
42 32
33#ifndef __ASSEMBLY__
34enum tegra_revision {
35 TEGRA_REVISION_UNKNOWN = 0,
36 TEGRA_REVISION_A01,
37 TEGRA_REVISION_A02,
38 TEGRA_REVISION_A03,
39 TEGRA_REVISION_A03p,
40 TEGRA_REVISION_A04,
41 TEGRA_REVISION_MAX,
42};
43
43extern int tegra_sku_id; 44extern int tegra_sku_id;
44extern int tegra_cpu_process_id; 45extern int tegra_cpu_process_id;
45extern int tegra_core_process_id; 46extern int tegra_core_process_id;
@@ -72,5 +73,6 @@ void tegra114_init_speedo_data(void);
72#else 73#else
73static inline void tegra114_init_speedo_data(void) {} 74static inline void tegra114_init_speedo_data(void) {}
74#endif 75#endif
76#endif /* __ASSEMBLY__ */
75 77
76#endif 78#endif
diff --git a/arch/arm/mach-tegra/reset-handler.S b/arch/arm/mach-tegra/reset-handler.S
index e6de88a2ea06..40af405b0465 100644
--- a/arch/arm/mach-tegra/reset-handler.S
+++ b/arch/arm/mach-tegra/reset-handler.S
@@ -22,11 +22,11 @@
22#include <asm/hardware/cache-l2x0.h> 22#include <asm/hardware/cache-l2x0.h>
23 23
24#include "flowctrl.h" 24#include "flowctrl.h"
25#include "fuse.h"
25#include "iomap.h" 26#include "iomap.h"
26#include "reset.h" 27#include "reset.h"
27#include "sleep.h" 28#include "sleep.h"
28 29
29#define APB_MISC_GP_HIDREV 0x804
30#define PMC_SCRATCH41 0x140 30#define PMC_SCRATCH41 0x140
31 31
32#define RESET_DATA(x) ((TEGRA_RESET_##x)*4) 32#define RESET_DATA(x) ((TEGRA_RESET_##x)*4)
@@ -49,10 +49,8 @@ ENTRY(tegra_resume)
49 49
50#ifdef CONFIG_ARCH_TEGRA_3x_SOC 50#ifdef CONFIG_ARCH_TEGRA_3x_SOC
51 /* Are we on Tegra20? */ 51 /* Are we on Tegra20? */
52 mov32 r6, TEGRA_APB_MISC_BASE 52 tegra_get_soc_id TEGRA_APB_MISC_BASE, r6
53 ldr r0, [r6, #APB_MISC_GP_HIDREV] 53 cmp r6, #TEGRA20
54 and r0, r0, #0xff00
55 cmp r0, #(0x20 << 8)
56 beq 1f @ Yes 54 beq 1f @ Yes
57 /* Clear the flow controller flags for this CPU. */ 55 /* Clear the flow controller flags for this CPU. */
58 mov32 r2, TEGRA_FLOW_CTRL_BASE + FLOW_CTRL_CPU0_CSR @ CPU0 CSR 56 mov32 r2, TEGRA_FLOW_CTRL_BASE + FLOW_CTRL_CPU0_CSR @ CPU0 CSR
@@ -98,7 +96,7 @@ ENTRY(__tegra_cpu_reset_handler_start)
98 * Register usage within the reset handler: 96 * Register usage within the reset handler:
99 * 97 *
100 * Others: scratch 98 * Others: scratch
101 * R6 = SoC ID << 8 99 * R6 = SoC ID
102 * R7 = CPU present (to the OS) mask 100 * R7 = CPU present (to the OS) mask
103 * R8 = CPU in LP1 state mask 101 * R8 = CPU in LP1 state mask
104 * R9 = CPU in LP2 state mask 102 * R9 = CPU in LP2 state mask
@@ -115,12 +113,10 @@ ENTRY(__tegra_cpu_reset_handler)
115 113
116 cpsid aif, 0x13 @ SVC mode, interrupts disabled 114 cpsid aif, 0x13 @ SVC mode, interrupts disabled
117 115
118 mov32 r6, TEGRA_APB_MISC_BASE 116 tegra_get_soc_id TEGRA_APB_MISC_BASE, r6
119 ldr r6, [r6, #APB_MISC_GP_HIDREV]
120 and r6, r6, #0xff00
121#ifdef CONFIG_ARCH_TEGRA_2x_SOC 117#ifdef CONFIG_ARCH_TEGRA_2x_SOC
122t20_check: 118t20_check:
123 cmp r6, #(0x20 << 8) 119 cmp r6, #TEGRA20
124 bne after_t20_check 120 bne after_t20_check
125t20_errata: 121t20_errata:
126 # Tegra20 is a Cortex-A9 r1p1 122 # Tegra20 is a Cortex-A9 r1p1
@@ -136,7 +132,7 @@ after_t20_check:
136#endif 132#endif
137#ifdef CONFIG_ARCH_TEGRA_3x_SOC 133#ifdef CONFIG_ARCH_TEGRA_3x_SOC
138t30_check: 134t30_check:
139 cmp r6, #(0x30 << 8) 135 cmp r6, #TEGRA30
140 bne after_t30_check 136 bne after_t30_check
141t30_errata: 137t30_errata:
142 # Tegra30 is a Cortex-A9 r2p9 138 # Tegra30 is a Cortex-A9 r2p9
@@ -163,7 +159,7 @@ after_errata:
163 159
164#ifdef CONFIG_ARCH_TEGRA_2x_SOC 160#ifdef CONFIG_ARCH_TEGRA_2x_SOC
165 /* Are we on Tegra20? */ 161 /* Are we on Tegra20? */
166 cmp r6, #(0x20 << 8) 162 cmp r6, #TEGRA20
167 bne 1f 163 bne 1f
168 /* If not CPU0, don't let CPU0 reset CPU1 now that CPU1 is coming up. */ 164 /* If not CPU0, don't let CPU0 reset CPU1 now that CPU1 is coming up. */
169 mov32 r5, TEGRA_PMC_BASE 165 mov32 r5, TEGRA_PMC_BASE
@@ -210,10 +206,7 @@ __die:
210 mov32 r7, TEGRA_CLK_RESET_BASE 206 mov32 r7, TEGRA_CLK_RESET_BASE
211 207
212 /* Are we on Tegra20? */ 208 /* Are we on Tegra20? */
213 mov32 r6, TEGRA_APB_MISC_BASE 209 cmp r6, #TEGRA20
214 ldr r0, [r6, #APB_MISC_GP_HIDREV]
215 and r0, r0, #0xff00
216 cmp r0, #(0x20 << 8)
217 bne 1f 210 bne 1f
218 211
219#ifdef CONFIG_ARCH_TEGRA_2x_SOC 212#ifdef CONFIG_ARCH_TEGRA_2x_SOC
diff --git a/arch/arm/mach-tegra/sleep.h b/arch/arm/mach-tegra/sleep.h
index 2080fb12ce26..f9f2164a2fc7 100644
--- a/arch/arm/mach-tegra/sleep.h
+++ b/arch/arm/mach-tegra/sleep.h
@@ -85,6 +85,15 @@
85 dsb 85 dsb
86.endm 86.endm
87 87
88/* Macro to check Tegra revision */
89#define APB_MISC_GP_HIDREV 0x804
90.macro tegra_get_soc_id base, tmp1
91 mov32 \tmp1, \base
92 ldr \tmp1, [\tmp1, #APB_MISC_GP_HIDREV]
93 and \tmp1, \tmp1, #0xff00
94 mov \tmp1, \tmp1, lsr #8
95.endm
96
88/* Macro to resume & re-enable L2 cache */ 97/* Macro to resume & re-enable L2 cache */
89#ifndef L2X0_CTRL_EN 98#ifndef L2X0_CTRL_EN
90#define L2X0_CTRL_EN 1 99#define L2X0_CTRL_EN 1