Lines Matching refs:usbh

224 static inline bool usbh_has_reg(struct bcm63xx_usbh_phy *usbh, int reg)  in usbh_has_reg()  argument
226 return (usbh->variant->regs[reg] >= 0); in usbh_has_reg()
229 static inline u32 usbh_readl(struct bcm63xx_usbh_phy *usbh, int reg) in usbh_readl() argument
231 return __raw_readl(usbh->base + usbh->variant->regs[reg]); in usbh_readl()
234 static inline void usbh_writel(struct bcm63xx_usbh_phy *usbh, int reg, in usbh_writel() argument
237 __raw_writel(value, usbh->base + usbh->variant->regs[reg]); in usbh_writel()
242 struct bcm63xx_usbh_phy *usbh = phy_get_drvdata(phy); in bcm63xx_usbh_phy_init() local
245 ret = clk_prepare_enable(usbh->usbh_clk); in bcm63xx_usbh_phy_init()
251 ret = clk_prepare_enable(usbh->usb_ref_clk); in bcm63xx_usbh_phy_init()
254 clk_disable_unprepare(usbh->usbh_clk); in bcm63xx_usbh_phy_init()
258 ret = reset_control_reset(usbh->reset); in bcm63xx_usbh_phy_init()
261 clk_disable_unprepare(usbh->usb_ref_clk); in bcm63xx_usbh_phy_init()
262 clk_disable_unprepare(usbh->usbh_clk); in bcm63xx_usbh_phy_init()
267 if (usbh_has_reg(usbh, USBH_SWAP_CONTROL)) { in bcm63xx_usbh_phy_init()
268 u32 val = usbh_readl(usbh, USBH_SWAP_CONTROL); in bcm63xx_usbh_phy_init()
276 if (usbh->device_mode && usbh->variant->swapctl_dev_set) in bcm63xx_usbh_phy_init()
277 val |= usbh->variant->swapctl_dev_set; in bcm63xx_usbh_phy_init()
279 usbh_writel(usbh, USBH_SWAP_CONTROL, val); in bcm63xx_usbh_phy_init()
282 if (usbh_has_reg(usbh, USBH_SETUP)) { in bcm63xx_usbh_phy_init()
283 u32 val = usbh_readl(usbh, USBH_SETUP); in bcm63xx_usbh_phy_init()
285 val |= usbh->variant->setup_set; in bcm63xx_usbh_phy_init()
286 val &= ~usbh->variant->setup_clr; in bcm63xx_usbh_phy_init()
288 usbh_writel(usbh, USBH_SETUP, val); in bcm63xx_usbh_phy_init()
291 if (usbh_has_reg(usbh, USBH_USB_SIM_CONTROL)) { in bcm63xx_usbh_phy_init()
292 u32 val = usbh_readl(usbh, USBH_USB_SIM_CONTROL); in bcm63xx_usbh_phy_init()
294 val |= usbh->variant->usc_set; in bcm63xx_usbh_phy_init()
296 usbh_writel(usbh, USBH_USB_SIM_CONTROL, val); in bcm63xx_usbh_phy_init()
299 if (usbh->variant->tpc_val && in bcm63xx_usbh_phy_init()
300 usbh_has_reg(usbh, USBH_TEST_PORT_CONTROL)) in bcm63xx_usbh_phy_init()
301 usbh_writel(usbh, USBH_TEST_PORT_CONTROL, in bcm63xx_usbh_phy_init()
302 usbh->variant->tpc_val); in bcm63xx_usbh_phy_init()
304 if (usbh->device_mode && in bcm63xx_usbh_phy_init()
305 usbh_has_reg(usbh, USBH_UTMI_CONTROL1) && in bcm63xx_usbh_phy_init()
306 usbh->variant->utmictl1_dev_set) { in bcm63xx_usbh_phy_init()
307 u32 val = usbh_readl(usbh, USBH_UTMI_CONTROL1); in bcm63xx_usbh_phy_init()
309 val |= usbh->variant->utmictl1_dev_set; in bcm63xx_usbh_phy_init()
311 usbh_writel(usbh, USBH_UTMI_CONTROL1, val); in bcm63xx_usbh_phy_init()
319 struct bcm63xx_usbh_phy *usbh = phy_get_drvdata(phy); in bcm63xx_usbh_phy_power_on() local
321 if (usbh_has_reg(usbh, USBH_PLL_CONTROL1)) { in bcm63xx_usbh_phy_power_on()
322 u32 val = usbh_readl(usbh, USBH_PLL_CONTROL1); in bcm63xx_usbh_phy_power_on()
324 val |= usbh->variant->power_pllc_set; in bcm63xx_usbh_phy_power_on()
325 val &= ~usbh->variant->power_pllc_clr; in bcm63xx_usbh_phy_power_on()
327 usbh_writel(usbh, USBH_PLL_CONTROL1, val); in bcm63xx_usbh_phy_power_on()
335 struct bcm63xx_usbh_phy *usbh = phy_get_drvdata(phy); in bcm63xx_usbh_phy_power_off() local
337 if (usbh_has_reg(usbh, USBH_PLL_CONTROL1)) { in bcm63xx_usbh_phy_power_off()
338 u32 val = usbh_readl(usbh, USBH_PLL_CONTROL1); in bcm63xx_usbh_phy_power_off()
340 val &= ~usbh->variant->power_pllc_set; in bcm63xx_usbh_phy_power_off()
341 val |= usbh->variant->power_pllc_clr; in bcm63xx_usbh_phy_power_off()
343 usbh_writel(usbh, USBH_PLL_CONTROL1, val); in bcm63xx_usbh_phy_power_off()
351 struct bcm63xx_usbh_phy *usbh = phy_get_drvdata(phy); in bcm63xx_usbh_phy_exit() local
353 clk_disable_unprepare(usbh->usbh_clk); in bcm63xx_usbh_phy_exit()
354 clk_disable_unprepare(usbh->usb_ref_clk); in bcm63xx_usbh_phy_exit()
370 struct bcm63xx_usbh_phy *usbh = dev_get_drvdata(dev); in bcm63xx_usbh_phy_xlate() local
372 usbh->device_mode = !!args->args[0]; in bcm63xx_usbh_phy_xlate()
380 struct bcm63xx_usbh_phy *usbh; in bcm63xx_usbh_phy_probe() local
385 usbh = devm_kzalloc(dev, sizeof(*usbh), GFP_KERNEL); in bcm63xx_usbh_phy_probe()
386 if (!usbh) in bcm63xx_usbh_phy_probe()
392 usbh->variant = variant; in bcm63xx_usbh_phy_probe()
394 usbh->base = devm_platform_ioremap_resource(pdev, 0); in bcm63xx_usbh_phy_probe()
395 if (IS_ERR(usbh->base)) in bcm63xx_usbh_phy_probe()
396 return PTR_ERR(usbh->base); in bcm63xx_usbh_phy_probe()
398 usbh->reset = devm_reset_control_get_exclusive(dev, NULL); in bcm63xx_usbh_phy_probe()
399 if (IS_ERR(usbh->reset)) { in bcm63xx_usbh_phy_probe()
400 if (PTR_ERR(usbh->reset) != -EPROBE_DEFER) in bcm63xx_usbh_phy_probe()
402 return PTR_ERR(usbh->reset); in bcm63xx_usbh_phy_probe()
405 usbh->usbh_clk = devm_clk_get_optional(dev, "usbh"); in bcm63xx_usbh_phy_probe()
406 if (IS_ERR(usbh->usbh_clk)) in bcm63xx_usbh_phy_probe()
407 return PTR_ERR(usbh->usbh_clk); in bcm63xx_usbh_phy_probe()
409 usbh->usb_ref_clk = devm_clk_get_optional(dev, "usb_ref"); in bcm63xx_usbh_phy_probe()
410 if (IS_ERR(usbh->usb_ref_clk)) in bcm63xx_usbh_phy_probe()
411 return PTR_ERR(usbh->usb_ref_clk); in bcm63xx_usbh_phy_probe()
419 platform_set_drvdata(pdev, usbh); in bcm63xx_usbh_phy_probe()
420 phy_set_drvdata(phy, usbh); in bcm63xx_usbh_phy_probe()