Lines Matching refs:usbphyc
96 static int stm32_usbphyc_pll_init(struct stm32_usbphyc *usbphyc) in stm32_usbphyc_pll_init() argument
99 u32 clk_rate = clk_get_rate(&usbphyc->clk); in stm32_usbphyc_pll_init()
119 writel(usbphyc_pll, usbphyc->base + STM32_USBPHYC_PLL); in stm32_usbphyc_pll_init()
127 static bool stm32_usbphyc_is_init(struct stm32_usbphyc *usbphyc) in stm32_usbphyc_is_init() argument
132 if (usbphyc->phys[i].init) in stm32_usbphyc_is_init()
139 static bool stm32_usbphyc_is_powered(struct stm32_usbphyc *usbphyc) in stm32_usbphyc_is_powered() argument
144 if (usbphyc->phys[i].powered) in stm32_usbphyc_is_powered()
153 struct stm32_usbphyc *usbphyc = dev_get_priv(phy->dev); in stm32_usbphyc_phy_init() local
154 struct stm32_usbphyc_phy *usbphyc_phy = usbphyc->phys + phy->id; in stm32_usbphyc_phy_init()
155 bool pllen = readl(usbphyc->base + STM32_USBPHYC_PLL) & PLLEN ? in stm32_usbphyc_phy_init()
161 if (pllen && stm32_usbphyc_is_init(usbphyc)) in stm32_usbphyc_phy_init()
164 if (usbphyc->vdda1v1) { in stm32_usbphyc_phy_init()
165 ret = regulator_set_enable(usbphyc->vdda1v1, true); in stm32_usbphyc_phy_init()
170 if (usbphyc->vdda1v8) { in stm32_usbphyc_phy_init()
171 ret = regulator_set_enable(usbphyc->vdda1v8, true); in stm32_usbphyc_phy_init()
177 clrbits_le32(usbphyc->base + STM32_USBPHYC_PLL, PLLEN); in stm32_usbphyc_phy_init()
181 ret = stm32_usbphyc_pll_init(usbphyc); in stm32_usbphyc_phy_init()
185 setbits_le32(usbphyc->base + STM32_USBPHYC_PLL, PLLEN); in stm32_usbphyc_phy_init()
190 if (!(readl(usbphyc->base + STM32_USBPHYC_PLL) & PLLEN)) in stm32_usbphyc_phy_init()
201 struct stm32_usbphyc *usbphyc = dev_get_priv(phy->dev); in stm32_usbphyc_phy_exit() local
202 struct stm32_usbphyc_phy *usbphyc_phy = usbphyc->phys + phy->id; in stm32_usbphyc_phy_exit()
209 if (stm32_usbphyc_is_init(usbphyc)) in stm32_usbphyc_phy_exit()
212 clrbits_le32(usbphyc->base + STM32_USBPHYC_PLL, PLLEN); in stm32_usbphyc_phy_exit()
220 if (readl(usbphyc->base + STM32_USBPHYC_PLL) & PLLEN) in stm32_usbphyc_phy_exit()
223 if (usbphyc->vdda1v1) { in stm32_usbphyc_phy_exit()
224 ret = regulator_set_enable(usbphyc->vdda1v1, false); in stm32_usbphyc_phy_exit()
229 if (usbphyc->vdda1v8) { in stm32_usbphyc_phy_exit()
230 ret = regulator_set_enable(usbphyc->vdda1v8, false); in stm32_usbphyc_phy_exit()
240 struct stm32_usbphyc *usbphyc = dev_get_priv(phy->dev); in stm32_usbphyc_phy_power_on() local
241 struct stm32_usbphyc_phy *usbphyc_phy = usbphyc->phys + phy->id; in stm32_usbphyc_phy_power_on()
263 struct stm32_usbphyc *usbphyc = dev_get_priv(phy->dev); in stm32_usbphyc_phy_power_off() local
264 struct stm32_usbphyc_phy *usbphyc_phy = usbphyc->phys + phy->id; in stm32_usbphyc_phy_power_off()
270 if (stm32_usbphyc_is_powered(usbphyc)) in stm32_usbphyc_phy_power_off()
340 struct stm32_usbphyc *usbphyc = dev_get_priv(dev); in stm32_usbphyc_probe() local
345 usbphyc->base = dev_read_addr(dev); in stm32_usbphyc_probe()
346 if (usbphyc->base == FDT_ADDR_T_NONE) in stm32_usbphyc_probe()
350 ret = clk_get_by_index(dev, 0, &usbphyc->clk); in stm32_usbphyc_probe()
354 ret = clk_enable(&usbphyc->clk); in stm32_usbphyc_probe()
368 &usbphyc->vdda1v1); in stm32_usbphyc_probe()
375 &usbphyc->vdda1v8); in stm32_usbphyc_probe()
387 struct stm32_usbphyc_phy *usbphyc_phy = usbphyc->phys + i; in stm32_usbphyc_probe()
408 setbits_le32(usbphyc->base + STM32_USBPHYC_MISC, SWITHOST); in stm32_usbphyc_probe()