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 | |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 6 | #include <asm/fsl_serdes.h> |
| 7 | #include <asm/processor.h> |
| 8 | #include <asm/io.h> |
| 9 | #include "fsl_corenet2_serdes.h" |
| 10 | |
| 11 | struct serdes_config { |
| 12 | u32 protocol; |
| 13 | u8 lanes[SRDS_MAX_LANES]; |
| 14 | }; |
| 15 | |
York Sun | 0fad326 | 2016-11-21 13:35:41 -0800 | [diff] [blame] | 16 | #ifdef CONFIG_ARCH_T4240 |
York Sun | 85e660f | 2013-03-25 07:33:28 +0000 | [diff] [blame] | 17 | static const struct serdes_config serdes1_cfg_tbl[] = { |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 18 | /* SerDes 1 */ |
| 19 | {1, {XAUI_FM1_MAC9, XAUI_FM1_MAC9, |
| 20 | XAUI_FM1_MAC9, XAUI_FM1_MAC9, |
| 21 | XAUI_FM1_MAC10, XAUI_FM1_MAC10, |
| 22 | XAUI_FM1_MAC10, XAUI_FM1_MAC10}}, |
| 23 | {2, {HIGIG_FM1_MAC9, HIGIG_FM1_MAC9, |
| 24 | HIGIG_FM1_MAC9, HIGIG_FM1_MAC9, |
| 25 | HIGIG_FM1_MAC10, HIGIG_FM1_MAC10, |
| 26 | HIGIG_FM1_MAC10, HIGIG_FM1_MAC10}}, |
| 27 | {4, {HIGIG_FM1_MAC9, HIGIG_FM1_MAC9, |
| 28 | HIGIG_FM1_MAC9, HIGIG_FM1_MAC9, |
| 29 | HIGIG_FM1_MAC10, HIGIG_FM1_MAC10, |
| 30 | HIGIG_FM1_MAC10, HIGIG_FM1_MAC10}}, |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 31 | {27, {SGMII_FM1_DTSEC5, SGMII_FM1_DTSEC6, |
| 32 | SGMII_FM1_DTSEC10, SGMII_FM1_DTSEC9, |
| 33 | SGMII_FM1_DTSEC1, SGMII_FM1_DTSEC2, |
| 34 | SGMII_FM1_DTSEC3, SGMII_FM1_DTSEC4} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 35 | {28, {SGMII_FM1_DTSEC5, SGMII_FM1_DTSEC6, |
| 36 | SGMII_FM1_DTSEC10, SGMII_FM1_DTSEC9, |
| 37 | SGMII_FM1_DTSEC1, SGMII_FM1_DTSEC2, |
| 38 | SGMII_FM1_DTSEC3, SGMII_FM1_DTSEC4}}, |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 39 | {35, {SGMII_FM1_DTSEC5, SGMII_FM1_DTSEC6, |
| 40 | SGMII_FM1_DTSEC10, SGMII_FM1_DTSEC9, |
| 41 | SGMII_FM1_DTSEC1, SGMII_FM1_DTSEC2, |
| 42 | SGMII_FM1_DTSEC3, SGMII_FM1_DTSEC4} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 43 | {36, {SGMII_FM1_DTSEC5, SGMII_FM1_DTSEC6, |
| 44 | SGMII_FM1_DTSEC10, SGMII_FM1_DTSEC9, |
| 45 | SGMII_FM1_DTSEC1, SGMII_FM1_DTSEC2, |
| 46 | SGMII_FM1_DTSEC3, SGMII_FM1_DTSEC4}}, |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 47 | {37, {NONE, NONE, QSGMII_FM1_B, NONE, |
| 48 | NONE, NONE, QSGMII_FM1_A, NONE} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 49 | {38, {NONE, NONE, QSGMII_FM1_B, NONE, |
| 50 | NONE, NONE, QSGMII_FM1_A, NONE}}, |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 51 | {39, {SGMII_FM1_DTSEC5, SGMII_FM1_DTSEC6, |
| 52 | SGMII_FM1_DTSEC10, SGMII_FM1_DTSEC9, |
| 53 | NONE, NONE, QSGMII_FM1_A, NONE} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 54 | {40, {SGMII_FM1_DTSEC5, SGMII_FM1_DTSEC6, |
| 55 | SGMII_FM1_DTSEC10, SGMII_FM1_DTSEC9, |
| 56 | NONE, NONE, QSGMII_FM1_A, NONE}}, |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 57 | {45, {SGMII_FM1_DTSEC5, SGMII_FM1_DTSEC6, |
| 58 | SGMII_FM1_DTSEC10, SGMII_FM1_DTSEC9, |
| 59 | NONE, NONE, QSGMII_FM1_A, NONE} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 60 | {46, {SGMII_FM1_DTSEC5, SGMII_FM1_DTSEC6, |
| 61 | SGMII_FM1_DTSEC10, SGMII_FM1_DTSEC9, |
| 62 | NONE, NONE, QSGMII_FM1_A, NONE}}, |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 63 | {47, {SGMII_FM1_DTSEC5, SGMII_FM1_DTSEC6, |
| 64 | SGMII_FM1_DTSEC10, SGMII_FM1_DTSEC9, |
| 65 | NONE, NONE, QSGMII_FM1_A, NONE} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 66 | {48, {SGMII_FM1_DTSEC5, SGMII_FM1_DTSEC6, |
| 67 | SGMII_FM1_DTSEC10, SGMII_FM1_DTSEC9, |
| 68 | NONE, NONE, QSGMII_FM1_A, NONE}}, |
| 69 | {} |
| 70 | }; |
York Sun | 85e660f | 2013-03-25 07:33:28 +0000 | [diff] [blame] | 71 | static const struct serdes_config serdes2_cfg_tbl[] = { |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 72 | /* SerDes 2 */ |
| 73 | {1, {XAUI_FM2_MAC9, XAUI_FM2_MAC9, |
| 74 | XAUI_FM2_MAC9, XAUI_FM2_MAC9, |
| 75 | XAUI_FM2_MAC10, XAUI_FM2_MAC10, |
| 76 | XAUI_FM2_MAC10, XAUI_FM2_MAC10}}, |
| 77 | {2, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9, |
| 78 | HIGIG_FM2_MAC9, HIGIG_FM2_MAC9, |
| 79 | HIGIG_FM2_MAC10, HIGIG_FM2_MAC10, |
| 80 | HIGIG_FM2_MAC10, HIGIG_FM2_MAC10}}, |
| 81 | {4, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9, |
| 82 | HIGIG_FM2_MAC9, HIGIG_FM2_MAC9, |
| 83 | HIGIG_FM2_MAC10, HIGIG_FM2_MAC10, |
| 84 | HIGIG_FM2_MAC10, HIGIG_FM2_MAC10}}, |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 85 | {6, {XAUI_FM2_MAC9, XAUI_FM2_MAC9, |
| 86 | XAUI_FM2_MAC9, XAUI_FM2_MAC9, |
| 87 | SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2, |
| 88 | SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 89 | {7, {XAUI_FM2_MAC9, XAUI_FM2_MAC9, |
| 90 | XAUI_FM2_MAC9, XAUI_FM2_MAC9, |
| 91 | SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2, |
| 92 | SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4}}, |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 93 | {12, {XAUI_FM2_MAC9, XAUI_FM2_MAC9, |
| 94 | XAUI_FM2_MAC9, XAUI_FM2_MAC9, |
| 95 | SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2, |
| 96 | SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 97 | {13, {XAUI_FM2_MAC9, XAUI_FM2_MAC9, |
| 98 | XAUI_FM2_MAC9, XAUI_FM2_MAC9, |
| 99 | SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2, |
| 100 | SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4}}, |
| 101 | {14, {XAUI_FM2_MAC9, XAUI_FM2_MAC9, |
| 102 | XAUI_FM2_MAC9, XAUI_FM2_MAC9, |
| 103 | SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2, |
| 104 | SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4}}, |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 105 | {15, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9, |
| 106 | HIGIG_FM2_MAC9, HIGIG_FM2_MAC9, |
| 107 | SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2, |
| 108 | SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 109 | {16, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9, |
| 110 | HIGIG_FM2_MAC9, HIGIG_FM2_MAC9, |
| 111 | SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2, |
| 112 | SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4}}, |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 113 | {21, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9, |
| 114 | HIGIG_FM2_MAC9, HIGIG_FM2_MAC9, |
| 115 | SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2, |
| 116 | SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 117 | {22, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9, |
| 118 | HIGIG_FM2_MAC9, HIGIG_FM2_MAC9, |
| 119 | SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2, |
| 120 | SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4}}, |
| 121 | {23, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9, |
| 122 | HIGIG_FM2_MAC9, HIGIG_FM2_MAC9, |
| 123 | SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2, |
| 124 | SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4}}, |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 125 | {24, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9, |
| 126 | HIGIG_FM2_MAC9, HIGIG_FM2_MAC9, |
| 127 | SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2, |
| 128 | SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 129 | {25, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9, |
| 130 | HIGIG_FM2_MAC9, HIGIG_FM2_MAC9, |
| 131 | SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2, |
| 132 | SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4}}, |
| 133 | {26, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9, |
| 134 | HIGIG_FM2_MAC9, HIGIG_FM2_MAC9, |
| 135 | SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2, |
| 136 | SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4}}, |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 137 | {27, {SGMII_FM2_DTSEC5, SGMII_FM2_DTSEC6, |
| 138 | SGMII_FM2_DTSEC10, SGMII_FM2_DTSEC9, |
| 139 | SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2, |
| 140 | SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 141 | {28, {SGMII_FM2_DTSEC5, SGMII_FM2_DTSEC6, |
| 142 | SGMII_FM2_DTSEC10, SGMII_FM2_DTSEC9, |
| 143 | SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2, |
| 144 | SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4}}, |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 145 | {35, {SGMII_FM2_DTSEC5, SGMII_FM2_DTSEC6, |
| 146 | SGMII_FM2_DTSEC10, SGMII_FM2_DTSEC9, |
| 147 | SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2, |
| 148 | SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 149 | {36, {SGMII_FM2_DTSEC5, SGMII_FM2_DTSEC6, |
| 150 | SGMII_FM2_DTSEC10, SGMII_FM2_DTSEC9, |
| 151 | SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2, |
| 152 | SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4}}, |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 153 | {37, {NONE, NONE, QSGMII_FM2_B, NONE, |
| 154 | NONE, NONE, QSGMII_FM2_A, NONE} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 155 | {38, {NONE, NONE, QSGMII_FM2_B, NONE, |
Shaohui Xie | c218d29 | 2013-08-19 18:58:52 +0800 | [diff] [blame] | 156 | NONE, NONE, QSGMII_FM2_A, NONE} }, |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 157 | {39, {SGMII_FM2_DTSEC5, SGMII_FM2_DTSEC6, |
| 158 | SGMII_FM2_DTSEC10, SGMII_FM2_DTSEC9, |
| 159 | NONE, NONE, QSGMII_FM2_A, NONE} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 160 | {40, {SGMII_FM2_DTSEC5, SGMII_FM2_DTSEC6, |
| 161 | SGMII_FM2_DTSEC10, SGMII_FM2_DTSEC9, |
Shaohui Xie | c218d29 | 2013-08-19 18:58:52 +0800 | [diff] [blame] | 162 | NONE, NONE, QSGMII_FM2_A, NONE} }, |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 163 | {45, {SGMII_FM2_DTSEC5, SGMII_FM2_DTSEC6, |
| 164 | SGMII_FM2_DTSEC10, SGMII_FM2_DTSEC9, |
| 165 | NONE, NONE, QSGMII_FM2_A, NONE} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 166 | {46, {SGMII_FM2_DTSEC5, SGMII_FM2_DTSEC6, |
| 167 | SGMII_FM2_DTSEC10, SGMII_FM2_DTSEC9, |
Shaohui Xie | c218d29 | 2013-08-19 18:58:52 +0800 | [diff] [blame] | 168 | NONE, NONE, QSGMII_FM2_A, NONE} }, |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 169 | {47, {SGMII_FM2_DTSEC5, SGMII_FM2_DTSEC6, |
| 170 | SGMII_FM2_DTSEC10, SGMII_FM2_DTSEC9, |
| 171 | NONE, NONE, QSGMII_FM2_A, NONE} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 172 | {48, {SGMII_FM2_DTSEC5, SGMII_FM2_DTSEC6, |
| 173 | SGMII_FM2_DTSEC10, SGMII_FM2_DTSEC9, |
Shaohui Xie | c218d29 | 2013-08-19 18:58:52 +0800 | [diff] [blame] | 174 | NONE, NONE, QSGMII_FM2_A, NONE} }, |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 175 | {49, {XAUI_FM2_MAC9, XAUI_FM2_MAC9, |
| 176 | XAUI_FM2_MAC9, XAUI_FM2_MAC9, |
| 177 | NONE, NONE, QSGMII_FM2_A, NONE} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 178 | {50, {XAUI_FM2_MAC9, XAUI_FM2_MAC9, |
| 179 | XAUI_FM2_MAC9, XAUI_FM2_MAC9, |
Shaohui Xie | c218d29 | 2013-08-19 18:58:52 +0800 | [diff] [blame] | 180 | NONE, NONE, QSGMII_FM2_A, NONE} }, |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 181 | {51, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9, |
| 182 | HIGIG_FM2_MAC9, HIGIG_FM2_MAC9, |
| 183 | NONE, NONE, QSGMII_FM2_A, NONE} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 184 | {52, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9, |
| 185 | HIGIG_FM2_MAC9, HIGIG_FM2_MAC9, |
Shaohui Xie | c218d29 | 2013-08-19 18:58:52 +0800 | [diff] [blame] | 186 | NONE, NONE, QSGMII_FM2_A, NONE} }, |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 187 | {53, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9, |
| 188 | HIGIG_FM2_MAC9, HIGIG_FM2_MAC9, |
| 189 | NONE, NONE, QSGMII_FM2_A, NONE} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 190 | {54, {HIGIG_FM2_MAC9, HIGIG_FM2_MAC9, |
| 191 | HIGIG_FM2_MAC9, HIGIG_FM2_MAC9, |
Shaohui Xie | c218d29 | 2013-08-19 18:58:52 +0800 | [diff] [blame] | 192 | NONE, NONE, QSGMII_FM2_A, NONE} }, |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 193 | {55, {XFI_FM1_MAC9, XFI_FM1_MAC10, |
| 194 | XFI_FM2_MAC10, XFI_FM2_MAC9, |
| 195 | SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2, |
| 196 | SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 197 | {56, {XFI_FM1_MAC9, XFI_FM1_MAC10, |
| 198 | XFI_FM2_MAC10, XFI_FM2_MAC9, |
| 199 | SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2, |
| 200 | SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4}}, |
| 201 | {57, {XFI_FM1_MAC9, XFI_FM1_MAC10, |
| 202 | XFI_FM2_MAC10, XFI_FM2_MAC9, |
| 203 | SGMII_FM2_DTSEC1, SGMII_FM2_DTSEC2, |
| 204 | SGMII_FM2_DTSEC3, SGMII_FM2_DTSEC4}}, |
| 205 | {} |
| 206 | }; |
York Sun | 85e660f | 2013-03-25 07:33:28 +0000 | [diff] [blame] | 207 | static const struct serdes_config serdes3_cfg_tbl[] = { |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 208 | /* SerDes 3 */ |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 209 | {1, {PCIE1, PCIE1, PCIE1, PCIE1, PCIE1, PCIE1, PCIE1, PCIE1} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 210 | {2, {PCIE1, PCIE1, PCIE1, PCIE1, PCIE1, PCIE1, PCIE1, PCIE1}}, |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 211 | {3, {PCIE1, PCIE1, PCIE1, PCIE1, PCIE2, PCIE2, PCIE2, PCIE2} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 212 | {4, {PCIE1, PCIE1, PCIE1, PCIE1, PCIE2, PCIE2, PCIE2, PCIE2}}, |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 213 | {5, {PCIE1, PCIE1, PCIE1, PCIE1, SRIO1, SRIO1, SRIO1, SRIO1} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 214 | {6, {PCIE1, PCIE1, PCIE1, PCIE1, SRIO1, SRIO1, SRIO1, SRIO1}}, |
Shaohui Xie | 0a8a397 | 2015-07-29 11:28:36 +0800 | [diff] [blame] | 215 | {7, {PCIE1, PCIE1, PCIE1, PCIE1, SRIO1, SRIO1, SRIO1, SRIO1} }, |
| 216 | {8, {PCIE1, PCIE1, PCIE1, PCIE1, SRIO1, SRIO1, SRIO1, SRIO1} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 217 | {9, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN, |
| 218 | INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN}}, |
| 219 | {10, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN, |
| 220 | INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN}}, |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 221 | {11, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN, |
| 222 | PCIE2, PCIE2, PCIE2, PCIE2} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 223 | {12, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN, |
| 224 | PCIE2, PCIE2, PCIE2, PCIE2}}, |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 225 | {13, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN, |
| 226 | PCIE2, PCIE2, PCIE2, PCIE2} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 227 | {14, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN, |
| 228 | PCIE2, PCIE2, PCIE2, PCIE2}}, |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 229 | {15, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN, |
| 230 | SRIO1, SRIO1, SRIO1, SRIO1} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 231 | {16, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN, |
| 232 | SRIO1, SRIO1, SRIO1, SRIO1}}, |
| 233 | {17, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN, |
| 234 | SRIO1, SRIO1, SRIO1, SRIO1}}, |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 235 | {18, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN, |
| 236 | SRIO1, SRIO1, SRIO1, SRIO1} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 237 | {19, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN, |
| 238 | SRIO1, SRIO1, SRIO1, SRIO1}}, |
| 239 | {20, {INTERLAKEN, INTERLAKEN, INTERLAKEN, INTERLAKEN, |
| 240 | SRIO1, SRIO1, SRIO1, SRIO1}}, |
| 241 | {} |
| 242 | }; |
York Sun | 85e660f | 2013-03-25 07:33:28 +0000 | [diff] [blame] | 243 | static const struct serdes_config serdes4_cfg_tbl[] = { |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 244 | /* SerDes 4 */ |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 245 | {1, {PCIE3, PCIE3, PCIE3, PCIE3, PCIE3, PCIE3, PCIE3, PCIE3} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 246 | {2, {PCIE3, PCIE3, PCIE3, PCIE3, PCIE3, PCIE3, PCIE3, PCIE3}}, |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 247 | {3, {PCIE3, PCIE3, PCIE3, PCIE3, PCIE4, PCIE4, PCIE4, PCIE4} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 248 | {4, {PCIE3, PCIE3, PCIE3, PCIE3, PCIE4, PCIE4, PCIE4, PCIE4}}, |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 249 | {5, {PCIE3, PCIE3, PCIE3, PCIE3, SRIO2, SRIO2, SRIO2, SRIO2} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 250 | {6, {PCIE3, PCIE3, PCIE3, PCIE3, SRIO2, SRIO2, SRIO2, SRIO2}}, |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 251 | {7, {PCIE3, PCIE3, PCIE3, PCIE3, SRIO2, SRIO2, SRIO2, SRIO2} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 252 | {8, {PCIE3, PCIE3, PCIE3, PCIE3, SRIO2, SRIO2, SRIO2, SRIO2}}, |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 253 | {9, {PCIE3, PCIE3, PCIE3, PCIE3, PCIE4, PCIE4, SATA1, SATA2} }, |
Roy Zang | cc117ce | 2013-03-25 07:33:18 +0000 | [diff] [blame] | 254 | {10, {PCIE3, PCIE3, PCIE3, PCIE3, PCIE4, PCIE4, SATA1, SATA2} }, |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 255 | {11, {PCIE3, PCIE3, PCIE3, PCIE3, AURORA, AURORA, SATA1, SATA2} }, |
Roy Zang | cc117ce | 2013-03-25 07:33:18 +0000 | [diff] [blame] | 256 | {12, {PCIE3, PCIE3, PCIE3, PCIE3, AURORA, AURORA, SATA1, SATA2} }, |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 257 | {13, {PCIE3, PCIE3, PCIE3, PCIE3, AURORA, AURORA, SRIO2, SRIO2} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 258 | {14, {PCIE3, PCIE3, PCIE3, PCIE3, AURORA, AURORA, SRIO2, SRIO2}}, |
Shaohui Xie | d9a1d83 | 2014-05-16 10:52:33 +0800 | [diff] [blame] | 259 | {15, {PCIE3, PCIE3, PCIE3, PCIE3, AURORA, AURORA, SRIO2, SRIO2} }, |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 260 | {16, {PCIE3, PCIE3, PCIE3, PCIE3, AURORA, AURORA, SRIO2, SRIO2}}, |
| 261 | {18, {PCIE3, PCIE3, PCIE3, PCIE3, AURORA, AURORA, AURORA, AURORA}}, |
| 262 | {} |
| 263 | }; |
York Sun | fb5137a | 2013-03-25 07:33:29 +0000 | [diff] [blame] | 264 | #else |
| 265 | #error "Need to define SerDes protocol" |
| 266 | #endif |
York Sun | 85e660f | 2013-03-25 07:33:28 +0000 | [diff] [blame] | 267 | static const struct serdes_config *serdes_cfg_tbl[] = { |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 268 | serdes1_cfg_tbl, |
| 269 | serdes2_cfg_tbl, |
| 270 | serdes3_cfg_tbl, |
| 271 | serdes4_cfg_tbl, |
| 272 | }; |
| 273 | |
| 274 | enum srds_prtcl serdes_get_prtcl(int serdes, int cfg, int lane) |
| 275 | { |
York Sun | 85e660f | 2013-03-25 07:33:28 +0000 | [diff] [blame] | 276 | const struct serdes_config *ptr; |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 277 | |
| 278 | if (serdes >= ARRAY_SIZE(serdes_cfg_tbl)) |
| 279 | return 0; |
| 280 | |
| 281 | ptr = serdes_cfg_tbl[serdes]; |
| 282 | while (ptr->protocol) { |
| 283 | if (ptr->protocol == cfg) |
| 284 | return ptr->lanes[lane]; |
| 285 | ptr++; |
| 286 | } |
| 287 | return 0; |
| 288 | } |
| 289 | |
| 290 | int is_serdes_prtcl_valid(int serdes, u32 prtcl) |
| 291 | { |
| 292 | int i; |
York Sun | 85e660f | 2013-03-25 07:33:28 +0000 | [diff] [blame] | 293 | const struct serdes_config *ptr; |
York Sun | 9941a22 | 2012-10-08 07:44:19 +0000 | [diff] [blame] | 294 | |
| 295 | if (serdes >= ARRAY_SIZE(serdes_cfg_tbl)) |
| 296 | return 0; |
| 297 | |
| 298 | ptr = serdes_cfg_tbl[serdes]; |
| 299 | while (ptr->protocol) { |
| 300 | if (ptr->protocol == prtcl) |
| 301 | break; |
| 302 | ptr++; |
| 303 | } |
| 304 | |
| 305 | if (!ptr->protocol) |
| 306 | return 0; |
| 307 | |
| 308 | for (i = 0; i < SRDS_MAX_LANES; i++) { |
| 309 | if (ptr->lanes[i] != NONE) |
| 310 | return 1; |
| 311 | } |
| 312 | |
| 313 | return 0; |
| 314 | } |