From patchwork Fri Dec 1 00:14:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 172186 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp776417vqy; Thu, 30 Nov 2023 16:16:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IHHm1zDiTvpZZ7oFT8C6EcZi6TcKGw23YEYLcXMZTAV1FYqm2Y+9aQie5Fz9JKuRVdDV9U9 X-Received: by 2002:a17:90b:1d8c:b0:285:b7b9:dcd4 with SMTP id pf12-20020a17090b1d8c00b00285b7b9dcd4mr19489914pjb.16.1701389764530; Thu, 30 Nov 2023 16:16:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701389764; cv=none; d=google.com; s=arc-20160816; b=aedyJ5JFCzYhbdAtlkfB1YrtnCC5IufsvzR7oZZuTxoRhJk8wlM5pq2tOplPHfPMBW A9uquPKZJl6l0Bfe/tLcxy/Qkr1rbkzJC4DBc5xKgaAJCIGoQDfLtc7+BFwUNZ2vFR4m /wBV0yaC7L1hhWwbfBEQP4R6aH/CKyhT5vCQpHYEaA/48FNEeF59vnHSK7Vhht4GCrbt 6HYbcpdoFyAe7tYC2RWKWLDuiokzxEtcODQWQMGUefsfLASR26+fjg5tL8IsiYedWJSw Z45Dj4hd0pk3hdZzzxgdQ6J/oGe4A5J17DvYux1nKl1U7in7bzCvvg39SDr6ihJt8I5X G3HQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=rYf/4x1S6Xi4qxCbsW/ZhILQxOYsjDvuEIJRKEsMK/k=; fh=utmrxdkgikAlLxVfQI1kldUG+rNjhrLN+3fAlOYj01s=; b=ulC3rTz4GOx4oR026AGKXuN1cHvk5x1HTfMqCQFkz7RTDozpOZ4WkryoW7elYeBr5p qJ4fHNdRU/WpFRxugjbys8RA2+jyyoy5r5/WUAb+ZDUhTAPJhfpHsnJtMl/nUqufmfln mPe6Ot5uCtsrag65jV7D5huWtMB//e/aRHlQNc3Nnhp1ecz4QptHISxXypwWueUOf5Y9 0OFYfE7xeoPuaKkqdZqVmMX0DtTdMxyjEq7SJFtsbd6Pa3KGeBTL71M3jTgQbfnCxBRc 31CWTIBV/xAt0dlKIBKD20/osNhtQxyHq+7SEd9dNN/UbFmEDPQ6ohDkemSAcrV+k4S6 nobw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=BY6FVuHh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id oe8-20020a17090b394800b002858a291a45si2518935pjb.141.2023.11.30.16.16.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 16:16:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=BY6FVuHh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id A8FAE807E420; Thu, 30 Nov 2023 16:15:31 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377495AbjLAAPR (ORCPT + 99 others); Thu, 30 Nov 2023 19:15:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377447AbjLAAPD (ORCPT ); Thu, 30 Nov 2023 19:15:03 -0500 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CEC41722; Thu, 30 Nov 2023 16:14:59 -0800 (PST) Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-40b2ddab817so14657935e9.3; Thu, 30 Nov 2023 16:14:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701389698; x=1701994498; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rYf/4x1S6Xi4qxCbsW/ZhILQxOYsjDvuEIJRKEsMK/k=; b=BY6FVuHhiIpA1VGHZ1mmqCF8dsAlNTB2kwvzy0oWO6K8Z/dcl+iRSlkLVPkkssEuns L055R9M91icT9YeBXqgdk/EOI+e1gHvAxVa08YshdeoexvF4XAes4JlNb9OkX7EtIi3+ FusEWBAbRgwtI3zn7E4cJd5p9hnC9QS7evrhpSmCHs9Xxm6M5tBj/tAfn57Md6qUmpQD 0gwFy0nkHaabq+/gJnkT49R0d5mXG3fBHMSKATgBshJ09gk9fD8dwej5Z0giKgdwoxRV gH6i979byCbAsLmb8ByQKAlePmwPKZnW2a3SJszcXsRBQQFPdNbZXyLw3qZzL0wuCt34 T3UA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701389698; x=1701994498; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rYf/4x1S6Xi4qxCbsW/ZhILQxOYsjDvuEIJRKEsMK/k=; b=vAqVmHffckItnsIfK58RfNh70AkJVKi+N4fFHAEyrfors9Mm5nAsVt7rsIhgDyyySj 0x1M/NMQuNOtkkK2mFv9WN4tv9WEyLR2H6UU56DLOJe6T0So5Z5JKqpmDWxfT3iWF/vi YjYVHnhVpmWtfmntKAMaLPRekGFO4vwERc5Szz/4Rn5HpCcBt78FtWddLRq5mfoDJ0ID ihTdNAWBtKcWVB4F4SZY69Az6zX+9tIlAzZzsSqNapjWyAUzaJ6RC3cNEY5xJwZLsMr9 EBxaMhRz+Sc4l0hHR998XO7X2qdG+GXOO68AxLeDJp8I30Sw5xPO0Yc/ZlzU9IeDvywB QTSw== X-Gm-Message-State: AOJu0YxvVHesz6X5Bd2RAmEXGadviqws+MK+WSvzKZI3GpEonXoIffNw leQ82hYkh+oS/x7J6UJUl9TDOuxnoGw= X-Received: by 2002:a7b:c3d9:0:b0:40b:5e59:da9a with SMTP id t25-20020a7bc3d9000000b0040b5e59da9amr108816wmj.173.1701389697891; Thu, 30 Nov 2023 16:14:57 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id g16-20020a05600c4ed000b0040b47c53610sm3535457wmq.14.2023.11.30.16.14.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 16:14:57 -0800 (PST) From: Christian Marangi To: Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Christian Marangi Subject: [net-next PATCH v2 09/12] net: phy: at803x: move specific at8031 config_intr to dedicated function Date: Fri, 1 Dec 2023 01:14:19 +0100 Message-Id: <20231201001423.20989-10-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231201001423.20989-1-ansuelsmth@gmail.com> References: <20231201001423.20989-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Thu, 30 Nov 2023 16:15:31 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784036473309865477 X-GMAIL-MSGID: 1784036473309865477 Move specific at8031 config_intr bits to dedicated function to make at803x_config_initr more generic. This is needed in preparation for PHY driver split as qca8081 share the same function to setup interrupts. Signed-off-by: Christian Marangi --- drivers/net/phy/at803x.c | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index 2de7a59c0faa..1897030667d9 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -990,7 +990,6 @@ static int at803x_ack_interrupt(struct phy_device *phydev) static int at803x_config_intr(struct phy_device *phydev) { - struct at803x_priv *priv = phydev->priv; int err; int value; @@ -1007,10 +1006,6 @@ static int at803x_config_intr(struct phy_device *phydev) value |= AT803X_INTR_ENABLE_DUPLEX_CHANGED; value |= AT803X_INTR_ENABLE_LINK_FAIL; value |= AT803X_INTR_ENABLE_LINK_SUCCESS; - if (priv->is_fiber) { - value |= AT803X_INTR_ENABLE_LINK_FAIL_BX; - value |= AT803X_INTR_ENABLE_LINK_SUCCESS_BX; - } err = phy_write(phydev, AT803X_INTR_ENABLE, value); } else { @@ -1619,6 +1614,29 @@ static int at8031_set_wol(struct phy_device *phydev, return ret; } +static int at8031_config_intr(struct phy_device *phydev) +{ + struct at803x_priv *priv = phydev->priv; + int err, value = 0; + + if (phydev->interrupts == PHY_INTERRUPT_ENABLED && + priv->is_fiber) { + /* Clear any pending interrupts */ + err = at803x_ack_interrupt(phydev); + if (err) + return err; + + value |= AT803X_INTR_ENABLE_LINK_FAIL_BX; + value |= AT803X_INTR_ENABLE_LINK_SUCCESS_BX; + + err = phy_set_bits(phydev, AT803X_INTR_ENABLE, value); + if (err) + return err; + } + + return at803x_config_intr(phydev); +} + static int qca83xx_config_init(struct phy_device *phydev) { u8 switch_revision; @@ -2139,7 +2157,7 @@ static struct phy_driver at803x_driver[] = { .write_page = at803x_write_page, .get_features = at803x_get_features, .read_status = at803x_read_status, - .config_intr = at803x_config_intr, + .config_intr = at8031_config_intr, .handle_interrupt = at803x_handle_interrupt, .get_tunable = at803x_get_tunable, .set_tunable = at803x_set_tunable,