From 200938e4875e6069829477a3dd0b5609b4acefa7 Mon Sep 17 00:00:00 2001 From: Mayank Rana Date: Thu, 1 Dec 2016 09:58:30 -0800 Subject: [PATCH] f_gsi: Don't reconfigure USB GSI eps multiple time with cable connect case Commit dbca823c25bf ("f_gsi: Don't send end xfer command when USB is into U3 state") consolidated below usecases path for RNDIS: 1. USB RNDIS adaptor disable/enable case 2. USB RNDIS suspend/resume case 3. USB cable connect case Due to USB GSI endpoints are getting disabled as part of above usecase 1 i.e. adaptor disable, it is required to reconfigure and re-enable USB GSI endpoints when adaptor is enabled. USB GSI endpoints are re-configured but not re-enabled for above usecase 3 although it is already configured and enabled as pat of set_alt(1). Hence USB GSI endpoint are partially configured causing no USB data transfer between USB GSI and IPA GSI which fails IP address assignment. Fix this issue by making sure that USB GSI endpoints are not reconfigured in above usecase 3. CRs-Fixed: 1095920 Change-Id: I67068bac21274d715f61f9e5b83fae54e2c8e22d Signed-off-by: Mayank Rana --- drivers/usb/gadget/function/f_gsi.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/usb/gadget/function/f_gsi.c b/drivers/usb/gadget/function/f_gsi.c index d3845b4f82c6..e46edc83430c 100644 --- a/drivers/usb/gadget/function/f_gsi.c +++ b/drivers/usb/gadget/function/f_gsi.c @@ -672,25 +672,27 @@ static void ipa_work_handler(struct work_struct *w) break; } + /* + * Update desc and reconfigure USB GSI OUT and IN + * endpoint for RNDIS Adaptor enable case. + */ if (d_port->out_ep && !d_port->out_ep->desc && gsi->out_ep_desc_backup) { d_port->out_ep->desc = gsi->out_ep_desc_backup; d_port->out_ep->ep_intr_num = 1; + log_event_dbg("%s: OUT ep_op_config", __func__); + usb_gsi_ep_op(d_port->out_ep, + &d_port->out_request, GSI_EP_OP_CONFIG); } if (d_port->in_ep && !d_port->in_ep->desc && gsi->in_ep_desc_backup) { d_port->in_ep->desc = gsi->in_ep_desc_backup; d_port->in_ep->ep_intr_num = 2; - } - - if (d_port->out_ep) - usb_gsi_ep_op(d_port->out_ep, - &d_port->out_request, GSI_EP_OP_CONFIG); - - if (d_port->in_ep) + log_event_dbg("%s: IN ep_op_config", __func__); usb_gsi_ep_op(d_port->in_ep, &d_port->in_request, GSI_EP_OP_CONFIG); + } ipa_connect_channels(d_port); ipa_data_path_enable(d_port);