summaryrefslogtreecommitdiffstats
path: root/include/linux/platform/tegra/tegra_cbb.h
blob: 767c8ec71fa1f68a08893c140351dcdd08c8a9ea (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
/*
 * Copyright (c) 2017-2020, NVIDIA CORPORATION.  All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms and conditions of the GNU General Public License,
 * version 2, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 */


#define  OFF_ERRLOGGER_0_ID_COREID_0            0x00000000
#define  OFF_ERRLOGGER_0_ID_REVISIONID_0        0x00000004
#define  OFF_ERRLOGGER_0_FAULTEN_0              0x00000008
#define  OFF_ERRLOGGER_0_ERRVLD_0               0x0000000c
#define  OFF_ERRLOGGER_0_ERRCLR_0               0x00000010
#define  OFF_ERRLOGGER_0_ERRLOG0_0              0x00000014
#define  OFF_ERRLOGGER_0_ERRLOG1_0              0x00000018
#define  OFF_ERRLOGGER_0_RESERVED_00_0          0x0000001c
#define  OFF_ERRLOGGER_0_ERRLOG3_0              0x00000020
#define  OFF_ERRLOGGER_0_ERRLOG4_0              0x00000024
#define  OFF_ERRLOGGER_0_ERRLOG5_0              0x00000028
#define  OFF_ERRLOGGER_0_STALLEN_0              0x00000038

#define  OFF_ERRLOGGER_1_ID_COREID_0            0x00000080
#define  OFF_ERRLOGGER_1_ID_REVISIONID_0        0x00000084
#define  OFF_ERRLOGGER_1_FAULTEN_0              0x00000088
#define  OFF_ERRLOGGER_1_ERRVLD_0               0x0000008c
#define  OFF_ERRLOGGER_1_ERRCLR_0               0x00000090
#define  OFF_ERRLOGGER_1_ERRLOG0_0              0x00000094
#define  OFF_ERRLOGGER_1_ERRLOG1_0              0x00000098
#define  OFF_ERRLOGGER_1_RESERVED_00_0          0x0000009c
#define  OFF_ERRLOGGER_1_ERRLOG3_0              0x000000A0
#define  OFF_ERRLOGGER_1_ERRLOG4_0              0x000000A4
#define  OFF_ERRLOGGER_1_ERRLOG5_0              0x000000A8
#define  OFF_ERRLOGGER_1_STALLEN_0              0x000000b8

#define  OFF_ERRLOGGER_2_ID_COREID_0            0x00000100
#define  OFF_ERRLOGGER_2_ID_REVISIONID_0        0x00000104
#define  OFF_ERRLOGGER_2_FAULTEN_0              0x00000108
#define  OFF_ERRLOGGER_2_ERRVLD_0               0x0000010c
#define  OFF_ERRLOGGER_2_ERRCLR_0               0x00000110
#define  OFF_ERRLOGGER_2_ERRLOG0_0              0x00000114
#define  OFF_ERRLOGGER_2_ERRLOG1_0              0x00000118
#define  OFF_ERRLOGGER_2_RESERVED_00_0          0x0000011c
#define  OFF_ERRLOGGER_2_ERRLOG3_0              0x00000120
#define  OFF_ERRLOGGER_2_ERRLOG4_0              0x00000124
#define  OFF_ERRLOGGER_2_ERRLOG5_0              0x00000128
#define  OFF_ERRLOGGER_2_STALLEN_0              0x00000138

#define DMAAPB_X_RAW_INTERRUPT_STATUS	0x2ec

#define CBB_BIT(_bit_) (1ULL << (_bit_))
#define CBB_MASK(_msb_, _lsb_) \
	((CBB_BIT(_msb_+1) - 1) & ~(CBB_BIT(_lsb_) - 1))
#define CBB_EXTRACT(_x_, _msb_, _lsb_)  \
	((_x_ & CBB_MASK(_msb_, _lsb_)) >> _lsb_)

#define get_noc_errlog_subfield(_x_, _msb_, _lsb_) \
			CBB_EXTRACT(_x_, _msb_, _lsb_)

struct tegra_noc_errors {
	char *errcode;
	char *src;
	char *type;
};

struct tegra_noc_packet_header {
	bool    lock;	// [0]
	u8      opc;	// [4:1]
	u8      errcode;// [10:8]= RD, RDW, RDL, RDX, WR, WRW, WRC, PRE, URG
	u16     len1;	// [27:16]
	bool    format;	// [31]  = 1 -> FlexNoC versions 2.7 & above
};

struct tegra_lookup_noc_aperture {
	u8      initflow;
	u8      targflow;
	u8      targ_subrange;
	u8	init_mapping;
	u32	init_localaddress;
	u8	targ_mapping;
	u32	targ_localaddress;
	u16	seqid;
};

struct tegra_noc_userbits {
	u8	axcache;
	u8	non_mod;
	u8	axprot;
	u8	falconsec;
	u8	grpsec;
	u8	vqc;
	u8	mstr_id;
	u8	axi_id;
};

struct tegra_cbb_errlog_record {
	struct list_head node;
	struct serr_hook *callback;
	char            *name;
	phys_addr_t     start;
	void            __iomem *vaddr;
	int		noc_secure_irq;
	int		noc_nonsecure_irq;
	u32             errlog0;
	u32             errlog1;
	u32             errlog2;
	u32             errlog3;
	u32             errlog4;
	u32             errlog5;
	u32             errlog6;	//RESERVED
	u32             errlog7;	//RESERVED
	u32             errlog8;	//RESERVED
	unsigned int    (*errvld)(void __iomem *addr);
	void            (*errclr)(void __iomem *addr);
	void            (*faulten)(void __iomem *addr);
	void            (*stallen)(void __iomem *addr);
	void		(*tegra_noc_parse_routeid)
				(struct tegra_lookup_noc_aperture *, u64);
	void		(*tegra_noc_parse_userbits)
				(struct tegra_noc_userbits *, u64);
	struct		tegra_lookup_noc_aperture *noc_aperture;
	int             max_noc_aperture;
	char		**tegra_noc_routeid_initflow;
	char		**tegra_noc_routeid_targflow;
	char		**tegra_cbb_master_id;
	bool		is_ax2apb_bridge_connected;
	void __iomem 	**axi2abp_bases;
	int		apb_bridge_cnt;
	bool		is_clk_rst;
	int		(*is_cluster_probed)(void);
	int		(*is_clk_enabled)(void);
	int		(*tegra_noc_en_clk_rpm)(void);
	int		(*tegra_noc_dis_clk_rpm)(void);
	int		(*tegra_noc_en_clk_no_rpm)(void);
	int		(*tegra_noc_dis_clk_no_rpm)(void);
};

struct tegra_cbb_noc_data {
	char            *name;
	unsigned int    (*errvld)(void __iomem *addr);
	void            (*errclr)(void __iomem *addr);
	void            (*faulten)(void __iomem *addr);
	void            (*stallen)(void __iomem *addr);
	void		(*tegra_noc_parse_routeid)
				(struct tegra_lookup_noc_aperture *, u64);
	void		(*tegra_noc_parse_userbits)
				(struct tegra_noc_userbits *, u64);
	struct		tegra_lookup_noc_aperture *noc_aperture;
	int             max_error;
	int             max_noc_aperture;
	char		**tegra_noc_routeid_initflow;
	char		**tegra_noc_routeid_targflow;
	char		**tegra_cbb_master_id;
	bool		is_ax2apb_bridge_connected;
	bool		is_clk_rst;
	bool		erd_mask_inband_err;
	u64		off_erd_err_config;
	int		(*is_cluster_probed)(void);
	int		(*is_clk_enabled)(void);
	int		(*tegra_noc_en_clk_rpm)(void);
	int		(*tegra_noc_dis_clk_rpm)(void);
	int		(*tegra_noc_en_clk_no_rpm)(void);
	int		(*tegra_noc_dis_clk_no_rpm)(void);
};