diff options
Diffstat (limited to 'drivers/net/stmmac')
-rw-r--r-- | drivers/net/stmmac/dwmac_lib.c | 28 | ||||
-rw-r--r-- | drivers/net/stmmac/norm_desc.c | 2 | ||||
-rw-r--r-- | drivers/net/stmmac/stmmac_main.c | 49 |
3 files changed, 43 insertions, 36 deletions
diff --git a/drivers/net/stmmac/dwmac_lib.c b/drivers/net/stmmac/dwmac_lib.c index d65fab1ba790..e25093510b0c 100644 --- a/drivers/net/stmmac/dwmac_lib.c +++ b/drivers/net/stmmac/dwmac_lib.c | |||
@@ -26,9 +26,9 @@ | |||
26 | 26 | ||
27 | #undef DWMAC_DMA_DEBUG | 27 | #undef DWMAC_DMA_DEBUG |
28 | #ifdef DWMAC_DMA_DEBUG | 28 | #ifdef DWMAC_DMA_DEBUG |
29 | #define DBG(fmt, args...) printk(fmt, ## args) | 29 | #define DWMAC_LIB_DBG(fmt, args...) printk(fmt, ## args) |
30 | #else | 30 | #else |
31 | #define DBG(fmt, args...) do { } while (0) | 31 | #define DWMAC_LIB_DBG(fmt, args...) do { } while (0) |
32 | #endif | 32 | #endif |
33 | 33 | ||
34 | /* CSR1 enables the transmit DMA to check for new descriptor */ | 34 | /* CSR1 enables the transmit DMA to check for new descriptor */ |
@@ -152,7 +152,7 @@ int dwmac_dma_interrupt(void __iomem *ioaddr, | |||
152 | /* read the status register (CSR5) */ | 152 | /* read the status register (CSR5) */ |
153 | u32 intr_status = readl(ioaddr + DMA_STATUS); | 153 | u32 intr_status = readl(ioaddr + DMA_STATUS); |
154 | 154 | ||
155 | DBG(INFO, "%s: [CSR5: 0x%08x]\n", __func__, intr_status); | 155 | DWMAC_LIB_DBG(KERN_INFO "%s: [CSR5: 0x%08x]\n", __func__, intr_status); |
156 | #ifdef DWMAC_DMA_DEBUG | 156 | #ifdef DWMAC_DMA_DEBUG |
157 | /* It displays the DMA process states (CSR5 register) */ | 157 | /* It displays the DMA process states (CSR5 register) */ |
158 | show_tx_process_state(intr_status); | 158 | show_tx_process_state(intr_status); |
@@ -160,43 +160,43 @@ int dwmac_dma_interrupt(void __iomem *ioaddr, | |||
160 | #endif | 160 | #endif |
161 | /* ABNORMAL interrupts */ | 161 | /* ABNORMAL interrupts */ |
162 | if (unlikely(intr_status & DMA_STATUS_AIS)) { | 162 | if (unlikely(intr_status & DMA_STATUS_AIS)) { |
163 | DBG(INFO, "CSR5[15] DMA ABNORMAL IRQ: "); | 163 | DWMAC_LIB_DBG(KERN_INFO "CSR5[15] DMA ABNORMAL IRQ: "); |
164 | if (unlikely(intr_status & DMA_STATUS_UNF)) { | 164 | if (unlikely(intr_status & DMA_STATUS_UNF)) { |
165 | DBG(INFO, "transmit underflow\n"); | 165 | DWMAC_LIB_DBG(KERN_INFO "transmit underflow\n"); |
166 | ret = tx_hard_error_bump_tc; | 166 | ret = tx_hard_error_bump_tc; |
167 | x->tx_undeflow_irq++; | 167 | x->tx_undeflow_irq++; |
168 | } | 168 | } |
169 | if (unlikely(intr_status & DMA_STATUS_TJT)) { | 169 | if (unlikely(intr_status & DMA_STATUS_TJT)) { |
170 | DBG(INFO, "transmit jabber\n"); | 170 | DWMAC_LIB_DBG(KERN_INFO "transmit jabber\n"); |
171 | x->tx_jabber_irq++; | 171 | x->tx_jabber_irq++; |
172 | } | 172 | } |
173 | if (unlikely(intr_status & DMA_STATUS_OVF)) { | 173 | if (unlikely(intr_status & DMA_STATUS_OVF)) { |
174 | DBG(INFO, "recv overflow\n"); | 174 | DWMAC_LIB_DBG(KERN_INFO "recv overflow\n"); |
175 | x->rx_overflow_irq++; | 175 | x->rx_overflow_irq++; |
176 | } | 176 | } |
177 | if (unlikely(intr_status & DMA_STATUS_RU)) { | 177 | if (unlikely(intr_status & DMA_STATUS_RU)) { |
178 | DBG(INFO, "receive buffer unavailable\n"); | 178 | DWMAC_LIB_DBG(KERN_INFO "receive buffer unavailable\n"); |
179 | x->rx_buf_unav_irq++; | 179 | x->rx_buf_unav_irq++; |
180 | } | 180 | } |
181 | if (unlikely(intr_status & DMA_STATUS_RPS)) { | 181 | if (unlikely(intr_status & DMA_STATUS_RPS)) { |
182 | DBG(INFO, "receive process stopped\n"); | 182 | DWMAC_LIB_DBG(KERN_INFO "receive process stopped\n"); |
183 | x->rx_process_stopped_irq++; | 183 | x->rx_process_stopped_irq++; |
184 | } | 184 | } |
185 | if (unlikely(intr_status & DMA_STATUS_RWT)) { | 185 | if (unlikely(intr_status & DMA_STATUS_RWT)) { |
186 | DBG(INFO, "receive watchdog\n"); | 186 | DWMAC_LIB_DBG(KERN_INFO "receive watchdog\n"); |
187 | x->rx_watchdog_irq++; | 187 | x->rx_watchdog_irq++; |
188 | } | 188 | } |
189 | if (unlikely(intr_status & DMA_STATUS_ETI)) { | 189 | if (unlikely(intr_status & DMA_STATUS_ETI)) { |
190 | DBG(INFO, "transmit early interrupt\n"); | 190 | DWMAC_LIB_DBG(KERN_INFO "transmit early interrupt\n"); |
191 | x->tx_early_irq++; | 191 | x->tx_early_irq++; |
192 | } | 192 | } |
193 | if (unlikely(intr_status & DMA_STATUS_TPS)) { | 193 | if (unlikely(intr_status & DMA_STATUS_TPS)) { |
194 | DBG(INFO, "transmit process stopped\n"); | 194 | DWMAC_LIB_DBG(KERN_INFO "transmit process stopped\n"); |
195 | x->tx_process_stopped_irq++; | 195 | x->tx_process_stopped_irq++; |
196 | ret = tx_hard_error; | 196 | ret = tx_hard_error; |
197 | } | 197 | } |
198 | if (unlikely(intr_status & DMA_STATUS_FBI)) { | 198 | if (unlikely(intr_status & DMA_STATUS_FBI)) { |
199 | DBG(INFO, "fatal bus error\n"); | 199 | DWMAC_LIB_DBG(KERN_INFO "fatal bus error\n"); |
200 | x->fatal_bus_error_irq++; | 200 | x->fatal_bus_error_irq++; |
201 | ret = tx_hard_error; | 201 | ret = tx_hard_error; |
202 | } | 202 | } |
@@ -215,7 +215,7 @@ int dwmac_dma_interrupt(void __iomem *ioaddr, | |||
215 | /* Clear the interrupt by writing a logic 1 to the CSR5[15-0] */ | 215 | /* Clear the interrupt by writing a logic 1 to the CSR5[15-0] */ |
216 | writel((intr_status & 0x1ffff), ioaddr + DMA_STATUS); | 216 | writel((intr_status & 0x1ffff), ioaddr + DMA_STATUS); |
217 | 217 | ||
218 | DBG(INFO, "\n\n"); | 218 | DWMAC_LIB_DBG(KERN_INFO "\n\n"); |
219 | return ret; | 219 | return ret; |
220 | } | 220 | } |
221 | 221 | ||
diff --git a/drivers/net/stmmac/norm_desc.c b/drivers/net/stmmac/norm_desc.c index cd0cc76f7a1c..029c2a2cf524 100644 --- a/drivers/net/stmmac/norm_desc.c +++ b/drivers/net/stmmac/norm_desc.c | |||
@@ -67,7 +67,7 @@ static int ndesc_get_tx_len(struct dma_desc *p) | |||
67 | 67 | ||
68 | /* This function verifies if each incoming frame has some errors | 68 | /* This function verifies if each incoming frame has some errors |
69 | * and, if required, updates the multicast statistics. | 69 | * and, if required, updates the multicast statistics. |
70 | * In case of success, it returns csum_none becasue the device | 70 | * In case of success, it returns csum_none because the device |
71 | * is not able to compute the csum in HW. */ | 71 | * is not able to compute the csum in HW. */ |
72 | static int ndesc_get_rx_status(void *data, struct stmmac_extra_stats *x, | 72 | static int ndesc_get_rx_status(void *data, struct stmmac_extra_stats *x, |
73 | struct dma_desc *p) | 73 | struct dma_desc *p) |
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 | |||
881 | open_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 | /** |