summaryrefslogtreecommitdiffstats
path: root/drivers/net/rtl8139.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/rtl8139.c')
-rw-r--r--drivers/net/rtl8139.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/net/rtl8139.c b/drivers/net/rtl8139.c
index e1c57e6b7c..5c91c10fea 100644
--- a/drivers/net/rtl8139.c
+++ b/drivers/net/rtl8139.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
#include <common.h>
#include <dma.h>
#include <net.h>
@@ -9,8 +10,6 @@
#include <linux/phy.h>
#include <linux/pci.h>
-#include <asm/dma-mapping.h>
-
#define RTL8139_DEBUG
#undef RTL8139_DEBUG
@@ -374,7 +373,6 @@ static int rtl8139_init_dev(struct eth_device *edev)
struct rtl8139_priv *priv = edev->priv;
rtl8139_chip_reset(priv);
- pci_set_master(priv->pci_dev);
return 0;
}
@@ -391,6 +389,8 @@ static int rtl8139_eth_open(struct eth_device *edev)
rtl8139_init_ring(priv);
rtl8139_hw_start(priv);
+ pci_set_master(priv->pci_dev);
+
ret = phy_device_connect(edev, &priv->miibus, 0, NULL, 0,
PHY_INTERFACE_MODE_NA);
@@ -409,6 +409,11 @@ static void rtl8139_eth_halt(struct eth_device *edev)
pci_clear_master(priv->pci_dev);
+ dma_free_coherent((void *)priv->tx_bufs, priv->tx_bufs_dma,
+ TX_BUF_TOT_LEN);
+ dma_free_coherent((void *)priv->rx_ring, priv->rx_ring_dma,
+ RX_BUF_TOT_LEN);
+
/* Green! Put the chip in low-power mode. */
RTL_W8(priv, Cfg9346, Cfg9346_Unlock);
}
@@ -530,7 +535,7 @@ static int rtl8139_probe(struct pci_dev *pdev, const struct pci_device_id *id)
struct eth_device *edev;
struct rtl8139_priv *priv;
int ret;
- struct device_d *dev = &pdev->dev;
+ struct device *dev = &pdev->dev;
/* enable pci device */
pci_enable_device(pdev);