Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
York Sun | bcf7b3d | 2012-10-08 07:44:20 +0000 | [diff] [blame] | 2 | /* |
| 3 | * Copyright 2012 Freescale Semiconductor, Inc. |
York Sun | bcf7b3d | 2012-10-08 07:44:20 +0000 | [diff] [blame] | 4 | */ |
| 5 | |
York Sun | bcf7b3d | 2012-10-08 07:44:20 +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 | u8 protocol; |
| 13 | u8 lanes[SRDS_MAX_LANES]; |
| 14 | }; |
| 15 | |
York Sun | 68eaa9a | 2016-11-18 11:44:43 -0800 | [diff] [blame] | 16 | #ifdef CONFIG_ARCH_B4860 |
York Sun | bcf7b3d | 2012-10-08 07:44:20 +0000 | [diff] [blame] | 17 | static struct serdes_config serdes1_cfg_tbl[] = { |
| 18 | /* SerDes 1 */ |
Shaveta Leekha | b4d75ed | 2014-11-12 16:02:25 +0530 | [diff] [blame] | 19 | {0x01, {AURORA, AURORA, CPRI6, CPRI5, |
| 20 | CPRI4, CPRI3, CPRI2, CPRI1} }, |
Shaveta Leekha | 8d2ba98 | 2014-02-26 16:06:30 +0530 | [diff] [blame] | 21 | {0x02, {AURORA, AURORA, CPRI6, CPRI5, |
| 22 | CPRI4, CPRI3, CPRI2, CPRI1} }, |
| 23 | {0x04, {AURORA, AURORA, CPRI6, CPRI5, |
| 24 | CPRI4, CPRI3, CPRI2, CPRI1} }, |
| 25 | {0x05, {AURORA, AURORA, CPRI6, CPRI5, |
| 26 | CPRI4, CPRI3, CPRI2, CPRI1} }, |
| 27 | {0x06, {AURORA, AURORA, CPRI6, CPRI5, |
| 28 | CPRI4, CPRI3, CPRI2, CPRI1} }, |
Shaveta Leekha | b4d75ed | 2014-11-12 16:02:25 +0530 | [diff] [blame] | 29 | {0x07, {AURORA, AURORA, CPRI6, CPRI5, |
| 30 | CPRI4, CPRI3, CPRI2, CPRI1} }, |
Shaveta Leekha | 8d2ba98 | 2014-02-26 16:06:30 +0530 | [diff] [blame] | 31 | {0x08, {AURORA, AURORA, CPRI6, CPRI5, |
| 32 | CPRI4, CPRI3, CPRI2, CPRI1} }, |
| 33 | {0x09, {AURORA, AURORA, CPRI6, CPRI5, |
| 34 | CPRI4, CPRI3, CPRI2, CPRI1} }, |
| 35 | {0x0A, {AURORA, AURORA, CPRI6, CPRI5, |
| 36 | CPRI4, CPRI3, CPRI2, CPRI1} }, |
| 37 | {0x0B, {AURORA, AURORA, CPRI6, CPRI5, |
| 38 | CPRI4, CPRI3, CPRI2, CPRI1} }, |
| 39 | {0x0C, {AURORA, AURORA, CPRI6, CPRI5, |
| 40 | CPRI4, CPRI3, CPRI2, CPRI1} }, |
York Sun | bcf7b3d | 2012-10-08 07:44:20 +0000 | [diff] [blame] | 41 | {0x0D, {CPRI8, CPRI7, CPRI6, CPRI5, |
| 42 | CPRI4, CPRI3, CPRI2, CPRI1}}, |
| 43 | {0x0E, {CPRI8, CPRI7, CPRI6, CPRI5, |
| 44 | CPRI4, CPRI3, CPRI2, CPRI1}}, |
| 45 | {0x12, {CPRI8, CPRI7, CPRI6, CPRI5, |
| 46 | CPRI4, CPRI3, CPRI2, CPRI1}}, |
poonam aggrwal | 331dd1d | 2014-02-17 08:38:58 +0530 | [diff] [blame] | 47 | {0x29, {SGMII_FM1_DTSEC5, SGMII_FM1_DTSEC6, |
| 48 | CPRI6, CPRI5, CPRI4, CPRI3, CPRI2, CPRI1} }, |
York Sun | bcf7b3d | 2012-10-08 07:44:20 +0000 | [diff] [blame] | 49 | {0x2a, {SGMII_FM1_DTSEC5, SGMII_FM1_DTSEC6, |
| 50 | CPRI6, CPRI5, CPRI4, CPRI3, CPRI2, CPRI1}}, |
Poonam Aggrwal | 1c85955 | 2012-12-23 19:22:33 +0000 | [diff] [blame] | 51 | {0x2C, {SGMII_FM1_DTSEC5, SGMII_FM1_DTSEC6, |
| 52 | CPRI6, CPRI5, CPRI4, CPRI3, CPRI2, CPRI1}}, |
| 53 | {0x2D, {SGMII_FM1_DTSEC5, SGMII_FM1_DTSEC6, |
| 54 | CPRI6, CPRI5, CPRI4, CPRI3, CPRI2, CPRI1}}, |
| 55 | {0x2E, {SGMII_FM1_DTSEC5, SGMII_FM1_DTSEC6, |
| 56 | CPRI6, CPRI5, CPRI4, CPRI3, CPRI2, CPRI1}}, |
poonam aggrwal | 331dd1d | 2014-02-17 08:38:58 +0530 | [diff] [blame] | 57 | {0x2F, {AURORA, AURORA, |
| 58 | SGMII_FM1_DTSEC3, SGMII_FM1_DTSEC4, |
| 59 | CPRI4, CPRI3, CPRI2, CPRI1} }, |
York Sun | bcf7b3d | 2012-10-08 07:44:20 +0000 | [diff] [blame] | 60 | {0x30, {AURORA, AURORA, |
| 61 | SGMII_FM1_DTSEC3, SGMII_FM1_DTSEC4, |
| 62 | CPRI4, CPRI3, CPRI2, CPRI1}}, |
| 63 | {0x32, {AURORA, AURORA, |
| 64 | SGMII_FM1_DTSEC3, SGMII_FM1_DTSEC4, |
| 65 | CPRI4, CPRI3, CPRI2, CPRI1}}, |
| 66 | {0x33, {AURORA, AURORA, |
| 67 | SGMII_FM1_DTSEC3, SGMII_FM1_DTSEC4, |
| 68 | CPRI4, CPRI3, CPRI2, CPRI1}}, |
| 69 | {0x34, {AURORA, AURORA, |
| 70 | SGMII_FM1_DTSEC3, SGMII_FM1_DTSEC4, |
| 71 | CPRI4, CPRI3, CPRI2, CPRI1}}, |
Shaveta Leekha | 8d2ba98 | 2014-02-26 16:06:30 +0530 | [diff] [blame] | 72 | {0x39, {AURORA, AURORA, CPRI6, CPRI5, |
| 73 | CPRI4, CPRI3, CPRI2, CPRI1} }, |
| 74 | {0x3A, {AURORA, AURORA, CPRI6, CPRI5, |
| 75 | CPRI4, CPRI3, CPRI2, CPRI1} }, |
| 76 | {0x3C, {AURORA, AURORA, CPRI6, CPRI5, |
| 77 | CPRI4, CPRI3, CPRI2, CPRI1} }, |
| 78 | {0x3D, {AURORA, AURORA, CPRI6, CPRI5, |
| 79 | CPRI4, CPRI3, CPRI2, CPRI1} }, |
York Sun | bcf7b3d | 2012-10-08 07:44:20 +0000 | [diff] [blame] | 80 | {0x3E, {CPRI8, CPRI7, CPRI6, CPRI5, |
| 81 | CPRI4, CPRI3, CPRI2, CPRI1}}, |
Shaveta Leekha | 8d2ba98 | 2014-02-26 16:06:30 +0530 | [diff] [blame] | 82 | {0x5C, {AURORA, AURORA, |
| 83 | SGMII_FM1_DTSEC3, SGMII_FM1_DTSEC4, |
| 84 | CPRI4, CPRI3, CPRI2, CPRI1} }, |
| 85 | {0x5D, {AURORA, AURORA, |
| 86 | SGMII_FM1_DTSEC3, SGMII_FM1_DTSEC4, |
| 87 | CPRI4, CPRI3, CPRI2, CPRI1} }, |
York Sun | bcf7b3d | 2012-10-08 07:44:20 +0000 | [diff] [blame] | 88 | {} |
| 89 | }; |
| 90 | static struct serdes_config serdes2_cfg_tbl[] = { |
| 91 | /* SerDes 2 */ |
poonam aggrwal | 331dd1d | 2014-02-17 08:38:58 +0530 | [diff] [blame] | 92 | {0x17, {SGMII_FM1_DTSEC1, SGMII_FM1_DTSEC2, |
| 93 | SGMII_FM1_DTSEC3, SGMII_FM1_DTSEC4, |
| 94 | AURORA, AURORA, SRIO1, SRIO1} }, |
York Sun | bcf7b3d | 2012-10-08 07:44:20 +0000 | [diff] [blame] | 95 | {0x18, {SGMII_FM1_DTSEC1, SGMII_FM1_DTSEC2, |
| 96 | SGMII_FM1_DTSEC3, SGMII_FM1_DTSEC4, |
| 97 | AURORA, AURORA, SRIO1, SRIO1}}, |
| 98 | {0x1D, {SGMII_FM1_DTSEC1, SGMII_FM1_DTSEC2, |
| 99 | SGMII_FM1_DTSEC3, SGMII_FM1_DTSEC4, |
| 100 | AURORA, AURORA, SRIO1, SRIO1}}, |
poonam aggrwal | 331dd1d | 2014-02-17 08:38:58 +0530 | [diff] [blame] | 101 | {0x2A, {SGMII_FM1_DTSEC1, SGMII_FM1_DTSEC2, |
| 102 | SRIO2, SRIO2, |
| 103 | AURORA, AURORA, SRIO1, SRIO1} }, |
York Sun | bcf7b3d | 2012-10-08 07:44:20 +0000 | [diff] [blame] | 104 | {0x2B, {SGMII_FM1_DTSEC1, SGMII_FM1_DTSEC2, |
| 105 | SRIO2, SRIO2, |
| 106 | AURORA, AURORA, SRIO1, SRIO1}}, |
| 107 | {0x30, {SGMII_FM1_DTSEC1, SGMII_FM1_DTSEC2, |
| 108 | SRIO2, SRIO2, |
| 109 | AURORA, AURORA, |
| 110 | SRIO1, SRIO1}}, |
poonam aggrwal | 331dd1d | 2014-02-17 08:38:58 +0530 | [diff] [blame] | 111 | {0x48, {SGMII_FM1_DTSEC1, SGMII_FM1_DTSEC2, |
| 112 | SGMII_FM1_DTSEC3, AURORA, |
| 113 | SRIO1, SRIO1, SRIO1, SRIO1} }, |
York Sun | bcf7b3d | 2012-10-08 07:44:20 +0000 | [diff] [blame] | 114 | {0x49, {SGMII_FM1_DTSEC1, SGMII_FM1_DTSEC2, |
| 115 | SGMII_FM1_DTSEC3, AURORA, |
| 116 | SRIO1, SRIO1, SRIO1, SRIO1}}, |
| 117 | {0x4A, {SGMII_FM1_DTSEC1, SGMII_FM1_DTSEC2, |
| 118 | SGMII_FM1_DTSEC3, AURORA, |
| 119 | SRIO1, SRIO1, SRIO1, SRIO1}}, |
| 120 | {0x4C, {SGMII_FM1_DTSEC1, SGMII_FM1_DTSEC2, |
| 121 | SGMII_FM1_DTSEC3, AURORA, |
| 122 | SRIO1, SRIO1, SRIO1, SRIO1}}, |
| 123 | {0x4E, {SGMII_FM1_DTSEC1, SGMII_FM1_DTSEC2, |
| 124 | SGMII_FM1_DTSEC3, AURORA, |
| 125 | SRIO1, SRIO1, SRIO1, SRIO1}}, |
poonam aggrwal | 331dd1d | 2014-02-17 08:38:58 +0530 | [diff] [blame] | 126 | {0x79, {SRIO2, SRIO2, SRIO2, SRIO2, |
| 127 | SRIO1, SRIO1, SRIO1, SRIO1} }, |
Poonam Aggrwal | 1c85955 | 2012-12-23 19:22:33 +0000 | [diff] [blame] | 128 | {0x7A, {SRIO2, SRIO2, SRIO2, SRIO2, |
| 129 | SRIO1, SRIO1, SRIO1, SRIO1}}, |
poonam aggrwal | 331dd1d | 2014-02-17 08:38:58 +0530 | [diff] [blame] | 130 | {0x83, {SGMII_FM1_DTSEC1, SGMII_FM1_DTSEC2, |
| 131 | SRIO2, SRIO2, AURORA, AURORA, |
| 132 | XFI_FM1_MAC9, XFI_FM1_MAC10} }, |
York Sun | bcf7b3d | 2012-10-08 07:44:20 +0000 | [diff] [blame] | 133 | {0x84, {SGMII_FM1_DTSEC1, SGMII_FM1_DTSEC2, |
| 134 | SRIO2, SRIO2, AURORA, AURORA, |
| 135 | XFI_FM1_MAC9, XFI_FM1_MAC10}}, |
| 136 | {0x85, {SGMII_FM1_DTSEC1, SGMII_FM1_DTSEC2, |
| 137 | SRIO2, SRIO2, AURORA, AURORA, |
| 138 | XFI_FM1_MAC9, XFI_FM1_MAC10}}, |
poonam aggrwal | 331dd1d | 2014-02-17 08:38:58 +0530 | [diff] [blame] | 139 | {0x86, {SGMII_FM1_DTSEC1, SGMII_FM1_DTSEC2, |
| 140 | SRIO2, SRIO2, |
| 141 | SGMII_FM1_DTSEC3, SGMII_FM1_DTSEC4, |
| 142 | XFI_FM1_MAC9, XFI_FM1_MAC10} }, |
York Sun | bcf7b3d | 2012-10-08 07:44:20 +0000 | [diff] [blame] | 143 | {0x87, {SGMII_FM1_DTSEC1, SGMII_FM1_DTSEC2, |
| 144 | SRIO2, SRIO2, |
| 145 | SGMII_FM1_DTSEC3, SGMII_FM1_DTSEC4, |
| 146 | XFI_FM1_MAC9, XFI_FM1_MAC10}}, |
poonam aggrwal | 331dd1d | 2014-02-17 08:38:58 +0530 | [diff] [blame] | 147 | {0x8C, {SRIO2, SRIO2, SRIO2, SRIO2, |
| 148 | SGMII_FM1_DTSEC3, SGMII_FM1_DTSEC4, |
| 149 | XFI_FM1_MAC9, XFI_FM1_MAC10} }, |
Poonam Aggrwal | 1c85955 | 2012-12-23 19:22:33 +0000 | [diff] [blame] | 150 | {0x8D, {SRIO2, SRIO2, SRIO2, SRIO2, |
| 151 | SGMII_FM1_DTSEC3, SGMII_FM1_DTSEC4, |
| 152 | XFI_FM1_MAC9, XFI_FM1_MAC10}}, |
York Sun | bcf7b3d | 2012-10-08 07:44:20 +0000 | [diff] [blame] | 153 | {0x93, {SGMII_FM1_DTSEC1, SGMII_FM1_DTSEC2, |
| 154 | SGMII_FM1_DTSEC3, SGMII_FM1_DTSEC4, |
| 155 | XAUI_FM1_MAC10, XAUI_FM1_MAC10, |
| 156 | XAUI_FM1_MAC10, XAUI_FM1_MAC10}}, |
| 157 | {0x9E, {PCIE1, PCIE1, PCIE1, PCIE1, |
| 158 | XAUI_FM1_MAC10, XAUI_FM1_MAC10, |
| 159 | XAUI_FM1_MAC10, XAUI_FM1_MAC10}}, |
| 160 | {0x9A, {PCIE1, PCIE1, |
| 161 | SGMII_FM1_DTSEC3, SGMII_FM1_DTSEC4, |
| 162 | XAUI_FM1_MAC10, XAUI_FM1_MAC10, |
| 163 | XAUI_FM1_MAC10, XAUI_FM1_MAC10}}, |
poonam aggrwal | 331dd1d | 2014-02-17 08:38:58 +0530 | [diff] [blame] | 164 | {0xB1, {PCIE1, PCIE1, PCIE1, PCIE1, |
| 165 | SGMII_FM1_DTSEC3, SGMII_FM1_DTSEC4, |
| 166 | XFI_FM1_MAC9, XFI_FM1_MAC10} }, |
York Sun | bcf7b3d | 2012-10-08 07:44:20 +0000 | [diff] [blame] | 167 | {0xB2, {PCIE1, PCIE1, PCIE1, PCIE1, |
| 168 | SGMII_FM1_DTSEC3, SGMII_FM1_DTSEC4, |
| 169 | XFI_FM1_MAC9, XFI_FM1_MAC10}}, |
| 170 | {0xC3, {XAUI_FM1_MAC9, XAUI_FM1_MAC9, |
| 171 | XAUI_FM1_MAC9, XAUI_FM1_MAC9, |
| 172 | SRIO1, SRIO1, SRIO1, SRIO1}}, |
Poonam Aggrwal | 1c85955 | 2012-12-23 19:22:33 +0000 | [diff] [blame] | 173 | {0x98, {XAUI_FM1_MAC9, XAUI_FM1_MAC9, |
| 174 | XAUI_FM1_MAC9, XAUI_FM1_MAC9, |
| 175 | XAUI_FM1_MAC10, XAUI_FM1_MAC10, |
| 176 | XAUI_FM1_MAC10, XAUI_FM1_MAC10}}, |
York Sun | bcf7b3d | 2012-10-08 07:44:20 +0000 | [diff] [blame] | 177 | {} |
| 178 | }; |
Poonam Aggrwal | 248865e | 2012-12-23 19:24:16 +0000 | [diff] [blame] | 179 | #endif |
| 180 | |
York Sun | fda566d | 2016-11-18 11:56:57 -0800 | [diff] [blame] | 181 | #ifdef CONFIG_ARCH_B4420 |
Poonam Aggrwal | 248865e | 2012-12-23 19:24:16 +0000 | [diff] [blame] | 182 | static struct serdes_config serdes1_cfg_tbl[] = { |
| 183 | {0x0D, {NONE, NONE, CPRI6, CPRI5, |
| 184 | CPRI4, CPRI3, NONE, NONE} }, |
| 185 | {0x0E, {NONE, NONE, CPRI8, CPRI5, |
| 186 | CPRI4, CPRI3, NONE, NONE} }, |
| 187 | {0x0F, {NONE, NONE, CPRI6, CPRI5, |
| 188 | CPRI4, CPRI3, NONE, NONE} }, |
Shaveta Leekha | b4d75ed | 2014-11-12 16:02:25 +0530 | [diff] [blame] | 189 | {0x17, {NONE, NONE, |
| 190 | SGMII_FM1_DTSEC3, SGMII_FM1_DTSEC4, |
| 191 | NONE, NONE, NONE, NONE} }, |
Poonam Aggrwal | 248865e | 2012-12-23 19:24:16 +0000 | [diff] [blame] | 192 | {0x18, {NONE, NONE, |
| 193 | SGMII_FM1_DTSEC3, SGMII_FM1_DTSEC4, |
| 194 | NONE, NONE, NONE, NONE} }, |
| 195 | {0x1B, {NONE, NONE, |
| 196 | SGMII_FM1_DTSEC3, SGMII_FM1_DTSEC4, |
| 197 | NONE, NONE, NONE, NONE} }, |
Shaveta Leekha | b4d75ed | 2014-11-12 16:02:25 +0530 | [diff] [blame] | 198 | {0x1D, {NONE, NONE, AURORA, AURORA, |
| 199 | NONE, NONE, NONE, NONE} }, |
Poonam Aggrwal | 248865e | 2012-12-23 19:24:16 +0000 | [diff] [blame] | 200 | {0x1E, {NONE, NONE, AURORA, AURORA, |
| 201 | NONE, NONE, NONE, NONE} }, |
| 202 | {0x21, {NONE, NONE, AURORA, AURORA, |
| 203 | NONE, NONE, NONE, NONE} }, |
| 204 | {0x3E, {NONE, NONE, CPRI6, CPRI5, |
| 205 | CPRI4, CPRI3, NONE, NONE} }, |
| 206 | {} |
| 207 | }; |
| 208 | static struct serdes_config serdes2_cfg_tbl[] = { |
Shaveta Leekha | b4d75ed | 2014-11-12 16:02:25 +0530 | [diff] [blame] | 209 | {0x48, {SGMII_FM1_DTSEC1, SGMII_FM1_DTSEC2, |
| 210 | SGMII_FM1_DTSEC3, AURORA, |
| 211 | NONE, NONE, NONE, NONE} }, |
Poonam Aggrwal | 248865e | 2012-12-23 19:24:16 +0000 | [diff] [blame] | 212 | {0x49, {SGMII_FM1_DTSEC1, SGMII_FM1_DTSEC2, |
| 213 | SGMII_FM1_DTSEC3, AURORA, |
| 214 | NONE, NONE, NONE, NONE} }, |
| 215 | {0x4A, {SGMII_FM1_DTSEC1, SGMII_FM1_DTSEC2, |
| 216 | SGMII_FM1_DTSEC3, AURORA, |
| 217 | NONE, NONE, NONE, NONE} }, |
Shaveta Leekha | b4d75ed | 2014-11-12 16:02:25 +0530 | [diff] [blame] | 218 | {0x6E, {SGMII_FM1_DTSEC1, SGMII_FM1_DTSEC2, |
| 219 | AURORA, AURORA, NONE, NONE, NONE, NONE} }, |
Poonam Aggrwal | 248865e | 2012-12-23 19:24:16 +0000 | [diff] [blame] | 220 | {0x6F, {SGMII_FM1_DTSEC1, SGMII_FM1_DTSEC2, |
| 221 | AURORA, AURORA, NONE, NONE, NONE, NONE} }, |
| 222 | {0x70, {SGMII_FM1_DTSEC1, SGMII_FM1_DTSEC2, |
| 223 | AURORA, AURORA, NONE, NONE, NONE, NONE} }, |
Shaveta Leekha | b4d75ed | 2014-11-12 16:02:25 +0530 | [diff] [blame] | 224 | {0x99, {PCIE1, PCIE1, |
| 225 | SGMII_FM1_DTSEC3, SGMII_FM1_DTSEC4, |
| 226 | NONE, NONE, NONE, NONE} }, |
Poonam Aggrwal | 248865e | 2012-12-23 19:24:16 +0000 | [diff] [blame] | 227 | {0x9A, {PCIE1, PCIE1, |
| 228 | SGMII_FM1_DTSEC3, SGMII_FM1_DTSEC4, |
| 229 | NONE, NONE, NONE, NONE} }, |
Shaveta Leekha | b4d75ed | 2014-11-12 16:02:25 +0530 | [diff] [blame] | 230 | {0x9D, {PCIE1, PCIE1, PCIE1, PCIE1, |
| 231 | NONE, NONE, NONE, NONE} }, |
Poonam Aggrwal | 248865e | 2012-12-23 19:24:16 +0000 | [diff] [blame] | 232 | {0x9E, {PCIE1, PCIE1, PCIE1, PCIE1, |
| 233 | NONE, NONE, NONE, NONE} }, |
| 234 | {} |
| 235 | }; |
| 236 | #endif |
| 237 | |
York Sun | bcf7b3d | 2012-10-08 07:44:20 +0000 | [diff] [blame] | 238 | static struct serdes_config *serdes_cfg_tbl[] = { |
| 239 | serdes1_cfg_tbl, |
| 240 | serdes2_cfg_tbl, |
| 241 | }; |
| 242 | |
| 243 | enum srds_prtcl serdes_get_prtcl(int serdes, int cfg, int lane) |
| 244 | { |
| 245 | struct serdes_config *ptr; |
| 246 | |
| 247 | if (serdes >= ARRAY_SIZE(serdes_cfg_tbl)) |
| 248 | return 0; |
| 249 | |
| 250 | ptr = serdes_cfg_tbl[serdes]; |
| 251 | while (ptr->protocol) { |
| 252 | if (ptr->protocol == cfg) |
| 253 | return ptr->lanes[lane]; |
| 254 | ptr++; |
| 255 | } |
| 256 | |
| 257 | return 0; |
| 258 | } |
| 259 | |
| 260 | int is_serdes_prtcl_valid(int serdes, u32 prtcl) |
| 261 | { |
| 262 | int i; |
| 263 | struct serdes_config *ptr; |
| 264 | |
| 265 | if (serdes >= ARRAY_SIZE(serdes_cfg_tbl)) |
| 266 | return 0; |
| 267 | |
| 268 | ptr = serdes_cfg_tbl[serdes]; |
| 269 | while (ptr->protocol) { |
| 270 | if (ptr->protocol == prtcl) |
| 271 | break; |
| 272 | ptr++; |
| 273 | } |
| 274 | |
| 275 | if (!ptr->protocol) |
| 276 | return 0; |
| 277 | |
| 278 | for (i = 0; i < SRDS_MAX_LANES; i++) { |
| 279 | if (ptr->lanes[i] != NONE) |
| 280 | return 1; |
| 281 | } |
| 282 | |
| 283 | return 0; |
| 284 | } |