All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hayes Wang <hayeswang@realtek.com>
To: <netdev@vger.kernel.org>
Cc: <nic_swsd@realtek.com>, <linux-kernel@vger.kernel.org>,
	<linux-usb@vger.kernel.org>, <pmalani@chromium.org>,
	<grundler@chromium.org>, Hayes Wang <hayeswang@realtek.com>
Subject: [PATCH net v3 9/9] r8152: disable DelayPhyPwrChg
Date: Wed, 22 Jan 2020 16:02:13 +0800	[thread overview]
Message-ID: <1394712342-15778-367-Taiwan-albertk@realtek.com> (raw)
In-Reply-To: <1394712342-15778-358-Taiwan-albertk@realtek.com>

When enabling this, the device would wait an internal signal which
wouldn't be triggered. Then, the device couldn't enter P3 mode, so
the power consumption is increased.

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

diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index c037fc7adcea..3f425f974d03 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -31,7 +31,7 @@
 #define NETNEXT_VERSION		"11"
 
 /* Information for net */
-#define NET_VERSION		"10"
+#define NET_VERSION		"11"
 
 #define DRIVER_VERSION		"v1." NETNEXT_VERSION "." NET_VERSION
 #define DRIVER_AUTHOR "Realtek linux nic maintainers <nic_swsd@realtek.com>"
@@ -109,6 +109,7 @@
 #define PLA_BP_EN		0xfc38
 
 #define USB_USB2PHY		0xb41e
+#define USB_SSPHYLINK1		0xb426
 #define USB_SSPHYLINK2		0xb428
 #define USB_U2P3_CTRL		0xb460
 #define USB_CSR_DUMMY1		0xb464
@@ -384,6 +385,9 @@
 #define USB2PHY_SUSPEND		0x0001
 #define USB2PHY_L1		0x0002
 
+/* USB_SSPHYLINK1 */
+#define DELAY_PHY_PWR_CHG	BIT(1)
+
 /* USB_SSPHYLINK2 */
 #define pwd_dn_scale_mask	0x3ffe
 #define pwd_dn_scale(x)		((x) << 1)
@@ -4994,6 +4998,10 @@ static void rtl8153_up(struct r8152 *tp)
 	ocp_data &= ~LANWAKE_PIN;
 	ocp_write_byte(tp, MCU_TYPE_PLA, PLA_LWAKE_CTRL_REG, ocp_data);
 
+	ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_SSPHYLINK1);
+	ocp_data &= ~DELAY_PHY_PWR_CHG;
+	ocp_write_word(tp, MCU_TYPE_USB, USB_SSPHYLINK1, ocp_data);
+
 	r8153_aldps_en(tp, true);
 
 	switch (tp->version) {
-- 
2.21.0


WARNING: multiple messages have this Message-ID (diff)
From: Hayes Wang <hayeswang@realtek.com>
To: <kuba@kernel.org>, <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>, <nic_swsd@realtek.com>,
	<linux-kernel@vger.kernel.org>, <linux-usb@vger.kernel.org>,
	Hayes Wang <hayeswang@realtek.com>
Subject: [PATCH net-next] r8152: store the information of the pipes
Date: Thu, 17 Jun 2021 18:00:15 +0800	[thread overview]
Message-ID: <1394712342-15778-367-Taiwan-albertk@realtek.com> (raw)
Message-ID: <20210617100015.HN6iwuVXVr8bKwHZem2rjISXYqd0poncDcAzQS850OU@z> (raw)

Store the information of the pipes to avoid calling usb_rcvctrlpipe(),
usb_sndctrlpipe(), usb_rcvbulkpipe(), usb_sndbulkpipe(), and
usb_rcvintpipe() frequently.

Signed-off-by: Hayes Wang <hayeswang@realtek.com>
---
 drivers/net/usb/r8152.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index 85039e17f4cd..62cd48dc2878 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -931,6 +931,8 @@ struct r8152 {
 	u32 rx_pending;
 	u32 fc_pause_on, fc_pause_off;
 
+	unsigned int pipe_in, pipe_out, pipe_intr, pipe_ctrl_in, pipe_ctrl_out;
+
 	u32 support_2500full:1;
 	u32 lenovo_macpassthru:1;
 	u32 dell_tb_rx_agg_bug:1;
@@ -1198,7 +1200,7 @@ int get_registers(struct r8152 *tp, u16 value, u16 index, u16 size, void *data)
 	if (!tmp)
 		return -ENOMEM;
 
-	ret = usb_control_msg(tp->udev, usb_rcvctrlpipe(tp->udev, 0),
+	ret = usb_control_msg(tp->udev, tp->pipe_ctrl_in,
 			      RTL8152_REQ_GET_REGS, RTL8152_REQT_READ,
 			      value, index, tmp, size, 500);
 	if (ret < 0)
@@ -1221,7 +1223,7 @@ int set_registers(struct r8152 *tp, u16 value, u16 index, u16 size, void *data)
 	if (!tmp)
 		return -ENOMEM;
 
-	ret = usb_control_msg(tp->udev, usb_sndctrlpipe(tp->udev, 0),
+	ret = usb_control_msg(tp->udev, tp->pipe_ctrl_out,
 			      RTL8152_REQ_SET_REGS, RTL8152_REQT_WRITE,
 			      value, index, tmp, size, 500);
 
@@ -2041,7 +2043,7 @@ static int alloc_all_mem(struct r8152 *tp)
 		goto err1;
 
 	tp->intr_interval = (int)ep_intr->desc.bInterval;
-	usb_fill_int_urb(tp->intr_urb, tp->udev, usb_rcvintpipe(tp->udev, 3),
+	usb_fill_int_urb(tp->intr_urb, tp->udev, tp->pipe_intr,
 			 tp->intr_buff, INTBUFSIZE, intr_callback,
 			 tp, tp->intr_interval);
 
@@ -2305,7 +2307,7 @@ static int r8152_tx_agg_fill(struct r8152 *tp, struct tx_agg *agg)
 	if (ret < 0)
 		goto out_tx_fill;
 
-	usb_fill_bulk_urb(agg->urb, tp->udev, usb_sndbulkpipe(tp->udev, 2),
+	usb_fill_bulk_urb(agg->urb, tp->udev, tp->pipe_out,
 			  agg->head, (int)(tx_data - (u8 *)agg->head),
 			  (usb_complete_t)write_bulk_callback, agg);
 
@@ -2620,7 +2622,7 @@ int r8152_submit_rx(struct r8152 *tp, struct rx_agg *agg, gfp_t mem_flags)
 	    !test_bit(WORK_ENABLE, &tp->flags) || !netif_carrier_ok(tp->netdev))
 		return 0;
 
-	usb_fill_bulk_urb(agg->urb, tp->udev, usb_rcvbulkpipe(tp->udev, 1),
+	usb_fill_bulk_urb(agg->urb, tp->udev, tp->pipe_in,
 			  agg->buffer, tp->rx_buf_sz,
 			  (usb_complete_t)read_bulk_callback, agg);
 
@@ -9507,6 +9509,12 @@ static int rtl8152_probe(struct usb_interface *intf,
 	tp->intf = intf;
 	tp->version = version;
 
+	tp->pipe_ctrl_in = usb_rcvctrlpipe(udev, 0);
+	tp->pipe_ctrl_out = usb_sndctrlpipe(udev, 0);
+	tp->pipe_in = usb_rcvbulkpipe(udev, 1);
+	tp->pipe_out = usb_sndbulkpipe(udev, 2);
+	tp->pipe_intr = usb_rcvintpipe(udev, 3);
+
 	switch (version) {
 	case RTL_VER_01:
 	case RTL_VER_02:
-- 
2.26.3


  parent reply	other threads:[~2020-01-22  8:03 UTC|newest]

Thread overview: 91+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-21 12:40 [PATCH net 0/9] r8152: serial fixes Hayes Wang
2020-01-21 12:40 ` [PATCH net 1/9] r8152: fix runtime resume for linking change Hayes Wang
2020-01-22  9:47   ` Sergei Shtylyov
2020-01-21 12:40 ` [PATCH net 2/9] r8152: reset flow control patch when linking on for RTL8153B Hayes Wang
2020-01-21 12:54   ` David Miller
2020-01-21 13:01     ` Joe Perches
2020-01-21 13:19       ` Hayes Wang
2020-01-21 12:40 ` [PATCH net 3/9] r8152: get default setting of WOL before initializing Hayes Wang
2021-02-19  9:04   ` [PATCH net-next 0/4] r8152: minor adjustments Hayes Wang
2021-02-23 20:40   ` patchwork-bot+netdevbpf
2020-01-21 12:40 ` [PATCH net 4/9] r8152: disable U2P3 for RTL8153B Hayes Wang
2021-02-19  9:04   ` [PATCH net-next 1/4] r8152: enable U1/U2 for USB_SPEED_SUPER Hayes Wang
2020-01-21 12:40 ` [PATCH net 5/9] r8152: Disable PLA MCU clock speed down Hayes Wang
2021-02-19  9:04   ` [PATCH net-next 2/4] r8152: check if the pointer of the function exists Hayes Wang
2020-01-21 12:40 ` [PATCH net 6/9] r8152: disable test IO for RTL8153B Hayes Wang
2021-02-19  9:04   ` [PATCH net-next 3/4] r8152: replace netif_err with dev_err Hayes Wang
2020-01-21 12:40 ` [PATCH net 7/9] r8152: don't enable U1U2 with USB_SPEED_HIGH for RTL8153B Hayes Wang
2021-02-19  9:04   ` [PATCH net-next 4/4] r8152: spilt rtl_set_eee_plus and r8153b_green_en Hayes Wang
2020-01-21 12:40 ` [PATCH net 8/9] r8152: avoid the MCU to clear the lanwake Hayes Wang
2021-02-19  9:38   ` [PATCH net] r8152: move r8153_mac_clk_spd Hayes Wang
2021-02-19 18:22   ` Jakub Kicinski
2021-02-22  6:19     ` Hayes Wang
2020-01-21 12:40 ` [PATCH net 9/9] r8152: disable DelayPhyPwrChg Hayes Wang
2021-03-03  8:39   ` [PATCH net] Revert "r8152: adjust the settings about MAC clock speed down for RTL8153" Hayes Wang
2020-01-22  7:02   ` [PATCH net 9/9] r8152: disable DelayPhyPwrChg Grant Grundler
2020-01-22  7:50     ` Hayes Wang
2021-03-04  1:00   ` [PATCH net] Revert "r8152: adjust the settings about MAC clock speed down for RTL8153" patchwork-bot+netdevbpf
2020-01-22  1:41 ` [PATCH net v2 0/9] r8152: serial fixes Hayes Wang
2021-03-05  9:34   ` [PATCH net] r8169: fix r8168fp_adjust_ocp_cmd function Hayes Wang
2020-01-22  1:41   ` [PATCH net v2 1/9] r8152: fix runtime resume for linking change Hayes Wang
2021-03-19  7:37     ` [PATCH net] r8152: limit the RX buffer size of RTL8153A for USB 2.0 Hayes Wang
2020-01-22  1:41   ` [PATCH net v2 2/9] r8152: reset flow control patch when linking on for RTL8153B Hayes Wang
2021-04-16  8:04     ` [PATCH net-next 0/6] r8152: support new chips Hayes Wang
2021-04-16 22:40     ` patchwork-bot+netdevbpf
2020-01-22  1:41   ` [PATCH net v2 3/9] r8152: get default setting of WOL before initializing Hayes Wang
2021-04-16  8:04     ` [PATCH net-next 1/6] r8152: set inter fram gap time depending on speed Hayes Wang
2020-01-22  1:41   ` [PATCH net v2 4/9] r8152: disable U2P3 for RTL8153B Hayes Wang
2021-04-16  8:04     ` [PATCH net-next 2/6] r8152: adjust rtl8152_check_firmware function Hayes Wang
2020-01-22  1:41   ` [PATCH net v2 5/9] r8152: Disable PLA MCU clock speed down Hayes Wang
2021-04-16  8:04     ` [PATCH net-next 3/6] r8152: add help function to change mtu Hayes Wang
2020-01-22  1:41   ` [PATCH net v2 6/9] r8152: disable test IO for RTL8153B Hayes Wang
2021-04-16  8:04     ` [PATCH net-next 4/6] r8152: support new chips Hayes Wang
2021-04-16 21:50     ` Jakub Kicinski
2021-04-20  7:00       ` Hayes Wang
2021-04-20 18:34         ` Jakub Kicinski
2021-04-21  2:23           ` Hayes Wang
2020-01-22  1:41   ` [PATCH net v2 7/9] r8152: don't enable U1U2 with USB_SPEED_HIGH for RTL8153B Hayes Wang
2021-04-16  8:04     ` [PATCH net-next 5/6] r8152: support PHY firmware for RTL8156 series Hayes Wang
2020-01-22  1:41   ` [PATCH net v2 8/9] r8152: avoid the MCU to clear the lanwake Hayes Wang
2021-04-16  8:04     ` [PATCH net-next 6/6] r8152: search the configuration of vendor mode Hayes Wang
2020-01-22  1:41   ` [PATCH net v2 9/9] r8152: disable DelayPhyPwrChg Hayes Wang
2021-04-20 12:40     ` [PATCH linux-firmware] rtl_nic: add new firmware for RTL8153 and RTL8156 series Hayes Wang
2021-04-21 11:07     ` Josh Boyer
2021-03-05 11:48   ` [PATCH net] r8169: fix r8168fp_adjust_ocp_cmd function Heiner Kallweit
2021-03-05 21:10   ` patchwork-bot+netdevbpf
2020-01-22  8:02 ` [PATCH net v3 0/9] r8152: serial fixes Hayes Wang
2021-04-22  8:48   ` [PATCH net-next] r8152: replace return with break for ram code speedup mode timeout Hayes Wang
2020-01-22  8:02   ` [PATCH net v3 1/9] r8152: fix runtime resume for linking change Hayes Wang
2021-04-23  9:44     ` [PATCH net-next 0/2] r8152: adjust REALTEK_USB_DEVICE Hayes Wang
2021-04-23 21:00     ` patchwork-bot+netdevbpf
2020-01-22  8:02   ` [PATCH net v3 2/9] r8152: reset flow control patch when linking on for RTL8153B Hayes Wang
2021-04-23  9:44     ` [PATCH net-next 1/2] r8152: remove NCM mode from REALTEK_USB_DEVICE macro Hayes Wang
2020-01-22  8:02   ` [PATCH net v3 3/9] r8152: get default setting of WOL before initializing Hayes Wang
2021-04-23  9:44     ` [PATCH net-next 2/2] r8152: redefine REALTEK_USB_DEVICE macro Hayes Wang
2020-01-22  8:02   ` [PATCH net v3 4/9] r8152: disable U2P3 for RTL8153B Hayes Wang
2021-04-24  6:09     ` [PATCH net-next] r8152: remove some bit operations Hayes Wang
2021-04-26  1:30     ` patchwork-bot+netdevbpf
2020-01-22  8:02   ` [PATCH net v3 5/9] r8152: Disable PLA MCU clock speed down Hayes Wang
2021-05-21  9:07     ` [PATCH net] r8152: check the informaton of the device Hayes Wang
2021-05-21  9:42     ` Greg KH
2021-05-22  3:13       ` Hayes Wang
2020-01-22  8:02   ` [PATCH net v3 6/9] r8152: disable test IO for RTL8153B Hayes Wang
2021-05-22  5:24     ` [PATCH net v2] r8152: check the informaton of the device Hayes Wang
2021-05-22  7:32     ` Greg KH
2021-05-22  8:07       ` Johan Hovold
2021-05-24  1:49         ` Hayes Wang
2021-05-24  7:44           ` Johan Hovold
2020-01-22  8:02   ` [PATCH net v3 7/9] r8152: don't enable U1U2 with USB_SPEED_HIGH for RTL8153B Hayes Wang
2021-05-24  6:49     ` [PATCH net v3] r8152: check the informaton of the device Hayes Wang
2021-05-24  8:00     ` Johan Hovold
2021-05-24  8:54       ` Hayes Wang
2021-05-24  9:13         ` Johan Hovold
2021-05-24 20:20     ` patchwork-bot+netdevbpf
2020-01-22  8:02   ` [PATCH net v3 8/9] r8152: avoid the MCU to clear the lanwake Hayes Wang
2021-06-01  7:37     ` [PATCH net-next] r8152: support pauseparam of ethtool_ops Hayes Wang
2021-06-01 22:30     ` patchwork-bot+netdevbpf
2020-01-22  8:02   ` Hayes Wang [this message]
2021-06-17 10:00     ` [PATCH net-next] r8152: store the information of the pipes Hayes Wang
2021-06-17 19:20     ` patchwork-bot+netdevbpf
2020-01-23 10:21   ` [PATCH net v3 0/9] r8152: serial fixes David Miller
2021-04-22 21:20   ` [PATCH net-next] r8152: replace return with break for ram code speedup mode timeout patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1394712342-15778-367-Taiwan-albertk@realtek.com \
    --to=hayeswang@realtek.com \
    --cc=grundler@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nic_swsd@realtek.com \
    --cc=pmalani@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.