]> nv-tegra.nvidia Code Review - linux-3.10.git/blob - arch/arm/mach-tegra/mcerr.h
ARM: tegra: bonaire: Lower UART clock for only QT
[linux-3.10.git] / arch / arm / mach-tegra / mcerr.h
1 /*
2  * arch/arm/mach-tegra/mcerr.h
3  *
4  * MC error interrupt handling header file. Various defines and declarations
5  * across T20, T30, and T11x.
6  *
7  * Copyright (c) 2010-2012, NVIDIA Corporation. All rights reserved.
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful, but WITHOUT
15  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
17  * more details.
18  *
19  * You should have received a copy of the GNU General Public License along
20  * with this program; if not, write to the Free Software Foundation, Inc.,
21  * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
22  */
23
24 #ifndef __MCERR_H
25 #define __MCERR_H
26
27 #include <linux/kernel.h>
28 #include <linux/debugfs.h>
29 #include <linux/spinlock.h>
30
31 /* Pull in chip specific EMC header. */
32 #if defined(CONFIG_ARCH_TEGRA_3x_SOC)
33 #include "tegra3_emc.h"
34 #define MC_LATENCY_ALLOWANCE_BASE       MC_LATENCY_ALLOWANCE_AFI
35 #elif defined(CONFIG_ARCH_TEGRA_11x_SOC)
36 #include "tegra11_emc.h"
37 #define MC_LATENCY_ALLOWANCE_BASE       MC_LATENCY_ALLOWANCE_AVPC_0
38 #elif defined(CONFIG_ARCH_TEGRA_14x_SOC)
39 #include "tegra14_emc.h"
40 #define MC_LATENCY_ALLOWANCE_BASE       MC_LATENCY_ALLOWANCE_AVPC_0
41 #elif defined(CONFIG_ARCH_TEGRA_12x_SOC)
42 #include "tegra3_emc.h"
43 #define MC_LATENCY_ALLOWANCE_BASE       MC_LATENCY_ALLOWANCE_AFI
44 #endif
45
46 #define MAX_PRINTS                      6
47
48 #define MC_INT_STATUS                   0x0
49 #define MC_INT_MASK                     0x4
50 #define MC_ERROR_STATUS                 0x8
51 #define MC_ERROR_ADDRESS                0xC
52 #define MC_ERR_VPR_STATUS               0x654
53 #define MC_ERR_VPR_ADR                  0x658
54 #define MC_ERR_SEC_STATUS               0x67c
55 #define MC_ERR_SEC_ADR                  0x680
56
57 #define MC_INT_EXT_INTR_IN                      (1<<1)
58 #define MC_INT_DECERR_EMEM                      (1<<6)
59 #define MC_INT_SECURITY_VIOLATION               (1<<8)
60 #define MC_INT_ARBITRATION_EMEM                 (1<<9)
61 #define MC_INT_INVALID_SMMU_PAGE                (1<<10)
62 #define MC_INT_DECERR_VPR                       (1<<12)
63 #define MC_INT_SECERR_SEC                       (1<<13)
64 #define MC_INT_BBC_PRIVATE_MEM_VIOLATION        (1<<14)
65 #define MC_INT_DECERR_BBC                       (1<<15)
66
67 /*
68  * Number of unique interrupts we have for this chip.
69  */
70 #if defined(CONFIG_ARCH_TEGRA_11x_SOC)
71 #define INTR_COUNT      6
72 #elif defined(CONFIG_ARCH_TEGRA_14x_SOC)
73 #define INTR_COUNT      8
74 #else
75 #define INTR_COUNT      4
76 #endif
77
78 #define MC_ERR_DECERR_EMEM              (2)
79 #define MC_ERR_SECURITY_TRUSTZONE       (3)
80 #define MC_ERR_SECURITY_CARVEOUT        (4)
81 #define MC_ERR_INVALID_SMMU_PAGE        (6)
82
83 #if defined(CONFIG_ARCH_TEGRA_3x_SOC)
84 #define _MC_INT_EN_MASK (MC_INT_DECERR_EMEM |           \
85                          MC_INT_SECURITY_VIOLATION |    \
86                          MC_INT_INVALID_SMMU_PAGE)
87 #elif defined(CONFIG_ARCH_TEGRA_11x_SOC)
88 #define MC_DUAL_CHANNEL
89 #define _MC_INT_EN_MASK (MC_INT_EXT_INTR_IN |           \
90                          MC_INT_DECERR_EMEM |           \
91                          MC_INT_SECURITY_VIOLATION |    \
92                          MC_INT_INVALID_SMMU_PAGE |     \
93                          MC_INT_DECERR_VPR |            \
94                          MC_INT_SECERR_SEC)
95 #elif defined(CONFIG_ARCH_TEGRA_14x_SOC)
96 #define _MC_INT_EN_MASK (MC_INT_DECERR_EMEM |                   \
97                          MC_INT_SECURITY_VIOLATION |            \
98                          MC_INT_INVALID_SMMU_PAGE |             \
99                          MC_INT_DECERR_VPR |                    \
100                          MC_INT_SECERR_SEC |                    \
101                          MC_INT_BBC_PRIVATE_MEM_VIOLATION |     \
102                          MC_INT_DECERR_BBC)
103 #elif defined(CONFIG_ARCH_TEGRA_12x_SOC)
104 #define _MC_INT_EN_MASK (MC_INT_DECERR_EMEM |           \
105                          MC_INT_SECURITY_VIOLATION |    \
106                          MC_INT_ARBITRATION_EMEM |      \
107                          MC_INT_INVALID_SMMU_PAGE |     \
108                          MC_INT_DECERR_VPR |            \
109                          MC_INT_SECERR_SEC)
110 #endif
111
112 #ifdef CONFIG_TEGRA_ARBITRATION_EMEM_INTR
113 #define MC_INT_EN_MASK  (_MC_INT_EN_MASK | MC_INT_ARBITRATION_EMEM)
114 #else
115 #define MC_INT_EN_MASK  (_MC_INT_EN_MASK)
116 #endif
117
118 extern void __iomem *mc;
119
120 struct mc_client {
121         const char *name;
122         unsigned int intr_counts[INTR_COUNT];
123 };
124
125 extern int mc_client_last;
126
127 struct mcerr_chip_specific {
128
129         const char      *(*mcerr_info)(u32 status);
130         void             (*mcerr_info_update)(struct mc_client *c, u32 status);
131         const char      *(*mcerr_type)(u32 err);
132         void             (*mcerr_print)(const char *mc_err, u32 err, u32 addr,
133                                         const struct mc_client *client,
134                                         int is_secure, int is_write,
135                                         const char *mc_err_info);
136         int              (*mcerr_debugfs_show)(struct seq_file *s, void *v);
137
138         /* Numeric fields that must be set by the different architectures. */
139         unsigned int     nr_clients;
140 };
141
142 #define client(_name) { .name = _name }
143
144 /*
145  * Error MMA tracking.
146  */
147 #define MMA_HISTORY_SAMPLES 20
148 struct arb_emem_intr_info {
149         int arb_intr_mma;
150         u64 time;
151         spinlock_t lock;
152 };
153
154 /*
155  * Externs that get defined by the chip specific code. This way the generic
156  * T3x/T11x can handle a much as possible.
157  */
158 extern struct mc_client mc_clients[];
159 extern void mcerr_chip_specific_setup(struct mcerr_chip_specific *spec);
160
161 #endif /* __MCERR_H */