Lines Matching +full:valid +full:- +full:wakeup +full:- +full:mask

1 // SPDX-License-Identifier: GPL-2.0
3 * dwc3-am62.c - TI specific Glue layer for AM62 DWC3 USB Controller
5 * Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com
57 /* WAKEUP CONFIG register bits */
70 /* WAKEUP STAT register bits */
100 /* Mask for PHY PLL REFCLK */
134 return readl((am62->usbss) + offset); in dwc3_ti_readl()
139 writel(value, (am62->usbss) + offset); in dwc3_ti_writel()
144 struct device *dev = am62->dev; in phy_syscon_pll_refclk()
145 struct device_node *node = dev->of_node; in phy_syscon_pll_refclk()
150 syscon = syscon_regmap_lookup_by_phandle(node, "ti,syscon-phy-pll-refclk"); in phy_syscon_pll_refclk()
152 dev_err(dev, "unable to get ti,syscon-phy-pll-refclk regmap\n"); in phy_syscon_pll_refclk()
156 am62->syscon = syscon; in phy_syscon_pll_refclk()
158 ret = of_parse_phandle_with_fixed_args(node, "ti,syscon-phy-pll-refclk", 1, in phy_syscon_pll_refclk()
163 am62->offset = args.args[0]; in phy_syscon_pll_refclk()
165 ret = regmap_update_bits(am62->syscon, am62->offset, PHY_PLL_REFCLK_MASK, am62->rate_code); in phy_syscon_pll_refclk()
176 struct device *dev = &pdev->dev; in dwc3_ti_probe()
177 struct device_node *node = pdev->dev.of_node; in dwc3_ti_probe()
185 return -ENOMEM; in dwc3_ti_probe()
187 am62->dev = dev; in dwc3_ti_probe()
190 am62->usbss = devm_platform_ioremap_resource(pdev, 0); in dwc3_ti_probe()
191 if (IS_ERR(am62->usbss)) { in dwc3_ti_probe()
193 return PTR_ERR(am62->usbss); in dwc3_ti_probe()
196 am62->usb2_refclk = devm_clk_get(dev, "ref"); in dwc3_ti_probe()
197 if (IS_ERR(am62->usb2_refclk)) { in dwc3_ti_probe()
199 return PTR_ERR(am62->usb2_refclk); in dwc3_ti_probe()
203 rate = clk_get_rate(am62->usb2_refclk); in dwc3_ti_probe()
212 return -EINVAL; in dwc3_ti_probe()
215 am62->rate_code = i; in dwc3_ti_probe()
223 am62->vbus_divider = device_property_read_bool(dev, "ti,vbus-divider"); in dwc3_ti_probe()
225 if (am62->vbus_divider) in dwc3_ti_probe()
236 clk_prepare_enable(am62->usb2_refclk); in dwc3_ti_probe()
245 /* Set mode valid bit to indicate role is valid */ in dwc3_ti_probe()
250 /* Device has capability to wakeup system from sleep */ in dwc3_ti_probe()
254 dev_err(dev, "couldn't enable device as a wakeup source: %d\n", ret); in dwc3_ti_probe()
264 clk_disable_unprepare(am62->usb2_refclk); in dwc3_ti_probe()
280 struct device *dev = &pdev->dev; in dwc3_ti_remove()
286 /* Clear mode valid bit */ in dwc3_ti_remove()
292 clk_disable_unprepare(am62->usb2_refclk); in dwc3_ti_remove()
307 /* Set wakeup config enable bits */ in dwc3_ti_suspend_common()
315 * and in U2/L3 state else it causes spurious wake-up. in dwc3_ti_suspend_common()
319 /* clear wakeup status so we know what caused the wake up */ in dwc3_ti_suspend_common()
323 clk_disable_unprepare(am62->usb2_refclk); in dwc3_ti_suspend_common()
333 clk_prepare_enable(am62->usb2_refclk); in dwc3_ti_resume_common()
336 /* Clear wakeup config enable bits */ in dwc3_ti_resume_common()
341 am62->wakeup_stat = reg; in dwc3_ti_resume_common()
355 { .compatible = "ti,am62-usb"},
364 .name = "dwc3-am62",
372 MODULE_ALIAS("platform:dwc3-am62");
373 MODULE_AUTHOR("Aswath Govindraju <a-govindraju@ti.com>");