All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hayes Wang <hayeswang@realtek.com>
To: <hkallweit1@gmail.com>
Cc: <netdev@vger.kernel.org>, <nic_swsd@realtek.com>,
	Hayes Wang <hayeswang@realtek.com>
Subject: [RFC PATCH 1/4] r8169: remove the relative code about dash
Date: Mon, 29 Nov 2021 18:13:12 +0800	[thread overview]
Message-ID: <20211129101315.16372-382-nic_swsd@realtek.com> (raw)
In-Reply-To: <20211129101315.16372-381-nic_swsd@realtek.com>

Remove the relative code of dash, except for RTL8111DP.

The flow of initialization is different when considering supporting the
dash, so remove the relative code first.

The RTL8111DP has the different design and is stopped to maintain, so
keep the current behavior is enough.

Signed-off-by: Hayes Wang <hayeswang@realtek.com>
---
 drivers/net/ethernet/realtek/r8169_main.c | 70 ++---------------------
 1 file changed, 5 insertions(+), 65 deletions(-)

diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
index 3d6843332c77..fd295bcd125c 100644
--- a/drivers/net/ethernet/realtek/r8169_main.c
+++ b/drivers/net/ethernet/realtek/r8169_main.c
@@ -245,10 +245,6 @@ enum rtl_registers {
 	FuncEvent	= 0xf0,
 	FuncEventMask	= 0xf4,
 	FuncPresetState	= 0xf8,
-	IBCR0           = 0xf8,
-	IBCR2           = 0xf9,
-	IBIMR0          = 0xfa,
-	IBISR0          = 0xfb,
 	FuncForceEvent	= 0xfc,
 };
 
@@ -1127,67 +1123,18 @@ DECLARE_RTL_COND(rtl_dp_ocp_read_cond)
 	return r8168dp_ocp_read(tp, reg) & 0x00000800;
 }
 
-DECLARE_RTL_COND(rtl_ep_ocp_read_cond)
-{
-	return r8168ep_ocp_read(tp, 0x124) & 0x00000001;
-}
-
-DECLARE_RTL_COND(rtl_ocp_tx_cond)
-{
-	return RTL_R8(tp, IBISR0) & 0x20;
-}
-
-static void rtl8168ep_stop_cmac(struct rtl8169_private *tp)
-{
-	RTL_W8(tp, IBCR2, RTL_R8(tp, IBCR2) & ~0x01);
-	rtl_loop_wait_high(tp, &rtl_ocp_tx_cond, 50000, 2000);
-	RTL_W8(tp, IBISR0, RTL_R8(tp, IBISR0) | 0x20);
-	RTL_W8(tp, IBCR0, RTL_R8(tp, IBCR0) & ~0x01);
-}
-
 static void rtl8168dp_driver_start(struct rtl8169_private *tp)
 {
 	r8168dp_oob_notify(tp, OOB_CMD_DRIVER_START);
 	rtl_loop_wait_high(tp, &rtl_dp_ocp_read_cond, 10000, 10);
 }
 
-static void rtl8168ep_driver_start(struct rtl8169_private *tp)
-{
-	r8168ep_ocp_write(tp, 0x01, 0x180, OOB_CMD_DRIVER_START);
-	r8168ep_ocp_write(tp, 0x01, 0x30, r8168ep_ocp_read(tp, 0x30) | 0x01);
-	rtl_loop_wait_high(tp, &rtl_ep_ocp_read_cond, 10000, 10);
-}
-
-static void rtl8168_driver_start(struct rtl8169_private *tp)
-{
-	if (tp->dash_type == RTL_DASH_DP)
-		rtl8168dp_driver_start(tp);
-	else
-		rtl8168ep_driver_start(tp);
-}
-
 static void rtl8168dp_driver_stop(struct rtl8169_private *tp)
 {
 	r8168dp_oob_notify(tp, OOB_CMD_DRIVER_STOP);
 	rtl_loop_wait_low(tp, &rtl_dp_ocp_read_cond, 10000, 10);
 }
 
-static void rtl8168ep_driver_stop(struct rtl8169_private *tp)
-{
-	rtl8168ep_stop_cmac(tp);
-	r8168ep_ocp_write(tp, 0x01, 0x180, OOB_CMD_DRIVER_STOP);
-	r8168ep_ocp_write(tp, 0x01, 0x30, r8168ep_ocp_read(tp, 0x30) | 0x01);
-	rtl_loop_wait_low(tp, &rtl_ep_ocp_read_cond, 10000, 10);
-}
-
-static void rtl8168_driver_stop(struct rtl8169_private *tp)
-{
-	if (tp->dash_type == RTL_DASH_DP)
-		rtl8168dp_driver_stop(tp);
-	else
-		rtl8168ep_driver_stop(tp);
-}
-
 static bool r8168dp_check_dash(struct rtl8169_private *tp)
 {
 	u16 reg = rtl8168_get_ocp_reg(tp);
@@ -3227,8 +3174,6 @@ static void rtl_hw_start_8168h_1(struct rtl8169_private *tp)
 
 static void rtl_hw_start_8168ep(struct rtl8169_private *tp)
 {
-	rtl8168ep_stop_cmac(tp);
-
 	rtl_set_fifo_size(tp, 0x08, 0x10, 0x02, 0x06);
 	rtl8168g_set_pause_thresholds(tp, 0x2f, 0x5f);
 
@@ -3324,8 +3269,6 @@ static void rtl_hw_start_8117(struct rtl8169_private *tp)
 	};
 	int rg_saw_cnt;
 
-	rtl8168ep_stop_cmac(tp);
-
 	/* disable aspm and clock request before access ephy */
 	rtl_hw_aspm_clkreq_enable(tp, false);
 	rtl_ephy_init(tp, e_info_8117);
@@ -4968,8 +4911,8 @@ static void rtl_remove_one(struct pci_dev *pdev)
 
 	unregister_netdev(tp->dev);
 
-	if (tp->dash_type != RTL_DASH_NONE)
-		rtl8168_driver_stop(tp);
+	if (tp->dash_type == RTL_DASH_DP)
+		rtl8168dp_driver_stop(tp);
 
 	rtl_release_firmware(tp);
 
@@ -5161,10 +5104,7 @@ static void rtl_hw_init_8125(struct rtl8169_private *tp)
 static void rtl_hw_initialize(struct rtl8169_private *tp)
 {
 	switch (tp->mac_version) {
-	case RTL_GIGA_MAC_VER_49 ... RTL_GIGA_MAC_VER_53:
-		rtl8168ep_stop_cmac(tp);
-		fallthrough;
-	case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_48:
+	case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_53:
 		rtl_hw_init_8168g(tp);
 		break;
 	case RTL_GIGA_MAC_VER_60 ... RTL_GIGA_MAC_VER_63:
@@ -5443,9 +5383,9 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 			    jumbo_max, tp->mac_version <= RTL_GIGA_MAC_VER_06 ?
 			    "ok" : "ko");
 
-	if (tp->dash_type != RTL_DASH_NONE) {
+	if (tp->dash_type == RTL_DASH_DP) {
 		netdev_info(dev, "DASH enabled\n");
-		rtl8168_driver_start(tp);
+		rtl8168dp_driver_start(tp);
 	}
 
 	if (pci_dev_run_wake(pdev))
-- 
2.31.1


  reply	other threads:[~2021-11-29 10:15 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-29 10:13 [RFC PATCH 0/4] r8169: support dash Hayes Wang
2021-11-29 10:13 ` Hayes Wang [this message]
2021-11-29 10:13 ` [RFC PATCH 2/4] r8169: add type2 access functions Hayes Wang
2021-11-29 10:13 ` [RFC PATCH 3/4] r8169: support CMAC Hayes Wang
2021-11-29 15:47   ` kernel test robot
2021-11-29 20:46   ` Heiner Kallweit
2021-12-03  7:57     ` Hayes Wang
2021-12-03 11:37       ` Heiner Kallweit
2021-11-29 10:13 ` [RFC PATCH 4/4] r8169: add sysfs for dash Hayes Wang
2021-12-03 15:15   ` Heiner Kallweit
2021-12-07  6:53     ` Hayes Wang
2021-12-07  7:38       ` Heiner Kallweit
2021-12-07  8:20         ` Hayes Wang
2021-11-29 17:59 ` [RFC PATCH 0/4] r8169: support dash Jakub Kicinski
2021-11-29 17:59   ` [Intel-wired-lan] " Jakub Kicinski
2021-12-01  2:57   ` Hayes Wang
2021-12-01  2:57     ` [Intel-wired-lan] " Hayes Wang
2021-12-01  3:09     ` Jakub Kicinski
2021-12-01  3:09       ` [Intel-wired-lan] " Jakub Kicinski
2021-12-03  7:57       ` Hayes Wang
2021-12-03  7:57         ` [Intel-wired-lan] " Hayes Wang
2021-12-03 15:04         ` Jakub Kicinski
2021-12-03 15:04           ` [Intel-wired-lan] " Jakub Kicinski
2021-12-04  1:08           ` Alexander Lobakin
2021-12-04  1:08             ` [Intel-wired-lan] " Alexander Lobakin
2021-12-04  1:32             ` Jakub Kicinski
2021-12-04  1:32               ` [Intel-wired-lan] " Jakub Kicinski
2021-12-07  7:28           ` Hayes Wang
2021-12-07  7:28             ` [Intel-wired-lan] " Hayes Wang
2021-12-08  4:21             ` Jakub Kicinski
2021-12-08  4:21               ` [Intel-wired-lan] " Jakub Kicinski
2021-12-08  7:53               ` Hayes Wang
2021-12-08  7:53                 ` [Intel-wired-lan] " Hayes Wang
2021-12-08 21:37                 ` Jakub Kicinski
2021-12-08 21:37                   ` [Intel-wired-lan] " Jakub Kicinski
2021-12-09  7:14                   ` Hayes Wang
2021-12-09  7:14                     ` [Intel-wired-lan] " Hayes Wang

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=20211129101315.16372-382-nic_swsd@realtek.com \
    --to=hayeswang@realtek.com \
    --cc=hkallweit1@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=nic_swsd@realtek.com \
    /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.