Skip to contentSkip to conversation

r8169: remove firmware for RTL8169D PHY

PATCH In review Ben Hutchings 2 participants 3 messages Nov 1, 2009 – Nov 2, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 r8169: remove firmware for RTL8169D PHY

The recently added support for RTL8169D chips included some machine code without accompanying source code. Replace this with use of the firmware loader.

Compile-tested only.

---
Here's my attempt at the driver change. I leave it to you to work out licencing of the firmware blob.

Ben.

 drivers/net/Kconfig |    1 +
 drivers/net/r8169.c |  719 ++++-----------------------------------------------
 2 files changed, 47 insertions(+), 673 deletions(-)
drivers/net/Kconfig +1 -0
index e19ca4b..4395c1e 100644
@@ -2170,6 +2170,7 @@ config R8169
 	depends on PCI
 	select CRC32
 	select MII
+	select FW_LOADER
 	---help---
 	  Say Y here if you have a Realtek 8169 PCI Gigabit Ethernet adapter.
 
drivers/net/r8169.c +46 -673

774 lines not on this page · raw message

Signature · 1 line
1.6.5.2
#1 lore raw

PATCH 1/2 r8169: allow rtl_hw_phy_config() and rtl8169_init_phy() to return error codes

This is preparation for loading PHY firmware, which may fail.

---
This one belongs before the other. Sorry about sending them in the wrong order.

Ben.

 drivers/net/r8169.c |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)
drivers/net/r8169.c +13 -4
index f98ef52..8ceecd0 100644
@@ -2607,7 +2607,7 @@ static void rtl8102e_hw_phy_config(void __iomem *ioaddr)
 	rtl_phy_write(ioaddr, phy_reg_init, ARRAY_SIZE(phy_reg_init));
 }
 
-static void rtl_hw_phy_config(struct net_device *dev)
+static int rtl_hw_phy_config(struct net_device *dev)
 {
 	struct rtl8169_private *tp = netdev_priv(dev);
 	void __iomem *ioaddr = tp->mmio_addr;
@@ -2676,6 +2676,8 @@ static void rtl_hw_phy_config(struct net_device *dev)
 	default:
 		break;
 	}
+
+	return 0;
 }
 
 static void rtl8169_phy_timer(unsigned long __opaque)
@@ -2780,11 +2782,14 @@ static void rtl8169_phy_reset(struct net_device *dev,
 		printk(KERN_ERR "%s: PHY reset failed.\n", dev->name);
 }
 
-static void rtl8169_init_phy(struct net_device *dev, struct rtl8169_private *tp)
+static int rtl8169_init_phy(struct net_device *dev, struct rtl8169_private *tp)
 {
 	void __iomem *ioaddr = tp->mmio_addr;
+	int rc;
 
-	rtl_hw_phy_config(dev);
+	rc = rtl_hw_phy_config(dev);
+	if (rc)
+		return rc;
 
 	if (tp->mac_version <= RTL_GIGA_MAC_VER_06) {
 		dprintk("Set MAC Reg C+CR Offset 0x82h = 0x01h\n");
@@ -2813,6 +2818,8 @@ static void rtl8169_init_phy(struct net_device *dev, struct rtl8169_private *tp)
 
 	if ((RTL_R8(PHYstatus) & TBI_Enable) && netif_msg_link(tp))
 		printk(KERN_INFO PFX "%s: TBI auto-negotiating\n", dev->name);
+
+	return 0;
 }
 
 static void rtl_rar_set(struct rtl8169_private *tp, u8 *addr)
@@ -3199,7 +3206,9 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 		       dev->dev_addr[4], dev->dev_addr[5], xid, dev->irq);
 	}
 
-	rtl8169_init_phy(dev, tp);
+	rc = rtl8169_init_phy(dev, tp);
+	if (rc)
+		goto err_out_msi_5;
 
 	/*
 	 * Pretend we are using VLANs; This bypasses a nasty bug where
Signature · 1 line
1.6.5.2
maintainer
#2 lore raw
In reply to Ben Hutchings

From: Ben Hutchings <[email protected]>
Date: Sun, 01 Nov 2009 22:48:07 +0000

Quoted 10 lines

The recently added support for RTL8169D chips included some machine code without accompanying source code. Replace this with use of the firmware loader.

Compile-tested only.

---
Here's my attempt at the driver change. I leave it to you to work out licencing of the firmware blob.

I'm not even looking at this patch until you do some research and substantiate your claims about what this thing is doing.