1 /*
2  * Copyright 2012 Freescale Semiconductor, Inc.
3  *
4  * See file CREDITS for list of people who contributed to this
5  * project.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License as
9  * published by the Free Software Foundation; either version 2 of
10  * the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
20  * MA 02111-1307 USA
21  */
22 
23 #include <common.h>
24 #include <asm/fsl_portals.h>
25 #include <asm/fsl_liodn.h>
26 
27 #ifdef CONFIG_SYS_DPAA_QBMAN
28 struct qportal_info qp_info[CONFIG_SYS_QMAN_NUM_PORTALS] = {
29 	/* dqrr liodn, frame data liodn, liodn off, sdest */
30 	SET_QP_INFO(1, 27, 1, 0),
31 	SET_QP_INFO(2, 28, 1, 0),
32 	SET_QP_INFO(3, 29, 1, 1),
33 	SET_QP_INFO(4, 30, 1, 1),
34 	SET_QP_INFO(5, 31, 1, 2),
35 	SET_QP_INFO(6, 32, 1, 2),
36 	SET_QP_INFO(7, 33, 1, 3),
37 	SET_QP_INFO(8, 34, 1, 3),
38 	SET_QP_INFO(9, 35, 1, 4),
39 	SET_QP_INFO(10, 36, 1, 4),
40 	SET_QP_INFO(11, 37, 1, 5),
41 	SET_QP_INFO(12, 38, 1, 5),
42 	SET_QP_INFO(13, 39, 1, 6),
43 	SET_QP_INFO(14, 40, 1, 6),
44 	SET_QP_INFO(15, 41, 1, 7),
45 	SET_QP_INFO(16, 42, 1, 7),
46 	SET_QP_INFO(17, 43, 1, 8),
47 	SET_QP_INFO(18, 44, 1, 8),
48 	SET_QP_INFO(19, 45, 1, 9),
49 	SET_QP_INFO(20, 46, 1, 9),
50 	SET_QP_INFO(21, 47, 1, 10),
51 	SET_QP_INFO(22, 48, 1, 10),
52 	SET_QP_INFO(23, 49, 1, 11),
53 	SET_QP_INFO(24, 50, 1, 11),
54 	SET_QP_INFO(65, 89, 1, 0),
55 	SET_QP_INFO(66, 90, 1, 0),
56 	SET_QP_INFO(67, 91, 1, 1),
57 	SET_QP_INFO(68, 92, 1, 1),
58 	SET_QP_INFO(69, 93, 1, 2),
59 	SET_QP_INFO(70, 94, 1, 2),
60 	SET_QP_INFO(71, 95, 1, 3),
61 	SET_QP_INFO(72, 96, 1, 3),
62 	SET_QP_INFO(73, 97, 1, 4),
63 	SET_QP_INFO(74, 98, 1, 4),
64 	SET_QP_INFO(75, 99, 1, 5),
65 	SET_QP_INFO(76, 100, 1, 5),
66 	SET_QP_INFO(77, 101, 1, 6),
67 	SET_QP_INFO(78, 102, 1, 6),
68 	SET_QP_INFO(79, 103, 1, 7),
69 	SET_QP_INFO(80, 104, 1, 7),
70 	SET_QP_INFO(81, 105, 1, 8),
71 	SET_QP_INFO(82, 106, 1, 8),
72 	SET_QP_INFO(83, 107, 1, 9),
73 	SET_QP_INFO(84, 108, 1, 9),
74 	SET_QP_INFO(85, 109, 1, 10),
75 	SET_QP_INFO(86, 110, 1, 10),
76 	SET_QP_INFO(87, 111, 1, 11),
77 	SET_QP_INFO(88, 112, 1, 11),
78 	SET_QP_INFO(25, 51, 1, 0),
79 	SET_QP_INFO(26, 52, 1, 0),
80 };
81 #endif
82 
83 struct srio_liodn_id_table srio_liodn_tbl[] = {
84 	SET_SRIO_LIODN_1(1, 307),
85 	SET_SRIO_LIODN_1(2, 387),
86 };
87 int srio_liodn_tbl_sz = ARRAY_SIZE(srio_liodn_tbl);
88 
89 struct liodn_id_table liodn_tbl[] = {
90 #ifdef CONFIG_SYS_DPAA_QBMAN
91 	SET_QMAN_LIODN(62),
92 	SET_BMAN_LIODN(63),
93 #endif
94 
95 	SET_SDHC_LIODN(1, 552),
96 
97 	SET_PME_LIODN(117),
98 
99 	SET_USB_LIODN(1, "fsl-usb2-mph", 553),
100 	SET_USB_LIODN(2, "fsl-usb2-dr", 554),
101 
102 	SET_SATA_LIODN(1, 555),
103 	SET_SATA_LIODN(2, 556),
104 
105 	SET_PCI_LIODN(CONFIG_SYS_FSL_PCIE_COMPAT, 1, 148),
106 	SET_PCI_LIODN(CONFIG_SYS_FSL_PCIE_COMPAT, 2, 228),
107 	SET_PCI_LIODN(CONFIG_SYS_FSL_PCIE_COMPAT, 3, 308),
108 	SET_PCI_LIODN(CONFIG_SYS_FSL_PCIE_COMPAT, 4, 388),
109 
110 	SET_DMA_LIODN(1, 147),
111 	SET_DMA_LIODN(2, 227),
112 
113 	SET_GUTS_LIODN("fsl,rapidio-delta", 199, rio1liodnr, 0),
114 	SET_GUTS_LIODN(NULL, 200, rio2liodnr, 0),
115 	SET_GUTS_LIODN(NULL, 201, rio1maintliodnr, 0),
116 	SET_GUTS_LIODN(NULL, 202, rio2maintliodnr, 0),
117 
118 #ifdef CONFIG_SYS_PMAN
119 	SET_PMAN_LIODN(1, 513),
120 	SET_PMAN_LIODN(2, 514),
121 	SET_PMAN_LIODN(3, 515),
122 #endif
123 
124 	/* SET_NEXUS_LIODN(557), -- not yet implemented */
125 };
126 int liodn_tbl_sz = ARRAY_SIZE(liodn_tbl);
127 
128 #ifdef CONFIG_SYS_DPAA_FMAN
129 struct liodn_id_table fman1_liodn_tbl[] = {
130 	SET_FMAN_RX_1G_LIODN(1, 0, 88),
131 	SET_FMAN_RX_1G_LIODN(1, 1, 89),
132 	SET_FMAN_RX_1G_LIODN(1, 2, 90),
133 	SET_FMAN_RX_1G_LIODN(1, 3, 91),
134 	SET_FMAN_RX_1G_LIODN(1, 4, 92),
135 	SET_FMAN_RX_1G_LIODN(1, 5, 93),
136 	SET_FMAN_RX_10G_LIODN(1, 0, 94),
137 	SET_FMAN_RX_10G_LIODN(1, 1, 95),
138 };
139 int fman1_liodn_tbl_sz = ARRAY_SIZE(fman1_liodn_tbl);
140 #if (CONFIG_SYS_NUM_FMAN == 2)
141 struct liodn_id_table fman2_liodn_tbl[] = {
142 	SET_FMAN_RX_1G_LIODN(2, 0, 88),
143 	SET_FMAN_RX_1G_LIODN(2, 1, 89),
144 	SET_FMAN_RX_1G_LIODN(2, 2, 90),
145 	SET_FMAN_RX_1G_LIODN(2, 3, 91),
146 	SET_FMAN_RX_1G_LIODN(2, 4, 92),
147 	SET_FMAN_RX_1G_LIODN(2, 5, 93),
148 	SET_FMAN_RX_10G_LIODN(2, 0, 94),
149 	SET_FMAN_RX_10G_LIODN(2, 1, 95),
150 };
151 int fman2_liodn_tbl_sz = ARRAY_SIZE(fman2_liodn_tbl);
152 #endif
153 #endif
154 
155 struct liodn_id_table sec_liodn_tbl[] = {
156 	SET_SEC_JR_LIODN_ENTRY(0, 454, 458),
157 	SET_SEC_JR_LIODN_ENTRY(1, 455, 459),
158 	SET_SEC_JR_LIODN_ENTRY(2, 456, 460),
159 	SET_SEC_JR_LIODN_ENTRY(3, 457, 461),
160 	SET_SEC_RTIC_LIODN_ENTRY(a, 453),
161 	SET_SEC_RTIC_LIODN_ENTRY(b, 549),
162 	SET_SEC_RTIC_LIODN_ENTRY(c, 550),
163 	SET_SEC_RTIC_LIODN_ENTRY(d, 551),
164 	SET_SEC_DECO_LIODN_ENTRY(0, 541, 610),
165 	SET_SEC_DECO_LIODN_ENTRY(1, 542, 611),
166 	SET_SEC_DECO_LIODN_ENTRY(2, 543, 612),
167 	SET_SEC_DECO_LIODN_ENTRY(3, 544, 613),
168 	SET_SEC_DECO_LIODN_ENTRY(4, 545, 614),
169 	SET_SEC_DECO_LIODN_ENTRY(5, 546, 615),
170 	SET_SEC_DECO_LIODN_ENTRY(6, 547, 616),
171 	SET_SEC_DECO_LIODN_ENTRY(7, 548, 617),
172 };
173 int sec_liodn_tbl_sz = ARRAY_SIZE(sec_liodn_tbl);
174 
175 #ifdef CONFIG_SYS_DPAA_RMAN
176 struct liodn_id_table rman_liodn_tbl[] = {
177 	/* Set RMan block 0-3 liodn offset */
178 	SET_RMAN_LIODN(0, 678),
179 	SET_RMAN_LIODN(1, 679),
180 	SET_RMAN_LIODN(2, 680),
181 	SET_RMAN_LIODN(3, 681),
182 };
183 int rman_liodn_tbl_sz = ARRAY_SIZE(rman_liodn_tbl);
184 #endif
185 
186 struct liodn_id_table liodn_bases[] = {
187 #ifdef CONFIG_SYS_DPAA_DCE
188 	[FSL_HW_PORTAL_DCE]  = SET_LIODN_BASE_2(618, 694),
189 #endif
190 	[FSL_HW_PORTAL_SEC]  = SET_LIODN_BASE_2(462, 558),
191 #ifdef CONFIG_SYS_DPAA_FMAN
192 	[FSL_HW_PORTAL_FMAN1] = SET_LIODN_BASE_1(973),
193 #if (CONFIG_SYS_NUM_FMAN == 2)
194 	[FSL_HW_PORTAL_FMAN2] = SET_LIODN_BASE_1(1069),
195 #endif
196 #endif
197 #ifdef CONFIG_SYS_DPAA_PME
198 	[FSL_HW_PORTAL_PME]   = SET_LIODN_BASE_2(770, 846),
199 #endif
200 #ifdef CONFIG_SYS_DPAA_RMAN
201 	[FSL_HW_PORTAL_RMAN] = SET_LIODN_BASE_1(922),
202 #endif
203 };
204