Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp4822401rwl; Wed, 28 Dec 2022 09:15:04 -0800 (PST) X-Google-Smtp-Source: AMrXdXuUP0C8LdEQtAECDdYjSbNJQHIkShwO6KWVKb5IKj+EcugBdwSqpuBcJPw9MPV5CbtNEBCt X-Received: by 2002:a17:90b:4fcf:b0:225:f77d:3d6b with SMTP id qa15-20020a17090b4fcf00b00225f77d3d6bmr10409789pjb.18.1672247704052; Wed, 28 Dec 2022 09:15:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672247704; cv=none; d=google.com; s=arc-20160816; b=rM7c8JwK0PhZs25nXNnbDDwPy4HrDAG3blCjnNKhSTnkabbBYvz3X3aCGiqYF4kXK/ oNzn014vHCwP6gRHTur4YteYxcOTQ6fJcuM5x4Bu6+OOR1jnwMVfoHnfFKT27BlL/NKa hneL3xZEOnjgn7Az6uLL6qBU2YiuR2wJVgF1KABdEcgqsZvjJYZIMLnyCiNr3cjTKeLm 2q12KttjdoS+an838OtLgbAUpsD7pp3/zpFeWSkIL0Ey9YvcRLaPmhx4NaALqtLTVnc+ cAp7S3MqRy4aBrToyHYHB+pjySUTxE2r191/U2do9m4cfpaj4n3YcpA6E7rraBCs7gma aNcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=eeEUIq8anNiPZM23MObY5xSvdyY0tL2j5SQvoivztbw=; b=VhQaIPTyIdkgThsdcFPChT9dVvSmfAXF3Y58FNJCSy9wyclGfcfOFN97qByOHj/cgr x358ZbpEqnGtBUIU6KPuT2FekXYdneu5rz/DNtHtLhmkNcEF2tdg5Tu+TUCd80TtnZT/ C3hhCkES1U1vSecJNL4vGOKG23x4dsOqiLAkTmVo/V4ovOewbJdTW9K4WJCF6zjZd1rr RpQNwC8gfAVLs9kMI530mBTKX89WD2AFUv2CentY0tf5i75QU65oPmp9ai3biLmgjeA5 LzRCV4VME9jd189Qmxq4h0naxiRp4vyV/fgC6gkenipEZQb8ub/S2c4w9gbWqI0E8Y3z ZW7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=NBZXScmr; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kb7-20020a17090ae7c700b00225fc594eacsi7605185pjb.80.2022.12.28.09.14.55; Wed, 28 Dec 2022 09:15:04 -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=pass header.i=@gmail.com header.s=20210112 header.b=NBZXScmr; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235254AbiL1QzY (ORCPT + 64 others); Wed, 28 Dec 2022 11:55:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234853AbiL1Qyw (ORCPT ); Wed, 28 Dec 2022 11:54:52 -0500 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 258A91C40C; Wed, 28 Dec 2022 08:49:39 -0800 (PST) Received: by mail-pl1-x635.google.com with SMTP id u7so16493102plq.11; Wed, 28 Dec 2022 08:49:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=eeEUIq8anNiPZM23MObY5xSvdyY0tL2j5SQvoivztbw=; b=NBZXScmrt5t0BbfQ3yo5Fy3xzkn73i56npIJLWqI/LdGF5rpiDA32lTcAvJfcEisPN OKErGRQMeGXhfIa3523zfGpkllQ7SOYCSkPwqDM5dIvqaH4Y02Dxb5AKcuN6sLwSfQZZ gaAQFg/iV1nrXh+5yr2s+QlEDwbCYhXXLr1ObdZsv/wZ2ZxHJRnu3FN9BaSJz6wczWbT /++R5hmrYq51QE7ji2n3kmztpebCZaqqc+yVELk55D4GPfHnbU3epIMCMiqo5/f2BI39 Bacg6h9JZ0DeFgv1cL8C7qnMYggMICuFs2U+pmjwjO7POsTxnIv/mBXcnRRMWEn+pTeQ rwWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=eeEUIq8anNiPZM23MObY5xSvdyY0tL2j5SQvoivztbw=; b=JV7ZTJtxx/lUu3wF+aU8/yO81bKfCnfS6XjK96VTxHu4iC27ysU0xv5AYEkr0J0LgY +tRoG2lAqvo4mM9RR6QLbZro66Z4Cqqnslv/2jyhmQKbPJ/b/Flo+lSuuqhMYU0M54Yk GXHguC5+SlARS7HG0I9Cze01nEpjHzxX/O4NJdf4cRn/bpvnwRXTyiMSS0Rs4LLcndzl WjcwHIvZs0OFnoGoDZuLgSDYu/bJSR3eYxdkGoCSequ3pQdaSFCRyp1LCUgDpSxNwihV gJeqlKuTKx3VXotThnK+RrFq2znMIkKeRU5utWJD9Of6XbcMOpBJq3+GOY+0kAQu32fX aLiQ== X-Gm-Message-State: AFqh2koAacD1vuebCeET5xpkTHBeMLxYKAgpIn9Hlr0+eU0F1OatqrI9 ulYrFqhdWCdBSHi/ytech3I= X-Received: by 2002:a17:902:848d:b0:189:5f5c:da1d with SMTP id c13-20020a170902848d00b001895f5cda1dmr25196749plo.18.1672246178504; Wed, 28 Dec 2022 08:49:38 -0800 (PST) Received: from [192.168.1.3] (ip72-194-116-95.oc.oc.cox.net. [72.194.116.95]) by smtp.gmail.com with ESMTPSA id d6-20020a170902654600b0019255ab4dc8sm11346976pln.66.2022.12.28.08.49.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 28 Dec 2022 08:49:37 -0800 (PST) Message-ID: Date: Wed, 28 Dec 2022 08:49:35 -0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: [PATCH RFC net-next v2 1/2] net: phy: allow a phy to opt-out of interrupt handling Content-Language: en-US To: Michael Walle , Xu Liang , Andrew Lunn , Heiner Kallweit , Russell King , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <20221228164008.1653348-1-michael@walle.cc> <20221228164008.1653348-2-michael@walle.cc> From: Florian Fainelli In-Reply-To: <20221228164008.1653348-2-michael@walle.cc> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 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 :) -- Florian