Lines Matching refs:phy

117 __maybe_unused static void usb_phy_write(struct sunxi_usb_phy *phy, int addr,  in usb_phy_write()  argument
128 usbc_bit = 1 << (phy->id * 2); in usb_phy_write()
150 static void sunxi_usb_phy_config(struct sunxi_usb_phy *phy) in sunxi_usb_phy_config() argument
153 if (phy->id == 0) in sunxi_usb_phy_config()
156 clrbits_le32(phy->base + REG_PMU_UNK_H3, 0x02); in sunxi_usb_phy_config()
159 static void sunxi_usb_phy_config(struct sunxi_usb_phy *phy) in sunxi_usb_phy_config() argument
163 static void sunxi_usb_phy_config(struct sunxi_usb_phy *phy) in sunxi_usb_phy_config() argument
170 if (phy->id == 0) in sunxi_usb_phy_config()
171 usb_phy_write(phy, 0x0c, 0x01, 1); in sunxi_usb_phy_config()
174 usb_phy_write(phy, 0x20, 0x14, 5); in sunxi_usb_phy_config()
178 usb_phy_write(phy, 0x2a, 2, 2); in sunxi_usb_phy_config()
180 usb_phy_write(phy, 0x2a, 3, 2); in sunxi_usb_phy_config()
187 static void sunxi_usb_phy_passby(struct sunxi_usb_phy *phy, int enable) in sunxi_usb_phy_passby() argument
192 addr = (void *)phy->base + SUNXI_USB_PMU_IRQ_ENABLE; in sunxi_usb_phy_passby()
200 if (phy->id == 2) in sunxi_usb_phy_passby()
217 struct sunxi_usb_phy *phy = &sunxi_usb_phy[index]; in sunxi_usb_phy_enable_squelch_detect() local
219 usb_phy_write(phy, 0x3c, enable ? 0 : 2, 2); in sunxi_usb_phy_enable_squelch_detect()
225 struct sunxi_usb_phy *phy = &sunxi_usb_phy[index]; in sunxi_usb_phy_init() local
228 phy->init_count++; in sunxi_usb_phy_init()
229 if (phy->init_count != 1) in sunxi_usb_phy_init()
232 setbits_le32(&ccm->usb_clk_cfg, phy->usb_rst_mask); in sunxi_usb_phy_init()
234 sunxi_usb_phy_config(phy); in sunxi_usb_phy_init()
236 if (phy->id != 0) in sunxi_usb_phy_init()
237 sunxi_usb_phy_passby(phy, SUNXI_USB_PASSBY_EN); in sunxi_usb_phy_init()
240 if (phy->id == 0) { in sunxi_usb_phy_init()
251 struct sunxi_usb_phy *phy = &sunxi_usb_phy[index]; in sunxi_usb_phy_exit() local
254 phy->init_count--; in sunxi_usb_phy_exit()
255 if (phy->init_count != 0) in sunxi_usb_phy_exit()
258 if (phy->id != 0) in sunxi_usb_phy_exit()
259 sunxi_usb_phy_passby(phy, !SUNXI_USB_PASSBY_EN); in sunxi_usb_phy_exit()
262 if (phy->id == 0) { in sunxi_usb_phy_exit()
268 clrbits_le32(&ccm->usb_clk_cfg, phy->usb_rst_mask); in sunxi_usb_phy_exit()
273 struct sunxi_usb_phy *phy = &sunxi_usb_phy[index]; in sunxi_usb_phy_power_on() local
280 phy->power_on_count++; in sunxi_usb_phy_power_on()
281 if (phy->power_on_count != 1) in sunxi_usb_phy_power_on()
284 if (phy->gpio_vbus >= 0) in sunxi_usb_phy_power_on()
285 gpio_set_value(phy->gpio_vbus, 1); in sunxi_usb_phy_power_on()
290 struct sunxi_usb_phy *phy = &sunxi_usb_phy[index]; in sunxi_usb_phy_power_off() local
292 phy->power_on_count--; in sunxi_usb_phy_power_off()
293 if (phy->power_on_count != 0) in sunxi_usb_phy_power_off()
296 if (phy->gpio_vbus >= 0) in sunxi_usb_phy_power_off()
297 gpio_set_value(phy->gpio_vbus, 0); in sunxi_usb_phy_power_off()
302 struct sunxi_usb_phy *phy = &sunxi_usb_phy[index]; in sunxi_usb_phy_vbus_detect() local
305 if (phy->gpio_vbus_det < 0) in sunxi_usb_phy_vbus_detect()
306 return phy->gpio_vbus_det; in sunxi_usb_phy_vbus_detect()
308 err = gpio_get_value(phy->gpio_vbus_det); in sunxi_usb_phy_vbus_detect()
316 err = gpio_get_value(phy->gpio_vbus_det); in sunxi_usb_phy_vbus_detect()
324 struct sunxi_usb_phy *phy = &sunxi_usb_phy[index]; in sunxi_usb_phy_id_detect() local
326 if (phy->gpio_id_det < 0) in sunxi_usb_phy_id_detect()
327 return phy->gpio_id_det; in sunxi_usb_phy_id_detect()
329 return gpio_get_value(phy->gpio_id_det); in sunxi_usb_phy_id_detect()
335 struct sunxi_usb_phy *phy; in sunxi_usb_phy_probe() local
339 phy = &sunxi_usb_phy[i]; in sunxi_usb_phy_probe()
341 phy->gpio_vbus = get_vbus_gpio(i); in sunxi_usb_phy_probe()
342 if (phy->gpio_vbus >= 0) { in sunxi_usb_phy_probe()
343 ret = gpio_request(phy->gpio_vbus, "usb_vbus"); in sunxi_usb_phy_probe()
346 ret = gpio_direction_output(phy->gpio_vbus, 0); in sunxi_usb_phy_probe()
351 phy->gpio_vbus_det = get_vbus_detect_gpio(i); in sunxi_usb_phy_probe()
352 if (phy->gpio_vbus_det >= 0) { in sunxi_usb_phy_probe()
353 ret = gpio_request(phy->gpio_vbus_det, "usb_vbus_det"); in sunxi_usb_phy_probe()
356 ret = gpio_direction_input(phy->gpio_vbus_det); in sunxi_usb_phy_probe()
361 phy->gpio_id_det = get_id_detect_gpio(i); in sunxi_usb_phy_probe()
362 if (phy->gpio_id_det >= 0) { in sunxi_usb_phy_probe()
363 ret = gpio_request(phy->gpio_id_det, "usb_id_det"); in sunxi_usb_phy_probe()
366 ret = gpio_direction_input(phy->gpio_id_det); in sunxi_usb_phy_probe()
369 sunxi_gpio_set_pull(phy->gpio_id_det, in sunxi_usb_phy_probe()
382 struct sunxi_usb_phy *phy; in sunxi_usb_phy_remove() local
388 phy = &sunxi_usb_phy[i]; in sunxi_usb_phy_remove()
390 if (phy->gpio_vbus >= 0) in sunxi_usb_phy_remove()
391 gpio_free(phy->gpio_vbus); in sunxi_usb_phy_remove()
393 if (phy->gpio_vbus_det >= 0) in sunxi_usb_phy_remove()
394 gpio_free(phy->gpio_vbus_det); in sunxi_usb_phy_remove()
396 if (phy->gpio_id_det >= 0) in sunxi_usb_phy_remove()
397 gpio_free(phy->gpio_id_det); in sunxi_usb_phy_remove()