dwc2 fixes for HiKey
Subsystems (2)
v2 cover dwc2 fixes for HiKey
I wanted to send out two patches we're using on the dwc2 driver in order to make HiKey function.
The first is seemingly just a bug fix we ran into when changing modes while the bus was auto-suspended.
The second is a little more interesting as it works around a limitation of the the device in that it can't handle split transactions, so the usb speed but be lowered and raised manually when full-speed devices come and go.
I wanted to send these out for further review and consideration.
Changes in v2:
* Fix build issue reported by kbuildbot
* Rework to avoid using new dts entry suggested by RobH
* Further tweaks from Chen Yu to try to address comments from John Youn
* Further simplified logic
Feedback would be greatly appreciated!
thanks
-john
Chen Yu (2):
usb: dwc2: Force port resume on switching to device mode
usb: dwc2: Add a quirk to allow speed negotiation for Hisilicon Hi6220
drivers/usb/dwc2/core.h | 6 ++++ drivers/usb/dwc2/hcd.c | 69 +++++++++++++++++++++++++++++++++++++++++++++ drivers/usb/dwc2/platform.c | 1 + 3 files changed, 76 insertions(+)
Signature · 1 line
2.7.4
RFC PATCH v2 1/2 usb: dwc2: Force port resume on switching to device mode
From: Chen Yu <[email protected]>
We've seen failures when switching between host and gadget mode, which was diagnosed as being caused due to the bus being auto-suspended when we switched.
So this patch forces a port resume when switching to device mode if the bus is suspended.
--- drivers/usb/dwc2/hcd.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/usb/dwc2/hcd.c +8 -0
@@ -54,6 +54,9 @@#include "core.h" #include "hcd.h" + +static void dwc2_port_resume (struct dwc2_hsotg *hsotg); +/* * ========================================================================= * Host Core Layer Functions
@@ -3204,6 +3207,11 @@ static void dwc2_conn_id_status_change(struct work_struct *work)if (gotgctl &GOTGCTL_CONID_B ) {/* Wait for switch to device mode */ dev_dbg (hsotg->dev,"connId B\n" ); +if (hsotg->bus_suspended) { +dev_info (hsotg->dev, +"Do port resume before switching to device mode\n" ); +dwc2_port_resume (hsotg); + }while (!dwc2_is_device_mode (hsotg)) { dev_info(hsotg->dev, "Waiting for Peripheral Mode, Mode=%s\n",
Signature · 1 line
2.7.4
RFC PATCH v2 2/2 usb: dwc2: Add a quirk to allow speed negotiation for Hisilicon Hi6220
In reply to John StultzFrom: Chen Yu <[email protected]>
The Hi6220's usb controller is limited in that it does not support "Split Transactions", so it does not support communicating with low-speed and full-speed devices behind a high-speed hub.
Thus it requires a quirk so that we can manually drop the usb speed when low/full-speed are attached, and bump back to high speed when they are removed.
[jstultz: Reworked to simplify the patch, and made
commit log to be more specific about the issue]
---
v2:
* Fix build issue reported by kbuildbot
* Rework to avoid using new dts entry suggested by RobH
* Further tweaks from Chen Yu to try to address comments from John Youn
* Further simplified logic
--- drivers/usb/dwc2/core.h | 6 +++++ drivers/usb/dwc2/hcd.c | 61 +++++++++++++++++++++++++++++++++++++++++++++ drivers/usb/dwc2/platform.c | 1 + 3 files changed, 68 insertions(+)
drivers/usb/dwc2/core.h +6 -0
@@ -417,6 +417,11 @@ enum dwc2_ep0_state {* needed. * 0 - No (default) * 1 - Yes +* @change_speed_quirk: Change speed configuration to DWC2_SPEED_PARAM_FULL +* while full&low speed device connect. And change speed +* back to DWC2_SPEED_PARAM_HIGH while device is gone. +* 0 - No (default) +* 1 - Yes * * The following parameters may be specified when starting the module. These * parameters define how the DWC_otg controller should be configured. A
@@ -457,6 +462,7 @@ struct dwc2_core_params {int uframe_sched;int external_id_pin_ctl;int hibernation; +int change_speed_quirk; };/**
drivers/usb/dwc2/hcd.c +61 -0
73 lines not on this page · raw message
drivers/usb/dwc2/platform.c +1 -0
@@ -85,6 +85,7 @@ static const struct dwc2_core_params params_hi6220 = { .uframe_sched = 0, .external_id_pin_ctl = -1, .hibernation = -1, + .change_speed_quirk = 1, };static const struct dwc2_core_params params_bcm2835 = {
Signature · 1 line
2.7.4