Lines Matching refs:phy
36 struct phy *phy; member
44 static void sun9i_usb_phy_passby(struct sun9i_usb_phy *phy, int enable) in sun9i_usb_phy_passby() argument
52 if (phy->type == USBPHY_INTERFACE_MODE_HSIC) in sun9i_usb_phy_passby()
56 reg_value = readl(phy->pmu); in sun9i_usb_phy_passby()
63 writel(reg_value, phy->pmu); in sun9i_usb_phy_passby()
66 static int sun9i_usb_phy_init(struct phy *_phy) in sun9i_usb_phy_init()
68 struct sun9i_usb_phy *phy = phy_get_drvdata(_phy); in sun9i_usb_phy_init() local
71 ret = clk_prepare_enable(phy->clk); in sun9i_usb_phy_init()
75 ret = clk_prepare_enable(phy->hsic_clk); in sun9i_usb_phy_init()
79 ret = reset_control_deassert(phy->reset); in sun9i_usb_phy_init()
83 sun9i_usb_phy_passby(phy, 1); in sun9i_usb_phy_init()
87 clk_disable_unprepare(phy->hsic_clk); in sun9i_usb_phy_init()
90 clk_disable_unprepare(phy->clk); in sun9i_usb_phy_init()
96 static int sun9i_usb_phy_exit(struct phy *_phy) in sun9i_usb_phy_exit()
98 struct sun9i_usb_phy *phy = phy_get_drvdata(_phy); in sun9i_usb_phy_exit() local
100 sun9i_usb_phy_passby(phy, 0); in sun9i_usb_phy_exit()
101 reset_control_assert(phy->reset); in sun9i_usb_phy_exit()
102 clk_disable_unprepare(phy->hsic_clk); in sun9i_usb_phy_exit()
103 clk_disable_unprepare(phy->clk); in sun9i_usb_phy_exit()
116 struct sun9i_usb_phy *phy; in sun9i_usb_phy_probe() local
121 phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); in sun9i_usb_phy_probe()
122 if (!phy) in sun9i_usb_phy_probe()
125 phy->type = of_usb_get_phy_mode(np); in sun9i_usb_phy_probe()
126 if (phy->type == USBPHY_INTERFACE_MODE_HSIC) { in sun9i_usb_phy_probe()
127 phy->clk = devm_clk_get(dev, "hsic_480M"); in sun9i_usb_phy_probe()
128 if (IS_ERR(phy->clk)) { in sun9i_usb_phy_probe()
130 return PTR_ERR(phy->clk); in sun9i_usb_phy_probe()
133 phy->hsic_clk = devm_clk_get(dev, "hsic_12M"); in sun9i_usb_phy_probe()
134 if (IS_ERR(phy->hsic_clk)) { in sun9i_usb_phy_probe()
136 return PTR_ERR(phy->hsic_clk); in sun9i_usb_phy_probe()
139 phy->reset = devm_reset_control_get(dev, "hsic"); in sun9i_usb_phy_probe()
140 if (IS_ERR(phy->reset)) { in sun9i_usb_phy_probe()
142 return PTR_ERR(phy->reset); in sun9i_usb_phy_probe()
145 phy->clk = devm_clk_get(dev, "phy"); in sun9i_usb_phy_probe()
146 if (IS_ERR(phy->clk)) { in sun9i_usb_phy_probe()
148 return PTR_ERR(phy->clk); in sun9i_usb_phy_probe()
151 phy->reset = devm_reset_control_get(dev, "phy"); in sun9i_usb_phy_probe()
152 if (IS_ERR(phy->reset)) { in sun9i_usb_phy_probe()
154 return PTR_ERR(phy->reset); in sun9i_usb_phy_probe()
158 phy->pmu = devm_platform_ioremap_resource(pdev, 0); in sun9i_usb_phy_probe()
159 if (IS_ERR(phy->pmu)) in sun9i_usb_phy_probe()
160 return PTR_ERR(phy->pmu); in sun9i_usb_phy_probe()
162 phy->phy = devm_phy_create(dev, NULL, &sun9i_usb_phy_ops); in sun9i_usb_phy_probe()
163 if (IS_ERR(phy->phy)) { in sun9i_usb_phy_probe()
165 return PTR_ERR(phy->phy); in sun9i_usb_phy_probe()
168 phy_set_drvdata(phy->phy, phy); in sun9i_usb_phy_probe()