Lines Matching full:lane
23 #define LYNX_28G_LNa_PCC_OFFSET(lane) (4 * (LYNX_28G_NUM_LANE - (lane->id) - 1)) argument
44 /* Per SerDes lane registers */
45 /* Lane a General Control Register */
46 #define LYNX_28G_LNaGCR0(lane) (0x800 + (lane) * 0x100 + 0x0) argument
54 /* Lane a Tx Reset Control Register */
55 #define LYNX_28G_LNaTRSTCTL(lane) (0x800 + (lane) * 0x100 + 0x20) argument
60 /* Lane a Tx General Control Register */
61 #define LYNX_28G_LNaTGCR0(lane) (0x800 + (lane) * 0x100 + 0x24) argument
70 #define LYNX_28G_LNaTECR0(lane) (0x800 + (lane) * 0x100 + 0x30) argument
72 /* Lane a Rx Reset Control Register */
73 #define LYNX_28G_LNaRRSTCTL(lane) (0x800 + (lane) * 0x100 + 0x40) argument
79 /* Lane a Rx General Control Register */
80 #define LYNX_28G_LNaRGCR0(lane) (0x800 + (lane) * 0x100 + 0x44) argument
90 #define LYNX_28G_LNaRGCR1(lane) (0x800 + (lane) * 0x100 + 0x48) argument
92 #define LYNX_28G_LNaRECR0(lane) (0x800 + (lane) * 0x100 + 0x50) argument
93 #define LYNX_28G_LNaRECR1(lane) (0x800 + (lane) * 0x100 + 0x54) argument
94 #define LYNX_28G_LNaRECR2(lane) (0x800 + (lane) * 0x100 + 0x58) argument
96 #define LYNX_28G_LNaRSCCR0(lane) (0x800 + (lane) * 0x100 + 0x74) argument
98 #define LYNX_28G_LNaPSS(lane) (0x1000 + (lane) * 0x4) argument
103 #define LYNX_28G_SGMIIaCR1(lane) (0x1804 + (lane) * 0x10) argument
130 struct lynx_28g_lane lane[LYNX_28G_NUM_LANE]; member
147 #define lynx_28g_lane_rmw(lane, reg, val, mask) \ argument
148 lynx_28g_rmw((lane)->priv, LYNX_28G_##reg(lane->id), \
150 #define lynx_28g_lane_read(lane, reg) \ argument
151 ioread32((lane)->priv->base + LYNX_28G_##reg((lane)->id))
189 static void lynx_28g_lane_set_nrate(struct lynx_28g_lane *lane, in lynx_28g_lane_set_nrate() argument
199 lynx_28g_lane_rmw(lane, LNaTGCR0, N_RATE_QUARTER, N_RATE_MSK); in lynx_28g_lane_set_nrate()
200 lynx_28g_lane_rmw(lane, LNaRGCR0, N_RATE_QUARTER, N_RATE_MSK); in lynx_28g_lane_set_nrate()
210 lynx_28g_lane_rmw(lane, LNaTGCR0, N_RATE_FULL, N_RATE_MSK); in lynx_28g_lane_set_nrate()
211 lynx_28g_lane_rmw(lane, LNaRGCR0, N_RATE_FULL, N_RATE_MSK); in lynx_28g_lane_set_nrate()
222 static void lynx_28g_lane_set_pll(struct lynx_28g_lane *lane, in lynx_28g_lane_set_pll() argument
226 lynx_28g_lane_rmw(lane, LNaTGCR0, USE_PLLF, USE_PLL_MSK); in lynx_28g_lane_set_pll()
227 lynx_28g_lane_rmw(lane, LNaRGCR0, USE_PLLF, USE_PLL_MSK); in lynx_28g_lane_set_pll()
229 lynx_28g_lane_rmw(lane, LNaTGCR0, USE_PLLS, USE_PLL_MSK); in lynx_28g_lane_set_pll()
230 lynx_28g_lane_rmw(lane, LNaRGCR0, USE_PLLS, USE_PLL_MSK); in lynx_28g_lane_set_pll()
234 static void lynx_28g_cleanup_lane(struct lynx_28g_lane *lane) in lynx_28g_cleanup_lane() argument
236 u32 lane_offset = LYNX_28G_LNa_PCC_OFFSET(lane); in lynx_28g_cleanup_lane()
237 struct lynx_28g_priv *priv = lane->priv; in lynx_28g_cleanup_lane()
240 switch (lane->interface) { in lynx_28g_cleanup_lane()
257 static void lynx_28g_lane_set_sgmii(struct lynx_28g_lane *lane) in lynx_28g_lane_set_sgmii() argument
259 u32 lane_offset = LYNX_28G_LNa_PCC_OFFSET(lane); in lynx_28g_lane_set_sgmii()
260 struct lynx_28g_priv *priv = lane->priv; in lynx_28g_lane_set_sgmii()
263 lynx_28g_cleanup_lane(lane); in lynx_28g_lane_set_sgmii()
265 /* Setup the lane to run in SGMII */ in lynx_28g_lane_set_sgmii()
271 lynx_28g_lane_rmw(lane, LNaGCR0, PROTO_SEL_SGMII, PROTO_SEL_MSK); in lynx_28g_lane_set_sgmii()
272 lynx_28g_lane_rmw(lane, LNaGCR0, IF_WIDTH_10_BIT, IF_WIDTH_MSK); in lynx_28g_lane_set_sgmii()
276 lynx_28g_lane_set_pll(lane, pll); in lynx_28g_lane_set_sgmii()
278 /* Choose the portion of clock net to be used on this lane */ in lynx_28g_lane_set_sgmii()
279 lynx_28g_lane_set_nrate(lane, pll, PHY_INTERFACE_MODE_SGMII); in lynx_28g_lane_set_sgmii()
282 lynx_28g_lane_rmw(lane, SGMIIaCR1, SGPCS_EN, SGPCS_MSK); in lynx_28g_lane_set_sgmii()
285 iowrite32(0x00808006, priv->base + LYNX_28G_LNaTECR0(lane->id)); in lynx_28g_lane_set_sgmii()
286 iowrite32(0x04310000, priv->base + LYNX_28G_LNaRGCR1(lane->id)); in lynx_28g_lane_set_sgmii()
287 iowrite32(0x9f800000, priv->base + LYNX_28G_LNaRECR0(lane->id)); in lynx_28g_lane_set_sgmii()
288 iowrite32(0x001f0000, priv->base + LYNX_28G_LNaRECR1(lane->id)); in lynx_28g_lane_set_sgmii()
289 iowrite32(0x00000000, priv->base + LYNX_28G_LNaRECR2(lane->id)); in lynx_28g_lane_set_sgmii()
290 iowrite32(0x00000000, priv->base + LYNX_28G_LNaRSCCR0(lane->id)); in lynx_28g_lane_set_sgmii()
293 static void lynx_28g_lane_set_10gbaser(struct lynx_28g_lane *lane) in lynx_28g_lane_set_10gbaser() argument
295 u32 lane_offset = LYNX_28G_LNa_PCC_OFFSET(lane); in lynx_28g_lane_set_10gbaser()
296 struct lynx_28g_priv *priv = lane->priv; in lynx_28g_lane_set_10gbaser()
299 lynx_28g_cleanup_lane(lane); in lynx_28g_lane_set_10gbaser()
301 /* Enable the SXGMII lane */ in lynx_28g_lane_set_10gbaser()
307 lynx_28g_lane_rmw(lane, LNaGCR0, PROTO_SEL_XFI, PROTO_SEL_MSK); in lynx_28g_lane_set_10gbaser()
308 lynx_28g_lane_rmw(lane, LNaGCR0, IF_WIDTH_20_BIT, IF_WIDTH_MSK); in lynx_28g_lane_set_10gbaser()
312 lynx_28g_lane_set_pll(lane, pll); in lynx_28g_lane_set_10gbaser()
314 /* Choose the portion of clock net to be used on this lane */ in lynx_28g_lane_set_10gbaser()
315 lynx_28g_lane_set_nrate(lane, pll, PHY_INTERFACE_MODE_10GBASER); in lynx_28g_lane_set_10gbaser()
318 lynx_28g_lane_rmw(lane, SGMIIaCR1, SGPCS_DIS, SGPCS_MSK); in lynx_28g_lane_set_10gbaser()
321 iowrite32(0x10808307, priv->base + LYNX_28G_LNaTECR0(lane->id)); in lynx_28g_lane_set_10gbaser()
322 iowrite32(0x10000000, priv->base + LYNX_28G_LNaRGCR1(lane->id)); in lynx_28g_lane_set_10gbaser()
323 iowrite32(0x00000000, priv->base + LYNX_28G_LNaRECR0(lane->id)); in lynx_28g_lane_set_10gbaser()
324 iowrite32(0x001f0000, priv->base + LYNX_28G_LNaRECR1(lane->id)); in lynx_28g_lane_set_10gbaser()
325 iowrite32(0x81000020, priv->base + LYNX_28G_LNaRECR2(lane->id)); in lynx_28g_lane_set_10gbaser()
326 iowrite32(0x00002000, priv->base + LYNX_28G_LNaRSCCR0(lane->id)); in lynx_28g_lane_set_10gbaser()
331 struct lynx_28g_lane *lane = phy_get_drvdata(phy); in lynx_28g_power_off() local
334 if (!lane->powered_up) in lynx_28g_power_off()
338 lynx_28g_lane_rmw(lane, LNaTRSTCTL, HLT_REQ, HLT_REQ); in lynx_28g_power_off()
339 lynx_28g_lane_rmw(lane, LNaRRSTCTL, HLT_REQ, HLT_REQ); in lynx_28g_power_off()
343 trstctl = lynx_28g_lane_read(lane, LNaTRSTCTL); in lynx_28g_power_off()
344 rrstctl = lynx_28g_lane_read(lane, LNaRRSTCTL); in lynx_28g_power_off()
348 lane->powered_up = false; in lynx_28g_power_off()
355 struct lynx_28g_lane *lane = phy_get_drvdata(phy); in lynx_28g_power_on() local
358 if (lane->powered_up) in lynx_28g_power_on()
361 /* Issue a reset request on the lane */ in lynx_28g_power_on()
362 lynx_28g_lane_rmw(lane, LNaTRSTCTL, RST_REQ, RST_REQ); in lynx_28g_power_on()
363 lynx_28g_lane_rmw(lane, LNaRRSTCTL, RST_REQ, RST_REQ); in lynx_28g_power_on()
367 trstctl = lynx_28g_lane_read(lane, LNaTRSTCTL); in lynx_28g_power_on()
368 rrstctl = lynx_28g_lane_read(lane, LNaRRSTCTL); in lynx_28g_power_on()
372 lane->powered_up = true; in lynx_28g_power_on()
379 struct lynx_28g_lane *lane = phy_get_drvdata(phy); in lynx_28g_set_mode() local
380 struct lynx_28g_priv *priv = lane->priv; in lynx_28g_set_mode()
381 int powered_up = lane->powered_up; in lynx_28g_set_mode()
387 if (lane->interface == PHY_INTERFACE_MODE_NA) in lynx_28g_set_mode()
393 /* If the lane is powered up, put the lane into the halt state while in lynx_28g_set_mode()
402 lynx_28g_lane_set_sgmii(lane); in lynx_28g_set_mode()
405 lynx_28g_lane_set_10gbaser(lane); in lynx_28g_set_mode()
412 lane->interface = submode; in lynx_28g_set_mode()
415 /* Power up the lane if necessary */ in lynx_28g_set_mode()
425 struct lynx_28g_lane *lane = phy_get_drvdata(phy); in lynx_28g_validate() local
426 struct lynx_28g_priv *priv = lane->priv; in lynx_28g_validate()
439 struct lynx_28g_lane *lane = phy_get_drvdata(phy); in lynx_28g_init() local
441 /* Mark the fact that the lane was init */ in lynx_28g_init()
442 lane->init = true; in lynx_28g_init()
444 /* SerDes lanes are powered on at boot time. Any lane that is managed in lynx_28g_init()
448 lane->powered_up = true; in lynx_28g_init()
503 struct lynx_28g_lane *lane; in lynx_28g_cdr_lock_check() local
508 lane = &priv->lane[i]; in lynx_28g_cdr_lock_check()
510 if (!lane->init) in lynx_28g_cdr_lock_check()
513 if (!lane->powered_up) in lynx_28g_cdr_lock_check()
516 rrstctl = lynx_28g_lane_read(lane, LNaRRSTCTL); in lynx_28g_cdr_lock_check()
518 lynx_28g_lane_rmw(lane, LNaRRSTCTL, RST_REQ, RST_REQ); in lynx_28g_cdr_lock_check()
520 rrstctl = lynx_28g_lane_read(lane, LNaRRSTCTL); in lynx_28g_cdr_lock_check()
528 static void lynx_28g_lane_read_configuration(struct lynx_28g_lane *lane) in lynx_28g_lane_read_configuration() argument
532 pss = lynx_28g_lane_read(lane, LNaPSS); in lynx_28g_lane_read_configuration()
536 lane->interface = PHY_INTERFACE_MODE_SGMII; in lynx_28g_lane_read_configuration()
539 lane->interface = PHY_INTERFACE_MODE_10GBASER; in lynx_28g_lane_read_configuration()
542 lane->interface = PHY_INTERFACE_MODE_NA; in lynx_28g_lane_read_configuration()
555 return priv->lane[idx].phy; in lynx_28g_xlate()
577 struct lynx_28g_lane *lane = &priv->lane[i]; in lynx_28g_probe() local
580 memset(lane, 0, sizeof(*lane)); in lynx_28g_probe()
586 lane->priv = priv; in lynx_28g_probe()
587 lane->phy = phy; in lynx_28g_probe()
588 lane->id = i; in lynx_28g_probe()
589 phy_set_drvdata(phy, lane); in lynx_28g_probe()
590 lynx_28g_lane_read_configuration(lane); in lynx_28g_probe()