aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/stmmac/stmmac_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/stmmac/stmmac_main.c')
-rw-r--r--drivers/net/stmmac/stmmac_main.c49
1 files changed, 28 insertions, 21 deletions
diff --git a/drivers/net/stmmac/stmmac_main.c b/drivers/net/stmmac/stmmac_main.c
index 62fa51ed93ff..ba9daeccb8af 100644
--- a/drivers/net/stmmac/stmmac_main.c
+++ b/drivers/net/stmmac/stmmac_main.c
@@ -749,7 +749,6 @@ static void stmmac_dma_interrupt(struct stmmac_priv *priv)
749 priv->hw->dma->dma_mode(priv->ioaddr, tc, SF_DMA_MODE); 749 priv->hw->dma->dma_mode(priv->ioaddr, tc, SF_DMA_MODE);
750 priv->xstats.threshold = tc; 750 priv->xstats.threshold = tc;
751 } 751 }
752 stmmac_tx_err(priv);
753 } else if (unlikely(status == tx_hard_error)) 752 } else if (unlikely(status == tx_hard_error))
754 stmmac_tx_err(priv); 753 stmmac_tx_err(priv);
755} 754}
@@ -780,21 +779,6 @@ static int stmmac_open(struct net_device *dev)
780 779
781 stmmac_verify_args(); 780 stmmac_verify_args();
782 781
783 ret = stmmac_init_phy(dev);
784 if (unlikely(ret)) {
785 pr_err("%s: Cannot attach to PHY (error: %d)\n", __func__, ret);
786 return ret;
787 }
788
789 /* Request the IRQ lines */
790 ret = request_irq(dev->irq, stmmac_interrupt,
791 IRQF_SHARED, dev->name, dev);
792 if (unlikely(ret < 0)) {
793 pr_err("%s: ERROR: allocating the IRQ %d (error: %d)\n",
794 __func__, dev->irq, ret);
795 return ret;
796 }
797
798#ifdef CONFIG_STMMAC_TIMER 782#ifdef CONFIG_STMMAC_TIMER
799 priv->tm = kzalloc(sizeof(struct stmmac_timer *), GFP_KERNEL); 783 priv->tm = kzalloc(sizeof(struct stmmac_timer *), GFP_KERNEL);
800 if (unlikely(priv->tm == NULL)) { 784 if (unlikely(priv->tm == NULL)) {
@@ -813,6 +797,11 @@ static int stmmac_open(struct net_device *dev)
813 } else 797 } else
814 priv->tm->enable = 1; 798 priv->tm->enable = 1;
815#endif 799#endif
800 ret = stmmac_init_phy(dev);
801 if (unlikely(ret)) {
802 pr_err("%s: Cannot attach to PHY (error: %d)\n", __func__, ret);
803 goto open_error;
804 }
816 805
817 /* Create and initialize the TX/RX descriptors chains. */ 806 /* Create and initialize the TX/RX descriptors chains. */
818 priv->dma_tx_size = STMMAC_ALIGN(dma_txsize); 807 priv->dma_tx_size = STMMAC_ALIGN(dma_txsize);
@@ -821,12 +810,11 @@ static int stmmac_open(struct net_device *dev)
821 init_dma_desc_rings(dev); 810 init_dma_desc_rings(dev);
822 811
823 /* DMA initialization and SW reset */ 812 /* DMA initialization and SW reset */
824 if (unlikely(priv->hw->dma->init(priv->ioaddr, priv->plat->pbl, 813 ret = priv->hw->dma->init(priv->ioaddr, priv->plat->pbl,
825 priv->dma_tx_phy, 814 priv->dma_tx_phy, priv->dma_rx_phy);
826 priv->dma_rx_phy) < 0)) { 815 if (ret < 0) {
827
828 pr_err("%s: DMA initialization failed\n", __func__); 816 pr_err("%s: DMA initialization failed\n", __func__);
829 return -1; 817 goto open_error;
830 } 818 }
831 819
832 /* Copy the MAC addr into the HW */ 820 /* Copy the MAC addr into the HW */
@@ -848,6 +836,15 @@ static int stmmac_open(struct net_device *dev)
848 writel(0xffffffff, priv->ioaddr + MMC_HIGH_INTR_MASK); 836 writel(0xffffffff, priv->ioaddr + MMC_HIGH_INTR_MASK);
849 writel(0xffffffff, priv->ioaddr + MMC_LOW_INTR_MASK); 837 writel(0xffffffff, priv->ioaddr + MMC_LOW_INTR_MASK);
850 838
839 /* Request the IRQ lines */
840 ret = request_irq(dev->irq, stmmac_interrupt,
841 IRQF_SHARED, dev->name, dev);
842 if (unlikely(ret < 0)) {
843 pr_err("%s: ERROR: allocating the IRQ %d (error: %d)\n",
844 __func__, dev->irq, ret);
845 goto open_error;
846 }
847
851 /* Enable the MAC Rx/Tx */ 848 /* Enable the MAC Rx/Tx */
852 stmmac_enable_mac(priv->ioaddr); 849 stmmac_enable_mac(priv->ioaddr);
853 850
@@ -878,7 +875,17 @@ static int stmmac_open(struct net_device *dev)
878 napi_enable(&priv->napi); 875 napi_enable(&priv->napi);
879 skb_queue_head_init(&priv->rx_recycle); 876 skb_queue_head_init(&priv->rx_recycle);
880 netif_start_queue(dev); 877 netif_start_queue(dev);
878
881 return 0; 879 return 0;
880
881open_error:
882#ifdef CONFIG_STMMAC_TIMER
883 kfree(priv->tm);
884#endif
885 if (priv->phydev)
886 phy_disconnect(priv->phydev);
887
888 return ret;
882} 889}
883 890
884/** 891/**