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