blob: 8f4365175697db6a8dd362743f206c3e97c8a1ef [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Minghuan Lian0e3a2b92015-03-20 19:28:16 -07002/*
Priyanka Jain1a602532018-09-27 10:32:05 +05303 * Copyright 2018 NXP
Minghuan Lian0e3a2b92015-03-20 19:28:16 -07004 * Copyright 2015 Freescale Semiconductor, Inc.
Minghuan Lian0e3a2b92015-03-20 19:28:16 -07005 */
6
Mingkai Hu0e58b512015-10-26 19:47:50 +08007#ifndef __FSL_SERDES_H__
8#define __FSL_SERDES_H__
Minghuan Lian0e3a2b92015-03-20 19:28:16 -07009
10#include <config.h>
11
Ashish Kumarb25faa22017-08-31 16:12:53 +053012#ifdef CONFIG_FSL_LSCH3
Minghuan Lian0e3a2b92015-03-20 19:28:16 -070013enum srds_prtcl {
Hou Zhiqiangb435ae92016-08-02 19:03:22 +080014 /*
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 Lian0e3a2b92015-03-20 19:28:16 -070018 NONE = 0,
19 PCIE1,
20 PCIE2,
21 PCIE3,
22 PCIE4,
Priyanka Jainef76b2e2018-10-29 09:17:09 +000023 PCIE5,
24 PCIE6,
Minghuan Lian0e3a2b92015-03-20 19:28:16 -070025 SATA1,
26 SATA2,
Priyanka Jainef76b2e2018-10-29 09:17:09 +000027 SATA3,
28 SATA4,
Minghuan Lian0e3a2b92015-03-20 19:28:16 -070029 XAUI1,
30 XAUI2,
31 XFI1,
32 XFI2,
33 XFI3,
34 XFI4,
35 XFI5,
36 XFI6,
37 XFI7,
38 XFI8,
Priyanka Jainef76b2e2018-10-29 09:17:09 +000039 XFI9,
40 XFI10,
41 XFI11,
42 XFI12,
43 XFI13,
44 XFI14,
Minghuan Lian0e3a2b92015-03-20 19:28:16 -070045 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 Jainef76b2e2018-10-29 09:17:09 +000061 SGMII17,
62 SGMII18,
Prabhakar Kushwaha3c39c082017-02-15 20:40:00 +053063 QSGMII_A,
64 QSGMII_B,
65 QSGMII_C,
66 QSGMII_D,
Xiaowei Bao1eb44592019-05-21 18:28:31 +080067 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 Jainef76b2e2018-10-29 09:17:09 +000079 _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 Lian0e3a2b92015-03-20 19:28:16 -070095 SERDES_PRCTL_COUNT
96};
97
98enum srds {
99 FSL_SRDS_1 = 0,
100 FSL_SRDS_2 = 1,
Priyanka Jain1a602532018-09-27 10:32:05 +0530101 NXP_SRDS_3 = 2,
Minghuan Lian0e3a2b92015-03-20 19:28:16 -0700102};
Prabhakar Kushwaha1966d012016-06-03 18:41:27 +0530103#elif defined(CONFIG_FSL_LSCH2)
Mingkai Hue4e93ea2015-10-26 19:47:51 +0800104enum srds_prtcl {
Hou Zhiqiangb435ae92016-08-02 19:03:22 +0800105 /*
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 Hue4e93ea2015-10-26 19:47:51 +0800109 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 Kushwahad169ebe2016-06-03 18:41:31 +0530186 TX_CLK,
Mingkai Hue4e93ea2015-10-26 19:47:51 +0800187 SERDES_PRCTL_COUNT
188};
189
190enum srds {
191 FSL_SRDS_1 = 0,
Qianyu Gong2b5b7a92016-07-05 16:01:54 +0800192 FSL_SRDS_2 = 1,
Mingkai Hue4e93ea2015-10-26 19:47:51 +0800193};
194
Mingkai Hu0e58b512015-10-26 19:47:50 +0800195#endif
Minghuan Lian0e3a2b92015-03-20 19:28:16 -0700196
197int is_serdes_configured(enum srds_prtcl device);
198void fsl_serdes_init(void);
Minghuan Lian0e3a2b92015-03-20 19:28:16 -0700199int serdes_get_first_lane(u32 sd, enum srds_prtcl device);
200enum srds_prtcl serdes_get_prtcl(int serdes, int cfg, int lane);
201int is_serdes_prtcl_valid(int serdes, u32 prtcl);
Ashish Kumarb25faa22017-08-31 16:12:53 +0530202int serdes_get_number(int serdes, int cfg);
Ashish Kumarec455e22017-08-31 16:37:31 +0530203void fsl_rgmii_init(void);
Minghuan Lian0e3a2b92015-03-20 19:28:16 -0700204
Mingkai Hucd54c0f2016-07-05 16:01:55 +0800205#ifdef CONFIG_FSL_LSCH2
Mingkai Hue4e93ea2015-10-26 19:47:51 +0800206const char *serdes_clock_to_string(u32 clock);
207int get_serdes_protocol(void);
Rajesh Bhagat814e0772018-01-17 16:13:00 +0530208#endif
Hou Zhiqiang4ad59992016-12-09 16:09:00 +0800209#ifdef CONFIG_SYS_HAS_SERDES
210/* Get the volt of SVDD in unit mV */
211int get_serdes_volt(void);
212/* Set the volt of SVDD in unit mV */
213int set_serdes_volt(int svdd);
214/* The target volt of SVDD in unit mV */
215int setup_serdes_volt(u32 svdd);
216#endif
Mingkai Hue4e93ea2015-10-26 19:47:51 +0800217
Mingkai Hu0e58b512015-10-26 19:47:50 +0800218#endif /* __FSL_SERDES_H__ */