Lines Matching +full:bcm6328 +full:- +full:power +full:- +full:controller
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * BCM6328 USBH PHY Controller Driver
76 /* PLLC bits to set/clear for power on */
80 /* Setup bits to set/clear for power on */
87 /* Test Port Control value to set if non-zero */
108 [USBH_BRT_CONTROL1] = -1,
109 [USBH_BRT_CONTROL2] = -1,
110 [USBH_BRT_STATUS1] = -1,
111 [USBH_BRT_STATUS2] = -1,
116 [USBH_GENERIC_CONTROL] = -1,
155 [USBH_BRT_CONTROL1] = -1,
156 [USBH_BRT_CONTROL2] = -1,
157 [USBH_BRT_STATUS1] = -1,
158 [USBH_BRT_STATUS2] = -1,
159 [USBH_UTMI_CONTROL1] = -1,
161 [USBH_PLL_CONTROL1] = -1,
163 [USBH_GENERIC_CONTROL] = -1,
164 [USBH_FRAME_ADJUST_VALUE] = -1,
165 [USBH_SETUP] = -1,
166 [USBH_MDIO] = -1,
167 [USBH_MDIO32] = -1,
168 [USBH_USB_SIM_CONTROL] = -1,
173 * help, so the magic value is used as-is.
188 [USBH_GENERIC_CONTROL] = -1,
227 return (usbh->variant->regs[reg] >= 0); in usbh_has_reg()
232 return __raw_readl(usbh->base + usbh->variant->regs[reg]); in usbh_readl()
238 __raw_writel(value, usbh->base + usbh->variant->regs[reg]); in usbh_writel()
246 ret = clk_prepare_enable(usbh->usbh_clk); in bcm63xx_usbh_phy_init()
248 dev_err(&phy->dev, "unable to enable usbh clock: %d\n", ret); in bcm63xx_usbh_phy_init()
252 ret = clk_prepare_enable(usbh->usb_ref_clk); in bcm63xx_usbh_phy_init()
254 dev_err(&phy->dev, "unable to enable usb_ref clock: %d\n", ret); in bcm63xx_usbh_phy_init()
255 clk_disable_unprepare(usbh->usbh_clk); in bcm63xx_usbh_phy_init()
259 ret = reset_control_reset(usbh->reset); in bcm63xx_usbh_phy_init()
261 dev_err(&phy->dev, "unable to reset device: %d\n", ret); in bcm63xx_usbh_phy_init()
262 clk_disable_unprepare(usbh->usb_ref_clk); in bcm63xx_usbh_phy_init()
263 clk_disable_unprepare(usbh->usbh_clk); in bcm63xx_usbh_phy_init()
277 if (usbh->device_mode && usbh->variant->swapctl_dev_set) in bcm63xx_usbh_phy_init()
278 val |= usbh->variant->swapctl_dev_set; in bcm63xx_usbh_phy_init()
286 val |= usbh->variant->setup_set; in bcm63xx_usbh_phy_init()
287 val &= ~usbh->variant->setup_clr; in bcm63xx_usbh_phy_init()
295 val |= usbh->variant->usc_set; in bcm63xx_usbh_phy_init()
300 if (usbh->variant->tpc_val && in bcm63xx_usbh_phy_init()
303 usbh->variant->tpc_val); in bcm63xx_usbh_phy_init()
305 if (usbh->device_mode && in bcm63xx_usbh_phy_init()
307 usbh->variant->utmictl1_dev_set) { in bcm63xx_usbh_phy_init()
310 val |= usbh->variant->utmictl1_dev_set; in bcm63xx_usbh_phy_init()
325 val |= usbh->variant->power_pllc_set; in bcm63xx_usbh_phy_power_on()
326 val &= ~usbh->variant->power_pllc_clr; in bcm63xx_usbh_phy_power_on()
341 val &= ~usbh->variant->power_pllc_set; in bcm63xx_usbh_phy_power_off()
342 val |= usbh->variant->power_pllc_clr; in bcm63xx_usbh_phy_power_off()
354 clk_disable_unprepare(usbh->usbh_clk); in bcm63xx_usbh_phy_exit()
355 clk_disable_unprepare(usbh->usb_ref_clk); in bcm63xx_usbh_phy_exit()
373 usbh->device_mode = !!args->args[0]; in bcm63xx_usbh_phy_xlate()
380 struct device *dev = &pdev->dev; in bcm63xx_usbh_phy_probe()
388 return -ENOMEM; in bcm63xx_usbh_phy_probe()
392 return -EINVAL; in bcm63xx_usbh_phy_probe()
393 usbh->variant = variant; in bcm63xx_usbh_phy_probe()
395 usbh->base = devm_platform_ioremap_resource(pdev, 0); in bcm63xx_usbh_phy_probe()
396 if (IS_ERR(usbh->base)) in bcm63xx_usbh_phy_probe()
397 return PTR_ERR(usbh->base); in bcm63xx_usbh_phy_probe()
399 usbh->reset = devm_reset_control_get_exclusive(dev, NULL); in bcm63xx_usbh_phy_probe()
400 if (IS_ERR(usbh->reset)) { in bcm63xx_usbh_phy_probe()
401 if (PTR_ERR(usbh->reset) != -EPROBE_DEFER) in bcm63xx_usbh_phy_probe()
403 return PTR_ERR(usbh->reset); in bcm63xx_usbh_phy_probe()
406 usbh->usbh_clk = devm_clk_get_optional(dev, "usbh"); in bcm63xx_usbh_phy_probe()
407 if (IS_ERR(usbh->usbh_clk)) in bcm63xx_usbh_phy_probe()
408 return PTR_ERR(usbh->usbh_clk); in bcm63xx_usbh_phy_probe()
410 usbh->usb_ref_clk = devm_clk_get_optional(dev, "usb_ref"); in bcm63xx_usbh_phy_probe()
411 if (IS_ERR(usbh->usb_ref_clk)) in bcm63xx_usbh_phy_probe()
412 return PTR_ERR(usbh->usb_ref_clk); in bcm63xx_usbh_phy_probe()
436 { .compatible = "brcm,bcm6318-usbh-phy", .data = &usbh_bcm6318 },
437 { .compatible = "brcm,bcm6328-usbh-phy", .data = &usbh_bcm6328 },
438 { .compatible = "brcm,bcm6358-usbh-phy", .data = &usbh_bcm6358 },
439 { .compatible = "brcm,bcm6362-usbh-phy", .data = &usbh_bcm6368 },
440 { .compatible = "brcm,bcm6368-usbh-phy", .data = &usbh_bcm6368 },
441 { .compatible = "brcm,bcm63268-usbh-phy", .data = &usbh_bcm63268 },
448 .name = "bcm63xx-usbh-phy",