netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] Pull request for 'davem.r8169.fixes' branch
@ 2011-09-17  9:56 Francois Romieu
  2011-09-17  9:57 ` [PATCH 1/5] r8169: fix the reset setting for 8111evl Francois Romieu
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Francois Romieu @ 2011-09-17  9:56 UTC (permalink / raw)
  To: davem; +Cc: netdev, Realtek linux nic maintainers, Hayes Wang

Please pull from branch 'davem.r8169.fixes' in repository

git://violet.fr.zoreil.com/romieu/linux davem.r8169.fixes

to get the changes below.

Distance from 'davem' (8e2ec639173f325977818c45011ee176ef2b11f6)
----------------------------------------------------------------

2544bfc0eb2581e0eedbdfea1468b3866223d47e
e03f33af79f0772156e1a1a1e36bdddf8012b2e4
106633897e086e1b47126996aac1a427eb80eb1b
bbb8af75d0a6a5138ff00fe0b1b95c4824effd55
c2b0c1e7fb69b54e704cb2dae5a80cc78a8cb0b2

Diffstat
--------

 drivers/net/r8169.c |   32 +++++++++++++++++++++++++++-----
 1 files changed, 27 insertions(+), 5 deletions(-)

Shortlog
--------

Francois Romieu (2):
      r8169: remove erroneous processing of always set bit.
      r8169: do not enable the TBI for anything but the original 8169.

Hayes Wang (3):
      r8169: fix the reset setting for 8111evl
      r8169: add MODULE_FIRMWARE for the firmware of 8111evl
      r8169: fix WOL setting for 8105 and 8111evl

Patch
-----

diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 02339b3..c236670 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -407,6 +407,7 @@ enum rtl_register_content {
 	RxOK		= 0x0001,
 
 	/* RxStatusDesc */
+	RxBOVF	= (1 << 24),
 	RxFOVF	= (1 << 23),
 	RxRWT	= (1 << 22),
 	RxRES	= (1 << 21),
@@ -682,6 +683,7 @@ struct rtl8169_private {
 	struct mii_if_info mii;
 	struct rtl8169_counters counters;
 	u32 saved_wolopts;
+	u32 opts1_mask;
 
 	struct rtl_fw {
 		const struct firmware *fw;
@@ -710,6 +712,7 @@ MODULE_FIRMWARE(FIRMWARE_8168D_1);
 MODULE_FIRMWARE(FIRMWARE_8168D_2);
 MODULE_FIRMWARE(FIRMWARE_8168E_1);
 MODULE_FIRMWARE(FIRMWARE_8168E_2);
+MODULE_FIRMWARE(FIRMWARE_8168E_3);
 MODULE_FIRMWARE(FIRMWARE_8105E_1);
 
 static int rtl8169_open(struct net_device *dev);
@@ -3077,6 +3080,14 @@ static void rtl8169_phy_reset(struct net_device *dev,
 	netif_err(tp, link, dev, "PHY reset failed\n");
 }
 
+static bool rtl_tbi_enabled(struct rtl8169_private *tp)
+{
+	void __iomem *ioaddr = tp->mmio_addr;
+
+	return (tp->mac_version == RTL_GIGA_MAC_VER_01) &&
+	    (RTL_R8(PHYstatus) & TBI_Enable);
+}
+
 static void rtl8169_init_phy(struct net_device *dev, struct rtl8169_private *tp)
 {
 	void __iomem *ioaddr = tp->mmio_addr;
@@ -3109,7 +3120,7 @@ static void rtl8169_init_phy(struct net_device *dev, struct rtl8169_private *tp)
 			   ADVERTISED_1000baseT_Half |
 			   ADVERTISED_1000baseT_Full : 0));
 
-	if (RTL_R8(PHYstatus) & TBI_Enable)
+	if (rtl_tbi_enabled(tp))
 		netif_info(tp, link, dev, "TBI auto-negotiating\n");
 }
 
@@ -3319,9 +3330,16 @@ static void r810x_phy_power_up(struct rtl8169_private *tp)
 
 static void r810x_pll_power_down(struct rtl8169_private *tp)
 {
+	void __iomem *ioaddr = tp->mmio_addr;
+
 	if (__rtl8169_get_wol(tp) & WAKE_ANY) {
 		rtl_writephy(tp, 0x1f, 0x0000);
 		rtl_writephy(tp, MII_BMCR, 0x0000);
+
+		if (tp->mac_version == RTL_GIGA_MAC_VER_29 ||
+		    tp->mac_version == RTL_GIGA_MAC_VER_30)
+			RTL_W32(RxConfig, RTL_R32(RxConfig) | AcceptBroadcast |
+				AcceptMulticast | AcceptMyPhys);
 		return;
 	}
 
@@ -3417,7 +3435,8 @@ static void r8168_pll_power_down(struct rtl8169_private *tp)
 		rtl_writephy(tp, MII_BMCR, 0x0000);
 
 		if (tp->mac_version == RTL_GIGA_MAC_VER_32 ||
-		    tp->mac_version == RTL_GIGA_MAC_VER_33)
+		    tp->mac_version == RTL_GIGA_MAC_VER_33 ||
+		    tp->mac_version == RTL_GIGA_MAC_VER_34)
 			RTL_W32(RxConfig, RTL_R32(RxConfig) | AcceptBroadcast |
 				AcceptMulticast | AcceptMyPhys);
 		return;
@@ -3727,8 +3746,7 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 	tp->features |= rtl_try_msi(pdev, ioaddr, cfg);
 	RTL_W8(Cfg9346, Cfg9346_Lock);
 
-	if ((tp->mac_version <= RTL_GIGA_MAC_VER_06) &&
-	    (RTL_R8(PHYstatus) & TBI_Enable)) {
+	if (rtl_tbi_enabled(tp)) {
 		tp->set_speed = rtl8169_set_speed_tbi;
 		tp->get_settings = rtl8169_gset_tbi;
 		tp->phy_reset_enable = rtl8169_tbi_reset_enable;
@@ -3777,6 +3795,9 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 	tp->intr_event = cfg->intr_event;
 	tp->napi_event = cfg->napi_event;
 
+	tp->opts1_mask = (tp->mac_version != RTL_GIGA_MAC_VER_01) ?
+		~(RxBOVF | RxFOVF) : ~0;
+
 	init_timer(&tp->timer);
 	tp->timer.data = (unsigned long) dev;
 	tp->timer.function = rtl8169_phy_timer;
@@ -3988,6 +4009,7 @@ static void rtl8169_hw_reset(struct rtl8169_private *tp)
 		while (RTL_R8(TxPoll) & NPQ)
 			udelay(20);
 	} else if (tp->mac_version == RTL_GIGA_MAC_VER_34) {
+		RTL_W8(ChipCmd, RTL_R8(ChipCmd) | StopReq);
 		while (!(RTL_R32(TxConfig) & TXCFG_EMPTY))
 			udelay(100);
 	} else {
@@ -5314,7 +5336,7 @@ static int rtl8169_rx_interrupt(struct net_device *dev,
 		u32 status;
 
 		rmb();
-		status = le32_to_cpu(desc->opts1);
+		status = le32_to_cpu(desc->opts1) & tp->opts1_mask;
 
 		if (status & DescOwn)
 			break;
-- 
Ueimor

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

* [PATCH 1/5] r8169: fix the reset setting for 8111evl
  2011-09-17  9:56 [PATCH 0/5] Pull request for 'davem.r8169.fixes' branch Francois Romieu
@ 2011-09-17  9:57 ` Francois Romieu
  2011-09-17  9:57 ` [PATCH 2/5] r8169: add MODULE_FIRMWARE for the firmware of 8111evl Francois Romieu
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Francois Romieu @ 2011-09-17  9:57 UTC (permalink / raw)
  To: davem; +Cc: netdev, Realtek linux nic maintainers, Hayes Wang

rtl8111evl should stop any TLP requirement before resetting by
enabling register 0x37 bit 7.

Signed-off-by: Hayes Wang <hayeswang@realtek.com>
---
 drivers/net/r8169.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 02339b3..a1c9070 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -3988,6 +3988,7 @@ static void rtl8169_hw_reset(struct rtl8169_private *tp)
 		while (RTL_R8(TxPoll) & NPQ)
 			udelay(20);
 	} else if (tp->mac_version == RTL_GIGA_MAC_VER_34) {
+		RTL_W8(ChipCmd, RTL_R8(ChipCmd) | StopReq);
 		while (!(RTL_R32(TxConfig) & TXCFG_EMPTY))
 			udelay(100);
 	} else {
-- 
1.7.6

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

* [PATCH 2/5] r8169: add MODULE_FIRMWARE for the firmware of 8111evl
  2011-09-17  9:56 [PATCH 0/5] Pull request for 'davem.r8169.fixes' branch Francois Romieu
  2011-09-17  9:57 ` [PATCH 1/5] r8169: fix the reset setting for 8111evl Francois Romieu
@ 2011-09-17  9:57 ` Francois Romieu
  2011-09-17  9:58 ` [PATCH 3/5] r8169: fix WOL setting for 8105 and 8111evl Francois Romieu
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Francois Romieu @ 2011-09-17  9:57 UTC (permalink / raw)
  To: davem; +Cc: netdev, Realtek linux nic maintainers, Hayes Wang

Add MODULE_FIRMWARE for the firmware of RTL8111E-VL

Signed-off-by: Hayes Wang <hayeswang@realtek.com>
---
 drivers/net/r8169.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index a1c9070..b55fba7 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -710,6 +710,7 @@ MODULE_FIRMWARE(FIRMWARE_8168D_1);
 MODULE_FIRMWARE(FIRMWARE_8168D_2);
 MODULE_FIRMWARE(FIRMWARE_8168E_1);
 MODULE_FIRMWARE(FIRMWARE_8168E_2);
+MODULE_FIRMWARE(FIRMWARE_8168E_3);
 MODULE_FIRMWARE(FIRMWARE_8105E_1);
 
 static int rtl8169_open(struct net_device *dev);
-- 
1.7.6

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

* [PATCH 3/5] r8169: fix WOL setting for 8105 and 8111evl
  2011-09-17  9:56 [PATCH 0/5] Pull request for 'davem.r8169.fixes' branch Francois Romieu
  2011-09-17  9:57 ` [PATCH 1/5] r8169: fix the reset setting for 8111evl Francois Romieu
  2011-09-17  9:57 ` [PATCH 2/5] r8169: add MODULE_FIRMWARE for the firmware of 8111evl Francois Romieu
@ 2011-09-17  9:58 ` Francois Romieu
  2011-09-17  9:58 ` [PATCH 4/5] r8169: remove erroneous processing of always set bit Francois Romieu
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Francois Romieu @ 2011-09-17  9:58 UTC (permalink / raw)
  To: davem; +Cc: netdev, Realtek linux nic maintainers, Hayes Wang

rtl8105, rtl8111E, and rtl8111evl need enable RxConfig bit 1 ~ 3
for supporting wake on lan.

Signed-off-by: Hayes Wang <hayeswang@realtek.com>
---
 drivers/net/r8169.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index b55fba7..78c1d58 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -3320,9 +3320,16 @@ static void r810x_phy_power_up(struct rtl8169_private *tp)
 
 static void r810x_pll_power_down(struct rtl8169_private *tp)
 {
+	void __iomem *ioaddr = tp->mmio_addr;
+
 	if (__rtl8169_get_wol(tp) & WAKE_ANY) {
 		rtl_writephy(tp, 0x1f, 0x0000);
 		rtl_writephy(tp, MII_BMCR, 0x0000);
+
+		if (tp->mac_version == RTL_GIGA_MAC_VER_29 ||
+		    tp->mac_version == RTL_GIGA_MAC_VER_30)
+			RTL_W32(RxConfig, RTL_R32(RxConfig) | AcceptBroadcast |
+				AcceptMulticast | AcceptMyPhys);
 		return;
 	}
 
@@ -3418,7 +3425,8 @@ static void r8168_pll_power_down(struct rtl8169_private *tp)
 		rtl_writephy(tp, MII_BMCR, 0x0000);
 
 		if (tp->mac_version == RTL_GIGA_MAC_VER_32 ||
-		    tp->mac_version == RTL_GIGA_MAC_VER_33)
+		    tp->mac_version == RTL_GIGA_MAC_VER_33 ||
+		    tp->mac_version == RTL_GIGA_MAC_VER_34)
 			RTL_W32(RxConfig, RTL_R32(RxConfig) | AcceptBroadcast |
 				AcceptMulticast | AcceptMyPhys);
 		return;
-- 
1.7.6

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

* [PATCH 4/5] r8169: remove erroneous processing of always set bit.
  2011-09-17  9:56 [PATCH 0/5] Pull request for 'davem.r8169.fixes' branch Francois Romieu
                   ` (2 preceding siblings ...)
  2011-09-17  9:58 ` [PATCH 3/5] r8169: fix WOL setting for 8105 and 8111evl Francois Romieu
@ 2011-09-17  9:58 ` Francois Romieu
  2011-09-17  9:59 ` [PATCH 5/5] r8169: do not enable the TBI for anything but the original 8169 Francois Romieu
  2011-09-20 18:43 ` [PATCH 0/5] Pull request for 'davem.r8169.fixes' branch David Miller
  5 siblings, 0 replies; 7+ messages in thread
From: Francois Romieu @ 2011-09-17  9:58 UTC (permalink / raw)
  To: davem; +Cc: netdev, Realtek linux nic maintainers, Hayes Wang

When set, RxFOVF (resp. RxBOVF) is always 1 (resp. 0).

Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Cc: Hayes <hayeswang@realtek.com>
---
 drivers/net/r8169.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 78c1d58..dff0bf0 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -407,6 +407,7 @@ enum rtl_register_content {
 	RxOK		= 0x0001,
 
 	/* RxStatusDesc */
+	RxBOVF	= (1 << 24),
 	RxFOVF	= (1 << 23),
 	RxRWT	= (1 << 22),
 	RxRES	= (1 << 21),
@@ -682,6 +683,7 @@ struct rtl8169_private {
 	struct mii_if_info mii;
 	struct rtl8169_counters counters;
 	u32 saved_wolopts;
+	u32 opts1_mask;
 
 	struct rtl_fw {
 		const struct firmware *fw;
@@ -3786,6 +3788,9 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 	tp->intr_event = cfg->intr_event;
 	tp->napi_event = cfg->napi_event;
 
+	tp->opts1_mask = (tp->mac_version != RTL_GIGA_MAC_VER_01) ?
+		~(RxBOVF | RxFOVF) : ~0;
+
 	init_timer(&tp->timer);
 	tp->timer.data = (unsigned long) dev;
 	tp->timer.function = rtl8169_phy_timer;
@@ -5324,7 +5329,7 @@ static int rtl8169_rx_interrupt(struct net_device *dev,
 		u32 status;
 
 		rmb();
-		status = le32_to_cpu(desc->opts1);
+		status = le32_to_cpu(desc->opts1) & tp->opts1_mask;
 
 		if (status & DescOwn)
 			break;
-- 
1.7.6

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

* [PATCH 5/5] r8169: do not enable the TBI for anything but the original 8169.
  2011-09-17  9:56 [PATCH 0/5] Pull request for 'davem.r8169.fixes' branch Francois Romieu
                   ` (3 preceding siblings ...)
  2011-09-17  9:58 ` [PATCH 4/5] r8169: remove erroneous processing of always set bit Francois Romieu
@ 2011-09-17  9:59 ` Francois Romieu
  2011-09-20 18:43 ` [PATCH 0/5] Pull request for 'davem.r8169.fixes' branch David Miller
  5 siblings, 0 replies; 7+ messages in thread
From: Francois Romieu @ 2011-09-17  9:59 UTC (permalink / raw)
  To: davem; +Cc: netdev, Realtek linux nic maintainers, Hayes Wang

The TBI bit in PHYStatus is reserved on anything but the oldest 8169.

Nobody complained after I disabled it for the 8168 and the 810x (see
66ec5d4fb1ce6f0bd9df4bc4b758f0916d9f37ab).

Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Cc: Hayes Wang <hayeswang@realtek.com>
---
 drivers/net/r8169.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index dff0bf0..c236670 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -3080,6 +3080,14 @@ static void rtl8169_phy_reset(struct net_device *dev,
 	netif_err(tp, link, dev, "PHY reset failed\n");
 }
 
+static bool rtl_tbi_enabled(struct rtl8169_private *tp)
+{
+	void __iomem *ioaddr = tp->mmio_addr;
+
+	return (tp->mac_version == RTL_GIGA_MAC_VER_01) &&
+	    (RTL_R8(PHYstatus) & TBI_Enable);
+}
+
 static void rtl8169_init_phy(struct net_device *dev, struct rtl8169_private *tp)
 {
 	void __iomem *ioaddr = tp->mmio_addr;
@@ -3112,7 +3120,7 @@ static void rtl8169_init_phy(struct net_device *dev, struct rtl8169_private *tp)
 			   ADVERTISED_1000baseT_Half |
 			   ADVERTISED_1000baseT_Full : 0));
 
-	if (RTL_R8(PHYstatus) & TBI_Enable)
+	if (rtl_tbi_enabled(tp))
 		netif_info(tp, link, dev, "TBI auto-negotiating\n");
 }
 
@@ -3738,8 +3746,7 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 	tp->features |= rtl_try_msi(pdev, ioaddr, cfg);
 	RTL_W8(Cfg9346, Cfg9346_Lock);
 
-	if ((tp->mac_version <= RTL_GIGA_MAC_VER_06) &&
-	    (RTL_R8(PHYstatus) & TBI_Enable)) {
+	if (rtl_tbi_enabled(tp)) {
 		tp->set_speed = rtl8169_set_speed_tbi;
 		tp->get_settings = rtl8169_gset_tbi;
 		tp->phy_reset_enable = rtl8169_tbi_reset_enable;
-- 
1.7.6

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

* Re: [PATCH 0/5] Pull request for 'davem.r8169.fixes' branch
  2011-09-17  9:56 [PATCH 0/5] Pull request for 'davem.r8169.fixes' branch Francois Romieu
                   ` (4 preceding siblings ...)
  2011-09-17  9:59 ` [PATCH 5/5] r8169: do not enable the TBI for anything but the original 8169 Francois Romieu
@ 2011-09-20 18:43 ` David Miller
  5 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2011-09-20 18:43 UTC (permalink / raw)
  To: romieu; +Cc: netdev, nic_swsd, hayeswang

From: Francois Romieu <romieu@fr.zoreil.com>
Date: Sat, 17 Sep 2011 11:56:17 +0200

> Please pull from branch 'davem.r8169.fixes' in repository
> 
> git://violet.fr.zoreil.com/romieu/linux davem.r8169.fixes
> 
> to get the changes below.

Pulled, thanks a lot!

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

end of thread, other threads:[~2011-09-20 18:44 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-17  9:56 [PATCH 0/5] Pull request for 'davem.r8169.fixes' branch Francois Romieu
2011-09-17  9:57 ` [PATCH 1/5] r8169: fix the reset setting for 8111evl Francois Romieu
2011-09-17  9:57 ` [PATCH 2/5] r8169: add MODULE_FIRMWARE for the firmware of 8111evl Francois Romieu
2011-09-17  9:58 ` [PATCH 3/5] r8169: fix WOL setting for 8105 and 8111evl Francois Romieu
2011-09-17  9:58 ` [PATCH 4/5] r8169: remove erroneous processing of always set bit Francois Romieu
2011-09-17  9:59 ` [PATCH 5/5] r8169: do not enable the TBI for anything but the original 8169 Francois Romieu
2011-09-20 18:43 ` [PATCH 0/5] Pull request for 'davem.r8169.fixes' branch David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).