blob: 7b43b282bb6f5014c6f13933777aeb56bcf5d993 [file] [log] [blame]
York Sun9e758752012-10-08 07:44:19 +00001/*
2 * Copyright 2012 Freescale Semiconductor, Inc.
3 *
Wolfgang Denk1a459662013-07-08 09:37:19 +02004 * SPDX-License-Identifier: GPL-2.0+
York Sun9e758752012-10-08 07:44:19 +00005 */
6
7#include <common.h>
8#include <asm/fsl_serdes.h>
9#include <asm/processor.h>
10#include <asm/io.h>
11#include "fsl_corenet2_serdes.h"
12
13struct serdes_config {
14 u32 protocol;
15 u8 lanes[SRDS_MAX_LANES];
16};
17
York Sunb6240842013-03-25 07:33:29 +000018#ifdef CONFIG_PPC_T4240
York Sun924859a2013-03-25 07:33:28 +000019static const struct serdes_config serdes1_cfg_tbl[] = {
York Sun9e758752012-10-08 07:44:19 +000020 /* SerDes 1 */
21 {1, {XAUI_FM1_MAC9, XAUI_FM1_MAC9,
22 XAUI_FM1_MAC9, XAUI_FM1_MAC9,
23 XAUI_FM1_MAC10, XAUI_FM1_MAC10,
24 XAUI_FM1_MAC10, XAUI_FM1_MAC10}},
25 {2, {HIGIG_FM1_MAC9, HIGIG_FM1_MAC9,
26 HIGIG_FM1_MAC9, HIGIG_FM1_MAC9,
27 HIGIG_FM1_MAC10, HIGIG_FM1_MAC10,
28 HIGIG_FM1_MAC10, HIGIG_FM1_MAC10}},
29 {4, {HIGIG_FM1_MAC9, HIGIG_FM1_MAC9,
30 HIGIG_FM1_MAC9, HIGIG_FM1_MAC9,
31 HIGIG_FM1_MAC10, HIGIG_FM1_MAC10,
32 HIGIG_FM1_MAC10, HIGIG_FM1_MAC10}},
Shaohui Xie94752f62014-05-16 10:52:33 +080033 {27, {SGMII_FM1_DTSEC5, SGMII_FM1_DTSEC6,
34 SGMII_FM1_DTSEC10, SGMII_FM1_DTSEC9,
35 SGMII_FM1_DTSEC1, SGMII_FM1_DTSEC2,
36 SGMII_FM1_DTSEC3, SGMII_FM1_DTSEC4} },
York Sun9e758752012-10-08 07:44:19 +000037 {28, {SGMII_FM1_DTSEC5, SGMII_FM1_DTSEC6,
38 SGMII_FM1_DTSEC10, SGMII_FM1_DTSEC9,
39 SGMII_FM1_DTSEC1, SGMII_FM1_DTSEC2,
40 SGMII_FM1_DTSEC3, SGMII_FM1_DTSEC4}},
Shaohui Xie94752f62014-05-16 10:52:33 +080041 {35, {SGMII_FM1_DTSEC5, SGMII_FM1_DTSEC6,
42 SGMII_FM1_DTSEC10, SGMII_FM1_DTSEC9,
43 SGMII_FM1_DTSEC1, SGMII_FM1_DTSEC2,
44 SGMII_FM1_DTSEC3, SGMII_FM1_DTSEC4} },
York Sun9e758752012-10-08 07:44:19 +000045 {36, {SGMII_FM1_DTSEC5, SGMII_FM1_DTSEC6,
46 SGMII_FM1_DTSEC10, SGMII_FM1_DTSEC9,
47 SGMII_FM1_DTSEC1, SGMII_FM1_DTSEC2,
48 SGMII_FM1_DTSEC3, SGMII_FM1_DTSEC4}},
Shaohui Xie94752f62014-05-16 10:52:33 +080049 {37, {NONE, NONE, QSGMII_FM1_B, NONE,
50 NONE, NONE, QSGMII_FM1_A, NONE} },
York Sun9e758752012-10-08 07:44:19 +000051 {38, {NONE, NONE, QSGMII_FM1_B, NONE,
52 NONE, NONE, QSGMII_FM1_A, NONE}},
Shaohui Xie94752f62014-05-16 10:52:33 +080053 {39, {SGMII_FM1_DTSEC5, SGMII_FM1_DTSEC6,
54 SGMII_FM1_DTSEC10, SGMII_FM1_DTSEC9,
55 NONE, NONE, QSGMII_FM1_A, NONE} },
York Sun9e758752012-10-08 07:44:19 +000056 {40, {SGMII_FM1_DTSEC5, SGMII_FM1_DTSEC6,
57 SGMII_FM1_DTSEC10, SGMII_FM1_DTSEC9,
58 NONE, NONE, QSGMII_FM1_A, NONE}},
Shaohui Xie94752f62014-05-16 10:52:33 +080059 {45, {SGMII_FM1_DTSEC5, SGMII_FM1_DTSEC6,
60 SGMII_FM1_DTSEC10, SGMII_FM1_DTSEC9,
61 NONE, NONE, QSGMII_FM1_A, NONE} },
York Sun9e758752012-10-08 07:44:19 +000062 {46, {SGMII_FM1_DTSEC5, SGMII_FM1_DTSEC6,
63 SGMII_FM1_DTSEC10, SGMII_FM1_DTSEC9,
64 NONE, NONE, QSGMII_FM1_A, NONE}},
Shaohui Xie94752f62014-05-16 10:52:33 +080065 {47, {SGMII_FM1_DTSEC5, SGMII_FM1_DTSEC6,
66 SGMII_FM1_DTSEC10, SGMII_FM1_DTSEC9,
67 NONE, NONE, QSGMII_FM1_A, NONE} },
York Sun9e758752012-10-08 07:44:19 +000068 {48, {SGMII_FM1_DTSEC5, SGMII_FM1_DTSEC6,
69 SGMII_FM1_DTSEC10, SGMII_FM1_DTSEC9,
70 NONE, NONE, QSGMII_FM1_A, NONE}},
71 {}
72};
York Sun924859a2013-03-25 07:33:28 +000073static const struct serdes_config serdes2_cfg_tbl[] = {
York Sun9e758752012-10-08 07:44:19 +000074 /* SerDes 2 */
75 {1, {XAUI_FM2_MAC9, XAUI_FM2_MAC9,
76 XAUI_FM2_MAC9, XAUI_FM2_MAC9,
77 XAUI_FM2_MAC10, XAUI_FM2_MAC10,
78 XAUI_FM2_MAC10, XAUI_FM2_MAC10}},
79 {2, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
80 HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
81 HIGIG_FM2_MAC10, HIGIG_FM2_MAC10,
82 HIGIG_FM2_MAC10, HIGIG_FM2_MAC10}},
83 {4, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
84 HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
85 HIGIG_FM2_MAC10, HIGIG_FM2_MAC10,
86 HIGIG_FM2_MAC10, HIGIG_FM2_MAC10}},
Shaohui Xie94752f62014-05-16 10:52:33 +080087 {6, {XAUI_FM2_MAC9, XAUI_FM2_MAC9,
88 XAUI_FM2_MAC9, XAUI_FM2_MAC9,
89 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
90 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4} },
York Sun9e758752012-10-08 07:44:19 +000091 {7, {XAUI_FM2_MAC9, XAUI_FM2_MAC9,
92 XAUI_FM2_MAC9, XAUI_FM2_MAC9,
93 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
94 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4}},
Shaohui Xie94752f62014-05-16 10:52:33 +080095 {12, {XAUI_FM2_MAC9, XAUI_FM2_MAC9,
96 XAUI_FM2_MAC9, XAUI_FM2_MAC9,
97 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
98 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4} },
York Sun9e758752012-10-08 07:44:19 +000099 {13, {XAUI_FM2_MAC9, XAUI_FM2_MAC9,
100 XAUI_FM2_MAC9, XAUI_FM2_MAC9,
101 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
102 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4}},
103 {14, {XAUI_FM2_MAC9, XAUI_FM2_MAC9,
104 XAUI_FM2_MAC9, XAUI_FM2_MAC9,
105 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
106 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4}},
Shaohui Xie94752f62014-05-16 10:52:33 +0800107 {15, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
108 HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
109 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
110 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4} },
York Sun9e758752012-10-08 07:44:19 +0000111 {16, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
112 HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
113 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
114 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4}},
Shaohui Xie94752f62014-05-16 10:52:33 +0800115 {21, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
116 HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
117 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
118 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4} },
York Sun9e758752012-10-08 07:44:19 +0000119 {22, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
120 HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
121 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
122 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4}},
123 {23, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
124 HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
125 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
126 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4}},
Shaohui Xie94752f62014-05-16 10:52:33 +0800127 {24, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
128 HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
129 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
130 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4} },
York Sun9e758752012-10-08 07:44:19 +0000131 {25, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
132 HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
133 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
134 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4}},
135 {26, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
136 HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
137 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
138 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4}},
Shaohui Xie94752f62014-05-16 10:52:33 +0800139 {27, {SGMII_FM2_DTSEC5, SGMII_FM2_DTSEC6,
140 SGMII_FM2_DTSEC10, SGMII_FM2_DTSEC9,
141 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
142 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4} },
York Sun9e758752012-10-08 07:44:19 +0000143 {28, {SGMII_FM2_DTSEC5, SGMII_FM2_DTSEC6,
144 SGMII_FM2_DTSEC10, SGMII_FM2_DTSEC9,
145 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
146 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4}},
Shaohui Xie94752f62014-05-16 10:52:33 +0800147 {35, {SGMII_FM2_DTSEC5, SGMII_FM2_DTSEC6,
148 SGMII_FM2_DTSEC10, SGMII_FM2_DTSEC9,
149 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
150 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4} },
York Sun9e758752012-10-08 07:44:19 +0000151 {36, {SGMII_FM2_DTSEC5, SGMII_FM2_DTSEC6,
152 SGMII_FM2_DTSEC10, SGMII_FM2_DTSEC9,
153 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
154 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4}},
Shaohui Xie94752f62014-05-16 10:52:33 +0800155 {37, {NONE, NONE, QSGMII_FM2_B, NONE,
156 NONE, NONE, QSGMII_FM2_A, NONE} },
York Sun9e758752012-10-08 07:44:19 +0000157 {38, {NONE, NONE, QSGMII_FM2_B, NONE,
Shaohui Xie1c68d012013-08-19 18:58:52 +0800158 NONE, NONE, QSGMII_FM2_A, NONE} },
Shaohui Xie94752f62014-05-16 10:52:33 +0800159 {39, {SGMII_FM2_DTSEC5, SGMII_FM2_DTSEC6,
160 SGMII_FM2_DTSEC10, SGMII_FM2_DTSEC9,
161 NONE, NONE, QSGMII_FM2_A, NONE} },
York Sun9e758752012-10-08 07:44:19 +0000162 {40, {SGMII_FM2_DTSEC5, SGMII_FM2_DTSEC6,
163 SGMII_FM2_DTSEC10, SGMII_FM2_DTSEC9,
Shaohui Xie1c68d012013-08-19 18:58:52 +0800164 NONE, NONE, QSGMII_FM2_A, NONE} },
Shaohui Xie94752f62014-05-16 10:52:33 +0800165 {45, {SGMII_FM2_DTSEC5, SGMII_FM2_DTSEC6,
166 SGMII_FM2_DTSEC10, SGMII_FM2_DTSEC9,
167 NONE, NONE, QSGMII_FM2_A, NONE} },
York Sun9e758752012-10-08 07:44:19 +0000168 {46, {SGMII_FM2_DTSEC5, SGMII_FM2_DTSEC6,
169 SGMII_FM2_DTSEC10, SGMII_FM2_DTSEC9,
Shaohui Xie1c68d012013-08-19 18:58:52 +0800170 NONE, NONE, QSGMII_FM2_A, NONE} },
Shaohui Xie94752f62014-05-16 10:52:33 +0800171 {47, {SGMII_FM2_DTSEC5, SGMII_FM2_DTSEC6,
172 SGMII_FM2_DTSEC10, SGMII_FM2_DTSEC9,
173 NONE, NONE, QSGMII_FM2_A, NONE} },
York Sun9e758752012-10-08 07:44:19 +0000174 {48, {SGMII_FM2_DTSEC5, SGMII_FM2_DTSEC6,
175 SGMII_FM2_DTSEC10, SGMII_FM2_DTSEC9,
Shaohui Xie1c68d012013-08-19 18:58:52 +0800176 NONE, NONE, QSGMII_FM2_A, NONE} },
Shaohui Xie94752f62014-05-16 10:52:33 +0800177 {49, {XAUI_FM2_MAC9, XAUI_FM2_MAC9,
178 XAUI_FM2_MAC9, XAUI_FM2_MAC9,
179 NONE, NONE, QSGMII_FM2_A, NONE} },
York Sun9e758752012-10-08 07:44:19 +0000180 {50, {XAUI_FM2_MAC9, XAUI_FM2_MAC9,
181 XAUI_FM2_MAC9, XAUI_FM2_MAC9,
Shaohui Xie1c68d012013-08-19 18:58:52 +0800182 NONE, NONE, QSGMII_FM2_A, NONE} },
Shaohui Xie94752f62014-05-16 10:52:33 +0800183 {51, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
184 HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
185 NONE, NONE, QSGMII_FM2_A, NONE} },
York Sun9e758752012-10-08 07:44:19 +0000186 {52, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
187 HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
Shaohui Xie1c68d012013-08-19 18:58:52 +0800188 NONE, NONE, QSGMII_FM2_A, NONE} },
Shaohui Xie94752f62014-05-16 10:52:33 +0800189 {53, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
190 HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
191 NONE, NONE, QSGMII_FM2_A, NONE} },
York Sun9e758752012-10-08 07:44:19 +0000192 {54, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
193 HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
Shaohui Xie1c68d012013-08-19 18:58:52 +0800194 NONE, NONE, QSGMII_FM2_A, NONE} },
Shaohui Xie94752f62014-05-16 10:52:33 +0800195 {55, {XFI_FM1_MAC9, XFI_FM1_MAC10,
196 XFI_FM2_MAC10, XFI_FM2_MAC9,
197 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
198 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4} },
York Sun9e758752012-10-08 07:44:19 +0000199 {56, {XFI_FM1_MAC9, XFI_FM1_MAC10,
200 XFI_FM2_MAC10, XFI_FM2_MAC9,
201 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
202 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4}},
203 {57, {XFI_FM1_MAC9, XFI_FM1_MAC10,
204 XFI_FM2_MAC10, XFI_FM2_MAC9,
205 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
206 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4}},
207 {}
208};
York Sun924859a2013-03-25 07:33:28 +0000209static const struct serdes_config serdes3_cfg_tbl[] = {
York Sun9e758752012-10-08 07:44:19 +0000210 /* SerDes 3 */
Shaohui Xie94752f62014-05-16 10:52:33 +0800211 {1, {PCIE1, PCIE1, PCIE1, PCIE1, PCIE1, PCIE1, PCIE1, PCIE1} },
York Sun9e758752012-10-08 07:44:19 +0000212 {2, {PCIE1, PCIE1, PCIE1, PCIE1, PCIE1, PCIE1, PCIE1, PCIE1}},
Shaohui Xie94752f62014-05-16 10:52:33 +0800213 {3, {PCIE1, PCIE1, PCIE1, PCIE1, PCIE2, PCIE2, PCIE2, PCIE2} },
York Sun9e758752012-10-08 07:44:19 +0000214 {4, {PCIE1, PCIE1, PCIE1, PCIE1, PCIE2, PCIE2, PCIE2, PCIE2}},
Shaohui Xie94752f62014-05-16 10:52:33 +0800215 {5, {PCIE1, PCIE1, PCIE1, PCIE1, SRIO1, SRIO1, SRIO1, SRIO1} },
York Sun9e758752012-10-08 07:44:19 +0000216 {6, {PCIE1, PCIE1, PCIE1, PCIE1, SRIO1, SRIO1, SRIO1, SRIO1}},
Shaohui Xie4bf7f902015-07-29 11:28:36 +0800217 {7, {PCIE1, PCIE1, PCIE1, PCIE1, SRIO1, SRIO1, SRIO1, SRIO1} },
218 {8, {PCIE1, PCIE1, PCIE1, PCIE1, SRIO1, SRIO1, SRIO1, SRIO1} },
York Sun9e758752012-10-08 07:44:19 +0000219 {9, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN,
220 INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN}},
221 {10, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN,
222 INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN}},
Shaohui Xie94752f62014-05-16 10:52:33 +0800223 {11, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN,
224 PCIE2, PCIE2, PCIE2, PCIE2} },
York Sun9e758752012-10-08 07:44:19 +0000225 {12, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN,
226 PCIE2, PCIE2, PCIE2, PCIE2}},
Shaohui Xie94752f62014-05-16 10:52:33 +0800227 {13, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN,
228 PCIE2, PCIE2, PCIE2, PCIE2} },
York Sun9e758752012-10-08 07:44:19 +0000229 {14, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN,
230 PCIE2, PCIE2, PCIE2, PCIE2}},
Shaohui Xie94752f62014-05-16 10:52:33 +0800231 {15, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN,
232 SRIO1, SRIO1, SRIO1, SRIO1} },
York Sun9e758752012-10-08 07:44:19 +0000233 {16, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN,
234 SRIO1, SRIO1, SRIO1, SRIO1}},
235 {17, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN,
236 SRIO1, SRIO1, SRIO1, SRIO1}},
Shaohui Xie94752f62014-05-16 10:52:33 +0800237 {18, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN,
238 SRIO1, SRIO1, SRIO1, SRIO1} },
York Sun9e758752012-10-08 07:44:19 +0000239 {19, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN,
240 SRIO1, SRIO1, SRIO1, SRIO1}},
241 {20, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN,
242 SRIO1, SRIO1, SRIO1, SRIO1}},
243 {}
244};
York Sun924859a2013-03-25 07:33:28 +0000245static const struct serdes_config serdes4_cfg_tbl[] = {
York Sun9e758752012-10-08 07:44:19 +0000246 /* SerDes 4 */
Shaohui Xie94752f62014-05-16 10:52:33 +0800247 {1, {PCIE3, PCIE3, PCIE3, PCIE3, PCIE3, PCIE3, PCIE3, PCIE3} },
York Sun9e758752012-10-08 07:44:19 +0000248 {2, {PCIE3, PCIE3, PCIE3, PCIE3, PCIE3, PCIE3, PCIE3, PCIE3}},
Shaohui Xie94752f62014-05-16 10:52:33 +0800249 {3, {PCIE3, PCIE3, PCIE3, PCIE3, PCIE4, PCIE4, PCIE4, PCIE4} },
York Sun9e758752012-10-08 07:44:19 +0000250 {4, {PCIE3, PCIE3, PCIE3, PCIE3, PCIE4, PCIE4, PCIE4, PCIE4}},
Shaohui Xie94752f62014-05-16 10:52:33 +0800251 {5, {PCIE3, PCIE3, PCIE3, PCIE3, SRIO2, SRIO2, SRIO2, SRIO2} },
York Sun9e758752012-10-08 07:44:19 +0000252 {6, {PCIE3, PCIE3, PCIE3, PCIE3, SRIO2, SRIO2, SRIO2, SRIO2}},
Shaohui Xie94752f62014-05-16 10:52:33 +0800253 {7, {PCIE3, PCIE3, PCIE3, PCIE3, SRIO2, SRIO2, SRIO2, SRIO2} },
York Sun9e758752012-10-08 07:44:19 +0000254 {8, {PCIE3, PCIE3, PCIE3, PCIE3, SRIO2, SRIO2, SRIO2, SRIO2}},
Shaohui Xie94752f62014-05-16 10:52:33 +0800255 {9, {PCIE3, PCIE3, PCIE3, PCIE3, PCIE4, PCIE4, SATA1, SATA2} },
Roy Zangf9772442013-03-25 07:33:18 +0000256 {10, {PCIE3, PCIE3, PCIE3, PCIE3, PCIE4, PCIE4, SATA1, SATA2} },
Shaohui Xie94752f62014-05-16 10:52:33 +0800257 {11, {PCIE3, PCIE3, PCIE3, PCIE3, AURORA, AURORA, SATA1, SATA2} },
Roy Zangf9772442013-03-25 07:33:18 +0000258 {12, {PCIE3, PCIE3, PCIE3, PCIE3, AURORA, AURORA, SATA1, SATA2} },
Shaohui Xie94752f62014-05-16 10:52:33 +0800259 {13, {PCIE3, PCIE3, PCIE3, PCIE3, AURORA, AURORA, SRIO2, SRIO2} },
York Sun9e758752012-10-08 07:44:19 +0000260 {14, {PCIE3, PCIE3, PCIE3, PCIE3, AURORA, AURORA, SRIO2, SRIO2}},
Shaohui Xie94752f62014-05-16 10:52:33 +0800261 {15, {PCIE3, PCIE3, PCIE3, PCIE3, AURORA, AURORA, SRIO2, SRIO2} },
York Sun9e758752012-10-08 07:44:19 +0000262 {16, {PCIE3, PCIE3, PCIE3, PCIE3, AURORA, AURORA, SRIO2, SRIO2}},
263 {18, {PCIE3, PCIE3, PCIE3, PCIE3, AURORA, AURORA, AURORA, AURORA}},
264 {}
265};
Shengzhou Liu5122dfa2014-04-25 16:31:22 +0800266#elif defined(CONFIG_PPC_T4160) || defined(CONFIG_PPC_T4080)
York Sunb6240842013-03-25 07:33:29 +0000267static const struct serdes_config serdes1_cfg_tbl[] = {
268 /* SerDes 1 */
Shaohui Xie4bf7f902015-07-29 11:28:36 +0800269 {1, {NONE, NONE, NONE, NONE,
York Sunb6240842013-03-25 07:33:29 +0000270 XAUI_FM1_MAC10, XAUI_FM1_MAC10,
271 XAUI_FM1_MAC10, XAUI_FM1_MAC10} },
Shaohui Xie4bf7f902015-07-29 11:28:36 +0800272 {2, {NONE, NONE, NONE, NONE,
York Sunb6240842013-03-25 07:33:29 +0000273 HIGIG_FM1_MAC10, HIGIG_FM1_MAC10,
274 HIGIG_FM1_MAC10, HIGIG_FM1_MAC10} },
Shaohui Xie4bf7f902015-07-29 11:28:36 +0800275 {4, {NONE, NONE, NONE, NONE,
York Sunb6240842013-03-25 07:33:29 +0000276 HIGIG_FM1_MAC10, HIGIG_FM1_MAC10,
277 HIGIG_FM1_MAC10, HIGIG_FM1_MAC10} },
Shaohui Xie4bf7f902015-07-29 11:28:36 +0800278 {27, {NONE, NONE, NONE, NONE,
Shaohui Xie94752f62014-05-16 10:52:33 +0800279 SGMII_FM1_DTSEC1, SGMII_FM1_DTSEC2,
280 SGMII_FM1_DTSEC3, SGMII_FM1_DTSEC4} },
Shaohui Xie4bf7f902015-07-29 11:28:36 +0800281 {28, {NONE, NONE, NONE, NONE,
York Sunb6240842013-03-25 07:33:29 +0000282 SGMII_FM1_DTSEC1, SGMII_FM1_DTSEC2,
283 SGMII_FM1_DTSEC3, SGMII_FM1_DTSEC4} },
Shaohui Xie4bf7f902015-07-29 11:28:36 +0800284 {35, {NONE, NONE, NONE, NONE,
Shaohui Xie94752f62014-05-16 10:52:33 +0800285 SGMII_FM1_DTSEC1, SGMII_FM1_DTSEC2,
286 SGMII_FM1_DTSEC3, SGMII_FM1_DTSEC4} },
Shaohui Xie4bf7f902015-07-29 11:28:36 +0800287 {36, {NONE, NONE, NONE, NONE,
York Sunb6240842013-03-25 07:33:29 +0000288 SGMII_FM1_DTSEC1, SGMII_FM1_DTSEC2,
289 SGMII_FM1_DTSEC3, SGMII_FM1_DTSEC4} },
Shaohui Xie4bf7f902015-07-29 11:28:36 +0800290 {37, {NONE, NONE, NONE, NONE,
Shaohui Xie94752f62014-05-16 10:52:33 +0800291 NONE, NONE, QSGMII_FM1_A, NONE} },
Shaohui Xie4bf7f902015-07-29 11:28:36 +0800292 {38, {NONE, NONE, NONE, NONE,
York Sunb6240842013-03-25 07:33:29 +0000293 NONE, NONE, QSGMII_FM1_A, NONE} },
294 {}
295};
296static const struct serdes_config serdes2_cfg_tbl[] = {
297 /* SerDes 2 */
Shaohui Xie94752f62014-05-16 10:52:33 +0800298 {6, {XAUI_FM2_MAC9, XAUI_FM2_MAC9,
299 XAUI_FM2_MAC9, XAUI_FM2_MAC9,
300 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
301 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4} },
York Sunb6240842013-03-25 07:33:29 +0000302 {7, {XAUI_FM2_MAC9, XAUI_FM2_MAC9,
303 XAUI_FM2_MAC9, XAUI_FM2_MAC9,
304 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
305 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4} },
Shaohui Xie94752f62014-05-16 10:52:33 +0800306 {12, {XAUI_FM2_MAC9, XAUI_FM2_MAC9,
307 XAUI_FM2_MAC9, XAUI_FM2_MAC9,
308 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
309 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4} },
York Sunb6240842013-03-25 07:33:29 +0000310 {13, {XAUI_FM2_MAC9, XAUI_FM2_MAC9,
311 XAUI_FM2_MAC9, XAUI_FM2_MAC9,
312 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
313 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4} },
Shaohui Xie94752f62014-05-16 10:52:33 +0800314 {15, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
315 HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
316 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
317 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4} },
York Sunb6240842013-03-25 07:33:29 +0000318 {16, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
319 HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
320 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
321 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4} },
Shaohui Xie94752f62014-05-16 10:52:33 +0800322 {21, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
323 HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
324 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
325 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4} },
York Sunb6240842013-03-25 07:33:29 +0000326 {22, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
327 HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
328 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
329 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4} },
Shaohui Xie94752f62014-05-16 10:52:33 +0800330 {24, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
331 HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
332 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
333 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4} },
York Sunb6240842013-03-25 07:33:29 +0000334 {25, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
335 HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
336 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
337 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4} },
338 {26, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
339 HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
340 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
341 NONE, NONE} },
Shaohui Xie94752f62014-05-16 10:52:33 +0800342 {27, {SGMII_FM2_DTSEC5, SGMII_FM2_DTSEC6,
343 SGMII_FM2_DTSEC10, SGMII_FM2_DTSEC9,
344 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
345 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4} },
York Sunb6240842013-03-25 07:33:29 +0000346 {28, {SGMII_FM2_DTSEC5, SGMII_FM2_DTSEC6,
347 SGMII_FM2_DTSEC10, SGMII_FM2_DTSEC9,
348 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
349 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4} },
Shaohui Xie94752f62014-05-16 10:52:33 +0800350 {35, {SGMII_FM2_DTSEC5, SGMII_FM2_DTSEC6,
351 SGMII_FM2_DTSEC10, SGMII_FM2_DTSEC9,
352 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
353 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4} },
York Sunb6240842013-03-25 07:33:29 +0000354 {36, {SGMII_FM2_DTSEC5, SGMII_FM2_DTSEC6,
355 SGMII_FM2_DTSEC10, SGMII_FM2_DTSEC9,
356 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
357 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4} },
Shaohui Xie94752f62014-05-16 10:52:33 +0800358 {37, {NONE, NONE, QSGMII_FM2_B, NONE,
Shaohui Xie4bf7f902015-07-29 11:28:36 +0800359 NONE, NONE, QSGMII_FM2_A, NONE} },
York Sunb6240842013-03-25 07:33:29 +0000360 {38, {NONE, NONE, QSGMII_FM2_B, NONE,
Shaohui Xie4bf7f902015-07-29 11:28:36 +0800361 NONE, NONE, QSGMII_FM2_A, NONE} },
Shaohui Xie94752f62014-05-16 10:52:33 +0800362 {39, {SGMII_FM2_DTSEC5, SGMII_FM2_DTSEC6,
363 SGMII_FM2_DTSEC10, SGMII_FM2_DTSEC9,
Shaohui Xie4bf7f902015-07-29 11:28:36 +0800364 NONE, NONE, QSGMII_FM2_A, NONE} },
York Sunb6240842013-03-25 07:33:29 +0000365 {40, {SGMII_FM2_DTSEC5, SGMII_FM2_DTSEC6,
366 SGMII_FM2_DTSEC10, SGMII_FM2_DTSEC9,
Shaohui Xie4bf7f902015-07-29 11:28:36 +0800367 NONE, NONE, QSGMII_FM2_A, NONE} },
Shaohui Xie94752f62014-05-16 10:52:33 +0800368 {45, {SGMII_FM2_DTSEC5, SGMII_FM2_DTSEC6,
369 SGMII_FM2_DTSEC10, SGMII_FM2_DTSEC9,
Shaohui Xie4bf7f902015-07-29 11:28:36 +0800370 NONE, NONE, QSGMII_FM2_A, NONE} },
York Sunb6240842013-03-25 07:33:29 +0000371 {46, {SGMII_FM2_DTSEC5, SGMII_FM2_DTSEC6,
372 SGMII_FM2_DTSEC10, SGMII_FM2_DTSEC9,
Shaohui Xie4bf7f902015-07-29 11:28:36 +0800373 NONE, NONE, QSGMII_FM2_A, NONE} },
Shaohui Xie94752f62014-05-16 10:52:33 +0800374 {47, {SGMII_FM2_DTSEC5, SGMII_FM2_DTSEC6,
375 SGMII_FM2_DTSEC10, SGMII_FM2_DTSEC9,
Shaohui Xie4bf7f902015-07-29 11:28:36 +0800376 NONE, NONE, QSGMII_FM2_A, NONE} },
York Sunb6240842013-03-25 07:33:29 +0000377 {48, {SGMII_FM2_DTSEC5, SGMII_FM2_DTSEC6,
378 SGMII_FM2_DTSEC10, SGMII_FM2_DTSEC9,
Shaohui Xie4bf7f902015-07-29 11:28:36 +0800379 NONE, NONE, QSGMII_FM2_A, NONE} },
Shaohui Xie94752f62014-05-16 10:52:33 +0800380 {49, {XAUI_FM2_MAC9, XAUI_FM2_MAC9,
381 XAUI_FM2_MAC9, XAUI_FM2_MAC9,
Shaohui Xie4bf7f902015-07-29 11:28:36 +0800382 NONE, NONE, QSGMII_FM2_A, NONE} },
York Sunb6240842013-03-25 07:33:29 +0000383 {50, {XAUI_FM2_MAC9, XAUI_FM2_MAC9,
384 XAUI_FM2_MAC9, XAUI_FM2_MAC9,
Shaohui Xie4bf7f902015-07-29 11:28:36 +0800385 NONE, NONE, QSGMII_FM2_A, NONE} },
Shaohui Xie94752f62014-05-16 10:52:33 +0800386 {51, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
387 HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
Shaohui Xie4bf7f902015-07-29 11:28:36 +0800388 NONE, NONE, QSGMII_FM2_A, NONE} },
York Sunb6240842013-03-25 07:33:29 +0000389 {52, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
390 HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
Shaohui Xie4bf7f902015-07-29 11:28:36 +0800391 NONE, NONE, QSGMII_FM2_A, NONE} },
Shaohui Xie94752f62014-05-16 10:52:33 +0800392 {53, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
393 HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
Shaohui Xie4bf7f902015-07-29 11:28:36 +0800394 NONE, NONE, QSGMII_FM2_A, NONE} },
York Sunb6240842013-03-25 07:33:29 +0000395 {54, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
396 HIGIG_FM2_MAC9, HIGIG_FM2_MAC9,
Shaohui Xie4bf7f902015-07-29 11:28:36 +0800397 NONE, NONE, QSGMII_FM2_A, NONE} },
Shaohui Xie94752f62014-05-16 10:52:33 +0800398 {55, {NONE, XFI_FM1_MAC10,
399 XFI_FM2_MAC10, NONE,
400 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
401 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4} },
York Sunb6240842013-03-25 07:33:29 +0000402 {56, {NONE, XFI_FM1_MAC10,
403 XFI_FM2_MAC10, NONE,
404 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
405 SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4} },
406 {57, {NONE, XFI_FM1_MAC10,
407 XFI_FM2_MAC10, NONE,
408 SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2,
409 NONE, NONE} },
410 {}
411};
412static const struct serdes_config serdes3_cfg_tbl[] = {
413 /* SerDes 3 */
Shaohui Xie94752f62014-05-16 10:52:33 +0800414 {1, {PCIE1, PCIE1, PCIE1, PCIE1, PCIE1, PCIE1, PCIE1, PCIE1} },
York Sunb6240842013-03-25 07:33:29 +0000415 {2, {PCIE1, PCIE1, PCIE1, PCIE1, PCIE1, PCIE1, PCIE1, PCIE1} },
Shaohui Xie94752f62014-05-16 10:52:33 +0800416 {3, {PCIE1, PCIE1, PCIE1, PCIE1, PCIE2, PCIE2, PCIE2, PCIE2} },
York Sunb6240842013-03-25 07:33:29 +0000417 {4, {PCIE1, PCIE1, PCIE1, PCIE1, PCIE2, PCIE2, PCIE2, PCIE2} },
Shaohui Xie94752f62014-05-16 10:52:33 +0800418 {5, {PCIE1, PCIE1, PCIE1, PCIE1, SRIO1, SRIO1, SRIO1, SRIO1} },
York Sunb6240842013-03-25 07:33:29 +0000419 {6, {PCIE1, PCIE1, PCIE1, PCIE1, SRIO1, SRIO1, SRIO1, SRIO1} },
Shaohui Xie4bf7f902015-07-29 11:28:36 +0800420 {7, {PCIE1, PCIE1, PCIE1, PCIE1, SRIO1, SRIO1, SRIO1, SRIO1} },
421 {8, {PCIE1, PCIE1, PCIE1, PCIE1, SRIO1, SRIO1, SRIO1, SRIO1} },
York Sunb6240842013-03-25 07:33:29 +0000422 {9, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN,
423 INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN} },
424 {10, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN,
425 INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN} },
Shaohui Xie4bf7f902015-07-29 11:28:36 +0800426 {11, {NONE, NONE, NONE, NONE,
Shaohui Xie94752f62014-05-16 10:52:33 +0800427 PCIE2, PCIE2, PCIE2, PCIE2} },
Shaohui Xie4bf7f902015-07-29 11:28:36 +0800428 {12, {NONE, NONE, NONE, NONE,
York Sunb6240842013-03-25 07:33:29 +0000429 PCIE2, PCIE2, PCIE2, PCIE2} },
Shaohui Xie94752f62014-05-16 10:52:33 +0800430 {13, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN,
431 PCIE2, PCIE2, PCIE2, PCIE2} },
York Sunb6240842013-03-25 07:33:29 +0000432 {14, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN,
433 PCIE2, PCIE2, PCIE2, PCIE2} },
Shaohui Xie4bf7f902015-07-29 11:28:36 +0800434 {15, {NONE, NONE, NONE, NONE,
Shaohui Xie94752f62014-05-16 10:52:33 +0800435 SRIO1, SRIO1, SRIO1, SRIO1} },
Shaohui Xie4bf7f902015-07-29 11:28:36 +0800436 {16, {NONE, NONE, NONE, NONE,
York Sunb6240842013-03-25 07:33:29 +0000437 SRIO1, SRIO1, SRIO1, SRIO1} },
Shaohui Xie4bf7f902015-07-29 11:28:36 +0800438 {17, {NONE, NONE, NONE, NONE,
York Sunb6240842013-03-25 07:33:29 +0000439 SRIO1, SRIO1, SRIO1, SRIO1} },
Shaohui Xie94752f62014-05-16 10:52:33 +0800440 {18, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN,
441 SRIO1, SRIO1, SRIO1, SRIO1} },
York Sunb6240842013-03-25 07:33:29 +0000442 {19, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN,
443 SRIO1, SRIO1, SRIO1, SRIO1} },
444 {20, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN,
Shaohui Xie4bf7f902015-07-29 11:28:36 +0800445 SRIO1, SRIO1, SRIO1, SRIO1} },
York Sunb6240842013-03-25 07:33:29 +0000446 {}
447};
448static const struct serdes_config serdes4_cfg_tbl[] = {
449 /* SerDes 4 */
Shaohui Xie4bf7f902015-07-29 11:28:36 +0800450 {3, {NONE, NONE, NONE, NONE, PCIE4, PCIE4, PCIE4, PCIE4} },
451 {4, {NONE, NONE, NONE, NONE, PCIE4, PCIE4, PCIE4, PCIE4} },
452 {5, {NONE, NONE, NONE, NONE, SRIO2, SRIO2, SRIO2, SRIO2} },
453 {6, {NONE, NONE, NONE, NONE, SRIO2, SRIO2, SRIO2, SRIO2} },
454 {7, {NONE, NONE, NONE, NONE, SRIO2, SRIO2, SRIO2, SRIO2} },
455 {8, {NONE, NONE, NONE, NONE, SRIO2, SRIO2, SRIO2, SRIO2} },
456 {9, {NONE, NONE, NONE, NONE, PCIE4, PCIE4, SATA1, SATA2} },
457 {10, {NONE, NONE, NONE, NONE, PCIE4, PCIE4, SATA1, SATA2} },
458 {11, {NONE, NONE, NONE, NONE, AURORA, AURORA, SATA1, SATA2} },
459 {12, {NONE, NONE, NONE, NONE, AURORA, AURORA, SATA1, SATA2} },
460 {13, {NONE, NONE, NONE, NONE, AURORA, AURORA, SRIO2, SRIO2} },
461 {14, {NONE, NONE, NONE, NONE, AURORA, AURORA, SRIO2, SRIO2} },
462 {15, {NONE, NONE, NONE, NONE, AURORA, AURORA, SRIO2, SRIO2} },
463 {16, {NONE, NONE, NONE, NONE, AURORA, AURORA, SRIO2, SRIO2} },
464 {18, {NONE, NONE, NONE, NONE, AURORA, AURORA, AURORA, AURORA} },
York Sunb6240842013-03-25 07:33:29 +0000465 {}
466}
467;
468#else
469#error "Need to define SerDes protocol"
470#endif
York Sun924859a2013-03-25 07:33:28 +0000471static const struct serdes_config *serdes_cfg_tbl[] = {
York Sun9e758752012-10-08 07:44:19 +0000472 serdes1_cfg_tbl,
473 serdes2_cfg_tbl,
474 serdes3_cfg_tbl,
475 serdes4_cfg_tbl,
476};
477
478enum srds_prtcl serdes_get_prtcl(int serdes, int cfg, int lane)
479{
York Sun924859a2013-03-25 07:33:28 +0000480 const struct serdes_config *ptr;
York Sun9e758752012-10-08 07:44:19 +0000481
482 if (serdes >= ARRAY_SIZE(serdes_cfg_tbl))
483 return 0;
484
485 ptr = serdes_cfg_tbl[serdes];
486 while (ptr->protocol) {
487 if (ptr->protocol == cfg)
488 return ptr->lanes[lane];
489 ptr++;
490 }
491 return 0;
492}
493
494int is_serdes_prtcl_valid(int serdes, u32 prtcl)
495{
496 int i;
York Sun924859a2013-03-25 07:33:28 +0000497 const struct serdes_config *ptr;
York Sun9e758752012-10-08 07:44:19 +0000498
499 if (serdes >= ARRAY_SIZE(serdes_cfg_tbl))
500 return 0;
501
502 ptr = serdes_cfg_tbl[serdes];
503 while (ptr->protocol) {
504 if (ptr->protocol == prtcl)
505 break;
506 ptr++;
507 }
508
509 if (!ptr->protocol)
510 return 0;
511
512 for (i = 0; i < SRDS_MAX_LANES; i++) {
513 if (ptr->lanes[i] != NONE)
514 return 1;
515 }
516
517 return 0;
518}