[PATCH v4 14/20] usb: dwc3: add Tx de-emphasis quirk

2014-10-30 Thread Huang Rui
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: Huang Rui ray.hu...@amd.com
---
 Documentation/devicetree/bindings/usb/dwc3.txt |  3 +++
 drivers/usb/dwc3/core.c| 17 +
 drivers/usb/dwc3/core.h| 11 +++
 drivers/usb/dwc3/platform_data.h   |  3 +++
 4 files changed, 34 insertions(+)

diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt 
b/Documentation/devicetree/bindings/usb/dwc3.txt
index 38bac28..a9e54ae 100644
--- a/Documentation/devicetree/bindings/usb/dwc3.txt
+++ b/Documentation/devicetree/bindings/usb/dwc3.txt
@@ -29,6 +29,9 @@ Optional properties:
  - 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
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.
 
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index e02c3b0..b55fa5b 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -401,6 +401,9 @@ static void dwc3_phy_setup(struct dwc3 *dwc)
if (dwc-rx_detect_poll_quirk)
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);
 
mdelay(100);
@@ -717,6 +720,7 @@ static int dwc3_probe(struct platform_device *pdev)
struct resource *res;
struct dwc3 *dwc;
u8  lpm_nyet_threshold;
+   u8  tx_de_emphasis;
 
int ret;
 
@@ -775,6 +779,9 @@ static int dwc3_probe(struct platform_device *pdev)
/* default to highest possible threshold */
lpm_nyet_threshold = 0xff;
 
+   /* default to -3.5dB de-emphasis */
+   tx_de_emphasis = 1;
+
if (node) {
dwc-maximum_speed = of_usb_get_maximum_speed(node);
dwc-has_lpm_erratum = of_property_read_bool(node,
@@ -802,6 +809,11 @@ static int dwc3_probe(struct platform_device *pdev)
snps,lfps_filter_quirk);
dwc-rx_detect_poll_quirk = of_property_read_bool(node,
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) {
dwc-maximum_speed = pdata-maximum_speed;
dwc-has_lpm_erratum = pdata-has_lpm_erratum;
@@ -819,6 +831,10 @@ static int dwc3_probe(struct platform_device *pdev)
dwc-del_phy_power_chg_quirk = pdata-del_phy_power_chg_quirk;
dwc-lfps_filter_quirk = pdata-lfps_filter_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 */
@@ -826,6 +842,7 @@ static int dwc3_probe(struct platform_device *pdev)
dwc-maximum_speed = USB_SPEED_SUPER;
 
dwc-lpm_nyet_threshold = lpm_nyet_threshold;
+   dwc-tx_de_emphasis = tx_de_emphasis;
 
ret = dwc3_core_get_phy(dwc);
if (ret)
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
index eeef976..469ee13 100644
--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -185,6 +185,8 @@
 #define DWC3_GUSB3PIPECTL_SUSPHY   (1  17)
 #define DWC3_GUSB3PIPECTL_LFPSFILT (1  9)
 #define DWC3_GUSB3PIPECTL_RX_DETOPOLL  (1  8)
+#define DWC3_GUSB3PIPECTL_TX_DEEPH_MASKDWC3_GUSB3PIPECTL_TX_DEEPH(3)
+#define DWC3_GUSB3PIPECTL_TX_DEEPH(n)  ((n)  1)
 
 /* Global TX Fifo Size Register */
 #define DWC3_GTXFIFOSIZ_TXFDEF(n)  ((n)  0x)
@@ -695,6 +697,12 @@ struct dwc3_scratchpad_array {
  * @del_phy_power_chg_quirk: set if we enable delay phy power change 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
+ * @tx_de_emphasis_quirk: set if we enable Tx de-emphasis quirk
+ * @tx_de_emphasis: Tx de-emphasis value
+ * 0   - 

Re: [PATCH v4 14/20] usb: dwc3: add Tx de-emphasis quirk

2014-10-30 Thread Felipe Balbi
On Thu, Oct 30, 2014 at 06:08:39PM +0800, Huang Rui wrote:
 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: Huang Rui ray.hu...@amd.com

doesn't apply:

checking file Documentation/devicetree/bindings/usb/dwc3.txt
checking file drivers/usb/dwc3/core.c
Hunk #2 succeeded at 718 (offset -2 lines).
Hunk #3 succeeded at 777 (offset -2 lines).
Hunk #4 succeeded at 807 (offset -2 lines).
Hunk #5 succeeded at 829 (offset -2 lines).
Hunk #6 succeeded at 840 (offset -2 lines).
checking file drivers/usb/dwc3/core.h
Hunk #2 FAILED at 697.
1 out of 3 hunks FAILED
checking file drivers/usb/dwc3/platform_data.h

please rebase on testing/next

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH v4 14/20] usb: dwc3: add Tx de-emphasis quirk

2014-10-30 Thread Huang Rui
On Thu, Oct 30, 2014 at 11:42:10AM -0500, Felipe Balbi wrote:
 On Thu, Oct 30, 2014 at 06:08:39PM +0800, Huang Rui wrote:
  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: Huang Rui ray.hu...@amd.com
 
 doesn't apply:
 
 checking file Documentation/devicetree/bindings/usb/dwc3.txt
 checking file drivers/usb/dwc3/core.c
 Hunk #2 succeeded at 718 (offset -2 lines).
 Hunk #3 succeeded at 777 (offset -2 lines).
 Hunk #4 succeeded at 807 (offset -2 lines).
 Hunk #5 succeeded at 829 (offset -2 lines).
 Hunk #6 succeeded at 840 (offset -2 lines).
 checking file drivers/usb/dwc3/core.h
 Hunk #2 FAILED at 697.
 1 out of 3 hunks FAILED
 checking file drivers/usb/dwc3/platform_data.h
 
 please rebase on testing/next
 

That's because in patch 12 and other ones you applied, I changed
addreviations to uppercase such as lfps - LFPS, fpga - FPGA.

Previous 13 patches are already applied. Do you mean, I send the other
patches since Tx de-emphasis (patch 14) after rebased current
branch.

If yes, at patch 1, Enabling this bit ... hibernation .. yet, should
it be updated in extra patch?

Thanks,
Rui
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v4 14/20] usb: dwc3: add Tx de-emphasis quirk

2014-10-30 Thread Felipe Balbi
Hi,

On Fri, Oct 31, 2014 at 09:29:55AM +0800, Huang Rui wrote:
 On Thu, Oct 30, 2014 at 11:42:10AM -0500, Felipe Balbi wrote:
  On Thu, Oct 30, 2014 at 06:08:39PM +0800, Huang Rui wrote:
   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: Huang Rui ray.hu...@amd.com
  
  doesn't apply:
  
  checking file Documentation/devicetree/bindings/usb/dwc3.txt
  checking file drivers/usb/dwc3/core.c
  Hunk #2 succeeded at 718 (offset -2 lines).
  Hunk #3 succeeded at 777 (offset -2 lines).
  Hunk #4 succeeded at 807 (offset -2 lines).
  Hunk #5 succeeded at 829 (offset -2 lines).
  Hunk #6 succeeded at 840 (offset -2 lines).
  checking file drivers/usb/dwc3/core.h
  Hunk #2 FAILED at 697.
  1 out of 3 hunks FAILED
  checking file drivers/usb/dwc3/platform_data.h
  
  please rebase on testing/next
  
 
 That's because in patch 12 and other ones you applied, I changed
 addreviations to uppercase such as lfps - LFPS, fpga - FPGA.

didn't notice that. I'll just reapply the entire series.

 Previous 13 patches are already applied. Do you mean, I send the other
 patches since Tx de-emphasis (patch 14) after rebased current
 branch.
 
 If yes, at patch 1, Enabling this bit ... hibernation .. yet, should
 it be updated in extra patch?

don't worry, I'll reapply the whole series, thanks :-)

-- 
balbi


signature.asc
Description: Digital signature