26 #include <linux/kernel.h>
27 #include <linux/slab.h>
28 #include <linux/export.h>
39 #define ULPI_ID(vendor, product) (((vendor) << 16) | (product))
40 #define ULPI_INFO(_id, _name) \
52 static int ulpi_set_otg_flags(
struct usb_phy *
phy)
76 static int ulpi_set_fc_flags(
struct usb_phy *phy)
78 unsigned int flags = 0;
118 static int ulpi_set_ic_flags(
struct usb_phy *phy)
120 unsigned int flags = 0;
137 static int ulpi_set_flags(
struct usb_phy *phy)
141 ret = ulpi_set_otg_flags(phy);
145 ret = ulpi_set_ic_flags(phy);
149 return ulpi_set_fc_flags(phy);
152 static int ulpi_check_integrity(
struct usb_phy *phy)
155 unsigned int val = 0x55;
157 for (i = 0; i < 2; i++) {
167 pr_err(
"ULPI integrity check: failed!");
173 pr_info(
"ULPI integrity check: passed.\n");
178 static int ulpi_init(
struct usb_phy *phy)
183 for (i = 0; i < 4; i++) {
187 ulpi_id = (ulpi_id << 8) | ret;
189 vid = ulpi_id & 0xffff;
192 pr_info(
"ULPI transceiver vendor/product ID 0x%04x/0x%04x\n", vid, pid);
195 if (ulpi_ids[i].
id ==
ULPI_ID(vid, pid)) {
196 pr_info(
"Found %s ULPI transceiver.\n",
202 ret = ulpi_check_integrity(phy);
206 return ulpi_set_flags(phy);
209 static int ulpi_set_host(
struct usb_otg *otg,
struct usb_bus *
host)
235 static int ulpi_set_vbus(
struct usb_otg *otg,
bool on)
274 phy->
init = ulpi_init;