blob: a8c0c47f4af1720d7c0971f3c00e9416956d1f01 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
York Sun9941a222012-10-08 07:44:19 +00002/*
3 * Copyright 2012 Freescale Semiconductor, Inc.
York Sun9941a222012-10-08 07:44:19 +00004 */
5
6#include <common.h>
7#include <asm/fsl_serdes.h>
8#include <asm/processor.h>
9#include <asm/io.h>
10#include "fsl_corenet2_serdes.h"
11
12struct serdes_config {
13 u32 protocol;
14 u8 lanes[SRDS_MAX_LANES];
15};
16
York Sun0fad3262016-11-21 13:35:41 -080017#ifdef CONFIG_ARCH_T4240
York Sun85e660f2013-03-25 07:33:28 +000018static const struct serdes_config serdes1_cfg_tbl[] = {
York Sun9941a222012-10-08 07:44:19 +000019 /* SerDes 1 */
20 {1, {XAUI_FM1_MAC9, XAUI_FM1_MAC9,
21 XAUI_FM1_MAC9, XAUI_FM1_MAC9,
22 XAUI_FM1_MAC10, XAUI_FM1_MAC10,
23 XAUI_FM1_MAC10, XAUI_FM1_MAC10}},
24 {2, {HIGIG_FM1_MAC9, HIGIG_FM1_MAC9,
25 HIGIG_FM1_MAC9, HIGIG_FM1_MAC9,
26 HIGIG_FM1_MAC10, HIGIG_FM1_MAC10,
27 HIGIG_FM1_MAC10, HIGIG_FM1_MAC10}},
28 {4, {HIGIG_FM1_MAC9, HIGIG_FM1_MAC9,
29 HIGIG_FM1_MAC9, HIGIG_FM1_MAC9,
30 HIGIG_FM1_MAC10, HIGIG_FM1_MAC10,
31 HIGIG_FM1_MAC10, HIGIG_FM1_MAC10}},
Shaohui Xied9a1d832014-05-16 10:52:33 +080032 {27, {SGMII_FM1_DTSEC5, SGMII_FM1_DTSEC6,
33 SGMII_FM1_DTSEC10, SGMII_FM1_DTSEC9,
34 SGMII_FM1_DTSEC1, SGMII_FM1_DTSEC2,
35 SGMII_FM1_DTSEC3, SGMII_FM1_DTSEC4} },
York Sun9941a222012-10-08 07:44:19 +000036 {28, {SGMII_FM1_DTSEC5, SGMII_FM1_DTSEC6,
37 SGMII_FM1_DTSEC10, SGMII_FM1_DTSEC9,
38 SGMII_FM1_DTSEC1, SGMII_FM1_DTSEC2,
39 SGMII_FM1_DTSEC3, SGMII_FM1_DTSEC4}},
Shaohui Xied9a1d832014-05-16 10:52:33 +080040 {35, {SGMII_FM1_DTSEC5, SGMII_FM1_DTSEC6,
41 SGMII_FM1_DTSEC10, SGMII_FM1_DTSEC9,
42 SGMII_FM1_DTSEC1, SGMII_FM1_DTSEC2,
43 SGMII_FM1_DTSEC3, SGMII_FM1_DTSEC4} },
York Sun9941a222012-10-08 07:44:19 +000044 {36, {SGMII_FM1_DTSEC5, SGMII_FM1_DTSEC6,
45 SGMII_FM1_DTSEC10, SGMII_FM1_DTSEC9,
46 SGMII_FM1_DTSEC1, SGMII_FM1_DTSEC2,
47 SGMII_FM1_DTSEC3, SGMII_FM1_DTSEC4}},
Shaohui Xied9a1d832014-05-16 10:52:33 +080048 {37, {NONE, NONE, QSGMII_FM1_B, NONE,
49 NONE, NONE, QSGMII_FM1_A, NONE} },
York Sun9941a222012-10-08 07:44:19 +000050 {38, {NONE, NONE, QSGMII_FM1_B, NONE,
51 NONE, NONE, QSGMII_FM1_A, NONE}},
Shaohui Xied9a1d832014-05-16 10:52:33 +080052 {39, {SGMII_FM1_DTSEC5, SGMII_FM1_DTSEC6,
53 SGMII_FM1_DTSEC10, SGMII_FM1_DTSEC9,
54 NONE, NONE, QSGMII_FM1_A, NONE} },
York Sun9941a222012-10-08 07:44:19 +000055 {40, {SGMII_FM1_DTSEC5, SGMII_FM1_DTSEC6,
56 SGMII_FM1_DTSEC10, SGMII_FM1_DTSEC9,
57 NONE, NONE, QSGMII_FM1_A, NONE}},
Shaohui Xied9a1d832014-05-16 10:52:33 +080058 {45, {SGMII_FM1_DTSEC5, SGMII_FM1_DTSEC6,
59 SGMII_FM1_DTSEC10, SGMII_FM1_DTSEC9,
60 NONE, NONE, QSGMII_FM1_A, NONE} },
York Sun9941a222012-10-08 07:44:19 +000061 {46, {SGMII_FM1_DTSEC5, SGMII_FM1_DTSEC6,
62 SGMII_FM1_DTSEC10, SGMII_FM1_DTSEC9,
63 NONE, NONE, QSGMII_FM1_A, NONE}},
Shaohui Xied9a1d832014-05-16 10:52:33 +080064 {47, {SGMII_FM1_DTSEC5, SGMII_FM1_DTSEC6,
65 SGMII_FM1_DTSEC10, SGMII_FM1_DTSEC9,
66 NONE, NONE, QSGMII_FM1_A, NONE} },
York Sun9941a222012-10-08 07:44:19 +000067 {48, {SGMII_FM1_DTSEC5, SGMII_FM1_DTSEC6,
68 SGMII_FM1_DTSEC10, SGMII_FM1_DTSEC9,
69 NONE, NONE, QSGMII_FM1_A, NONE}},
70 {}
71};
York Sun85e660f2013-03-25 07:33:28 +000072static const struct serdes_config serdes2_cfg_tbl[] = {
York Sun9941a222012-10-08 07:44:19 +000073 /* SerDes 2 */
74 {1, {XAUI_FM2_MAC9, XAUI_FM2_MAC9,
75 XAUI_FM2_MAC9, XAUI_FM2_MAC9,
76 XAUI_FM2_MAC10, XAUI_FM2_MAC10,
77 XAUI_FM2_MAC10, XAUI_FM2_MAC10}},
78 {2, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
79 HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
80 HIGIG_FM2_MAC10, HIGIG_FM2_MAC10,
81 HIGIG_FM2_MAC10, HIGIG_FM2_MAC10}},
82 {4, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
83 HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
84 HIGIG_FM2_MAC10, HIGIG_FM2_MAC10,
85 HIGIG_FM2_MAC10, HIGIG_FM2_MAC10}},
Shaohui Xied9a1d832014-05-16 10:52:33 +080086 {6, {XAUI_FM2_MAC9, XAUI_FM2_MAC9,
87 XAUI_FM2_MAC9, XAUI_FM2_MAC9,
88 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
89 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4} },
York Sun9941a222012-10-08 07:44:19 +000090 {7, {XAUI_FM2_MAC9, XAUI_FM2_MAC9,
91 XAUI_FM2_MAC9, XAUI_FM2_MAC9,
92 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
93 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4}},
Shaohui Xied9a1d832014-05-16 10:52:33 +080094 {12, {XAUI_FM2_MAC9, XAUI_FM2_MAC9,
95 XAUI_FM2_MAC9, XAUI_FM2_MAC9,
96 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
97 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4} },
York Sun9941a222012-10-08 07:44:19 +000098 {13, {XAUI_FM2_MAC9, XAUI_FM2_MAC9,
99 XAUI_FM2_MAC9, XAUI_FM2_MAC9,
100 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
101 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4}},
102 {14, {XAUI_FM2_MAC9, XAUI_FM2_MAC9,
103 XAUI_FM2_MAC9, XAUI_FM2_MAC9,
104 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
105 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4}},
Shaohui Xied9a1d832014-05-16 10:52:33 +0800106 {15, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
107 HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
108 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
109 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4} },
York Sun9941a222012-10-08 07:44:19 +0000110 {16, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
111 HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
112 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
113 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4}},
Shaohui Xied9a1d832014-05-16 10:52:33 +0800114 {21, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
115 HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
116 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
117 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4} },
York Sun9941a222012-10-08 07:44:19 +0000118 {22, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
119 HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
120 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
121 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4}},
122 {23, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
123 HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
124 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
125 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4}},
Shaohui Xied9a1d832014-05-16 10:52:33 +0800126 {24, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
127 HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
128 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
129 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4} },
York Sun9941a222012-10-08 07:44:19 +0000130 {25, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
131 HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
132 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
133 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4}},
134 {26, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
135 HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
136 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
137 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4}},
Shaohui Xied9a1d832014-05-16 10:52:33 +0800138 {27, {SGMII_FM2_DTSEC5, SGMII_FM2_DTSEC6,
139 SGMII_FM2_DTSEC10, SGMII_FM2_DTSEC9,
140 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
141 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4} },
York Sun9941a222012-10-08 07:44:19 +0000142 {28, {SGMII_FM2_DTSEC5, SGMII_FM2_DTSEC6,
143 SGMII_FM2_DTSEC10, SGMII_FM2_DTSEC9,
144 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
145 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4}},
Shaohui Xied9a1d832014-05-16 10:52:33 +0800146 {35, {SGMII_FM2_DTSEC5, SGMII_FM2_DTSEC6,
147 SGMII_FM2_DTSEC10, SGMII_FM2_DTSEC9,
148 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
149 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4} },
York Sun9941a222012-10-08 07:44:19 +0000150 {36, {SGMII_FM2_DTSEC5, SGMII_FM2_DTSEC6,
151 SGMII_FM2_DTSEC10, SGMII_FM2_DTSEC9,
152 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
153 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4}},
Shaohui Xied9a1d832014-05-16 10:52:33 +0800154 {37, {NONE, NONE, QSGMII_FM2_B, NONE,
155 NONE, NONE, QSGMII_FM2_A, NONE} },
York Sun9941a222012-10-08 07:44:19 +0000156 {38, {NONE, NONE, QSGMII_FM2_B, NONE,
Shaohui Xiec218d292013-08-19 18:58:52 +0800157 NONE, NONE, QSGMII_FM2_A, NONE} },
Shaohui Xied9a1d832014-05-16 10:52:33 +0800158 {39, {SGMII_FM2_DTSEC5, SGMII_FM2_DTSEC6,
159 SGMII_FM2_DTSEC10, SGMII_FM2_DTSEC9,
160 NONE, NONE, QSGMII_FM2_A, NONE} },
York Sun9941a222012-10-08 07:44:19 +0000161 {40, {SGMII_FM2_DTSEC5, SGMII_FM2_DTSEC6,
162 SGMII_FM2_DTSEC10, SGMII_FM2_DTSEC9,
Shaohui Xiec218d292013-08-19 18:58:52 +0800163 NONE, NONE, QSGMII_FM2_A, NONE} },
Shaohui Xied9a1d832014-05-16 10:52:33 +0800164 {45, {SGMII_FM2_DTSEC5, SGMII_FM2_DTSEC6,
165 SGMII_FM2_DTSEC10, SGMII_FM2_DTSEC9,
166 NONE, NONE, QSGMII_FM2_A, NONE} },
York Sun9941a222012-10-08 07:44:19 +0000167 {46, {SGMII_FM2_DTSEC5, SGMII_FM2_DTSEC6,
168 SGMII_FM2_DTSEC10, SGMII_FM2_DTSEC9,
Shaohui Xiec218d292013-08-19 18:58:52 +0800169 NONE, NONE, QSGMII_FM2_A, NONE} },
Shaohui Xied9a1d832014-05-16 10:52:33 +0800170 {47, {SGMII_FM2_DTSEC5, SGMII_FM2_DTSEC6,
171 SGMII_FM2_DTSEC10, SGMII_FM2_DTSEC9,
172 NONE, NONE, QSGMII_FM2_A, NONE} },
York Sun9941a222012-10-08 07:44:19 +0000173 {48, {SGMII_FM2_DTSEC5, SGMII_FM2_DTSEC6,
174 SGMII_FM2_DTSEC10, SGMII_FM2_DTSEC9,
Shaohui Xiec218d292013-08-19 18:58:52 +0800175 NONE, NONE, QSGMII_FM2_A, NONE} },
Shaohui Xied9a1d832014-05-16 10:52:33 +0800176 {49, {XAUI_FM2_MAC9, XAUI_FM2_MAC9,
177 XAUI_FM2_MAC9, XAUI_FM2_MAC9,
178 NONE, NONE, QSGMII_FM2_A, NONE} },
York Sun9941a222012-10-08 07:44:19 +0000179 {50, {XAUI_FM2_MAC9, XAUI_FM2_MAC9,
180 XAUI_FM2_MAC9, XAUI_FM2_MAC9,
Shaohui Xiec218d292013-08-19 18:58:52 +0800181 NONE, NONE, QSGMII_FM2_A, NONE} },
Shaohui Xied9a1d832014-05-16 10:52:33 +0800182 {51, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
183 HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
184 NONE, NONE, QSGMII_FM2_A, NONE} },
York Sun9941a222012-10-08 07:44:19 +0000185 {52, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
186 HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
Shaohui Xiec218d292013-08-19 18:58:52 +0800187 NONE, NONE, QSGMII_FM2_A, NONE} },
Shaohui Xied9a1d832014-05-16 10:52:33 +0800188 {53, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
189 HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
190 NONE, NONE, QSGMII_FM2_A, NONE} },
York Sun9941a222012-10-08 07:44:19 +0000191 {54, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
192 HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
Shaohui Xiec218d292013-08-19 18:58:52 +0800193 NONE, NONE, QSGMII_FM2_A, NONE} },
Shaohui Xied9a1d832014-05-16 10:52:33 +0800194 {55, {XFI_FM1_MAC9, XFI_FM1_MAC10,
195 XFI_FM2_MAC10, XFI_FM2_MAC9,
196 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
197 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4} },
York Sun9941a222012-10-08 07:44:19 +0000198 {56, {XFI_FM1_MAC9, XFI_FM1_MAC10,
199 XFI_FM2_MAC10, XFI_FM2_MAC9,
200 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
201 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4}},
202 {57, {XFI_FM1_MAC9, XFI_FM1_MAC10,
203 XFI_FM2_MAC10, XFI_FM2_MAC9,
204 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
205 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4}},
206 {}
207};
York Sun85e660f2013-03-25 07:33:28 +0000208static const struct serdes_config serdes3_cfg_tbl[] = {
York Sun9941a222012-10-08 07:44:19 +0000209 /* SerDes 3 */
Shaohui Xied9a1d832014-05-16 10:52:33 +0800210 {1, {PCIE1, PCIE1, PCIE1, PCIE1, PCIE1, PCIE1, PCIE1, PCIE1} },
York Sun9941a222012-10-08 07:44:19 +0000211 {2, {PCIE1, PCIE1, PCIE1, PCIE1, PCIE1, PCIE1, PCIE1, PCIE1}},
Shaohui Xied9a1d832014-05-16 10:52:33 +0800212 {3, {PCIE1, PCIE1, PCIE1, PCIE1, PCIE2, PCIE2, PCIE2, PCIE2} },
York Sun9941a222012-10-08 07:44:19 +0000213 {4, {PCIE1, PCIE1, PCIE1, PCIE1, PCIE2, PCIE2, PCIE2, PCIE2}},
Shaohui Xied9a1d832014-05-16 10:52:33 +0800214 {5, {PCIE1, PCIE1, PCIE1, PCIE1, SRIO1, SRIO1, SRIO1, SRIO1} },
York Sun9941a222012-10-08 07:44:19 +0000215 {6, {PCIE1, PCIE1, PCIE1, PCIE1, SRIO1, SRIO1, SRIO1, SRIO1}},
Shaohui Xie0a8a3972015-07-29 11:28:36 +0800216 {7, {PCIE1, PCIE1, PCIE1, PCIE1, SRIO1, SRIO1, SRIO1, SRIO1} },
217 {8, {PCIE1, PCIE1, PCIE1, PCIE1, SRIO1, SRIO1, SRIO1, SRIO1} },
York Sun9941a222012-10-08 07:44:19 +0000218 {9, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN,
219 INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN}},
220 {10, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN,
221 INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN}},
Shaohui Xied9a1d832014-05-16 10:52:33 +0800222 {11, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN,
223 PCIE2, PCIE2, PCIE2, PCIE2} },
York Sun9941a222012-10-08 07:44:19 +0000224 {12, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN,
225 PCIE2, PCIE2, PCIE2, PCIE2}},
Shaohui Xied9a1d832014-05-16 10:52:33 +0800226 {13, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN,
227 PCIE2, PCIE2, PCIE2, PCIE2} },
York Sun9941a222012-10-08 07:44:19 +0000228 {14, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN,
229 PCIE2, PCIE2, PCIE2, PCIE2}},
Shaohui Xied9a1d832014-05-16 10:52:33 +0800230 {15, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN,
231 SRIO1, SRIO1, SRIO1, SRIO1} },
York Sun9941a222012-10-08 07:44:19 +0000232 {16, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN,
233 SRIO1, SRIO1, SRIO1, SRIO1}},
234 {17, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN,
235 SRIO1, SRIO1, SRIO1, SRIO1}},
Shaohui Xied9a1d832014-05-16 10:52:33 +0800236 {18, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN,
237 SRIO1, SRIO1, SRIO1, SRIO1} },
York Sun9941a222012-10-08 07:44:19 +0000238 {19, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN,
239 SRIO1, SRIO1, SRIO1, SRIO1}},
240 {20, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN,
241 SRIO1, SRIO1, SRIO1, SRIO1}},
242 {}
243};
York Sun85e660f2013-03-25 07:33:28 +0000244static const struct serdes_config serdes4_cfg_tbl[] = {
York Sun9941a222012-10-08 07:44:19 +0000245 /* SerDes 4 */
Shaohui Xied9a1d832014-05-16 10:52:33 +0800246 {1, {PCIE3, PCIE3, PCIE3, PCIE3, PCIE3, PCIE3, PCIE3, PCIE3} },
York Sun9941a222012-10-08 07:44:19 +0000247 {2, {PCIE3, PCIE3, PCIE3, PCIE3, PCIE3, PCIE3, PCIE3, PCIE3}},
Shaohui Xied9a1d832014-05-16 10:52:33 +0800248 {3, {PCIE3, PCIE3, PCIE3, PCIE3, PCIE4, PCIE4, PCIE4, PCIE4} },
York Sun9941a222012-10-08 07:44:19 +0000249 {4, {PCIE3, PCIE3, PCIE3, PCIE3, PCIE4, PCIE4, PCIE4, PCIE4}},
Shaohui Xied9a1d832014-05-16 10:52:33 +0800250 {5, {PCIE3, PCIE3, PCIE3, PCIE3, SRIO2, SRIO2, SRIO2, SRIO2} },
York Sun9941a222012-10-08 07:44:19 +0000251 {6, {PCIE3, PCIE3, PCIE3, PCIE3, SRIO2, SRIO2, SRIO2, SRIO2}},
Shaohui Xied9a1d832014-05-16 10:52:33 +0800252 {7, {PCIE3, PCIE3, PCIE3, PCIE3, SRIO2, SRIO2, SRIO2, SRIO2} },
York Sun9941a222012-10-08 07:44:19 +0000253 {8, {PCIE3, PCIE3, PCIE3, PCIE3, SRIO2, SRIO2, SRIO2, SRIO2}},
Shaohui Xied9a1d832014-05-16 10:52:33 +0800254 {9, {PCIE3, PCIE3, PCIE3, PCIE3, PCIE4, PCIE4, SATA1, SATA2} },
Roy Zangcc117ce2013-03-25 07:33:18 +0000255 {10, {PCIE3, PCIE3, PCIE3, PCIE3, PCIE4, PCIE4, SATA1, SATA2} },
Shaohui Xied9a1d832014-05-16 10:52:33 +0800256 {11, {PCIE3, PCIE3, PCIE3, PCIE3, AURORA, AURORA, SATA1, SATA2} },
Roy Zangcc117ce2013-03-25 07:33:18 +0000257 {12, {PCIE3, PCIE3, PCIE3, PCIE3, AURORA, AURORA, SATA1, SATA2} },
Shaohui Xied9a1d832014-05-16 10:52:33 +0800258 {13, {PCIE3, PCIE3, PCIE3, PCIE3, AURORA, AURORA, SRIO2, SRIO2} },
York Sun9941a222012-10-08 07:44:19 +0000259 {14, {PCIE3, PCIE3, PCIE3, PCIE3, AURORA, AURORA, SRIO2, SRIO2}},
Shaohui Xied9a1d832014-05-16 10:52:33 +0800260 {15, {PCIE3, PCIE3, PCIE3, PCIE3, AURORA, AURORA, SRIO2, SRIO2} },
York Sun9941a222012-10-08 07:44:19 +0000261 {16, {PCIE3, PCIE3, PCIE3, PCIE3, AURORA, AURORA, SRIO2, SRIO2}},
262 {18, {PCIE3, PCIE3, PCIE3, PCIE3, AURORA, AURORA, AURORA, AURORA}},
263 {}
264};
York Sunc1845032016-11-21 13:41:30 -0800265#elif defined(CONFIG_ARCH_T4160)
York Sunfb5137a2013-03-25 07:33:29 +0000266static const struct serdes_config serdes1_cfg_tbl[] = {
267 /* SerDes 1 */
Shaohui Xie0a8a3972015-07-29 11:28:36 +0800268 {1, {NONE, NONE, NONE, NONE,
York Sunfb5137a2013-03-25 07:33:29 +0000269 XAUI_FM1_MAC10, XAUI_FM1_MAC10,
270 XAUI_FM1_MAC10, XAUI_FM1_MAC10} },
Shaohui Xie0a8a3972015-07-29 11:28:36 +0800271 {2, {NONE, NONE, NONE, NONE,
York Sunfb5137a2013-03-25 07:33:29 +0000272 HIGIG_FM1_MAC10, HIGIG_FM1_MAC10,
273 HIGIG_FM1_MAC10, HIGIG_FM1_MAC10} },
Shaohui Xie0a8a3972015-07-29 11:28:36 +0800274 {4, {NONE, NONE, NONE, NONE,
York Sunfb5137a2013-03-25 07:33:29 +0000275 HIGIG_FM1_MAC10, HIGIG_FM1_MAC10,
276 HIGIG_FM1_MAC10, HIGIG_FM1_MAC10} },
Shaohui Xie0a8a3972015-07-29 11:28:36 +0800277 {27, {NONE, NONE, NONE, NONE,
Shaohui Xied9a1d832014-05-16 10:52:33 +0800278 SGMII_FM1_DTSEC1, SGMII_FM1_DTSEC2,
279 SGMII_FM1_DTSEC3, SGMII_FM1_DTSEC4} },
Shaohui Xie0a8a3972015-07-29 11:28:36 +0800280 {28, {NONE, NONE, NONE, NONE,
York Sunfb5137a2013-03-25 07:33:29 +0000281 SGMII_FM1_DTSEC1, SGMII_FM1_DTSEC2,
282 SGMII_FM1_DTSEC3, SGMII_FM1_DTSEC4} },
Shaohui Xie0a8a3972015-07-29 11:28:36 +0800283 {35, {NONE, NONE, NONE, NONE,
Shaohui Xied9a1d832014-05-16 10:52:33 +0800284 SGMII_FM1_DTSEC1, SGMII_FM1_DTSEC2,
285 SGMII_FM1_DTSEC3, SGMII_FM1_DTSEC4} },
Shaohui Xie0a8a3972015-07-29 11:28:36 +0800286 {36, {NONE, NONE, NONE, NONE,
York Sunfb5137a2013-03-25 07:33:29 +0000287 SGMII_FM1_DTSEC1, SGMII_FM1_DTSEC2,
288 SGMII_FM1_DTSEC3, SGMII_FM1_DTSEC4} },
Shaohui Xie0a8a3972015-07-29 11:28:36 +0800289 {37, {NONE, NONE, NONE, NONE,
Shaohui Xied9a1d832014-05-16 10:52:33 +0800290 NONE, NONE, QSGMII_FM1_A, NONE} },
Shaohui Xie0a8a3972015-07-29 11:28:36 +0800291 {38, {NONE, NONE, NONE, NONE,
York Sunfb5137a2013-03-25 07:33:29 +0000292 NONE, NONE, QSGMII_FM1_A, NONE} },
293 {}
294};
295static const struct serdes_config serdes2_cfg_tbl[] = {
296 /* SerDes 2 */
Shaohui Xied9a1d832014-05-16 10:52:33 +0800297 {6, {XAUI_FM2_MAC9, XAUI_FM2_MAC9,
298 XAUI_FM2_MAC9, XAUI_FM2_MAC9,
299 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
300 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4} },
York Sunfb5137a2013-03-25 07:33:29 +0000301 {7, {XAUI_FM2_MAC9, XAUI_FM2_MAC9,
302 XAUI_FM2_MAC9, XAUI_FM2_MAC9,
303 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
304 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4} },
Shaohui Xied9a1d832014-05-16 10:52:33 +0800305 {12, {XAUI_FM2_MAC9, XAUI_FM2_MAC9,
306 XAUI_FM2_MAC9, XAUI_FM2_MAC9,
307 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
308 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4} },
York Sunfb5137a2013-03-25 07:33:29 +0000309 {13, {XAUI_FM2_MAC9, XAUI_FM2_MAC9,
310 XAUI_FM2_MAC9, XAUI_FM2_MAC9,
311 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
312 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4} },
Shaohui Xied9a1d832014-05-16 10:52:33 +0800313 {15, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
314 HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
315 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
316 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4} },
York Sunfb5137a2013-03-25 07:33:29 +0000317 {16, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
318 HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
319 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
320 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4} },
Shaohui Xied9a1d832014-05-16 10:52:33 +0800321 {21, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
322 HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
323 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
324 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4} },
York Sunfb5137a2013-03-25 07:33:29 +0000325 {22, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
326 HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
327 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
328 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4} },
Shaohui Xied9a1d832014-05-16 10:52:33 +0800329 {24, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
330 HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
331 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
332 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4} },
York Sunfb5137a2013-03-25 07:33:29 +0000333 {25, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
334 HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
335 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
336 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4} },
337 {26, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
338 HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
339 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
340 NONE, NONE} },
Shaohui Xied9a1d832014-05-16 10:52:33 +0800341 {27, {SGMII_FM2_DTSEC5, SGMII_FM2_DTSEC6,
342 SGMII_FM2_DTSEC10, SGMII_FM2_DTSEC9,
343 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
344 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4} },
York Sunfb5137a2013-03-25 07:33:29 +0000345 {28, {SGMII_FM2_DTSEC5, SGMII_FM2_DTSEC6,
346 SGMII_FM2_DTSEC10, SGMII_FM2_DTSEC9,
347 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
348 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4} },
Shaohui Xied9a1d832014-05-16 10:52:33 +0800349 {35, {SGMII_FM2_DTSEC5, SGMII_FM2_DTSEC6,
350 SGMII_FM2_DTSEC10, SGMII_FM2_DTSEC9,
351 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
352 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4} },
York Sunfb5137a2013-03-25 07:33:29 +0000353 {36, {SGMII_FM2_DTSEC5, SGMII_FM2_DTSEC6,
354 SGMII_FM2_DTSEC10, SGMII_FM2_DTSEC9,
355 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
356 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4} },
Shaohui Xied9a1d832014-05-16 10:52:33 +0800357 {37, {NONE, NONE, QSGMII_FM2_B, NONE,
Shaohui Xie0a8a3972015-07-29 11:28:36 +0800358 NONE, NONE, QSGMII_FM2_A, NONE} },
York Sunfb5137a2013-03-25 07:33:29 +0000359 {38, {NONE, NONE, QSGMII_FM2_B, NONE,
Shaohui Xie0a8a3972015-07-29 11:28:36 +0800360 NONE, NONE, QSGMII_FM2_A, NONE} },
Shaohui Xied9a1d832014-05-16 10:52:33 +0800361 {39, {SGMII_FM2_DTSEC5, SGMII_FM2_DTSEC6,
362 SGMII_FM2_DTSEC10, SGMII_FM2_DTSEC9,
Shaohui Xie0a8a3972015-07-29 11:28:36 +0800363 NONE, NONE, QSGMII_FM2_A, NONE} },
York Sunfb5137a2013-03-25 07:33:29 +0000364 {40, {SGMII_FM2_DTSEC5, SGMII_FM2_DTSEC6,
365 SGMII_FM2_DTSEC10, SGMII_FM2_DTSEC9,
Shaohui Xie0a8a3972015-07-29 11:28:36 +0800366 NONE, NONE, QSGMII_FM2_A, NONE} },
Shaohui Xied9a1d832014-05-16 10:52:33 +0800367 {45, {SGMII_FM2_DTSEC5, SGMII_FM2_DTSEC6,
368 SGMII_FM2_DTSEC10, SGMII_FM2_DTSEC9,
Shaohui Xie0a8a3972015-07-29 11:28:36 +0800369 NONE, NONE, QSGMII_FM2_A, NONE} },
York Sunfb5137a2013-03-25 07:33:29 +0000370 {46, {SGMII_FM2_DTSEC5, SGMII_FM2_DTSEC6,
371 SGMII_FM2_DTSEC10, SGMII_FM2_DTSEC9,
Shaohui Xie0a8a3972015-07-29 11:28:36 +0800372 NONE, NONE, QSGMII_FM2_A, NONE} },
Shaohui Xied9a1d832014-05-16 10:52:33 +0800373 {47, {SGMII_FM2_DTSEC5, SGMII_FM2_DTSEC6,
374 SGMII_FM2_DTSEC10, SGMII_FM2_DTSEC9,
Shaohui Xie0a8a3972015-07-29 11:28:36 +0800375 NONE, NONE, QSGMII_FM2_A, NONE} },
York Sunfb5137a2013-03-25 07:33:29 +0000376 {48, {SGMII_FM2_DTSEC5, SGMII_FM2_DTSEC6,
377 SGMII_FM2_DTSEC10, SGMII_FM2_DTSEC9,
Shaohui Xie0a8a3972015-07-29 11:28:36 +0800378 NONE, NONE, QSGMII_FM2_A, NONE} },
Shaohui Xied9a1d832014-05-16 10:52:33 +0800379 {49, {XAUI_FM2_MAC9, XAUI_FM2_MAC9,
380 XAUI_FM2_MAC9, XAUI_FM2_MAC9,
Shaohui Xie0a8a3972015-07-29 11:28:36 +0800381 NONE, NONE, QSGMII_FM2_A, NONE} },
York Sunfb5137a2013-03-25 07:33:29 +0000382 {50, {XAUI_FM2_MAC9, XAUI_FM2_MAC9,
383 XAUI_FM2_MAC9, XAUI_FM2_MAC9,
Shaohui Xie0a8a3972015-07-29 11:28:36 +0800384 NONE, NONE, QSGMII_FM2_A, NONE} },
Shaohui Xied9a1d832014-05-16 10:52:33 +0800385 {51, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
386 HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
Shaohui Xie0a8a3972015-07-29 11:28:36 +0800387 NONE, NONE, QSGMII_FM2_A, NONE} },
York Sunfb5137a2013-03-25 07:33:29 +0000388 {52, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
389 HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
Shaohui Xie0a8a3972015-07-29 11:28:36 +0800390 NONE, NONE, QSGMII_FM2_A, NONE} },
Shaohui Xied9a1d832014-05-16 10:52:33 +0800391 {53, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
392 HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
Shaohui Xie0a8a3972015-07-29 11:28:36 +0800393 NONE, NONE, QSGMII_FM2_A, NONE} },
York Sunfb5137a2013-03-25 07:33:29 +0000394 {54, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
395 HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
Shaohui Xie0a8a3972015-07-29 11:28:36 +0800396 NONE, NONE, QSGMII_FM2_A, NONE} },
Shaohui Xied9a1d832014-05-16 10:52:33 +0800397 {55, {NONE, XFI_FM1_MAC10,
398 XFI_FM2_MAC10, NONE,
399 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
400 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4} },
York Sunfb5137a2013-03-25 07:33:29 +0000401 {56, {NONE, XFI_FM1_MAC10,
402 XFI_FM2_MAC10, NONE,
403 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
404 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4} },
405 {57, {NONE, XFI_FM1_MAC10,
406 XFI_FM2_MAC10, NONE,
407 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
408 NONE, NONE} },
409 {}
410};
411static const struct serdes_config serdes3_cfg_tbl[] = {
412 /* SerDes 3 */
Shaohui Xied9a1d832014-05-16 10:52:33 +0800413 {1, {PCIE1, PCIE1, PCIE1, PCIE1, PCIE1, PCIE1, PCIE1, PCIE1} },
York Sunfb5137a2013-03-25 07:33:29 +0000414 {2, {PCIE1, PCIE1, PCIE1, PCIE1, PCIE1, PCIE1, PCIE1, PCIE1} },
Shaohui Xied9a1d832014-05-16 10:52:33 +0800415 {3, {PCIE1, PCIE1, PCIE1, PCIE1, PCIE2, PCIE2, PCIE2, PCIE2} },
York Sunfb5137a2013-03-25 07:33:29 +0000416 {4, {PCIE1, PCIE1, PCIE1, PCIE1, PCIE2, PCIE2, PCIE2, PCIE2} },
Shaohui Xied9a1d832014-05-16 10:52:33 +0800417 {5, {PCIE1, PCIE1, PCIE1, PCIE1, SRIO1, SRIO1, SRIO1, SRIO1} },
York Sunfb5137a2013-03-25 07:33:29 +0000418 {6, {PCIE1, PCIE1, PCIE1, PCIE1, SRIO1, SRIO1, SRIO1, SRIO1} },
Shaohui Xie0a8a3972015-07-29 11:28:36 +0800419 {7, {PCIE1, PCIE1, PCIE1, PCIE1, SRIO1, SRIO1, SRIO1, SRIO1} },
420 {8, {PCIE1, PCIE1, PCIE1, PCIE1, SRIO1, SRIO1, SRIO1, SRIO1} },
York Sunfb5137a2013-03-25 07:33:29 +0000421 {9, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN,
422 INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN} },
423 {10, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN,
424 INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN} },
Shaohui Xie0a8a3972015-07-29 11:28:36 +0800425 {11, {NONE, NONE, NONE, NONE,
Shaohui Xied9a1d832014-05-16 10:52:33 +0800426 PCIE2, PCIE2, PCIE2, PCIE2} },
Shaohui Xie0a8a3972015-07-29 11:28:36 +0800427 {12, {NONE, NONE, NONE, NONE,
York Sunfb5137a2013-03-25 07:33:29 +0000428 PCIE2, PCIE2, PCIE2, PCIE2} },
Shaohui Xied9a1d832014-05-16 10:52:33 +0800429 {13, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN,
430 PCIE2, PCIE2, PCIE2, PCIE2} },
York Sunfb5137a2013-03-25 07:33:29 +0000431 {14, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN,
432 PCIE2, PCIE2, PCIE2, PCIE2} },
Shaohui Xie0a8a3972015-07-29 11:28:36 +0800433 {15, {NONE, NONE, NONE, NONE,
Shaohui Xied9a1d832014-05-16 10:52:33 +0800434 SRIO1, SRIO1, SRIO1, SRIO1} },
Shaohui Xie0a8a3972015-07-29 11:28:36 +0800435 {16, {NONE, NONE, NONE, NONE,
York Sunfb5137a2013-03-25 07:33:29 +0000436 SRIO1, SRIO1, SRIO1, SRIO1} },
Shaohui Xie0a8a3972015-07-29 11:28:36 +0800437 {17, {NONE, NONE, NONE, NONE,
York Sunfb5137a2013-03-25 07:33:29 +0000438 SRIO1, SRIO1, SRIO1, SRIO1} },
Shaohui Xied9a1d832014-05-16 10:52:33 +0800439 {18, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN,
440 SRIO1, SRIO1, SRIO1, SRIO1} },
York Sunfb5137a2013-03-25 07:33:29 +0000441 {19, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN,
442 SRIO1, SRIO1, SRIO1, SRIO1} },
443 {20, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN,
Shaohui Xie0a8a3972015-07-29 11:28:36 +0800444 SRIO1, SRIO1, SRIO1, SRIO1} },
York Sunfb5137a2013-03-25 07:33:29 +0000445 {}
446};
447static const struct serdes_config serdes4_cfg_tbl[] = {
448 /* SerDes 4 */
Shaohui Xie0a8a3972015-07-29 11:28:36 +0800449 {3, {NONE, NONE, NONE, NONE, PCIE4, PCIE4, PCIE4, PCIE4} },
450 {4, {NONE, NONE, NONE, NONE, PCIE4, PCIE4, PCIE4, PCIE4} },
451 {5, {NONE, NONE, NONE, NONE, SRIO2, SRIO2, SRIO2, SRIO2} },
452 {6, {NONE, NONE, NONE, NONE, SRIO2, SRIO2, SRIO2, SRIO2} },
453 {7, {NONE, NONE, NONE, NONE, SRIO2, SRIO2, SRIO2, SRIO2} },
454 {8, {NONE, NONE, NONE, NONE, SRIO2, SRIO2, SRIO2, SRIO2} },
455 {9, {NONE, NONE, NONE, NONE, PCIE4, PCIE4, SATA1, SATA2} },
456 {10, {NONE, NONE, NONE, NONE, PCIE4, PCIE4, SATA1, SATA2} },
457 {11, {NONE, NONE, NONE, NONE, AURORA, AURORA, SATA1, SATA2} },
458 {12, {NONE, NONE, NONE, NONE, AURORA, AURORA, SATA1, SATA2} },
459 {13, {NONE, NONE, NONE, NONE, AURORA, AURORA, SRIO2, SRIO2} },
460 {14, {NONE, NONE, NONE, NONE, AURORA, AURORA, SRIO2, SRIO2} },
461 {15, {NONE, NONE, NONE, NONE, AURORA, AURORA, SRIO2, SRIO2} },
462 {16, {NONE, NONE, NONE, NONE, AURORA, AURORA, SRIO2, SRIO2} },
463 {18, {NONE, NONE, NONE, NONE, AURORA, AURORA, AURORA, AURORA} },
York Sunfb5137a2013-03-25 07:33:29 +0000464 {}
465}
466;
467#else
468#error "Need to define SerDes protocol"
469#endif
York Sun85e660f2013-03-25 07:33:28 +0000470static const struct serdes_config *serdes_cfg_tbl[] = {
York Sun9941a222012-10-08 07:44:19 +0000471 serdes1_cfg_tbl,
472 serdes2_cfg_tbl,
473 serdes3_cfg_tbl,
474 serdes4_cfg_tbl,
475};
476
477enum srds_prtcl serdes_get_prtcl(int serdes, int cfg, int lane)
478{
York Sun85e660f2013-03-25 07:33:28 +0000479 const struct serdes_config *ptr;
York Sun9941a222012-10-08 07:44:19 +0000480
481 if (serdes >= ARRAY_SIZE(serdes_cfg_tbl))
482 return 0;
483
484 ptr = serdes_cfg_tbl[serdes];
485 while (ptr->protocol) {
486 if (ptr->protocol == cfg)
487 return ptr->lanes[lane];
488 ptr++;
489 }
490 return 0;
491}
492
493int is_serdes_prtcl_valid(int serdes, u32 prtcl)
494{
495 int i;
York Sun85e660f2013-03-25 07:33:28 +0000496 const struct serdes_config *ptr;
York Sun9941a222012-10-08 07:44:19 +0000497
498 if (serdes >= ARRAY_SIZE(serdes_cfg_tbl))
499 return 0;
500
501 ptr = serdes_cfg_tbl[serdes];
502 while (ptr->protocol) {
503 if (ptr->protocol == prtcl)
504 break;
505 ptr++;
506 }
507
508 if (!ptr->protocol)
509 return 0;
510
511 for (i = 0; i < SRDS_MAX_LANES; i++) {
512 if (ptr->lanes[i] != NONE)
513 return 1;
514 }
515
516 return 0;
517}