All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net 0/2] r8152: fix flow control settings
@ 2022-08-18  8:06 Hayes Wang
  2022-08-18  8:06 ` [PATCH net 1/2] r8152: fix the units of some registers for RTL8156A Hayes Wang
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Hayes Wang @ 2022-08-18  8:06 UTC (permalink / raw)
  To: kuba, davem; +Cc: netdev, nic_swsd, linux-kernel, linux-usb, Hayes Wang

These patches fix the settings of RX FIFO about flow control.

Hayes Wang (2):
  r8152: fix the units of some registers for RTL8156A
  r8152: fix the RX FIFO settings when suspending

 drivers/net/usb/r8152.c | 27 ++++++++++++---------------
 1 file changed, 12 insertions(+), 15 deletions(-)

-- 
2.34.3


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

* [PATCH net 1/2] r8152: fix the units of some registers for RTL8156A
  2022-08-18  8:06 [PATCH net 0/2] r8152: fix flow control settings Hayes Wang
@ 2022-08-18  8:06 ` Hayes Wang
  2022-08-18  8:06 ` [PATCH net 2/2] r8152: fix the RX FIFO settings when suspending Hayes Wang
  2022-08-22 14:00 ` [PATCH net 0/2] r8152: fix flow control settings patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Hayes Wang @ 2022-08-18  8:06 UTC (permalink / raw)
  To: kuba, davem; +Cc: netdev, nic_swsd, linux-kernel, linux-usb, Hayes Wang

The units of PLA_RX_FIFO_FULL and PLA_RX_FIFO_EMPTY are 16 bytes.

Fixes: 195aae321c82 ("r8152: support new chips")
Signed-off-by: Hayes Wang <hayeswang@realtek.com>
---
 drivers/net/usb/r8152.c | 17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index 0f6efaabaa32..46c7954d2762 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -6431,21 +6431,8 @@ static void r8156_fc_parameter(struct r8152 *tp)
 	u32 pause_on = tp->fc_pause_on ? tp->fc_pause_on : fc_pause_on_auto(tp);
 	u32 pause_off = tp->fc_pause_off ? tp->fc_pause_off : fc_pause_off_auto(tp);
 
-	switch (tp->version) {
-	case RTL_VER_10:
-	case RTL_VER_11:
-		ocp_write_word(tp, MCU_TYPE_PLA, PLA_RX_FIFO_FULL, pause_on / 8);
-		ocp_write_word(tp, MCU_TYPE_PLA, PLA_RX_FIFO_EMPTY, pause_off / 8);
-		break;
-	case RTL_VER_12:
-	case RTL_VER_13:
-	case RTL_VER_15:
-		ocp_write_word(tp, MCU_TYPE_PLA, PLA_RX_FIFO_FULL, pause_on / 16);
-		ocp_write_word(tp, MCU_TYPE_PLA, PLA_RX_FIFO_EMPTY, pause_off / 16);
-		break;
-	default:
-		break;
-	}
+	ocp_write_word(tp, MCU_TYPE_PLA, PLA_RX_FIFO_FULL, pause_on / 16);
+	ocp_write_word(tp, MCU_TYPE_PLA, PLA_RX_FIFO_EMPTY, pause_off / 16);
 }
 
 static void rtl8156_change_mtu(struct r8152 *tp)
-- 
2.34.3


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

* [PATCH net 2/2] r8152: fix the RX FIFO settings when suspending
  2022-08-18  8:06 [PATCH net 0/2] r8152: fix flow control settings Hayes Wang
  2022-08-18  8:06 ` [PATCH net 1/2] r8152: fix the units of some registers for RTL8156A Hayes Wang
@ 2022-08-18  8:06 ` Hayes Wang
  2022-08-22 14:00 ` [PATCH net 0/2] r8152: fix flow control settings patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Hayes Wang @ 2022-08-18  8:06 UTC (permalink / raw)
  To: kuba, davem
  Cc: netdev, nic_swsd, linux-kernel, linux-usb, Hayes Wang, Mark Blakeney

The RX FIFO would be changed when suspending, so the related settings
have to be modified, too. Otherwise, the flow control would work
abnormally.

BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=216333
Reported-by: Mark Blakeney <mark.blakeney@bullet-systems.net>
Fixes: cdf0b86b250f ("r8152: fix a WOL issue")
Signed-off-by: Hayes Wang <hayeswang@realtek.com>
---
 drivers/net/usb/r8152.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index 46c7954d2762..d142ac8fcf6e 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -5906,6 +5906,11 @@ static void r8153_enter_oob(struct r8152 *tp)
 	ocp_data &= ~NOW_IS_OOB;
 	ocp_write_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL, ocp_data);
 
+	/* RX FIFO settings for OOB */
+	ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RXFIFO_CTRL0, RXFIFO_THR1_OOB);
+	ocp_write_word(tp, MCU_TYPE_PLA, PLA_RXFIFO_CTRL1, RXFIFO_THR2_OOB);
+	ocp_write_word(tp, MCU_TYPE_PLA, PLA_RXFIFO_CTRL2, RXFIFO_THR3_OOB);
+
 	rtl_disable(tp);
 	rtl_reset_bmu(tp);
 
@@ -6544,6 +6549,11 @@ static void rtl8156_down(struct r8152 *tp)
 	ocp_data &= ~NOW_IS_OOB;
 	ocp_write_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL, ocp_data);
 
+	/* RX FIFO settings for OOB */
+	ocp_write_word(tp, MCU_TYPE_PLA, PLA_RXFIFO_FULL, 64 / 16);
+	ocp_write_word(tp, MCU_TYPE_PLA, PLA_RX_FIFO_FULL, 1024 / 16);
+	ocp_write_word(tp, MCU_TYPE_PLA, PLA_RX_FIFO_EMPTY, 4096 / 16);
+
 	rtl_disable(tp);
 	rtl_reset_bmu(tp);
 
-- 
2.34.3


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

* Re: [PATCH net 0/2] r8152: fix flow control settings
  2022-08-18  8:06 [PATCH net 0/2] r8152: fix flow control settings Hayes Wang
  2022-08-18  8:06 ` [PATCH net 1/2] r8152: fix the units of some registers for RTL8156A Hayes Wang
  2022-08-18  8:06 ` [PATCH net 2/2] r8152: fix the RX FIFO settings when suspending Hayes Wang
@ 2022-08-22 14:00 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-08-22 14:00 UTC (permalink / raw)
  To: Hayes Wang; +Cc: kuba, davem, netdev, nic_swsd, linux-kernel, linux-usb

Hello:

This series was applied to netdev/net.git (master)
by David S. Miller <davem@davemloft.net>:

On Thu, 18 Aug 2022 16:06:18 +0800 you wrote:
> These patches fix the settings of RX FIFO about flow control.
> 
> Hayes Wang (2):
>   r8152: fix the units of some registers for RTL8156A
>   r8152: fix the RX FIFO settings when suspending
> 
>  drivers/net/usb/r8152.c | 27 ++++++++++++---------------
>  1 file changed, 12 insertions(+), 15 deletions(-)

Here is the summary with links:
  - [net,1/2] r8152: fix the units of some registers for RTL8156A
    https://git.kernel.org/netdev/net/c/6dc4df12d741
  - [net,2/2] r8152: fix the RX FIFO settings when suspending
    https://git.kernel.org/netdev/net/c/b75d61201444

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2022-08-22 14:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-18  8:06 [PATCH net 0/2] r8152: fix flow control settings Hayes Wang
2022-08-18  8:06 ` [PATCH net 1/2] r8152: fix the units of some registers for RTL8156A Hayes Wang
2022-08-18  8:06 ` [PATCH net 2/2] r8152: fix the RX FIFO settings when suspending Hayes Wang
2022-08-22 14:00 ` [PATCH net 0/2] r8152: fix flow control settings patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.