[kernel] r16755 - in dists/sid/linux-2.6/debian: . patches/features/all patches/series
Ben Hutchings
benh at alioth.debian.org
Mon Jan 3 23:36:23 UTC 2011
Author: benh
Date: Mon Jan 3 23:36:05 2011
New Revision: 16755
Log:
r8169: Change RTL8111D/RTL8168D initialisation and firmware loading to match upstream version (for #564628)
Added:
dists/sid/linux-2.6/debian/patches/features/all/r8169-remove-the-firmware-of-RTL8111D.patch
Modified:
dists/sid/linux-2.6/debian/changelog
dists/sid/linux-2.6/debian/patches/series/30
Modified: dists/sid/linux-2.6/debian/changelog
==============================================================================
--- dists/sid/linux-2.6/debian/changelog Mon Jan 3 20:36:24 2011 (r16754)
+++ dists/sid/linux-2.6/debian/changelog Mon Jan 3 23:36:05 2011 (r16755)
@@ -19,6 +19,8 @@
workaround for incorrect region code in NVRAM (Closes: #594561)
* btrfs: Require CAP_SYS_ADMIN for filesystem rebalance (Closes: #608185)
* [x86] dell-laptop: Enable for some newer Dell models
+ * r8169: Change RTL8111D/RTL8168D initialisation and firmware loading to
+ match upstream version (for #564628)
[ maximilian attems ]
* [openvz] Reenable NF_CONNTRACK_IPV6. (closes: #580507)
Added: dists/sid/linux-2.6/debian/patches/features/all/r8169-remove-the-firmware-of-RTL8111D.patch
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dists/sid/linux-2.6/debian/patches/features/all/r8169-remove-the-firmware-of-RTL8111D.patch Mon Jan 3 23:36:05 2011 (r16755)
@@ -0,0 +1,295 @@
+From: Francois Romieu <romieu at fr.zoreil.com>
+Date: Mon, 3 Jan 2011 00:35:52 +0100
+Subject: [PATCH] r8169: remove the firmware of RTL8111D.
+
+The binary file of the firmware is moved to linux-firmware repository.
+The firmwares are rtl_nic/rtl8168d-1.fw and rtl_nic/rtl8168d-2.fw.
+The driver goes along if the firmware couldn't be found. However, it
+is suggested to be done with the suitable firmware.
+
+Some wrong PHY parameters are directly corrected in the driver.
+
+Simple firmware checking added per Ben Hutchings suggestion.
+
+Signed-off-by: Hayes Wang <hayeswang at realtek.com>
+Signed-off-by: Francois Romieu <romieu at fr.zoreil.com>
+Cc: Ben Hutchings <benh at debian.org>
+[bwh: Adjust for Debian's 2.6.32]
+---
+ drivers/net/r8169.c | 157 ++++++++++++++++++++++++++++++++++++++++++++-------
+ 1 files changed, 137 insertions(+), 20 deletions(-)
+
+diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
+index a31745b..a9b9e2a 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>
+@@ -32,6 +33,9 @@
+ #define MODULENAME "r8169"
+ #define PFX MODULENAME ": "
+
++#define FIRMWARE_8168D_1 "rtl_nic/rtl8168d-1.fw"
++#define FIRMWARE_8168D_2 "rtl_nic/rtl8168d-2.fw"
++
+ #ifdef RTL8169_DEBUG
+ #define assert(expr) \
+ if (!(expr)) { \
+@@ -521,6 +525,8 @@ module_param_named(debug, debug.msg_enable, int, 0);
+ MODULE_PARM_DESC(debug, "Debug verbosity level (0=none, ..., 16=all)");
+ MODULE_LICENSE("GPL");
+ MODULE_VERSION(RTL8169_VERSION);
++MODULE_FIRMWARE(FIRMWARE_8168D_1);
++MODULE_FIRMWARE(FIRMWARE_8168D_2);
+
+ static int rtl8169_open(struct net_device *dev);
+ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb,
+@@ -1375,6 +1381,65 @@ static void rtl_phy_write(void __iomem *ioaddr, struct phy_reg *regs, int len)
+ }
+ }
+
++#define PHY_READ 0x00000000
++#define PHY_DATA_OR 0x10000000
++#define PHY_DATA_AND 0x20000000
++#define PHY_BJMPN 0x30000000
++#define PHY_READ_EFUSE 0x40000000
++#define PHY_READ_MAC_BYTE 0x50000000
++#define PHY_WRITE_MAC_BYTE 0x60000000
++#define PHY_CLEAR_READCOUNT 0x70000000
++#define PHY_WRITE 0x80000000
++#define PHY_READCOUNT_EQ_SKIP 0x90000000
++#define PHY_COMP_EQ_SKIPN 0xa0000000
++#define PHY_COMP_NEQ_SKIPN 0xb0000000
++#define PHY_WRITE_PREVIOUS 0xc0000000
++#define PHY_SKIPN 0xd0000000
++#define PHY_DELAY_MS 0xe0000000
++#define PHY_WRITE_ERI_WORD 0xf0000000
++
++static void
++rtl_phy_write_fw(struct rtl8169_private *tp, const struct firmware *fw)
++{
++ void __iomem *ioaddr = tp->mmio_addr;
++ __le32 *phytable = (__le32 *)fw->data;
++ struct net_device *dev = tp->dev;
++ size_t i;
++
++ if (fw->size % sizeof(*phytable)) {
++ netif_err(tp, probe, dev, "odd sized firmware %zd\n", fw->size);
++ return;
++ }
++
++ for (i = 0; i < fw->size / sizeof(*phytable); i++) {
++ u32 action = le32_to_cpu(phytable[i]);
++
++ if (!action)
++ break;
++
++ if ((action & 0xf0000000) != PHY_WRITE) {
++ netif_err(tp, probe, dev,
++ "unknown action 0x%08x\n", action);
++ return;
++ }
++ }
++
++ while (i-- != 0) {
++ u32 action = le32_to_cpu(*phytable);
++ u32 data = action & 0x0000ffff;
++ u32 reg = (action & 0x0fff0000) >> 16;
++
++ switch(action & 0xf0000000) {
++ case PHY_WRITE:
++ mdio_write(ioaddr, reg, data);
++ phytable++;
++ break;
++ default:
++ BUG();
++ }
++ }
++}
++
+ static void rtl8169s_hw_phy_config(void __iomem *ioaddr)
+ {
+ struct phy_reg phy_reg_init[] = {
+@@ -1707,9 +1772,10 @@ 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 void rtl8168d_1_hw_phy_config(struct rtl8169_private *tp)
+ {
+ static struct phy_reg phy_reg_init_0[] = {
++ /* Channel Estimation */
+ { 0x1f, 0x0001 },
+ { 0x06, 0x4064 },
+ { 0x07, 0x2863 },
+@@ -1726,24 +1792,41 @@ static void rtl8168d_1_hw_phy_config(void __iomem *ioaddr)
+ { 0x12, 0xf49f },
+ { 0x13, 0x070b },
+ { 0x1a, 0x05ad },
+- { 0x14, 0x94c0 }
+- };
+- static struct phy_reg phy_reg_init_1[] = {
++ { 0x14, 0x94c0 },
++
++ /*
++ * Tx Error Issue
++ * enhance line driver power
++ */
+ { 0x1f, 0x0002 },
+ { 0x06, 0x5561 },
+ { 0x1f, 0x0005 },
+ { 0x05, 0x8332 },
+- { 0x06, 0x5561 }
++ { 0x06, 0x5561 },
++
++ /*
++ * Can not link to 1Gbps with bad cable
++ * Decrease SNR threshold form 21.07dB to 19.04dB
++ */
++ { 0x1f, 0x0001 },
++ { 0x17, 0x0cc0 },
++
++ { 0x1f, 0x0000 },
++ { 0x0d, 0xf880 }
+ };
++ void __iomem *ioaddr = tp->mmio_addr;
++ const struct firmware *fw;
+
+ rtl_phy_write(ioaddr, phy_reg_init_0, ARRAY_SIZE(phy_reg_init_0));
+
++ /*
++ * Rx Error Issue
++ * Fine Tune Switching regulator parameter
++ */
+ mdio_write(ioaddr, 0x1f, 0x0002);
+ mdio_plus_minus(ioaddr, 0x0b, 0x0010, 0x00ef);
+ mdio_plus_minus(ioaddr, 0x0c, 0xa200, 0x5d00);
+
+- rtl_phy_write(ioaddr, phy_reg_init_1, ARRAY_SIZE(phy_reg_init_1));
+-
+ if (rtl8168d_efuse_read(ioaddr, 0x01) == 0xb1) {
+ struct phy_reg phy_reg_init[] = {
+ { 0x1f, 0x0002 },
+@@ -1784,22 +1867,33 @@ static void rtl8168d_1_hw_phy_config(void __iomem *ioaddr)
+ rtl_phy_write(ioaddr, phy_reg_init, ARRAY_SIZE(phy_reg_init));
+ }
+
++ /* RSET couple improve */
+ mdio_write(ioaddr, 0x1f, 0x0002);
+ mdio_patch(ioaddr, 0x0d, 0x0300);
+ mdio_patch(ioaddr, 0x0f, 0x0010);
+
++ /* Fine tune PLL performance */
+ mdio_write(ioaddr, 0x1f, 0x0002);
+ 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
++ mdio_write(ioaddr, 0x1f, 0x0005);
++ mdio_write(ioaddr, 0x05, 0x001b);
++ if (mdio_read(ioaddr, 0x06) == 0xbf00 &&
++ request_firmware(&fw, FIRMWARE_8168D_1, &tp->pci_dev->dev) == 0) {
++ rtl_phy_write_fw(tp, fw);
++ release_firmware(fw);
++ } else {
++ netif_warn(tp, probe, tp->dev, "unable to apply firmware patch\n");
++ }
++
++ mdio_write(ioaddr, 0x1f, 0x0000);
+ }
+
+-static void rtl8168d_2_hw_phy_config(void __iomem *ioaddr)
++static void rtl8168d_2_hw_phy_config(struct rtl8169_private *tp)
+ {
+ static struct phy_reg phy_reg_init_0[] = {
++ /* Channel Estimation */
+ { 0x1f, 0x0001 },
+ { 0x06, 0x4064 },
+ { 0x07, 0x2863 },
+@@ -1818,12 +1912,28 @@ static void rtl8168d_2_hw_phy_config(void __iomem *ioaddr)
+ { 0x1a, 0x05ad },
+ { 0x14, 0x94c0 },
+
++ /*
++ * Tx Error Issue
++ * enhance line driver power
++ */
+ { 0x1f, 0x0002 },
+ { 0x06, 0x5561 },
+ { 0x1f, 0x0005 },
+ { 0x05, 0x8332 },
+- { 0x06, 0x5561 }
++ { 0x06, 0x5561 },
++
++ /*
++ * Can not link to 1Gbps with bad cable
++ * Decrease SNR threshold form 21.07dB to 19.04dB
++ */
++ { 0x1f, 0x0001 },
++ { 0x17, 0x0cc0 },
++
++ { 0x1f, 0x0000 },
++ { 0x0d, 0xf880 }
+ };
++ void __iomem *ioaddr = tp->mmio_addr;
++ const struct firmware *fw;
+
+ rtl_phy_write(ioaddr, phy_reg_init_0, ARRAY_SIZE(phy_reg_init_0));
+
+@@ -1867,19 +1977,26 @@ static void rtl8168d_2_hw_phy_config(void __iomem *ioaddr)
+ rtl_phy_write(ioaddr, phy_reg_init, ARRAY_SIZE(phy_reg_init));
+ }
+
++ /* Fine tune PLL performance */
+ mdio_write(ioaddr, 0x1f, 0x0002);
+ mdio_plus_minus(ioaddr, 0x02, 0x0100, 0x0600);
+ mdio_plus_minus(ioaddr, 0x03, 0x0000, 0xe000);
+
+- mdio_write(ioaddr, 0x1f, 0x0001);
+- mdio_write(ioaddr, 0x17, 0x0cc0);
+-
++ /* Switching regulator Slew rate */
+ 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
++ mdio_write(ioaddr, 0x1f, 0x0005);
++ mdio_write(ioaddr, 0x05, 0x001b);
++ if (mdio_read(ioaddr, 0x06) == 0xb300 &&
++ request_firmware(&fw, FIRMWARE_8168D_2, &tp->pci_dev->dev) == 0) {
++ rtl_phy_write_fw(tp, fw);
++ release_firmware(fw);
++ } else {
++ netif_warn(tp, probe, tp->dev, "unable to apply firmware patch\n");
++ }
++
++ mdio_write(ioaddr, 0x1f, 0x0000);
+ }
+
+ static void rtl8168d_3_hw_phy_config(void __iomem *ioaddr)
+@@ -2017,10 +2134,10 @@ static void 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);
++ rtl8168d_1_hw_phy_config(tp);
+ break;
+ case RTL_GIGA_MAC_VER_26:
+- rtl8168d_2_hw_phy_config(ioaddr);
++ rtl8168d_2_hw_phy_config(tp);
+ break;
+ case RTL_GIGA_MAC_VER_27:
+ rtl8168d_3_hw_phy_config(ioaddr);
+--
+1.7.2.3
+
Modified: dists/sid/linux-2.6/debian/patches/series/30
==============================================================================
--- dists/sid/linux-2.6/debian/patches/series/30 Mon Jan 3 20:36:24 2011 (r16754)
+++ dists/sid/linux-2.6/debian/patches/series/30 Mon Jan 3 23:36:05 2011 (r16755)
@@ -26,3 +26,5 @@
+ bugfix/all/btrfs-Require-CAP_SYS_ADMIN-for-filesystem-rebalance.patch
+ features/x86/dell-laptop-Add-Dell-Computer-type-8-to-DMI-whitelist.patch
+ features/x86/dell-laptop-Add-Dell-Inc-type-9-to-DMI-whitelist.patch
+- features/all/r8169-rtl8168d-1-2-request_firmware-3.patch
++ features/all/r8169-remove-the-firmware-of-RTL8111D.patch
More information about the Kernel-svn-changes
mailing list