From patchwork Sun Apr 2 09:44: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: 13197319 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 9547AC7619A for ; Sun, 2 Apr 2023 09:48:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230191AbjDBJsb (ORCPT ); Sun, 2 Apr 2023 05:48:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229459AbjDBJsa (ORCPT ); Sun, 2 Apr 2023 05:48:30 -0400 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F06E59E8 for ; Sun, 2 Apr 2023 02:48:29 -0700 (PDT) Received: by mail-wr1-x42e.google.com with SMTP id r29so26395879wra.13 for ; Sun, 02 Apr 2023 02:48:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680428908; 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=TUj/LbQXS5AilzPoAPviWunmxFJ38xjPPr5k7HLhoD/S4ljgP887uo0GX6mLaYZKuC P287QNkqKn5PsTQRwYDWL1Yy3RpGqZHxqIT0dsIu3J3TY9VCCe1DCoy5KLtq9cWrViiv L3b2Cuz/fg1CVjd8DKp6Tg3NEl9KDuLsqVNaz5Aya02Ieoyfjmuu8i8jBWUezUGvaMct H2z6ZQ+ka9puLP3iNXgnl6Iat9jc0JnNlh2EvJ5vSvZkOMvB1S504+/YzOaIWa2SuGHv XCoXeyfOfRoFgIWigszmGIZcuPxjAjXmZY5A277zCcKol1lEI7HwvL2ZWUppSoSePOT9 KsIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680428908; 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=U6dfJO4p1nFYl3UYJBzGSedDq83ucj+X/jiY+D9T3LFX71PmXLBxNl19jZynWVaunA opFeXUtBveU7TbemJdRyrNcaMdtOQ65aLPVe+xymr3casdgnDwWR5YCTcR+f2xirxWGa m1mtV84ERsEcKHOG1krsG7AISDgLSB6oItZVCDoMAhy8EavvAMVWCuiRhDG0pHQNzWK1 tGGsuObtFh8nHpY9Xzx5eYAcwx5PedgrJmTs1uTut1UTMZqZnapKuMlqWfU4/yBPvbPR NmBvEt2Qc3FMvxWqEZQ5hOxFcqczoE2UKR4rYQrZ2GrKjvS41VUhOndQUNwli/S+jan5 u+JQ== X-Gm-Message-State: AAQBX9cEE0gRStPlyFDtP/KXpTN8I0iypedXemcydw7RuHffTZec737U bHu2Qef3Sx5RX+NIl1xYVJk= X-Google-Smtp-Source: AKy350YvLuFzEXwAlZMrAw2O2kiJHtSaniO94Ij2S8y+njmGkkuUtVqJcVJlWuhedGDTrSPuQCnpWA== X-Received: by 2002:adf:f38e:0:b0:2dc:c9c0:85cc with SMTP id m14-20020adff38e000000b002dcc9c085ccmr26163248wro.59.1680428907837; Sun, 02 Apr 2023 02:48:27 -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 x9-20020a5d4449000000b002e40d124460sm6890448wrr.97.2023.04.02.02.48.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 02 Apr 2023 02:48:27 -0700 (PDT) Message-ID: <44049041-67ee-43f6-a598-c7397ac63a56@gmail.com> Date: Sun, 2 Apr 2023 11:44: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 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 , Paolo Abeni , David Miller , Jakub Kicinski Cc: "netdev@vger.kernel.org" References: <17fcccf5-8d81-298e-0671-d543340da105@gmail.com> In-Reply-To: <17fcccf5-8d81-298e-0671-d543340da105@gmail.com> 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 --- 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 09:45:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 13197320 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 B5BF3C76196 for ; Sun, 2 Apr 2023 09:48:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230239AbjDBJsd (ORCPT ); Sun, 2 Apr 2023 05:48:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230206AbjDBJsb (ORCPT ); Sun, 2 Apr 2023 05:48:31 -0400 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE4675B85 for ; Sun, 2 Apr 2023 02:48:30 -0700 (PDT) Received: by mail-wm1-x334.google.com with SMTP id bg16-20020a05600c3c9000b003eb34e21bdfso18014210wmb.0 for ; Sun, 02 Apr 2023 02:48:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680428909; 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=l+A6zY/43MGMMyb9o/A5gUfOzkbkHeEzkZ8M9cu5LIv6DxWF/bgWEaOnaNqnmAWB56 aAnFp20cqew4wd/BXtWu0WuY4XMQpZRTrycX+bhDxtXafTOKTXNITlHfNjtInz1871v9 n7qBCxEFYAkTf3oBvPi2/XGItnmfY4GbVZP3ERSfL62c0D2zz8lcnT/FcKBqxa1sNE8i sWzxVB0MKjwGIn4Lm/6xglGCi3YBJD9bsXscOyYRAQbobK9Rphlo38mey/SNVcnjtNCL mFkZCM09g1ncltTZ8s2lgpNPeWMLG++qFtCNSydzcInD3hiAjzHFC2Ct0I01ZgS+8yHl mTIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680428909; 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=Ixx4OD8K0PxrujG1KlxAS2H4pGigXC0EHOj8TfHscCnnOMyO00neM8HzsFoa9fA6mM mqeecNGbXTCX4oVkjMfSgyFVxUeFOkWccH3k3XYBmYpn7FvMPJnR7Nr18t46s4wV8yla +NwtsnSJgZn/ofnSq+55iSFaItPRCt/g6H2m79alVFoicG3Zth9VwlmJb9rWsPajR8vu MR/TTwzutcIfcKMLHyLp56DjxKGb3qKfJSKGeVpZjU06Iqwr2eJN9LyAvjClUuT8pmrk Dl7Zd/eXU9Xt8ztOvm3xSVn4PE6XxAf3DZ+47B4lDcEZjgmZcGDuFeitn1ERU/YvXESx vn2g== X-Gm-Message-State: AO0yUKVlgxNwCUFOpd+OqZS0I4WGYeMH0o+FjnmO+krwL0cJvpy31KiL N6kFyWAzpmmuR5b+C1KWtcM= X-Google-Smtp-Source: AK7set8qBUMVe4dZVitqlV32lDCEA8h7uLASbKwoQCenQ8DFRRu8Yv0DKbp5vAInewXGXTaBtWFxMg== X-Received: by 2002:a7b:c7ce:0:b0:3ed:a07b:c59d with SMTP id z14-20020a7bc7ce000000b003eda07bc59dmr25125849wmk.21.1680428909312; Sun, 02 Apr 2023 02:48:29 -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 q9-20020a1cf309000000b003f04f0c5a6fsm1821763wmq.26.2023.04.02.02.48.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 02 Apr 2023 02:48:28 -0700 (PDT) Message-ID: Date: Sun, 2 Apr 2023 11:45:16 +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 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 , Paolo Abeni , David Miller , Jakub Kicinski Cc: "netdev@vger.kernel.org" References: <17fcccf5-8d81-298e-0671-d543340da105@gmail.com> In-Reply-To: <17fcccf5-8d81-298e-0671-d543340da105@gmail.com> 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 --- 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 09:45:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 13197321 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 09CF5C76196 for ; Sun, 2 Apr 2023 09:48:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230260AbjDBJse (ORCPT ); Sun, 2 Apr 2023 05:48:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230218AbjDBJsd (ORCPT ); Sun, 2 Apr 2023 05:48:33 -0400 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31A0359E8 for ; Sun, 2 Apr 2023 02:48:32 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id t4so21206379wra.7 for ; Sun, 02 Apr 2023 02:48:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680428910; 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=LwgbIeTanWWopm2Woc6G9OjxlDTFUJdRd+39o8DvPaQ=; b=UeaaSaYdZ3IGhpR5TWe2uV5Rs8gK6W5fAWC5SOjltkwjeoz9RSLxhsma1z5v29GUXa SJj80LQvDtLpem/ag248Hsoyu7YW8FZGKzLHPMjgNXGPV/xRwjJybygYfAAB+5pUiSdZ bNyfspOUhVl/qRtNfEBdi69qsjEodRHoD9rHQ1X9U4PLJRTPzJV44mNBBCuy7DKsA6Jt bSJKKdEC36BFazRMYk5Xd9QOxvj3cFD8VM+qUTGyCmHIruqtyGA1j+vxkjN+FRFsUZYm 3KHx79pY8VhrPAbtPw4/3VYh9viyohMDmdrsTZliakK+fSgcFsxFZnkg3BVUF7KnlDN2 485A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680428910; 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=LwgbIeTanWWopm2Woc6G9OjxlDTFUJdRd+39o8DvPaQ=; b=LPb2Kbh50Zu4WRQxJKZJZ8JWiw0U5D/7JBWW3qgzpCsYFO4+w+//kCnx5ucjP6amxF 3rCZgjskzxU/J+Is/cYmaRps7r7SX4vFYm/98qZJjMd06AzfC7YGvhvP3YZTAgWgTrz0 oU5FoA2Ap5f6jIW8rN/H0BihH1g2J0DqErWfbLAPCUgXwCgHwvjJ9LJunETxLZXH/P+Z AUsBMCukVgWxtE1PJ/+k+4/W7UCqAxAXpQGVkCL7PYeaqP5kYsA7rqOTNp0Cz+et5bH6 BwMxAHan+yN3dxpL3K9H5kxo/AzUOlZMORamR+H/M1aX6l1M1dt5pO8XyXNNcyyOZZ8U awSQ== X-Gm-Message-State: AAQBX9eeha+T5W/+i1TqDV0jgKfub0uSQE05AZpCMUh/Ej+HXIyPCyEm nW3y8KuCRXckAzWJoX8NvbU= X-Google-Smtp-Source: AKy350aKHy9TnCxEaNjPSqZVBT7xU3MfmYWc0KvuWxmVFVNNpxvo/+zQ9KKdibW9+Y6Qvu/kw00yFw== X-Received: by 2002:a5d:6b4b:0:b0:2dc:2431:67d0 with SMTP id x11-20020a5d6b4b000000b002dc243167d0mr24385422wrw.19.1680428910525; Sun, 02 Apr 2023 02:48:30 -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 k16-20020a056000005000b002e116cbe24esm6903026wrx.32.2023.04.02.02.48.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 02 Apr 2023 02:48:30 -0700 (PDT) Message-ID: Date: Sun, 2 Apr 2023 11:45:54 +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 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 , Paolo Abeni , David Miller , Jakub Kicinski Cc: "netdev@vger.kernel.org" References: <17fcccf5-8d81-298e-0671-d543340da105@gmail.com> In-Reply-To: <17fcccf5-8d81-298e-0671-d543340da105@gmail.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Clear edpd_enable if interrupt mode is used, this avoids having to check for PHY_POLL multiple times. Signed-off-by: Heiner Kallweit --- 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 09:46:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 13197323 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 CD3ECC76196 for ; Sun, 2 Apr 2023 09:48:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230297AbjDBJsr (ORCPT ); Sun, 2 Apr 2023 05:48:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230243AbjDBJse (ORCPT ); Sun, 2 Apr 2023 05:48:34 -0400 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A3ED5FDE for ; Sun, 2 Apr 2023 02:48:33 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id t4so21206399wra.7 for ; Sun, 02 Apr 2023 02:48:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680428912; 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=VqUuc1jeFxOE8B56aOQjff51BS/bwt8MPVAYGou1fXtPX+/x35WOayOtkKE7EIVIiQ EdOFURMxO2LwMtvDQFclZtjWM8Ir6gaBkyNRbX6dbZwNX6xBpMxEn0E82mcHL0xXWQqB HPWV4Rbwwf7I3tJxKJuNLVpt3bVXkhAheZD8EFd0flLfAa1VehS1X2d7d37I4GfDjSuc fSZIwl7+cR1jCmv0kx1Y4O5woT497X95vxrSl85Cv+KBBXyuUZt7SRvt7xAOK8jlaGVM fJHzzj8FJ/i878INBFsi4cAZuhs3Q+/sfLEj18AfvrqqeyvpcIzSsQLCxszNB+hY/8HF kbOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680428912; 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=pU4cbqoSzVZnL2Ahck3gUlpaZTneF5Ok6G821GNHmOH66XhZklE/mBI9SDnz7rnINv TMTaCa30HTdQ35WXmCGXaZaGNDmjvT6u9rAQnk4VZcjOJ2Ll/nw0TBjGJr+GvE9DczJ5 R+xwtbvnSrOqYd7AxGviMyHdH82Lee+rk8DZNlqoTV7HE0uBt1K6qw6k2bAwKi3q6YI9 8TG/tX8y16qpJgyC0nc1iG/coxeSJ1veIxCjAuN6qwtOTzZHfDjp066TBvWwS3tP3LIR h0wwRfRxNnAJ4dw4NhWNP4rNkmZ/PwvVh0NSqIU+7WBcAP+K6FJ4gWNQ+H/0zv3DLbjw qH4g== X-Gm-Message-State: AAQBX9eFoDUV2wIGUS9fLM+P2snhRIKRzdFMxhxRGlB7Pmc0w/6ndnKk WjeOu5tUyWRZKKEN4c81eKw= X-Google-Smtp-Source: AKy350Zcz8vO7fTXi9lrhFYPijzW8y35py5tSvuFF29SLePG1/VoA5d4rm6k7blpygFI4Sa/+Uun4g== X-Received: by 2002:a5d:6692:0:b0:2e4:cc81:8a80 with SMTP id l18-20020a5d6692000000b002e4cc818a80mr8799756wru.26.1680428911830; Sun, 02 Apr 2023 02:48:31 -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 e7-20020adffd07000000b002ca864b807csm7008480wrr.0.2023.04.02.02.48.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 02 Apr 2023 02:48:31 -0700 (PDT) Message-ID: <4a498ad1-5d2f-e861-1550-f67eda55c01c@gmail.com> Date: Sun, 2 Apr 2023 11:46:25 +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 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 , Paolo Abeni , David Miller , Jakub Kicinski Cc: "netdev@vger.kernel.org" References: <17fcccf5-8d81-298e-0671-d543340da105@gmail.com> In-Reply-To: <17fcccf5-8d81-298e-0671-d543340da105@gmail.com> 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 --- 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 09:47:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 13197322 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 607F5C76196 for ; Sun, 2 Apr 2023 09:48:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230315AbjDBJsq (ORCPT ); Sun, 2 Apr 2023 05:48:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230270AbjDBJsg (ORCPT ); Sun, 2 Apr 2023 05:48:36 -0400 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C91D01BF7A for ; Sun, 2 Apr 2023 02:48:34 -0700 (PDT) Received: by mail-wm1-x32b.google.com with SMTP id p34so15371629wms.3 for ; Sun, 02 Apr 2023 02:48:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680428913; 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=SAblUE03ymYuwzjrgwBcc3OSVWPRf9YpmAHrq+Quvv4=; b=NE9K05P0a/C7QVRXP6JzGXQk4tA7LUXr2rzefRgCJT8s0XRxCrhw9NtCuCtElJjtl5 UXqX/YsYNyOm0TC8VOwQ2YZxBg8Uk31/2GFk1MRJH2mwz1Rfmqq2+2QlATOt4O8K0Mtz fTUav9U6C54I3a1rb7tk0cJ1rW5WELuAYtNErZNVbGzHJ0PT5WQCUx34ojPzYPtGV/NS Sahq0ZT9hVpzLPXmzV3VjNyK3f7DaV+sq/pc/GvsYf/rgU1QdRTd6x7WUcCHQ3Cr9hk8 HoRBCElZlhxWlMJmS9PkB3XzZoSp1k/Z6vZ/+V6uNX4i2tsigjN1P54/cqkdqTbDjEys HRMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680428913; 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=SAblUE03ymYuwzjrgwBcc3OSVWPRf9YpmAHrq+Quvv4=; b=3X9DhW0gWCjwsY3ltknbwND1D2sDLtAvJHHvHmPMB9/H1RjTohcDUkenQ1pt5fLpXk s2Ay9mUH+ZuZMWeABf7ay9x26MipVfWmM76g2eqjuaYInLswDOdAyh/TGgL2Wt4x1Mnk 519+dx/lST311Mx40kbboKywSSjbULYzWYcTb2ZMPyq8YgzM+ZrpNR5tF87HP5UhxL7c TF87wl/LGq4qwiWdreelDc67fERLqqqre6gs+wNhg7pysos0rA62wcYGEKMrfc7I+Y+h VResJli3u/L2u550SqgYTwz0V1Fo2HkX8QyJhAZXy1Kug6kpbQQpx9/1IDoQ1k1FZlqJ Lqkg== X-Gm-Message-State: AAQBX9eD6ZKBrfABaA7WaiQNHnHKOdC21nNi1UVDPtkf3zOu1oZbTZl6 cR4lDDdnH41ELPV9pRvEGPo= X-Google-Smtp-Source: AKy350ZhtmSaSxWUzMy58Et9f+xTTsKpUSRU7191r6Jg/6o1EPeVn/SlTvHPXO1IdVvx0Rx1kcM+lA== X-Received: by 2002:a1c:ed17:0:b0:3f0:396b:8b9c with SMTP id l23-20020a1ced17000000b003f0396b8b9cmr7881598wmh.9.1680428913290; Sun, 02 Apr 2023 02:48:33 -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 y22-20020a7bcd96000000b003ee42696acesm8559115wmj.16.2023.04.02.02.48.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 02 Apr 2023 02:48:32 -0700 (PDT) Message-ID: <602fd4ec-3448-d45b-034a-6110a4a454d6@gmail.com> Date: Sun, 2 Apr 2023 11:47:03 +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 5/7] net: phy: smss: prepare for making edpd wait period configurable Content-Language: en-US From: Heiner Kallweit To: Andrew Lunn , Russell King - ARM Linux , Eric Dumazet , Paolo Abeni , David Miller , Jakub Kicinski Cc: "netdev@vger.kernel.org" References: <17fcccf5-8d81-298e-0671-d543340da105@gmail.com> In-Reply-To: <17fcccf5-8d81-298e-0671-d543340da105@gmail.com> 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. Signed-off-by: Heiner Kallweit --- 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..0cd433f01 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 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; if (device_property_present(dev, "smsc,disable-energy-detect")) priv->edpd_enable = false; From patchwork Sun Apr 2 09:47:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 13197324 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 120DAC7619A for ; Sun, 2 Apr 2023 09:48:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230307AbjDBJsw (ORCPT ); Sun, 2 Apr 2023 05:48:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230293AbjDBJsp (ORCPT ); Sun, 2 Apr 2023 05:48:45 -0400 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D14A1D2C6 for ; Sun, 2 Apr 2023 02:48:36 -0700 (PDT) Received: by mail-wm1-x32e.google.com with SMTP id r19-20020a05600c459300b003eb3e2a5e7bso16375577wmo.0 for ; Sun, 02 Apr 2023 02:48:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680428914; 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=h74B+sspgxWF+7aFXKfhg3s39gu1HTzZBhHhas95eg0=; b=RJbxMQr1kpLtO+MyUBP7WhR6bj67reJZZg+Ym4Q6b91V6CNXZjPWPVB+OuaHKiqoQM RSqO6808kyOJ+lQQ+AH7AV4wqE9s+U6WYNg13YjX67jDTAl8B8HXSUZcdAS7/YpKUgmf M1abDow9NjG1gIOVQDNQKNbeT+IUO/74NCB6lahka5RIyUB6S1tFFACE9A5/caW2zcPg 0FWtPtKXPUo5AeBgHuazkYhmyJsGnXSzjc/a+QngZqotCi8MfITpxNI1wl8+M9fB5ZVE vtL9B8mYZBx9KG7CUjfQgIJpRj8iLdr8XnBc+UNSFCMIGeOTNUtiEkheZ11L1Gpq4+BW 5rGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680428914; 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=h74B+sspgxWF+7aFXKfhg3s39gu1HTzZBhHhas95eg0=; b=zJOVK0QbZx9U/ffqYe6yB+NvUA5R+dJ6pBvZsUHL3B/I2dYiaau26XJwjy0aTLmbnz gHqknDP8xSB1YKinu29WiOc1DCFMjXT4EgSLphsWC+tWiHGHi4ICSXk7GK9XOUFHiHT1 cJP9pU/tKn+zUJH3AT9uSRIfrdB43JtArwPRxdQB+6RTN9KraqFC75fzlfjiS1wkn2Ig DiMiJmHvrJEOtvlI+43Zg6IDSXw07bYmiY7kgso8imrxotgEItc+ulbd9mFYGoDGTlAI /8HNuWnE+bSnuc/4pXqSoSzEXeZSEDvLhAcFgVQckhlKgb5czawx24Fw8DOxYzpshNJb oc4A== X-Gm-Message-State: AO0yUKU32JnbGqg8mvHiOdkj7BdGMMkVVAwrJfgUauB/MAYkF4H89jjf EHM7qEE3orDfiBzc0S0KQTA= X-Google-Smtp-Source: AK7set9JKeHqrfKGDPSlyxWTJeNb2C8RLV62283dni2kCcbBO7m2DSmxeAXtdLPAPAP9EnTYhi+tFw== X-Received: by 2002:a05:600c:25a:b0:3ed:358e:c1c2 with SMTP id 26-20020a05600c025a00b003ed358ec1c2mr24288815wmj.18.1680428914544; Sun, 02 Apr 2023 02:48:34 -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 z7-20020a05600c220700b003f04646838esm7382057wml.39.2023.04.02.02.48.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 02 Apr 2023 02:48:34 -0700 (PDT) Message-ID: <66446a75-8087-10f4-fc37-b97e13b88c27@gmail.com> Date: Sun, 2 Apr 2023 11:47:34 +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 6/7] net: phy: smsc: add edpd tunable support Content-Language: en-US From: Heiner Kallweit To: Andrew Lunn , Russell King - ARM Linux , Eric Dumazet , Paolo Abeni , David Miller , Jakub Kicinski Cc: "netdev@vger.kernel.org" References: <17fcccf5-8d81-298e-0671-d543340da105@gmail.com> In-Reply-To: <17fcccf5-8d81-298e-0671-d543340da105@gmail.com> 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. Signed-off-by: Heiner Kallweit --- drivers/net/phy/smsc.c | 82 +++++++++++++++++++++++++++++++++++++++++ include/linux/smscphy.h | 4 ++ 2 files changed, 86 insertions(+) diff --git a/drivers/net/phy/smsc.c b/drivers/net/phy/smsc.c index 0cd433f01..cca5bf46f 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 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,86 @@ 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; + int ret; + + if (!priv) + return -EOPNOTSUPP; + + mutex_lock(&phydev->lock); + + 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; + 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; + + ret = smsc_phy_config_edpd(phydev); + + mutex_unlock(&phydev->lock); + + return ret; +} + +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 09:48:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 13197325 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 E2339C76196 for ; Sun, 2 Apr 2023 09:48:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230052AbjDBJs5 (ORCPT ); Sun, 2 Apr 2023 05:48:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230298AbjDBJsp (ORCPT ); Sun, 2 Apr 2023 05:48:45 -0400 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93A1A5FD0 for ; Sun, 2 Apr 2023 02:48:37 -0700 (PDT) Received: by mail-wm1-x32b.google.com with SMTP id m6-20020a05600c3b0600b003ee6e324b19so16377879wms.1 for ; Sun, 02 Apr 2023 02:48:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680428916; 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=dtMfU//EjnJXIFHUDZIKeAuLL38xF7hEOoaS7TmL8WE=; b=i7H5pOkK1gU389XfjyQBiYjEK+//qaGoMmblu+DDslhSt41GTUoAqg1A3mSW7rOEFI 5DtrEFk2HACplNAqgxUdVZ04Cq3EI0evGXnXWicvhrOl0X9EHuEzxV5rMH+cc8Zd6eHF p/5FD4PCfVAo1MwhakMJiJlKN6rwt8/NCMWDe1Ryk/gF6O5qt5n1CiTR6DG4kLUaVQvy c50lAtgNxbrCL340LS8KaFGxrrb++eb6wxpxCxUbl1vFhbGo2ikSg7EBD6gp8ZrJDjsw +vXCHIduCuTmHozzmVUebgjVZ7IvBufdtPC97rF/3U8dVyDhxrsr64mOu7/IqtC9sv36 u3vA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680428916; 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=dtMfU//EjnJXIFHUDZIKeAuLL38xF7hEOoaS7TmL8WE=; b=moniilb4q+ZEhgUAIYHBydhCqTffztBUrStXcbNK7AxfnnaFp5GyODEsgvM4L3hc50 zaQVCffI2zryi1O5vMQMjDrRHfDwLBEuG3POPcZyXX6ZA69kfWurs00dyLdYZYuhNVhP 07Rs4NSdDxOO029+CjJWS0LBj9T4TFdo1X/wz4s8UYPGYRW2zxZrLDOC+7AsWcQ2Z7gO AmcL84iq8QEHJS+nEIuhq66QL8N1AcsgpyZj1ayj/pij7t7ZcUfddchXbhkFmZrc1/Uc iWYKWRqxPcoK2/SqDUq8I0KYaaVezbIXsl9REjF+XJ1N6q6XDAb5yJadPT8KqSqt6bPI Ok3Q== X-Gm-Message-State: AO0yUKWuxdXpzsy/YO3Pbnm+F4nP6JM1NfWWi+JoqAsb0M1IMmkl6bbg OC3zt4saO3TvjMi8kHbqrkI= X-Google-Smtp-Source: AK7set8M8MWH6c6GFp74+7s0Dz27ozCvFJ3y67uCZWa0rD6OCzAMtXJL4rQlFK4TQ7ECIx4koDY4zg== X-Received: by 2002:a1c:f619:0:b0:3ed:514d:e07f with SMTP id w25-20020a1cf619000000b003ed514de07fmr25464147wmc.3.1680428915751; Sun, 02 Apr 2023 02:48:35 -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 q3-20020a05600c46c300b003ebf73acf9asm24968293wmo.3.2023.04.02.02.48.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 02 Apr 2023 02:48:35 -0700 (PDT) Message-ID: <48dc7962-f9e1-4489-d73e-28716f586b56@gmail.com> Date: Sun, 2 Apr 2023 11:48:12 +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 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 , Paolo Abeni , David Miller , Jakub Kicinski Cc: "netdev@vger.kernel.org" References: <17fcccf5-8d81-298e-0671-d543340da105@gmail.com> In-Reply-To: <17fcccf5-8d81-298e-0671-d543340da105@gmail.com> 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 --- 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 cca5bf46f..a85763c02 100644 --- a/drivers/net/phy/smsc.c +++ b/drivers/net/phy/smsc.c @@ -476,6 +476,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, }, { @@ -520,6 +523,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, }, { @@ -546,6 +552,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, }, { @@ -576,6 +585,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, } };