Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9F760C5519F for ; Wed, 18 Nov 2020 15:55:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4B33F247BA for ; Wed, 18 Nov 2020 15:55:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726760AbgKRPzy (ORCPT ); Wed, 18 Nov 2020 10:55:54 -0500 Received: from vps0.lunn.ch ([185.16.172.187]:35404 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726304AbgKRPzy (ORCPT ); Wed, 18 Nov 2020 10:55:54 -0500 Received: from andrew by vps0.lunn.ch with local (Exim 4.94) (envelope-from ) id 1kfPoF-007kUQ-6D; Wed, 18 Nov 2020 16:55:51 +0100 Date: Wed, 18 Nov 2020 16:55:51 +0100 From: Andrew Lunn To: Asmaa Mnebhi Cc: David Thompson , "netdev@vger.kernel.org" , "davem@davemloft.net" , "kuba@kernel.org" Subject: Re: [PATCH net-next v3] Add Mellanox BlueField Gigabit Ethernet driver Message-ID: <20201118155551.GD1800835@lunn.ch> References: <1605654870-14859-1-git-send-email-davthompson@nvidia.com> <20201118030950.GB1804098@lunn.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org > Yes mlxbf_gige_mdio_handle_phy_interrupt is used to check whether > the interrupt is coming from GPIO12 (which is set in HW as the PHY > INT_N pin). There is one HW interrupt line (here defined as > MLXBF_GIGE_PHY_INT_N) shared among all the GPIOs and other > components (like I2C). So this is the key thing here. You have an interrupt controller, where as the PHY subsystem wants a plain interrupt. Give the PHY subsystem a plain interrupt, and it will do all the calls to configure the PHY, enable interrupts in the PHY etc. There is nothing stopping you have an interrupt controller inside an Ethernet driver, or any other sort of driver. Take for example: https://elixir.bootlin.com/linux/v5.10-rc4/source/drivers/net/dsa/mv88e6xxx/chip.c#L127 The Marvell Ethernet switches also have an interrupt controller. Actually they have two nested controllers. This code registers an irq domain with the linux core, so that the individual interrupt sources can be used as just plain old Linux interrupts. The irqdomain is responsible to masking and unmasking interrupts, in the interrupt controller. The end user of these interrupts, then just request them in the usual way: https://elixir.bootlin.com/linux/v5.10-rc4/source/drivers/net/dsa/mv88e6xxx/global1_atu.c#L419 So in your case, map the PHY interrupt in this domain, and pass it to the PHY subsystem. Andrew