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