Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp4917911rwb; Sun, 4 Dec 2022 10:30:38 -0800 (PST) X-Google-Smtp-Source: AA0mqf40pucQtxdiS8SIBkaa66rMIGTHuhKeW18naPkPiY8HrHzs768eYUvQmN0on448DwOX232p X-Received: by 2002:a17:906:a107:b0:77f:9082:73c7 with SMTP id t7-20020a170906a10700b0077f908273c7mr49904623ejy.517.1670178638570; Sun, 04 Dec 2022 10:30:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670178638; cv=none; d=google.com; s=arc-20160816; b=fKuj8PT99VkzYTNKE3n2xjYBy7M4gcpYJkqMTza1GIqeCXxmduaYhoq/kbvZOzG5Dn BlM143K0QoY0aX0m+woI9JFyAlM0w0bJGz5YDNu/9H3nwBFi8fS3vXtgSWpA0DhL3JfG lcbIaRhffV+Xg3mG0U2DY7rNVfo4JB2+SNPFNZbsAEgyf5O/PNECIHFTZy/l1mq+x5TY MDKtYaLI1tQ6dsKaX7pDdiR/PAmGyZ12k6i2kO1ITlNpE+wACweYgQzvHVcM5XJjhgdO rC2Ed7DovBKUDNxOA9gq80+3hPnnKvxhxDvr5HB9yf50cj5YPTr6fG1AdddMtVeQM8K/ rvDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=hxaIyiMKkKRAft5XVZyqxqDaRSGY1h1I1Orv3yrm3ZM=; b=to/m+oqQTmPivvoIp0KmcxA7g9vY3n5kI3joitUdqGsvhYpwS4b7lNfcNhvrdgUFxz 7bgZ0Rj+QY7SGImA9PTB+NSXZBSwE94sAu//6kow5jyMAsPndDyVTxgTj2TbP3BTdeAQ BgsvCokQz/eV0qhLQ7BZmhVScYhAhw8kpbqxPd+mbyyMKtUFle8AWBbLDNTQUpwEZMpb kqrb0dInDh/1Nj6zKwUItBkEeuxZuQzpuSqH+EvyBSTueh+kRFtmgMBQ+EclLkYs3Ruu r+cLwcfRpuyuSAXlHWkoj6at8sp/wVarCX4ArEqsMKzlUqE7kTVHHTjSFKsqxB/U77aO 3qvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b="PMPRw/D3"; 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=NONE dis=NONE) header.from=lunn.ch Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l19-20020a056402255300b0046909065335si10807307edb.525.2022.12.04.10.30.19; Sun, 04 Dec 2022 10:30:38 -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=@lunn.ch header.s=20171124 header.b="PMPRw/D3"; 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=NONE dis=NONE) header.from=lunn.ch Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229973AbiLDSB5 (ORCPT + 82 others); Sun, 4 Dec 2022 13:01:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231124AbiLDSBi (ORCPT ); Sun, 4 Dec 2022 13:01:38 -0500 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09A831E6; Sun, 4 Dec 2022 10:00:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=hxaIyiMKkKRAft5XVZyqxqDaRSGY1h1I1Orv3yrm3ZM=; b=PMPRw/D3ghY75mSPCatMu9WvHV oo7r8yQxvM9Ku1DuQCoY/kKat9UXhMwh8rgI3XeTXIAZSdGK6LWjnPotDLjzMfbY/+66zdJLDZi3U ngfYMvrUgn608+o45FQ97yxByBnWopxwPXzbyvO3APDPiHQ+C+Wy1/gfElB/+Rf2N7wo=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1p1tI6-004KnR-I9; Sun, 04 Dec 2022 19:00:38 +0100 Date: Sun, 4 Dec 2022 19:00:38 +0100 From: Andrew Lunn To: "Russell King (Oracle)" Cc: Piergiorgio Beruto , Heiner Kallweit , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Oleksij Rempel Subject: Re: [PATCH net-next 3/4] drivers/net/phy: Add driver for the onsemi NCN26000 10BASE-T1S PHY Message-ID: References: <834be48779804c338f00f03002f31658d942546b.1670119328.git.piergiorgio.beruto@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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_PASS,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 Sun, Dec 04, 2022 at 03:31:33AM +0100, Piergiorgio Beruto wrote: > > +static irqreturn_t ncn26000_handle_interrupt(struct phy_device *phydev) > > +{ > > + const struct ncn26000_priv *const priv = phydev->priv; > > + u16 events; > > + int ret; > > + > > + // read and aknowledge the IRQ status register > > + ret = phy_read(phydev, NCN26000_REG_IRQ_STATUS); > > + > > + if (unlikely(ret < 0)) > > + return IRQ_NONE; > > + > > + events = (u16)ret & priv->enabled_irqs; > > + if (events == 0) > > + return IRQ_NONE; > > + > > + if (events & NCN26000_IRQ_LINKST_BIT) { > > + ret = phy_read(phydev, MII_BMSR); > > + > > + if (unlikely(ret < 0)) { > > + phydev_err(phydev, > > + "error reading the status register (%d)\n", > > + ret); > > + > > + return IRQ_NONE; > > + } > > + > > + phydev->link = ((u16)ret & BMSR_ANEGCOMPLETE) ? 1 : 0; Hi Piergiorgio Interrupt handling in PHY don't follow the usual model. Historically, PHYs were always polled once per second. The read_status() function gets called to report the current status of the PHY. Interrupt are just used to indicate that poll should happen now. All the handler needs to do is clear the interrupt line so it can be safely reenabled and not cause an interrupt storm, and call phy_trigger_machine() to trigger the poll. Andrew