]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[realtek] Use explicit value for TCR.MXDMA
authorMichael Brown <mcb30@ipxe.org>
Thu, 23 Aug 2012 12:27:31 +0000 (13:27 +0100)
committerMichael Brown <mcb30@ipxe.org>
Thu, 23 Aug 2012 14:15:42 +0000 (15:15 +0100)
Some RTL8169 cards (observed with an RTL8169SC) power up with
TCR.MXDMA set to 16 bytes.  While this does not prevent proper
operation, it almost certainly degrades performance.

Fix by explicitly setting TCR.MXDMA to "unlimited".

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/drivers/net/realtek.c
src/drivers/net/realtek.h

index 2dded0a5579130b23644ca99587cb7871b86de7f..77df64e61bc578e32bc42376f150d4edd21b90a5 100644 (file)
@@ -500,6 +500,7 @@ static void realtek_refill_rx ( struct realtek_nic *rtl ) {
  */
 static int realtek_open ( struct net_device *netdev ) {
        struct realtek_nic *rtl = netdev->priv;
+       uint32_t tcr;
        uint32_t rcr;
        int rc;
 
@@ -524,6 +525,12 @@ static int realtek_open ( struct net_device *netdev ) {
         */
        writeb ( ( RTL_CR_TE | RTL_CR_RE ), rtl->regs + RTL_CR );
 
+       /* Configure transmitter */
+       tcr = readl ( rtl->regs + RTL_TCR );
+       tcr &= ~RTL_TCR_MXDMA_MASK;
+       tcr |= RTL_TCR_MXDMA_DEFAULT;
+       writel ( tcr, rtl->regs + RTL_TCR );
+
        /* Configure receiver */
        rcr = readl ( rtl->regs + RTL_RCR );
        rcr &= ~( RTL_RCR_RXFTH_MASK | RTL_RCR_RBLEN_MASK |
index 24ec09e71b44f214be8497cb3c1a6e89d1d2d2ab..2591e7255817d0cb4290876b9a127d7115eb8fc5 100644 (file)
@@ -132,6 +132,12 @@ enum realtek_legacy_status {
 /** Interrupt Status Register (word) */
 #define RTL_ISR 0x3e
 
+/** Transmit (Tx) Configuration Register (dword) */
+#define RTL_TCR 0x40
+#define RTL_TCR_MXDMA(x)       ( (x) << 8 ) /**< Max DMA burst size */
+#define RTL_TCR_MXDMA_MASK     RTL_TCR_MXDMA ( 0x7 )
+#define RTL_TCR_MXDMA_DEFAULT  RTL_TCR_MXDMA ( 0x7 /* Unlimited */ )
+
 /** Receive (Rx) Configuration Register (dword) */
 #define RTL_RCR 0x44
 #define RTL_RCR_RXFTH(x)       ( (x) << 13 ) /**< Receive FIFO threshold */