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>
This commit is contained in:
parent
a874c1606f
commit
e8869713e5
3 changed files with 14 additions and 4 deletions
|
@ -659,8 +659,10 @@ int dwc3_core_init(struct dwc3 *dwc)
|
||||||
/* Handle USB2.0-only core configuration */
|
/* Handle USB2.0-only core configuration */
|
||||||
if (DWC3_GHWPARAMS3_SSPHY_IFC(dwc->hwparams.hwparams3) ==
|
if (DWC3_GHWPARAMS3_SSPHY_IFC(dwc->hwparams.hwparams3) ==
|
||||||
DWC3_GHWPARAMS3_SSPHY_IFC_DIS) {
|
DWC3_GHWPARAMS3_SSPHY_IFC_DIS) {
|
||||||
if (dwc->maximum_speed == USB_SPEED_SUPER)
|
if (dwc->max_hw_supp_speed == USB_SPEED_SUPER) {
|
||||||
dwc->maximum_speed = USB_SPEED_HIGH;
|
dwc->max_hw_supp_speed = USB_SPEED_HIGH;
|
||||||
|
dwc->maximum_speed = dwc->max_hw_supp_speed;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = dwc3_core_reset(dwc);
|
ret = dwc3_core_reset(dwc);
|
||||||
|
@ -1084,6 +1086,7 @@ static int dwc3_probe(struct platform_device *pdev)
|
||||||
hird_threshold = 12;
|
hird_threshold = 12;
|
||||||
|
|
||||||
dwc->maximum_speed = usb_get_maximum_speed(dev);
|
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->dr_mode = usb_get_dr_mode(dev);
|
||||||
|
|
||||||
dwc->has_lpm_erratum = device_property_read_bool(dev,
|
dwc->has_lpm_erratum = device_property_read_bool(dev,
|
||||||
|
@ -1157,6 +1160,7 @@ static int dwc3_probe(struct platform_device *pdev)
|
||||||
|
|
||||||
if (pdata) {
|
if (pdata) {
|
||||||
dwc->maximum_speed = pdata->maximum_speed;
|
dwc->maximum_speed = pdata->maximum_speed;
|
||||||
|
dwc->max_hw_supp_speed = dwc->maximum_speed;
|
||||||
dwc->has_lpm_erratum = pdata->has_lpm_erratum;
|
dwc->has_lpm_erratum = pdata->has_lpm_erratum;
|
||||||
if (pdata->lpm_nyet_threshold)
|
if (pdata->lpm_nyet_threshold)
|
||||||
lpm_nyet_threshold = 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 */
|
/* default to superspeed if no maximum_speed passed */
|
||||||
if (dwc->maximum_speed == USB_SPEED_UNKNOWN)
|
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->lpm_nyet_threshold = lpm_nyet_threshold;
|
||||||
dwc->tx_de_emphasis = tx_de_emphasis;
|
dwc->tx_de_emphasis = tx_de_emphasis;
|
||||||
|
|
|
@ -757,7 +757,8 @@ struct dwc3_scratchpad_array {
|
||||||
* @nr_scratch: number of scratch buffers
|
* @nr_scratch: number of scratch buffers
|
||||||
* @num_event_buffers: calculated number of event buffers
|
* @num_event_buffers: calculated number of event buffers
|
||||||
* @u1u2: only used on revisions <1.83a for workaround
|
* @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
|
* @revision: revision register contents
|
||||||
* @dr_mode: requested mode of operation
|
* @dr_mode: requested mode of operation
|
||||||
* @usb2_phy: pointer to USB2 PHY
|
* @usb2_phy: pointer to USB2 PHY
|
||||||
|
@ -888,6 +889,7 @@ struct dwc3 {
|
||||||
u32 u1;
|
u32 u1;
|
||||||
u32 u1u2;
|
u32 u1u2;
|
||||||
u32 maximum_speed;
|
u32 maximum_speed;
|
||||||
|
u32 max_hw_supp_speed;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* All 3.1 IP version constants are greater than the 3.0 IP
|
* All 3.1 IP version constants are greater than the 3.0 IP
|
||||||
|
|
|
@ -2608,6 +2608,8 @@ static int dwc3_msm_id_notifier(struct notifier_block *nb,
|
||||||
|
|
||||||
speed = extcon_get_cable_state_(edev, EXTCON_USB_SPEED);
|
speed = extcon_get_cable_state_(edev, EXTCON_USB_SPEED);
|
||||||
dwc->maximum_speed = (speed <= 0) ? USB_SPEED_HIGH : USB_SPEED_SUPER;
|
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) {
|
if (mdwc->id_state != id) {
|
||||||
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);
|
speed = extcon_get_cable_state_(edev, EXTCON_USB_SPEED);
|
||||||
dwc->maximum_speed = (speed <= 0) ? USB_SPEED_HIGH : USB_SPEED_SUPER;
|
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;
|
mdwc->vbus_active = event;
|
||||||
if (dwc->is_drd && !mdwc->in_restart) {
|
if (dwc->is_drd && !mdwc->in_restart) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue