Skip to content

Commit e542a22

Browse files
hayesorzFrancois Romieu
authored andcommitted
r8169: adjust the RxConfig settings.
Set the init value before reset in probe function. And then just modify the relative bits and keep the init settings. For 8110S, 8110SB, and 8110SC series, the initial value of RxConfig needs to be set after the tx/rx is enabled. Signed-off-by: Hayes Wang <[email protected]> Acked-by: Francois Romieu <[email protected]>
1 parent aaa89c0 commit e542a22

File tree

1 file changed

+44
-12
lines changed

1 file changed

+44
-12
lines changed

drivers/net/r8169.c

Lines changed: 44 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,6 @@ enum rtl_registers {
286286
#define RXCFG_DMA_SHIFT 8
287287
/* Unlimited maximum PCI burst. */
288288
#define RX_DMA_BURST (7 << RXCFG_DMA_SHIFT)
289-
#define RTL_RX_CONFIG_MASK 0xff7e1880u
290289

291290
RxMissed = 0x4c,
292291
Cfg9346 = 0x50,
@@ -728,8 +727,6 @@ static void rtl8169_down(struct net_device *dev);
728727
static void rtl8169_rx_clear(struct rtl8169_private *tp);
729728
static int rtl8169_poll(struct napi_struct *napi, int budget);
730729

731-
static const unsigned int rtl8169_rx_config = RX_FIFO_THRESH | RX_DMA_BURST;
732-
733730
static u32 ocp_read(struct rtl8169_private *tp, u8 mask, u16 reg)
734731
{
735732
void __iomem *ioaddr = tp->mmio_addr;
@@ -3503,6 +3500,42 @@ static void __devinit rtl_init_pll_power_ops(struct rtl8169_private *tp)
35033500
}
35043501
}
35053502

3503+
static void rtl_init_rxcfg(struct rtl8169_private *tp)
3504+
{
3505+
void __iomem *ioaddr = tp->mmio_addr;
3506+
3507+
switch (tp->mac_version) {
3508+
case RTL_GIGA_MAC_VER_01:
3509+
case RTL_GIGA_MAC_VER_02:
3510+
case RTL_GIGA_MAC_VER_03:
3511+
case RTL_GIGA_MAC_VER_04:
3512+
case RTL_GIGA_MAC_VER_05:
3513+
case RTL_GIGA_MAC_VER_06:
3514+
case RTL_GIGA_MAC_VER_10:
3515+
case RTL_GIGA_MAC_VER_11:
3516+
case RTL_GIGA_MAC_VER_12:
3517+
case RTL_GIGA_MAC_VER_13:
3518+
case RTL_GIGA_MAC_VER_14:
3519+
case RTL_GIGA_MAC_VER_15:
3520+
case RTL_GIGA_MAC_VER_16:
3521+
case RTL_GIGA_MAC_VER_17:
3522+
RTL_W32(RxConfig, RX_FIFO_THRESH | RX_DMA_BURST);
3523+
break;
3524+
case RTL_GIGA_MAC_VER_18:
3525+
case RTL_GIGA_MAC_VER_19:
3526+
case RTL_GIGA_MAC_VER_20:
3527+
case RTL_GIGA_MAC_VER_21:
3528+
case RTL_GIGA_MAC_VER_22:
3529+
case RTL_GIGA_MAC_VER_23:
3530+
case RTL_GIGA_MAC_VER_24:
3531+
RTL_W32(RxConfig, RX128_INT_EN | RX_MULTI_EN | RX_DMA_BURST);
3532+
break;
3533+
default:
3534+
RTL_W32(RxConfig, RX128_INT_EN | RX_DMA_BURST);
3535+
break;
3536+
}
3537+
}
3538+
35063539
static void rtl8169_init_ring_indexes(struct rtl8169_private *tp)
35073540
{
35083541
tp->dirty_tx = tp->dirty_rx = tp->cur_tx = tp->cur_rx = 0;
@@ -3630,6 +3663,11 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
36303663
if (!pci_is_pcie(pdev))
36313664
netif_info(tp, probe, dev, "not PCI Express\n");
36323665

3666+
/* Identify chip attached to board */
3667+
rtl8169_get_mac_version(tp, dev, cfg->default_ver);
3668+
3669+
rtl_init_rxcfg(tp);
3670+
36333671
RTL_W16(IntrMask, 0x0000);
36343672

36353673
rtl_hw_reset(tp);
@@ -3638,9 +3676,6 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
36383676

36393677
pci_set_master(pdev);
36403678

3641-
/* Identify chip attached to board */
3642-
rtl8169_get_mac_version(tp, dev, cfg->default_ver);
3643-
36443679
/*
36453680
* Pretend we are using VLANs; This bypasses a nasty bug where
36463681
* Interrupts stop flowing on high load on 8110SCd controllers.
@@ -3943,10 +3978,6 @@ static void rtl8169_hw_reset(struct rtl8169_private *tp)
39433978
static void rtl_set_rx_tx_config_registers(struct rtl8169_private *tp)
39443979
{
39453980
void __iomem *ioaddr = tp->mmio_addr;
3946-
u32 cfg = rtl8169_rx_config;
3947-
3948-
cfg |= (RTL_R32(RxConfig) & RTL_RX_CONFIG_MASK);
3949-
RTL_W32(RxConfig, cfg);
39503981

39513982
/* Set DMA burst size and Interframe Gap Time */
39523983
RTL_W32(TxConfig, (TX_DMA_BURST << TxDMAShift) |
@@ -4034,6 +4065,8 @@ static void rtl_hw_start_8169(struct net_device *dev)
40344065
tp->mac_version == RTL_GIGA_MAC_VER_04)
40354066
RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb);
40364067

4068+
rtl_init_rxcfg(tp);
4069+
40374070
RTL_W8(EarlyTxThres, NoEarlyTx);
40384071

40394072
rtl_set_rx_max_size(ioaddr, rx_buf_sz);
@@ -5553,8 +5586,7 @@ static void rtl_set_rx_mode(struct net_device *dev)
55535586

55545587
spin_lock_irqsave(&tp->lock, flags);
55555588

5556-
tmp = rtl8169_rx_config | rx_mode |
5557-
(RTL_R32(RxConfig) & RTL_RX_CONFIG_MASK);
5589+
tmp = RTL_R32(RxConfig) | rx_mode;
55585590

55595591
if (tp->mac_version > RTL_GIGA_MAC_VER_06) {
55605592
u32 data = mc_filter[0];

0 commit comments

Comments
 (0)