public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] ChipIdea USB role-switch fixes and tweaks
@ 2020-05-04 22:43 Bryan O'Donoghue
  2020-05-04 22:43 ` [PATCH 1/2] usb: chipidea: msm: Ensure proper controller reset using role switch API Bryan O'Donoghue
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Bryan O'Donoghue @ 2020-05-04 22:43 UTC (permalink / raw)
  To: Peter.Chen, gregkh, linux-usb; +Cc: linux-arm-msm, Bryan O'Donoghue

This set addresses two things:

- A bug when using the USB role-switch API.
  If we are using role-switch we still want to switch HS_PHY_GENCONFIG_2
  bits.

- Adding the flag to allow user-space to control the USB role as other
  controllers already support.

Bryan O'Donoghue (2):
  usb: chipidea: msm: Ensure proper controller reset using role switch
    API
  usb: chipidea: Enable user-space triggered role-switching

 drivers/usb/chipidea/ci_hdrc_msm.c | 2 +-
 drivers/usb/chipidea/core.c        | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] usb: chipidea: msm: Ensure proper controller reset using role switch API
  2020-05-04 22:43 [PATCH 0/2] ChipIdea USB role-switch fixes and tweaks Bryan O'Donoghue
@ 2020-05-04 22:43 ` Bryan O'Donoghue
  2020-05-04 22:43 ` [PATCH 2/2] usb: chipidea: Enable user-space triggered role-switching Bryan O'Donoghue
  2020-05-06  2:18 ` [PATCH 0/2] ChipIdea USB role-switch fixes and tweaks Peter Chen
  2 siblings, 0 replies; 4+ messages in thread
From: Bryan O'Donoghue @ 2020-05-04 22:43 UTC (permalink / raw)
  To: Peter.Chen, gregkh, linux-usb
  Cc: linux-arm-msm, Bryan O'Donoghue, Philipp Zabel, linux-kernel,
	Stephen Boyd

Currently we check to make sure there is no error state on the extcon
handle for VBUS when writing to the HS_PHY_GENCONFIG_2 register. When using
the USB role-switch API we still need to write to this register absent an
extcon handle.

This patch makes the appropriate update to ensure the write happens if
role-switching is true.

Fixes: 05559f10ed79 ("usb: chipidea: add role switch class support")

Cc: Peter Chen <Peter.Chen@nxp.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Philipp Zabel <p.zabel@pengutronix.de>
Cc: linux-usb@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: Stephen Boyd <swboyd@chromium.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 drivers/usb/chipidea/ci_hdrc_msm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/chipidea/ci_hdrc_msm.c b/drivers/usb/chipidea/ci_hdrc_msm.c
index af648ba6544d..46105457e1ca 100644
--- a/drivers/usb/chipidea/ci_hdrc_msm.c
+++ b/drivers/usb/chipidea/ci_hdrc_msm.c
@@ -114,7 +114,7 @@ static int ci_hdrc_msm_notify_event(struct ci_hdrc *ci, unsigned event)
 			hw_write_id_reg(ci, HS_PHY_GENCONFIG_2,
 					HS_PHY_ULPI_TX_PKT_EN_CLR_FIX, 0);
 
-		if (!IS_ERR(ci->platdata->vbus_extcon.edev)) {
+		if (!IS_ERR(ci->platdata->vbus_extcon.edev) || ci->role_switch) {
 			hw_write_id_reg(ci, HS_PHY_GENCONFIG_2,
 					HS_PHY_SESS_VLD_CTRL_EN,
 					HS_PHY_SESS_VLD_CTRL_EN);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] usb: chipidea: Enable user-space triggered role-switching
  2020-05-04 22:43 [PATCH 0/2] ChipIdea USB role-switch fixes and tweaks Bryan O'Donoghue
  2020-05-04 22:43 ` [PATCH 1/2] usb: chipidea: msm: Ensure proper controller reset using role switch API Bryan O'Donoghue
@ 2020-05-04 22:43 ` Bryan O'Donoghue
  2020-05-06  2:18 ` [PATCH 0/2] ChipIdea USB role-switch fixes and tweaks Peter Chen
  2 siblings, 0 replies; 4+ messages in thread
From: Bryan O'Donoghue @ 2020-05-04 22:43 UTC (permalink / raw)
  To: Peter.Chen, gregkh, linux-usb
  Cc: linux-arm-msm, Bryan O'Donoghue, Jun Li, Liam Girdwood,
	Mark Brown, linux-kernel, Stephen Boyd

The flag provided by the USB role-switch logic allow_userspace_control
allows user-space to trigger a role-switch. Several other USB controller
drivers already enable this feature. Let's switch it on for the chipidea
core now also.

Cc: Peter Chen <Peter.Chen@nxp.com>
Cc: Jun Li <jun.li@nxp.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: linux-usb@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: Stephen Boyd <swboyd@chromium.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 drivers/usb/chipidea/core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index ae0bdc036464..5f31fda92292 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -666,6 +666,7 @@ static int ci_usb_role_switch_set(struct usb_role_switch *sw,
 static struct usb_role_switch_desc ci_role_switch = {
 	.set = ci_usb_role_switch_set,
 	.get = ci_usb_role_switch_get,
+	.allow_userspace_control = true,
 };
 
 static int ci_get_platdata(struct device *dev,
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] ChipIdea USB role-switch fixes and tweaks
  2020-05-04 22:43 [PATCH 0/2] ChipIdea USB role-switch fixes and tweaks Bryan O'Donoghue
  2020-05-04 22:43 ` [PATCH 1/2] usb: chipidea: msm: Ensure proper controller reset using role switch API Bryan O'Donoghue
  2020-05-04 22:43 ` [PATCH 2/2] usb: chipidea: Enable user-space triggered role-switching Bryan O'Donoghue
@ 2020-05-06  2:18 ` Peter Chen
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Chen @ 2020-05-06  2:18 UTC (permalink / raw)
  To: Bryan O'Donoghue
  Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
	linux-arm-msm@vger.kernel.org

On 20-05-04 23:43:44, Bryan O'Donoghue wrote:
> This set addresses two things:
> 
> - A bug when using the USB role-switch API.
>   If we are using role-switch we still want to switch HS_PHY_GENCONFIG_2
>   bits.
> 
> - Adding the flag to allow user-space to control the USB role as other
>   controllers already support.
> 
> Bryan O'Donoghue (2):
>   usb: chipidea: msm: Ensure proper controller reset using role switch
>     API
>   usb: chipidea: Enable user-space triggered role-switching
> 
>  drivers/usb/chipidea/ci_hdrc_msm.c | 2 +-
>  drivers/usb/chipidea/core.c        | 1 +
>  2 files changed, 2 insertions(+), 1 deletion(-)
> 

Applied both, thanks.

-- 

Thanks,
Peter Chen

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-05-06  2:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-04 22:43 [PATCH 0/2] ChipIdea USB role-switch fixes and tweaks Bryan O'Donoghue
2020-05-04 22:43 ` [PATCH 1/2] usb: chipidea: msm: Ensure proper controller reset using role switch API Bryan O'Donoghue
2020-05-04 22:43 ` [PATCH 2/2] usb: chipidea: Enable user-space triggered role-switching Bryan O'Donoghue
2020-05-06  2:18 ` [PATCH 0/2] ChipIdea USB role-switch fixes and tweaks Peter Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox