Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp462691pxb; Thu, 12 Nov 2020 08:03:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJz7+7zgKrTK73Us5jItkmb0Ti09CGIRGGugjXCC1U6LIaAh/cjeRoE5MB2d+CEDdTTt2AwF X-Received: by 2002:a17:906:6686:: with SMTP id z6mr30210125ejo.554.1605196985403; Thu, 12 Nov 2020 08:03:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605196985; cv=none; d=google.com; s=arc-20160816; b=OX9unhR0QlelHHN7vWdBJV+/DCIB8VLLnZvd2SIe9cS+ke7pYibc4bhoCN0GKHjqO8 Zjac+LV4uCjCEyDSNLsjyCYe1BGLM5brInUdc31hYJCYRSzAyo5cF9wEVTwp4gBcGEIi iHSXqtcbbmSdEz3zIeASsi+BhOPTI6/zGe1lvqt9IBe/f/d3ay+WiUipFs/Cp8Kt0lwn 4WiGUidUUsYVgt/1hs+HgtatitNvzbOMCitH7FfHKobsRa6sAX7ijmU4VJSSvUv9nzhR NZKXe95MIbl8TCYMMllgxfCQWLifApdIOHWmR3JdMlr2Q9kSyiSOq6f6hV+I2lvnZf+i fzQQ== 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=8ulq0yD0my4Otp65SkQZNLolrSXf+hFMzY6ErDKfcVE=; b=M8+z9JzfyJBf/iFWKL5kn7CPYIPeY1gYCcwaEIe/0lAZFPywhFYqIk5vFiGXlJFNsw J9GKlK3tkmQ05ZwIdmmCoKgqiEnkfILPNd4YS67ucu7CbFm1bSldMxHUR9dF1S2cw08q GCemyCeWO4nI+RfEe3MAoSlIirxrOpfoVoBIgsWdlBT1k4/d/zN3GMWpFrIDGDIYriVY WPqIRpo1unrLxnHlIbZtwo2sdVP63q8guvhd6hdHb3MQRYtCru/nkccoCDPAu+0k4PxM FdOVaEDgXD0+c75J+eYgg5oSksQhlipsObAYQhbYFhOkbaJ16K1SgCAZBiEPDEe0Zsqh RuDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=tXYwL7r4; 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 a11si3882972ejx.432.2020.11.12.08.02.33; Thu, 12 Nov 2020 08:03:05 -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=tXYwL7r4; 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 S1728678AbgKLP77 (ORCPT + 99 others); Thu, 12 Nov 2020 10:59:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728874AbgKLP63 (ORCPT ); Thu, 12 Nov 2020 10:58:29 -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 C7987C0613D1; Thu, 12 Nov 2020 07:58:28 -0800 (PST) Received: by mail-ed1-x542.google.com with SMTP id cq7so6862081edb.4; Thu, 12 Nov 2020 07:58:28 -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=8ulq0yD0my4Otp65SkQZNLolrSXf+hFMzY6ErDKfcVE=; b=tXYwL7r4So6bp1gZYXepAd5QTtB1eSBW87eG93DxuwN5Th2+/CdaXxfkLkc9B3KFvE Lv5SphrQiO7hOix6IRAedK0UqUQVExLke0Sm9Qg9zfitOvmqMlbNYWSsQObn8BqC1HwB uwpfOM4dIbDURFxWa/zqWkC1UN6BYlbm2+6uUn6yD0oiCWYliS7lPvXkwI7r7fT49osE l01tqqEEc2OvycQ6Jcmj5ctMimBrRMLe9bmC7C9prBdMmcgKX/cbwly0mC+gqETsoj2+ lp1BeKocgDOPGxqwq1MJIzAj+t/AeIppTH108ht+/zL/NVn81zslkWBvoOMAxp8wqevy WRcQ== 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=8ulq0yD0my4Otp65SkQZNLolrSXf+hFMzY6ErDKfcVE=; b=Av9JzkeRlm5pelMBXToDWV3gzMg+EHrfkMnzoMp7q/CA2ZKk5XzztxRUWjLwejFP+5 zlL0DXf5npDZYRrX1lwBg4s5uq2DQx/gD/6YfeyTIJpVNfSGH9i1GanUWSAbLCvJmjnA 3KPwzEjjUj/1Jy+xccyumxNrjPdiHLKy1u4qOvkfukthouV6xvlPVV4TNFEbEqblXvbd oe+QocvbUVZMYZWFDsqm70vDA6XN9/2EpPmsTAaq5g65DHXUzGSIPuxdfmD4zL6Vtu8J YDfiM+b4Emk3Hjdwe8skbpmybtDvPwq+5DeCQ4whld2tfqm4581xTdcO5Y+ZjiI3MWWB SGVA== X-Gm-Message-State: AOAM533Ie4RIhSGKGOGXyd3684dxCGpuC8pSi+SYgS0JYvjA53baR4+l +rh/lqcxPy8uw3Jwys/obUw= X-Received: by 2002:a50:e04d:: with SMTP id g13mr460895edl.72.1605196707482; Thu, 12 Nov 2020 07:58:27 -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.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Nov 2020 07:58:26 -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 , Marek Vasut , Oleksij Rempel Subject: [PATCH net-next 09/18] net: phy: nxp-tja11xx: implement generic .handle_interrupt() callback Date: Thu, 12 Nov 2020 17:55:04 +0200 Message-Id: <20201112155513.411604-10-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: Marek Vasut Cc: Oleksij Rempel Signed-off-by: Ioana Ciornei --- drivers/net/phy/nxp-tja11xx.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/net/phy/nxp-tja11xx.c b/drivers/net/phy/nxp-tja11xx.c index a72fa0d2e7c7..1c4c5c267fe6 100644 --- a/drivers/net/phy/nxp-tja11xx.c +++ b/drivers/net/phy/nxp-tja11xx.c @@ -44,6 +44,9 @@ #define MII_CFG2_SLEEP_REQUEST_TO_16MS 0x3 #define MII_INTSRC 21 +#define MII_INTSRC_LINK_FAIL BIT(10) +#define MII_INTSRC_LINK_UP BIT(9) +#define MII_INTSRC_MASK (MII_INTSRC_LINK_FAIL | MII_INTSRC_LINK_UP) #define MII_INTSRC_TEMP_ERR BIT(1) #define MII_INTSRC_UV_ERR BIT(3) @@ -604,6 +607,24 @@ static int tja11xx_config_intr(struct phy_device *phydev) return phy_write(phydev, MII_INTEN, value); } +static irqreturn_t tja11xx_handle_interrupt(struct phy_device *phydev) +{ + int irq_status; + + irq_status = phy_read(phydev, MII_INTSRC); + if (irq_status < 0) { + phy_error(phydev); + return IRQ_NONE; + } + + if (!(irq_status & MII_INTSRC_MASK)) + return IRQ_NONE; + + phy_trigger_machine(phydev); + + return IRQ_HANDLED; +} + static int tja11xx_cable_test_start(struct phy_device *phydev) { int ret; @@ -749,6 +770,7 @@ static struct phy_driver tja11xx_driver[] = { .get_stats = tja11xx_get_stats, .ack_interrupt = tja11xx_ack_interrupt, .config_intr = tja11xx_config_intr, + .handle_interrupt = tja11xx_handle_interrupt, .cable_test_start = tja11xx_cable_test_start, .cable_test_get_status = tja11xx_cable_test_get_status, }, { @@ -772,6 +794,7 @@ static struct phy_driver tja11xx_driver[] = { .get_stats = tja11xx_get_stats, .ack_interrupt = tja11xx_ack_interrupt, .config_intr = tja11xx_config_intr, + .handle_interrupt = tja11xx_handle_interrupt, .cable_test_start = tja11xx_cable_test_start, .cable_test_get_status = tja11xx_cable_test_get_status, } -- 2.28.0