Lines Matching +full:pericrg +full:- +full:syscon
1 // SPDX-License-Identifier: GPL-2.0
5 * Copyright (C) 2017-2018 Hilisicon Electronics Co., Ltd.
12 #include <linux/mfd/syscon.h>
72 ret = regmap_write(priv->peri_crg, PERI_CRG_ISODIS, USB_REFCLK_ISO_EN); in hi3660_phy_init()
78 ret = regmap_write(priv->pctrl, PCTRL_PERI_CTRL3, val); in hi3660_phy_init()
84 ret = regmap_write(priv->peri_crg, PERI_CRG_RSTEN4, val); in hi3660_phy_init()
91 ret = regmap_update_bits(priv->otg_bc, USBOTG3_CTRL0, mask, val); in hi3660_phy_init()
97 ret = regmap_update_bits(priv->otg_bc, USBOTG3_CTRL7, mask, val); in hi3660_phy_init()
103 ret = regmap_update_bits(priv->otg_bc, USBOTG3_CTRL2, mask, 0); in hi3660_phy_init()
112 ret = regmap_write(priv->peri_crg, PERI_CRG_RSTDIS4, val); in hi3660_phy_init()
122 ret = regmap_update_bits(priv->otg_bc, USBOTG3_CTRL3, mask, val); in hi3660_phy_init()
129 ret = regmap_write(priv->otg_bc, USBOTG3_CTRL4, in hi3660_phy_init()
130 priv->eye_diagram_param); in hi3660_phy_init()
136 dev_err(priv->dev, "failed to init phy ret: %d\n", ret); in hi3660_phy_init()
148 ret = regmap_write(priv->peri_crg, PERI_CRG_RSTEN4, val); in hi3660_phy_exit()
154 ret = regmap_write(priv->pctrl, PCTRL_PERI_CTRL3, val); in hi3660_phy_exit()
160 dev_err(priv->dev, "failed to exit phy ret: %d\n", ret); in hi3660_phy_exit()
173 struct device *dev = &pdev->dev; in hi3660_phy_probe()
179 return -ENOMEM; in hi3660_phy_probe()
181 priv->dev = dev; in hi3660_phy_probe()
182 priv->peri_crg = syscon_regmap_lookup_by_phandle(dev->of_node, in hi3660_phy_probe()
183 "hisilicon,pericrg-syscon"); in hi3660_phy_probe()
184 if (IS_ERR(priv->peri_crg)) { in hi3660_phy_probe()
185 dev_err(dev, "no hisilicon,pericrg-syscon\n"); in hi3660_phy_probe()
186 return PTR_ERR(priv->peri_crg); in hi3660_phy_probe()
189 priv->pctrl = syscon_regmap_lookup_by_phandle(dev->of_node, in hi3660_phy_probe()
190 "hisilicon,pctrl-syscon"); in hi3660_phy_probe()
191 if (IS_ERR(priv->pctrl)) { in hi3660_phy_probe()
192 dev_err(dev, "no hisilicon,pctrl-syscon\n"); in hi3660_phy_probe()
193 return PTR_ERR(priv->pctrl); in hi3660_phy_probe()
196 /* node of hi3660 phy is a sub-node of usb3_otg_bc */ in hi3660_phy_probe()
197 priv->otg_bc = syscon_node_to_regmap(dev->parent->of_node); in hi3660_phy_probe()
198 if (IS_ERR(priv->otg_bc)) { in hi3660_phy_probe()
199 dev_err(dev, "no hisilicon,usb3-otg-bc-syscon\n"); in hi3660_phy_probe()
200 return PTR_ERR(priv->otg_bc); in hi3660_phy_probe()
203 if (of_property_read_u32(dev->of_node, "hisilicon,eye-diagram-param", in hi3660_phy_probe()
204 &(priv->eye_diagram_param))) in hi3660_phy_probe()
205 priv->eye_diagram_param = HI3660_USB_DEFAULT_PHY_PARAM; in hi3660_phy_probe()
217 {.compatible = "hisilicon,hi3660-usb-phy",},
225 .name = "hi3660-usb-phy",