Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp11678691rwl; Tue, 3 Jan 2023 03:09:22 -0800 (PST) X-Google-Smtp-Source: AMrXdXtUZr/kkd4aEwMmVtOWX7PADs1TyXsFyneN0+Wya5icJGq6+IaqkElAGpBivjsM0AArFLnm X-Received: by 2002:a17:90a:b395:b0:226:1531:6be6 with SMTP id e21-20020a17090ab39500b0022615316be6mr25299606pjr.48.1672744162048; Tue, 03 Jan 2023 03:09:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672744162; cv=none; d=google.com; s=arc-20160816; b=akfm99yrSeY8Rx9O3ntEh0oqqqnxZx3O9x2kzrST2IHi/wjWRy3XU926hnBdQs2iFq 4VRVU8Fuo2nVhu/gszpLsXA66JoNWXaDRG+AjMSLC8RV7uqZc80lZVhzeEehiW5FoSzc fOZ1Qb1x3Dxvv2t0MTRg3kUFhH4O0j5Tps4tQ2qthMjXRuvr+6EJPPJQyktEzoHLmJum lvjDq+4gYv1mrGeWk9BRT5928HcwFCOXR6ogCOuOcWhuJ1pUVB86TmS9ITXNik1jP0qn zFEE0C7MiaJV4K9ZH/np/Hts4pDncdcYDemkjxAAi2qXLWwGL4klYZJboy00F1jKi2Kg ZZjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=5kukGlDFMSVA3hFPcBY5jEpdLjtGj3Dwb3Kj2ab+XKA=; b=Ok/7n+UdHOsM96IC2zWZk+NboSCD/9UDOqgaeNMejchKuDe4WYG5YKY8uKcpc/I78i yvrvi7bDP7mGzcf+X9YLlThRHYr7yhyWImwDBgIjuIlHJVExxzxvEGM0c4hF0AsQHc0e V46g1/cff/ZqVwxrgrTMFpuIOjZxEtAHWeGn6M5hC44mko5Va0qA4avnm1aG2PD8E1N2 4kbq3QIopc0gI+hWlSo+H3NCP6+nU72ONAJxrEjox0YCLaSoYHaJm05fCvnPN8LxYKyY ISCwk+JBGgnnWk7lW5g7xsoJUxTIvWVwNsraYuYz6fOvi6Xp8ZMF5grbUCY1aeo79PSz f5bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=ie5QquIb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x12-20020a17090a970c00b0021824fcc6b9si30447351pjo.63.2023.01.03.03.09.14; Tue, 03 Jan 2023 03:09:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=ie5QquIb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236887AbjACK1p (ORCPT + 61 others); Tue, 3 Jan 2023 05:27:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233310AbjACK13 (ORCPT ); Tue, 3 Jan 2023 05:27:29 -0500 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A951510AA; Tue, 3 Jan 2023 02:27:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=5kukGlDFMSVA3hFPcBY5jEpdLjtGj3Dwb3Kj2ab+XKA=; b=ie5QquIbDqicHFURbmXb6WUsmw NZvGSKX0/By0EFHDK5VxPEqe3mzTrHLKxLfdSrh5PF1oLA7jBHlrSySJW/gIm650pUZr7VjWueQpm /sExjorFqiPboDwQOB9tZ+O52KwBTgR4BLg5t8AmwFOG3SL6ydWkEJgf51xA2Mc4gCF+hJ4fKNsT7 sgDcHaOyg9KJmG5O4J1TzcT+kHnZ5uP//nt712trd5IM1DtmYisnkPaH20knWxZ9+UGjI/cHVel0S /CRU305Sbox5JIxnw/Qq+5PQ2vHoG46wGZXDYqZGhKsnUq0PzUsdmMtJ6zNdlIE9vy4TxehQJWVnF NUzaLjlg==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:35914) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1pCeVu-0005DT-GP; Tue, 03 Jan 2023 10:27:22 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1pCeVs-0001z2-QU; Tue, 03 Jan 2023 10:27:20 +0000 Date: Tue, 3 Jan 2023 10:27:20 +0000 From: "Russell King (Oracle)" To: Florian Fainelli Cc: Michael Walle , Xu Liang , Andrew Lunn , Heiner Kallweit , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH RFC net-next v2 1/2] net: phy: allow a phy to opt-out of interrupt handling Message-ID: References: <20221228164008.1653348-1-michael@walle.cc> <20221228164008.1653348-2-michael@walle.cc> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Russell King (Oracle) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 28, 2022 at 08:49:35AM -0800, Florian Fainelli wrote: > > > On 12/28/2022 8:40 AM, Michael Walle wrote: > > Until now, it is not possible for a PHY driver to disable interrupts > > during runtime. If a driver offers the .config_intr() as well as the > > .handle_interrupt() ops, it is eligible for interrupt handling. > > Introduce a new flag for the dev_flags property of struct phy_device, which > > can be set by PHY driver to skip interrupt setup and fall back to polling > > mode. > > > > At the moment, this is used for the MaxLinear PHY which has broken > > interrupt handling and there is a need to disable interrupts in some > > cases. > > > > Signed-off-by: Michael Walle > > --- > > drivers/net/phy/phy_device.c | 7 +++++++ > > include/linux/phy.h | 2 ++ > > 2 files changed, 9 insertions(+) > > > > diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c > > index 716870a4499c..e4562859ac00 100644 > > --- a/drivers/net/phy/phy_device.c > > +++ b/drivers/net/phy/phy_device.c > > @@ -1487,6 +1487,13 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, > > phydev->interrupts = PHY_INTERRUPT_DISABLED; > > + /* PHYs can request to use poll mode even though they have an > > + * associated interrupt line. This could be the case if they > > + * detect a broken interrupt handling. > > + */ > > + if (phydev->dev_flags & PHY_F_NO_IRQ) > > + phydev->irq = PHY_POLL; > > Cannot you achieve the same thing with the PHY driver mangling phydev->irq > to a negative value, or is that too later already by the time your phy > driver's probe function is running? > > > + > > /* Port is set to PORT_TP by default and the actual PHY driver will set > > * it to different value depending on the PHY configuration. If we have > > * the generic PHY driver we can't figure it out, thus set the old > > diff --git a/include/linux/phy.h b/include/linux/phy.h > > index 71eeb4e3b1fd..f1566c7e47a8 100644 > > --- a/include/linux/phy.h > > +++ b/include/linux/phy.h > > @@ -82,6 +82,8 @@ extern const int phy_10gbit_features_array[1]; > > #define PHY_POLL_CABLE_TEST 0x00000004 > > #define MDIO_DEVICE_IS_PHY 0x80000000 > > +#define PHY_F_NO_IRQ 0x80000000 > > Kudos for using the appropriate namespace for dev_flags :) But eww for placement. PHY_IS_INTERNAL, PHY_RST_AFTER_CLK_EN, PHY_POLL_CABLE_TEST and MDIO_DEVICE_IS_PHY are all used for the MDIO driver's flags member. This new flag is used for the .dev_flags of phy_device - I feel that it should be separated from the above definitions. I also think it could do with a comment, because it's not obvious for future changes that PHY_F_NO_IRQ is used with .dev_flags. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!