Commit 36033766 authored by Olof Johansson's avatar Olof Johansson Committed by David S. Miller

pasemi_mac: don't enable rx before there are buffers on the ring

pasemi_mac: don't enable rx before there are buffers on the ring

Reorder initialization of the DMA channels and the interface. Before there
was a time window when the interface was enabled before DMA was enabled.
Also, now there will always be RX buffers available at the time the
MAC interface is enabled, to avoid temporary out-of-buffer errors for the
very first packets (on busy networks).
Signed-off-by: default avatarOlof Johansson <olof@lixom.net>
Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
parent ca7e235f
...@@ -786,14 +786,6 @@ static int pasemi_mac_open(struct net_device *dev) ...@@ -786,14 +786,6 @@ static int pasemi_mac_open(struct net_device *dev)
write_mac_reg(mac, PAS_MAC_CFG_TXP, flags); write_mac_reg(mac, PAS_MAC_CFG_TXP, flags);
flags = PAS_MAC_CFG_PCFG_S1 | PAS_MAC_CFG_PCFG_PE |
PAS_MAC_CFG_PCFG_PR | PAS_MAC_CFG_PCFG_CE;
if (mac->type == MAC_TYPE_GMAC)
flags |= PAS_MAC_CFG_PCFG_TSR_1G | PAS_MAC_CFG_PCFG_SPD_1G;
else
flags |= PAS_MAC_CFG_PCFG_TSR_10G | PAS_MAC_CFG_PCFG_SPD_10G;
write_iob_reg(mac, PAS_IOB_DMA_RXCH_CFG(mac->dma_rxch), write_iob_reg(mac, PAS_IOB_DMA_RXCH_CFG(mac->dma_rxch),
PAS_IOB_DMA_RXCH_CFG_CNTTH(0)); PAS_IOB_DMA_RXCH_CFG_CNTTH(0));
...@@ -808,8 +800,6 @@ static int pasemi_mac_open(struct net_device *dev) ...@@ -808,8 +800,6 @@ static int pasemi_mac_open(struct net_device *dev)
write_iob_reg(mac, PAS_IOB_DMA_COM_TIMEOUTCFG, write_iob_reg(mac, PAS_IOB_DMA_COM_TIMEOUTCFG,
PAS_IOB_DMA_COM_TIMEOUTCFG_TCNT(0xffffff)); PAS_IOB_DMA_COM_TIMEOUTCFG_TCNT(0xffffff));
write_mac_reg(mac, PAS_MAC_CFG_PCFG, flags);
ret = pasemi_mac_setup_rx_resources(dev); ret = pasemi_mac_setup_rx_resources(dev);
if (ret) if (ret)
goto out_rx_resources; goto out_rx_resources;
...@@ -837,6 +827,17 @@ static int pasemi_mac_open(struct net_device *dev) ...@@ -837,6 +827,17 @@ static int pasemi_mac_open(struct net_device *dev)
pasemi_mac_replenish_rx_ring(dev); pasemi_mac_replenish_rx_ring(dev);
flags = PAS_MAC_CFG_PCFG_S1 | PAS_MAC_CFG_PCFG_PE |
PAS_MAC_CFG_PCFG_PR | PAS_MAC_CFG_PCFG_CE;
if (mac->type == MAC_TYPE_GMAC)
flags |= PAS_MAC_CFG_PCFG_TSR_1G | PAS_MAC_CFG_PCFG_SPD_1G;
else
flags |= PAS_MAC_CFG_PCFG_TSR_10G | PAS_MAC_CFG_PCFG_SPD_10G;
/* Enable interface in MAC */
write_mac_reg(mac, PAS_MAC_CFG_PCFG, flags);
ret = pasemi_mac_phy_init(dev); ret = pasemi_mac_phy_init(dev);
/* Some configs don't have PHYs (XAUI etc), so don't complain about /* Some configs don't have PHYs (XAUI etc), so don't complain about
* failed init due to -ENODEV. * failed init due to -ENODEV.
......
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