Lines Matching +full:ulpi +full:- +full:0
1 // SPDX-License-Identifier: GPL-2.0+
3 * Generic ULPI USB transceiver support
18 #include <linux/usb/ulpi.h>
33 /* ULPI hardcoded IDs, used for probing */
35 ULPI_INFO(ULPI_ID(0x04cc, 0x1504), "NXP ISP1504"),
36 ULPI_INFO(ULPI_ID(0x0424, 0x0006), "SMSC USB331x"),
37 ULPI_INFO(ULPI_ID(0x0424, 0x0007), "SMSC USB3320"),
38 ULPI_INFO(ULPI_ID(0x0424, 0x0009), "SMSC USB334x"),
39 ULPI_INFO(ULPI_ID(0x0451, 0x1507), "TI TUSB1210"),
47 if (phy->flags & ULPI_OTG_ID_PULLUP) in ulpi_set_otg_flags()
51 * ULPI Specification rev.1.1 default 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()
68 unsigned int flags = 0; in ulpi_set_fc_flags()
71 * ULPI Specification rev.1.1 default in ulpi_set_fc_flags()
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()
87 * ULPI Specification rev.1.1 default 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()
100 * ULPI Specification rev.1.1 default in ulpi_set_fc_flags()
110 unsigned int flags = 0; in ulpi_set_ic_flags()
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()
145 unsigned int val = 0x55; in ulpi_check_integrity()
147 for (i = 0; i < 2; i++) { in ulpi_check_integrity()
149 if (ret < 0) in ulpi_check_integrity()
153 if (ret < 0) in ulpi_check_integrity()
157 pr_err("ULPI integrity check: failed!"); in ulpi_check_integrity()
158 return -ENODEV; in ulpi_check_integrity()
163 pr_info("ULPI integrity check: passed.\n"); in ulpi_check_integrity()
165 return 0; in ulpi_check_integrity()
171 u32 ulpi_id = 0; in ulpi_init()
173 for (i = 0; i < 4; i++) { in ulpi_init()
174 ret = usb_phy_io_read(phy, ULPI_PRODUCT_ID_HIGH - i); in ulpi_init()
175 if (ret < 0) in ulpi_init()
179 vid = ulpi_id & 0xffff; in ulpi_init()
182 pr_info("ULPI transceiver vendor/product ID 0x%04x/0x%04x\n", vid, pid); in ulpi_init()
184 for (i = 0; i < ARRAY_SIZE(ulpi_ids); i++) { in ulpi_init()
186 pr_info("Found %s ULPI transceiver.\n", in ulpi_init()
201 struct usb_phy *phy = otg->usb_phy; in ulpi_set_host()
205 otg->host = NULL; in ulpi_set_host()
206 return 0; in ulpi_set_host()
209 otg->host = host; 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()
227 struct usb_phy *phy = otg->usb_phy; 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()
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()
254 otg->set_host = ulpi_set_host; in otg_ulpi_init()
255 otg->set_vbus = ulpi_set_vbus; in otg_ulpi_init()