blob: 862bb46801b426183660316514f4a294eb281bf7 [file] [log] [blame]
Duy Truong790f06d2013-02-13 16:38:12 -08001/* Copyright (c) 2011, The Linux Foundation. All rights reserved.
Gagan Mac53fcb1d2011-09-21 17:36:49 -06002 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 */
13
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/device.h>
17#include <linux/module.h>
18#include <mach/msm_bus.h>
19#include <mach/msm_bus_board.h>
20#include <mach/board.h>
21#include <mach/rpm.h>
22#include "msm_bus_core.h"
23
24#define NMASTERS 14
25#define NSLAVES 12
26#define NFAB_9615 2
27
28enum msm_bus_fabric_tiered_slave_type {
29 MSM_BUS_TIERED_SLAVE_EBI1_CH0 = 1,
30};
31
32enum msm_bus_9615_master_ports_type {
33 MSM_BUS_MASTER_PORT_SPS = 0,
34 MSM_BUS_MASTER_PORT_APSS_PROC,
35 MSM_BUS_MASTER_PORT_ADM_PORT0,
36 MSM_BUS_MASTER_PORT_ADM_PORT1,
37 MSM_BUS_MASTER_PORT_LPASS_PROC,
38 MSM_BUS_MASTER_PORT_MSS,
39 MSM_BUS_MASTER_PORT_MSS_SW_PROC,
40 MSM_BUS_MASTER_PORT_MSS_FW_PROC,
41 MSM_BUS_MASTER_PORT_LPASS,
42 MSM_BUS_SYSTEM_MASTER_PORT_CPSS_FPB,
43 MSM_BUS_SYSTEM_MASTER_PORT_SYSTEM_FPB,
44 MSM_BUS_SYSTEM_MASTER_PORT_ADM_AHB_CI,
45};
46
47enum msm_bus_9615_slave_ports_type {
48 MSM_BUS_SLAVE_PORT_SPS = 0,
49 MSM_BUS_SLAVE_PORT_EBI1_CH0,
50 MSM_BUS_SLAVE_PORT_APSS_L2,
51 MSM_BUS_SLAVE_PORT_SYSTEM_IMEM,
52 MSM_BUS_SLAVE_PORT_CORESIGHT,
53 MSM_BUS_SLAVE_PORT_APSS,
54 MSM_BUS_SLAVE_PORT_MSS,
55 MSM_BUS_SLAVE_PORT_LPASS,
56 MSM_BUS_SYSTEM_SLAVE_PORT_CPSS_FPB,
57 MSM_BUS_SYSTEM_SLAVE_PORT_SYSTEM_FPB,
58};
59
60static int tier2[] = {MSM_BUS_BW_TIER2,};
61static uint32_t master_iids[NMASTERS];
62static uint32_t slave_iids[NSLAVES];
63
64static int sport_ebi1_ch0[] = {MSM_BUS_SLAVE_PORT_EBI1_CH0,};
65static int sport_apss_l2[] = {MSM_BUS_SLAVE_PORT_APSS_L2,};
66
67static int tiered_slave_ebi1_ch0[] = {MSM_BUS_TIERED_SLAVE_EBI1_CH0,};
68
69static int mport_sps[] = {MSM_BUS_MASTER_PORT_SPS,};
70static int mport_apss_proc[] = {MSM_BUS_MASTER_PORT_APSS_PROC,};
71static int mport_adm_port0[] = {MSM_BUS_MASTER_PORT_ADM_PORT0,};
72static int mport_adm_port1[] = {MSM_BUS_MASTER_PORT_ADM_PORT1,};
73static int mport_mss[] = {MSM_BUS_MASTER_PORT_MSS,};
74static int mport_lpass_proc[] = {MSM_BUS_MASTER_PORT_LPASS_PROC,};
75static int mport_mss_sw_proc[] = {MSM_BUS_MASTER_PORT_MSS_SW_PROC,};
76static int mport_mss_fw_proc[] = {MSM_BUS_MASTER_PORT_MSS_FW_PROC,};
77static int mport_lpass[] = {MSM_BUS_MASTER_PORT_LPASS,};
78static int system_mport_adm_ahb_ci[] = {MSM_BUS_SYSTEM_MASTER_PORT_ADM_AHB_CI,};
79static int mport_system_fpb[] = {MSM_BUS_SYSTEM_MASTER_PORT_SYSTEM_FPB,};
80static int system_mport_cpss_fpb[] = {MSM_BUS_SYSTEM_MASTER_PORT_CPSS_FPB,};
81
82static int system_sport_system_fpb[] = {MSM_BUS_SYSTEM_SLAVE_PORT_SYSTEM_FPB,};
83static int system_sport_cpss_fpb[] = {MSM_BUS_SYSTEM_SLAVE_PORT_CPSS_FPB,};
84static int sport_sps[] = {MSM_BUS_SLAVE_PORT_SPS,};
85static int sport_system_imem[] = {MSM_BUS_SLAVE_PORT_SYSTEM_IMEM,};
86static int sport_coresight[] = {MSM_BUS_SLAVE_PORT_CORESIGHT,};
87static int sport_apss[] = {MSM_BUS_SLAVE_PORT_APSS,};
88static int sport_mss[] = {MSM_BUS_SLAVE_PORT_MSS,};
89static int sport_lpass[] = {MSM_BUS_SLAVE_PORT_LPASS,};
90
91static struct msm_bus_node_info system_fabric_info[] = {
92 {
93 .id = MSM_BUS_MASTER_SPS,
94 .masterp = mport_sps,
95 .num_mports = ARRAY_SIZE(mport_sps),
96 .tier = tier2,
97 .num_tiers = ARRAY_SIZE(tier2),
98 },
99 {
100 .id = MSM_BUS_MASTER_ADM_PORT0,
101 .masterp = mport_adm_port0,
102 .num_mports = ARRAY_SIZE(mport_adm_port0),
103 .tier = tier2,
104 .num_tiers = ARRAY_SIZE(tier2),
105 },
106 {
107 .id = MSM_BUS_MASTER_ADM_PORT1,
108 .masterp = mport_adm_port1,
109 .num_mports = ARRAY_SIZE(mport_adm_port1),
110 .tier = tier2,
111 .num_tiers = ARRAY_SIZE(tier2),
112 },
113 {
114 .id = MSM_BUS_MASTER_LPASS_PROC,
115 .masterp = mport_lpass_proc,
116 .num_mports = ARRAY_SIZE(mport_lpass_proc),
117 .tier = tier2,
118 .num_tiers = ARRAY_SIZE(tier2),
119 },
120 {
121 .id = MSM_BUS_MASTER_MSS,
122 .masterp = mport_mss,
123 .num_mports = ARRAY_SIZE(mport_mss),
124 .tier = tier2,
125 .num_tiers = ARRAY_SIZE(tier2),
126 },
127 {
128 .id = MSM_BUS_MASTER_AMPSS_M0,
129 .masterp = mport_apss_proc,
130 .num_mports = ARRAY_SIZE(mport_apss_proc),
131 .tier = tier2,
132 .num_tiers = ARRAY_SIZE(tier2),
133 },
134 {
135 .id = MSM_BUS_MASTER_MSS_SW_PROC,
136 .masterp = mport_mss_sw_proc,
137 .num_mports = ARRAY_SIZE(mport_mss_sw_proc),
138 .tier = tier2,
139 .num_tiers = ARRAY_SIZE(tier2),
140 },
141 {
142 .id = MSM_BUS_MASTER_MSS_FW_PROC,
143 .masterp = mport_mss_fw_proc,
144 .num_mports = ARRAY_SIZE(mport_mss_fw_proc),
145 .tier = tier2,
146 .num_tiers = ARRAY_SIZE(tier2),
147 },
148 {
149 .id = MSM_BUS_MASTER_LPASS,
150 .masterp = mport_lpass,
151 .num_mports = ARRAY_SIZE(mport_lpass),
152 .tier = tier2,
153 .num_tiers = ARRAY_SIZE(tier2),
154 },
155 {
156 .id = MSM_BUS_MASTER_ADM0_CI,
157 .masterp = system_mport_adm_ahb_ci,
158 .num_mports = ARRAY_SIZE(system_mport_adm_ahb_ci),
159 .tier = tier2,
160 .num_tiers = ARRAY_SIZE(tier2),
161 },
162 {
163 .id = MSM_BUS_FAB_SYSTEM_FPB,
164 .gateway = 1,
165 .slavep = system_sport_system_fpb,
166 .num_sports = ARRAY_SIZE(system_sport_system_fpb),
167 .masterp = mport_system_fpb,
168 .num_mports = ARRAY_SIZE(mport_system_fpb),
169 .buswidth = 4,
170 },
171 {
172 .id = MSM_BUS_FAB_CPSS_FPB,
173 .gateway = 1,
174 .slavep = system_sport_cpss_fpb,
175 .num_sports = ARRAY_SIZE(system_sport_cpss_fpb),
176 .masterp = system_mport_cpss_fpb,
177 .num_mports = ARRAY_SIZE(system_mport_cpss_fpb),
178 .buswidth = 4,
179 },
180 {
181 .id = MSM_BUS_SLAVE_SPS,
182 .slavep = sport_sps,
183 .num_sports = ARRAY_SIZE(sport_sps),
184 .tier = tier2,
185 .num_tiers = ARRAY_SIZE(tier2),
186 .buswidth = 8,
Gagan Macbc5f81d2012-04-04 15:03:12 -0600187 .slaveclk[DUAL_CTX] = "dfab_clk",
188 .slaveclk[ACTIVE_CTX] = "dfab_a_clk",
Gagan Mac53fcb1d2011-09-21 17:36:49 -0600189 },
190 {
191 .id = MSM_BUS_SLAVE_EBI_CH0,
192 .slavep = sport_ebi1_ch0,
193 .num_sports = ARRAY_SIZE(sport_ebi1_ch0),
194 .tier = tiered_slave_ebi1_ch0,
195 .num_tiers = ARRAY_SIZE(tiered_slave_ebi1_ch0),
196 .buswidth = 8,
Matt Wagantallb2710b82011-11-16 19:55:17 -0800197 .slaveclk[DUAL_CTX] = "mem_clk",
198 .slaveclk[ACTIVE_CTX] = "mem_a_clk",
Gagan Mac53fcb1d2011-09-21 17:36:49 -0600199 },
200 {
201 .id = MSM_BUS_SLAVE_SYSTEM_IMEM,
202 .slavep = sport_system_imem,
203 .num_sports = ARRAY_SIZE(sport_system_imem),
204 .buswidth = 8,
205 },
206 {
207 .id = MSM_BUS_SLAVE_CORESIGHT,
208 .slavep = sport_coresight,
209 .num_sports = ARRAY_SIZE(sport_coresight),
210 .tier = tier2,
211 .num_tiers = ARRAY_SIZE(tier2),
212 .buswidth = 8,
213 },
214 {
215 .id = MSM_BUS_SLAVE_AMPSS,
216 .slavep = sport_apss,
217 .num_sports = ARRAY_SIZE(sport_apss),
218 .tier = tier2,
219 .num_tiers = ARRAY_SIZE(tier2),
220 .buswidth = 8,
221 },
222 {
223 .id = MSM_BUS_SLAVE_AMPSS_L2,
224 .slavep = sport_apss_l2,
225 .num_sports = ARRAY_SIZE(sport_apss_l2),
226 .tier = tier2,
227 .num_tiers = ARRAY_SIZE(tier2),
228 .buswidth = 8,
229 },
230 {
231 .id = MSM_BUS_SLAVE_MSS,
232 .slavep = sport_mss,
233 .num_sports = ARRAY_SIZE(sport_mss),
234 .tier = tier2,
235 .num_tiers = ARRAY_SIZE(tier2),
236 .buswidth = 8,
237 },
238 {
239 .id = MSM_BUS_SLAVE_LPASS,
240 .slavep = sport_lpass,
241 .num_sports = ARRAY_SIZE(sport_lpass),
242 .tier = tier2,
243 .num_tiers = ARRAY_SIZE(tier2),
244 .buswidth = 8,
245 },
246};
247
248static void msm_bus_board_assign_iids(struct msm_bus_fabric_registration
249 *fabreg, int fabid)
250{
251 int i;
252 for (i = 0; i < fabreg->len; i++) {
253 if (!fabreg->info[i].gateway) {
254 fabreg->info[i].priv_id = fabid + fabreg->info[i].id;
255 if (fabreg->info[i].id < SLAVE_ID_KEY)
256 master_iids[fabreg->info[i].id] =
257 fabreg->info[i].priv_id;
258 else
259 slave_iids[fabreg->info[i].id - (SLAVE_ID_KEY)]
260 = fabreg->info[i].priv_id;
261 } else
262 fabreg->info[i].priv_id = fabreg->info[i].id;
263 }
264}
265
266static int msm_bus_board_9615_get_iid(int id)
267{
268 if ((id < SLAVE_ID_KEY && id >= NMASTERS) ||
269 id >= (SLAVE_ID_KEY + NSLAVES)) {
270 MSM_BUS_ERR("Cannot get iid. Invalid id %d passed\n", id);
271 return -EINVAL;
272 }
273
274 return ((id < SLAVE_ID_KEY) ? master_iids[id] : slave_iids[id -
275 SLAVE_ID_KEY]);
276}
277
278static struct msm_bus_board_algorithm msm_bus_board_algo = {
279 .board_nfab = NFAB_9615,
280 .get_iid = msm_bus_board_9615_get_iid,
281 .assign_iids = msm_bus_board_assign_iids,
282};
283
284struct msm_bus_fabric_registration msm_bus_9615_sys_fabric_pdata = {
285 .id = MSM_BUS_FAB_SYSTEM,
286 .name = "msm_sys_fab",
287 system_fabric_info,
288 ARRAY_SIZE(system_fabric_info),
289 .ahb = 0,
Matt Wagantallb2710b82011-11-16 19:55:17 -0800290 .fabclk[DUAL_CTX] = "bus_clk",
291 .fabclk[ACTIVE_CTX] = "bus_a_clk",
Gagan Mac53fcb1d2011-09-21 17:36:49 -0600292 .haltid = MSM_RPM_ID_SYS_FABRIC_CFG_HALT_0,
293 .offset = MSM_RPM_ID_SYSTEM_FABRIC_ARB_0,
294 .nmasters = 12,
295 .nslaves = 10,
296 .ntieredslaves = 1,
297 .board_algo = &msm_bus_board_algo,
298};
299
300struct msm_bus_fabric_registration msm_bus_9615_def_fab_pdata = {
301 .id = MSM_BUS_FAB_DEFAULT,
302 .name = "msm_def_fab",
303 .ahb = 1,
304 .nmasters = 0,
305 .nslaves = 0,
306 .ntieredslaves = 0,
307 .board_algo = &msm_bus_board_algo,
308};
309
310int msm_bus_board_rpm_get_il_ids(uint16_t id[])
311{
312 return -ENXIO;
313}
Gagan Mac7c7e5542012-12-19 19:28:47 -0700314
315void msm_bus_board_init(struct msm_bus_fabric_registration *pdata)
316{
317}