mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] net: rtl8139: remove dependence on MIPS
@ 2023-02-08  8:13 Denis Orlov
  2023-02-08  8:13 ` [PATCH 2/2] net: rtl8139: fix ifdown/ifup issues Denis Orlov
  2023-02-08  8:37 ` [PATCH 1/2] net: rtl8139: remove dependence on MIPS Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Denis Orlov @ 2023-02-08  8:13 UTC (permalink / raw)
  To: barebox; +Cc: Denis Orlov

This driver seems to work fine on ARM64 Virtual Machine in QEMU.

Signed-off-by: Denis Orlov <denorl2009@gmail.com>
---
 drivers/net/Kconfig   | 1 -
 drivers/net/rtl8139.c | 2 --
 2 files changed, 3 deletions(-)

diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 30de1f544c..86096c07e2 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -232,7 +232,6 @@ config DRIVER_NET_ORION
 config DRIVER_NET_RTL8139
 	bool "RealTek RTL-8139 PCI Ethernet driver"
 	depends on PCI
-	depends on MIPS
 	select PHYLIB
 	help
 	  This is a driver for the Fast Ethernet PCI network cards based on
diff --git a/drivers/net/rtl8139.c b/drivers/net/rtl8139.c
index bea888f08d..617a60bfcb 100644
--- a/drivers/net/rtl8139.c
+++ b/drivers/net/rtl8139.c
@@ -10,8 +10,6 @@
 #include <linux/phy.h>
 #include <linux/pci.h>
 
-#include <asm/dma-mapping.h>
-
 #define RTL8139_DEBUG
 #undef RTL8139_DEBUG
 
-- 
2.30.2




^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/2] net: rtl8139: fix ifdown/ifup issues
  2023-02-08  8:13 [PATCH 1/2] net: rtl8139: remove dependence on MIPS Denis Orlov
@ 2023-02-08  8:13 ` Denis Orlov
  2023-02-08  8:37 ` [PATCH 1/2] net: rtl8139: remove dependence on MIPS Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Denis Orlov @ 2023-02-08  8:13 UTC (permalink / raw)
  To: barebox; +Cc: Denis Orlov

This moves PCI bus-mastering enable from 'init' to 'open', allowing to
bring an interface up after bringing it down. Also add corresponding
dma_free_coherent() calls into 'close', getting rid of memory leaks.

Signed-off-by: Denis Orlov <denorl2009@gmail.com>
---
 drivers/net/rtl8139.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/net/rtl8139.c b/drivers/net/rtl8139.c
index 617a60bfcb..1cd2ae14de 100644
--- a/drivers/net/rtl8139.c
+++ b/drivers/net/rtl8139.c
@@ -373,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;
 }
@@ -390,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);
 
@@ -408,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,
+			  TX_BUF_TOT_LEN);
+
 	/* Green! Put the chip in low-power mode. */
 	RTL_W8(priv, Cfg9346, Cfg9346_Unlock);
 }
-- 
2.30.2




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] net: rtl8139: remove dependence on MIPS
  2023-02-08  8:13 [PATCH 1/2] net: rtl8139: remove dependence on MIPS Denis Orlov
  2023-02-08  8:13 ` [PATCH 2/2] net: rtl8139: fix ifdown/ifup issues Denis Orlov
@ 2023-02-08  8:37 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2023-02-08  8:37 UTC (permalink / raw)
  To: Denis Orlov; +Cc: barebox

On Wed, Feb 08, 2023 at 11:13:06AM +0300, Denis Orlov wrote:
> This driver seems to work fine on ARM64 Virtual Machine in QEMU.
> 
> Signed-off-by: Denis Orlov <denorl2009@gmail.com>
> ---
>  drivers/net/Kconfig   | 1 -
>  drivers/net/rtl8139.c | 2 --
>  2 files changed, 3 deletions(-)

Applied including the fixup!

Thanks,
 Sascha

> 
> diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
> index 30de1f544c..86096c07e2 100644
> --- a/drivers/net/Kconfig
> +++ b/drivers/net/Kconfig
> @@ -232,7 +232,6 @@ config DRIVER_NET_ORION
>  config DRIVER_NET_RTL8139
>  	bool "RealTek RTL-8139 PCI Ethernet driver"
>  	depends on PCI
> -	depends on MIPS
>  	select PHYLIB
>  	help
>  	  This is a driver for the Fast Ethernet PCI network cards based on
> diff --git a/drivers/net/rtl8139.c b/drivers/net/rtl8139.c
> index bea888f08d..617a60bfcb 100644
> --- a/drivers/net/rtl8139.c
> +++ b/drivers/net/rtl8139.c
> @@ -10,8 +10,6 @@
>  #include <linux/phy.h>
>  #include <linux/pci.h>
>  
> -#include <asm/dma-mapping.h>
> -
>  #define RTL8139_DEBUG
>  #undef RTL8139_DEBUG
>  
> -- 
> 2.30.2
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-02-08  8:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-08  8:13 [PATCH 1/2] net: rtl8139: remove dependence on MIPS Denis Orlov
2023-02-08  8:13 ` [PATCH 2/2] net: rtl8139: fix ifdown/ifup issues Denis Orlov
2023-02-08  8:37 ` [PATCH 1/2] net: rtl8139: remove dependence on MIPS Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox