bus: omap_l3_noc: introduce concept of submodule
[linux-2.6-block.git] / drivers / bus / omap_l3_noc.h
CommitLineData
ed0e3520 1/*
c10d5c9e 2 * OMAP L3 Interconnect error handling driver header
ed0e3520 3 *
c5f2aea0 4 * Copyright (C) 2011-2014 Texas Instruments Incorporated - http://www.ti.com/
ed0e3520 5 * Santosh Shilimkar <santosh.shilimkar@ti.com>
6 * sricharan <r.sricharan@ti.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
c5f2aea0
NM
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
ed0e3520 11 *
c5f2aea0
NM
12 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
13 * kind, whether express or implied; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ed0e3520 15 * GNU General Public License for more details.
ed0e3520 16 */
c10d5c9e
S
17#ifndef __OMAP_L3_NOC_H
18#define __OMAP_L3_NOC_H
2722e56d 19
0659452d 20#define MAX_L3_MODULES 3
97708c08 21#define MAX_CLKDM_TARGETS 31
0659452d 22
2722e56d
SS
23#define CLEAR_STDERR_LOG (1 << 31)
24#define CUSTOM_ERROR 0x2
25#define STANDARD_ERROR 0x0
26#define INBAND_ERROR 0x0
2722e56d
SS
27#define L3_APPLICATION_ERROR 0x0
28#define L3_DEBUG_ERROR 0x1
29
342fd144 30/* L3 TARG register offsets */
ed0e3520 31#define L3_TARG_STDERRLOG_MAIN 0x48
7f9de02d 32#define L3_TARG_STDERRLOG_HDR 0x4c
c98aa7aa 33#define L3_TARG_STDERRLOG_MSTADDR 0x50
cf52b2ec 34#define L3_TARG_STDERRLOG_INFO 0x58
ed0e3520 35#define L3_TARG_STDERRLOG_SLVOFSLSB 0x5c
cf52b2ec 36#define L3_TARG_STDERRLOG_CINFO_INFO 0x64
c98aa7aa 37#define L3_TARG_STDERRLOG_CINFO_MSTADDR 0x68
7f9de02d 38#define L3_TARG_STDERRLOG_CINFO_OPCODE 0x6c
ed0e3520 39#define L3_FLAGMUX_REGERR0 0xc
3340d739
RN
40#define L3_FLAGMUX_MASK0 0x8
41
42#define L3_TARGET_NOT_SUPPORTED NULL
43
f33ddf74
NM
44#define L3_BASE_IS_SUBMODULE ((void __iomem *)(1 << 0))
45
7f9de02d
NM
46static const char * const l3_transaction_type[] = {
47 /* 0 0 0 */ "Idle",
48 /* 0 0 1 */ "Write",
49 /* 0 1 0 */ "Read",
50 /* 0 1 1 */ "ReadEx",
51 /* 1 0 0 */ "Read Link",
52 /* 1 0 1 */ "Write Non-Posted",
53 /* 1 1 0 */ "Write Conditional",
54 /* 1 1 1 */ "Write Broadcast",
55};
56
f0a6e654
NM
57/**
58 * struct l3_masters_data - L3 Master information
59 * @id: ID of the L3 Master
60 * @name: master name
61 */
62struct l3_masters_data {
63 u32 id;
64 char *name;
65};
66
3ae9af7c
NM
67/**
68 * struct l3_target_data - L3 Target information
69 * @offset: Offset from base for L3 Target
70 * @name: Target name
71 *
72 * Target information is organized indexed by bit field definitions.
73 */
74struct l3_target_data {
75 u32 offset;
76 char *name;
77};
78
97708c08
NM
79/**
80 * struct l3_flagmux_data - Flag Mux information
81 * @offset: offset from base for flagmux register
82 * @l3_targ: array indexed by flagmux index (bit offset) pointing to the
83 * target data. unsupported ones are marked with
84 * L3_TARGET_NOT_SUPPORTED
85 * @num_targ_data: number of entries in target data
2100b595
AM
86 * @mask_app_bits: ignore these from raw application irq status
87 * @mask_dbg_bits: ignore these from raw debug irq status
97708c08
NM
88 */
89struct l3_flagmux_data {
90 u32 offset;
91 struct l3_target_data *l3_targ;
92 u8 num_targ_data;
2100b595
AM
93 u32 mask_app_bits;
94 u32 mask_dbg_bits;
97708c08
NM
95};
96
0659452d
S
97
98/**
99 * struct omap_l3 - Description of data relevant for L3 bus.
100 * @dev: device representing the bus (populated runtime)
f33ddf74
NM
101 * @l3_base: base addresses of modules (populated runtime if 0)
102 * if set to L3_BASE_IS_SUBMODULE, then uses previous
103 * module index as the base address
97708c08 104 * @l3_flag_mux: array containing flag mux data per module
0659452d
S
105 * offset from corresponding module base indexed per
106 * module.
107 * @num_modules: number of clock domains / modules.
108 * @l3_masters: array pointing to master data containing name and register
109 * offset for the master.
110 * @num_master: number of masters
d4d8819e 111 * @mst_addr_mask: Mask representing MSTADDR information of NTTP packet
0659452d
S
112 * @debug_irq: irq number of the debug interrupt (populated runtime)
113 * @app_irq: irq number of the application interrupt (populated runtime)
114 */
115struct omap_l3 {
116 struct device *dev;
117
118 void __iomem *l3_base[MAX_L3_MODULES];
97708c08 119 struct l3_flagmux_data **l3_flagmux;
0659452d
S
120 int num_modules;
121
122 struct l3_masters_data *l3_masters;
123 int num_masters;
d4d8819e 124 u32 mst_addr_mask;
0659452d 125
0659452d
S
126 int debug_irq;
127 int app_irq;
128};
129
97708c08 130static struct l3_target_data omap_l3_target_data_clk1[] = {
3ae9af7c
NM
131 {0x100, "DMM1",},
132 {0x200, "DMM2",},
133 {0x300, "ABE",},
134 {0x400, "L4CFG",},
135 {0x600, "CLK2PWRDISC",},
136 {0x0, "HOSTCLK1",},
137 {0x900, "L4WAKEUP",},
2722e56d
SS
138};
139
97708c08
NM
140static struct l3_flagmux_data omap_l3_flagmux_clk1 = {
141 .offset = 0x500,
142 .l3_targ = omap_l3_target_data_clk1,
143 .num_targ_data = ARRAY_SIZE(omap_l3_target_data_clk1),
144};
145
146
147static struct l3_target_data omap_l3_target_data_clk2[] = {
3ae9af7c
NM
148 {0x500, "CORTEXM3",},
149 {0x300, "DSS",},
150 {0x100, "GPMC",},
151 {0x400, "ISS",},
152 {0x700, "IVAHD",},
153 {0xD00, "AES1",},
154 {0x900, "L4PER0",},
155 {0x200, "OCMRAM",},
156 {0x100, "GPMCsERROR",},
157 {0x600, "SGX",},
158 {0x800, "SL2",},
159 {0x1600, "C2C",},
160 {0x1100, "PWRDISCCLK1",},
161 {0xF00, "SHA1",},
162 {0xE00, "AES2",},
163 {0xC00, "L4PER3",},
164 {0xA00, "L4PER1",},
165 {0xB00, "L4PER2",},
166 {0x0, "HOSTCLK2",},
167 {0x1800, "CAL",},
168 {0x1700, "LLI",},
2722e56d
SS
169};
170
97708c08
NM
171static struct l3_flagmux_data omap_l3_flagmux_clk2 = {
172 .offset = 0x1000,
173 .l3_targ = omap_l3_target_data_clk2,
174 .num_targ_data = ARRAY_SIZE(omap_l3_target_data_clk2),
175};
176
177
178static struct l3_target_data omap_l3_target_data_clk3[] = {
3ae9af7c
NM
179 {0x0100, "EMUSS",},
180 {0x0300, "DEBUG SOURCE",},
181 {0x0, "HOST CLK3",},
2722e56d
SS
182};
183
97708c08
NM
184static struct l3_flagmux_data omap_l3_flagmux_clk3 = {
185 .offset = 0x0200,
186 .l3_targ = omap_l3_target_data_clk3,
187 .num_targ_data = ARRAY_SIZE(omap_l3_target_data_clk3),
188};
189
0659452d 190static struct l3_masters_data omap_l3_masters[] = {
551a9fa9 191 { 0x0 , "MPU"},
192 { 0x10, "CS_ADP"},
193 { 0x14, "xxx"},
194 { 0x20, "DSP"},
195 { 0x30, "IVAHD"},
196 { 0x40, "ISS"},
197 { 0x44, "DucatiM3"},
198 { 0x48, "FaceDetect"},
199 { 0x50, "SDMA_Rd"},
200 { 0x54, "SDMA_Wr"},
201 { 0x58, "xxx"},
202 { 0x5C, "xxx"},
203 { 0x60, "SGX"},
204 { 0x70, "DSS"},
205 { 0x80, "C2C"},
206 { 0x88, "xxx"},
207 { 0x8C, "xxx"},
208 { 0x90, "HSI"},
209 { 0xA0, "MMC1"},
210 { 0xA4, "MMC2"},
211 { 0xA8, "MMC6"},
212 { 0xB0, "UNIPRO1"},
213 { 0xC0, "USBHOSTHS"},
214 { 0xC4, "USBOTGHS"},
215 { 0xC8, "USBHOSTFS"}
216};
217
97708c08
NM
218static struct l3_flagmux_data *omap_l3_flagmux[] = {
219 &omap_l3_flagmux_clk1,
220 &omap_l3_flagmux_clk2,
221 &omap_l3_flagmux_clk3,
2722e56d
SS
222};
223
0659452d
S
224static const struct omap_l3 omap_l3_data = {
225 .l3_flagmux = omap_l3_flagmux,
97708c08 226 .num_modules = ARRAY_SIZE(omap_l3_flagmux),
0659452d
S
227 .l3_masters = omap_l3_masters,
228 .num_masters = ARRAY_SIZE(omap_l3_masters),
d4d8819e
NM
229 /* The 6 MSBs of register field used to distinguish initiator */
230 .mst_addr_mask = 0xFC,
2722e56d 231};
c10d5c9e
S
232
233#endif /* __OMAP_L3_NOC_H */