Lines Matching refs:gtr_phy
273 static inline u32 xpsgtr_read_phy(struct xpsgtr_phy *gtr_phy, u32 reg) in xpsgtr_read_phy() argument
275 void __iomem *addr = gtr_phy->dev->serdes in xpsgtr_read_phy()
276 + gtr_phy->lane * PHY_REG_OFFSET + reg; in xpsgtr_read_phy()
281 static inline void xpsgtr_write_phy(struct xpsgtr_phy *gtr_phy, in xpsgtr_write_phy() argument
284 void __iomem *addr = gtr_phy->dev->serdes in xpsgtr_write_phy()
285 + gtr_phy->lane * PHY_REG_OFFSET + reg; in xpsgtr_write_phy()
290 static inline void xpsgtr_clr_set_phy(struct xpsgtr_phy *gtr_phy, in xpsgtr_clr_set_phy() argument
293 void __iomem *addr = gtr_phy->dev->serdes in xpsgtr_clr_set_phy()
294 + gtr_phy->lane * PHY_REG_OFFSET + reg; in xpsgtr_clr_set_phy()
306 struct xpsgtr_phy *gtr_phy = phy_get_drvdata(phy); in xpsgtr_wait_pll_lock() local
307 struct xpsgtr_dev *gtr_dev = gtr_phy->dev; in xpsgtr_wait_pll_lock()
314 u32 reg = xpsgtr_read_phy(gtr_phy, L0_PLL_STATUS_READ_1); in xpsgtr_wait_pll_lock()
332 gtr_phy->lane, gtr_phy->type, gtr_phy->protocol); in xpsgtr_wait_pll_lock()
338 static void xpsgtr_configure_pll(struct xpsgtr_phy *gtr_phy) in xpsgtr_configure_pll() argument
343 ssc = gtr_phy->dev->refclk_sscs[gtr_phy->refclk]; in xpsgtr_configure_pll()
346 xpsgtr_clr_set(gtr_phy->dev, PLL_REF_SEL(gtr_phy->lane), in xpsgtr_configure_pll()
350 if (gtr_phy->refclk != gtr_phy->lane) { in xpsgtr_configure_pll()
352 xpsgtr_clr_set(gtr_phy->dev, L0_Ln_REF_CLK_SEL(gtr_phy->lane), in xpsgtr_configure_pll()
353 L0_REF_CLK_SEL_MASK, 1 << gtr_phy->refclk); in xpsgtr_configure_pll()
357 xpsgtr_clr_set_phy(gtr_phy, L0_PLL_SS_STEP_SIZE_0_LSB, in xpsgtr_configure_pll()
362 xpsgtr_clr_set_phy(gtr_phy, L0_PLL_SS_STEP_SIZE_1, in xpsgtr_configure_pll()
367 xpsgtr_clr_set_phy(gtr_phy, L0_PLL_SS_STEP_SIZE_2, in xpsgtr_configure_pll()
371 xpsgtr_clr_set_phy(gtr_phy, L0_PLL_SS_STEPS_0_LSB, in xpsgtr_configure_pll()
375 xpsgtr_clr_set_phy(gtr_phy, L0_PLL_SS_STEPS_1_MSB, in xpsgtr_configure_pll()
381 xpsgtr_clr_set_phy(gtr_phy, L0_PLL_SS_STEP_SIZE_3_MSB, in xpsgtr_configure_pll()
387 static void xpsgtr_lane_set_protocol(struct xpsgtr_phy *gtr_phy) in xpsgtr_lane_set_protocol() argument
389 struct xpsgtr_dev *gtr_dev = gtr_phy->dev; in xpsgtr_lane_set_protocol()
390 u8 protocol = gtr_phy->protocol; in xpsgtr_lane_set_protocol()
392 switch (gtr_phy->lane) { in xpsgtr_lane_set_protocol()
414 static void xpsgtr_bypass_scrambler_8b10b(struct xpsgtr_phy *gtr_phy) in xpsgtr_bypass_scrambler_8b10b() argument
416 xpsgtr_write_phy(gtr_phy, L0_TM_DIG_6, L0_TM_DIS_DESCRAMBLE_DECODER); in xpsgtr_bypass_scrambler_8b10b()
417 xpsgtr_write_phy(gtr_phy, L0_TX_DIG_61, L0_TM_DISABLE_SCRAMBLE_ENCODER); in xpsgtr_bypass_scrambler_8b10b()
421 static void xpsgtr_phy_init_dp(struct xpsgtr_phy *gtr_phy) in xpsgtr_phy_init_dp() argument
423 xpsgtr_write_phy(gtr_phy, L0_TXPMD_TM_45, in xpsgtr_phy_init_dp()
429 xpsgtr_write_phy(gtr_phy, L0_TX_ANA_TM_118, in xpsgtr_phy_init_dp()
434 static void xpsgtr_phy_init_sata(struct xpsgtr_phy *gtr_phy) in xpsgtr_phy_init_sata() argument
436 struct xpsgtr_dev *gtr_dev = gtr_phy->dev; in xpsgtr_phy_init_sata()
438 xpsgtr_bypass_scrambler_8b10b(gtr_phy); in xpsgtr_phy_init_sata()
440 writel(gtr_phy->lane, gtr_dev->siou + SATA_CONTROL_OFFSET); in xpsgtr_phy_init_sata()
444 static void xpsgtr_phy_init_sgmii(struct xpsgtr_phy *gtr_phy) in xpsgtr_phy_init_sgmii() argument
446 struct xpsgtr_dev *gtr_dev = gtr_phy->dev; in xpsgtr_phy_init_sgmii()
447 u32 mask = PROT_BUS_WIDTH_MASK(gtr_phy->lane); in xpsgtr_phy_init_sgmii()
448 u32 val = PROT_BUS_WIDTH_10 << PROT_BUS_WIDTH_SHIFT(gtr_phy->lane); in xpsgtr_phy_init_sgmii()
454 xpsgtr_bypass_scrambler_8b10b(gtr_phy); in xpsgtr_phy_init_sgmii()
458 static void xpsgtr_phy_configure_dp(struct xpsgtr_phy *gtr_phy, unsigned int pre, in xpsgtr_phy_configure_dp() argument
474 xpsgtr_write_phy(gtr_phy, L0_TXPMD_TM_48, voltage_swing[pre][voltage]); in xpsgtr_phy_configure_dp()
475 xpsgtr_write_phy(gtr_phy, L0_TX_ANA_TM_18, pre_emphasis[pre][voltage]); in xpsgtr_phy_configure_dp()
482 static bool xpsgtr_phy_init_required(struct xpsgtr_phy *gtr_phy) in xpsgtr_phy_init_required() argument
491 if (gtr_phy->protocol == ICM_PROTOCOL_USB && gtr_phy->skip_phy_init) in xpsgtr_phy_init_required()
502 static int xpsgtr_phy_tx_term_fix(struct xpsgtr_phy *gtr_phy) in xpsgtr_phy_tx_term_fix() argument
504 struct xpsgtr_dev *gtr_dev = gtr_phy->dev; in xpsgtr_phy_tx_term_fix()
522 xpsgtr_lane_set_protocol(gtr_phy); in xpsgtr_phy_tx_term_fix()
567 struct xpsgtr_phy *gtr_phy = phy_get_drvdata(phy); in xpsgtr_phy_init() local
568 struct xpsgtr_dev *gtr_dev = gtr_phy->dev; in xpsgtr_phy_init()
574 if (!xpsgtr_phy_init_required(gtr_phy)) in xpsgtr_phy_init()
578 ret = xpsgtr_phy_tx_term_fix(gtr_phy); in xpsgtr_phy_init()
586 xpsgtr_write_phy(gtr_phy, L0_TM_PLL_DIG_37, L0_TM_COARSE_CODE_LIMIT); in xpsgtr_phy_init()
592 xpsgtr_configure_pll(gtr_phy); in xpsgtr_phy_init()
593 xpsgtr_lane_set_protocol(gtr_phy); in xpsgtr_phy_init()
595 switch (gtr_phy->protocol) { in xpsgtr_phy_init()
597 xpsgtr_phy_init_dp(gtr_phy); in xpsgtr_phy_init()
601 xpsgtr_phy_init_sata(gtr_phy); in xpsgtr_phy_init()
605 xpsgtr_phy_init_sgmii(gtr_phy); in xpsgtr_phy_init()
616 struct xpsgtr_phy *gtr_phy = phy_get_drvdata(phy); in xpsgtr_phy_exit() local
618 gtr_phy->skip_phy_init = false; in xpsgtr_phy_exit()
625 struct xpsgtr_phy *gtr_phy = phy_get_drvdata(phy); in xpsgtr_phy_power_on() local
633 if (gtr_phy->protocol != ICM_PROTOCOL_DP || in xpsgtr_phy_power_on()
634 gtr_phy->type == XPSGTR_TYPE_DP_0) in xpsgtr_phy_power_on()
642 struct xpsgtr_phy *gtr_phy = phy_get_drvdata(phy); in xpsgtr_phy_configure() local
644 if (gtr_phy->protocol != ICM_PROTOCOL_DP) in xpsgtr_phy_configure()
647 xpsgtr_phy_configure_dp(gtr_phy, opts->dp.pre[0], opts->dp.voltage[0]); in xpsgtr_phy_configure()
665 static int xpsgtr_set_lane_type(struct xpsgtr_phy *gtr_phy, u8 phy_type, in xpsgtr_set_lane_type() argument
680 gtr_phy->protocol = ICM_PROTOCOL_SATA; in xpsgtr_set_lane_type()
691 gtr_phy->protocol = ICM_PROTOCOL_USB; in xpsgtr_set_lane_type()
702 gtr_phy->protocol = ICM_PROTOCOL_DP; in xpsgtr_set_lane_type()
715 gtr_phy->protocol = ICM_PROTOCOL_PCIE; in xpsgtr_set_lane_type()
728 gtr_phy->protocol = ICM_PROTOCOL_SGMII; in xpsgtr_set_lane_type()
738 gtr_phy->type = phy_types[phy_instance]; in xpsgtr_set_lane_type()
761 struct xpsgtr_phy *gtr_phy; in xpsgtr_xlate() local
784 gtr_phy = >r_dev->phys[phy_lane]; in xpsgtr_xlate()
788 ret = xpsgtr_set_lane_type(gtr_phy, phy_type, phy_instance); in xpsgtr_xlate()
801 gtr_phy->refclk = refclk; in xpsgtr_xlate()
808 if (icm_matrix[phy_lane][i] == gtr_phy->type) in xpsgtr_xlate()
809 return gtr_phy->phy; in xpsgtr_xlate()
949 struct xpsgtr_phy *gtr_phy = >r_dev->phys[port]; in xpsgtr_probe() local
952 gtr_phy->lane = port; in xpsgtr_probe()
953 gtr_phy->dev = gtr_dev; in xpsgtr_probe()
961 gtr_phy->phy = phy; in xpsgtr_probe()
962 phy_set_drvdata(phy, gtr_phy); in xpsgtr_probe()