ci->gadget.ep0 = &ci->ep0in->ep;
- ci->transceiver = usb_get_phy(USB_PHY_TYPE_USB2);
+ if (ci->global_phy)
+ ci->transceiver = usb_get_phy(USB_PHY_TYPE_USB2);
if (ci->platdata->flags & CI13XXX_REQUIRE_TRANSCEIVER) {
if (ci->transceiver == NULL) {
remove_trans:
if (!IS_ERR_OR_NULL(ci->transceiver)) {
otg_set_peripheral(ci->transceiver->otg, &ci->gadget);
- usb_put_phy(ci->transceiver);
+ if (ci->global_phy)
+ usb_put_phy(ci->transceiver);
}
dev_err(dev, "error = %i\n", retval);
unreg_device:
device_unregister(&ci->gadget.dev);
put_transceiver:
- if (!IS_ERR_OR_NULL(ci->transceiver))
+ if (!IS_ERR_OR_NULL(ci->transceiver) && ci->global_phy)
usb_put_phy(ci->transceiver);
free_pools:
dma_pool_destroy(ci->td_pool);
if (!IS_ERR_OR_NULL(ci->transceiver)) {
otg_set_peripheral(ci->transceiver->otg, NULL);
- usb_put_phy(ci->transceiver);
+ if (ci->global_phy)
+ usb_put_phy(ci->transceiver);
}
dbg_remove_files(&ci->gadget.dev);
device_unregister(&ci->gadget.dev);
#ifndef __LINUX_USB_CHIPIDEA_H
#define __LINUX_USB_CHIPIDEA_H
+#include <linux/usb/otg.h>
+
struct ci13xxx;
struct ci13xxx_platform_data {
const char *name;
/* offset of the capability registers */
uintptr_t capoffset;
unsigned power_budget;
+ struct usb_phy *phy;
unsigned long flags;
#define CI13XXX_REGS_SHARED BIT(0)
#define CI13XXX_REQUIRE_TRANSCEIVER BIT(1)