Lines Matching +full:usb2 +full:- +full:phy0
1 // SPDX-License-Identifier: GPL-2.0
19 #define PHY0POR BIT(0) /* PHY Power-On Reset Control Bit */
21 #define PHY0COMN BIT(2) /* PHY Common Block Power-Down Control */
36 ret = clk_prepare_enable(p_phy->clk); in ma35_usb_phy_power_on()
38 dev_err(p_phy->dev, "Failed to enable PHY clock: %d\n", ret); in ma35_usb_phy_power_on()
42 regmap_read(p_phy->sysreg, MA35_SYS_REG_USBPMISCR, &val); in ma35_usb_phy_power_on()
45 * USB PHY0 is in operation mode already in ma35_usb_phy_power_on()
48 ret = regmap_read_poll_timeout(p_phy->sysreg, MA35_SYS_REG_USBPMISCR, val, in ma35_usb_phy_power_on()
55 * reset USB PHY0. in ma35_usb_phy_power_on()
56 * wait until USB PHY0 60 MHz UTMI Interface Clock ready in ma35_usb_phy_power_on()
58 regmap_update_bits(p_phy->sysreg, MA35_SYS_REG_USBPMISCR, 0x7, (PHY0POR | PHY0SUSPEND)); in ma35_usb_phy_power_on()
61 /* make USB PHY0 enter operation mode */ in ma35_usb_phy_power_on()
62 regmap_update_bits(p_phy->sysreg, MA35_SYS_REG_USBPMISCR, 0x7, PHY0SUSPEND); in ma35_usb_phy_power_on()
65 ret = regmap_read_poll_timeout(p_phy->sysreg, MA35_SYS_REG_USBPMISCR, val, in ma35_usb_phy_power_on()
67 if (ret == -ETIMEDOUT) { in ma35_usb_phy_power_on()
68 dev_err(p_phy->dev, "Check PHY clock, Timeout: %d\n", ret); in ma35_usb_phy_power_on()
69 clk_disable_unprepare(p_phy->clk); in ma35_usb_phy_power_on()
80 clk_disable_unprepare(p_phy->clk); in ma35_usb_phy_power_off()
96 p_phy = devm_kzalloc(&pdev->dev, sizeof(*p_phy), GFP_KERNEL); in ma35_usb_phy_probe()
98 return -ENOMEM; in ma35_usb_phy_probe()
100 p_phy->dev = &pdev->dev; in ma35_usb_phy_probe()
103 p_phy->sysreg = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, "nuvoton,sys"); in ma35_usb_phy_probe()
104 if (IS_ERR(p_phy->sysreg)) in ma35_usb_phy_probe()
105 return dev_err_probe(&pdev->dev, PTR_ERR(p_phy->sysreg), in ma35_usb_phy_probe()
108 p_phy->clk = of_clk_get(pdev->dev.of_node, 0); in ma35_usb_phy_probe()
109 if (IS_ERR(p_phy->clk)) in ma35_usb_phy_probe()
110 return dev_err_probe(&pdev->dev, PTR_ERR(p_phy->clk), in ma35_usb_phy_probe()
113 phy = devm_phy_create(&pdev->dev, NULL, &ma35_usb_phy_ops); in ma35_usb_phy_probe()
115 return dev_err_probe(&pdev->dev, PTR_ERR(phy), "Failed to create PHY\n"); in ma35_usb_phy_probe()
119 provider = devm_of_phy_provider_register(&pdev->dev, of_phy_simple_xlate); in ma35_usb_phy_probe()
121 return dev_err_probe(&pdev->dev, PTR_ERR(provider), in ma35_usb_phy_probe()
127 { .compatible = "nuvoton,ma35d1-usb2-phy", },
135 .name = "ma35d1-usb2-phy",
141 MODULE_DESCRIPTION("Nuvoton ma35d1 USB2.0 PHY driver");
142 MODULE_AUTHOR("Hui-Ping Chen <hpchen0nvt@gmail.com>");