aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/dwc3/core.c
diff options
context:
space:
mode:
authorHuang Rui <ray.huang@amd.com>2014-10-28 07:54:26 -0400
committerFelipe Balbi <balbi@ti.com>2014-11-03 11:03:36 -0500
commit80caf7d21adca10c4621d511f6eb01f7ed2b342c (patch)
tree097bf706580823890264c4bb319f87fa1521a93a /drivers/usb/dwc3/core.c
parent3b81221a529c087171557d7c4aec02b0ba029bb1 (diff)
usb: dwc3: add lpm erratum support
When parameter DWC_USB3_LPM_ERRATA_ENABLE is enabled in Andvanced Configuration of coreConsultant, it supports of xHCI BESL Errata Dated 10/19/2011 is enabled in host mode. In device mode it adds the capability to send NYET response threshold based on the BESL value received in the LPM token, and the threhold is configurable for each soc platform. This patch adds an entry that soc platform is able to define the lpm capacity with their own device tree or bus glue layer. [ balbi@ti.com : added devicetree documentation, spelled threshold completely, made sure threshold is only applied to proper core revisions. ] Signed-off-by: Huang Rui <ray.huang@amd.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/dwc3/core.c')
-rw-r--r--drivers/usb/dwc3/core.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index a0ae1326b7e3..6f9e5b85977a 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -657,6 +657,7 @@ static int dwc3_probe(struct platform_device *pdev)
657 struct device_node *node = dev->of_node; 657 struct device_node *node = dev->of_node;
658 struct resource *res; 658 struct resource *res;
659 struct dwc3 *dwc; 659 struct dwc3 *dwc;
660 u8 lpm_nyet_threshold;
660 661
661 int ret; 662 int ret;
662 663
@@ -712,16 +713,27 @@ static int dwc3_probe(struct platform_device *pdev)
712 */ 713 */
713 res->start -= DWC3_GLOBALS_REGS_START; 714 res->start -= DWC3_GLOBALS_REGS_START;
714 715
716 /* default to highest possible threshold */
717 lpm_nyet_threshold = 0xff;
718
715 if (node) { 719 if (node) {
716 dwc->maximum_speed = of_usb_get_maximum_speed(node); 720 dwc->maximum_speed = of_usb_get_maximum_speed(node);
721 dwc->has_lpm_erratum = of_property_read_bool(node,
722 "snps,has-lpm-erratum");
723 of_property_read_u8(node, "snps,lpm-nyet-threshold",
724 &lpm_nyet_threshold);
717 725
718 dwc->needs_fifo_resize = of_property_read_bool(node, "tx-fifo-resize"); 726 dwc->needs_fifo_resize = of_property_read_bool(node,
727 "tx-fifo-resize");
719 dwc->dr_mode = of_usb_get_dr_mode(node); 728 dwc->dr_mode = of_usb_get_dr_mode(node);
720 729
721 dwc->disable_scramble_quirk = of_property_read_bool(node, 730 dwc->disable_scramble_quirk = of_property_read_bool(node,
722 "snps,disable_scramble_quirk"); 731 "snps,disable_scramble_quirk");
723 } else if (pdata) { 732 } else if (pdata) {
724 dwc->maximum_speed = pdata->maximum_speed; 733 dwc->maximum_speed = pdata->maximum_speed;
734 dwc->has_lpm_erratum = pdata->has_lpm_erratum;
735 if (pdata->lpm_nyet_threshold)
736 lpm_nyet_threshold = pdata->lpm_nyet_threshold;
725 737
726 dwc->needs_fifo_resize = pdata->tx_fifo_resize; 738 dwc->needs_fifo_resize = pdata->tx_fifo_resize;
727 dwc->dr_mode = pdata->dr_mode; 739 dwc->dr_mode = pdata->dr_mode;
@@ -733,6 +745,8 @@ static int dwc3_probe(struct platform_device *pdev)
733 if (dwc->maximum_speed == USB_SPEED_UNKNOWN) 745 if (dwc->maximum_speed == USB_SPEED_UNKNOWN)
734 dwc->maximum_speed = USB_SPEED_SUPER; 746 dwc->maximum_speed = USB_SPEED_SUPER;
735 747
748 dwc->lpm_nyet_threshold = lpm_nyet_threshold;
749
736 ret = dwc3_core_get_phy(dwc); 750 ret = dwc3_core_get_phy(dwc);
737 if (ret) 751 if (ret)
738 return ret; 752 return ret;