diff options
author | blogic <blogic@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2012-11-12 21:35:01 +0000 |
---|---|---|
committer | blogic <blogic@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2012-11-12 21:35:01 +0000 |
commit | 127682ebab01d720d5e90a6db1bb8a00036bcfef (patch) | |
tree | 698561f37ddeae12858a25d0e09bebf4a0223d48 /target | |
parent | 88e6c931a0769f42be984929e72635ebea532d3c (diff) |
[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
Diffstat (limited to 'target')
-rw-r--r-- | target/linux/ramips/files/drivers/net/ethernet/ramips/ramips_main.c | 46 | ||||
-rw-r--r-- | target/linux/ramips/image/Makefile | 6 |
2 files changed, 32 insertions, 20 deletions
diff --git a/target/linux/ramips/files/drivers/net/ethernet/ramips/ramips_main.c b/target/linux/ramips/files/drivers/net/ethernet/ramips/ramips_main.c index f08655383..b6c72b8a8 100644 --- a/target/linux/ramips/files/drivers/net/ethernet/ramips/ramips_main.c +++ b/target/linux/ramips/files/drivers/net/ethernet/ramips/ramips_main.c @@ -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,15 +973,28 @@ 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) { struct raeth_priv *re = netdev_priv(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 = { diff --git a/target/linux/ramips/image/Makefile b/target/linux/ramips/image/Makefile index 6509e2dea..5dd693833 100644 --- a/target/linux/ramips/image/Makefile +++ b/target/linux/ramips/image/Makefile @@ -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 |