Lines Matching +full:usb +full:- +full:misc +full:- +full:reg

1 // SPDX-License-Identifier: GPL-2.0
48 /* Armada 3700 USB miscellaneous registers */
59 * struct mvebu_a3700_utmi_caps - PHY capabilities
62 * - The UTMI PHY wired to the USB3/USB2 controller (otg)
63 * - The UTMI PHY wired to the USB2 controller (host only)
72 * struct mvebu_a3700_utmi - PHY driver data
75 * @usb_misc: Regmap with USB miscellaneous registers including PHY ones
89 struct device *dev = &phy->dev; in mvebu_a3700_utmi_phy_power_on()
90 int usb32 = utmi->caps->usb32; in mvebu_a3700_utmi_phy_power_on()
92 u32 reg; in mvebu_a3700_utmi_phy_power_on() local
98 reg = readl(utmi->regs + USB2_PHY_PLL_CTRL_REG0); in mvebu_a3700_utmi_phy_power_on()
99 reg &= ~(PLL_REF_DIV_MASK | PLL_FB_DIV_MASK | PLL_SEL_LPFR_MASK); in mvebu_a3700_utmi_phy_power_on()
100 reg |= (PLL_REF_DIV_5 << PLL_REF_DIV_OFF) | in mvebu_a3700_utmi_phy_power_on()
102 writel(reg, utmi->regs + USB2_PHY_PLL_CTRL_REG0); in mvebu_a3700_utmi_phy_power_on()
105 regmap_update_bits(utmi->usb_misc, USB2_PHY_CTRL(usb32), in mvebu_a3700_utmi_phy_power_on()
111 reg = readl(utmi->regs + USB2_PHY_OTG_CTRL); in mvebu_a3700_utmi_phy_power_on()
112 reg |= PHY_PU_OTG; in mvebu_a3700_utmi_phy_power_on()
113 writel(reg, utmi->regs + USB2_PHY_OTG_CTRL); in mvebu_a3700_utmi_phy_power_on()
116 reg = readl(utmi->regs + USB2_PHY_CHRGR_DETECT); in mvebu_a3700_utmi_phy_power_on()
117 reg &= ~(PHY_CDP_EN | PHY_DCP_EN | PHY_PD_EN | PHY_PU_CHRG_DTC | in mvebu_a3700_utmi_phy_power_on()
119 writel(reg, utmi->regs + USB2_PHY_CHRGR_DETECT); in mvebu_a3700_utmi_phy_power_on()
121 /* Disable PHY DP/DM pull-down (used for device mode) */ in mvebu_a3700_utmi_phy_power_on()
122 regmap_update_bits(utmi->usb_misc, USB2_PHY_CTRL(usb32), in mvebu_a3700_utmi_phy_power_on()
128 ret = readl_poll_timeout(utmi->regs + USB2_PHY_CAL_CTRL, reg, in mvebu_a3700_utmi_phy_power_on()
129 reg & PHY_PLLCAL_DONE, in mvebu_a3700_utmi_phy_power_on()
137 ret = readl_poll_timeout(utmi->regs + USB2_PHY_CAL_CTRL, reg, in mvebu_a3700_utmi_phy_power_on()
138 reg & PHY_IMPCAL_DONE, in mvebu_a3700_utmi_phy_power_on()
146 ret = readl_poll_timeout(utmi->regs + USB2_RX_CHAN_CTRL1, reg, in mvebu_a3700_utmi_phy_power_on()
147 reg & USB2PHY_SQCAL_DONE, in mvebu_a3700_utmi_phy_power_on()
155 ret = readl_poll_timeout(utmi->regs + USB2_PHY_PLL_CTRL_REG0, reg, in mvebu_a3700_utmi_phy_power_on()
156 reg & PLL_READY, in mvebu_a3700_utmi_phy_power_on()
167 int usb32 = utmi->caps->usb32; in mvebu_a3700_utmi_phy_power_off()
168 u32 reg; in mvebu_a3700_utmi_phy_power_off() local
170 /* Disable PHY pull-up and enable USB2 suspend */ in mvebu_a3700_utmi_phy_power_off()
171 reg = readl(utmi->regs + USB2_PHY_CTRL(usb32)); in mvebu_a3700_utmi_phy_power_off()
172 reg &= ~(RB_USB2PHY_PU | RB_USB2PHY_SUSPM(usb32)); in mvebu_a3700_utmi_phy_power_off()
173 writel(reg, utmi->regs + USB2_PHY_CTRL(usb32)); in mvebu_a3700_utmi_phy_power_off()
177 reg = readl(utmi->regs + USB2_PHY_OTG_CTRL); in mvebu_a3700_utmi_phy_power_off()
178 reg &= ~PHY_PU_OTG; in mvebu_a3700_utmi_phy_power_off()
179 writel(reg, utmi->regs + USB2_PHY_OTG_CTRL); in mvebu_a3700_utmi_phy_power_off()
203 .compatible = "marvell,a3700-utmi-otg-phy",
207 .compatible = "marvell,a3700-utmi-host-phy",
216 struct device *dev = &pdev->dev; in mvebu_a3700_utmi_phy_probe()
222 return -ENOMEM; in mvebu_a3700_utmi_phy_probe()
225 utmi->regs = devm_platform_ioremap_resource(pdev, 0); in mvebu_a3700_utmi_phy_probe()
226 if (IS_ERR(utmi->regs)) in mvebu_a3700_utmi_phy_probe()
227 return PTR_ERR(utmi->regs); in mvebu_a3700_utmi_phy_probe()
230 utmi->usb_misc = syscon_regmap_lookup_by_phandle(dev->of_node, in mvebu_a3700_utmi_phy_probe()
231 "marvell,usb-misc-reg"); in mvebu_a3700_utmi_phy_probe()
232 if (IS_ERR(utmi->usb_misc)) { in mvebu_a3700_utmi_phy_probe()
234 "Missing USB misc purpose system controller\n"); in mvebu_a3700_utmi_phy_probe()
235 return PTR_ERR(utmi->usb_misc); in mvebu_a3700_utmi_phy_probe()
239 utmi->caps = of_device_get_match_data(dev); in mvebu_a3700_utmi_phy_probe()
242 utmi->phy = devm_phy_create(dev, NULL, utmi->caps->ops); in mvebu_a3700_utmi_phy_probe()
243 if (IS_ERR(utmi->phy)) { in mvebu_a3700_utmi_phy_probe()
245 return PTR_ERR(utmi->phy); in mvebu_a3700_utmi_phy_probe()
248 phy_set_drvdata(utmi->phy, utmi); in mvebu_a3700_utmi_phy_probe()
251 utmi->caps->ops->power_off(utmi->phy); in mvebu_a3700_utmi_phy_probe()
261 .name = "mvebu-a3700-utmi-phy",