Lines Matching refs:uphy

45 	struct qcom_usb_hs_phy *uphy = phy_get_drvdata(phy);  in qcom_usb_hs_phy_set_mode()  local
49 if (!uphy->vbus_edev) { in qcom_usb_hs_phy_set_mode()
64 ret = ulpi_write(uphy->ulpi, ULPI_USB_INT_EN_RISE, val); in qcom_usb_hs_phy_set_mode()
67 ret = ulpi_write(uphy->ulpi, ULPI_USB_INT_EN_FALL, val); in qcom_usb_hs_phy_set_mode()
81 ret = ulpi_write(uphy->ulpi, ULPI_SET(ULPI_PWR_CLK_MNG_REG), in qcom_usb_hs_phy_set_mode()
85 ret = ulpi_write(uphy->ulpi, addr, ULPI_MISC_A_VBUSVLDEXTSEL); in qcom_usb_hs_phy_set_mode()
95 struct qcom_usb_hs_phy *uphy; in qcom_usb_hs_phy_vbus_notifier() local
98 uphy = container_of(nb, struct qcom_usb_hs_phy, vbus_notify); in qcom_usb_hs_phy_vbus_notifier()
105 return ulpi_write(uphy->ulpi, addr, ULPI_MISC_A_VBUSVLDEXT); in qcom_usb_hs_phy_vbus_notifier()
110 struct qcom_usb_hs_phy *uphy = phy_get_drvdata(phy); in qcom_usb_hs_phy_power_on() local
111 struct ulpi *ulpi = uphy->ulpi; in qcom_usb_hs_phy_power_on()
115 ret = clk_prepare_enable(uphy->ref_clk); in qcom_usb_hs_phy_power_on()
119 ret = clk_prepare_enable(uphy->sleep_clk); in qcom_usb_hs_phy_power_on()
123 ret = regulator_set_load(uphy->v1p8, 50000); in qcom_usb_hs_phy_power_on()
127 ret = regulator_enable(uphy->v1p8); in qcom_usb_hs_phy_power_on()
131 ret = regulator_set_voltage_triplet(uphy->v3p3, 3050000, 3300000, in qcom_usb_hs_phy_power_on()
136 ret = regulator_set_load(uphy->v3p3, 50000); in qcom_usb_hs_phy_power_on()
140 ret = regulator_enable(uphy->v3p3); in qcom_usb_hs_phy_power_on()
144 for (seq = uphy->init_seq; seq->addr; seq++) { in qcom_usb_hs_phy_power_on()
151 if (uphy->reset) { in qcom_usb_hs_phy_power_on()
152 ret = reset_control_reset(uphy->reset); in qcom_usb_hs_phy_power_on()
157 if (uphy->vbus_edev) { in qcom_usb_hs_phy_power_on()
158 state = extcon_get_state(uphy->vbus_edev, EXTCON_USB); in qcom_usb_hs_phy_power_on()
160 qcom_usb_hs_phy_vbus_notifier(&uphy->vbus_notify, state, in qcom_usb_hs_phy_power_on()
161 uphy->vbus_edev); in qcom_usb_hs_phy_power_on()
162 ret = extcon_register_notifier(uphy->vbus_edev, EXTCON_USB, in qcom_usb_hs_phy_power_on()
163 &uphy->vbus_notify); in qcom_usb_hs_phy_power_on()
170 regulator_disable(uphy->v3p3); in qcom_usb_hs_phy_power_on()
172 regulator_disable(uphy->v1p8); in qcom_usb_hs_phy_power_on()
174 clk_disable_unprepare(uphy->sleep_clk); in qcom_usb_hs_phy_power_on()
176 clk_disable_unprepare(uphy->ref_clk); in qcom_usb_hs_phy_power_on()
182 struct qcom_usb_hs_phy *uphy = phy_get_drvdata(phy); in qcom_usb_hs_phy_power_off() local
184 if (uphy->vbus_edev) in qcom_usb_hs_phy_power_off()
185 extcon_unregister_notifier(uphy->vbus_edev, EXTCON_USB, in qcom_usb_hs_phy_power_off()
186 &uphy->vbus_notify); in qcom_usb_hs_phy_power_off()
187 regulator_disable(uphy->v3p3); in qcom_usb_hs_phy_power_off()
188 regulator_disable(uphy->v1p8); in qcom_usb_hs_phy_power_off()
189 clk_disable_unprepare(uphy->sleep_clk); in qcom_usb_hs_phy_power_off()
190 clk_disable_unprepare(uphy->ref_clk); in qcom_usb_hs_phy_power_off()
204 struct qcom_usb_hs_phy *uphy; in qcom_usb_hs_phy_probe() local
212 uphy = devm_kzalloc(&ulpi->dev, sizeof(*uphy), GFP_KERNEL); in qcom_usb_hs_phy_probe()
213 if (!uphy) in qcom_usb_hs_phy_probe()
215 ulpi_set_drvdata(ulpi, uphy); in qcom_usb_hs_phy_probe()
216 uphy->ulpi = ulpi; in qcom_usb_hs_phy_probe()
221 uphy->init_seq = devm_kmalloc_array(&ulpi->dev, (size / 2) + 1, in qcom_usb_hs_phy_probe()
222 sizeof(*uphy->init_seq), GFP_KERNEL); in qcom_usb_hs_phy_probe()
223 if (!uphy->init_seq) in qcom_usb_hs_phy_probe()
226 (u8 *)uphy->init_seq, size); in qcom_usb_hs_phy_probe()
230 uphy->init_seq[size / 2].addr = uphy->init_seq[size / 2].val = 0; in qcom_usb_hs_phy_probe()
232 uphy->ref_clk = clk = devm_clk_get(&ulpi->dev, "ref"); in qcom_usb_hs_phy_probe()
236 uphy->sleep_clk = clk = devm_clk_get(&ulpi->dev, "sleep"); in qcom_usb_hs_phy_probe()
240 uphy->v1p8 = reg = devm_regulator_get(&ulpi->dev, "v1p8"); in qcom_usb_hs_phy_probe()
244 uphy->v3p3 = reg = devm_regulator_get(&ulpi->dev, "v3p3"); in qcom_usb_hs_phy_probe()
248 uphy->reset = reset = devm_reset_control_get(&ulpi->dev, "por"); in qcom_usb_hs_phy_probe()
252 uphy->reset = NULL; in qcom_usb_hs_phy_probe()
255 uphy->phy = devm_phy_create(&ulpi->dev, ulpi->dev.of_node, in qcom_usb_hs_phy_probe()
257 if (IS_ERR(uphy->phy)) in qcom_usb_hs_phy_probe()
258 return PTR_ERR(uphy->phy); in qcom_usb_hs_phy_probe()
260 uphy->vbus_edev = extcon_get_edev_by_phandle(&ulpi->dev, 0); in qcom_usb_hs_phy_probe()
261 if (IS_ERR(uphy->vbus_edev)) { in qcom_usb_hs_phy_probe()
262 if (PTR_ERR(uphy->vbus_edev) != -ENODEV) in qcom_usb_hs_phy_probe()
263 return PTR_ERR(uphy->vbus_edev); in qcom_usb_hs_phy_probe()
264 uphy->vbus_edev = NULL; in qcom_usb_hs_phy_probe()
267 uphy->vbus_notify.notifier_call = qcom_usb_hs_phy_vbus_notifier; in qcom_usb_hs_phy_probe()
268 phy_set_drvdata(uphy->phy, uphy); in qcom_usb_hs_phy_probe()