Commit 6b6a0c9a authored by Huang Rui's avatar Huang Rui Committed by Felipe Balbi

usb: dwc3: add Tx de-emphasis quirk

This patch adds Tx de-emphasis quirk, and the Tx de-emphasis value is
configurable according to PIPE3 specification.

Value		Description
0		-6dB de-emphasis
1		-3.5dB de-emphasis
2		No de-emphasis
3		Reserved

It can be configured on DT or platform data.
Signed-off-by: default avatarHuang Rui <ray.huang@amd.com>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 2164a476
...@@ -29,6 +29,9 @@ Optional properties: ...@@ -29,6 +29,9 @@ Optional properties:
- snps,lfps_filter_quirk: when set core will filter LFPS reception. - snps,lfps_filter_quirk: when set core will filter LFPS reception.
- snps,rx_detect_poll_quirk: when set core will disable a 400us delay to start - snps,rx_detect_poll_quirk: when set core will disable a 400us delay to start
Polling LFPS after RX.Detect. Polling LFPS after RX.Detect.
- snps,tx_de_emphasis_quirk: when set core will set Tx de-emphasis value.
- snps,tx_de_emphasis: the value driven to the PHY is controlled by the
LTSSM during USB3 Compliance mode.
This is usually a subnode to DWC3 glue to which it is connected. This is usually a subnode to DWC3 glue to which it is connected.
......
...@@ -401,6 +401,9 @@ static void dwc3_phy_setup(struct dwc3 *dwc) ...@@ -401,6 +401,9 @@ static void dwc3_phy_setup(struct dwc3 *dwc)
if (dwc->rx_detect_poll_quirk) if (dwc->rx_detect_poll_quirk)
reg |= DWC3_GUSB3PIPECTL_RX_DETOPOLL; reg |= DWC3_GUSB3PIPECTL_RX_DETOPOLL;
if (dwc->tx_de_emphasis_quirk)
reg |= DWC3_GUSB3PIPECTL_TX_DEEPH(dwc->tx_de_emphasis);
dwc3_writel(dwc->regs, DWC3_GUSB3PIPECTL(0), reg); dwc3_writel(dwc->regs, DWC3_GUSB3PIPECTL(0), reg);
mdelay(100); mdelay(100);
...@@ -720,6 +723,7 @@ static int dwc3_probe(struct platform_device *pdev) ...@@ -720,6 +723,7 @@ static int dwc3_probe(struct platform_device *pdev)
struct resource *res; struct resource *res;
struct dwc3 *dwc; struct dwc3 *dwc;
u8 lpm_nyet_threshold; u8 lpm_nyet_threshold;
u8 tx_de_emphasis;
int ret; int ret;
...@@ -778,6 +782,9 @@ static int dwc3_probe(struct platform_device *pdev) ...@@ -778,6 +782,9 @@ static int dwc3_probe(struct platform_device *pdev)
/* default to highest possible threshold */ /* default to highest possible threshold */
lpm_nyet_threshold = 0xff; lpm_nyet_threshold = 0xff;
/* default to -3.5dB de-emphasis */
tx_de_emphasis = 1;
if (node) { if (node) {
dwc->maximum_speed = of_usb_get_maximum_speed(node); dwc->maximum_speed = of_usb_get_maximum_speed(node);
dwc->has_lpm_erratum = of_property_read_bool(node, dwc->has_lpm_erratum = of_property_read_bool(node,
...@@ -805,6 +812,11 @@ static int dwc3_probe(struct platform_device *pdev) ...@@ -805,6 +812,11 @@ static int dwc3_probe(struct platform_device *pdev)
"snps,lfps_filter_quirk"); "snps,lfps_filter_quirk");
dwc->rx_detect_poll_quirk = of_property_read_bool(node, dwc->rx_detect_poll_quirk = of_property_read_bool(node,
"snps,rx_detect_poll_quirk"); "snps,rx_detect_poll_quirk");
dwc->tx_de_emphasis_quirk = of_property_read_bool(node,
"snps,tx_de_emphasis_quirk");
of_property_read_u8(node, "snps,tx_de_emphasis",
&tx_de_emphasis);
} else if (pdata) { } else if (pdata) {
dwc->maximum_speed = pdata->maximum_speed; dwc->maximum_speed = pdata->maximum_speed;
dwc->has_lpm_erratum = pdata->has_lpm_erratum; dwc->has_lpm_erratum = pdata->has_lpm_erratum;
...@@ -822,6 +834,10 @@ static int dwc3_probe(struct platform_device *pdev) ...@@ -822,6 +834,10 @@ static int dwc3_probe(struct platform_device *pdev)
dwc->del_phy_power_chg_quirk = pdata->del_phy_power_chg_quirk; dwc->del_phy_power_chg_quirk = pdata->del_phy_power_chg_quirk;
dwc->lfps_filter_quirk = pdata->lfps_filter_quirk; dwc->lfps_filter_quirk = pdata->lfps_filter_quirk;
dwc->rx_detect_poll_quirk = pdata->rx_detect_poll_quirk; dwc->rx_detect_poll_quirk = pdata->rx_detect_poll_quirk;
dwc->tx_de_emphasis_quirk = pdata->tx_de_emphasis_quirk;
if (pdata->tx_de_emphasis)
tx_de_emphasis = pdata->tx_de_emphasis;
} }
/* default to superspeed if no maximum_speed passed */ /* default to superspeed if no maximum_speed passed */
...@@ -829,6 +845,7 @@ static int dwc3_probe(struct platform_device *pdev) ...@@ -829,6 +845,7 @@ static int dwc3_probe(struct platform_device *pdev)
dwc->maximum_speed = USB_SPEED_SUPER; 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;
ret = dwc3_core_get_phy(dwc); ret = dwc3_core_get_phy(dwc);
if (ret) if (ret)
......
...@@ -185,6 +185,8 @@ ...@@ -185,6 +185,8 @@
#define DWC3_GUSB3PIPECTL_SUSPHY (1 << 17) #define DWC3_GUSB3PIPECTL_SUSPHY (1 << 17)
#define DWC3_GUSB3PIPECTL_LFPSFILT (1 << 9) #define DWC3_GUSB3PIPECTL_LFPSFILT (1 << 9)
#define DWC3_GUSB3PIPECTL_RX_DETOPOLL (1 << 8) #define DWC3_GUSB3PIPECTL_RX_DETOPOLL (1 << 8)
#define DWC3_GUSB3PIPECTL_TX_DEEPH_MASK DWC3_GUSB3PIPECTL_TX_DEEPH(3)
#define DWC3_GUSB3PIPECTL_TX_DEEPH(n) ((n) << 1)
/* Global TX Fifo Size Register */ /* Global TX Fifo Size Register */
#define DWC3_GTXFIFOSIZ_TXFDEF(n) ((n) & 0xffff) #define DWC3_GTXFIFOSIZ_TXFDEF(n) ((n) & 0xffff)
...@@ -695,6 +697,12 @@ struct dwc3_scratchpad_array { ...@@ -695,6 +697,12 @@ struct dwc3_scratchpad_array {
* @del_phy_power_chg_quirk: set if we enable delay phy power change quirk * @del_phy_power_chg_quirk: set if we enable delay phy power change quirk
* @lfps_filter_quirk: set if we enable LFPS filter quirk * @lfps_filter_quirk: set if we enable LFPS filter quirk
* @rx_detect_poll_quirk: set if we enable rx_detect to polling lfps quirk * @rx_detect_poll_quirk: set if we enable rx_detect to polling lfps quirk
* @tx_de_emphasis_quirk: set if we enable Tx de-emphasis quirk
* @tx_de_emphasis: Tx de-emphasis value
* 0 - -6dB de-emphasis
* 1 - -3.5dB de-emphasis
* 2 - No de-emphasis
* 3 - Reserved
*/ */
struct dwc3 { struct dwc3 {
struct usb_ctrlrequest *ctrl_req; struct usb_ctrlrequest *ctrl_req;
...@@ -810,6 +818,9 @@ struct dwc3 { ...@@ -810,6 +818,9 @@ struct dwc3 {
unsigned del_phy_power_chg_quirk:1; unsigned del_phy_power_chg_quirk:1;
unsigned lfps_filter_quirk:1; unsigned lfps_filter_quirk:1;
unsigned rx_detect_poll_quirk:1; unsigned rx_detect_poll_quirk:1;
unsigned tx_de_emphasis_quirk:1;
unsigned tx_de_emphasis:2;
}; };
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
......
...@@ -36,4 +36,7 @@ struct dwc3_platform_data { ...@@ -36,4 +36,7 @@ struct dwc3_platform_data {
unsigned del_phy_power_chg_quirk:1; unsigned del_phy_power_chg_quirk:1;
unsigned lfps_filter_quirk:1; unsigned lfps_filter_quirk:1;
unsigned rx_detect_poll_quirk:1; unsigned rx_detect_poll_quirk:1;
unsigned tx_de_emphasis_quirk:1;
unsigned tx_de_emphasis:2;
}; };
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment