[PATCH 08/25] USB OTG Langwell: Fix missing b_sess_vld event for SRP.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Hao Wu <hao.wu@xxxxxxxxx>

The patch changed start_srp function and state machine process for SRP.

Signed-off-by: Hao Wu <hao.wu@xxxxxxxxx>
Signed-off-by: Alan Cox <alan@xxxxxxxxxxxxxxx>
---

 drivers/usb/otg/langwell_otg.c |   22 +++++++++++++++-------
 1 files changed, 15 insertions(+), 7 deletions(-)


diff --git a/drivers/usb/otg/langwell_otg.c b/drivers/usb/otg/langwell_otg.c
index 618b84d..62d9828 100644
--- a/drivers/usb/otg/langwell_otg.c
+++ b/drivers/usb/otg/langwell_otg.c
@@ -266,6 +266,14 @@ static int langwell_otg_start_srp(struct otg_transceiver *otg)
 	val |= (OTGSC_BSVIE | OTGSC_BSEIE);
 	writel(val, lnw->regs + CI_OTGSC);
 
+	/* If Vbus is valid, then update the hsm */
+	if (val & OTGSC_BSV) {
+		dev_dbg(&lnw->pdev->dev, "no b_sess_vld interrupt\n");
+
+		lnw->hsm.b_sess_vld = 1;
+		queue_work(lnw->qwork, &lnw->work);
+	}
+
 	dev_dbg(&lnw->pdev->dev, "%s <---\n", __func__);
 	return 0;
 }
@@ -884,13 +892,6 @@ static void langwell_otg_work(struct work_struct *work)
 			langwell_otg_phy_low_power(1);
 			lnw->otg.state = OTG_STATE_A_IDLE;
 			queue_work(lnw->qwork, &lnw->work);
-		} else if (lnw->hsm.b_srp_init_tmout) {
-			lnw->hsm.b_srp_init_tmout = 0;
-			dev_warn(&lnw->pdev->dev, "SRP init timeout\n");
-		} else if (lnw->hsm.b_srp_fail_tmout) {
-			lnw->hsm.b_srp_fail_tmout = 0;
-			lnw->hsm.b_bus_req = 0;
-			langwell_otg_nsf_msg(6);
 		} else if (lnw->hsm.b_sess_vld) {
 			langwell_otg_del_timer(b_srp_init_tmr);
 			del_timer_sync(&lnw->hsm_timer);
@@ -904,6 +905,13 @@ static void langwell_otg_work(struct work_struct *work)
 				dev_dbg(&lnw->pdev->dev,
 					"client driver not loaded.\n");
 
+		} else if (lnw->hsm.b_srp_init_tmout) {
+			lnw->hsm.b_srp_init_tmout = 0;
+			dev_warn(&lnw->pdev->dev, "SRP init timeout\n");
+		} else if (lnw->hsm.b_srp_fail_tmout) {
+			lnw->hsm.b_srp_fail_tmout = 0;
+			lnw->hsm.b_bus_req = 0;
+			langwell_otg_nsf_msg(6);
 		} else if (lnw->hsm.b_bus_req &&
 				(lnw->hsm.b_sess_end)) {
 			del_timer_sync(&lnw->hsm_timer);

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux