public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] fsl/usb: Increase TXFIFOTHRESH value for usb write in T4 Rev 2.0
@ 2014-04-07  3:16 Nikhil Badola
  2014-04-23 22:01 ` York Sun
  0 siblings, 1 reply; 2+ messages in thread
From: Nikhil Badola @ 2014-04-07  3:16 UTC (permalink / raw)
  To: u-boot

Increase TXFIFOTHRES field value in TXFILLTUNING register of usb for T4 Rev 2.0.
This decreases data burst rate with which data packets are posted from the TX
latency FIFO to compensate for latencies in DDR pipeline during DMA.
This avoids Tx buffer underruns and leads to successful usb writes

Signed-off-by: Ramneek Mehresh <ramneek.mehresh@freescale.com>
Signed-off-by: Nikhil Badola <nikhil.badola@freescale.com>
---
 drivers/usb/host/ehci-fsl.c | 20 ++++++++++++++++++++
 include/usb/ehci-fsl.h      |  7 +++++++
 2 files changed, 27 insertions(+)

diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c
index 1ca7cf5..991b43b 100644
--- a/drivers/usb/host/ehci-fsl.c
+++ b/drivers/usb/host/ehci-fsl.c
@@ -17,6 +17,8 @@
 
 #include "ehci.h"
 
+static void set_txfifothresh(struct usb_ehci *, u32);
+
 /* Check USB PHY clock valid */
 static int usb_phy_clk_valid(struct usb_ehci *ehci)
 {
@@ -109,6 +111,10 @@ int ehci_hcd_init(int index, enum usb_init_type init,
 
 	in_le32(&ehci->usbmode);
 
+	if (SVR_SOC_VER(get_svr()) == SVR_T4240 &&
+	    IS_SVR_REV(get_svr(), 2, 0))
+		set_txfifothresh(ehci, TXFIFOTHRESH);
+
 	return 0;
 }
 
@@ -120,3 +126,17 @@ int ehci_hcd_stop(int index)
 {
 	return 0;
 }
+
+/*
+ * Setting the value of TXFIFO_THRESH field in TXFILLTUNING register
+ * to counter DDR latencies in writing data into Tx buffer.
+ * This prevents Tx buffer from getting underrun
+ */
+static void set_txfifothresh(struct usb_ehci *ehci, u32 txfifo_thresh)
+{
+	u32 cmd;
+	cmd = ehci_readl(&ehci->txfilltuning);
+	cmd &= ~TXFIFO_THRESH_MASK;
+	cmd |= TXFIFO_THRESH(txfifo_thresh);
+	ehci_writel(&ehci->txfilltuning, cmd);
+}
diff --git a/include/usb/ehci-fsl.h b/include/usb/ehci-fsl.h
index 734305b..c9ee1d5 100644
--- a/include/usb/ehci-fsl.h
+++ b/include/usb/ehci-fsl.h
@@ -164,6 +164,13 @@
 #endif
 
 /*
+ * Increasing TX FIFO threshold value from 2 to 4 decreases
+ * data burst rate with which data packets are posted from the TX
+ * latency FIFO to compensate for latencies in DDR pipeline during DMA
+ */
+#define TXFIFOTHRESH		4
+
+/*
  * USB Registers
  */
 struct usb_ehci {
-- 
1.7.11.7

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [U-Boot] [PATCH] fsl/usb: Increase TXFIFOTHRESH value for usb write in T4 Rev 2.0
  2014-04-07  3:16 [U-Boot] [PATCH] fsl/usb: Increase TXFIFOTHRESH value for usb write in T4 Rev 2.0 Nikhil Badola
@ 2014-04-23 22:01 ` York Sun
  0 siblings, 0 replies; 2+ messages in thread
From: York Sun @ 2014-04-23 22:01 UTC (permalink / raw)
  To: u-boot

On 04/06/2014 08:16 PM, Nikhil Badola wrote:
> Increase TXFIFOTHRES field value in TXFILLTUNING register of usb for T4 Rev 2.0.
> This decreases data burst rate with which data packets are posted from the TX
> latency FIFO to compensate for latencies in DDR pipeline during DMA.
> This avoids Tx buffer underruns and leads to successful usb writes
> 
> Signed-off-by: Ramneek Mehresh <ramneek.mehresh@freescale.com>
> Signed-off-by: Nikhil Badola <nikhil.badola@freescale.com>
> ---

Applied to u-boot-mpc85xx/master, thanks.

York

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-04-23 22:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-07  3:16 [U-Boot] [PATCH] fsl/usb: Increase TXFIFOTHRESH value for usb write in T4 Rev 2.0 Nikhil Badola
2014-04-23 22:01 ` York Sun

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox