Lines Matching refs:phy

81 static void phy_w32(struct mt76x8_usb_phy *phy, u32 reg, u32 val)  in phy_w32()  argument
83 writel(val, phy->base + reg); in phy_w32()
86 static u32 phy_r32(struct mt76x8_usb_phy *phy, u32 reg) in phy_r32() argument
88 return readl(phy->base + reg); in phy_r32()
91 static void phy_rmw32(struct mt76x8_usb_phy *phy, u32 reg, u32 clr, u32 set) in phy_rmw32() argument
93 clrsetbits_32(phy->base + reg, clr, set); in phy_rmw32()
96 static void mt76x8_usb_phy_init(struct mt76x8_usb_phy *phy) in mt76x8_usb_phy_init() argument
98 phy_r32(phy, OFS_U2_PHY_AC2); in mt76x8_usb_phy_init()
99 phy_r32(phy, OFS_U2_PHY_ACR0); in mt76x8_usb_phy_init()
100 phy_r32(phy, OFS_U2_PHY_DCR0); in mt76x8_usb_phy_init()
102 phy_w32(phy, OFS_U2_PHY_DCR0, in mt76x8_usb_phy_init()
104 phy_r32(phy, OFS_U2_PHY_DCR0); in mt76x8_usb_phy_init()
106 phy_w32(phy, OFS_U2_PHY_DCR0, in mt76x8_usb_phy_init()
108 phy_r32(phy, OFS_U2_PHY_DCR0); in mt76x8_usb_phy_init()
110 phy_w32(phy, OFS_U2_PHY_DCR0, in mt76x8_usb_phy_init()
112 phy_r32(phy, OFS_U2_PHY_DCR0); in mt76x8_usb_phy_init()
114 phy_w32(phy, OFS_U2_PHY_DCR0, in mt76x8_usb_phy_init()
116 phy_r32(phy, OFS_U2_PHY_DCR0); in mt76x8_usb_phy_init()
118 phy_w32(phy, OFS_U2_PHY_AC0, in mt76x8_usb_phy_init()
123 phy_w32(phy, OFS_U2_PHY_AC1, in mt76x8_usb_phy_init()
127 phy_w32(phy, OFS_U2_PHY_ACR3, in mt76x8_usb_phy_init()
130 phy_w32(phy, OFS_U2_PHY_DTM0, FORCE_USB_CLKEN); in mt76x8_usb_phy_init()
133 static void mt76x8_usb_phy_sr_calibrate(struct mt76x8_usb_phy *phy) in mt76x8_usb_phy_sr_calibrate() argument
139 phy_rmw32(phy, OFS_U2_PHY_ACR0, 0, HSTX_SRCAL_EN); in mt76x8_usb_phy_sr_calibrate()
143 phy_rmw32(phy, OFS_FM_MONR1, 0, FRCK_EN); in mt76x8_usb_phy_sr_calibrate()
146 phy_rmw32(phy, OFS_FM_CR0, CYCLECNT_M, 0x400 << CYCLECNT_S); in mt76x8_usb_phy_sr_calibrate()
149 phy_rmw32(phy, OFS_FM_CR0, 0, FREQDET_EN); in mt76x8_usb_phy_sr_calibrate()
153 fmout = phy_r32(phy, OFS_FM_MONR0); in mt76x8_usb_phy_sr_calibrate()
162 phy_rmw32(phy, OFS_FM_CR0, FREQDET_EN, 0); in mt76x8_usb_phy_sr_calibrate()
165 phy_rmw32(phy, OFS_FM_MONR1, FRCK_EN, 0); in mt76x8_usb_phy_sr_calibrate()
168 phy_rmw32(phy, OFS_U2_PHY_ACR0, HSTX_SRCAL_EN, 0); in mt76x8_usb_phy_sr_calibrate()
179 phy_rmw32(phy, OFS_U2_PHY_ACR0, HSTX_SRCTRL_M, in mt76x8_usb_phy_sr_calibrate()
183 static int mt76x8_usb_phy_power_on(struct phy *_phy) in mt76x8_usb_phy_power_on()
185 struct mt76x8_usb_phy *phy = dev_get_priv(_phy->dev); in mt76x8_usb_phy_power_on() local
187 clk_enable(&phy->cg); in mt76x8_usb_phy_power_on()
189 reset_deassert(&phy->rst_phy); in mt76x8_usb_phy_power_on()
197 mt76x8_usb_phy_init(phy); in mt76x8_usb_phy_power_on()
198 mt76x8_usb_phy_sr_calibrate(phy); in mt76x8_usb_phy_power_on()
203 static int mt76x8_usb_phy_power_off(struct phy *_phy) in mt76x8_usb_phy_power_off()
205 struct mt76x8_usb_phy *phy = dev_get_priv(_phy->dev); in mt76x8_usb_phy_power_off() local
207 clk_disable(&phy->cg); in mt76x8_usb_phy_power_off()
209 reset_assert(&phy->rst_phy); in mt76x8_usb_phy_power_off()
216 struct mt76x8_usb_phy *phy = dev_get_priv(dev); in mt76x8_usb_phy_probe() local
219 phy->base = dev_read_addr_ptr(dev); in mt76x8_usb_phy_probe()
220 if (!phy->base) in mt76x8_usb_phy_probe()
224 ret = clk_get_by_name(dev, "cg", &phy->cg); in mt76x8_usb_phy_probe()
228 ret = reset_get_by_name(dev, "phy", &phy->rst_phy); in mt76x8_usb_phy_probe()