From patchwork Thu Jan 3 01:10:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 10746815 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 01FBA17D2 for ; Thu, 3 Jan 2019 01:11:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E385028415 for ; Thu, 3 Jan 2019 01:11:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D5B002841D; Thu, 3 Jan 2019 01:11:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 624A028415 for ; Thu, 3 Jan 2019 01:11:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728645AbfACBLY (ORCPT ); Wed, 2 Jan 2019 20:11:24 -0500 Received: from mail-out.m-online.net ([212.18.0.10]:49061 "EHLO mail-out.m-online.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728814AbfACBLV (ORCPT ); Wed, 2 Jan 2019 20:11:21 -0500 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 43VVH94znFz1qvTW; Thu, 3 Jan 2019 02:11:17 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 43VVH94pMnz1qvWb; Thu, 3 Jan 2019 02:11:17 +0100 (CET) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id VnThscKzqTn1; Thu, 3 Jan 2019 02:11:16 +0100 (CET) X-Auth-Info: 76RxfvCbdRGno/Le2KL4I5Jw+z+YZKHtAcp7EdQLkcU= Received: from kurokawa.lan (ip-86-49-110-70.net.upcbroadband.cz [86.49.110.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Thu, 3 Jan 2019 02:11:16 +0100 (CET) From: Marek Vasut To: netdev@vger.kernel.org Cc: Marek Vasut , "David S . Miller" , Nisar Sayed , Woojung Huh , Andrew Lunn , Florian Fainelli , linux-usb@vger.kernel.org Subject: [PATCH 11/19] usbnet: smsc95xx: Replace smsc95xx_mdio_write() with phy_write() Date: Thu, 3 Jan 2019 02:10:32 +0100 Message-Id: <20190103011040.25974-12-marex@denx.de> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20190103011040.25974-1-marex@denx.de> References: <20190103011040.25974-1-marex@denx.de> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Just replace smsc95xx_mdio_write() with generic phy_write() to reduce usage of the ad-hoc accessors. Signed-off-by: Marek Vasut Cc: David S. Miller Cc: Nisar Sayed Cc: Woojung Huh Cc: Andrew Lunn Cc: Florian Fainelli Cc: linux-usb@vger.kernel.org To: netdev@vger.kernel.org --- drivers/net/usb/smsc95xx.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c index 53f817e699df..c1e59813c1fc 100644 --- a/drivers/net/usb/smsc95xx.c +++ b/drivers/net/usb/smsc95xx.c @@ -797,7 +797,7 @@ static void set_mdix_status(struct net_device *net, __u8 mdix_ctrl) buf = phy_read(pdata->phydev, PHY_EDPD_CONFIG); buf |= PHY_EDPD_CONFIG_EXT_CROSSOVER_; - smsc95xx_mdio_write(dev->net, dev->mii.phy_id, + phy_write(pdata->phydev, PHY_EDPD_CONFIG, buf); } @@ -807,7 +807,7 @@ static void set_mdix_status(struct net_device *net, __u8 mdix_ctrl) buf |= SPECIAL_CTRL_STS_OVRRD_AMDIX_; buf &= ~(SPECIAL_CTRL_STS_AMDIX_ENABLE_ | SPECIAL_CTRL_STS_AMDIX_STATE_); - smsc95xx_mdio_write(dev->net, dev->mii.phy_id, + phy_write(pdata->phydev, SPECIAL_CTRL_STS, buf); } else if (mdix_ctrl == ETH_TP_MDI_X) { buf = phy_read(pdata->phydev, @@ -816,7 +816,7 @@ static void set_mdix_status(struct net_device *net, __u8 mdix_ctrl) buf &= ~(SPECIAL_CTRL_STS_AMDIX_ENABLE_ | SPECIAL_CTRL_STS_AMDIX_STATE_); buf |= SPECIAL_CTRL_STS_AMDIX_STATE_; - smsc95xx_mdio_write(dev->net, dev->mii.phy_id, + phy_write(pdata->phydev, SPECIAL_CTRL_STS, buf); } else if (mdix_ctrl == ETH_TP_MDI_AUTO) { buf = phy_read(pdata->phydev, @@ -825,7 +825,7 @@ static void set_mdix_status(struct net_device *net, __u8 mdix_ctrl) buf &= ~(SPECIAL_CTRL_STS_AMDIX_ENABLE_ | SPECIAL_CTRL_STS_AMDIX_STATE_); buf |= SPECIAL_CTRL_STS_AMDIX_ENABLE_; - smsc95xx_mdio_write(dev->net, dev->mii.phy_id, + phy_write(pdata->phydev, SPECIAL_CTRL_STS, buf); } pdata->mdix_ctrl = mdix_ctrl; @@ -973,7 +973,7 @@ static int smsc95xx_phy_initialize(struct usbnet *dev) int bmcr, ret, timeout = 0; /* reset phy and wait for reset to complete */ - smsc95xx_mdio_write(dev->net, dev->mii.phy_id, MII_BMCR, BMCR_RESET); + phy_write(pdata->phydev, MII_BMCR, BMCR_RESET); do { msleep(10); @@ -986,7 +986,7 @@ static int smsc95xx_phy_initialize(struct usbnet *dev) return -EIO; } - smsc95xx_mdio_write(dev->net, dev->mii.phy_id, MII_ADVERTISE, + phy_write(pdata->phydev, MII_ADVERTISE, ADVERTISE_ALL | ADVERTISE_CSMA | ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM); @@ -997,7 +997,7 @@ static int smsc95xx_phy_initialize(struct usbnet *dev) return ret; } - smsc95xx_mdio_write(dev->net, dev->mii.phy_id, PHY_INT_MASK, + phy_write(pdata->phydev, PHY_INT_MASK, PHY_INT_MASK_DEFAULT_); mii_nway_restart(&dev->mii); @@ -1410,7 +1410,6 @@ static u32 smsc_crc(const u8 *buffer, size_t len, int filter) static int smsc95xx_enable_phy_wakeup_interrupts(struct usbnet *dev, u16 mask) { struct smsc95xx_priv *pdata = (struct smsc95xx_priv *)(dev->data[0]); - struct mii_if_info *mii = &dev->mii; int ret; netdev_dbg(dev->net, "enabling PHY wakeup interrupts\n"); @@ -1427,7 +1426,7 @@ static int smsc95xx_enable_phy_wakeup_interrupts(struct usbnet *dev, u16 mask) ret |= mask; - smsc95xx_mdio_write(dev->net, mii->phy_id, PHY_INT_MASK, ret); + phy_write(pdata->phydev, PHY_INT_MASK, ret); return 0; } @@ -1491,7 +1490,6 @@ static int smsc95xx_enter_suspend0(struct usbnet *dev) static int smsc95xx_enter_suspend1(struct usbnet *dev) { struct smsc95xx_priv *pdata = (struct smsc95xx_priv *)(dev->data[0]); - struct mii_if_info *mii = &dev->mii; u32 val; int ret; @@ -1499,7 +1497,7 @@ static int smsc95xx_enter_suspend1(struct usbnet *dev) * compatibility with non-standard link partners */ if (pdata->features & FEATURE_PHY_NLP_CROSSOVER) - smsc95xx_mdio_write(dev->net, mii->phy_id, PHY_EDPD_CONFIG, + phy_write(pdata->phydev, PHY_EDPD_CONFIG, PHY_EDPD_CONFIG_DEFAULT); /* enable energy detect power-down mode */ @@ -1509,7 +1507,7 @@ static int smsc95xx_enter_suspend1(struct usbnet *dev) ret |= MODE_CTRL_STS_EDPWRDOWN_; - smsc95xx_mdio_write(dev->net, mii->phy_id, PHY_MODE_CTRL_STS, ret); + phy_write(pdata->phydev, PHY_MODE_CTRL_STS, ret); /* enter SUSPEND1 mode */ ret = smsc95xx_read_reg(dev, PM_CTRL, &val);