|
@@ -872,6 +872,43 @@ static int dwc3_core_init(struct dwc3 *dwc)
|
|
|
dwc3_writel(dwc->regs, DWC3_GUCTL1, reg);
|
|
|
}
|
|
|
|
|
|
+ /*
|
|
|
+ * Must config both number of packets and max burst settings to enable
|
|
|
+ * RX and/or TX threshold.
|
|
|
+ */
|
|
|
+ if (dwc3_is_usb31(dwc) && dwc->dr_mode == USB_DR_MODE_HOST) {
|
|
|
+ u8 rx_thr_num = dwc->rx_thr_num_pkt_prd;
|
|
|
+ u8 rx_maxburst = dwc->rx_max_burst_prd;
|
|
|
+ u8 tx_thr_num = dwc->tx_thr_num_pkt_prd;
|
|
|
+ u8 tx_maxburst = dwc->tx_max_burst_prd;
|
|
|
+
|
|
|
+ if (rx_thr_num && rx_maxburst) {
|
|
|
+ reg = dwc3_readl(dwc->regs, DWC3_GRXTHRCFG);
|
|
|
+ reg |= DWC31_RXTHRNUMPKTSEL_PRD;
|
|
|
+
|
|
|
+ reg &= ~DWC31_RXTHRNUMPKT_PRD(~0);
|
|
|
+ reg |= DWC31_RXTHRNUMPKT_PRD(rx_thr_num);
|
|
|
+
|
|
|
+ reg &= ~DWC31_MAXRXBURSTSIZE_PRD(~0);
|
|
|
+ reg |= DWC31_MAXRXBURSTSIZE_PRD(rx_maxburst);
|
|
|
+
|
|
|
+ dwc3_writel(dwc->regs, DWC3_GRXTHRCFG, reg);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (tx_thr_num && tx_maxburst) {
|
|
|
+ reg = dwc3_readl(dwc->regs, DWC3_GTXTHRCFG);
|
|
|
+ reg |= DWC31_TXTHRNUMPKTSEL_PRD;
|
|
|
+
|
|
|
+ reg &= ~DWC31_TXTHRNUMPKT_PRD(~0);
|
|
|
+ reg |= DWC31_TXTHRNUMPKT_PRD(tx_thr_num);
|
|
|
+
|
|
|
+ reg &= ~DWC31_MAXTXBURSTSIZE_PRD(~0);
|
|
|
+ reg |= DWC31_MAXTXBURSTSIZE_PRD(tx_maxburst);
|
|
|
+
|
|
|
+ dwc3_writel(dwc->regs, DWC3_GTXTHRCFG, reg);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
return 0;
|
|
|
|
|
|
err4:
|
|
@@ -1042,6 +1079,10 @@ static void dwc3_get_properties(struct dwc3 *dwc)
|
|
|
u8 lpm_nyet_threshold;
|
|
|
u8 tx_de_emphasis;
|
|
|
u8 hird_threshold;
|
|
|
+ u8 rx_thr_num_pkt_prd;
|
|
|
+ u8 rx_max_burst_prd;
|
|
|
+ u8 tx_thr_num_pkt_prd;
|
|
|
+ u8 tx_max_burst_prd;
|
|
|
|
|
|
/* default to highest possible threshold */
|
|
|
lpm_nyet_threshold = 0xff;
|
|
@@ -1076,6 +1117,14 @@ static void dwc3_get_properties(struct dwc3 *dwc)
|
|
|
&hird_threshold);
|
|
|
dwc->usb3_lpm_capable = device_property_read_bool(dev,
|
|
|
"snps,usb3_lpm_capable");
|
|
|
+ device_property_read_u8(dev, "snps,rx-thr-num-pkt-prd",
|
|
|
+ &rx_thr_num_pkt_prd);
|
|
|
+ device_property_read_u8(dev, "snps,rx-max-burst-prd",
|
|
|
+ &rx_max_burst_prd);
|
|
|
+ device_property_read_u8(dev, "snps,tx-thr-num-pkt-prd",
|
|
|
+ &tx_thr_num_pkt_prd);
|
|
|
+ device_property_read_u8(dev, "snps,tx-max-burst-prd",
|
|
|
+ &tx_max_burst_prd);
|
|
|
|
|
|
dwc->disable_scramble_quirk = device_property_read_bool(dev,
|
|
|
"snps,disable_scramble_quirk");
|
|
@@ -1126,6 +1175,12 @@ static void dwc3_get_properties(struct dwc3 *dwc)
|
|
|
dwc->hird_threshold = hird_threshold
|
|
|
| (dwc->is_utmi_l1_suspend << 4);
|
|
|
|
|
|
+ dwc->rx_thr_num_pkt_prd = rx_thr_num_pkt_prd;
|
|
|
+ dwc->rx_max_burst_prd = rx_max_burst_prd;
|
|
|
+
|
|
|
+ dwc->tx_thr_num_pkt_prd = tx_thr_num_pkt_prd;
|
|
|
+ dwc->tx_max_burst_prd = tx_max_burst_prd;
|
|
|
+
|
|
|
dwc->imod_interval = 0;
|
|
|
}
|
|
|
|