Lines Matching refs:phy

42 static int ulpi_set_otg_flags(struct usb_phy *phy)  in ulpi_set_otg_flags()  argument
47 if (phy->flags & ULPI_OTG_ID_PULLUP) in ulpi_set_otg_flags()
54 if (phy->flags & ULPI_OTG_DP_PULLDOWN_DIS) in ulpi_set_otg_flags()
57 if (phy->flags & ULPI_OTG_DM_PULLDOWN_DIS) in ulpi_set_otg_flags()
60 if (phy->flags & ULPI_OTG_EXTVBUSIND) in ulpi_set_otg_flags()
63 return usb_phy_io_write(phy, flags, ULPI_OTG_CTRL); in ulpi_set_otg_flags()
66 static int ulpi_set_fc_flags(struct usb_phy *phy) in ulpi_set_fc_flags() argument
74 if (phy->flags & ULPI_FC_HS) in ulpi_set_fc_flags()
76 else if (phy->flags & ULPI_FC_LS) in ulpi_set_fc_flags()
78 else if (phy->flags & ULPI_FC_FS4LS) in ulpi_set_fc_flags()
83 if (phy->flags & ULPI_FC_TERMSEL) in ulpi_set_fc_flags()
90 if (phy->flags & ULPI_FC_OP_NODRV) in ulpi_set_fc_flags()
92 else if (phy->flags & ULPI_FC_OP_DIS_NRZI) in ulpi_set_fc_flags()
94 else if (phy->flags & ULPI_FC_OP_NSYNC_NEOP) in ulpi_set_fc_flags()
105 return usb_phy_io_write(phy, flags, ULPI_FUNC_CTRL); in ulpi_set_fc_flags()
108 static int ulpi_set_ic_flags(struct usb_phy *phy) in ulpi_set_ic_flags() argument
112 if (phy->flags & ULPI_IC_AUTORESUME) in ulpi_set_ic_flags()
115 if (phy->flags & ULPI_IC_EXTVBUS_INDINV) in ulpi_set_ic_flags()
118 if (phy->flags & ULPI_IC_IND_PASSTHRU) in ulpi_set_ic_flags()
121 if (phy->flags & ULPI_IC_PROTECT_DIS) in ulpi_set_ic_flags()
124 return usb_phy_io_write(phy, flags, ULPI_IFC_CTRL); in ulpi_set_ic_flags()
127 static int ulpi_set_flags(struct usb_phy *phy) in ulpi_set_flags() argument
131 ret = ulpi_set_otg_flags(phy); in ulpi_set_flags()
135 ret = ulpi_set_ic_flags(phy); in ulpi_set_flags()
139 return ulpi_set_fc_flags(phy); in ulpi_set_flags()
142 static int ulpi_check_integrity(struct usb_phy *phy) in ulpi_check_integrity() argument
148 ret = usb_phy_io_write(phy, val, ULPI_SCRATCH); in ulpi_check_integrity()
152 ret = usb_phy_io_read(phy, ULPI_SCRATCH); in ulpi_check_integrity()
168 static int ulpi_init(struct usb_phy *phy) in ulpi_init() argument
174 ret = usb_phy_io_read(phy, ULPI_PRODUCT_ID_HIGH - i); in ulpi_init()
192 ret = ulpi_check_integrity(phy); in ulpi_init()
196 return ulpi_set_flags(phy); in ulpi_init()
201 struct usb_phy *phy = otg->usb_phy; in ulpi_set_host() local
202 unsigned int flags = usb_phy_io_read(phy, ULPI_IFC_CTRL); in ulpi_set_host()
215 if (phy->flags & ULPI_IC_6PIN_SERIAL) in ulpi_set_host()
217 else if (phy->flags & ULPI_IC_3PIN_SERIAL) in ulpi_set_host()
219 else if (phy->flags & ULPI_IC_CARKIT) in ulpi_set_host()
222 return usb_phy_io_write(phy, flags, ULPI_IFC_CTRL); in ulpi_set_host()
227 struct usb_phy *phy = otg->usb_phy; in ulpi_set_vbus() local
228 unsigned int flags = usb_phy_io_read(phy, ULPI_OTG_CTRL); in ulpi_set_vbus()
233 if (phy->flags & ULPI_OTG_DRVVBUS) in ulpi_set_vbus()
236 if (phy->flags & ULPI_OTG_DRVVBUS_EXT) in ulpi_set_vbus()
240 return usb_phy_io_write(phy, flags, ULPI_OTG_CTRL); in ulpi_set_vbus()
243 static void otg_ulpi_init(struct usb_phy *phy, struct usb_otg *otg, in otg_ulpi_init() argument
247 phy->label = "ULPI"; in otg_ulpi_init()
248 phy->flags = flags; in otg_ulpi_init()
249 phy->io_ops = ops; in otg_ulpi_init()
250 phy->otg = otg; in otg_ulpi_init()
251 phy->init = ulpi_init; in otg_ulpi_init()
253 otg->usb_phy = phy; in otg_ulpi_init()
262 struct usb_phy *phy; in otg_ulpi_create() local
265 phy = kzalloc(sizeof(*phy), GFP_KERNEL); in otg_ulpi_create()
266 if (!phy) in otg_ulpi_create()
271 kfree(phy); in otg_ulpi_create()
275 otg_ulpi_init(phy, otg, ops, flags); in otg_ulpi_create()
277 return phy; in otg_ulpi_create()
286 struct usb_phy *phy; in devm_otg_ulpi_create() local
289 phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); in devm_otg_ulpi_create()
290 if (!phy) in devm_otg_ulpi_create()
295 devm_kfree(dev, phy); in devm_otg_ulpi_create()
299 otg_ulpi_init(phy, otg, ops, flags); in devm_otg_ulpi_create()
301 return phy; in devm_otg_ulpi_create()