Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp462292pxb; Thu, 12 Nov 2020 08:02:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJzLJv/ZuF1duO2/dKvHQ+avi/e8zW8t2IrBgIhf7xNqpFdaNJ845xi1n6aUgYOKBJx6Z3mI X-Received: by 2002:a17:906:17d1:: with SMTP id u17mr29467216eje.229.1605196959458; Thu, 12 Nov 2020 08:02:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605196959; cv=none; d=google.com; s=arc-20160816; b=zaIbIrhRd5SYMnxE5VDYnI6mKmEVsazub1lrX2CR52IjydGfmV1Pf653gVB17qjt3Q NhFzggtoZdNpbVR9B8bPibA4eNIzmHwzOsqbJnBLBPzk7aYBXb1bzPtCg29X3HYWYC1j wjnOYi80Ql0rYTSC3lgZXS20Sg3+sxqjTXDqkMTqjjNOnanKKiztthTaXOzN+AzoSUmY nTVynLNwIAJiqmAWFoYmZogGXj0u4rWOzExigzmPyhxEZ0FCAYsAPLnmxAZhKNW+pgxG 87/C1Tv/tGTjnViLLVrySX/5I3eP9IzygLVkEPIsoOSwexhHAovcbTLV1n//IECwrYk0 +wpQ== 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=Y8LXIYYpPzP9HNW+uSjQkTA7aSXHrHU/5a1QvbrK6pU=; b=vMMaB6BjJR2Jb4R0k7+RGLPdAFnPtdrp2HXWeDocaKEaN58GIedSPvXAshvsxtuAF2 c0aeRPKSbZMgPkzb2aIQeycojoTTmKb5Q22bstizupCsAID/FOqhFlPC+D8SU+5PW0w5 dLcW1os6aPJV4I94bInIMORzuB+vcuCweSOfBzsbJSZJUduaZo1TT5BZUqV8POtxDmx7 l4INNYlCiNQkNEHlmDejFX3kNiqh+3R8ulZ3bdhj0gfQ9sDJ9c7HN3cmTc3fBGB3If61 QTl5uAvsXXn3m0UfZpiFlJoN1htPfaWpuOE1yK2nTaaiZLtyg57yzwIzQPU1EQkIU9cq woVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Mf8jMYwx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g1si3994730edh.491.2020.11.12.08.02.09; Thu, 12 Nov 2020 08:02:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Mf8jMYwx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1728831AbgKLP6U (ORCPT + 99 others); Thu, 12 Nov 2020 10:58:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728792AbgKLP6S (ORCPT ); Thu, 12 Nov 2020 10:58:18 -0500 Received: from mail-ed1-x542.google.com (mail-ed1-x542.google.com [IPv6:2a00:1450:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E60FC0613D1; Thu, 12 Nov 2020 07:58:18 -0800 (PST) Received: by mail-ed1-x542.google.com with SMTP id v22so6839817edt.9; Thu, 12 Nov 2020 07:58:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Y8LXIYYpPzP9HNW+uSjQkTA7aSXHrHU/5a1QvbrK6pU=; b=Mf8jMYwx3MccylRZVpZjJKNS5ZylfgEGGfPOj5DjKvYtf2p5gw2bpUVDQ8nrPlA8/a 64cGwf9pKyxMHAzlpz084caVQsL/gfw/R8EeVWkJw9XR8SnDwT0pY1eTHeRlEG7nH7PV my9OGNkh1djkhZMsnmCvTRkg+IBDPw7pNtw8IV3rSRgkwIaH1vQwGQSpxV4ZUUiXw2zN NRH6QK4E2yNl7mSn/pYhKYOm6ghO+68h/Kr8CbiIEwqtSIW3QIRqp1him+7t9KGZlYs+ 31TtEfd/u3Xs0NNy7Boe8MbQg0VJ+ju7v35CoAr4f0HVweeaKSJmJwk0cZFHffXi/Jgt 1C9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Y8LXIYYpPzP9HNW+uSjQkTA7aSXHrHU/5a1QvbrK6pU=; b=gaibUjvkQe6tpmlv5BXu7Z6M4tndLMM46UMmdYTPePtcBBrCugySP/V0x0H+zyBQFd X42CvRLDAW4xqQCag4gVpxRdqSo/Y9aC/cBLHXLeDMyGiDWpAzZXWGiv3f7kH1vtuhgE oCtwIj+kdfwqC4RwNfEErgZ6O07xBhsWu5VZE4jrfHDDPyop2EPp43IFVRWjEMxwAexY ricS8k4D8BfMDfo2NZOqD6Qbdq5sJsDe6gKbC1x/aEkOddhdtV5mQcLIoSs2q42GX1Ae NaADkqtpZkAx4TyTkj0z9ZvzsXSRItjmhDjRVd0uyz3DP55gnkmlCHiLMBNwpwmdsTL5 wInA== X-Gm-Message-State: AOAM5303OTYXy+L6qHWsiBazH8xVFkouC5M5pXdLdwBRGnCXqZPyA42N GhsPUQjI9834fqRpfOhK95sGWTnzgkBHuw== X-Received: by 2002:a05:6402:1456:: with SMTP id d22mr395126edx.77.1605196696690; Thu, 12 Nov 2020 07:58:16 -0800 (PST) Received: from yoga-910.localhost ([188.25.2.177]) by smtp.gmail.com with ESMTPSA id q15sm2546540edt.95.2020.11.12.07.58.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Nov 2020 07:58:16 -0800 (PST) From: Ioana Ciornei To: Andrew Lunn , Heiner Kallweit , Russell King , Florian Fainelli , Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Ioana Ciornei , Kavya Sree Kotagiri , Linus Walleij Subject: [PATCH net-next 01/18] net: phy: vitesse: implement generic .handle_interrupt() callback Date: Thu, 12 Nov 2020 17:54:56 +0200 Message-Id: <20201112155513.411604-2-ciorneiioana@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201112155513.411604-1-ciorneiioana@gmail.com> References: <20201112155513.411604-1-ciorneiioana@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ioana Ciornei In an attempt to actually support shared IRQs in phylib, we now move the responsibility of triggering the phylib state machine or just returning IRQ_NONE, based on the IRQ status register, to the PHY driver. Having 3 different IRQ handling callbacks (.handle_interrupt(), .did_interrupt() and .ack_interrupt() ) is confusing so let the PHY driver implement directly an IRQ handler like any other device driver. Make this driver follow the new convention. Cc: Kavya Sree Kotagiri Cc: Linus Walleij Signed-off-by: Ioana Ciornei --- drivers/net/phy/vitesse.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/drivers/net/phy/vitesse.c b/drivers/net/phy/vitesse.c index bb680352708a..9f6cd6ec9747 100644 --- a/drivers/net/phy/vitesse.c +++ b/drivers/net/phy/vitesse.c @@ -40,6 +40,11 @@ #define MII_VSC8244_ISTAT_SPEED 0x4000 #define MII_VSC8244_ISTAT_LINK 0x2000 #define MII_VSC8244_ISTAT_DUPLEX 0x1000 +#define MII_VSC8244_ISTAT_MASK (MII_VSC8244_ISTAT_SPEED | \ + MII_VSC8244_ISTAT_LINK | \ + MII_VSC8244_ISTAT_DUPLEX) + +#define MII_VSC8221_ISTAT_MASK MII_VSC8244_ISTAT_LINK /* Vitesse Auxiliary Control/Status Register */ #define MII_VSC8244_AUX_CONSTAT 0x1c @@ -311,6 +316,31 @@ static int vsc82xx_config_intr(struct phy_device *phydev) return err; } +static irqreturn_t vsc82xx_handle_interrupt(struct phy_device *phydev) +{ + int irq_status, irq_mask; + + if (phydev->drv->phy_id == PHY_ID_VSC8244 || + phydev->drv->phy_id == PHY_ID_VSC8572 || + phydev->drv->phy_id == PHY_ID_VSC8601) + irq_mask = MII_VSC8244_ISTAT_MASK; + else + irq_mask = MII_VSC8221_ISTAT_MASK; + + irq_status = phy_read(phydev, MII_VSC8244_ISTAT); + if (irq_status < 0) { + phy_error(phydev); + return IRQ_NONE; + } + + if (!(irq_status & irq_mask)) + return IRQ_NONE; + + phy_trigger_machine(phydev); + + return IRQ_HANDLED; +} + static int vsc8221_config_init(struct phy_device *phydev) { int err; @@ -392,6 +422,7 @@ static struct phy_driver vsc82xx_driver[] = { .config_aneg = &vsc82x4_config_aneg, .ack_interrupt = &vsc824x_ack_interrupt, .config_intr = &vsc82xx_config_intr, + .handle_interrupt = &vsc82xx_handle_interrupt, }, { .phy_id = PHY_ID_VSC8244, .name = "Vitesse VSC8244", @@ -401,6 +432,7 @@ static struct phy_driver vsc82xx_driver[] = { .config_aneg = &vsc82x4_config_aneg, .ack_interrupt = &vsc824x_ack_interrupt, .config_intr = &vsc82xx_config_intr, + .handle_interrupt = &vsc82xx_handle_interrupt, }, { .phy_id = PHY_ID_VSC8572, .name = "Vitesse VSC8572", @@ -410,6 +442,7 @@ static struct phy_driver vsc82xx_driver[] = { .config_aneg = &vsc82x4_config_aneg, .ack_interrupt = &vsc824x_ack_interrupt, .config_intr = &vsc82xx_config_intr, + .handle_interrupt = &vsc82xx_handle_interrupt, }, { .phy_id = PHY_ID_VSC8601, .name = "Vitesse VSC8601", @@ -418,6 +451,7 @@ static struct phy_driver vsc82xx_driver[] = { .config_init = &vsc8601_config_init, .ack_interrupt = &vsc824x_ack_interrupt, .config_intr = &vsc82xx_config_intr, + .handle_interrupt = &vsc82xx_handle_interrupt, }, { .phy_id = PHY_ID_VSC7385, .name = "Vitesse VSC7385", @@ -463,6 +497,7 @@ static struct phy_driver vsc82xx_driver[] = { .config_aneg = &vsc82x4_config_aneg, .ack_interrupt = &vsc824x_ack_interrupt, .config_intr = &vsc82xx_config_intr, + .handle_interrupt = &vsc82xx_handle_interrupt, }, { /* Vitesse 8221 */ .phy_id = PHY_ID_VSC8221, @@ -472,6 +507,7 @@ static struct phy_driver vsc82xx_driver[] = { .config_init = &vsc8221_config_init, .ack_interrupt = &vsc824x_ack_interrupt, .config_intr = &vsc82xx_config_intr, + .handle_interrupt = &vsc82xx_handle_interrupt, }, { /* Vitesse 8211 */ .phy_id = PHY_ID_VSC8211, @@ -481,6 +517,7 @@ static struct phy_driver vsc82xx_driver[] = { .config_init = &vsc8221_config_init, .ack_interrupt = &vsc824x_ack_interrupt, .config_intr = &vsc82xx_config_intr, + .handle_interrupt = &vsc82xx_handle_interrupt, } }; module_phy_driver(vsc82xx_driver); -- 2.28.0