Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 2 | /* |
| 3 | * Copyright 2012 Freescale Semiconductor, Inc. |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 4 | */ |
| 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 | |
| 12 | struct serdes_config { |
| 13 | u32 protocol; |
| 14 | u8 lanes[SRDS_MAX_LANES]; |
| 15 | }; |
| 16 | |
York Sun | 0fad326 | 2016-11-21 13:35:41 -0800 | [diff] [blame] | 17 | #ifdef CONFIG_ARCH_T4240 |
York Sun | 85e660f | 2013-03-25 07:33:28 +0000 | [diff] [blame] | 18 | static const struct serdes_config serdes1_cfg_tbl[] = { |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 19 | /* 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 Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 32 | {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 Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 36 | {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 Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 40 | {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 Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 44 | {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 Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 48 | {37, {NONE, NONE, QSGMII_FM1_B, NONE, |
| 49 | NONE, NONE, QSGMII_FM1_A, NONE} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 50 | {38, {NONE, NONE, QSGMII_FM1_B, NONE, |
| 51 | NONE, NONE, QSGMII_FM1_A, NONE}}, |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 52 | {39, {SGMII_FM1_DTSEC5, SGMII_FM1_DTSEC6, |
| 53 | SGMII_FM1_DTSEC10, SGMII_FM1_DTSEC9, |
| 54 | NONE, NONE, QSGMII_FM1_A, NONE} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 55 | {40, {SGMII_FM1_DTSEC5, SGMII_FM1_DTSEC6, |
| 56 | SGMII_FM1_DTSEC10, SGMII_FM1_DTSEC9, |
| 57 | NONE, NONE, QSGMII_FM1_A, NONE}}, |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 58 | {45, {SGMII_FM1_DTSEC5, SGMII_FM1_DTSEC6, |
| 59 | SGMII_FM1_DTSEC10, SGMII_FM1_DTSEC9, |
| 60 | NONE, NONE, QSGMII_FM1_A, NONE} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 61 | {46, {SGMII_FM1_DTSEC5, SGMII_FM1_DTSEC6, |
| 62 | SGMII_FM1_DTSEC10, SGMII_FM1_DTSEC9, |
| 63 | NONE, NONE, QSGMII_FM1_A, NONE}}, |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 64 | {47, {SGMII_FM1_DTSEC5, SGMII_FM1_DTSEC6, |
| 65 | SGMII_FM1_DTSEC10, SGMII_FM1_DTSEC9, |
| 66 | NONE, NONE, QSGMII_FM1_A, NONE} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 67 | {48, {SGMII_FM1_DTSEC5, SGMII_FM1_DTSEC6, |
| 68 | SGMII_FM1_DTSEC10, SGMII_FM1_DTSEC9, |
| 69 | NONE, NONE, QSGMII_FM1_A, NONE}}, |
| 70 | {} |
| 71 | }; |
York Sun | 85e660f | 2013-03-25 07:33:28 +0000 | [diff] [blame] | 72 | static const struct serdes_config serdes2_cfg_tbl[] = { |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 73 | /* 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 Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 86 | {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 Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 90 | {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 Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 94 | {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 Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 98 | {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 Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 106 | {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 Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 110 | {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 Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 114 | {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 Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 118 | {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 Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 126 | {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 Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 130 | {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 Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 138 | {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 Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 142 | {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 Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 146 | {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 Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 150 | {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 Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 154 | {37, {NONE, NONE, QSGMII_FM2_B, NONE, |
| 155 | NONE, NONE, QSGMII_FM2_A, NONE} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 156 | {38, {NONE, NONE, QSGMII_FM2_B, NONE, |
Shaohui Xie | c218d29 | 2013-08-19 18:58:52 +0800 | [diff] [blame] | 157 | NONE, NONE, QSGMII_FM2_A, NONE} }, |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 158 | {39, {SGMII_FM2_DTSEC5, SGMII_FM2_DTSEC6, |
| 159 | SGMII_FM2_DTSEC10, SGMII_FM2_DTSEC9, |
| 160 | NONE, NONE, QSGMII_FM2_A, NONE} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 161 | {40, {SGMII_FM2_DTSEC5, SGMII_FM2_DTSEC6, |
| 162 | SGMII_FM2_DTSEC10, SGMII_FM2_DTSEC9, |
Shaohui Xie | c218d29 | 2013-08-19 18:58:52 +0800 | [diff] [blame] | 163 | NONE, NONE, QSGMII_FM2_A, NONE} }, |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 164 | {45, {SGMII_FM2_DTSEC5, SGMII_FM2_DTSEC6, |
| 165 | SGMII_FM2_DTSEC10, SGMII_FM2_DTSEC9, |
| 166 | NONE, NONE, QSGMII_FM2_A, NONE} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 167 | {46, {SGMII_FM2_DTSEC5, SGMII_FM2_DTSEC6, |
| 168 | SGMII_FM2_DTSEC10, SGMII_FM2_DTSEC9, |
Shaohui Xie | c218d29 | 2013-08-19 18:58:52 +0800 | [diff] [blame] | 169 | NONE, NONE, QSGMII_FM2_A, NONE} }, |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 170 | {47, {SGMII_FM2_DTSEC5, SGMII_FM2_DTSEC6, |
| 171 | SGMII_FM2_DTSEC10, SGMII_FM2_DTSEC9, |
| 172 | NONE, NONE, QSGMII_FM2_A, NONE} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 173 | {48, {SGMII_FM2_DTSEC5, SGMII_FM2_DTSEC6, |
| 174 | SGMII_FM2_DTSEC10, SGMII_FM2_DTSEC9, |
Shaohui Xie | c218d29 | 2013-08-19 18:58:52 +0800 | [diff] [blame] | 175 | NONE, NONE, QSGMII_FM2_A, NONE} }, |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 176 | {49, {XAUI_FM2_MAC9, XAUI_FM2_MAC9, |
| 177 | XAUI_FM2_MAC9, XAUI_FM2_MAC9, |
| 178 | NONE, NONE, QSGMII_FM2_A, NONE} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 179 | {50, {XAUI_FM2_MAC9, XAUI_FM2_MAC9, |
| 180 | XAUI_FM2_MAC9, XAUI_FM2_MAC9, |
Shaohui Xie | c218d29 | 2013-08-19 18:58:52 +0800 | [diff] [blame] | 181 | NONE, NONE, QSGMII_FM2_A, NONE} }, |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 182 | {51, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9, |
| 183 | HIGIG_FM2_MAC9, HIGIG_FM2_MAC9, |
| 184 | NONE, NONE, QSGMII_FM2_A, NONE} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 185 | {52, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9, |
| 186 | HIGIG_FM2_MAC9, HIGIG_FM2_MAC9, |
Shaohui Xie | c218d29 | 2013-08-19 18:58:52 +0800 | [diff] [blame] | 187 | NONE, NONE, QSGMII_FM2_A, NONE} }, |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 188 | {53, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9, |
| 189 | HIGIG_FM2_MAC9, HIGIG_FM2_MAC9, |
| 190 | NONE, NONE, QSGMII_FM2_A, NONE} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 191 | {54, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9, |
| 192 | HIGIG_FM2_MAC9, HIGIG_FM2_MAC9, |
Shaohui Xie | c218d29 | 2013-08-19 18:58:52 +0800 | [diff] [blame] | 193 | NONE, NONE, QSGMII_FM2_A, NONE} }, |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 194 | {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 Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 198 | {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 Sun | 85e660f | 2013-03-25 07:33:28 +0000 | [diff] [blame] | 208 | static const struct serdes_config serdes3_cfg_tbl[] = { |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 209 | /* SerDes 3 */ |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 210 | {1, {PCIE1, PCIE1, PCIE1, PCIE1, PCIE1, PCIE1, PCIE1, PCIE1} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 211 | {2, {PCIE1, PCIE1, PCIE1, PCIE1, PCIE1, PCIE1, PCIE1, PCIE1}}, |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 212 | {3, {PCIE1, PCIE1, PCIE1, PCIE1, PCIE2, PCIE2, PCIE2, PCIE2} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 213 | {4, {PCIE1, PCIE1, PCIE1, PCIE1, PCIE2, PCIE2, PCIE2, PCIE2}}, |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 214 | {5, {PCIE1, PCIE1, PCIE1, PCIE1, SRIO1, SRIO1, SRIO1, SRIO1} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 215 | {6, {PCIE1, PCIE1, PCIE1, PCIE1, SRIO1, SRIO1, SRIO1, SRIO1}}, |
Shaohui Xie | 0a8a397 | 2015-07-29 11:28:36 +0800 | [diff] [blame] | 216 | {7, {PCIE1, PCIE1, PCIE1, PCIE1, SRIO1, SRIO1, SRIO1, SRIO1} }, |
| 217 | {8, {PCIE1, PCIE1, PCIE1, PCIE1, SRIO1, SRIO1, SRIO1, SRIO1} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 218 | {9, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN, |
| 219 | INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN}}, |
| 220 | {10, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN, |
| 221 | INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN}}, |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 222 | {11, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN, |
| 223 | PCIE2, PCIE2, PCIE2, PCIE2} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 224 | {12, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN, |
| 225 | PCIE2, PCIE2, PCIE2, PCIE2}}, |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 226 | {13, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN, |
| 227 | PCIE2, PCIE2, PCIE2, PCIE2} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 228 | {14, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN, |
| 229 | PCIE2, PCIE2, PCIE2, PCIE2}}, |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 230 | {15, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN, |
| 231 | SRIO1, SRIO1, SRIO1, SRIO1} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 232 | {16, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN, |
| 233 | SRIO1, SRIO1, SRIO1, SRIO1}}, |
| 234 | {17, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN, |
| 235 | SRIO1, SRIO1, SRIO1, SRIO1}}, |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 236 | {18, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN, |
| 237 | SRIO1, SRIO1, SRIO1, SRIO1} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 238 | {19, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN, |
| 239 | SRIO1, SRIO1, SRIO1, SRIO1}}, |
| 240 | {20, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN, |
| 241 | SRIO1, SRIO1, SRIO1, SRIO1}}, |
| 242 | {} |
| 243 | }; |
York Sun | 85e660f | 2013-03-25 07:33:28 +0000 | [diff] [blame] | 244 | static const struct serdes_config serdes4_cfg_tbl[] = { |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 245 | /* SerDes 4 */ |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 246 | {1, {PCIE3, PCIE3, PCIE3, PCIE3, PCIE3, PCIE3, PCIE3, PCIE3} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 247 | {2, {PCIE3, PCIE3, PCIE3, PCIE3, PCIE3, PCIE3, PCIE3, PCIE3}}, |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 248 | {3, {PCIE3, PCIE3, PCIE3, PCIE3, PCIE4, PCIE4, PCIE4, PCIE4} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 249 | {4, {PCIE3, PCIE3, PCIE3, PCIE3, PCIE4, PCIE4, PCIE4, PCIE4}}, |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 250 | {5, {PCIE3, PCIE3, PCIE3, PCIE3, SRIO2, SRIO2, SRIO2, SRIO2} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 251 | {6, {PCIE3, PCIE3, PCIE3, PCIE3, SRIO2, SRIO2, SRIO2, SRIO2}}, |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 252 | {7, {PCIE3, PCIE3, PCIE3, PCIE3, SRIO2, SRIO2, SRIO2, SRIO2} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 253 | {8, {PCIE3, PCIE3, PCIE3, PCIE3, SRIO2, SRIO2, SRIO2, SRIO2}}, |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 254 | {9, {PCIE3, PCIE3, PCIE3, PCIE3, PCIE4, PCIE4, SATA1, SATA2} }, |
Roy Zang | cc117ce | 2013-03-25 07:33:18 +0000 | [diff] [blame] | 255 | {10, {PCIE3, PCIE3, PCIE3, PCIE3, PCIE4, PCIE4, SATA1, SATA2} }, |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 256 | {11, {PCIE3, PCIE3, PCIE3, PCIE3, AURORA, AURORA, SATA1, SATA2} }, |
Roy Zang | cc117ce | 2013-03-25 07:33:18 +0000 | [diff] [blame] | 257 | {12, {PCIE3, PCIE3, PCIE3, PCIE3, AURORA, AURORA, SATA1, SATA2} }, |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 258 | {13, {PCIE3, PCIE3, PCIE3, PCIE3, AURORA, AURORA, SRIO2, SRIO2} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 259 | {14, {PCIE3, PCIE3, PCIE3, PCIE3, AURORA, AURORA, SRIO2, SRIO2}}, |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 260 | {15, {PCIE3, PCIE3, PCIE3, PCIE3, AURORA, AURORA, SRIO2, SRIO2} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 261 | {16, {PCIE3, PCIE3, PCIE3, PCIE3, AURORA, AURORA, SRIO2, SRIO2}}, |
| 262 | {18, {PCIE3, PCIE3, PCIE3, PCIE3, AURORA, AURORA, AURORA, AURORA}}, |
| 263 | {} |
| 264 | }; |
York Sun | fb5137a | 2013-03-25 07:33:29 +0000 | [diff] [blame] | 265 | #else |
| 266 | #error "Need to define SerDes protocol" |
| 267 | #endif |
York Sun | 85e660f | 2013-03-25 07:33:28 +0000 | [diff] [blame] | 268 | static const struct serdes_config *serdes_cfg_tbl[] = { |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 269 | serdes1_cfg_tbl, |
| 270 | serdes2_cfg_tbl, |
| 271 | serdes3_cfg_tbl, |
| 272 | serdes4_cfg_tbl, |
| 273 | }; |
| 274 | |
| 275 | enum srds_prtcl serdes_get_prtcl(int serdes, int cfg, int lane) |
| 276 | { |
York Sun | 85e660f | 2013-03-25 07:33:28 +0000 | [diff] [blame] | 277 | const struct serdes_config *ptr; |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 278 | |
| 279 | if (serdes >= ARRAY_SIZE(serdes_cfg_tbl)) |
| 280 | return 0; |
| 281 | |
| 282 | ptr = serdes_cfg_tbl[serdes]; |
| 283 | while (ptr->protocol) { |
| 284 | if (ptr->protocol == cfg) |
| 285 | return ptr->lanes[lane]; |
| 286 | ptr++; |
| 287 | } |
| 288 | return 0; |
| 289 | } |
| 290 | |
| 291 | int is_serdes_prtcl_valid(int serdes, u32 prtcl) |
| 292 | { |
| 293 | int i; |
York Sun | 85e660f | 2013-03-25 07:33:28 +0000 | [diff] [blame] | 294 | const struct serdes_config *ptr; |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 295 | |
| 296 | if (serdes >= ARRAY_SIZE(serdes_cfg_tbl)) |
| 297 | return 0; |
| 298 | |
| 299 | ptr = serdes_cfg_tbl[serdes]; |
| 300 | while (ptr->protocol) { |
| 301 | if (ptr->protocol == prtcl) |
| 302 | break; |
| 303 | ptr++; |
| 304 | } |
| 305 | |
| 306 | if (!ptr->protocol) |
| 307 | return 0; |
| 308 | |
| 309 | for (i = 0; i < SRDS_MAX_LANES; i++) { |
| 310 | if (ptr->lanes[i] != NONE) |
| 311 | return 1; |
| 312 | } |
| 313 | |
| 314 | return 0; |
| 315 | } |