Lines Matching +full:reset +full:- +full:assert +full:- +full:ms
1 // SPDX-License-Identifier: GPL-2.0-or-later
20 #include <linux/reset.h>
63 writel(val, phy->base + reg); in u2_phy_w32()
68 return readl(phy->base + reg); in u2_phy_r32()
97 regmap_update_bits(phy->sysctl, RT_SYSC_REG_CLKCFG1, in ralink_usb_phy_power_on()
98 phy->clk, phy->clk); in ralink_usb_phy_power_on()
101 regmap_update_bits(phy->sysctl, RT_SYSC_REG_SYSCFG1, in ralink_usb_phy_power_on()
105 /* deassert the reset lines */ in ralink_usb_phy_power_on()
106 reset_control_deassert(phy->rsthost); in ralink_usb_phy_power_on()
107 reset_control_deassert(phy->rstdev); in ralink_usb_phy_power_on()
110 * The SDK kernel had a delay of 100ms. however on device in ralink_usb_phy_power_on()
111 * testing showed that 10ms is enough in ralink_usb_phy_power_on()
115 if (phy->base) in ralink_usb_phy_power_on()
119 regmap_read(phy->sysctl, RT_SYSC_REG_USB_PHY_CFG, &t); in ralink_usb_phy_power_on()
120 dev_info(&phy->phy->dev, "remote usb device wakeup %s\n", in ralink_usb_phy_power_on()
123 dev_info(&phy->phy->dev, "UTMI 8bit 60MHz\n"); in ralink_usb_phy_power_on()
125 dev_info(&phy->phy->dev, "UTMI 16bit 30MHz\n"); in ralink_usb_phy_power_on()
135 regmap_update_bits(phy->sysctl, RT_SYSC_REG_CLKCFG1, in ralink_usb_phy_power_off()
136 phy->clk, 0); in ralink_usb_phy_power_off()
138 /* assert the reset lines */ in ralink_usb_phy_power_off()
139 reset_control_assert(phy->rstdev); in ralink_usb_phy_power_off()
140 reset_control_assert(phy->rsthost); in ralink_usb_phy_power_off()
153 .compatible = "ralink,rt3352-usbphy",
158 .compatible = "mediatek,mt7620-usbphy",
163 .compatible = "mediatek,mt7628-usbphy",
172 struct device *dev = &pdev->dev; in ralink_usb_phy_probe()
177 match = of_match_device(ralink_usb_phy_of_match, &pdev->dev); in ralink_usb_phy_probe()
179 return -ENODEV; in ralink_usb_phy_probe()
183 return -ENOMEM; in ralink_usb_phy_probe()
185 phy->clk = (uintptr_t)match->data; in ralink_usb_phy_probe()
186 phy->base = NULL; in ralink_usb_phy_probe()
188 phy->sysctl = syscon_regmap_lookup_by_phandle(dev->of_node, "ralink,sysctl"); in ralink_usb_phy_probe()
189 if (IS_ERR(phy->sysctl)) { in ralink_usb_phy_probe()
191 return PTR_ERR(phy->sysctl); in ralink_usb_phy_probe()
195 if (of_device_is_compatible(dev->of_node, "mediatek,mt7628-usbphy")) { in ralink_usb_phy_probe()
196 phy->base = devm_platform_ioremap_resource(pdev, 0); in ralink_usb_phy_probe()
197 if (IS_ERR(phy->base)) { in ralink_usb_phy_probe()
199 return PTR_ERR(phy->base); in ralink_usb_phy_probe()
203 phy->rsthost = devm_reset_control_get(&pdev->dev, "host"); in ralink_usb_phy_probe()
204 if (IS_ERR(phy->rsthost)) { in ralink_usb_phy_probe()
205 dev_err(dev, "host reset is missing\n"); in ralink_usb_phy_probe()
206 return PTR_ERR(phy->rsthost); in ralink_usb_phy_probe()
209 phy->rstdev = devm_reset_control_get(&pdev->dev, "device"); in ralink_usb_phy_probe()
210 if (IS_ERR(phy->rstdev)) { in ralink_usb_phy_probe()
211 dev_err(dev, "device reset is missing\n"); in ralink_usb_phy_probe()
212 return PTR_ERR(phy->rstdev); in ralink_usb_phy_probe()
215 phy->phy = devm_phy_create(dev, NULL, &ralink_usb_phy_ops); in ralink_usb_phy_probe()
216 if (IS_ERR(phy->phy)) { in ralink_usb_phy_probe()
218 return PTR_ERR(phy->phy); in ralink_usb_phy_probe()
220 phy_set_drvdata(phy->phy, phy); in ralink_usb_phy_probe()
231 .name = "ralink-usb-phy",