[kernel] r14537 - in dists/trunk/linux-2.6/debian: . patches/debian/dfsg patches/features/all patches/series

Ben Hutchings benh at alioth.debian.org
Wed Nov 4 00:33:57 UTC 2009


Author: benh
Date: Wed Nov  4 00:33:53 2009
New Revision: 14537

Log:
r8169: Remove firmware for RTL8168D v1 and v2 and use request_firmware() to load it

Added:
   dists/trunk/linux-2.6/debian/patches/debian/dfsg/r8169-rtl8168d-1-2-disable.patch
   dists/trunk/linux-2.6/debian/patches/features/all/r8169-init-phy-return-error.patch
   dists/trunk/linux-2.6/debian/patches/features/all/r8169-rtl8168d-1-2-request_firmware.patch
Modified:
   dists/trunk/linux-2.6/debian/changelog
   dists/trunk/linux-2.6/debian/patches/debian/dfsg/files-1
   dists/trunk/linux-2.6/debian/patches/series/base
   dists/trunk/linux-2.6/debian/patches/series/orig-0

Modified: dists/trunk/linux-2.6/debian/changelog
==============================================================================
--- dists/trunk/linux-2.6/debian/changelog	Wed Nov  4 00:31:07 2009	(r14536)
+++ dists/trunk/linux-2.6/debian/changelog	Wed Nov  4 00:33:53 2009	(r14537)
@@ -6,6 +6,8 @@
     packages (Closes: #546182)
   * lgs8gxx: Remove firmware for lgs8g75 and use request_firmware() to
     load it
+  * r8169: Remove firmware for RTL8168D v1 and v2 and use
+    request_firmware() to load it
 
   [ Bastian Blank ]
   * [mips] Don't force EMBEDDED on.

Modified: dists/trunk/linux-2.6/debian/patches/debian/dfsg/files-1
==============================================================================
--- dists/trunk/linux-2.6/debian/patches/debian/dfsg/files-1	Wed Nov  4 00:31:07 2009	(r14536)
+++ dists/trunk/linux-2.6/debian/patches/debian/dfsg/files-1	Wed Nov  4 00:33:53 2009	(r14537)
@@ -43,6 +43,8 @@
 rm drivers/net/appletalk/cops_ffdrv.h
 rm drivers/net/appletalk/cops_ltdrv.h
 
+unifdef drivers/net/r8169.c -UREMOVE_DFSG
+
 rm drivers/staging/otus/hal/hp*fw*.c*
 
 rm drivers/staging/rt2860/common/firmware.h

Added: dists/trunk/linux-2.6/debian/patches/debian/dfsg/r8169-rtl8168d-1-2-disable.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/trunk/linux-2.6/debian/patches/debian/dfsg/r8169-rtl8168d-1-2-disable.patch	Wed Nov  4 00:33:53 2009	(r14537)
@@ -0,0 +1,68 @@
+From 8ee9e3b6b1f41934a67567aaefae986ff517587e Mon Sep 17 00:00:00 2001
+From: Ben Hutchings <ben at decadent.org.uk>
+Date: Tue, 3 Nov 2009 23:58:25 +0000
+Subject: [PATCH 21/24] r8169: mark firmware for removal and mark code using it as broken
+
+---
+ drivers/net/r8169.c |    8 ++++++++
+ 1 files changed, 8 insertions(+), 0 deletions(-)
+
+diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
+index fa49356..3495ff6 100644
+--- a/drivers/net/r8169.c
++++ b/drivers/net/r8169.c
+@@ -1719,6 +1719,7 @@ static void rtl8168d_1_hw_phy_config(void __iomem *ioaddr)
+ 		{ 0x05, 0x8332 },
+ 		{ 0x06, 0x5561 }
+ 	};
++#ifdef REMOVE_DFSG
+ 	static struct phy_reg phy_reg_init_2[] = {
+ 		{ 0x1f, 0x0005 },
+ 		{ 0x05, 0xffc2 },
+@@ -2074,6 +2075,7 @@ static void rtl8168d_1_hw_phy_config(void __iomem *ioaddr)
+ 		{ 0x0d, 0xf880 },
+ 		{ 0x1f, 0x0000 }
+ 	};
++#endif
+ 
+ 	rtl_phy_write(ioaddr, phy_reg_init_0, ARRAY_SIZE(phy_reg_init_0));
+ 
+@@ -2131,7 +2133,9 @@ static void rtl8168d_1_hw_phy_config(void __iomem *ioaddr)
+ 	mdio_plus_minus(ioaddr, 0x02, 0x0100, 0x0600);
+ 	mdio_plus_minus(ioaddr, 0x03, 0x0000, 0xe000);
+ 
++#ifdef CONFIG_BROKEN
+ 	rtl_phy_write(ioaddr, phy_reg_init_2, ARRAY_SIZE(phy_reg_init_2));
++#endif
+ }
+ 
+ static void rtl8168d_2_hw_phy_config(void __iomem *ioaddr)
+@@ -2161,6 +2165,7 @@ static void rtl8168d_2_hw_phy_config(void __iomem *ioaddr)
+ 		{ 0x05, 0x8332 },
+ 		{ 0x06, 0x5561 }
+ 	};
++#ifdef REMOVE_DFSG
+ 	static struct phy_reg phy_reg_init_1[] = {
+ 		{ 0x1f, 0x0005 },
+ 		{ 0x05, 0xffc2 },
+@@ -2473,6 +2478,7 @@ static void rtl8168d_2_hw_phy_config(void __iomem *ioaddr)
+ 		{ 0x0d, 0xf880 },
+ 		{ 0x1f, 0x0000 }
+ 	};
++#endif
+ 
+ 	rtl_phy_write(ioaddr, phy_reg_init_0, ARRAY_SIZE(phy_reg_init_0));
+ 
+@@ -2526,7 +2532,9 @@ static void rtl8168d_2_hw_phy_config(void __iomem *ioaddr)
+ 	mdio_write(ioaddr, 0x1f, 0x0002);
+ 	mdio_patch(ioaddr, 0x0f, 0x0017);
+ 
++#ifdef CONFIG_BROKEN
+ 	rtl_phy_write(ioaddr, phy_reg_init_1, ARRAY_SIZE(phy_reg_init_1));
++#endif
+ }
+ 
+ static void rtl8168d_3_hw_phy_config(void __iomem *ioaddr)
+-- 
+1.6.5.2
+

Added: dists/trunk/linux-2.6/debian/patches/features/all/r8169-init-phy-return-error.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/trunk/linux-2.6/debian/patches/features/all/r8169-init-phy-return-error.patch	Wed Nov  4 00:33:53 2009	(r14537)
@@ -0,0 +1,72 @@
+From 3b59832103a30e3c70251667793f90ab3bd1427b Mon Sep 17 00:00:00 2001
+From: Ben Hutchings <ben at decadent.org.uk>
+Date: Sun, 1 Nov 2009 22:35:15 +0000
+Subject: [PATCH 23/24] r8169: allow rtl_hw_phy_config() and rtl8169_init_phy() to return error codes
+
+This is preparation for loading PHY firmware, which may fail.
+---
+ drivers/net/r8169.c |   17 +++++++++++++----
+ 1 files changed, 13 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
+index b753f4b..80a9d03 100644
+--- a/drivers/net/r8169.c
++++ b/drivers/net/r8169.c
+@@ -1944,7 +1944,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;
+@@ -2013,6 +2013,8 @@ static void rtl_hw_phy_config(struct net_device *dev)
+ 	default:
+ 		break;
+ 	}
++
++	return 0;
+ }
+ 
+ static void rtl8169_phy_timer(unsigned long __opaque)
+@@ -2117,11 +2119,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");
+@@ -2150,6 +2155,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)
+@@ -2536,7 +2543,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
+-- 
+1.6.5.2
+

Added: dists/trunk/linux-2.6/debian/patches/features/all/r8169-rtl8168d-1-2-request_firmware.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/trunk/linux-2.6/debian/patches/features/all/r8169-rtl8168d-1-2-request_firmware.patch	Wed Nov  4 00:33:53 2009	(r14537)
@@ -0,0 +1,155 @@
+From 6902a6e35ad0847c323680b3e12b909e872f0e6b Mon Sep 17 00:00:00 2001
+From: Ben Hutchings <ben at decadent.org.uk>
+Date: Sun, 1 Nov 2009 22:42:01 +0000
+Subject: [PATCH 24/24] 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.
+---
+ drivers/net/Kconfig |    1 +
+ drivers/net/r8169.c |   60 ++++++++++++++++++++++++++++++++++++++++----------
+ 2 files changed, 49 insertions(+), 12 deletions(-)
+
+diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
+index e19ca4b..4395c1e 100644
+--- a/drivers/net/Kconfig
++++ b/drivers/net/Kconfig
+@@ -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.
+ 
+diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
+index 80a9d03..8b6c57f 100644
+--- a/drivers/net/r8169.c
++++ b/drivers/net/r8169.c
+@@ -23,6 +23,7 @@
+ #include <linux/tcp.h>
+ #include <linux/init.h>
+ #include <linux/dma-mapping.h>
++#include <linux/firmware.h>
+ 
+ #include <asm/system.h>
+ #include <asm/io.h>
+@@ -1359,6 +1360,23 @@ static void rtl_phy_write(void __iomem *ioaddr, struct phy_reg *regs, int len)
+ 	}
+ }
+ 
++struct phy_reg_le {
++	__le16 reg;
++	__le16 val;
++};
++
++static void rtl_phy_write_fw(void __iomem *ioaddr, const struct firmware *fw)
++{
++	const struct phy_reg_le *regs = (const struct phy_reg_le *)fw->data;
++	size_t len = fw->size / sizeof(*regs);
++
++	while (len-- > 0) {
++		mdio_write(ioaddr, le16_to_cpu(regs->reg),
++			   le16_to_cpu(regs->val));
++		regs++;
++	}
++}
++
+ static void rtl8169s_hw_phy_config(void __iomem *ioaddr)
+ {
+ 	struct phy_reg phy_reg_init[] = {
+@@ -1691,7 +1709,7 @@ static void rtl8168c_4_hw_phy_config(void __iomem *ioaddr)
+ 	rtl8168c_3_hw_phy_config(ioaddr);
+ }
+ 
+-static void rtl8168d_1_hw_phy_config(void __iomem *ioaddr)
++static int rtl8168d_1_hw_phy_config(struct rtl8169_private *tp)
+ {
+ 	static struct phy_reg phy_reg_init_0[] = {
+ 		{ 0x1f, 0x0001 },
+@@ -1719,6 +1737,13 @@ static void rtl8168d_1_hw_phy_config(void __iomem *ioaddr)
+ 		{ 0x05, 0x8332 },
+ 		{ 0x06, 0x5561 }
+ 	};
++	void __iomem *ioaddr = tp->mmio_addr;
++	const struct firmware *fw;
++	int rc;
++
++	rc = request_firmware(&fw, "rtl8168d-1.fw", &tp->pci_dev->dev);
++	if (rc)
++		return rc;
+ 
+ 	rtl_phy_write(ioaddr, phy_reg_init_0, ARRAY_SIZE(phy_reg_init_0));
+ 
+@@ -1776,12 +1801,15 @@ static void rtl8168d_1_hw_phy_config(void __iomem *ioaddr)
+ 	mdio_plus_minus(ioaddr, 0x02, 0x0100, 0x0600);
+ 	mdio_plus_minus(ioaddr, 0x03, 0x0000, 0xe000);
+ 
+-#ifdef CONFIG_BROKEN
+-	rtl_phy_write(ioaddr, phy_reg_init_2, ARRAY_SIZE(phy_reg_init_2));
+-#endif
++	rtl_phy_write_fw(ioaddr, fw);
++
++	release_firmware(fw);
++	return 0;
+ }
+ 
+-static void rtl8168d_2_hw_phy_config(void __iomem *ioaddr)
++MODULE_FIRMWARE("rtl8168d-1.fw");
++
++static int rtl8168d_2_hw_phy_config(struct rtl8169_private *tp)
+ {
+ 	static struct phy_reg phy_reg_init_0[] = {
+ 		{ 0x1f, 0x0001 },
+@@ -1808,6 +1836,13 @@ static void rtl8168d_2_hw_phy_config(void __iomem *ioaddr)
+ 		{ 0x05, 0x8332 },
+ 		{ 0x06, 0x5561 }
+ 	};
++	void __iomem *ioaddr = tp->mmio_addr;
++	const struct firmware *fw;
++	int rc;
++
++	rc = request_firmware(&fw, "rtl8168d-2.fw", &tp->pci_dev->dev);
++	if (rc)
++		return rc;
+ 
+ 	rtl_phy_write(ioaddr, phy_reg_init_0, ARRAY_SIZE(phy_reg_init_0));
+ 
+@@ -1861,11 +1896,14 @@ static void rtl8168d_2_hw_phy_config(void __iomem *ioaddr)
+ 	mdio_write(ioaddr, 0x1f, 0x0002);
+ 	mdio_patch(ioaddr, 0x0f, 0x0017);
+ 
+-#ifdef CONFIG_BROKEN
+-	rtl_phy_write(ioaddr, phy_reg_init_1, ARRAY_SIZE(phy_reg_init_1));
+-#endif
++	rtl_phy_write_fw(ioaddr, fw);
++
++	release_firmware(fw);
++	return 0;
+ }
+ 
++MODULE_FIRMWARE("rtl8168d-2.fw");
++
+ static void rtl8168d_3_hw_phy_config(void __iomem *ioaddr)
+ {
+ 	struct phy_reg phy_reg_init[] = {
+@@ -2001,11 +2039,9 @@ static int rtl_hw_phy_config(struct net_device *dev)
+ 		rtl8168cp_2_hw_phy_config(ioaddr);
+ 		break;
+ 	case RTL_GIGA_MAC_VER_25:
+-		rtl8168d_1_hw_phy_config(ioaddr);
+-		break;
++		return rtl8168d_1_hw_phy_config(tp);
+ 	case RTL_GIGA_MAC_VER_26:
+-		rtl8168d_2_hw_phy_config(ioaddr);
+-		break;
++		return rtl8168d_2_hw_phy_config(tp);
+ 	case RTL_GIGA_MAC_VER_27:
+ 		rtl8168d_3_hw_phy_config(ioaddr);
+ 		break;
+-- 
+1.6.5.2
+

Modified: dists/trunk/linux-2.6/debian/patches/series/base
==============================================================================
--- dists/trunk/linux-2.6/debian/patches/series/base	Wed Nov  4 00:31:07 2009	(r14536)
+++ dists/trunk/linux-2.6/debian/patches/series/base	Wed Nov  4 00:33:53 2009	(r14537)
@@ -12,6 +12,8 @@
 + features/all/drivers-staging-rt28x0sta-request_firmware.patch
 + features/all/export-unionfs-symbols.patch
 + features/all/lgs8gxx-lgs8g75-request_firmware.patch
++ features/all/r8169-init-phy-return-error.patch
++ features/all/r8169-rtl8168d-1-2-request_firmware.patch
 + features/all/sound-pci-cs46xx-request_firmware.patch
 
 # patches from aufs2 repository, with s/EXPORT_SYMBOL/&_GPL/

Modified: dists/trunk/linux-2.6/debian/patches/series/orig-0
==============================================================================
--- dists/trunk/linux-2.6/debian/patches/series/orig-0	Wed Nov  4 00:31:07 2009	(r14536)
+++ dists/trunk/linux-2.6/debian/patches/series/orig-0	Wed Nov  4 00:33:53 2009	(r14537)
@@ -9,8 +9,6 @@
 + debian/dfsg/drivers-staging-rtl8192su-disable.patch
 + debian/dfsg/firmware-cleanup.patch
 + debian/dfsg/lgs8gxx-lgs8g75-disable.patch
++ debian/dfsg/r8169-rtl8168d-1-2-disable.patch
 + debian/dfsg/sound-pci.patch
 X debian/dfsg/files-1
-
-# TODO for 2.6.32:
-# drivers/net/r8169.c: phy_reg_init_2 in rtl8168d_{1,2}_hw_phy_config()



More information about the Kernel-svn-changes mailing list