1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-12-28 09:43:21 +02:00

[ramips] move ethernet hw init to init/uninit functions

This should fix the stalled irq problem seen by several people.
This is not the real fix, but rather moves the bug to the un/init patch of the driver.
The real bug still needs to be fixed, but this workaround should be suffcient to make
the ethernet stable.

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@34177 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
blogic 2012-11-12 21:35:01 +00:00
parent 88e6c931a0
commit 127682ebab
2 changed files with 32 additions and 20 deletions

View File

@ -927,7 +927,7 @@ ramips_eth_irq(int irq, void *dev)
}
static int
ramips_eth_open(struct net_device *dev)
ramips_eth_hw_init(struct net_device *dev)
{
struct raeth_priv *re = netdev_priv(dev);
int err;
@ -945,10 +945,6 @@ ramips_eth_open(struct net_device *dev)
ramips_hw_set_macaddr(dev->dev_addr);
ramips_setup_dma(re);
ramips_fe_twr((ramips_fe_trr(RAETH_REG_PDMA_GLO_CFG) & 0xff) |
(RAMIPS_TX_WB_DDONE | RAMIPS_RX_DMA_EN |
RAMIPS_TX_DMA_EN | RAMIPS_PDMA_SIZE_4DWORDS),
RAETH_REG_PDMA_GLO_CFG);
ramips_fe_wr((ramips_fe_rr(RAMIPS_FE_GLO_CFG) &
~(RAMIPS_US_CYC_CNT_MASK << RAMIPS_US_CYC_CNT_SHIFT)) |
((re->plat->sys_freq / RAMIPS_US_CYC_CNT_DIVISOR) << RAMIPS_US_CYC_CNT_SHIFT),
@ -958,7 +954,6 @@ ramips_eth_open(struct net_device *dev)
(unsigned long)dev);
tasklet_init(&re->rx_tasklet, ramips_eth_rx_hw, (unsigned long)dev);
ramips_phy_start(re);
ramips_fe_twr(RAMIPS_DELAY_INIT, RAETH_REG_DLY_INT_CFG);
ramips_fe_twr(TX_DLY_INT | RX_DLY_INT, RAETH_REG_FE_INT_ENABLE);
@ -978,14 +973,27 @@ ramips_eth_open(struct net_device *dev)
ramips_fe_wr(1, RAMIPS_FE_RST_GL);
ramips_fe_wr(0, RAMIPS_FE_RST_GL);
netif_start_queue(dev);
return 0;
err_free_irq:
err_free_irq:
free_irq(dev->irq, dev);
return err;
}
static int
ramips_eth_open(struct net_device *dev)
{
struct raeth_priv *re = netdev_priv(dev);
ramips_fe_twr((ramips_fe_trr(RAETH_REG_PDMA_GLO_CFG) & 0xff) |
(RAMIPS_TX_WB_DDONE | RAMIPS_RX_DMA_EN |
RAMIPS_TX_DMA_EN | RAMIPS_PDMA_SIZE_4DWORDS),
RAETH_REG_PDMA_GLO_CFG);
ramips_phy_start(re);
netif_start_queue(dev);
return 0;
}
static int
ramips_eth_stop(struct net_device *dev)
{
@ -995,16 +1003,8 @@ ramips_eth_stop(struct net_device *dev)
~(RAMIPS_TX_WB_DDONE | RAMIPS_RX_DMA_EN | RAMIPS_TX_DMA_EN),
RAETH_REG_PDMA_GLO_CFG);
/* disable all interrupts in the hw */
ramips_fe_twr(0, RAETH_REG_FE_INT_ENABLE);
ramips_phy_stop(re);
free_irq(dev->irq, dev);
netif_stop_queue(dev);
tasklet_kill(&re->tx_housekeeping_tasklet);
tasklet_kill(&re->rx_tasklet);
ramips_ring_cleanup(re);
ramips_ring_free(re);
ramips_phy_stop(re);
RADEBUG("ramips_eth: stopped\n");
return 0;
}
@ -1038,8 +1038,14 @@ ramips_eth_probe(struct net_device *dev)
if (err)
goto err_phy_disconnect;
err = ramips_eth_hw_init(dev);
if (err)
goto err_debugfs;
return 0;
err_debugfs:
raeth_debugfs_exit(re);
err_phy_disconnect:
ramips_phy_disconnect(re);
err_mdio_cleanup:
@ -1055,6 +1061,12 @@ ramips_eth_uninit(struct net_device *dev)
raeth_debugfs_exit(re);
ramips_phy_disconnect(re);
ramips_mdio_cleanup(re);
ramips_fe_twr(0, RAETH_REG_FE_INT_ENABLE);
free_irq(dev->irq, dev);
tasklet_kill(&re->tx_housekeeping_tasklet);
tasklet_kill(&re->rx_tasklet);
ramips_ring_cleanup(re);
ramips_ring_free(re);
}
static const struct net_device_ops ramips_eth_netdev_ops = {

View File

@ -126,9 +126,9 @@ define BuildFirmware/GENERIC_4M/initramfs
$(call BuildFirmware/Generic/initramfs,$(1),$(2),$(call mkcmdline,$(3),$(4),$(5)) $(call mkmtd/$(6),$(mtdlayout_4M)))
endef
mtdlayout_8M=192k(u-boot)ro,64k(u-boot-env)ro,64k(factory)ro,896k(kernel),6976k(rootfs),7872k@0x50000(firmware)
kernel_size_8M=917504
rootfs_size_8M=7143424
mtdlayout_8M=192k(u-boot)ro,64k(u-boot-env)ro,64k(factory)ro,960k(kernel),6912k(rootfs),7808k@0x50000(firmware)
kernel_size_8M=983040
rootfs_size_8M=7077888
define BuildFirmware/GENERIC_8M
$(call BuildFirmware/Generic,$(1),$(2),$(call mkcmdline,$(3),$(4),$(5)) $(call mkmtd/$(6),$(mtdlayout_8M)),$(kernel_size_8M),$(rootfs_size_8M))
endef