usb: otg: isp1301_omap: Start using struct usb_otg
Use struct usb_otg members with OTG specific functions instead of usb_phy members. Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Reviewed-by: Marek Vasut <marek.vasut@gmail.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
This commit is contained in:
parent
16bc1bb2d8
commit
819d1c742b
|
@ -52,7 +52,7 @@ MODULE_DESCRIPTION("ISP1301 USB OTG Transceiver Driver");
|
||||||
MODULE_LICENSE("GPL");
|
MODULE_LICENSE("GPL");
|
||||||
|
|
||||||
struct isp1301 {
|
struct isp1301 {
|
||||||
struct usb_phy otg;
|
struct usb_phy phy;
|
||||||
struct i2c_client *client;
|
struct i2c_client *client;
|
||||||
void (*i2c_release)(struct device *dev);
|
void (*i2c_release)(struct device *dev);
|
||||||
|
|
||||||
|
@ -236,7 +236,7 @@ isp1301_clear_bits(struct isp1301 *isp, u8 reg, u8 bits)
|
||||||
|
|
||||||
static inline const char *state_name(struct isp1301 *isp)
|
static inline const char *state_name(struct isp1301 *isp)
|
||||||
{
|
{
|
||||||
return otg_state_string(isp->otg.state);
|
return otg_state_string(isp->phy.state);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
|
@ -251,7 +251,7 @@ static inline const char *state_name(struct isp1301 *isp)
|
||||||
|
|
||||||
static void power_down(struct isp1301 *isp)
|
static void power_down(struct isp1301 *isp)
|
||||||
{
|
{
|
||||||
isp->otg.state = OTG_STATE_UNDEFINED;
|
isp->phy.state = OTG_STATE_UNDEFINED;
|
||||||
|
|
||||||
// isp1301_set_bits(isp, ISP1301_MODE_CONTROL_2, MC2_GLOBAL_PWR_DN);
|
// isp1301_set_bits(isp, ISP1301_MODE_CONTROL_2, MC2_GLOBAL_PWR_DN);
|
||||||
isp1301_set_bits(isp, ISP1301_MODE_CONTROL_1, MC1_SUSPEND);
|
isp1301_set_bits(isp, ISP1301_MODE_CONTROL_1, MC1_SUSPEND);
|
||||||
|
@ -280,13 +280,13 @@ static int host_suspend(struct isp1301 *isp)
|
||||||
#else
|
#else
|
||||||
struct device *dev;
|
struct device *dev;
|
||||||
|
|
||||||
if (!isp->otg.host)
|
if (!isp->phy.otg->host)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
/* Currently ASSUMES only the OTG port matters;
|
/* Currently ASSUMES only the OTG port matters;
|
||||||
* other ports could be active...
|
* other ports could be active...
|
||||||
*/
|
*/
|
||||||
dev = isp->otg.host->controller;
|
dev = isp->phy.otg->host->controller;
|
||||||
return dev->driver->suspend(dev, 3, 0);
|
return dev->driver->suspend(dev, 3, 0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -298,20 +298,20 @@ static int host_resume(struct isp1301 *isp)
|
||||||
#else
|
#else
|
||||||
struct device *dev;
|
struct device *dev;
|
||||||
|
|
||||||
if (!isp->otg.host)
|
if (!isp->phy.otg->host)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
dev = isp->otg.host->controller;
|
dev = isp->phy.otg->host->controller;
|
||||||
return dev->driver->resume(dev, 0);
|
return dev->driver->resume(dev, 0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static int gadget_suspend(struct isp1301 *isp)
|
static int gadget_suspend(struct isp1301 *isp)
|
||||||
{
|
{
|
||||||
isp->otg.gadget->b_hnp_enable = 0;
|
isp->phy.otg->gadget->b_hnp_enable = 0;
|
||||||
isp->otg.gadget->a_hnp_support = 0;
|
isp->phy.otg->gadget->a_hnp_support = 0;
|
||||||
isp->otg.gadget->a_alt_hnp_support = 0;
|
isp->phy.otg->gadget->a_alt_hnp_support = 0;
|
||||||
return usb_gadget_vbus_disconnect(isp->otg.gadget);
|
return usb_gadget_vbus_disconnect(isp->phy.otg->gadget);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
|
@ -341,19 +341,19 @@ static void a_idle(struct isp1301 *isp, const char *tag)
|
||||||
{
|
{
|
||||||
u32 l;
|
u32 l;
|
||||||
|
|
||||||
if (isp->otg.state == OTG_STATE_A_IDLE)
|
if (isp->phy.state == OTG_STATE_A_IDLE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
isp->otg.default_a = 1;
|
isp->phy.otg->default_a = 1;
|
||||||
if (isp->otg.host) {
|
if (isp->phy.otg->host) {
|
||||||
isp->otg.host->is_b_host = 0;
|
isp->phy.otg->host->is_b_host = 0;
|
||||||
host_suspend(isp);
|
host_suspend(isp);
|
||||||
}
|
}
|
||||||
if (isp->otg.gadget) {
|
if (isp->phy.otg->gadget) {
|
||||||
isp->otg.gadget->is_a_peripheral = 1;
|
isp->phy.otg->gadget->is_a_peripheral = 1;
|
||||||
gadget_suspend(isp);
|
gadget_suspend(isp);
|
||||||
}
|
}
|
||||||
isp->otg.state = OTG_STATE_A_IDLE;
|
isp->phy.state = OTG_STATE_A_IDLE;
|
||||||
l = omap_readl(OTG_CTRL) & OTG_XCEIV_OUTPUTS;
|
l = omap_readl(OTG_CTRL) & OTG_XCEIV_OUTPUTS;
|
||||||
omap_writel(l, OTG_CTRL);
|
omap_writel(l, OTG_CTRL);
|
||||||
isp->last_otg_ctrl = l;
|
isp->last_otg_ctrl = l;
|
||||||
|
@ -365,19 +365,19 @@ static void b_idle(struct isp1301 *isp, const char *tag)
|
||||||
{
|
{
|
||||||
u32 l;
|
u32 l;
|
||||||
|
|
||||||
if (isp->otg.state == OTG_STATE_B_IDLE)
|
if (isp->phy.state == OTG_STATE_B_IDLE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
isp->otg.default_a = 0;
|
isp->phy.otg->default_a = 0;
|
||||||
if (isp->otg.host) {
|
if (isp->phy.otg->host) {
|
||||||
isp->otg.host->is_b_host = 1;
|
isp->phy.otg->host->is_b_host = 1;
|
||||||
host_suspend(isp);
|
host_suspend(isp);
|
||||||
}
|
}
|
||||||
if (isp->otg.gadget) {
|
if (isp->phy.otg->gadget) {
|
||||||
isp->otg.gadget->is_a_peripheral = 0;
|
isp->phy.otg->gadget->is_a_peripheral = 0;
|
||||||
gadget_suspend(isp);
|
gadget_suspend(isp);
|
||||||
}
|
}
|
||||||
isp->otg.state = OTG_STATE_B_IDLE;
|
isp->phy.state = OTG_STATE_B_IDLE;
|
||||||
l = omap_readl(OTG_CTRL) & OTG_XCEIV_OUTPUTS;
|
l = omap_readl(OTG_CTRL) & OTG_XCEIV_OUTPUTS;
|
||||||
omap_writel(l, OTG_CTRL);
|
omap_writel(l, OTG_CTRL);
|
||||||
isp->last_otg_ctrl = l;
|
isp->last_otg_ctrl = l;
|
||||||
|
@ -478,7 +478,7 @@ static void check_state(struct isp1301 *isp, const char *tag)
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (isp->otg.state == state && !extra)
|
if (isp->phy.state == state && !extra)
|
||||||
return;
|
return;
|
||||||
pr_debug("otg: %s FSM %s/%02x, %s, %06x\n", tag,
|
pr_debug("otg: %s FSM %s/%02x, %s, %06x\n", tag,
|
||||||
otg_state_string(state), fsm, state_name(isp),
|
otg_state_string(state), fsm, state_name(isp),
|
||||||
|
@ -502,22 +502,23 @@ static void update_otg1(struct isp1301 *isp, u8 int_src)
|
||||||
|
|
||||||
if (int_src & INTR_SESS_VLD)
|
if (int_src & INTR_SESS_VLD)
|
||||||
otg_ctrl |= OTG_ASESSVLD;
|
otg_ctrl |= OTG_ASESSVLD;
|
||||||
else if (isp->otg.state == OTG_STATE_A_WAIT_VFALL) {
|
else if (isp->phy.state == OTG_STATE_A_WAIT_VFALL) {
|
||||||
a_idle(isp, "vfall");
|
a_idle(isp, "vfall");
|
||||||
otg_ctrl &= ~OTG_CTRL_BITS;
|
otg_ctrl &= ~OTG_CTRL_BITS;
|
||||||
}
|
}
|
||||||
if (int_src & INTR_VBUS_VLD)
|
if (int_src & INTR_VBUS_VLD)
|
||||||
otg_ctrl |= OTG_VBUSVLD;
|
otg_ctrl |= OTG_VBUSVLD;
|
||||||
if (int_src & INTR_ID_GND) { /* default-A */
|
if (int_src & INTR_ID_GND) { /* default-A */
|
||||||
if (isp->otg.state == OTG_STATE_B_IDLE
|
if (isp->phy.state == OTG_STATE_B_IDLE
|
||||||
|| isp->otg.state == OTG_STATE_UNDEFINED) {
|
|| isp->phy.state
|
||||||
|
== OTG_STATE_UNDEFINED) {
|
||||||
a_idle(isp, "init");
|
a_idle(isp, "init");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else { /* default-B */
|
} else { /* default-B */
|
||||||
otg_ctrl |= OTG_ID;
|
otg_ctrl |= OTG_ID;
|
||||||
if (isp->otg.state == OTG_STATE_A_IDLE
|
if (isp->phy.state == OTG_STATE_A_IDLE
|
||||||
|| isp->otg.state == OTG_STATE_UNDEFINED) {
|
|| isp->phy.state == OTG_STATE_UNDEFINED) {
|
||||||
b_idle(isp, "init");
|
b_idle(isp, "init");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -551,14 +552,14 @@ static void otg_update_isp(struct isp1301 *isp)
|
||||||
isp->last_otg_ctrl = otg_ctrl;
|
isp->last_otg_ctrl = otg_ctrl;
|
||||||
otg_ctrl = otg_ctrl & OTG_XCEIV_INPUTS;
|
otg_ctrl = otg_ctrl & OTG_XCEIV_INPUTS;
|
||||||
|
|
||||||
switch (isp->otg.state) {
|
switch (isp->phy.state) {
|
||||||
case OTG_STATE_B_IDLE:
|
case OTG_STATE_B_IDLE:
|
||||||
case OTG_STATE_B_PERIPHERAL:
|
case OTG_STATE_B_PERIPHERAL:
|
||||||
case OTG_STATE_B_SRP_INIT:
|
case OTG_STATE_B_SRP_INIT:
|
||||||
if (!(otg_ctrl & OTG_PULLUP)) {
|
if (!(otg_ctrl & OTG_PULLUP)) {
|
||||||
// if (otg_ctrl & OTG_B_HNPEN) {
|
// if (otg_ctrl & OTG_B_HNPEN) {
|
||||||
if (isp->otg.gadget->b_hnp_enable) {
|
if (isp->phy.otg->gadget->b_hnp_enable) {
|
||||||
isp->otg.state = OTG_STATE_B_WAIT_ACON;
|
isp->phy.state = OTG_STATE_B_WAIT_ACON;
|
||||||
pr_debug(" --> b_wait_acon\n");
|
pr_debug(" --> b_wait_acon\n");
|
||||||
}
|
}
|
||||||
goto pulldown;
|
goto pulldown;
|
||||||
|
@ -585,10 +586,10 @@ pulldown:
|
||||||
else clr |= ISP; \
|
else clr |= ISP; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
if (!(isp->otg.host))
|
if (!(isp->phy.otg->host))
|
||||||
otg_ctrl &= ~OTG_DRV_VBUS;
|
otg_ctrl &= ~OTG_DRV_VBUS;
|
||||||
|
|
||||||
switch (isp->otg.state) {
|
switch (isp->phy.state) {
|
||||||
case OTG_STATE_A_SUSPEND:
|
case OTG_STATE_A_SUSPEND:
|
||||||
if (otg_ctrl & OTG_DRV_VBUS) {
|
if (otg_ctrl & OTG_DRV_VBUS) {
|
||||||
set |= OTG1_VBUS_DRV;
|
set |= OTG1_VBUS_DRV;
|
||||||
|
@ -599,7 +600,7 @@ pulldown:
|
||||||
|
|
||||||
/* FALLTHROUGH */
|
/* FALLTHROUGH */
|
||||||
case OTG_STATE_A_VBUS_ERR:
|
case OTG_STATE_A_VBUS_ERR:
|
||||||
isp->otg.state = OTG_STATE_A_WAIT_VFALL;
|
isp->phy.state = OTG_STATE_A_WAIT_VFALL;
|
||||||
pr_debug(" --> a_wait_vfall\n");
|
pr_debug(" --> a_wait_vfall\n");
|
||||||
/* FALLTHROUGH */
|
/* FALLTHROUGH */
|
||||||
case OTG_STATE_A_WAIT_VFALL:
|
case OTG_STATE_A_WAIT_VFALL:
|
||||||
|
@ -608,7 +609,7 @@ pulldown:
|
||||||
break;
|
break;
|
||||||
case OTG_STATE_A_IDLE:
|
case OTG_STATE_A_IDLE:
|
||||||
if (otg_ctrl & OTG_DRV_VBUS) {
|
if (otg_ctrl & OTG_DRV_VBUS) {
|
||||||
isp->otg.state = OTG_STATE_A_WAIT_VRISE;
|
isp->phy.state = OTG_STATE_A_WAIT_VRISE;
|
||||||
pr_debug(" --> a_wait_vrise\n");
|
pr_debug(" --> a_wait_vrise\n");
|
||||||
}
|
}
|
||||||
/* FALLTHROUGH */
|
/* FALLTHROUGH */
|
||||||
|
@ -628,17 +629,17 @@ pulldown:
|
||||||
if (otg_change & OTG_PULLUP) {
|
if (otg_change & OTG_PULLUP) {
|
||||||
u32 l;
|
u32 l;
|
||||||
|
|
||||||
switch (isp->otg.state) {
|
switch (isp->phy.state) {
|
||||||
case OTG_STATE_B_IDLE:
|
case OTG_STATE_B_IDLE:
|
||||||
if (clr & OTG1_DP_PULLUP)
|
if (clr & OTG1_DP_PULLUP)
|
||||||
break;
|
break;
|
||||||
isp->otg.state = OTG_STATE_B_PERIPHERAL;
|
isp->phy.state = OTG_STATE_B_PERIPHERAL;
|
||||||
pr_debug(" --> b_peripheral\n");
|
pr_debug(" --> b_peripheral\n");
|
||||||
break;
|
break;
|
||||||
case OTG_STATE_A_SUSPEND:
|
case OTG_STATE_A_SUSPEND:
|
||||||
if (clr & OTG1_DP_PULLUP)
|
if (clr & OTG1_DP_PULLUP)
|
||||||
break;
|
break;
|
||||||
isp->otg.state = OTG_STATE_A_PERIPHERAL;
|
isp->phy.state = OTG_STATE_A_PERIPHERAL;
|
||||||
pr_debug(" --> a_peripheral\n");
|
pr_debug(" --> a_peripheral\n");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -659,6 +660,7 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp)
|
||||||
u32 otg_ctrl;
|
u32 otg_ctrl;
|
||||||
int ret = IRQ_NONE;
|
int ret = IRQ_NONE;
|
||||||
struct isp1301 *isp = _isp;
|
struct isp1301 *isp = _isp;
|
||||||
|
struct usb_otg *otg = isp->phy.otg;
|
||||||
|
|
||||||
/* update ISP1301 transceiver from OTG controller */
|
/* update ISP1301 transceiver from OTG controller */
|
||||||
if (otg_irq & OPRT_CHG) {
|
if (otg_irq & OPRT_CHG) {
|
||||||
|
@ -675,7 +677,7 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp)
|
||||||
* remote wakeup (SRP, normal) using their own timer
|
* remote wakeup (SRP, normal) using their own timer
|
||||||
* to give "check cable and A-device" messages.
|
* to give "check cable and A-device" messages.
|
||||||
*/
|
*/
|
||||||
if (isp->otg.state == OTG_STATE_B_SRP_INIT)
|
if (isp->phy.state == OTG_STATE_B_SRP_INIT)
|
||||||
b_idle(isp, "srp_timeout");
|
b_idle(isp, "srp_timeout");
|
||||||
|
|
||||||
omap_writew(B_SRP_TMROUT, OTG_IRQ_SRC);
|
omap_writew(B_SRP_TMROUT, OTG_IRQ_SRC);
|
||||||
|
@ -693,7 +695,7 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp)
|
||||||
omap_writel(otg_ctrl, OTG_CTRL);
|
omap_writel(otg_ctrl, OTG_CTRL);
|
||||||
|
|
||||||
/* subset of b_peripheral()... */
|
/* subset of b_peripheral()... */
|
||||||
isp->otg.state = OTG_STATE_B_PERIPHERAL;
|
isp->phy.state = OTG_STATE_B_PERIPHERAL;
|
||||||
pr_debug(" --> b_peripheral\n");
|
pr_debug(" --> b_peripheral\n");
|
||||||
|
|
||||||
omap_writew(B_HNP_FAIL, OTG_IRQ_SRC);
|
omap_writew(B_HNP_FAIL, OTG_IRQ_SRC);
|
||||||
|
@ -705,9 +707,9 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp)
|
||||||
state_name(isp), omap_readl(OTG_CTRL));
|
state_name(isp), omap_readl(OTG_CTRL));
|
||||||
|
|
||||||
isp1301_defer_work(isp, WORK_UPDATE_OTG);
|
isp1301_defer_work(isp, WORK_UPDATE_OTG);
|
||||||
switch (isp->otg.state) {
|
switch (isp->phy.state) {
|
||||||
case OTG_STATE_A_IDLE:
|
case OTG_STATE_A_IDLE:
|
||||||
if (!isp->otg.host)
|
if (!otg->host)
|
||||||
break;
|
break;
|
||||||
isp1301_defer_work(isp, WORK_HOST_RESUME);
|
isp1301_defer_work(isp, WORK_HOST_RESUME);
|
||||||
otg_ctrl = omap_readl(OTG_CTRL);
|
otg_ctrl = omap_readl(OTG_CTRL);
|
||||||
|
@ -736,7 +738,7 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp)
|
||||||
otg_ctrl |= OTG_BUSDROP;
|
otg_ctrl |= OTG_BUSDROP;
|
||||||
otg_ctrl &= ~OTG_A_BUSREQ & OTG_CTRL_MASK & ~OTG_XCEIV_INPUTS;
|
otg_ctrl &= ~OTG_A_BUSREQ & OTG_CTRL_MASK & ~OTG_XCEIV_INPUTS;
|
||||||
omap_writel(otg_ctrl, OTG_CTRL);
|
omap_writel(otg_ctrl, OTG_CTRL);
|
||||||
isp->otg.state = OTG_STATE_A_WAIT_VFALL;
|
isp->phy.state = OTG_STATE_A_WAIT_VFALL;
|
||||||
|
|
||||||
omap_writew(A_REQ_TMROUT, OTG_IRQ_SRC);
|
omap_writew(A_REQ_TMROUT, OTG_IRQ_SRC);
|
||||||
ret = IRQ_HANDLED;
|
ret = IRQ_HANDLED;
|
||||||
|
@ -750,7 +752,7 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp)
|
||||||
otg_ctrl |= OTG_BUSDROP;
|
otg_ctrl |= OTG_BUSDROP;
|
||||||
otg_ctrl &= ~OTG_A_BUSREQ & OTG_CTRL_MASK & ~OTG_XCEIV_INPUTS;
|
otg_ctrl &= ~OTG_A_BUSREQ & OTG_CTRL_MASK & ~OTG_XCEIV_INPUTS;
|
||||||
omap_writel(otg_ctrl, OTG_CTRL);
|
omap_writel(otg_ctrl, OTG_CTRL);
|
||||||
isp->otg.state = OTG_STATE_A_VBUS_ERR;
|
isp->phy.state = OTG_STATE_A_VBUS_ERR;
|
||||||
|
|
||||||
omap_writew(A_VBUS_ERR, OTG_IRQ_SRC);
|
omap_writew(A_VBUS_ERR, OTG_IRQ_SRC);
|
||||||
ret = IRQ_HANDLED;
|
ret = IRQ_HANDLED;
|
||||||
|
@ -771,7 +773,7 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp)
|
||||||
|
|
||||||
/* role is peripheral */
|
/* role is peripheral */
|
||||||
if (otg_ctrl & OTG_DRIVER_SEL) {
|
if (otg_ctrl & OTG_DRIVER_SEL) {
|
||||||
switch (isp->otg.state) {
|
switch (isp->phy.state) {
|
||||||
case OTG_STATE_A_IDLE:
|
case OTG_STATE_A_IDLE:
|
||||||
b_idle(isp, __func__);
|
b_idle(isp, __func__);
|
||||||
break;
|
break;
|
||||||
|
@ -787,19 +789,19 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp)
|
||||||
omap_writel(otg_ctrl | OTG_A_BUSREQ, OTG_CTRL);
|
omap_writel(otg_ctrl | OTG_A_BUSREQ, OTG_CTRL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isp->otg.host) {
|
if (otg->host) {
|
||||||
switch (isp->otg.state) {
|
switch (isp->phy.state) {
|
||||||
case OTG_STATE_B_WAIT_ACON:
|
case OTG_STATE_B_WAIT_ACON:
|
||||||
isp->otg.state = OTG_STATE_B_HOST;
|
isp->phy.state = OTG_STATE_B_HOST;
|
||||||
pr_debug(" --> b_host\n");
|
pr_debug(" --> b_host\n");
|
||||||
kick = 1;
|
kick = 1;
|
||||||
break;
|
break;
|
||||||
case OTG_STATE_A_WAIT_BCON:
|
case OTG_STATE_A_WAIT_BCON:
|
||||||
isp->otg.state = OTG_STATE_A_HOST;
|
isp->phy.state = OTG_STATE_A_HOST;
|
||||||
pr_debug(" --> a_host\n");
|
pr_debug(" --> a_host\n");
|
||||||
break;
|
break;
|
||||||
case OTG_STATE_A_PERIPHERAL:
|
case OTG_STATE_A_PERIPHERAL:
|
||||||
isp->otg.state = OTG_STATE_A_WAIT_BCON;
|
isp->phy.state = OTG_STATE_A_WAIT_BCON;
|
||||||
pr_debug(" --> a_wait_bcon\n");
|
pr_debug(" --> a_wait_bcon\n");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -813,8 +815,7 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp)
|
||||||
ret = IRQ_HANDLED;
|
ret = IRQ_HANDLED;
|
||||||
|
|
||||||
if (kick)
|
if (kick)
|
||||||
usb_bus_start_enum(isp->otg.host,
|
usb_bus_start_enum(otg->host, otg->host->otg_port);
|
||||||
isp->otg.host->otg_port);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
check_state(isp, __func__);
|
check_state(isp, __func__);
|
||||||
|
@ -930,7 +931,7 @@ static void b_peripheral(struct isp1301 *isp)
|
||||||
l = omap_readl(OTG_CTRL) & OTG_XCEIV_OUTPUTS;
|
l = omap_readl(OTG_CTRL) & OTG_XCEIV_OUTPUTS;
|
||||||
omap_writel(l, OTG_CTRL);
|
omap_writel(l, OTG_CTRL);
|
||||||
|
|
||||||
usb_gadget_vbus_connect(isp->otg.gadget);
|
usb_gadget_vbus_connect(isp->phy.otg->gadget);
|
||||||
|
|
||||||
#ifdef CONFIG_USB_OTG
|
#ifdef CONFIG_USB_OTG
|
||||||
enable_vbus_draw(isp, 8);
|
enable_vbus_draw(isp, 8);
|
||||||
|
@ -940,7 +941,7 @@ static void b_peripheral(struct isp1301 *isp)
|
||||||
/* UDC driver just set OTG_BSESSVLD */
|
/* UDC driver just set OTG_BSESSVLD */
|
||||||
isp1301_set_bits(isp, ISP1301_OTG_CONTROL_1, OTG1_DP_PULLUP);
|
isp1301_set_bits(isp, ISP1301_OTG_CONTROL_1, OTG1_DP_PULLUP);
|
||||||
isp1301_clear_bits(isp, ISP1301_OTG_CONTROL_1, OTG1_DP_PULLDOWN);
|
isp1301_clear_bits(isp, ISP1301_OTG_CONTROL_1, OTG1_DP_PULLDOWN);
|
||||||
isp->otg.state = OTG_STATE_B_PERIPHERAL;
|
isp->phy.state = OTG_STATE_B_PERIPHERAL;
|
||||||
pr_debug(" --> b_peripheral\n");
|
pr_debug(" --> b_peripheral\n");
|
||||||
dump_regs(isp, "2periph");
|
dump_regs(isp, "2periph");
|
||||||
#endif
|
#endif
|
||||||
|
@ -948,8 +949,9 @@ static void b_peripheral(struct isp1301 *isp)
|
||||||
|
|
||||||
static void isp_update_otg(struct isp1301 *isp, u8 stat)
|
static void isp_update_otg(struct isp1301 *isp, u8 stat)
|
||||||
{
|
{
|
||||||
|
struct usb_otg *otg = isp->phy.otg;
|
||||||
u8 isp_stat, isp_bstat;
|
u8 isp_stat, isp_bstat;
|
||||||
enum usb_otg_state state = isp->otg.state;
|
enum usb_otg_state state = isp->phy.state;
|
||||||
|
|
||||||
if (stat & INTR_BDIS_ACON)
|
if (stat & INTR_BDIS_ACON)
|
||||||
pr_debug("OTG: BDIS_ACON, %s\n", state_name(isp));
|
pr_debug("OTG: BDIS_ACON, %s\n", state_name(isp));
|
||||||
|
@ -957,7 +959,7 @@ static void isp_update_otg(struct isp1301 *isp, u8 stat)
|
||||||
/* start certain state transitions right away */
|
/* start certain state transitions right away */
|
||||||
isp_stat = isp1301_get_u8(isp, ISP1301_INTERRUPT_SOURCE);
|
isp_stat = isp1301_get_u8(isp, ISP1301_INTERRUPT_SOURCE);
|
||||||
if (isp_stat & INTR_ID_GND) {
|
if (isp_stat & INTR_ID_GND) {
|
||||||
if (isp->otg.default_a) {
|
if (otg->default_a) {
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case OTG_STATE_B_IDLE:
|
case OTG_STATE_B_IDLE:
|
||||||
a_idle(isp, "idle");
|
a_idle(isp, "idle");
|
||||||
|
@ -972,7 +974,7 @@ static void isp_update_otg(struct isp1301 *isp, u8 stat)
|
||||||
* when HNP is used.
|
* when HNP is used.
|
||||||
*/
|
*/
|
||||||
if (isp_stat & INTR_VBUS_VLD)
|
if (isp_stat & INTR_VBUS_VLD)
|
||||||
isp->otg.state = OTG_STATE_A_HOST;
|
isp->phy.state = OTG_STATE_A_HOST;
|
||||||
break;
|
break;
|
||||||
case OTG_STATE_A_WAIT_VFALL:
|
case OTG_STATE_A_WAIT_VFALL:
|
||||||
if (!(isp_stat & INTR_SESS_VLD))
|
if (!(isp_stat & INTR_SESS_VLD))
|
||||||
|
@ -980,7 +982,7 @@ static void isp_update_otg(struct isp1301 *isp, u8 stat)
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (!(isp_stat & INTR_VBUS_VLD))
|
if (!(isp_stat & INTR_VBUS_VLD))
|
||||||
isp->otg.state = OTG_STATE_A_VBUS_ERR;
|
isp->phy.state = OTG_STATE_A_VBUS_ERR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
isp_bstat = isp1301_get_u8(isp, ISP1301_OTG_STATUS);
|
isp_bstat = isp1301_get_u8(isp, ISP1301_OTG_STATUS);
|
||||||
|
@ -989,14 +991,14 @@ static void isp_update_otg(struct isp1301 *isp, u8 stat)
|
||||||
case OTG_STATE_B_PERIPHERAL:
|
case OTG_STATE_B_PERIPHERAL:
|
||||||
case OTG_STATE_B_HOST:
|
case OTG_STATE_B_HOST:
|
||||||
case OTG_STATE_B_WAIT_ACON:
|
case OTG_STATE_B_WAIT_ACON:
|
||||||
usb_gadget_vbus_disconnect(isp->otg.gadget);
|
usb_gadget_vbus_disconnect(otg->gadget);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (state != OTG_STATE_A_IDLE)
|
if (state != OTG_STATE_A_IDLE)
|
||||||
a_idle(isp, "id");
|
a_idle(isp, "id");
|
||||||
if (isp->otg.host && state == OTG_STATE_A_IDLE)
|
if (otg->host && state == OTG_STATE_A_IDLE)
|
||||||
isp1301_defer_work(isp, WORK_HOST_RESUME);
|
isp1301_defer_work(isp, WORK_HOST_RESUME);
|
||||||
isp_bstat = 0;
|
isp_bstat = 0;
|
||||||
}
|
}
|
||||||
|
@ -1006,10 +1008,10 @@ static void isp_update_otg(struct isp1301 *isp, u8 stat)
|
||||||
/* if user unplugged mini-A end of cable,
|
/* if user unplugged mini-A end of cable,
|
||||||
* don't bypass A_WAIT_VFALL.
|
* don't bypass A_WAIT_VFALL.
|
||||||
*/
|
*/
|
||||||
if (isp->otg.default_a) {
|
if (otg->default_a) {
|
||||||
switch (state) {
|
switch (state) {
|
||||||
default:
|
default:
|
||||||
isp->otg.state = OTG_STATE_A_WAIT_VFALL;
|
isp->phy.state = OTG_STATE_A_WAIT_VFALL;
|
||||||
break;
|
break;
|
||||||
case OTG_STATE_A_WAIT_VFALL:
|
case OTG_STATE_A_WAIT_VFALL:
|
||||||
state = OTG_STATE_A_IDLE;
|
state = OTG_STATE_A_IDLE;
|
||||||
|
@ -1022,7 +1024,7 @@ static void isp_update_otg(struct isp1301 *isp, u8 stat)
|
||||||
host_suspend(isp);
|
host_suspend(isp);
|
||||||
isp1301_clear_bits(isp, ISP1301_MODE_CONTROL_1,
|
isp1301_clear_bits(isp, ISP1301_MODE_CONTROL_1,
|
||||||
MC1_BDIS_ACON_EN);
|
MC1_BDIS_ACON_EN);
|
||||||
isp->otg.state = OTG_STATE_B_IDLE;
|
isp->phy.state = OTG_STATE_B_IDLE;
|
||||||
l = omap_readl(OTG_CTRL) & OTG_CTRL_MASK;
|
l = omap_readl(OTG_CTRL) & OTG_CTRL_MASK;
|
||||||
l &= ~OTG_CTRL_BITS;
|
l &= ~OTG_CTRL_BITS;
|
||||||
omap_writel(l, OTG_CTRL);
|
omap_writel(l, OTG_CTRL);
|
||||||
|
@ -1033,7 +1035,7 @@ static void isp_update_otg(struct isp1301 *isp, u8 stat)
|
||||||
}
|
}
|
||||||
isp_bstat = isp1301_get_u8(isp, ISP1301_OTG_STATUS);
|
isp_bstat = isp1301_get_u8(isp, ISP1301_OTG_STATUS);
|
||||||
|
|
||||||
switch (isp->otg.state) {
|
switch (isp->phy.state) {
|
||||||
case OTG_STATE_B_PERIPHERAL:
|
case OTG_STATE_B_PERIPHERAL:
|
||||||
case OTG_STATE_B_WAIT_ACON:
|
case OTG_STATE_B_WAIT_ACON:
|
||||||
case OTG_STATE_B_HOST:
|
case OTG_STATE_B_HOST:
|
||||||
|
@ -1055,7 +1057,7 @@ static void isp_update_otg(struct isp1301 *isp, u8 stat)
|
||||||
omap_writel(l, OTG_CTRL);
|
omap_writel(l, OTG_CTRL);
|
||||||
/* FALLTHROUGH */
|
/* FALLTHROUGH */
|
||||||
case OTG_STATE_B_IDLE:
|
case OTG_STATE_B_IDLE:
|
||||||
if (isp->otg.gadget && (isp_bstat & OTG_B_SESS_VLD)) {
|
if (otg->gadget && (isp_bstat & OTG_B_SESS_VLD)) {
|
||||||
#ifdef CONFIG_USB_OTG
|
#ifdef CONFIG_USB_OTG
|
||||||
update_otg1(isp, isp_stat);
|
update_otg1(isp, isp_stat);
|
||||||
update_otg2(isp, isp_bstat);
|
update_otg2(isp, isp_bstat);
|
||||||
|
@ -1073,7 +1075,7 @@ static void isp_update_otg(struct isp1301 *isp, u8 stat)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state != isp->otg.state)
|
if (state != isp->phy.state)
|
||||||
pr_debug(" isp, %s -> %s\n",
|
pr_debug(" isp, %s -> %s\n",
|
||||||
otg_state_string(state), state_name(isp));
|
otg_state_string(state), state_name(isp));
|
||||||
|
|
||||||
|
@ -1131,10 +1133,10 @@ isp1301_work(struct work_struct *work)
|
||||||
* skip A_WAIT_VRISE; hc transitions invisibly
|
* skip A_WAIT_VRISE; hc transitions invisibly
|
||||||
* skip A_WAIT_BCON; same.
|
* skip A_WAIT_BCON; same.
|
||||||
*/
|
*/
|
||||||
switch (isp->otg.state) {
|
switch (isp->phy.state) {
|
||||||
case OTG_STATE_A_WAIT_BCON:
|
case OTG_STATE_A_WAIT_BCON:
|
||||||
case OTG_STATE_A_WAIT_VRISE:
|
case OTG_STATE_A_WAIT_VRISE:
|
||||||
isp->otg.state = OTG_STATE_A_HOST;
|
isp->phy.state = OTG_STATE_A_HOST;
|
||||||
pr_debug(" --> a_host\n");
|
pr_debug(" --> a_host\n");
|
||||||
otg_ctrl = omap_readl(OTG_CTRL);
|
otg_ctrl = omap_readl(OTG_CTRL);
|
||||||
otg_ctrl |= OTG_A_BUSREQ;
|
otg_ctrl |= OTG_A_BUSREQ;
|
||||||
|
@ -1143,7 +1145,7 @@ isp1301_work(struct work_struct *work)
|
||||||
omap_writel(otg_ctrl, OTG_CTRL);
|
omap_writel(otg_ctrl, OTG_CTRL);
|
||||||
break;
|
break;
|
||||||
case OTG_STATE_B_WAIT_ACON:
|
case OTG_STATE_B_WAIT_ACON:
|
||||||
isp->otg.state = OTG_STATE_B_HOST;
|
isp->phy.state = OTG_STATE_B_HOST;
|
||||||
pr_debug(" --> b_host (acon)\n");
|
pr_debug(" --> b_host (acon)\n");
|
||||||
break;
|
break;
|
||||||
case OTG_STATE_B_HOST:
|
case OTG_STATE_B_HOST:
|
||||||
|
@ -1204,6 +1206,7 @@ static void isp1301_release(struct device *dev)
|
||||||
/* ugly -- i2c hijacks our memory hook to wait_for_completion() */
|
/* ugly -- i2c hijacks our memory hook to wait_for_completion() */
|
||||||
if (isp->i2c_release)
|
if (isp->i2c_release)
|
||||||
isp->i2c_release(dev);
|
isp->i2c_release(dev);
|
||||||
|
kfree(isp->phy.otg);
|
||||||
kfree (isp);
|
kfree (isp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1274,9 +1277,9 @@ static int isp1301_otg_enable(struct isp1301 *isp)
|
||||||
|
|
||||||
/* add or disable the host device+driver */
|
/* add or disable the host device+driver */
|
||||||
static int
|
static int
|
||||||
isp1301_set_host(struct usb_phy *otg, struct usb_bus *host)
|
isp1301_set_host(struct usb_otg *otg, struct usb_bus *host)
|
||||||
{
|
{
|
||||||
struct isp1301 *isp = container_of(otg, struct isp1301, otg);
|
struct isp1301 *isp = container_of(otg->phy, struct isp1301, phy);
|
||||||
|
|
||||||
if (!otg || isp != the_transceiver)
|
if (!otg || isp != the_transceiver)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
@ -1284,21 +1287,21 @@ isp1301_set_host(struct usb_phy *otg, struct usb_bus *host)
|
||||||
if (!host) {
|
if (!host) {
|
||||||
omap_writew(0, OTG_IRQ_EN);
|
omap_writew(0, OTG_IRQ_EN);
|
||||||
power_down(isp);
|
power_down(isp);
|
||||||
isp->otg.host = NULL;
|
otg->host = NULL;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_USB_OTG
|
#ifdef CONFIG_USB_OTG
|
||||||
isp->otg.host = host;
|
otg->host = host;
|
||||||
dev_dbg(&isp->client->dev, "registered host\n");
|
dev_dbg(&isp->client->dev, "registered host\n");
|
||||||
host_suspend(isp);
|
host_suspend(isp);
|
||||||
if (isp->otg.gadget)
|
if (otg->gadget)
|
||||||
return isp1301_otg_enable(isp);
|
return isp1301_otg_enable(isp);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
#elif !defined(CONFIG_USB_GADGET_OMAP)
|
#elif !defined(CONFIG_USB_GADGET_OMAP)
|
||||||
// FIXME update its refcount
|
// FIXME update its refcount
|
||||||
isp->otg.host = host;
|
otg->host = host;
|
||||||
|
|
||||||
power_up(isp);
|
power_up(isp);
|
||||||
|
|
||||||
|
@ -1330,9 +1333,9 @@ isp1301_set_host(struct usb_phy *otg, struct usb_bus *host)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
isp1301_set_peripheral(struct usb_phy *otg, struct usb_gadget *gadget)
|
isp1301_set_peripheral(struct usb_otg *otg, struct usb_gadget *gadget)
|
||||||
{
|
{
|
||||||
struct isp1301 *isp = container_of(otg, struct isp1301, otg);
|
struct isp1301 *isp = container_of(otg->phy, struct isp1301, phy);
|
||||||
#ifndef CONFIG_USB_OTG
|
#ifndef CONFIG_USB_OTG
|
||||||
u32 l;
|
u32 l;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1342,24 +1345,24 @@ isp1301_set_peripheral(struct usb_phy *otg, struct usb_gadget *gadget)
|
||||||
|
|
||||||
if (!gadget) {
|
if (!gadget) {
|
||||||
omap_writew(0, OTG_IRQ_EN);
|
omap_writew(0, OTG_IRQ_EN);
|
||||||
if (!isp->otg.default_a)
|
if (!otg->default_a)
|
||||||
enable_vbus_draw(isp, 0);
|
enable_vbus_draw(isp, 0);
|
||||||
usb_gadget_vbus_disconnect(isp->otg.gadget);
|
usb_gadget_vbus_disconnect(otg->gadget);
|
||||||
isp->otg.gadget = NULL;
|
otg->gadget = NULL;
|
||||||
power_down(isp);
|
power_down(isp);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_USB_OTG
|
#ifdef CONFIG_USB_OTG
|
||||||
isp->otg.gadget = gadget;
|
otg->gadget = gadget;
|
||||||
dev_dbg(&isp->client->dev, "registered gadget\n");
|
dev_dbg(&isp->client->dev, "registered gadget\n");
|
||||||
/* gadget driver may be suspended until vbus_connect () */
|
/* gadget driver may be suspended until vbus_connect () */
|
||||||
if (isp->otg.host)
|
if (otg->host)
|
||||||
return isp1301_otg_enable(isp);
|
return isp1301_otg_enable(isp);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
#elif !defined(CONFIG_USB_OHCI_HCD) && !defined(CONFIG_USB_OHCI_HCD_MODULE)
|
#elif !defined(CONFIG_USB_OHCI_HCD) && !defined(CONFIG_USB_OHCI_HCD_MODULE)
|
||||||
isp->otg.gadget = gadget;
|
otg->gadget = gadget;
|
||||||
// FIXME update its refcount
|
// FIXME update its refcount
|
||||||
|
|
||||||
l = omap_readl(OTG_CTRL) & OTG_CTRL_MASK;
|
l = omap_readl(OTG_CTRL) & OTG_CTRL_MASK;
|
||||||
|
@ -1368,7 +1371,7 @@ isp1301_set_peripheral(struct usb_phy *otg, struct usb_gadget *gadget)
|
||||||
omap_writel(l, OTG_CTRL);
|
omap_writel(l, OTG_CTRL);
|
||||||
|
|
||||||
power_up(isp);
|
power_up(isp);
|
||||||
isp->otg.state = OTG_STATE_B_IDLE;
|
isp->phy.state = OTG_STATE_B_IDLE;
|
||||||
|
|
||||||
if (machine_is_omap_h2() || machine_is_omap_h3())
|
if (machine_is_omap_h2() || machine_is_omap_h3())
|
||||||
isp1301_set_bits(isp, ISP1301_MODE_CONTROL_1, MC1_DAT_SE0);
|
isp1301_set_bits(isp, ISP1301_MODE_CONTROL_1, MC1_DAT_SE0);
|
||||||
|
@ -1409,13 +1412,13 @@ isp1301_set_power(struct usb_phy *dev, unsigned mA)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
isp1301_start_srp(struct usb_phy *dev)
|
isp1301_start_srp(struct usb_otg *otg)
|
||||||
{
|
{
|
||||||
struct isp1301 *isp = container_of(dev, struct isp1301, otg);
|
struct isp1301 *isp = container_of(otg->phy, struct isp1301, phy);
|
||||||
u32 otg_ctrl;
|
u32 otg_ctrl;
|
||||||
|
|
||||||
if (!dev || isp != the_transceiver
|
if (!otg || isp != the_transceiver
|
||||||
|| isp->otg.state != OTG_STATE_B_IDLE)
|
|| isp->phy.state != OTG_STATE_B_IDLE)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
otg_ctrl = omap_readl(OTG_CTRL);
|
otg_ctrl = omap_readl(OTG_CTRL);
|
||||||
|
@ -1425,7 +1428,7 @@ isp1301_start_srp(struct usb_phy *dev)
|
||||||
otg_ctrl |= OTG_B_BUSREQ;
|
otg_ctrl |= OTG_B_BUSREQ;
|
||||||
otg_ctrl &= ~OTG_A_BUSREQ & OTG_CTRL_MASK;
|
otg_ctrl &= ~OTG_A_BUSREQ & OTG_CTRL_MASK;
|
||||||
omap_writel(otg_ctrl, OTG_CTRL);
|
omap_writel(otg_ctrl, OTG_CTRL);
|
||||||
isp->otg.state = OTG_STATE_B_SRP_INIT;
|
isp->phy.state = OTG_STATE_B_SRP_INIT;
|
||||||
|
|
||||||
pr_debug("otg: SRP, %s ... %06x\n", state_name(isp),
|
pr_debug("otg: SRP, %s ... %06x\n", state_name(isp),
|
||||||
omap_readl(OTG_CTRL));
|
omap_readl(OTG_CTRL));
|
||||||
|
@ -1436,27 +1439,26 @@ isp1301_start_srp(struct usb_phy *dev)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
isp1301_start_hnp(struct usb_phy *dev)
|
isp1301_start_hnp(struct usb_otg *otg)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_USB_OTG
|
#ifdef CONFIG_USB_OTG
|
||||||
struct isp1301 *isp = container_of(dev, struct isp1301, otg);
|
struct isp1301 *isp = container_of(otg->phy, struct isp1301, phy);
|
||||||
u32 l;
|
u32 l;
|
||||||
|
|
||||||
if (!dev || isp != the_transceiver)
|
if (!otg || isp != the_transceiver)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
if (isp->otg.default_a && (isp->otg.host == NULL
|
if (otg->default_a && (otg->host == NULL || !otg->host->b_hnp_enable))
|
||||||
|| !isp->otg.host->b_hnp_enable))
|
|
||||||
return -ENOTCONN;
|
return -ENOTCONN;
|
||||||
if (!isp->otg.default_a && (isp->otg.gadget == NULL
|
if (!otg->default_a && (otg->gadget == NULL
|
||||||
|| !isp->otg.gadget->b_hnp_enable))
|
|| !otg->gadget->b_hnp_enable))
|
||||||
return -ENOTCONN;
|
return -ENOTCONN;
|
||||||
|
|
||||||
/* We want hardware to manage most HNP protocol timings.
|
/* We want hardware to manage most HNP protocol timings.
|
||||||
* So do this part as early as possible...
|
* So do this part as early as possible...
|
||||||
*/
|
*/
|
||||||
switch (isp->otg.state) {
|
switch (isp->phy.state) {
|
||||||
case OTG_STATE_B_HOST:
|
case OTG_STATE_B_HOST:
|
||||||
isp->otg.state = OTG_STATE_B_PERIPHERAL;
|
isp->phy.state = OTG_STATE_B_PERIPHERAL;
|
||||||
/* caller will suspend next */
|
/* caller will suspend next */
|
||||||
break;
|
break;
|
||||||
case OTG_STATE_A_HOST:
|
case OTG_STATE_A_HOST:
|
||||||
|
@ -1466,7 +1468,7 @@ isp1301_start_hnp(struct usb_phy *dev)
|
||||||
MC1_BDIS_ACON_EN);
|
MC1_BDIS_ACON_EN);
|
||||||
#endif
|
#endif
|
||||||
/* caller must suspend then clear A_BUSREQ */
|
/* caller must suspend then clear A_BUSREQ */
|
||||||
usb_gadget_vbus_connect(isp->otg.gadget);
|
usb_gadget_vbus_connect(otg->gadget);
|
||||||
l = omap_readl(OTG_CTRL);
|
l = omap_readl(OTG_CTRL);
|
||||||
l |= OTG_A_SETB_HNPEN;
|
l |= OTG_A_SETB_HNPEN;
|
||||||
omap_writel(l, OTG_CTRL);
|
omap_writel(l, OTG_CTRL);
|
||||||
|
@ -1503,6 +1505,12 @@ isp1301_probe(struct i2c_client *i2c, const struct i2c_device_id *id)
|
||||||
if (!isp)
|
if (!isp)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
isp->phy.otg = kzalloc(sizeof *isp->phy.otg, GFP_KERNEL);
|
||||||
|
if (!isp->phy.otg) {
|
||||||
|
kfree(isp);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
INIT_WORK(&isp->work, isp1301_work);
|
INIT_WORK(&isp->work, isp1301_work);
|
||||||
init_timer(&isp->timer);
|
init_timer(&isp->timer);
|
||||||
isp->timer.function = isp1301_timer;
|
isp->timer.function = isp1301_timer;
|
||||||
|
@ -1576,14 +1584,15 @@ isp1301_probe(struct i2c_client *i2c, const struct i2c_device_id *id)
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
isp->otg.dev = &i2c->dev;
|
isp->phy.dev = &i2c->dev;
|
||||||
isp->otg.label = DRIVER_NAME;
|
isp->phy.label = DRIVER_NAME;
|
||||||
|
isp->phy.set_power = isp1301_set_power,
|
||||||
|
|
||||||
isp->otg.set_host = isp1301_set_host,
|
isp->phy.otg->phy = &isp->phy;
|
||||||
isp->otg.set_peripheral = isp1301_set_peripheral,
|
isp->phy.otg->set_host = isp1301_set_host,
|
||||||
isp->otg.set_power = isp1301_set_power,
|
isp->phy.otg->set_peripheral = isp1301_set_peripheral,
|
||||||
isp->otg.start_srp = isp1301_start_srp,
|
isp->phy.otg->start_srp = isp1301_start_srp,
|
||||||
isp->otg.start_hnp = isp1301_start_hnp,
|
isp->phy.otg->start_hnp = isp1301_start_hnp,
|
||||||
|
|
||||||
enable_vbus_draw(isp, 0);
|
enable_vbus_draw(isp, 0);
|
||||||
power_down(isp);
|
power_down(isp);
|
||||||
|
@ -1601,7 +1610,7 @@ isp1301_probe(struct i2c_client *i2c, const struct i2c_device_id *id)
|
||||||
dev_dbg(&i2c->dev, "scheduled timer, %d min\n", TIMER_MINUTES);
|
dev_dbg(&i2c->dev, "scheduled timer, %d min\n", TIMER_MINUTES);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
status = otg_set_transceiver(&isp->otg);
|
status = usb_set_transceiver(&isp->phy);
|
||||||
if (status < 0)
|
if (status < 0)
|
||||||
dev_err(&i2c->dev, "can't register transceiver, %d\n",
|
dev_err(&i2c->dev, "can't register transceiver, %d\n",
|
||||||
status);
|
status);
|
||||||
|
@ -1609,6 +1618,7 @@ isp1301_probe(struct i2c_client *i2c, const struct i2c_device_id *id)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
|
kfree(isp->phy.otg);
|
||||||
kfree(isp);
|
kfree(isp);
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
@ -1639,7 +1649,7 @@ subsys_initcall(isp_init);
|
||||||
static void __exit isp_exit(void)
|
static void __exit isp_exit(void)
|
||||||
{
|
{
|
||||||
if (the_transceiver)
|
if (the_transceiver)
|
||||||
otg_set_transceiver(NULL);
|
usb_set_transceiver(NULL);
|
||||||
i2c_del_driver(&isp1301_driver);
|
i2c_del_driver(&isp1301_driver);
|
||||||
}
|
}
|
||||||
module_exit(isp_exit);
|
module_exit(isp_exit);
|
||||||
|
|
Loading…
Reference in a new issue