From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Boyd Subject: [PATCH v2 09/22] usb: chipidea: Kick OTG state machine for AVVIS with vbus extcon Date: Thu, 7 Jul 2016 15:21:00 -0700 Message-ID: <20160707222114.1673-10-stephen.boyd@linaro.org> References: <20160707222114.1673-1-stephen.boyd@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20160707222114.1673-1-stephen.boyd@linaro.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=m.gmane.org@lists.infradead.org To: linux-usb@vger.kernel.org Cc: Felipe Balbi , Arnd Bergmann , Neil Armstrong , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Bjorn Andersson , Peter Chen , Greg Kroah-Hartman , Andy Gross , linux-arm-kernel@lists.infradead.org List-Id: linux-arm-msm@vger.kernel.org Force the OTG state machine to go forward when we're using an extcon for vbus detection. In this case, the controller may never raise an interrupt for AVVIS, so we need to simulate the event by toggling the appropriate OTG fsm bits and kicking the state machine again. Cc: Peter Chen Cc: Greg Kroah-Hartman Signed-off-by: Stephen Boyd --- I think this was rejected last time around but I've kept it in the series to continue discussion on how we're supposed to be emulating vbus an id pin interrupts and the otgsc register. drivers/usb/chipidea/otg_fsm.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c index de8e22ec3902..aab076fc4d82 100644 --- a/drivers/usb/chipidea/otg_fsm.c +++ b/drivers/usb/chipidea/otg_fsm.c @@ -475,6 +475,14 @@ static void ci_otg_drv_vbus(struct otg_fsm *fsm, int on) return; } } + /* + * Force state machine forward if we use extcon + * to detect vbus state (i.e. simulate AVVIS event) + */ + if (!IS_ERR(ci->platdata->vbus_extcon.edev)) { + fsm->a_vbus_vld = 1; + ci_otg_queue_work(ci); + } /* Disable data pulse irq */ hw_write_otgsc(ci, OTGSC_DPIE, 0); @@ -486,6 +494,15 @@ static void ci_otg_drv_vbus(struct otg_fsm *fsm, int on) fsm->a_bus_drop = 1; fsm->a_bus_req = 0; + /* + * Force state machine forward if we use extcon + * to detect vbus state (i.e. simulate AVVIS event) + */ + if (!IS_ERR(ci->platdata->vbus_extcon.edev)) { + fsm->a_vbus_vld = 0; + fsm->b_conn = 0; + ci_otg_queue_work(ci); + } } } -- 2.9.0.rc2.8.ga28705d From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932252AbcGGW0p (ORCPT ); Thu, 7 Jul 2016 18:26:45 -0400 Received: from mail-pa0-f54.google.com ([209.85.220.54]:35858 "EHLO mail-pa0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932260AbcGGWVb (ORCPT ); Thu, 7 Jul 2016 18:21:31 -0400 From: Stephen Boyd To: linux-usb@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Andy Gross , Bjorn Andersson , Neil Armstrong , Arnd Bergmann , Felipe Balbi , Peter Chen , Greg Kroah-Hartman Subject: [PATCH v2 09/22] usb: chipidea: Kick OTG state machine for AVVIS with vbus extcon Date: Thu, 7 Jul 2016 15:21:00 -0700 Message-Id: <20160707222114.1673-10-stephen.boyd@linaro.org> X-Mailer: git-send-email 2.9.0.rc2.8.ga28705d In-Reply-To: <20160707222114.1673-1-stephen.boyd@linaro.org> References: <20160707222114.1673-1-stephen.boyd@linaro.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Force the OTG state machine to go forward when we're using an extcon for vbus detection. In this case, the controller may never raise an interrupt for AVVIS, so we need to simulate the event by toggling the appropriate OTG fsm bits and kicking the state machine again. Cc: Peter Chen Cc: Greg Kroah-Hartman Signed-off-by: Stephen Boyd --- I think this was rejected last time around but I've kept it in the series to continue discussion on how we're supposed to be emulating vbus an id pin interrupts and the otgsc register. drivers/usb/chipidea/otg_fsm.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c index de8e22ec3902..aab076fc4d82 100644 --- a/drivers/usb/chipidea/otg_fsm.c +++ b/drivers/usb/chipidea/otg_fsm.c @@ -475,6 +475,14 @@ static void ci_otg_drv_vbus(struct otg_fsm *fsm, int on) return; } } + /* + * Force state machine forward if we use extcon + * to detect vbus state (i.e. simulate AVVIS event) + */ + if (!IS_ERR(ci->platdata->vbus_extcon.edev)) { + fsm->a_vbus_vld = 1; + ci_otg_queue_work(ci); + } /* Disable data pulse irq */ hw_write_otgsc(ci, OTGSC_DPIE, 0); @@ -486,6 +494,15 @@ static void ci_otg_drv_vbus(struct otg_fsm *fsm, int on) fsm->a_bus_drop = 1; fsm->a_bus_req = 0; + /* + * Force state machine forward if we use extcon + * to detect vbus state (i.e. simulate AVVIS event) + */ + if (!IS_ERR(ci->platdata->vbus_extcon.edev)) { + fsm->a_vbus_vld = 0; + fsm->b_conn = 0; + ci_otg_queue_work(ci); + } } } -- 2.9.0.rc2.8.ga28705d From mboxrd@z Thu Jan 1 00:00:00 1970 From: stephen.boyd@linaro.org (Stephen Boyd) Date: Thu, 7 Jul 2016 15:21:00 -0700 Subject: [PATCH v2 09/22] usb: chipidea: Kick OTG state machine for AVVIS with vbus extcon In-Reply-To: <20160707222114.1673-1-stephen.boyd@linaro.org> References: <20160707222114.1673-1-stephen.boyd@linaro.org> Message-ID: <20160707222114.1673-10-stephen.boyd@linaro.org> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Force the OTG state machine to go forward when we're using an extcon for vbus detection. In this case, the controller may never raise an interrupt for AVVIS, so we need to simulate the event by toggling the appropriate OTG fsm bits and kicking the state machine again. Cc: Peter Chen Cc: Greg Kroah-Hartman Signed-off-by: Stephen Boyd --- I think this was rejected last time around but I've kept it in the series to continue discussion on how we're supposed to be emulating vbus an id pin interrupts and the otgsc register. drivers/usb/chipidea/otg_fsm.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c index de8e22ec3902..aab076fc4d82 100644 --- a/drivers/usb/chipidea/otg_fsm.c +++ b/drivers/usb/chipidea/otg_fsm.c @@ -475,6 +475,14 @@ static void ci_otg_drv_vbus(struct otg_fsm *fsm, int on) return; } } + /* + * Force state machine forward if we use extcon + * to detect vbus state (i.e. simulate AVVIS event) + */ + if (!IS_ERR(ci->platdata->vbus_extcon.edev)) { + fsm->a_vbus_vld = 1; + ci_otg_queue_work(ci); + } /* Disable data pulse irq */ hw_write_otgsc(ci, OTGSC_DPIE, 0); @@ -486,6 +494,15 @@ static void ci_otg_drv_vbus(struct otg_fsm *fsm, int on) fsm->a_bus_drop = 1; fsm->a_bus_req = 0; + /* + * Force state machine forward if we use extcon + * to detect vbus state (i.e. simulate AVVIS event) + */ + if (!IS_ERR(ci->platdata->vbus_extcon.edev)) { + fsm->a_vbus_vld = 0; + fsm->b_conn = 0; + ci_otg_queue_work(ci); + } } } -- 2.9.0.rc2.8.ga28705d