From: Heiner Kallweit <hkallweit1@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>,
Realtek linux nic maintainers <nic_swsd@realtek.com>,
Chun-Hao Lin <hau@realtek.com>
Cc: David Miller <davem@davemloft.net>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: [PATCH RFC 17/18] r8168: remove use of struct mii_if_info
Date: Thu, 21 Dec 2017 21:50:52 +0100 [thread overview]
Message-ID: <335edd3a-0956-72c9-dbf2-4dfb992c69f7@gmail.com> (raw)
In-Reply-To: <83321b2e-8402-26c5-9703-3fe795cc893d@gmail.com>
After switching to phylib we don't need most elements of
struct mii_if_info any longer.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
drivers/net/ethernet/realtek/r8168.c | 37 +++++++-----------------------------
1 file changed, 7 insertions(+), 30 deletions(-)
diff --git a/drivers/net/ethernet/realtek/r8168.c b/drivers/net/ethernet/realtek/r8168.c
index 64c87509d..765c60bc1 100644
--- a/drivers/net/ethernet/realtek/r8168.c
+++ b/drivers/net/ethernet/realtek/r8168.c
@@ -816,7 +816,7 @@ struct rtl8168_private {
unsigned features;
- struct mii_if_info mii;
+ bool supports_gmii;
struct mii_bus *mii_bus;
dma_addr_t counters_phys_addr;
struct rtl8168_counters *counters;
@@ -1188,21 +1188,6 @@ static void rtl_w0w1_phy(struct rtl8168_private *tp, int reg_addr, int p, int m)
rtl_writephy(tp, reg_addr, (val & ~m) | p);
}
-static void rtl_mdio_write(struct net_device *dev, int phy_id, int location,
- int val)
-{
- struct rtl8168_private *tp = netdev_priv(dev);
-
- rtl_writephy(tp, location, val);
-}
-
-static int rtl_mdio_read(struct net_device *dev, int phy_id, int location)
-{
- struct rtl8168_private *tp = netdev_priv(dev);
-
- return rtl_readphy(tp, location);
-}
-
DECLARE_RTL_COND(rtl_ephyar_cond)
{
void __iomem *ioaddr = tp->mmio_addr;
@@ -2447,15 +2432,15 @@ static void rtl8168_get_mac_version(struct rtl8168_private *tp,
"unknown MAC, using family default\n");
tp->mac_version = default_version;
} else if (tp->mac_version == RTL_GIGA_MAC_VER_42) {
- tp->mac_version = tp->mii.supports_gmii ?
+ tp->mac_version = tp->supports_gmii ?
RTL_GIGA_MAC_VER_42 :
RTL_GIGA_MAC_VER_43;
} else if (tp->mac_version == RTL_GIGA_MAC_VER_45) {
- tp->mac_version = tp->mii.supports_gmii ?
+ tp->mac_version = tp->supports_gmii ?
RTL_GIGA_MAC_VER_45 :
RTL_GIGA_MAC_VER_47;
} else if (tp->mac_version == RTL_GIGA_MAC_VER_46) {
- tp->mac_version = tp->mii.supports_gmii ?
+ tp->mac_version = tp->supports_gmii ?
RTL_GIGA_MAC_VER_46 :
RTL_GIGA_MAC_VER_48;
}
@@ -7691,7 +7676,7 @@ static int r8168_phy_connect(struct rtl8168_private *tp)
phy_interface_t phy_mode;
int ret;
- phy_mode = tp->mii.supports_gmii ? PHY_INTERFACE_MODE_GMII :
+ phy_mode = tp->supports_gmii ? PHY_INTERFACE_MODE_GMII :
PHY_INTERFACE_MODE_MII;
phydev = phy_find_first(tp->mii_bus);
@@ -7705,7 +7690,7 @@ static int r8168_phy_connect(struct rtl8168_private *tp)
phy_attached_info(phydev);
- if (!tp->mii.supports_gmii && (phydev->supported &
+ if (!tp->supports_gmii && (phydev->supported &
(SUPPORTED_1000baseT_Half | SUPPORTED_1000baseT_Full))) {
netif_info(tp, probe, tp->dev, "Restrict PHY to 100Mbit because MAC doesn't support 1GBit");
phy_set_max_speed(phydev, SPEED_100);
@@ -7784,7 +7769,6 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
const struct rtl_cfg_info *cfg = rtl_cfg_infos + ent->driver_data;
const unsigned int region = cfg->region;
struct rtl8168_private *tp;
- struct mii_if_info *mii;
struct net_device *dev;
void __iomem *ioaddr;
int chipset, i;
@@ -7805,14 +7789,7 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
tp->dev = dev;
tp->pci_dev = pdev;
tp->msg_enable = netif_msg_init(debug.msg_enable, R8168_MSG_DEFAULT);
-
- mii = &tp->mii;
- mii->dev = dev;
- mii->mdio_read = rtl_mdio_read;
- mii->mdio_write = rtl_mdio_write;
- mii->phy_id_mask = 0x1f;
- mii->reg_num_mask = 0x1f;
- mii->supports_gmii = !!(cfg->features & RTL_FEATURE_GMII);
+ tp->supports_gmii = !!(cfg->features & RTL_FEATURE_GMII);
/* disable ASPM completely as that cause random device stop working
* problems as well as full system hangs for some PCIe devices users */
--
2.15.1
next prev parent reply other threads:[~2017-12-21 20:51 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-21 20:38 [PATCH RFC 00/18] r8169: separate r8168 driver and add experimental phylib support Heiner Kallweit
2017-12-21 20:50 ` [PATCH RFC 01/18] r8169: split driver to one for the non-PCIE cards (r8169) and one for the PCIE cards (r8168) Heiner Kallweit
2017-12-21 20:50 ` [PATCH RFC 02/18] r8168: remove code specific to MAC version 01 - 06 Heiner Kallweit
2017-12-21 20:50 ` [PATCH RFC 03/18] r8168: remove magic register handling used on MAC version 05 and 06 only Heiner Kallweit
2017-12-21 20:50 ` [PATCH RFC 04/18] r8168: remove TBI mode support needed for MAC version 01 only Heiner Kallweit
2017-12-21 20:50 ` [PATCH RFC 05/18] r8168: remove unneeded callbacks from struct rtl8169_private Heiner Kallweit
2017-12-21 20:50 ` [PATCH RFC 06/18] r8168: remove function rtl8169_rx_missed() being specific to MAC version 01 - 06 Heiner Kallweit
2017-12-21 20:50 ` [PATCH RFC 07/18] r8168: replace 8169 with 8168 in all relevant symbols Heiner Kallweit
2017-12-21 20:50 ` [PATCH RFC 08/18] r8168: add basic phylib support Heiner Kallweit
2017-12-22 9:44 ` Andrew Lunn
2017-12-21 20:50 ` [PATCH RFC 09/18] r8168: use genphy_soft_reset instead of open coding the soft reset Heiner Kallweit
2017-12-22 9:57 ` Andrew Lunn
2017-12-22 22:19 ` Heiner Kallweit
2017-12-21 20:50 ` [PATCH RFC 10/18] r8168: switch to phy_ethtool_get/set_link_ksettings Heiner Kallweit
2017-12-22 9:57 ` Andrew Lunn
2017-12-21 20:50 ` [PATCH RFC 11/18] r8168: switch to phy_ethtool_nway_reset Heiner Kallweit
2017-12-22 9:58 ` Andrew Lunn
2017-12-21 20:50 ` [PATCH RFC 12/18] r8168: switch to phy_mii_ioctl Heiner Kallweit
2017-12-22 10:00 ` Andrew Lunn
2017-12-22 23:01 ` Heiner Kallweit
2017-12-21 20:50 ` [PATCH RFC 13/18] r8168: replace speed_down with genphy_restart_aneg Heiner Kallweit
2017-12-22 10:14 ` Andrew Lunn
2017-12-22 23:36 ` Heiner Kallweit
2017-12-21 20:50 ` [PATCH RFC 14/18] r8168: remove rtl8168_set_speed Heiner Kallweit
2017-12-21 20:50 ` [PATCH RFC 15/18] r8168: remove rtl_phy_work and rtl8168_phy_timer Heiner Kallweit
2017-12-21 20:50 ` [PATCH RFC 16/18] r8168: use phy_read/write in rtl_readphy/writephy helpers Heiner Kallweit
2017-12-21 20:50 ` Heiner Kallweit [this message]
2017-12-22 10:21 ` [PATCH RFC 17/18] r8168: remove use of struct mii_if_info Andrew Lunn
2017-12-21 20:50 ` [PATCH RFC 18/18] r8168: use link speed information as maintained by phylib Heiner Kallweit
2017-12-22 10:22 ` Andrew Lunn
2017-12-21 21:16 ` [PATCH RFC 00/18] r8169: separate r8168 driver and add experimental phylib support David Miller
2017-12-21 21:27 ` Heiner Kallweit
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=335edd3a-0956-72c9-dbf2-4dfb992c69f7@gmail.com \
--to=hkallweit1@gmail.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=hau@realtek.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 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).