Lines Matching +full:eye +full:- +full:diagram +full:- +full:param
1 // SPDX-License-Identifier: GPL-2.0-only
5 * Copyright (C) 2017-2020 Hilisicon Electronics Co., Ltd.
189 while (retry-- > 0) { in hi3670_phy_cr_wait_ack()
203 return -ETIMEDOUT; in hi3670_phy_cr_wait_ack()
293 ret = regmap_write(priv->usb31misc, USB3OTG_CTRL4, in hi3670_phy_set_params()
294 priv->eye_diagram_param); in hi3670_phy_set_params()
296 dev_err(priv->dev, "set USB3OTG_CTRL4 failed\n"); in hi3670_phy_set_params()
300 while (retry-- > 0) { in hi3670_phy_set_params()
301 ret = hi3670_phy_cr_read(priv->usb31misc, in hi3670_phy_set_params()
306 if (ret != -ETIMEDOUT) { in hi3670_phy_set_params()
307 dev_err(priv->dev, "read TX_VBOOST_LVL_REG failed\n"); in hi3670_phy_set_params()
314 reg |= (TX_VBOOST_LVL_ENABLE | (priv->tx_vboost_lvl << TX_VBOOST_LVL_START)); in hi3670_phy_set_params()
315 ret = hi3670_phy_cr_write(priv->usb31misc, TX_VBOOST_LVL_REG, reg); in hi3670_phy_set_params()
317 dev_err(priv->dev, "write TX_VBOOST_LVL_REG failed\n"); in hi3670_phy_set_params()
326 if (!priv->sctrl) { in hi3670_is_abbclk_selected()
327 dev_err(priv->dev, "priv->sctrl is null!\n"); in hi3670_is_abbclk_selected()
331 if (regmap_read(priv->sctrl, SCTRL_SCDEEPSLEEPED, ®)) { in hi3670_is_abbclk_selected()
332 dev_err(priv->dev, "SCTRL_SCDEEPSLEEPED read failed!\n"); in hi3670_is_abbclk_selected()
349 ret = regmap_write(priv->peri_crg, PERI_CRG_ISODIS, in hi3670_config_phy_clock()
355 ret = regmap_write(priv->pctrl, PCTRL_PERI_CTRL3, in hi3670_config_phy_clock()
361 ret = regmap_update_bits(priv->pctrl, in hi3670_config_phy_clock()
366 ret = regmap_update_bits(priv->usb31misc, USB_MISC_CFGA0, in hi3670_config_phy_clock()
371 ret = regmap_read(priv->usb31misc, USB3OTG_CTRL7, &val); in hi3670_config_phy_clock()
376 ret = regmap_write(priv->usb31misc, USB3OTG_CTRL7, val); in hi3670_config_phy_clock()
383 ret = regmap_update_bits(priv->usb31misc, USB_MISC_CFG54, in hi3670_config_phy_clock()
389 ret = regmap_update_bits(priv->usb31misc, USB_MISC_CFGA0, in hi3670_config_phy_clock()
395 ret = regmap_read(priv->usb31misc, USB3OTG_CTRL7, &val); in hi3670_config_phy_clock()
400 ret = regmap_write(priv->usb31misc, USB3OTG_CTRL7, val); in hi3670_config_phy_clock()
404 ret = regmap_write(priv->peri_crg, in hi3670_config_phy_clock()
411 dev_err(priv->dev, "failed to config phy clock ret: %d\n", ret); in hi3670_config_phy_clock()
420 ret = regmap_write(priv->usb31misc, TCA_INTR_STS, 0xffff); in hi3670_config_tca()
424 ret = regmap_write(priv->usb31misc, TCA_INTR_EN, in hi3670_config_tca()
430 ret = regmap_update_bits(priv->usb31misc, TCA_CLK_RST, mask, 0); in hi3670_config_tca()
434 ret = regmap_update_bits(priv->usb31misc, TCA_GCFG, in hi3670_config_tca()
440 ret = regmap_update_bits(priv->usb31misc, TCA_SYSMODE_CFG, in hi3670_config_tca()
445 ret = regmap_read(priv->usb31misc, TCA_TCPC, &val); in hi3670_config_tca()
450 ret = regmap_write(priv->usb31misc, TCA_TCPC, val); in hi3670_config_tca()
454 ret = regmap_write(priv->usb31misc, TCA_VBUS_CTRL, in hi3670_config_tca()
461 dev_err(priv->dev, "failed to config phy clock ret: %d\n", ret); in hi3670_config_tca()
474 ret = regmap_update_bits(priv->usb31misc, USB_MISC_CFGA0, val, 0); in hi3670_phy_init()
483 ret = regmap_update_bits(priv->usb31misc, USB3OTG_CTRL5, in hi3670_phy_init()
489 ret = regmap_update_bits(priv->usb31misc, USB_MISC_CFG50, in hi3670_phy_init()
496 ret = regmap_update_bits(priv->usb31misc, USB_MISC_CFGA0, val, val); in hi3670_phy_init()
505 ret = regmap_update_bits(priv->usb31misc, USB_MISC_CFG54, in hi3670_phy_init()
515 ret = regmap_update_bits(priv->usb31misc, USB_MISC_CFG5C, in hi3670_phy_init()
523 ret = regmap_update_bits(priv->usb31misc, USB_MISC_CFGA0, val, val); in hi3670_phy_init()
531 ret = regmap_update_bits(priv->usb31misc, USB3OTG_CTRL0, val, val); in hi3670_phy_init()
536 ret = regmap_update_bits(priv->usb31misc, USB3OTG_CTRL3, val, val); in hi3670_phy_init()
548 dev_err(priv->dev, "failed to init phy ret: %d\n", ret); in hi3670_phy_init()
560 ret = regmap_update_bits(priv->usb31misc, USB_MISC_CFGA0, mask, 0); in hi3670_phy_exit()
566 ret = regmap_write(priv->pctrl, PCTRL_PERI_CTRL3, in hi3670_phy_exit()
569 ret = regmap_write(priv->peri_crg, PERI_CRG_PERDIS6, in hi3670_phy_exit()
577 dev_err(priv->dev, "failed to exit phy ret: %d\n", ret); in hi3670_phy_exit()
590 struct device *dev = &pdev->dev; in hi3670_phy_probe()
596 return -ENOMEM; in hi3670_phy_probe()
598 priv->dev = dev; in hi3670_phy_probe()
599 priv->peri_crg = syscon_regmap_lookup_by_phandle(dev->of_node, in hi3670_phy_probe()
600 "hisilicon,pericrg-syscon"); in hi3670_phy_probe()
601 if (IS_ERR(priv->peri_crg)) { in hi3670_phy_probe()
602 dev_err(dev, "no hisilicon,pericrg-syscon\n"); in hi3670_phy_probe()
603 return PTR_ERR(priv->peri_crg); in hi3670_phy_probe()
606 priv->pctrl = syscon_regmap_lookup_by_phandle(dev->of_node, in hi3670_phy_probe()
607 "hisilicon,pctrl-syscon"); in hi3670_phy_probe()
608 if (IS_ERR(priv->pctrl)) { in hi3670_phy_probe()
609 dev_err(dev, "no hisilicon,pctrl-syscon\n"); in hi3670_phy_probe()
610 return PTR_ERR(priv->pctrl); in hi3670_phy_probe()
613 priv->sctrl = syscon_regmap_lookup_by_phandle(dev->of_node, in hi3670_phy_probe()
614 "hisilicon,sctrl-syscon"); in hi3670_phy_probe()
615 if (IS_ERR(priv->sctrl)) { in hi3670_phy_probe()
616 dev_err(dev, "no hisilicon,sctrl-syscon\n"); in hi3670_phy_probe()
617 return PTR_ERR(priv->sctrl); in hi3670_phy_probe()
620 /* node of hi3670 phy is a sub-node of usb3_otg_bc */ in hi3670_phy_probe()
621 priv->usb31misc = syscon_node_to_regmap(dev->parent->of_node); in hi3670_phy_probe()
622 if (IS_ERR(priv->usb31misc)) { in hi3670_phy_probe()
623 dev_err(dev, "no hisilicon,usb3-otg-bc-syscon\n"); in hi3670_phy_probe()
624 return PTR_ERR(priv->usb31misc); in hi3670_phy_probe()
627 if (of_property_read_u32(dev->of_node, "hisilicon,eye-diagram-param", in hi3670_phy_probe()
628 &priv->eye_diagram_param)) in hi3670_phy_probe()
629 priv->eye_diagram_param = KIRIN970_USB_DEFAULT_PHY_PARAM; in hi3670_phy_probe()
631 if (of_property_read_u32(dev->of_node, "hisilicon,tx-vboost-lvl", in hi3670_phy_probe()
632 &priv->tx_vboost_lvl)) in hi3670_phy_probe()
633 priv->tx_vboost_lvl = KIRIN970_USB_DEFAULT_PHY_VBOOST; in hi3670_phy_probe()
645 { .compatible = "hisilicon,hi3670-usb-phy" },
653 .name = "hi3670-usb-phy",