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
75 /* PLLC bits to set/clear for power on */
79 /* Setup bits to set/clear for power on */
86 /* Test Port Control value to set if non-zero */
107 [USBH_BRT_CONTROL1] = -1,
108 [USBH_BRT_CONTROL2] = -1,
109 [USBH_BRT_STATUS1] = -1,
110 [USBH_BRT_STATUS2] = -1,
115 [USBH_GENERIC_CONTROL] = -1,
154 [USBH_BRT_CONTROL1] = -1,
155 [USBH_BRT_CONTROL2] = -1,
156 [USBH_BRT_STATUS1] = -1,
157 [USBH_BRT_STATUS2] = -1,
158 [USBH_UTMI_CONTROL1] = -1,
160 [USBH_PLL_CONTROL1] = -1,
162 [USBH_GENERIC_CONTROL] = -1,
163 [USBH_FRAME_ADJUST_VALUE] = -1,
164 [USBH_SETUP] = -1,
165 [USBH_MDIO] = -1,
166 [USBH_MDIO32] = -1,
167 [USBH_USB_SIM_CONTROL] = -1,
172 * help, so the magic value is used as-is.
187 [USBH_GENERIC_CONTROL] = -1,
226 return (usbh->variant->regs[reg] >= 0); in usbh_has_reg()
231 return __raw_readl(usbh->base + usbh->variant->regs[reg]); in usbh_readl()
237 __raw_writel(value, usbh->base + usbh->variant->regs[reg]); in usbh_writel()
245 ret = clk_prepare_enable(usbh->usbh_clk); in bcm63xx_usbh_phy_init()
247 dev_err(&phy->dev, "unable to enable usbh clock: %d\n", ret); in bcm63xx_usbh_phy_init()
251 ret = clk_prepare_enable(usbh->usb_ref_clk); in bcm63xx_usbh_phy_init()
253 dev_err(&phy->dev, "unable to enable usb_ref clock: %d\n", ret); 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()
260 dev_err(&phy->dev, "unable to reset device: %d\n", ret); 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()
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()
285 val |= usbh->variant->setup_set; in bcm63xx_usbh_phy_init()
286 val &= ~usbh->variant->setup_clr; in bcm63xx_usbh_phy_init()
294 val |= usbh->variant->usc_set; in bcm63xx_usbh_phy_init()
299 if (usbh->variant->tpc_val && 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()
306 usbh->variant->utmictl1_dev_set) { in bcm63xx_usbh_phy_init()
309 val |= usbh->variant->utmictl1_dev_set; in bcm63xx_usbh_phy_init()
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()
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()
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()
372 usbh->device_mode = !!args->args[0]; in bcm63xx_usbh_phy_xlate()
379 struct device *dev = &pdev->dev; in bcm63xx_usbh_phy_probe()
387 return -ENOMEM; in bcm63xx_usbh_phy_probe()
391 return -EINVAL; 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()
435 { .compatible = "brcm,bcm6318-usbh-phy", .data = &usbh_bcm6318 },
436 { .compatible = "brcm,bcm6328-usbh-phy", .data = &usbh_bcm6328 },
437 { .compatible = "brcm,bcm6358-usbh-phy", .data = &usbh_bcm6358 },
438 { .compatible = "brcm,bcm6362-usbh-phy", .data = &usbh_bcm6368 },
439 { .compatible = "brcm,bcm6368-usbh-phy", .data = &usbh_bcm6368 },
440 { .compatible = "brcm,bcm63268-usbh-phy", .data = &usbh_bcm63268 },
447 .name = "bcm63xx-usbh-phy",