summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorVamsi Krishna Samavedam <vskrishn@codeaurora.org>2017-01-31 13:55:38 -0800
committerVamsi Krishna Samavedam <vskrishn@codeaurora.org>2017-01-31 14:52:59 -0800
commite8869713e5633fffa6a5c844bafaa60345a297fe (patch)
tree8dc2e24cc8d7881e3c86bced114f519a3d16dd2c /drivers
parenta874c1606fa22a4add4242cc8c5dfca500410f5d (diff)
usb: dwc3: Add maximum hw supported speed flag
Maximum hardware supported speed flag limits the maximum speed of the usb controller to high or super. Adding this additional flag as maximum_speed flag can be changed from different sources such as power delivery stack. Change-Id: I18f414e822b5525fe848a48384fac102cdae7b03 Signed-off-by: Vamsi Krishna Samavedam <vskrishn@codeaurora.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/dwc3/core.c10
-rw-r--r--drivers/usb/dwc3/core.h4
-rw-r--r--drivers/usb/dwc3/dwc3-msm.c4
3 files changed, 14 insertions, 4 deletions
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 5aae319198fa..76d966ca57ad 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -659,8 +659,10 @@ int dwc3_core_init(struct dwc3 *dwc)
/* Handle USB2.0-only core configuration */
if (DWC3_GHWPARAMS3_SSPHY_IFC(dwc->hwparams.hwparams3) ==
DWC3_GHWPARAMS3_SSPHY_IFC_DIS) {
- if (dwc->maximum_speed == USB_SPEED_SUPER)
- dwc->maximum_speed = USB_SPEED_HIGH;
+ if (dwc->max_hw_supp_speed == USB_SPEED_SUPER) {
+ dwc->max_hw_supp_speed = USB_SPEED_HIGH;
+ dwc->maximum_speed = dwc->max_hw_supp_speed;
+ }
}
ret = dwc3_core_reset(dwc);
@@ -1084,6 +1086,7 @@ static int dwc3_probe(struct platform_device *pdev)
hird_threshold = 12;
dwc->maximum_speed = usb_get_maximum_speed(dev);
+ dwc->max_hw_supp_speed = dwc->maximum_speed;
dwc->dr_mode = usb_get_dr_mode(dev);
dwc->has_lpm_erratum = device_property_read_bool(dev,
@@ -1157,6 +1160,7 @@ static int dwc3_probe(struct platform_device *pdev)
if (pdata) {
dwc->maximum_speed = pdata->maximum_speed;
+ dwc->max_hw_supp_speed = dwc->maximum_speed;
dwc->has_lpm_erratum = pdata->has_lpm_erratum;
if (pdata->lpm_nyet_threshold)
lpm_nyet_threshold = pdata->lpm_nyet_threshold;
@@ -1190,7 +1194,7 @@ static int dwc3_probe(struct platform_device *pdev)
/* default to superspeed if no maximum_speed passed */
if (dwc->maximum_speed == USB_SPEED_UNKNOWN)
- dwc->maximum_speed = USB_SPEED_SUPER;
+ dwc->max_hw_supp_speed = dwc->maximum_speed = USB_SPEED_SUPER;
dwc->lpm_nyet_threshold = lpm_nyet_threshold;
dwc->tx_de_emphasis = tx_de_emphasis;
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
index c2cdfd1a823b..1abd827beb3f 100644
--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -757,7 +757,8 @@ struct dwc3_scratchpad_array {
* @nr_scratch: number of scratch buffers
* @num_event_buffers: calculated number of event buffers
* @u1u2: only used on revisions <1.83a for workaround
- * @maximum_speed: maximum speed requested (mainly for testing purposes)
+ * @maximum_speed: maximum speed to operate as requested by sw
+ * @max_hw_supp_speed: maximum speed supported by hw design
* @revision: revision register contents
* @dr_mode: requested mode of operation
* @usb2_phy: pointer to USB2 PHY
@@ -888,6 +889,7 @@ struct dwc3 {
u32 u1;
u32 u1u2;
u32 maximum_speed;
+ u32 max_hw_supp_speed;
/*
* All 3.1 IP version constants are greater than the 3.0 IP
diff --git a/drivers/usb/dwc3/dwc3-msm.c b/drivers/usb/dwc3/dwc3-msm.c
index 1e252febc783..e3848b885b95 100644
--- a/drivers/usb/dwc3/dwc3-msm.c
+++ b/drivers/usb/dwc3/dwc3-msm.c
@@ -2608,6 +2608,8 @@ static int dwc3_msm_id_notifier(struct notifier_block *nb,
speed = extcon_get_cable_state_(edev, EXTCON_USB_SPEED);
dwc->maximum_speed = (speed <= 0) ? USB_SPEED_HIGH : USB_SPEED_SUPER;
+ if (dwc->maximum_speed > dwc->max_hw_supp_speed)
+ dwc->maximum_speed = dwc->max_hw_supp_speed;
if (mdwc->id_state != id) {
mdwc->id_state = id;
@@ -2649,6 +2651,8 @@ static int dwc3_msm_vbus_notifier(struct notifier_block *nb,
speed = extcon_get_cable_state_(edev, EXTCON_USB_SPEED);
dwc->maximum_speed = (speed <= 0) ? USB_SPEED_HIGH : USB_SPEED_SUPER;
+ if (dwc->maximum_speed > dwc->max_hw_supp_speed)
+ dwc->maximum_speed = dwc->max_hw_supp_speed;
mdwc->vbus_active = event;
if (dwc->is_drd && !mdwc->in_restart) {