blob: 9e29350ca4ba894b54834e012366b8d8ee53b1f2 [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
Ashish Kumarb25faa22017-08-31 16:12:53 +053010#ifdef CONFIG_FSL_LSCH3
Minghuan Lian0e3a2b92015-03-20 19:28:16 -070011enum srds_prtcl {
Hou Zhiqiangb435ae92016-08-02 19:03:22 +080012 /*
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 Lian0e3a2b92015-03-20 19:28:16 -070016 NONE = 0,
17 PCIE1,
18 PCIE2,
19 PCIE3,
20 PCIE4,
Priyanka Jainef76b2e2018-10-29 09:17:09 +000021 PCIE5,
22 PCIE6,
Minghuan Lian0e3a2b92015-03-20 19:28:16 -070023 SATA1,
24 SATA2,
Priyanka Jainef76b2e2018-10-29 09:17:09 +000025 SATA3,
26 SATA4,
Minghuan Lian0e3a2b92015-03-20 19:28:16 -070027 XAUI1,
28 XAUI2,
29 XFI1,
30 XFI2,
31 XFI3,
32 XFI4,
33 XFI5,
34 XFI6,
35 XFI7,
36 XFI8,
Priyanka Jainef76b2e2018-10-29 09:17:09 +000037 XFI9,
38 XFI10,
39 XFI11,
40 XFI12,
41 XFI13,
42 XFI14,
Minghuan Lian0e3a2b92015-03-20 19:28:16 -070043 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 Jainef76b2e2018-10-29 09:17:09 +000059 SGMII17,
60 SGMII18,
Prabhakar Kushwaha3c39c082017-02-15 20:40:00 +053061 QSGMII_A,
62 QSGMII_B,
63 QSGMII_C,
64 QSGMII_D,
Xiaowei Bao1eb44592019-05-21 18:28:31 +080065 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 Jainef76b2e2018-10-29 09:17:09 +000077 _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 Lian0e3a2b92015-03-20 19:28:16 -070093 SERDES_PRCTL_COUNT
94};
95
96enum srds {
97 FSL_SRDS_1 = 0,
98 FSL_SRDS_2 = 1,
Priyanka Jain1a602532018-09-27 10:32:05 +053099 NXP_SRDS_3 = 2,
Minghuan Lian0e3a2b92015-03-20 19:28:16 -0700100};
Prabhakar Kushwaha1966d012016-06-03 18:41:27 +0530101#elif defined(CONFIG_FSL_LSCH2)
Mingkai Hue4e93ea2015-10-26 19:47:51 +0800102enum srds_prtcl {
Hou Zhiqiangb435ae92016-08-02 19:03:22 +0800103 /*
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 Hue4e93ea2015-10-26 19:47:51 +0800107 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 Kushwahad169ebe2016-06-03 18:41:31 +0530184 TX_CLK,
Mingkai Hue4e93ea2015-10-26 19:47:51 +0800185 SERDES_PRCTL_COUNT
186};
187
188enum srds {
189 FSL_SRDS_1 = 0,
Qianyu Gong2b5b7a92016-07-05 16:01:54 +0800190 FSL_SRDS_2 = 1,
Mingkai Hue4e93ea2015-10-26 19:47:51 +0800191};
192
Mingkai Hu0e58b512015-10-26 19:47:50 +0800193#endif
Minghuan Lian0e3a2b92015-03-20 19:28:16 -0700194
195int is_serdes_configured(enum srds_prtcl device);
196void fsl_serdes_init(void);
Minghuan Lian0e3a2b92015-03-20 19:28:16 -0700197int serdes_get_first_lane(u32 sd, enum srds_prtcl device);
198enum srds_prtcl serdes_get_prtcl(int serdes, int cfg, int lane);
199int is_serdes_prtcl_valid(int serdes, u32 prtcl);
Ashish Kumarb25faa22017-08-31 16:12:53 +0530200int serdes_get_number(int serdes, int cfg);
Ashish Kumarec455e22017-08-31 16:37:31 +0530201void fsl_rgmii_init(void);
Minghuan Lian0e3a2b92015-03-20 19:28:16 -0700202
Mingkai Hucd54c0f2016-07-05 16:01:55 +0800203#ifdef CONFIG_FSL_LSCH2
Mingkai Hue4e93ea2015-10-26 19:47:51 +0800204const char *serdes_clock_to_string(u32 clock);
205int get_serdes_protocol(void);
Rajesh Bhagat814e0772018-01-17 16:13:00 +0530206#endif
Hou Zhiqiang4ad59992016-12-09 16:09:00 +0800207#ifdef CONFIG_SYS_HAS_SERDES
208/* Get the volt of SVDD in unit mV */
209int get_serdes_volt(void);
210/* Set the volt of SVDD in unit mV */
211int set_serdes_volt(int svdd);
212/* The target volt of SVDD in unit mV */
213int setup_serdes_volt(u32 svdd);
214#endif
Mingkai Hue4e93ea2015-10-26 19:47:51 +0800215
Mingkai Hu0e58b512015-10-26 19:47:50 +0800216#endif /* __FSL_SERDES_H__ */