xref: /openbmc/u-boot/drivers/misc/mpc83xx_serdes.h (revision d2166319df17286b2a3e2a1a7ce89f01e4f8bac9)
1*d2166319SMario Six /* SPDX-License-Identifier: GPL-2.0+ */
2*d2166319SMario Six /*
3*d2166319SMario Six  * (C) Copyright 2018
4*d2166319SMario Six  * Mario Six, Guntermann & Drunck GmbH, mario.six@gdsys.cc
5*d2166319SMario Six  */
6*d2166319SMario Six 
7*d2166319SMario Six /**
8*d2166319SMario Six  * enum srdscr0_mask - Bit masks for SRDSCR0 (SerDes Control Register 0)
9*d2166319SMario Six  * @SRDSCR0_DPPA:       Bitmask for the DPPA (diff pk-pk swing for lane A)
10*d2166319SMario Six  *			field of the SRCSCR0
11*d2166319SMario Six  * @SRDSCR0_DPPE:       Bitmask for the DPPE (diff pk-pk swing for lane E)
12*d2166319SMario Six  *			field of the SRCSCR0
13*d2166319SMario Six  * @SRDSCR0_DPP_1V2:    Combined bitmask to set diff pk-pk swing for both lanes
14*d2166319SMario Six  * @SRDSCR0_TXEQA_MASK: Bitmask for the TXEQA (transmit equalization for
15*d2166319SMario Six  *			lane A) field of the SRCSCR0
16*d2166319SMario Six  * @SRDSCR0_TXEQA_SATA: Bitmask to set the TXEQA to the value used for SATA
17*d2166319SMario Six  * @SRDSCR0_TXEQE_MASK: Bitmask for the TXEQE (transmit equalization for
18*d2166319SMario Six  *			lane E) field of the SRCSCR0
19*d2166319SMario Six  * @SRDSCR0_TXEQE_SATA: Bitmask to set the TXEQE to the value used for SATA
20*d2166319SMario Six  */
21*d2166319SMario Six enum srdscr0_mask {
22*d2166319SMario Six 	SRDSCR0_DPPA        = BIT(31 - 16),
23*d2166319SMario Six 	SRDSCR0_DPPE        = BIT(31 - 20),
24*d2166319SMario Six 	SRDSCR0_DPP_1V2    = SRDSCR0_DPPE | SRDSCR0_DPPA,
25*d2166319SMario Six 
26*d2166319SMario Six 	SRDSCR0_TXEQA_MASK = 0x00007000,
27*d2166319SMario Six 	SRDSCR0_TXEQA_SATA = 0x00001000,
28*d2166319SMario Six 	SRDSCR0_TXEQE_MASK = 0x00000700,
29*d2166319SMario Six 	SRDSCR0_TXEQE_SATA = 0x00000100,
30*d2166319SMario Six };
31*d2166319SMario Six 
32*d2166319SMario Six /**
33*d2166319SMario Six  * enum srdscr1_mask - Bit masks for SRDSCR1 (SerDes Control Register 1)
34*d2166319SMario Six  * @SRDSCR1_PLLBW: Bitmask for the PLLBW (PLL bandwidth) field of SRDSCR1
35*d2166319SMario Six  */
36*d2166319SMario Six enum srdscr1_mask {
37*d2166319SMario Six 	SRDSCR1_PLLBW = BIT(31 - 25),
38*d2166319SMario Six };
39*d2166319SMario Six 
40*d2166319SMario Six /**
41*d2166319SMario Six  * enum srdscr2_mask - Bit masks for SRDSCR2 (SerDes Control Register 2)
42*d2166319SMario Six  * @SRDSCR2_VDD_1V2:     Bit mask to to set the VDD field of the SCRSCR2
43*d2166319SMario Six  * @SRDSCR2_SEICA_MASK:  Bitmask for the SEICA (Receiver electrical idle
44*d2166319SMario Six  *			 detection control for lane A) field of the SRCSCR2
45*d2166319SMario Six  * @SRDSCR2_SEICE_MASK:  Bitmask for the SEICE (Receiver electrical idle
46*d2166319SMario Six  *			 detection control for lane E) field of the SRCSCR2
47*d2166319SMario Six  * @SRDSCR2_SEIC_MASK:   Combined bitmask to set the receiver electrical idle
48*d2166319SMario Six  *			 detection control for both lanes
49*d2166319SMario Six  * @SRDSCR2_SEICA_SATA:  Bitmask to set the SEICA field to the value used for
50*d2166319SMario Six  *			 SATA
51*d2166319SMario Six  * @SRDSCR2_SEICE_SATA:  Bitmask to set the SEICE field to the value used for
52*d2166319SMario Six  *			 SATA
53*d2166319SMario Six  * @SRDSCR2_SEIC_SATA:   Combined bitmask to set the value of both SEIC fields
54*d2166319SMario Six  *			 to the value used for SATA
55*d2166319SMario Six  * @SRDSCR2_SEICA_PEX:   Bitmask to set the SEICA field to the value used for
56*d2166319SMario Six  *			 PCI Express
57*d2166319SMario Six  * @SRDSCR2_SEICE_PEX:   Bitmask to set the SEICE field to the value used for
58*d2166319SMario Six  *			 PCI Express
59*d2166319SMario Six  * @SRDSCR2_SEIC_PEX:    Combined bitmask to set the value of both SEIC fields
60*d2166319SMario Six  *			 to the value used for PCI Express
61*d2166319SMario Six  * @SRDSCR2_SEICA_SGMII: Bitmask to set the SEICA field to the value used for
62*d2166319SMario Six  *			 SGMII
63*d2166319SMario Six  * @SRDSCR2_SEICE_SGMII: Bitmask to set the SEICE field to the value used for
64*d2166319SMario Six  *			 SGMII
65*d2166319SMario Six  * @SRDSCR2_SEIC_SGMII:  Combined bitmask to set the value of both SEIC fields
66*d2166319SMario Six  *			 to the value used for SGMII
67*d2166319SMario Six  */
68*d2166319SMario Six enum srdscr2_mask {
69*d2166319SMario Six 	SRDSCR2_VDD_1V2     = 0x00800000,
70*d2166319SMario Six 
71*d2166319SMario Six 	SRDSCR2_SEICA_MASK  = 0x00001c00,
72*d2166319SMario Six 	SRDSCR2_SEICE_MASK  = 0x0000001c,
73*d2166319SMario Six 	SRDSCR2_SEIC_MASK   = SRDSCR2_SEICA_MASK | SRDSCR2_SEICE_MASK,
74*d2166319SMario Six 
75*d2166319SMario Six 	SRDSCR2_SEICA_SATA  = 0x00001400,
76*d2166319SMario Six 	SRDSCR2_SEICE_SATA  = 0x00000014,
77*d2166319SMario Six 	SRDSCR2_SEIC_SATA   = SRDSCR2_SEICA_SATA | SRDSCR2_SEICE_SATA,
78*d2166319SMario Six 
79*d2166319SMario Six 	SRDSCR2_SEICA_PEX   = 0x00001000,
80*d2166319SMario Six 	SRDSCR2_SEICE_PEX   = 0x00000010,
81*d2166319SMario Six 	SRDSCR2_SEIC_PEX    = SRDSCR2_SEICA_PEX | SRDSCR2_SEICE_PEX,
82*d2166319SMario Six 
83*d2166319SMario Six 	SRDSCR2_SEICA_SGMII = 0x00000100,
84*d2166319SMario Six 	SRDSCR2_SEICE_SGMII = 0x00000001,
85*d2166319SMario Six 	SRDSCR2_SEIC_SGMII  = SRDSCR2_SEICA_SGMII | SRDSCR2_SEICE_SGMII,
86*d2166319SMario Six };
87*d2166319SMario Six 
88*d2166319SMario Six /**
89*d2166319SMario Six  * enum srdscr3_mask - Bit masks for SRDSCR3 (SerDes Control Register 3)
90*d2166319SMario Six  * @SRDSCR3_KFRA_SATA:      Bitmask to set the KFRA field of SRDSCR3 to the
91*d2166319SMario Six  *			    value used by SATA
92*d2166319SMario Six  * @SRDSCR3_KFRE_SATA:      Bitmask to set the KFRE field of SRDSCR3 to the
93*d2166319SMario Six  *			    value used by SATA
94*d2166319SMario Six  * @SRDSCR3_KFR_SATA:       Combined bitmask to set both KFR fields to the
95*d2166319SMario Six  *			    value used by SATA
96*d2166319SMario Six  * @SRDSCR3_KPHA_SATA:      Bitmask to set the KPHA field of SRDSCR3 to the
97*d2166319SMario Six  *			    value used by SATA
98*d2166319SMario Six  * @SRDSCR3_KPHE_SATA:      Bitmask to set the KPHE field of SRDSCR3 to the
99*d2166319SMario Six  *			    value used by SATA
100*d2166319SMario Six  * @SRDSCR3_KPH_SATA:       Combined bitmask to set both KPH fields to the
101*d2166319SMario Six  *			    value used by SATA
102*d2166319SMario Six  * @SRDSCR3_SDFMA_SATA_PEX: Bitmask to set the SDFMA field of SRDSCR3 to the
103*d2166319SMario Six  *			    value used by SATA and PCI Express
104*d2166319SMario Six  * @SRDSCR3_SDFME_SATA_PEX: Bitmask to set the SDFME field of SRDSCR3 to the
105*d2166319SMario Six  *			    value used by SATA and PCI Express
106*d2166319SMario Six  * @SRDSCR3_SDFM_SATA_PEX:  Combined bitmask to set both SDFM fields to the
107*d2166319SMario Six  *			    value used by SATA and PCI Express
108*d2166319SMario Six  * @SRDSCR3_SDTXLA_SATA:    Bitmask to set the SDTXLA field of SRDSCR3 to the
109*d2166319SMario Six  *			    value used by SATA
110*d2166319SMario Six  * @SRDSCR3_SDTXLE_SATA:    Bitmask to set the SDTXLE field of SRDSCR3 to the
111*d2166319SMario Six  *			    value used by SATA
112*d2166319SMario Six  * @SRDSCR3_SDTXL_SATA:     Combined bitmask to set both SDTXL fields to the
113*d2166319SMario Six  *			    value used by SATA
114*d2166319SMario Six  *
115*d2166319SMario Six  * KFRA = 'Kfr' gain selection in the CDR for lane A
116*d2166319SMario Six  * KFRE = 'Kfr' gain selection in the CDR for lane E
117*d2166319SMario Six  * SDFMA = Bandwidth of digital filter for lane A
118*d2166319SMario Six  * SDFME = Bandwidth of digital filter for lane E
119*d2166319SMario Six  * SDTXLA = Lane A transmitter amplitude levels
120*d2166319SMario Six  * SDTXLE = Lane E transmitter amplitude levels
121*d2166319SMario Six  */
122*d2166319SMario Six enum srdscr3_mask {
123*d2166319SMario Six 	SRDSCR3_KFRA_SATA      = 0x10000000,
124*d2166319SMario Six 	SRDSCR3_KFRE_SATA      = 0x00100000,
125*d2166319SMario Six 	SRDSCR3_KFR_SATA       = SRDSCR3_KFRA_SATA | SRDSCR3_KFRE_SATA,
126*d2166319SMario Six 
127*d2166319SMario Six 	SRDSCR3_KPHA_SATA      = 0x04000000,
128*d2166319SMario Six 	SRDSCR3_KPHE_SATA      = 0x00040000,
129*d2166319SMario Six 	SRDSCR3_KPH_SATA       = SRDSCR3_KPHA_SATA | SRDSCR3_KPHE_SATA,
130*d2166319SMario Six 
131*d2166319SMario Six 	SRDSCR3_SDFMA_SATA_PEX = 0x01000000,
132*d2166319SMario Six 	SRDSCR3_SDFME_SATA_PEX = 0x00010000,
133*d2166319SMario Six 	SRDSCR3_SDFM_SATA_PEX  = SRDSCR3_SDFMA_SATA_PEX | SRDSCR3_SDFME_SATA_PEX,
134*d2166319SMario Six 
135*d2166319SMario Six 	SRDSCR3_SDTXLA_SATA    = 0x00000500,
136*d2166319SMario Six 	SRDSCR3_SDTXLE_SATA    = 0x00000005,
137*d2166319SMario Six 	SRDSCR3_SDTXL_SATA     = SRDSCR3_SDTXLA_SATA | SRDSCR3_SDTXLE_SATA,
138*d2166319SMario Six };
139*d2166319SMario Six 
140*d2166319SMario Six /**
141*d2166319SMario Six  * enum srdscr4_mask - Bit masks for SRDSCR4 (SerDes Control Register 4)
142*d2166319SMario Six  * @SRDSCR4_PROTA_SATA:  Bitmask to set the PROTA field of SRDSCR4 to the
143*d2166319SMario Six  *			 value used by SATA
144*d2166319SMario Six  * @SRDSCR4_PROTE_SATA:  Bitmask to set the PROTE field of SRDSCR4 to the
145*d2166319SMario Six  *			 value used by SATA
146*d2166319SMario Six  * @SRDSCR4_PROT_SATA:   Combined bitmask to set both PROT fields to the
147*d2166319SMario Six  *			 value used by SATA
148*d2166319SMario Six  * @SRDSCR4_PROTA_PEX:   Bitmask to set the PROTA field of SRDSCR4 to the
149*d2166319SMario Six  *			 value used by PCI Express
150*d2166319SMario Six  * @SRDSCR4_PROTE_PEX:   Bitmask to set the PROTE field of SRDSCR4 to the
151*d2166319SMario Six  *			 value used by PCI Express
152*d2166319SMario Six  * @SRDSCR4_PROT_PEX:    Combined bitmask to set both PROT fields to the
153*d2166319SMario Six  *			 value used by PCI Express
154*d2166319SMario Six  * @SRDSCR4_PROTA_SGMII: Bitmask to set the PROTA field of SRDSCR4 to the
155*d2166319SMario Six  *			 value used by SGMII
156*d2166319SMario Six  * @SRDSCR4_PROTE_SGMII: Bitmask to set the PROTE field of SRDSCR4 to the
157*d2166319SMario Six  *			 value used by SGMII
158*d2166319SMario Six  * @SRDSCR4_PROT_SGMII:  Combined bitmask to set both PROT fields to the
159*d2166319SMario Six  *			 value used by SGMII
160*d2166319SMario Six  * @SRDSCR4_PLANE_X2:    Bitmask to set the PLANE field of SRDSCR4
161*d2166319SMario Six  * @SRDSCR4_RFCKS_100:   Bitmask to set the RFCKS field of SRDSCR4 to the
162*d2166319SMario Six  *			 value 100Mhz
163*d2166319SMario Six  * @SRDSCR4_RFCKS_125:   Bitmask to set the RFCKS field of SRDSCR4 to the
164*d2166319SMario Six  *			 value 125Mhz
165*d2166319SMario Six  * @SRDSCR4_RFCKS_150:   Bitmask to set the RFCKS field of SRDSCR4 to the
166*d2166319SMario Six  *			 value 150Mhz
167*d2166319SMario Six  *
168*d2166319SMario Six  * PROTA = Lane A protocol select
169*d2166319SMario Six  * PROTE = Lane E protocol select
170*d2166319SMario Six  * PLAME = Number of PCI Express lanes
171*d2166319SMario Six  */
172*d2166319SMario Six enum srdscr4_mask {
173*d2166319SMario Six 	SRDSCR4_PROTA_SATA  = 0x00000800,
174*d2166319SMario Six 	SRDSCR4_PROTE_SATA  = 0x00000008,
175*d2166319SMario Six 	SRDSCR4_PROT_SATA   = SRDSCR4_PROTA_SATA | SRDSCR4_PROTE_SATA,
176*d2166319SMario Six 
177*d2166319SMario Six 	SRDSCR4_PROTA_PEX   = 0x00000100,
178*d2166319SMario Six 	SRDSCR4_PROTE_PEX   = 0x00000001,
179*d2166319SMario Six 	SRDSCR4_PROT_PEX    = SRDSCR4_PROTA_PEX | SRDSCR4_PROTE_PEX,
180*d2166319SMario Six 
181*d2166319SMario Six 	SRDSCR4_PROTA_SGMII = 0x00000500,
182*d2166319SMario Six 	SRDSCR4_PROTE_SGMII = 0x00000005,
183*d2166319SMario Six 	SRDSCR4_PROT_SGMII  = SRDSCR4_PROTA_SGMII | SRDSCR4_PROTE_SGMII,
184*d2166319SMario Six 
185*d2166319SMario Six 	SRDSCR4_PLANE_X2    = 0x01000000,
186*d2166319SMario Six 
187*d2166319SMario Six 	SRDSCR4_RFCKS_100 = (0 << 28),
188*d2166319SMario Six 	SRDSCR4_RFCKS_125 = (1 << 28),
189*d2166319SMario Six 	SRDSCR4_RFCKS_150 = (3 << 28),
190*d2166319SMario Six };
191*d2166319SMario Six 
192*d2166319SMario Six /**
193*d2166319SMario Six  * enum srdsrstctl_mask - Bit masks for SRDSRSTCTL (SerDes Reset Control Register)
194*d2166319SMario Six  * @SRDSRSTCTL_RST:        Bitmask for the RST (Software reset) field of the
195*d2166319SMario Six  *			   SRDSRSTCTL
196*d2166319SMario Six  * @SRDSRSTCTL_SATA_RESET: Bitmask for the SATA_RESET (SATA reset) field of the
197*d2166319SMario Six  *			   SRDSRSTCTL
198*d2166319SMario Six  */
199*d2166319SMario Six enum srdsrstctl_mask {
200*d2166319SMario Six 	SRDSRSTCTL_RST        = 0x80000000,
201*d2166319SMario Six 	SRDSRSTCTL_SATA_RESET = 0xf,
202*d2166319SMario Six };
203*d2166319SMario Six 
204*d2166319SMario Six /**
205*d2166319SMario Six  * struct mpc83xx_serdes_regs - Register map of the SerDes controller
206*d2166319SMario Six  * @srdscr0:    SerDes Control Register 0
207*d2166319SMario Six  * @srdscr1:    SerDes Control Register 1
208*d2166319SMario Six  * @srdscr2:    SerDes Control Register 2
209*d2166319SMario Six  * @srdscr3:    SerDes Control Register 3
210*d2166319SMario Six  * @srdscr4:    SerDes Control Register 4
211*d2166319SMario Six  * @fill0:      Reserved space in the register map
212*d2166319SMario Six  * @srdsrstctl: SerDes Reset Control Register
213*d2166319SMario Six  */
214*d2166319SMario Six struct mpc83xx_serdes_regs {
215*d2166319SMario Six 	u32 srdscr0;
216*d2166319SMario Six 	u32 srdscr1;
217*d2166319SMario Six 	u32 srdscr2;
218*d2166319SMario Six 	u32 srdscr3;
219*d2166319SMario Six 	u32 srdscr4;
220*d2166319SMario Six 	u8 fill0[12];
221*d2166319SMario Six 	u32 srdsrstctl;
222*d2166319SMario Six };
223*d2166319SMario Six 
224*d2166319SMario Six /**
225*d2166319SMario Six  * enum pex_type - Types of PCI Express
226*d2166319SMario Six  * @PEX_X1: PCI Express in x1 mode
227*d2166319SMario Six  * @PEX_X2: PCI Express in x2 mode
228*d2166319SMario Six  */
229*d2166319SMario Six enum pex_type {
230*d2166319SMario Six 	PEX_X1,
231*d2166319SMario Six 	PEX_X2,
232*d2166319SMario Six };
233