Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Minghuan Lian | 0e3a2b9 | 2015-03-20 19:28:16 -0700 | [diff] [blame] | 2 | /* |
Priyanka Jain | 1a60253 | 2018-09-27 10:32:05 +0530 | [diff] [blame] | 3 | * Copyright 2018 NXP |
Minghuan Lian | 0e3a2b9 | 2015-03-20 19:28:16 -0700 | [diff] [blame] | 4 | * Copyright 2015 Freescale Semiconductor, Inc. |
Minghuan Lian | 0e3a2b9 | 2015-03-20 19:28:16 -0700 | [diff] [blame] | 5 | */ |
| 6 | |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 7 | #ifndef __FSL_SERDES_H__ |
| 8 | #define __FSL_SERDES_H__ |
Minghuan Lian | 0e3a2b9 | 2015-03-20 19:28:16 -0700 | [diff] [blame] | 9 | |
Ashish Kumar | b25faa2 | 2017-08-31 16:12:53 +0530 | [diff] [blame] | 10 | #ifdef CONFIG_FSL_LSCH3 |
Minghuan Lian | 0e3a2b9 | 2015-03-20 19:28:16 -0700 | [diff] [blame] | 11 | enum srds_prtcl { |
Hou Zhiqiang | b435ae9 | 2016-08-02 19:03:22 +0800 | [diff] [blame] | 12 | /* |
| 13 | * Nobody will check whether the device 'NONE' has been configured, |
| 14 | * So use it to indicate if the serdes_prtcl_map has been initialized. |
| 15 | */ |
Minghuan Lian | 0e3a2b9 | 2015-03-20 19:28:16 -0700 | [diff] [blame] | 16 | NONE = 0, |
| 17 | PCIE1, |
| 18 | PCIE2, |
| 19 | PCIE3, |
| 20 | PCIE4, |
Priyanka Jain | ef76b2e | 2018-10-29 09:17:09 +0000 | [diff] [blame] | 21 | PCIE5, |
| 22 | PCIE6, |
Minghuan Lian | 0e3a2b9 | 2015-03-20 19:28:16 -0700 | [diff] [blame] | 23 | SATA1, |
| 24 | SATA2, |
Priyanka Jain | ef76b2e | 2018-10-29 09:17:09 +0000 | [diff] [blame] | 25 | SATA3, |
| 26 | SATA4, |
Minghuan Lian | 0e3a2b9 | 2015-03-20 19:28:16 -0700 | [diff] [blame] | 27 | XAUI1, |
| 28 | XAUI2, |
| 29 | XFI1, |
| 30 | XFI2, |
| 31 | XFI3, |
| 32 | XFI4, |
| 33 | XFI5, |
| 34 | XFI6, |
| 35 | XFI7, |
| 36 | XFI8, |
Priyanka Jain | ef76b2e | 2018-10-29 09:17:09 +0000 | [diff] [blame] | 37 | XFI9, |
| 38 | XFI10, |
| 39 | XFI11, |
| 40 | XFI12, |
| 41 | XFI13, |
| 42 | XFI14, |
Minghuan Lian | 0e3a2b9 | 2015-03-20 19:28:16 -0700 | [diff] [blame] | 43 | SGMII1, |
| 44 | SGMII2, |
| 45 | SGMII3, |
| 46 | SGMII4, |
| 47 | SGMII5, |
| 48 | SGMII6, |
| 49 | SGMII7, |
| 50 | SGMII8, |
| 51 | SGMII9, |
| 52 | SGMII10, |
| 53 | SGMII11, |
| 54 | SGMII12, |
| 55 | SGMII13, |
| 56 | SGMII14, |
| 57 | SGMII15, |
| 58 | SGMII16, |
Priyanka Jain | ef76b2e | 2018-10-29 09:17:09 +0000 | [diff] [blame] | 59 | SGMII17, |
| 60 | SGMII18, |
Prabhakar Kushwaha | 3c39c08 | 2017-02-15 20:40:00 +0530 | [diff] [blame] | 61 | QSGMII_A, |
| 62 | QSGMII_B, |
| 63 | QSGMII_C, |
| 64 | QSGMII_D, |
Xiaowei Bao | 1eb4459 | 2019-05-21 18:28:31 +0800 | [diff] [blame] | 65 | SGMII_T1, |
| 66 | SGMII_T2, |
| 67 | SGMII_T3, |
| 68 | SGMII_T4, |
| 69 | SXGMII1, |
| 70 | SXGMII2, |
| 71 | SXGMII3, |
| 72 | SXGMII4, |
| 73 | QXGMII1, |
| 74 | QXGMII2, |
| 75 | QXGMII3, |
| 76 | QXGMII4, |
Priyanka Jain | ef76b2e | 2018-10-29 09:17:09 +0000 | [diff] [blame] | 77 | _25GE1, |
| 78 | _25GE2, |
| 79 | _25GE3, |
| 80 | _25GE4, |
| 81 | _25GE5, |
| 82 | _25GE6, |
| 83 | _25GE7, |
| 84 | _25GE8, |
| 85 | _25GE9, |
| 86 | _25GE10, |
| 87 | _40GE1, |
| 88 | _40GE2, |
| 89 | _50GE1, |
| 90 | _50GE2, |
| 91 | _100GE1, |
| 92 | _100GE2, |
Minghuan Lian | 0e3a2b9 | 2015-03-20 19:28:16 -0700 | [diff] [blame] | 93 | SERDES_PRCTL_COUNT |
| 94 | }; |
| 95 | |
| 96 | enum srds { |
| 97 | FSL_SRDS_1 = 0, |
| 98 | FSL_SRDS_2 = 1, |
Priyanka Jain | 1a60253 | 2018-09-27 10:32:05 +0530 | [diff] [blame] | 99 | NXP_SRDS_3 = 2, |
Minghuan Lian | 0e3a2b9 | 2015-03-20 19:28:16 -0700 | [diff] [blame] | 100 | }; |
Prabhakar Kushwaha | 1966d01 | 2016-06-03 18:41:27 +0530 | [diff] [blame] | 101 | #elif defined(CONFIG_FSL_LSCH2) |
Mingkai Hu | e4e93ea | 2015-10-26 19:47:51 +0800 | [diff] [blame] | 102 | enum srds_prtcl { |
Hou Zhiqiang | b435ae9 | 2016-08-02 19:03:22 +0800 | [diff] [blame] | 103 | /* |
| 104 | * Nobody will check whether the device 'NONE' has been configured, |
| 105 | * So use it to indicate if the serdes_prtcl_map has been initialized. |
| 106 | */ |
Mingkai Hu | e4e93ea | 2015-10-26 19:47:51 +0800 | [diff] [blame] | 107 | NONE = 0, |
| 108 | PCIE1, |
| 109 | PCIE2, |
| 110 | PCIE3, |
| 111 | PCIE4, |
| 112 | SATA1, |
| 113 | SATA2, |
| 114 | SRIO1, |
| 115 | SRIO2, |
| 116 | SGMII_FM1_DTSEC1, |
| 117 | SGMII_FM1_DTSEC2, |
| 118 | SGMII_FM1_DTSEC3, |
| 119 | SGMII_FM1_DTSEC4, |
| 120 | SGMII_FM1_DTSEC5, |
| 121 | SGMII_FM1_DTSEC6, |
| 122 | SGMII_FM1_DTSEC9, |
| 123 | SGMII_FM1_DTSEC10, |
| 124 | SGMII_FM2_DTSEC1, |
| 125 | SGMII_FM2_DTSEC2, |
| 126 | SGMII_FM2_DTSEC3, |
| 127 | SGMII_FM2_DTSEC4, |
| 128 | SGMII_FM2_DTSEC5, |
| 129 | SGMII_FM2_DTSEC6, |
| 130 | SGMII_FM2_DTSEC9, |
| 131 | SGMII_FM2_DTSEC10, |
| 132 | SGMII_TSEC1, |
| 133 | SGMII_TSEC2, |
| 134 | SGMII_TSEC3, |
| 135 | SGMII_TSEC4, |
| 136 | XAUI_FM1, |
| 137 | XAUI_FM2, |
| 138 | AURORA, |
| 139 | CPRI1, |
| 140 | CPRI2, |
| 141 | CPRI3, |
| 142 | CPRI4, |
| 143 | CPRI5, |
| 144 | CPRI6, |
| 145 | CPRI7, |
| 146 | CPRI8, |
| 147 | XAUI_FM1_MAC9, |
| 148 | XAUI_FM1_MAC10, |
| 149 | XAUI_FM2_MAC9, |
| 150 | XAUI_FM2_MAC10, |
| 151 | HIGIG_FM1_MAC9, |
| 152 | HIGIG_FM1_MAC10, |
| 153 | HIGIG_FM2_MAC9, |
| 154 | HIGIG_FM2_MAC10, |
| 155 | QSGMII_FM1_A, /* A indicates MACs 1,2,5,6 */ |
| 156 | QSGMII_FM1_B, /* B indicates MACs 5,6,9,10 */ |
| 157 | QSGMII_FM2_A, |
| 158 | QSGMII_FM2_B, |
| 159 | XFI_FM1_MAC1, |
| 160 | XFI_FM1_MAC2, |
| 161 | XFI_FM1_MAC9, |
| 162 | XFI_FM1_MAC10, |
| 163 | XFI_FM2_MAC9, |
| 164 | XFI_FM2_MAC10, |
| 165 | INTERLAKEN, |
| 166 | QSGMII_SW1_A, /* Indicates ports on L2 Switch */ |
| 167 | QSGMII_SW1_B, |
| 168 | SGMII_2500_FM1_DTSEC1, |
| 169 | SGMII_2500_FM1_DTSEC2, |
| 170 | SGMII_2500_FM1_DTSEC3, |
| 171 | SGMII_2500_FM1_DTSEC4, |
| 172 | SGMII_2500_FM1_DTSEC5, |
| 173 | SGMII_2500_FM1_DTSEC6, |
| 174 | SGMII_2500_FM1_DTSEC9, |
| 175 | SGMII_2500_FM1_DTSEC10, |
| 176 | SGMII_2500_FM2_DTSEC1, |
| 177 | SGMII_2500_FM2_DTSEC2, |
| 178 | SGMII_2500_FM2_DTSEC3, |
| 179 | SGMII_2500_FM2_DTSEC4, |
| 180 | SGMII_2500_FM2_DTSEC5, |
| 181 | SGMII_2500_FM2_DTSEC6, |
| 182 | SGMII_2500_FM2_DTSEC9, |
| 183 | SGMII_2500_FM2_DTSEC10, |
Prabhakar Kushwaha | d169ebe | 2016-06-03 18:41:31 +0530 | [diff] [blame] | 184 | TX_CLK, |
Mingkai Hu | e4e93ea | 2015-10-26 19:47:51 +0800 | [diff] [blame] | 185 | SERDES_PRCTL_COUNT |
| 186 | }; |
| 187 | |
| 188 | enum srds { |
| 189 | FSL_SRDS_1 = 0, |
Qianyu Gong | 2b5b7a9 | 2016-07-05 16:01:54 +0800 | [diff] [blame] | 190 | FSL_SRDS_2 = 1, |
Mingkai Hu | e4e93ea | 2015-10-26 19:47:51 +0800 | [diff] [blame] | 191 | }; |
| 192 | |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 193 | #endif |
Minghuan Lian | 0e3a2b9 | 2015-03-20 19:28:16 -0700 | [diff] [blame] | 194 | |
| 195 | int is_serdes_configured(enum srds_prtcl device); |
| 196 | void fsl_serdes_init(void); |
Minghuan Lian | 0e3a2b9 | 2015-03-20 19:28:16 -0700 | [diff] [blame] | 197 | int serdes_get_first_lane(u32 sd, enum srds_prtcl device); |
| 198 | enum srds_prtcl serdes_get_prtcl(int serdes, int cfg, int lane); |
| 199 | int is_serdes_prtcl_valid(int serdes, u32 prtcl); |
Ashish Kumar | b25faa2 | 2017-08-31 16:12:53 +0530 | [diff] [blame] | 200 | int serdes_get_number(int serdes, int cfg); |
Ashish Kumar | ec455e2 | 2017-08-31 16:37:31 +0530 | [diff] [blame] | 201 | void fsl_rgmii_init(void); |
Minghuan Lian | 0e3a2b9 | 2015-03-20 19:28:16 -0700 | [diff] [blame] | 202 | |
Mingkai Hu | cd54c0f | 2016-07-05 16:01:55 +0800 | [diff] [blame] | 203 | #ifdef CONFIG_FSL_LSCH2 |
Mingkai Hu | e4e93ea | 2015-10-26 19:47:51 +0800 | [diff] [blame] | 204 | const char *serdes_clock_to_string(u32 clock); |
| 205 | int get_serdes_protocol(void); |
Rajesh Bhagat | 814e077 | 2018-01-17 16:13:00 +0530 | [diff] [blame] | 206 | #endif |
Hou Zhiqiang | 4ad5999 | 2016-12-09 16:09:00 +0800 | [diff] [blame] | 207 | #ifdef CONFIG_SYS_HAS_SERDES |
| 208 | /* Get the volt of SVDD in unit mV */ |
| 209 | int get_serdes_volt(void); |
| 210 | /* Set the volt of SVDD in unit mV */ |
| 211 | int set_serdes_volt(int svdd); |
| 212 | /* The target volt of SVDD in unit mV */ |
| 213 | int setup_serdes_volt(u32 svdd); |
| 214 | #endif |
Mingkai Hu | e4e93ea | 2015-10-26 19:47:51 +0800 | [diff] [blame] | 215 | |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 216 | #endif /* __FSL_SERDES_H__ */ |