linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 0/2] r8152: fix bp settings
@ 2021-08-19  3:05 Hayes Wang
  2021-08-19  3:05 ` [PATCH net 1/2] r8152: fix writing USB_BP2_EN Hayes Wang
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Hayes Wang @ 2021-08-19  3:05 UTC (permalink / raw)
  To: kuba, davem; +Cc: netdev, nic_swsd, linux-kernel, linux-usb, Hayes Wang

Fix the wrong bp settings of the firmware.

Hayes Wang (2):
  r8152: fix writing USB_BP2_EN
  r8152: fix the maximum number of PLA bp for RTL8153C

 drivers/net/usb/r8152.c | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

-- 
2.31.1


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

* [PATCH net 1/2] r8152: fix writing USB_BP2_EN
  2021-08-19  3:05 [PATCH net 0/2] r8152: fix bp settings Hayes Wang
@ 2021-08-19  3:05 ` Hayes Wang
  2021-08-19  3:05 ` [PATCH net 2/2] r8152: fix the maximum number of PLA bp for RTL8153C Hayes Wang
  2021-08-19 11:30 ` [PATCH net 0/2] r8152: fix bp settings patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Hayes Wang @ 2021-08-19  3:05 UTC (permalink / raw)
  To: kuba, davem; +Cc: netdev, nic_swsd, linux-kernel, linux-usb, Hayes Wang

The register of USB_BP2_EN is 16 bits, so we should use
ocp_write_word(), not ocp_write_byte().

Fixes: 9370f2d05a2a ("support request_firmware for RTL8153")
Signed-off-by: Hayes Wang <hayeswang@realtek.com>
---
 drivers/net/usb/r8152.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index e09b107b5c99..3fd17b6dc61d 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -3965,7 +3965,7 @@ static void rtl_clear_bp(struct r8152 *tp, u16 type)
 	case RTL_VER_15:
 	default:
 		if (type == MCU_TYPE_USB) {
-			ocp_write_byte(tp, MCU_TYPE_USB, USB_BP2_EN, 0);
+			ocp_write_word(tp, MCU_TYPE_USB, USB_BP2_EN, 0);
 
 			ocp_write_word(tp, MCU_TYPE_USB, USB_BP_8, 0);
 			ocp_write_word(tp, MCU_TYPE_USB, USB_BP_9, 0);
-- 
2.31.1


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

* [PATCH net 2/2] r8152: fix the maximum number of PLA bp for RTL8153C
  2021-08-19  3:05 [PATCH net 0/2] r8152: fix bp settings Hayes Wang
  2021-08-19  3:05 ` [PATCH net 1/2] r8152: fix writing USB_BP2_EN Hayes Wang
@ 2021-08-19  3:05 ` Hayes Wang
  2021-08-19 11:30 ` [PATCH net 0/2] r8152: fix bp settings patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Hayes Wang @ 2021-08-19  3:05 UTC (permalink / raw)
  To: kuba, davem; +Cc: netdev, nic_swsd, linux-kernel, linux-usb, Hayes Wang

The maximum PLA bp number of RTL8153C is 16, not 8. That is, the
bp 0 ~ 15 are at 0xfc28 ~ 0xfc46, and the bp_en is at 0xfc48.

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

diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index 3fd17b6dc61d..79832374f78d 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -3955,13 +3955,24 @@ static void rtl_clear_bp(struct r8152 *tp, u16 type)
 	case RTL_VER_06:
 		ocp_write_byte(tp, type, PLA_BP_EN, 0);
 		break;
+	case RTL_VER_14:
+		ocp_write_word(tp, type, USB_BP2_EN, 0);
+
+		ocp_write_word(tp, type, USB_BP_8, 0);
+		ocp_write_word(tp, type, USB_BP_9, 0);
+		ocp_write_word(tp, type, USB_BP_10, 0);
+		ocp_write_word(tp, type, USB_BP_11, 0);
+		ocp_write_word(tp, type, USB_BP_12, 0);
+		ocp_write_word(tp, type, USB_BP_13, 0);
+		ocp_write_word(tp, type, USB_BP_14, 0);
+		ocp_write_word(tp, type, USB_BP_15, 0);
+		break;
 	case RTL_VER_08:
 	case RTL_VER_09:
 	case RTL_VER_10:
 	case RTL_VER_11:
 	case RTL_VER_12:
 	case RTL_VER_13:
-	case RTL_VER_14:
 	case RTL_VER_15:
 	default:
 		if (type == MCU_TYPE_USB) {
@@ -4331,7 +4342,6 @@ static bool rtl8152_is_fw_mac_ok(struct r8152 *tp, struct fw_mac *mac)
 		case RTL_VER_11:
 		case RTL_VER_12:
 		case RTL_VER_13:
-		case RTL_VER_14:
 		case RTL_VER_15:
 			fw_reg = 0xf800;
 			bp_ba_addr = PLA_BP_BA;
@@ -4339,6 +4349,13 @@ static bool rtl8152_is_fw_mac_ok(struct r8152 *tp, struct fw_mac *mac)
 			bp_start = PLA_BP_0;
 			max_bp = 8;
 			break;
+		case RTL_VER_14:
+			fw_reg = 0xf800;
+			bp_ba_addr = PLA_BP_BA;
+			bp_en_addr = USB_BP2_EN;
+			bp_start = PLA_BP_0;
+			max_bp = 16;
+			break;
 		default:
 			goto out;
 		}
-- 
2.31.1


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

* Re: [PATCH net 0/2] r8152: fix bp settings
  2021-08-19  3:05 [PATCH net 0/2] r8152: fix bp settings Hayes Wang
  2021-08-19  3:05 ` [PATCH net 1/2] r8152: fix writing USB_BP2_EN Hayes Wang
  2021-08-19  3:05 ` [PATCH net 2/2] r8152: fix the maximum number of PLA bp for RTL8153C Hayes Wang
@ 2021-08-19 11:30 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-08-19 11:30 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 (refs/heads/master):

On Thu, 19 Aug 2021 11:05:35 +0800 you wrote:
> Fix the wrong bp settings of the firmware.
> 
> Hayes Wang (2):
>   r8152: fix writing USB_BP2_EN
>   r8152: fix the maximum number of PLA bp for RTL8153C
> 
>  drivers/net/usb/r8152.c | 23 ++++++++++++++++++++---
>  1 file changed, 20 insertions(+), 3 deletions(-)

Here is the summary with links:
  - [net,1/2] r8152: fix writing USB_BP2_EN
    https://git.kernel.org/netdev/net/c/a876a33d2a11
  - [net,2/2] r8152: fix the maximum number of PLA bp for RTL8153C
    https://git.kernel.org/netdev/net/c/6633fb83f1fa

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:[~2021-08-19 11:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-19  3:05 [PATCH net 0/2] r8152: fix bp settings Hayes Wang
2021-08-19  3:05 ` [PATCH net 1/2] r8152: fix writing USB_BP2_EN Hayes Wang
2021-08-19  3:05 ` [PATCH net 2/2] r8152: fix the maximum number of PLA bp for RTL8153C Hayes Wang
2021-08-19 11:30 ` [PATCH net 0/2] r8152: fix bp settings patchwork-bot+netdevbpf

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).