Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp6132582rwl; Mon, 9 Jan 2023 04:44:16 -0800 (PST) X-Google-Smtp-Source: AMrXdXucOFXQjfeOQZb3w3a2uQJf71+wRNQd2N9JMgrVD69eRqA9TQkqfVg92vUwaBw91Xla5p9I X-Received: by 2002:a05:6a20:8f26:b0:ad:db18:6d0d with SMTP id b38-20020a056a208f2600b000addb186d0dmr98627057pzk.59.1673268256285; Mon, 09 Jan 2023 04:44:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673268256; cv=none; d=google.com; s=arc-20160816; b=QQwbQ+HNbgD9rLBHzNBbO17RwHs3HxnC5gJYLe4le8XCFY5/hlRjtY1i9dKUrRB568 Fk/0vnn3WW1iAXoD47mBM68br08EtHts/QBY6R9oa2Q/KGHgk74AckXxe33VHLFTSY4s gdqa/FlI82D5n8RlGX9qUTu1GLzR8yDSd/dS8hSaqm7ZcFOuXLpQ6Yh2mf4jaYNfm+tS zRGF5tg/b/F3Q8D8QL7LrqUMhvlV5au2MDNIeR2cWdBnS/xFRzuqTUGDshD+vpOgkaPB NirRIIqLlbWpaKoMdqXzfwEOUCUtvG86WKaCtDqnawpiT19c8bJtw7J8Fdkie4j4wJOK uDjw== 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=+pGsNIHjitpKn7MDw9fSh//e+FCcst6QZrjhQXHPk7c=; b=x+99JAMw7y/xus6wURDgapjztkOrxqpdDt5ZoowINXXLBbuVR0eWS9vPA3nJMwWh3t j2+apQOUM+yb6kzIvDK7kGDTgWn9vYXtFsJDK8c6v0DYfeNrbYGcB9UnIzjjpZ5pP0mL KGunetogDYxPupma3CvW89drmSqs/uKVVwU2v67/ofPLqyVWlhEjZ05UGWl0BcHeLN6s 0hko1Zs8bx0SsHj+pVyUkemOgN9rk/nfKKrieKYKaOZXqh7fmLZLJH4BfvT8yi1NQ+lR 9iAO3ie/vMTKCtdmp3T6tD0mNc7UD0R9g/C5eKfBbt5G/R6SEX+S7pOOid0oxhjEAUdT TuZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2022082101 header.b=dDYFZ1ou; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=walle.cc Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 28-20020a630f5c000000b004769f0faab8si9076903pgp.740.2023.01.09.04.44.09; Mon, 09 Jan 2023 04:44:16 -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=@walle.cc header.s=mail2022082101 header.b=dDYFZ1ou; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=walle.cc Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234691AbjAIMbJ (ORCPT + 52 others); Mon, 9 Jan 2023 07:31:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237273AbjAIMaZ (ORCPT ); Mon, 9 Jan 2023 07:30:25 -0500 Received: from mail.3ffe.de (0001.3ffe.de [IPv6:2a01:4f8:c0c:9d57::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 124561BCB4; Mon, 9 Jan 2023 04:30:24 -0800 (PST) Received: from mwalle01.kontron.local. (unknown [213.135.10.150]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.3ffe.de (Postfix) with ESMTPSA id 0614F16A5; Mon, 9 Jan 2023 13:30:22 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2022082101; t=1673267422; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+pGsNIHjitpKn7MDw9fSh//e+FCcst6QZrjhQXHPk7c=; b=dDYFZ1ouWPdjgrngTgusZbE+C5ahWILXMIQtW8byw1W0TAmH6iyRgWUA/7vYCYpmBFL2RD xcHW8P7Z9Tjf1Unz0qCYYf94jzehULbi/cNdCR2OBC8FnnVZmz+UiuVIevl31EhhyF38g8 RphRHhBnoYZ5fHBS6RZsNYOjSewmbw9WlEHWngW7ZEItH2Mf6OhCuhnM2Id0MSj9HFmDJ0 qvP2Puv1UejJNH9JgsdbYAyK2uxtiNVyqTzyMn6vcXukGCFfGVtXzi0hpv9gnCvz6s/r0g h+dAaDArPKW+WDQQ0fkLiDe39/q09eqJ3UN/MRPZRpH9TFARlkwoLI9efrnM6g== From: Michael Walle To: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Xu Liang , Andrew Lunn , Heiner Kallweit , Russell King Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Michael Walle Subject: [PATCH net-next v3 3/4] net: phy: allow a phy to opt-out of interrupt handling Date: Mon, 9 Jan 2023 13:30:12 +0100 Message-Id: <20230109123013.3094144-4-michael@walle.cc> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230109123013.3094144-1-michael@walle.cc> References: <20230109123013.3094144-1-michael@walle.cc> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam: Yes 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_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 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 | 3 +++ 2 files changed, 10 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; + /* 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 6378c997ded5..742754d72fc0 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -739,6 +739,9 @@ struct phy_device { #endif }; +/* Generic phy_device::dev_flags */ +#define PHY_F_NO_IRQ 0x80000000 + static inline struct phy_device *to_phy_device(const struct device *dev) { return container_of(to_mdio_device(dev), struct phy_device, mdio); -- 2.30.2