Lines Matching +full:otg +full:- +full:bvalid
1 // SPDX-License-Identifier: GPL-2.0+
3 * dwc3-st.c Support for dwc3 platform devices on ST Microelectronics platforms
14 * Inspired by dwc3-omap.c and dwc3-exynos.c.
79 * struct st_dwc3 - dwc3-st driver private structure
114 * OTG and dual role are not yet supported!
121 err = regmap_read(dwc3_data->regmap, dwc3_data->syscfg_reg_off, &val); in st_dwc3_drd_init()
127 switch (dwc3_data->dr_mode) { in st_dwc3_drd_init()
162 dev_err(dwc3_data->dev, "Unsupported mode of operation %d\n", in st_dwc3_drd_init()
163 dwc3_data->dr_mode); in st_dwc3_drd_init()
164 return -EINVAL; in st_dwc3_drd_init()
167 return regmap_write(dwc3_data->regmap, dwc3_data->syscfg_reg_off, val); in st_dwc3_drd_init()
176 u32 reg = st_dwc3_readl(dwc3_data->glue_base, CLKRST_CTRL); in st_dwc3_init()
180 st_dwc3_writel(dwc3_data->glue_base, CLKRST_CTRL, reg); in st_dwc3_init()
182 /* configure mux for vbus, powerpresent and bvalid signals */ in st_dwc3_init()
183 reg = st_dwc3_readl(dwc3_data->glue_base, USB2_VBUS_MNGMNT_SEL1); in st_dwc3_init()
189 st_dwc3_writel(dwc3_data->glue_base, USB2_VBUS_MNGMNT_SEL1, reg); in st_dwc3_init()
191 reg = st_dwc3_readl(dwc3_data->glue_base, CLKRST_CTRL); in st_dwc3_init()
193 st_dwc3_writel(dwc3_data->glue_base, CLKRST_CTRL, reg); in st_dwc3_init()
200 struct device *dev = &pdev->dev; in st_dwc3_probe()
201 struct device_node *node = dev->of_node; in st_dwc3_probe()
208 return -ENOMEM; in st_dwc3_probe()
210 dwc3_data->glue_base = in st_dwc3_probe()
211 devm_platform_ioremap_resource_byname(pdev, "reg-glue"); in st_dwc3_probe()
212 if (IS_ERR(dwc3_data->glue_base)) in st_dwc3_probe()
213 return PTR_ERR(dwc3_data->glue_base); in st_dwc3_probe()
219 dwc3_data->dev = dev; in st_dwc3_probe()
220 dwc3_data->regmap = regmap; in st_dwc3_probe()
222 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "syscfg-reg"); in st_dwc3_probe()
224 return -ENXIO; in st_dwc3_probe()
226 dwc3_data->syscfg_reg_off = res->start; in st_dwc3_probe()
228 dev_vdbg(dev, "glue-logic addr 0x%pK, syscfg-reg offset 0x%x\n", in st_dwc3_probe()
229 dwc3_data->glue_base, dwc3_data->syscfg_reg_off); in st_dwc3_probe()
235 return -ENODEV; in st_dwc3_probe()
238 dwc3_data->rstc_pwrdn = in st_dwc3_probe()
240 if (IS_ERR(dwc3_data->rstc_pwrdn)) in st_dwc3_probe()
241 return dev_err_probe(dev, PTR_ERR(dwc3_data->rstc_pwrdn), in st_dwc3_probe()
245 reset_control_deassert(dwc3_data->rstc_pwrdn); in st_dwc3_probe()
247 dwc3_data->rstc_rst = in st_dwc3_probe()
249 if (IS_ERR(dwc3_data->rstc_rst)) { in st_dwc3_probe()
250 ret = dev_err_probe(dev, PTR_ERR(dwc3_data->rstc_rst), in st_dwc3_probe()
256 reset_control_deassert(dwc3_data->rstc_rst); in st_dwc3_probe()
268 ret = -ENODEV; in st_dwc3_probe()
272 dwc3_data->dr_mode = usb_get_dr_mode(&child_pdev->dev); in st_dwc3_probe()
279 * as soon as OTG is available. in st_dwc3_probe()
296 reset_control_assert(dwc3_data->rstc_rst); in st_dwc3_probe()
298 reset_control_assert(dwc3_data->rstc_pwrdn); in st_dwc3_probe()
306 of_platform_depopulate(&pdev->dev); in st_dwc3_remove()
308 reset_control_assert(dwc3_data->rstc_pwrdn); in st_dwc3_remove()
309 reset_control_assert(dwc3_data->rstc_rst); in st_dwc3_remove()
317 reset_control_assert(dwc3_data->rstc_pwrdn); in st_dwc3_suspend()
318 reset_control_assert(dwc3_data->rstc_rst); in st_dwc3_suspend()
332 reset_control_deassert(dwc3_data->rstc_pwrdn); in st_dwc3_resume()
333 reset_control_deassert(dwc3_data->rstc_rst); in st_dwc3_resume()
351 { .compatible = "st,stih407-dwc3" },
361 .name = "usb-st-dwc3",