|
@@ -1277,6 +1277,96 @@ static void stmmac_mac_enable_rx_queues(struct stmmac_priv *priv)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+/**
|
|
|
|
+ * stmmac_start_rx_dma - start RX DMA channel
|
|
|
|
+ * @priv: driver private structure
|
|
|
|
+ * @chan: RX channel index
|
|
|
|
+ * Description:
|
|
|
|
+ * This starts a RX DMA channel
|
|
|
|
+ */
|
|
|
|
+static void stmmac_start_rx_dma(struct stmmac_priv *priv, u32 chan)
|
|
|
|
+{
|
|
|
|
+ netdev_dbg(priv->dev, "DMA RX processes started in channel %d\n", chan);
|
|
|
|
+ priv->hw->dma->start_rx(priv->ioaddr, chan);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * stmmac_start_tx_dma - start TX DMA channel
|
|
|
|
+ * @priv: driver private structure
|
|
|
|
+ * @chan: TX channel index
|
|
|
|
+ * Description:
|
|
|
|
+ * This starts a TX DMA channel
|
|
|
|
+ */
|
|
|
|
+static void stmmac_start_tx_dma(struct stmmac_priv *priv, u32 chan)
|
|
|
|
+{
|
|
|
|
+ netdev_dbg(priv->dev, "DMA TX processes started in channel %d\n", chan);
|
|
|
|
+ priv->hw->dma->start_tx(priv->ioaddr, chan);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * stmmac_stop_rx_dma - stop RX DMA channel
|
|
|
|
+ * @priv: driver private structure
|
|
|
|
+ * @chan: RX channel index
|
|
|
|
+ * Description:
|
|
|
|
+ * This stops a RX DMA channel
|
|
|
|
+ */
|
|
|
|
+static void stmmac_stop_rx_dma(struct stmmac_priv *priv, u32 chan)
|
|
|
|
+{
|
|
|
|
+ netdev_dbg(priv->dev, "DMA RX processes stopped in channel %d\n", chan);
|
|
|
|
+ priv->hw->dma->stop_rx(priv->ioaddr, chan);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * stmmac_stop_tx_dma - stop TX DMA channel
|
|
|
|
+ * @priv: driver private structure
|
|
|
|
+ * @chan: TX channel index
|
|
|
|
+ * Description:
|
|
|
|
+ * This stops a TX DMA channel
|
|
|
|
+ */
|
|
|
|
+static void stmmac_stop_tx_dma(struct stmmac_priv *priv, u32 chan)
|
|
|
|
+{
|
|
|
|
+ netdev_dbg(priv->dev, "DMA TX processes stopped in channel %d\n", chan);
|
|
|
|
+ priv->hw->dma->stop_tx(priv->ioaddr, chan);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * stmmac_start_all_dma - start all RX and TX DMA channels
|
|
|
|
+ * @priv: driver private structure
|
|
|
|
+ * Description:
|
|
|
|
+ * This starts all the RX and TX DMA channels
|
|
|
|
+ */
|
|
|
|
+static void stmmac_start_all_dma(struct stmmac_priv *priv)
|
|
|
|
+{
|
|
|
|
+ u32 rx_channels_count = priv->plat->rx_queues_to_use;
|
|
|
|
+ u32 tx_channels_count = priv->plat->tx_queues_to_use;
|
|
|
|
+ u32 chan = 0;
|
|
|
|
+
|
|
|
|
+ for (chan = 0; chan < rx_channels_count; chan++)
|
|
|
|
+ stmmac_start_rx_dma(priv, chan);
|
|
|
|
+
|
|
|
|
+ for (chan = 0; chan < tx_channels_count; chan++)
|
|
|
|
+ stmmac_start_tx_dma(priv, chan);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * stmmac_stop_all_dma - stop all RX and TX DMA channels
|
|
|
|
+ * @priv: driver private structure
|
|
|
|
+ * Description:
|
|
|
|
+ * This stops the RX and TX DMA channels
|
|
|
|
+ */
|
|
|
|
+static void stmmac_stop_all_dma(struct stmmac_priv *priv)
|
|
|
|
+{
|
|
|
|
+ u32 rx_channels_count = priv->plat->rx_queues_to_use;
|
|
|
|
+ u32 tx_channels_count = priv->plat->tx_queues_to_use;
|
|
|
|
+ u32 chan = 0;
|
|
|
|
+
|
|
|
|
+ for (chan = 0; chan < rx_channels_count; chan++)
|
|
|
|
+ stmmac_stop_rx_dma(priv, chan);
|
|
|
|
+
|
|
|
|
+ for (chan = 0; chan < tx_channels_count; chan++)
|
|
|
|
+ stmmac_stop_tx_dma(priv, chan);
|
|
|
|
+}
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* stmmac_dma_operation_mode - HW DMA operation mode
|
|
* stmmac_dma_operation_mode - HW DMA operation mode
|
|
* @priv: driver private structure
|
|
* @priv: driver private structure
|
|
@@ -1440,10 +1530,11 @@ static inline void stmmac_disable_dma_irq(struct stmmac_priv *priv, u32 chan)
|
|
*/
|
|
*/
|
|
static void stmmac_tx_err(struct stmmac_priv *priv)
|
|
static void stmmac_tx_err(struct stmmac_priv *priv)
|
|
{
|
|
{
|
|
|
|
+ u32 chan = STMMAC_CHAN0;
|
|
int i;
|
|
int i;
|
|
netif_stop_queue(priv->dev);
|
|
netif_stop_queue(priv->dev);
|
|
|
|
|
|
- priv->hw->dma->stop_tx(priv->ioaddr);
|
|
|
|
|
|
+ stmmac_stop_tx_dma(priv, chan);
|
|
dma_free_tx_skbufs(priv);
|
|
dma_free_tx_skbufs(priv);
|
|
for (i = 0; i < DMA_TX_SIZE; i++)
|
|
for (i = 0; i < DMA_TX_SIZE; i++)
|
|
if (priv->extend_desc)
|
|
if (priv->extend_desc)
|
|
@@ -1457,7 +1548,7 @@ static void stmmac_tx_err(struct stmmac_priv *priv)
|
|
priv->dirty_tx = 0;
|
|
priv->dirty_tx = 0;
|
|
priv->cur_tx = 0;
|
|
priv->cur_tx = 0;
|
|
netdev_reset_queue(priv->dev);
|
|
netdev_reset_queue(priv->dev);
|
|
- priv->hw->dma->start_tx(priv->ioaddr);
|
|
|
|
|
|
+ stmmac_start_tx_dma(priv, chan);
|
|
|
|
|
|
priv->dev->stats.tx_errors++;
|
|
priv->dev->stats.tx_errors++;
|
|
netif_wake_queue(priv->dev);
|
|
netif_wake_queue(priv->dev);
|
|
@@ -1882,9 +1973,7 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp)
|
|
__func__);
|
|
__func__);
|
|
#endif
|
|
#endif
|
|
/* Start the ball rolling... */
|
|
/* Start the ball rolling... */
|
|
- netdev_dbg(priv->dev, "DMA RX/TX processes started...\n");
|
|
|
|
- priv->hw->dma->start_tx(priv->ioaddr);
|
|
|
|
- priv->hw->dma->start_rx(priv->ioaddr);
|
|
|
|
|
|
+ stmmac_start_all_dma(priv);
|
|
|
|
|
|
priv->tx_lpi_timer = STMMAC_DEFAULT_TWT_LS;
|
|
priv->tx_lpi_timer = STMMAC_DEFAULT_TWT_LS;
|
|
|
|
|
|
@@ -2070,8 +2159,7 @@ static int stmmac_release(struct net_device *dev)
|
|
free_irq(priv->lpi_irq, dev);
|
|
free_irq(priv->lpi_irq, dev);
|
|
|
|
|
|
/* Stop TX/RX DMA and clear the descriptors */
|
|
/* Stop TX/RX DMA and clear the descriptors */
|
|
- priv->hw->dma->stop_tx(priv->ioaddr);
|
|
|
|
- priv->hw->dma->stop_rx(priv->ioaddr);
|
|
|
|
|
|
+ stmmac_stop_all_dma(priv);
|
|
|
|
|
|
/* Release and free the Rx/Tx resources */
|
|
/* Release and free the Rx/Tx resources */
|
|
free_dma_desc_resources(priv);
|
|
free_dma_desc_resources(priv);
|
|
@@ -3546,8 +3634,7 @@ int stmmac_dvr_remove(struct device *dev)
|
|
|
|
|
|
netdev_info(priv->dev, "%s: removing driver", __func__);
|
|
netdev_info(priv->dev, "%s: removing driver", __func__);
|
|
|
|
|
|
- priv->hw->dma->stop_rx(priv->ioaddr);
|
|
|
|
- priv->hw->dma->stop_tx(priv->ioaddr);
|
|
|
|
|
|
+ stmmac_stop_all_dma(priv);
|
|
|
|
|
|
stmmac_set_mac(priv->ioaddr, false);
|
|
stmmac_set_mac(priv->ioaddr, false);
|
|
netif_carrier_off(ndev);
|
|
netif_carrier_off(ndev);
|
|
@@ -3593,8 +3680,7 @@ int stmmac_suspend(struct device *dev)
|
|
napi_disable(&priv->napi);
|
|
napi_disable(&priv->napi);
|
|
|
|
|
|
/* Stop TX/RX DMA */
|
|
/* Stop TX/RX DMA */
|
|
- priv->hw->dma->stop_tx(priv->ioaddr);
|
|
|
|
- priv->hw->dma->stop_rx(priv->ioaddr);
|
|
|
|
|
|
+ stmmac_stop_all_dma(priv);
|
|
|
|
|
|
/* Enable Power down mode by programming the PMT regs */
|
|
/* Enable Power down mode by programming the PMT regs */
|
|
if (device_may_wakeup(priv->device)) {
|
|
if (device_may_wakeup(priv->device)) {
|