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 8/9] r8152: avoid the MCU to clear the lanwake Date: Tue, 21 Jan 2020 20:40:34 +0800 [thread overview] Message-ID: <1394712342-15778-346-Taiwan-albertk@realtek.com> (raw) In-Reply-To: <1394712342-15778-338-Taiwan-albertk@realtek.com> Avoid the MCU to clear the lanwake after suspending. It may cause the WOL fail. Disable LANWAKE_CLR_EN before suspending. Besides,enable it and reset the lanwake status when resuming or initializing. Signed-off-by: Hayes Wang <hayeswang@realtek.com> --- drivers/net/usb/r8152.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index 73256dfe77d7..0998b9587943 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -68,6 +68,7 @@ #define PLA_LED_FEATURE 0xdd92 #define PLA_PHYAR 0xde00 #define PLA_BOOT_CTRL 0xe004 +#define PLA_LWAKE_CTRL_REG 0xe007 #define PLA_GPHY_INTR_IMR 0xe022 #define PLA_EEE_CR 0xe040 #define PLA_EEEP_CR 0xe080 @@ -95,6 +96,7 @@ #define PLA_TALLYCNT 0xe890 #define PLA_SFF_STS_7 0xe8de #define PLA_PHYSTATUS 0xe908 +#define PLA_CONFIG6 0xe90a /* CONFIG6 */ #define PLA_BP_BA 0xfc26 #define PLA_BP_0 0xfc28 #define PLA_BP_1 0xfc2a @@ -300,6 +302,9 @@ #define LINK_ON_WAKE_EN 0x0010 #define LINK_OFF_WAKE_EN 0x0008 +/* PLA_CONFIG6 */ +#define LANWAKE_CLR_EN BIT(0) + /* PLA_CONFIG5 */ #define BWF_EN 0x0040 #define MWF_EN 0x0020 @@ -356,6 +361,9 @@ /* PLA_BOOT_CTRL */ #define AUTOLOAD_DONE 0x0002 +/* PLA_LWAKE_CTRL_REG */ +#define LANWAKE_PIN BIT(7) + /* PLA_SUSPEND_FLAG */ #define LINK_CHG_EVENT BIT(0) @@ -4967,6 +4975,8 @@ static void rtl8152_down(struct r8152 *tp) static void rtl8153_up(struct r8152 *tp) { + u32 ocp_data; + if (test_bit(RTL8152_UNPLUG, &tp->flags)) return; @@ -4974,6 +4984,15 @@ static void rtl8153_up(struct r8152 *tp) r8153_u2p3en(tp, false); r8153_aldps_en(tp, false); r8153_first_init(tp); + + ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_CONFIG6); + ocp_data |= LANWAKE_CLR_EN; + ocp_write_byte(tp, MCU_TYPE_PLA, PLA_CONFIG6, ocp_data); + + ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_LWAKE_CTRL_REG); + ocp_data &= ~LANWAKE_PIN; + ocp_write_byte(tp, MCU_TYPE_PLA, PLA_LWAKE_CTRL_REG, ocp_data); + r8153_aldps_en(tp, true); switch (tp->version) { @@ -4992,11 +5011,17 @@ static void rtl8153_up(struct r8152 *tp) static void rtl8153_down(struct r8152 *tp) { + u32 ocp_data; + if (test_bit(RTL8152_UNPLUG, &tp->flags)) { rtl_drop_queued_tx(tp); return; } + ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_CONFIG6); + ocp_data &= ~LANWAKE_CLR_EN; + ocp_write_byte(tp, MCU_TYPE_PLA, PLA_CONFIG6, ocp_data); + r8153_u1u2en(tp, false); r8153_u2p3en(tp, false); r8153_power_cut_en(tp, false); @@ -5457,6 +5482,14 @@ static void r8153_init(struct r8152 *tp) r8153_mac_clk_spd(tp, false); usb_enable_lpm(tp->udev); + ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_CONFIG6); + ocp_data |= LANWAKE_CLR_EN; + ocp_write_byte(tp, MCU_TYPE_PLA, PLA_CONFIG6, ocp_data); + + ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_LWAKE_CTRL_REG); + ocp_data &= ~LANWAKE_PIN; + ocp_write_byte(tp, MCU_TYPE_PLA, PLA_LWAKE_CTRL_REG, ocp_data); + /* rx aggregation */ ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_USB_CTRL); ocp_data &= ~(RX_AGG_DISABLE | RX_ZERO_EN); -- 2.21.0
WARNING: multiple messages have this Message-ID (diff)
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>, Hayes Wang <hayeswang@realtek.com> Subject: [PATCH net] r8152: move r8153_mac_clk_spd Date: Fri, 19 Feb 2021 17:38:03 +0800 [thread overview] Message-ID: <1394712342-15778-346-Taiwan-albertk@realtek.com> (raw) Message-ID: <20210219093803.Pbt8zX46KeD7pGM4UB97jelte19JdOHLkUIIvo7kQNA@z> (raw) Move calling r8153_mac_clk_spd() from r8153_first_init() to rtl8153_up(), and from r8153_enter_oob() to rtl8153_down(). r8153_mac_clk_spd() is used for RTL8153A. However, RTL8153B use r8153_first_init() and r8153_enter_oob(), too. Therefore, r8153_mac_clk_spd() needs to be moved. Signed-off-by: Hayes Wang <hayeswang@realtek.com> --- drivers/net/usb/r8152.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index 67cd6986634f..ec29878db566 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -4678,7 +4678,6 @@ static void r8153_first_init(struct r8152 *tp) { u32 ocp_data; - r8153_mac_clk_spd(tp, false); rxdy_gated_en(tp, true); r8153_teredo_off(tp); @@ -4729,8 +4728,6 @@ static void r8153_enter_oob(struct r8152 *tp) { u32 ocp_data; - r8153_mac_clk_spd(tp, true); - ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL); ocp_data &= ~NOW_IS_OOB; ocp_write_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL, ocp_data); @@ -4956,6 +4953,7 @@ static void rtl8153_up(struct r8152 *tp) r8153_u1u2en(tp, false); r8153_u2p3en(tp, false); r8153_aldps_en(tp, false); + r8153_mac_clk_spd(tp, false); r8153_first_init(tp); ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_CONFIG6); @@ -5003,6 +5001,7 @@ static void rtl8153_down(struct r8152 *tp) r8153_u2p3en(tp, false); r8153_power_cut_en(tp, false); r8153_aldps_en(tp, false); + r8153_mac_clk_spd(tp, true); r8153_enter_oob(tp); r8153_aldps_en(tp, true); } -- 2.26.2
next prev parent reply other threads:[~2020-01-21 12:43 UTC|newest] Thread overview: 89+ 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 ` Hayes Wang [this message] 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 2020-01-22 7:02 ` Grant Grundler 2020-01-22 7:50 ` Hayes Wang 2021-03-03 8:39 ` [PATCH net] Revert "r8152: adjust the settings about MAC clock speed down for RTL8153" Hayes Wang 2021-03-04 1:00 ` patchwork-bot+netdevbpf 2020-01-22 1:41 ` [PATCH net v2 0/9] r8152: serial fixes 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-03-05 9:34 ` [PATCH net] r8169: fix r8168fp_adjust_ocp_cmd function Hayes Wang 2021-03-05 11:48 ` 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 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 ` [PATCH net v3 9/9] r8152: disable DelayPhyPwrChg Hayes Wang 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 8:48 ` [PATCH net-next] r8152: replace return with break for ram code speedup mode timeout Hayes Wang 2021-04-22 21:20 ` 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-346-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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).