From patchwork Sun Apr 2 15:11:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 13197440 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 875D5C76196 for ; Sun, 2 Apr 2023 15:18:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231252AbjDBPSU (ORCPT ); Sun, 2 Apr 2023 11:18:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231135AbjDBPST (ORCPT ); Sun, 2 Apr 2023 11:18:19 -0400 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99CC5D50C for ; Sun, 2 Apr 2023 08:18:17 -0700 (PDT) Received: by mail-ed1-x52d.google.com with SMTP id b20so107944542edd.1 for ; Sun, 02 Apr 2023 08:18:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680448696; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=AxNLqwe7oCB4JXyBb+HCY+YQ9gAGvcZfdTIxvMULNNY=; b=PgiI2RTCnu6bJlFSqOVb1+tuMVn9Ms1zIz0AlR0jkUfvfJIJIuSUCRSMKoHU5EdGVS X3U1qvKFLNGnTNV85G2LW2mYXoJCM0s6ba1WzOj+uAvHWZFUoD6m61kAmBsF6BcWrk2s BJB1+UKP4/tNeryAjnjCSCNaP4Gc1Inj9giPQDOP6koC/fxSOjlJX/db55OdDtAZeojc AfRoyBDWm4/7uVzdA5WmUvwcAgU0SZ03zmX7R4Zy0CNIslIfUXz/Y6OdhTYFXCmyNiID xMrg8pzKya19ES3/PtmoErTX7Lq4rTY1fzsLCYtdPK7EZXc/ZFJRV0XXKdqMKYWAVaWJ 9QkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680448696; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=AxNLqwe7oCB4JXyBb+HCY+YQ9gAGvcZfdTIxvMULNNY=; b=QcpEGlpKmdadbaGrNEae33dXhji4hdyobyPzUcuXzKfqO2dz5p8+ZA++fI2M0oc57K irr9d+64d7d2H/domvEcHV5ZI3ZtiC554gNPaEYXeD9uMbgNhZMco9BLSyE1RlFfwjic SqkEG5kRJfnsCedAm04u2TPDxCMiSDCJQR+wvkkP4My3AnwnxDWF+CDiJ28xrYcY3LNg qr6rOywcrmJk0v4jCa+ai9Pa99R9eZ7q1pAUfU5dQa1hyDheGvDhpikbDFF/xIfANgye 5BXFBpm7cOZuKCucttTGdYLndkBuRPyerBGtGPL+0yM2CJ2a4Libcm+8EcMe/B5N6OlN DYVg== X-Gm-Message-State: AAQBX9dTbUvwQrFmO/rRzji8L+2uJGaTW/mxkcpSs0r9+bnEF6FczNug HAK1HgbJSPIKcLuNgItBAQeNImqc5YA= X-Google-Smtp-Source: AKy350bwG6TBalLi4Qp2mDFqHdBwmOXdfwdH1yVDYIaA42Bq5OnN6P+D41fgL5b7MNBG6DEMbx9okA== X-Received: by 2002:aa7:c490:0:b0:4fa:315a:cb55 with SMTP id m16-20020aa7c490000000b004fa315acb55mr34271690edq.21.1680448696097; Sun, 02 Apr 2023 08:18:16 -0700 (PDT) Received: from ?IPV6:2a01:c22:7b85:6800:129:5577:2076:7bf8? (dynamic-2a01-0c22-7b85-6800-0129-5577-2076-7bf8.c22.pool.telefonica.de. [2a01:c22:7b85:6800:129:5577:2076:7bf8]) by smtp.googlemail.com with ESMTPSA id r3-20020a50d683000000b00502719a3966sm2873282edi.18.2023.04.02.08.18.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 02 Apr 2023 08:18:15 -0700 (PDT) Message-ID: <3fcf639a-12b7-f5b2-29c8-a5c3e2e16ca3@gmail.com> Date: Sun, 2 Apr 2023 17:11:40 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 Subject: [PATCH net-next v2 1/7] net: phy: smsc: rename flag energy_enable Content-Language: en-US From: Heiner Kallweit To: Andrew Lunn , Russell King - ARM Linux , Eric Dumazet , Jakub Kicinski , David Miller , Paolo Abeni , Chris Healy Cc: "netdev@vger.kernel.org" References: In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Rename the flag to edpd_enable, as we're not enabling energy but edpd (energy detect power down) mode. In addition change the type to a bit field member in preparation of adding further flags. Signed-off-by: Heiner Kallweit Reviewed-by: Simon Horman --- drivers/net/phy/smsc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/phy/smsc.c b/drivers/net/phy/smsc.c index 730964b85..928cf6d8b 100644 --- a/drivers/net/phy/smsc.c +++ b/drivers/net/phy/smsc.c @@ -44,7 +44,7 @@ static struct smsc_hw_stat smsc_hw_stats[] = { }; struct smsc_phy_priv { - bool energy_enable; + unsigned int edpd_enable:1; }; static int smsc_phy_ack_interrupt(struct phy_device *phydev) @@ -102,7 +102,7 @@ int smsc_phy_config_init(struct phy_device *phydev) { struct smsc_phy_priv *priv = phydev->priv; - if (!priv || !priv->energy_enable || phydev->irq != PHY_POLL) + if (!priv || !priv->edpd_enable || phydev->irq != PHY_POLL) return 0; /* Enable energy detect power down mode */ @@ -198,7 +198,7 @@ int lan87xx_read_status(struct phy_device *phydev) if (err) return err; - if (!phydev->link && priv && priv->energy_enable && + if (!phydev->link && priv && priv->edpd_enable && phydev->irq == PHY_POLL) { /* Disable EDPD to wake up PHY */ int rc = phy_read(phydev, MII_LAN83C185_CTRL_STATUS); @@ -284,10 +284,10 @@ int smsc_phy_probe(struct phy_device *phydev) if (!priv) return -ENOMEM; - priv->energy_enable = true; + priv->edpd_enable = true; if (device_property_present(dev, "smsc,disable-energy-detect")) - priv->energy_enable = false; + priv->edpd_enable = false; phydev->priv = priv; From patchwork Sun Apr 2 15:12:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 13197441 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB084C7619A for ; Sun, 2 Apr 2023 15:18:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231255AbjDBPSV (ORCPT ); Sun, 2 Apr 2023 11:18:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231249AbjDBPSU (ORCPT ); Sun, 2 Apr 2023 11:18:20 -0400 Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17CE6CDFA for ; Sun, 2 Apr 2023 08:18:19 -0700 (PDT) Received: by mail-ed1-x52e.google.com with SMTP id ew6so107852425edb.7 for ; Sun, 02 Apr 2023 08:18:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680448697; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=upQXBEYXOyx70bYLdqvKtCylGja9s+Qe8Od27p9n1/c=; b=baelzLlXhOVPyW+bDQ8HK8fE9sKT8rnnFt5holvBi/Mn/ztQnoL7Uju2eZru2z2/Dk sGpCyiac2ufWrZpNyIipsC5JsYxecuprHhZnfORsuuxpxgVCYFw5d/G2VQutM4q6K5wY FOHOTBJ9K6FZVpxzrMdT0dq53vT4qRVi3K4ly0hot+zG6UHCCS7SGy1HjVqZwtRX+l2t EwcpXryTLw3Td4FH2EJwnACr4sFXVR+tIEzavX6OYPBkh1ou3W35gaFL6HKidWjoe/gv oTswuZD7N1qmeQ7T3SyfsXMmXyOnfB2jCjDBnwehrvDFN7iiHLtQX4XdZitwmB+C0Dr5 QEYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680448697; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=upQXBEYXOyx70bYLdqvKtCylGja9s+Qe8Od27p9n1/c=; b=lZGnUTKDLoLbrAp5hm6+RikjbhNDYt1ioAVxKSB+Im9ICWL5NVRFp+OayDN4yxAypd fv9giERTE+0p3uRpwcLGnPpYgpj3rtlbjrI/KF/QNSD7qzzPb9RtBdgHzEaLupcI51pM jEBvx/WOaknc84DJbZyF+To8FfW0F9a/Ktz57/KVZjlkjdHg/PSOK9rgq4pxS3x46Vib 3XTuhSCBTxzriFr20AaRtLnWRNoTbCR2Gi7xT8H2dzC8PCyKKWUqjfjE5HZ1iYdy/aU6 D+dsxisPrYmLT07LUrt3101Je05UhzcrOrKkGNfjat9E6csH60vPyb8CQjVH1loWEcuR 5CNQ== X-Gm-Message-State: AAQBX9fhL0OB1tOjYC9hC8fIP3ZI6J5BBTtW13w0daT3PMGMj2sl++jM nAR9wOv96i6ZX43xbKhUX8s= X-Google-Smtp-Source: AKy350Y/rY2j0t9FEruaIg7CM2MXRAaxcK6/P5ci1c19IIKMWTQ6olcUHQBvKLvJEKDSL3mzBb9vfQ== X-Received: by 2002:a17:907:b60e:b0:93e:9fb9:183b with SMTP id vl14-20020a170907b60e00b0093e9fb9183bmr34505980ejc.73.1680448697420; Sun, 02 Apr 2023 08:18:17 -0700 (PDT) Received: from ?IPV6:2a01:c22:7b85:6800:129:5577:2076:7bf8? (dynamic-2a01-0c22-7b85-6800-0129-5577-2076-7bf8.c22.pool.telefonica.de. [2a01:c22:7b85:6800:129:5577:2076:7bf8]) by smtp.googlemail.com with ESMTPSA id y7-20020a1709064b0700b00946be16f725sm3314857eju.153.2023.04.02.08.18.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 02 Apr 2023 08:18:16 -0700 (PDT) Message-ID: <27ad971b-929e-d292-a16e-c0c3371ca17b@gmail.com> Date: Sun, 2 Apr 2023 17:12:20 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 Subject: [PATCH net-next v2 2/7] net: phy: smsc: add helper smsc_phy_config_edpd Content-Language: en-US From: Heiner Kallweit To: Andrew Lunn , Russell King - ARM Linux , Eric Dumazet , Jakub Kicinski , David Miller , Paolo Abeni , Chris Healy Cc: "netdev@vger.kernel.org" References: In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Add helper smsc_phy_config_edpd() and explicitly clear bit MII_LAN83C185_EDPWRDOWN is edpd_enable isn't set. Boot loader may have left whatever value. Signed-off-by: Heiner Kallweit Reviewed-by: Simon Horman --- drivers/net/phy/smsc.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/net/phy/smsc.c b/drivers/net/phy/smsc.c index 928cf6d8b..1b588366e 100644 --- a/drivers/net/phy/smsc.c +++ b/drivers/net/phy/smsc.c @@ -77,6 +77,18 @@ int smsc_phy_config_intr(struct phy_device *phydev) } EXPORT_SYMBOL_GPL(smsc_phy_config_intr); +static int smsc_phy_config_edpd(struct phy_device *phydev) +{ + struct smsc_phy_priv *priv = phydev->priv; + + if (priv->edpd_enable) + return phy_set_bits(phydev, MII_LAN83C185_CTRL_STATUS, + MII_LAN83C185_EDPWRDOWN); + else + return phy_clear_bits(phydev, MII_LAN83C185_CTRL_STATUS, + MII_LAN83C185_EDPWRDOWN); +} + irqreturn_t smsc_phy_handle_interrupt(struct phy_device *phydev) { int irq_status; @@ -105,9 +117,7 @@ int smsc_phy_config_init(struct phy_device *phydev) if (!priv || !priv->edpd_enable || phydev->irq != PHY_POLL) return 0; - /* Enable energy detect power down mode */ - return phy_set_bits(phydev, MII_LAN83C185_CTRL_STATUS, - MII_LAN83C185_EDPWRDOWN); + return smsc_phy_config_edpd(phydev); } EXPORT_SYMBOL_GPL(smsc_phy_config_init); From patchwork Sun Apr 2 15:13:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 13197442 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 44D87C76196 for ; Sun, 2 Apr 2023 15:18:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231263AbjDBPSX (ORCPT ); Sun, 2 Apr 2023 11:18:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231254AbjDBPSV (ORCPT ); Sun, 2 Apr 2023 11:18:21 -0400 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4AAA0CDFA for ; Sun, 2 Apr 2023 08:18:20 -0700 (PDT) Received: by mail-ed1-x536.google.com with SMTP id t10so107762704edd.12 for ; Sun, 02 Apr 2023 08:18:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680448699; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=bpfHGW2yJcvgbBDsBVm5Q8M8aPAgMf3N33Xltk/h07w=; b=W0cOs6TnfvSJBwlHJT0fXxvxv6do+Br483bDSo47Wp6KMXa1gbqiiiK42tAd4y/Cg/ J6/5oJ2xqPHxUbm6twDOnyxo4RpZ9VjmuXnE/9hYDlZ+tWndsca9L8iy4XCppSZo8Y7n WhaNT1qmJxyDQv9+tR7SkaulZqeivEBHolD7FLEjVBPaXmed7Qu6L+wcf0s5yp3h1nql HVRCj4FUEdQfXXr2CNIRz0ZRXTux2a9aRUBG1R/BP9FsqukXkJzxtrcVR5H1+YVX5fjf qLtk7fNFxjDSEOqL7+dCbzwUXZ6HbGoD60H9FR7As6zCzNDc/haSVn2OMYsnaE6Dc9Vk 9ZYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680448699; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=bpfHGW2yJcvgbBDsBVm5Q8M8aPAgMf3N33Xltk/h07w=; b=ZoS3+hdMv0LUvrhAM4BUlLl01X/uRbgKfhGjOmAlo7yhpniYQ2uZyo0CY/WQYhPsTM g/o3PWsBGWghnacHKrVLbsJSjwhWrA6ZQ1An3OAMueH83TiH5EA59Rkj+hboe8Cr1E5N 6uhsB8foUFxmx0a7RQcvAHqSfedd3LIhnsUdCt+Ffq9U43U4POZNh9SIvmUldWtNRqqB WyMjwAHONSstPnHRg/s2Y8Szs1w8Ej+P/Xs0Y6Bfmsd1YSTs+NH9l48sRPafD7N22BFs fNW0JUfmRE2xzBjABPBtw1xlqQfK7SCCIBdfBan0NVBxtHcgDTPbiovKQXrmeBXEzHej Uqsw== X-Gm-Message-State: AAQBX9eHifejQ/EGpz++vZzIiYIonGE5QeJCqCNyVwuFa/JcD05MP+Qb UjnzvPsTI0YMGsP4aQmFhDg= X-Google-Smtp-Source: AKy350ZBmWgMgkpiQ4kvAD1ysRnb8ODJaYe6YtTltH5mdam5lAk2RkduqP10WGn1fqPqdZDeZfrwAg== X-Received: by 2002:a17:906:738a:b0:933:4ca3:9678 with SMTP id f10-20020a170906738a00b009334ca39678mr32509912ejl.24.1680448698623; Sun, 02 Apr 2023 08:18:18 -0700 (PDT) Received: from ?IPV6:2a01:c22:7b85:6800:129:5577:2076:7bf8? (dynamic-2a01-0c22-7b85-6800-0129-5577-2076-7bf8.c22.pool.telefonica.de. [2a01:c22:7b85:6800:129:5577:2076:7bf8]) by smtp.googlemail.com with ESMTPSA id l20-20020a17090612d400b00947740a4373sm3301741ejb.81.2023.04.02.08.18.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 02 Apr 2023 08:18:18 -0700 (PDT) Message-ID: <31386c3d-098b-6731-7431-baa761bfd16a@gmail.com> Date: Sun, 2 Apr 2023 17:13:05 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 Subject: [PATCH net-next v2 3/7] net: phy: smsc: clear edpd_enable if interrupt mode is used Content-Language: en-US From: Heiner Kallweit To: Andrew Lunn , Russell King - ARM Linux , Eric Dumazet , Jakub Kicinski , David Miller , Paolo Abeni , Chris Healy Cc: "netdev@vger.kernel.org" References: In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Clear edpd_enable if interupt mode is used, this avoids having to check for PHY_POLL multiple times. Signed-off-by: Heiner Kallweit Reviewed-by: Simon Horman --- drivers/net/phy/smsc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/net/phy/smsc.c b/drivers/net/phy/smsc.c index 1b588366e..f5ecd8bea 100644 --- a/drivers/net/phy/smsc.c +++ b/drivers/net/phy/smsc.c @@ -114,9 +114,12 @@ int smsc_phy_config_init(struct phy_device *phydev) { struct smsc_phy_priv *priv = phydev->priv; - if (!priv || !priv->edpd_enable || phydev->irq != PHY_POLL) + if (!priv) return 0; + if (phydev->irq != PHY_POLL) + priv->edpd_enable = false; + return smsc_phy_config_edpd(phydev); } EXPORT_SYMBOL_GPL(smsc_phy_config_init); @@ -208,8 +211,7 @@ int lan87xx_read_status(struct phy_device *phydev) if (err) return err; - if (!phydev->link && priv && priv->edpd_enable && - phydev->irq == PHY_POLL) { + if (!phydev->link && priv && priv->edpd_enable) { /* Disable EDPD to wake up PHY */ int rc = phy_read(phydev, MII_LAN83C185_CTRL_STATUS); if (rc < 0) From patchwork Sun Apr 2 15:13:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 13197443 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD183C761AF for ; Sun, 2 Apr 2023 15:18:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231284AbjDBPS3 (ORCPT ); Sun, 2 Apr 2023 11:18:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231260AbjDBPSW (ORCPT ); Sun, 2 Apr 2023 11:18:22 -0400 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 807F9CDFA for ; Sun, 2 Apr 2023 08:18:21 -0700 (PDT) Received: by mail-ed1-x52b.google.com with SMTP id er13so66935280edb.9 for ; Sun, 02 Apr 2023 08:18:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680448700; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=US5AITysJi0DvrH7I1yBYRlOPW+w1/VIILTUo1G3dZQ=; b=Efig/gI4on3UQzWSGCdpERXfd/ZNNb/Nxi7j3KfIP4H/NVcuwGQZC/+ff67bTFZ9iq g7KN/VX41tl/B+lTwCZ/pAoLPmZtOEt9UNqgQuCsPT6wevirnFtKJvwXesg5og8Iw4XQ Z+L6vIo+oGGZeTJFq+iLD4VRjBnqqNrztb8JGD9uPqlJ+XsH25QxLbGYgE7onOrEXqRK AWEJHTbY6aAxFQj8BH5WZwyPZO36ftTamNqsD8Vjcz5b3qi5cnTNpoKCNCKl+mic97UN 2N5pldURhWN0xFDMZ2At0xZbs+vl5q1tk4hisN4lWHEQr0f7exlVOWE09XaO34/RScsh WPLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680448700; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=US5AITysJi0DvrH7I1yBYRlOPW+w1/VIILTUo1G3dZQ=; b=t6hFhCPcsGh9oKNrQNj/OGaFx+vEDnUfgiN+WYN8uHlCuq7/dfb6c5K2orXQfxqxpD 12e2r4CRZMAfs7anWzl+cD1Obnp1D8eB83InnXZFn56MB7y3kPd5eGcHc1OgMXxbEziq oz4vb/UowL2Qq+dxKEpTBez9Hrj7QBFUMgfjBVwJal/PnH5XE3wD9TnEmOb0iP77fy2I IJrYrBuqEJbFD4TJOns/kIu6oSPM4pccqOuSXDC1l/Iq3JMbuVsoB4+cmljRwzyqU0zc 9jux9XR2YnmRaRE+/S5jf+DqkX+sPihSCWb9BcUdR6MmyZ7PLmHKSzGzxg5J0hTEq3HY 6d1A== X-Gm-Message-State: AAQBX9fufqqY0IvM+1eQ1FcOklJxcqfsQ4jVkrqesYqD4Z+1gZ+dojpC 5F9FaEnk2E1gjY63pY2ozrQ= X-Google-Smtp-Source: AKy350Yvxdf6GGYSzfi4ng5t/5/44uYo1gIBTgAZmzYffLuIw40XJQwviUm0O+m8bc1/LbqlpQziXQ== X-Received: by 2002:aa7:c6d8:0:b0:4a2:5652:d8ba with SMTP id b24-20020aa7c6d8000000b004a25652d8bamr14946611eds.18.1680448699905; Sun, 02 Apr 2023 08:18:19 -0700 (PDT) Received: from ?IPV6:2a01:c22:7b85:6800:129:5577:2076:7bf8? (dynamic-2a01-0c22-7b85-6800-0129-5577-2076-7bf8.c22.pool.telefonica.de. [2a01:c22:7b85:6800:129:5577:2076:7bf8]) by smtp.googlemail.com with ESMTPSA id t20-20020a50d714000000b005021d17d896sm3375662edi.21.2023.04.02.08.18.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 02 Apr 2023 08:18:19 -0700 (PDT) Message-ID: <61a0a91a-2743-52f0-e034-e256415c082f@gmail.com> Date: Sun, 2 Apr 2023 17:13:35 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 Subject: [PATCH net-next v2 4/7] net: phy: smsc: add flag edpd_mode_set_by_user Content-Language: en-US From: Heiner Kallweit To: Andrew Lunn , Russell King - ARM Linux , Eric Dumazet , Jakub Kicinski , David Miller , Paolo Abeni , Chris Healy Cc: "netdev@vger.kernel.org" References: In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Add flag edpd_mode_set_by_user in preparation of adding edpd phy tunable support. This flag will allow users to override the default behavior of edpd being disabled if interrupt mode is used. Signed-off-by: Heiner Kallweit Reviewed-by: Simon Horman --- drivers/net/phy/smsc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/phy/smsc.c b/drivers/net/phy/smsc.c index f5ecd8bea..25b9cd474 100644 --- a/drivers/net/phy/smsc.c +++ b/drivers/net/phy/smsc.c @@ -45,6 +45,7 @@ static struct smsc_hw_stat smsc_hw_stats[] = { struct smsc_phy_priv { unsigned int edpd_enable:1; + unsigned int edpd_mode_set_by_user:1; }; static int smsc_phy_ack_interrupt(struct phy_device *phydev) @@ -117,7 +118,8 @@ int smsc_phy_config_init(struct phy_device *phydev) if (!priv) return 0; - if (phydev->irq != PHY_POLL) + /* don't use EDPD in irq mode except overridden by user */ + if (!priv->edpd_mode_set_by_user && phydev->irq != PHY_POLL) priv->edpd_enable = false; return smsc_phy_config_edpd(phydev); From patchwork Sun Apr 2 15:14:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 13197444 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 628E1C7619A for ; Sun, 2 Apr 2023 15:18:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231273AbjDBPSb (ORCPT ); Sun, 2 Apr 2023 11:18:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231265AbjDBPSY (ORCPT ); Sun, 2 Apr 2023 11:18:24 -0400 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC277EB45 for ; Sun, 2 Apr 2023 08:18:22 -0700 (PDT) Received: by mail-ed1-x52f.google.com with SMTP id i5so108123629eda.0 for ; Sun, 02 Apr 2023 08:18:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680448701; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=X8jy0Uy+SkhXLksCm2m8dgVxEb7428GtIa/wyAURie0=; b=Y9fGYbQ5mY2IHImg4ILWpLvtwzlW4jv5lnh5YHj9jmg00ER/RWvEHV8bmB+lr7ZQc/ Kc9vip4wqYdz9IZjyPzoatU2liAJZSlnPROOmb6NMrRnV7fbyekfyq5qv+VVpy3NLUjX 69wxX2FdvBLasXV8g4N0AbkQTYsjXJ95aV1xa8CfJjJGXnuoqPe0ewGodd5Y/fb7h5bV 6KSf7bvrGURWdJL5kbBsSAR4HRVa0BA5AvDPN0ja4Z9pPK903vQRT2To+tLZ1oMpP08b U1Y7fIyWcE5S5RmYB5i8fEwoeCRfkQqio7K/CefDWiNJUoKkRiB0UovnQXzN5EAU5LEY zXpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680448701; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=X8jy0Uy+SkhXLksCm2m8dgVxEb7428GtIa/wyAURie0=; b=Ct6E+DU8CvJ6T2Nua+R8tS2pbZOCieg38dqjhG6QJ+VBl3cK6044gqCr620SOQzBOk eh07J4DHUp2s9LjCuvJBbYWzYA4EgZ4yJaT9lC9ZyiTYIT5EJ2FtfGRkq5r9crhND5Yw ogP+x+sb5+z4r4CZwPLYrYqZ/lln+4HtxTQhf7JixwD3Sfdl+lVHOWjfQzARtBn4xjxd DsiRrkCUxkyWWw53yDw3pYniTc/8XF+PP/q/dbDL+oQUTXLP238Y8LwpMm7fVFgUwCkE yFKX8kMDqeUHo+KCPHVLgKijVKzHZlhP3vHJSLIdK/3Bhj8yMg7y0QLpFE5SM1IXLiKh sgRQ== X-Gm-Message-State: AAQBX9eI8MAKAJ4gduX6olK2lUnhv3AQxUt0uy+nf/3LRpeCaan3lsqW e/wHVHKcvfmXso9qRRsT8iw= X-Google-Smtp-Source: AKy350aX9WtfJDZnECcbYCR5wUBtkQVaXZy4LmYi9OyYaHW1Wcq0WZU1VtA4cYDGOSDS66EiG9+sVA== X-Received: by 2002:a17:907:7295:b0:947:9dd3:d750 with SMTP id dt21-20020a170907729500b009479dd3d750mr10294809ejc.64.1680448701188; Sun, 02 Apr 2023 08:18:21 -0700 (PDT) Received: from ?IPV6:2a01:c22:7b85:6800:129:5577:2076:7bf8? (dynamic-2a01-0c22-7b85-6800-0129-5577-2076-7bf8.c22.pool.telefonica.de. [2a01:c22:7b85:6800:129:5577:2076:7bf8]) by smtp.googlemail.com with ESMTPSA id o2-20020a50c282000000b00501cc88b3adsm3374863edf.46.2023.04.02.08.18.20 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 02 Apr 2023 08:18:20 -0700 (PDT) Message-ID: <63c73df8-c1b9-7011-8490-2ab6de79d821@gmail.com> Date: Sun, 2 Apr 2023 17:14:35 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 Subject: [PATCH net-next v2 5/7] net: phy: smsc: prepare for making edpd wait period configurable Content-Language: en-US From: Heiner Kallweit To: Andrew Lunn , Russell King - ARM Linux , Eric Dumazet , Jakub Kicinski , David Miller , Paolo Abeni , Chris Healy Cc: "netdev@vger.kernel.org" References: In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Add a member edpd_max_wait_ms to the private data structure in preparation of making the wait period configurable by supporting the edpd phy tunable. v2: - rename constant to EDPD_MAX_WAIT_DFLT_MS Signed-off-by: Heiner Kallweit Reviewed-by: Simon Horman --- drivers/net/phy/smsc.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/net/phy/smsc.c b/drivers/net/phy/smsc.c index 25b9cd474..659a3ab10 100644 --- a/drivers/net/phy/smsc.c +++ b/drivers/net/phy/smsc.c @@ -33,6 +33,8 @@ #define SPECIAL_CTRL_STS_AMDIX_ENABLE_ 0x4000 #define SPECIAL_CTRL_STS_AMDIX_STATE_ 0x2000 +#define EDPD_MAX_WAIT_DFLT_MS 640 + struct smsc_hw_stat { const char *string; u8 reg; @@ -46,6 +48,7 @@ static struct smsc_hw_stat smsc_hw_stats[] = { struct smsc_phy_priv { unsigned int edpd_enable:1; unsigned int edpd_mode_set_by_user:1; + unsigned int edpd_max_wait_ms; }; static int smsc_phy_ack_interrupt(struct phy_device *phydev) @@ -213,9 +216,13 @@ int lan87xx_read_status(struct phy_device *phydev) if (err) return err; - if (!phydev->link && priv && priv->edpd_enable) { + if (!phydev->link && priv && priv->edpd_enable && + priv->edpd_max_wait_ms) { + unsigned int max_wait = priv->edpd_max_wait_ms * 1000; + int rc; + /* Disable EDPD to wake up PHY */ - int rc = phy_read(phydev, MII_LAN83C185_CTRL_STATUS); + rc = phy_read(phydev, MII_LAN83C185_CTRL_STATUS); if (rc < 0) return rc; @@ -229,7 +236,7 @@ int lan87xx_read_status(struct phy_device *phydev) */ read_poll_timeout(phy_read, rc, rc & MII_LAN83C185_ENERGYON || rc < 0, - 10000, 640000, true, phydev, + 10000, max_wait, true, phydev, MII_LAN83C185_CTRL_STATUS); if (rc < 0) return rc; @@ -299,6 +306,7 @@ int smsc_phy_probe(struct phy_device *phydev) return -ENOMEM; priv->edpd_enable = true; + priv->edpd_max_wait_ms = EDPD_MAX_WAIT_DFLT_MS; if (device_property_present(dev, "smsc,disable-energy-detect")) priv->edpd_enable = false; From patchwork Sun Apr 2 15:16:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 13197446 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB9B7C761AF for ; Sun, 2 Apr 2023 15:18:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231278AbjDBPSe (ORCPT ); Sun, 2 Apr 2023 11:18:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231267AbjDBPS2 (ORCPT ); Sun, 2 Apr 2023 11:18:28 -0400 Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CED9BE053 for ; Sun, 2 Apr 2023 08:18:23 -0700 (PDT) Received: by mail-ed1-x52e.google.com with SMTP id eh3so107849204edb.11 for ; Sun, 02 Apr 2023 08:18:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680448702; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=NOf2b+S5Wsg1yUC+DGGFW5l5LkigK5jBetrmYDqYsRM=; b=bNtypxNSEIr1y1gG8y6mgGsvkBz9HHEBzKvaNLt3+2PsQAAWROLdsyuFmvADt7Q1EI wKMvWd1ZLG1uIPi/4Vq7r9Qeqw7GQic/T0AqdiCHzq3o+CD7q4b+AAr93ZcwvzsRhpzm ezCszw/u0po0Ti3RxUfRzJfB3xvUmskTSGKPEbwwGtn0DyrCWpc3V70MDCia4mx4kww5 RdY5QgPnD1k95P4m5o8e2ON+QqfWiVTd5CccN1JLy4awrb9GJro3MVGgvwFO40eOVE51 x7hovMxam3F45E7szXXBPlE9YP1Ulfg6iK65AcD5S+bPhlUsBOG0djLs04nqdSHu3x1V yllQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680448702; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=NOf2b+S5Wsg1yUC+DGGFW5l5LkigK5jBetrmYDqYsRM=; b=dBDS5OwgozLlfHDFfhfM5Pxe3xuoURiV0p8ZaEWJzQxl3vyq6o0/X/dni/mLqfLnyd GFsC+S/jJTBfz34F5F/m7kux2381vwOtjQ2x8Qn7YP9Og61kRHIYPT+GAePGgLVciWUu xpxkPuWEAJnpvFk42ndSs5ECdXJT5bzz4Baaxkj7r9K0rif/KGPCSe/7XzNVyB/b7xhE ht1boL3YpP8h5tG6/VVnR9HuaROcWMe73U5agdJaQmb4dedgKjzDDJ3DU5hCv7Rq9Xmn iJfpCO7vtb6uqZ07YZlzsi1sU3rwtlyrigqraoeCG8HDoclnsE899iHaqQ2S2J3uPRK0 A0jA== X-Gm-Message-State: AAQBX9dqcy0NqNPtaiHHglLW9OdoaJkf1AKElNmyBsty5qC6GT2ipOMn UurJGe8xFIir/7duRSqud/E= X-Google-Smtp-Source: AKy350bkZwf6iqswzqpXMmSEia/rGJP1PvbA0fR+8KeG+QddbiCmajg1LYcnnv02jdpb/PT8S/FGbQ== X-Received: by 2002:a17:907:320c:b0:947:5acb:920c with SMTP id xg12-20020a170907320c00b009475acb920cmr13903488ejb.34.1680448702344; Sun, 02 Apr 2023 08:18:22 -0700 (PDT) Received: from ?IPV6:2a01:c22:7b85:6800:129:5577:2076:7bf8? (dynamic-2a01-0c22-7b85-6800-0129-5577-2076-7bf8.c22.pool.telefonica.de. [2a01:c22:7b85:6800:129:5577:2076:7bf8]) by smtp.googlemail.com with ESMTPSA id l20-20020a17090612d400b00947740a4373sm3301782ejb.81.2023.04.02.08.18.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 02 Apr 2023 08:18:22 -0700 (PDT) Message-ID: Date: Sun, 2 Apr 2023 17:16:56 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 Subject: [PATCH net-next v2 6/7] net: phy: smsc: add support for edpd tunable Content-Language: en-US From: Heiner Kallweit To: Andrew Lunn , Russell King - ARM Linux , Eric Dumazet , Jakub Kicinski , David Miller , Paolo Abeni , Chris Healy Cc: "netdev@vger.kernel.org" References: In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org This adds support for the EDPD PHY tunable. Per default EDPD is disabled in interrupt mode, the tunable can be used to override this, e.g. if the link partner doesn't use EDPD. The interval to check for energy can be chosen between 1000ms and 2000ms. Note that this value consists of the 1000ms phylib interval for state machine runs plus the time to wait for energy being detected. v2: - consider that phylib core holds phydev->lock when calling the phy tunable hooks Signed-off-by: Heiner Kallweit Reviewed-by: Simon Horman --- drivers/net/phy/smsc.c | 75 +++++++++++++++++++++++++++++++++++++++++ include/linux/smscphy.h | 4 +++ 2 files changed, 79 insertions(+) diff --git a/drivers/net/phy/smsc.c b/drivers/net/phy/smsc.c index 659a3ab10..0eba69ad5 100644 --- a/drivers/net/phy/smsc.c +++ b/drivers/net/phy/smsc.c @@ -34,6 +34,8 @@ #define SPECIAL_CTRL_STS_AMDIX_STATE_ 0x2000 #define EDPD_MAX_WAIT_DFLT_MS 640 +/* interval between phylib state machine runs in ms */ +#define PHY_STATE_MACH_MS 1000 struct smsc_hw_stat { const char *string; @@ -295,6 +297,79 @@ static void smsc_get_stats(struct phy_device *phydev, data[i] = smsc_get_stat(phydev, i); } +static int smsc_phy_get_edpd(struct phy_device *phydev, u16 *edpd) +{ + struct smsc_phy_priv *priv = phydev->priv; + + if (!priv) + return -EOPNOTSUPP; + + if (!priv->edpd_enable) + *edpd = ETHTOOL_PHY_EDPD_DISABLE; + else if (!priv->edpd_max_wait_ms) + *edpd = ETHTOOL_PHY_EDPD_NO_TX; + else + *edpd = PHY_STATE_MACH_MS + priv->edpd_max_wait_ms; + + return 0; +} + +static int smsc_phy_set_edpd(struct phy_device *phydev, u16 edpd) +{ + struct smsc_phy_priv *priv = phydev->priv; + + if (!priv) + return -EOPNOTSUPP; + + switch (edpd) { + case ETHTOOL_PHY_EDPD_DISABLE: + priv->edpd_enable = false; + break; + case ETHTOOL_PHY_EDPD_NO_TX: + priv->edpd_enable = true; + priv->edpd_max_wait_ms = 0; + break; + case ETHTOOL_PHY_EDPD_DFLT_TX_MSECS: + edpd = PHY_STATE_MACH_MS + EDPD_MAX_WAIT_DFLT_MS; + fallthrough; + default: + if (phydev->irq != PHY_POLL) + return -EOPNOTSUPP; + if (edpd < PHY_STATE_MACH_MS || edpd > PHY_STATE_MACH_MS + 1000) + return -EINVAL; + priv->edpd_enable = true; + priv->edpd_max_wait_ms = edpd - PHY_STATE_MACH_MS; + } + + priv->edpd_mode_set_by_user = true; + + return smsc_phy_config_edpd(phydev); +} + +int smsc_phy_get_tunable(struct phy_device *phydev, + struct ethtool_tunable *tuna, void *data) +{ + switch (tuna->id) { + case ETHTOOL_PHY_EDPD: + return smsc_phy_get_edpd(phydev, data); + default: + return -EOPNOTSUPP; + } +} +EXPORT_SYMBOL_GPL(smsc_phy_get_tunable); + +int smsc_phy_set_tunable(struct phy_device *phydev, + struct ethtool_tunable *tuna, const void *data) +{ + switch (tuna->id) { + case ETHTOOL_PHY_EDPD: + return smsc_phy_set_edpd(phydev, *(u16 *)data); + default: + return -EOPNOTSUPP; + } +} +EXPORT_SYMBOL_GPL(smsc_phy_set_tunable); + int smsc_phy_probe(struct phy_device *phydev) { struct device *dev = &phydev->mdio.dev; diff --git a/include/linux/smscphy.h b/include/linux/smscphy.h index 80f37c1db..e1c886277 100644 --- a/include/linux/smscphy.h +++ b/include/linux/smscphy.h @@ -32,6 +32,10 @@ int smsc_phy_config_intr(struct phy_device *phydev); irqreturn_t smsc_phy_handle_interrupt(struct phy_device *phydev); int smsc_phy_config_init(struct phy_device *phydev); int lan87xx_read_status(struct phy_device *phydev); +int smsc_phy_get_tunable(struct phy_device *phydev, + struct ethtool_tunable *tuna, void *data); +int smsc_phy_set_tunable(struct phy_device *phydev, + struct ethtool_tunable *tuna, const void *data); int smsc_phy_probe(struct phy_device *phydev); #endif /* __LINUX_SMSCPHY_H__ */ From patchwork Sun Apr 2 15:17:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 13197445 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4467BC76196 for ; Sun, 2 Apr 2023 15:18:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231265AbjDBPSc (ORCPT ); Sun, 2 Apr 2023 11:18:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231274AbjDBPS2 (ORCPT ); Sun, 2 Apr 2023 11:18:28 -0400 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C08DDBC8 for ; Sun, 2 Apr 2023 08:18:23 -0700 (PDT) Received: by mail-ed1-x52b.google.com with SMTP id er13so66935599edb.9 for ; Sun, 02 Apr 2023 08:18:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680448703; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=FHt3FWLjHDC9hshm9BOf8mHp4Hkxi+Xn48pQS9ShfZE=; b=lSqTgViQ0PHr1p5uHtQu18Jgoi4ztIxy4WlUFPn8doIpwmjdbw4U1ZmmnR1u3h9kLK BwQMlQ5C+nuVB+O9jWPFd9Ruxq+BVUUH3OV5zLXF0hdIRqDINWMG1EChjneJyJgv4dUT EqsJ0GQfNvte7yWdt+zBp1l1l5d8AZqhZixMakeOERAjsmBu1ss5Y8NcIreBJiQafIvw L3pX5Zy3S3iJVABSbseWr1GiSvkm44N/UQdsw6hCOdZLFVH9H4XFei3DowRULQ0LaSHX 460W3TAQyScTKBTkm4kst+JHHUopCwD3SmMQKYSwOO0ZjY+TWxgutZ+KoJbK8fMbeFlj +5dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680448703; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=FHt3FWLjHDC9hshm9BOf8mHp4Hkxi+Xn48pQS9ShfZE=; b=VkY6ZJkx2TqcSMjeC3i6m/V+Vap9vMyS3hWbZGnyQ7zpMOCNOyj6MV288V6A9KglxR EUsWt0GkZCRPXiyrZBM5Tew9ghYDM0HGSksT5Ogy/VuFq5wu+rDjg/4pBXwsBWJQXOct N97PMFed9MZpXXFqCxBz9sOUImN1LzvRQehjbXcCISzcDiKrBL/yc0JxA53pS+IG6qLA KbAmoXL0bjARc0s01z0uYiifnElqQy3pDlU3RtjfpcVmXXsK7qIqXI4ySbjJG1ynC5Yn RTvg9/kYvgSXRueLJTX0VHVYw7DMFNw6AotrSbWPs0PV8hLS7H7Jb2hDOB0+MPfIO/VU aGwQ== X-Gm-Message-State: AAQBX9dCCgE9oMA66N2O10bY4WSAZ+mb+EMyBIvWVXENI6t6JLMN4hp5 UjQna3Rz3CZOPIcnVYohyRs= X-Google-Smtp-Source: AKy350aWQVLljdUCbiEp1xniGevQ9h3WauJDs6aGlgyhiXr/M7tswNf44sY5A+/uxJ0gcpI0QDNa1Q== X-Received: by 2002:aa7:c1d7:0:b0:4fa:ba31:6c66 with SMTP id d23-20020aa7c1d7000000b004faba316c66mr31403047edp.42.1680448703533; Sun, 02 Apr 2023 08:18:23 -0700 (PDT) Received: from ?IPV6:2a01:c22:7b85:6800:129:5577:2076:7bf8? (dynamic-2a01-0c22-7b85-6800-0129-5577-2076-7bf8.c22.pool.telefonica.de. [2a01:c22:7b85:6800:129:5577:2076:7bf8]) by smtp.googlemail.com with ESMTPSA id n19-20020a509353000000b004c09527d62dsm3410553eda.30.2023.04.02.08.18.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 02 Apr 2023 08:18:23 -0700 (PDT) Message-ID: Date: Sun, 2 Apr 2023 17:17:35 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 Subject: [PATCH net-next v2 7/7] net: phy: smsc: enable edpd tunable support Content-Language: en-US From: Heiner Kallweit To: Andrew Lunn , Russell King - ARM Linux , Eric Dumazet , Jakub Kicinski , David Miller , Paolo Abeni , Chris Healy Cc: "netdev@vger.kernel.org" References: In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Enable EDPD PHY tunable support for all drivers using lan87xx_read_status. Signed-off-by: Heiner Kallweit Reviewed-by: Simon Horman --- drivers/net/phy/smsc.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/net/phy/smsc.c b/drivers/net/phy/smsc.c index 0eba69ad5..692930750 100644 --- a/drivers/net/phy/smsc.c +++ b/drivers/net/phy/smsc.c @@ -469,6 +469,9 @@ static struct phy_driver smsc_phy_driver[] = { .get_strings = smsc_get_strings, .get_stats = smsc_get_stats, + .get_tunable = smsc_phy_get_tunable, + .set_tunable = smsc_phy_set_tunable, + .suspend = genphy_suspend, .resume = genphy_resume, }, { @@ -513,6 +516,9 @@ static struct phy_driver smsc_phy_driver[] = { .get_strings = smsc_get_strings, .get_stats = smsc_get_stats, + .get_tunable = smsc_phy_get_tunable, + .set_tunable = smsc_phy_set_tunable, + .suspend = genphy_suspend, .resume = genphy_resume, }, { @@ -539,6 +545,9 @@ static struct phy_driver smsc_phy_driver[] = { .get_strings = smsc_get_strings, .get_stats = smsc_get_stats, + .get_tunable = smsc_phy_get_tunable, + .set_tunable = smsc_phy_set_tunable, + .suspend = genphy_suspend, .resume = genphy_resume, }, { @@ -569,6 +578,9 @@ static struct phy_driver smsc_phy_driver[] = { .get_strings = smsc_get_strings, .get_stats = smsc_get_stats, + .get_tunable = smsc_phy_get_tunable, + .set_tunable = smsc_phy_set_tunable, + .suspend = genphy_suspend, .resume = genphy_resume, } };