Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp463550pxb; Thu, 12 Nov 2020 08:04:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJwy+KBqDKBYOC7XHIguibl7zWNXAmR0AfV8ZxDgTPi/iFc3ZJdAm1+Z55/A3L/kkt3XsN8h X-Received: by 2002:a19:7b06:: with SMTP id w6mr12861481lfc.260.1605197048003; Thu, 12 Nov 2020 08:04:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605197047; cv=none; d=google.com; s=arc-20160816; b=mhz3q5VLTndvueIWS/UT67UJH+Jojz1PnLbPsmNdDQr+3wAifREgUc/U4PYJFVWZ0k B+AMg0yeBJ5faLJdXKG4wlC0IkknAxkt6IDXMI5p0rPWlB8zB2mIvoi1t1BVFy8OINzo KIjt0UXtyMwoJh7vDCxfJbIyxc6rzY7tCjcTG/LJpvSa4sVhUypqAvPtdJpItN+gYr0k vIFMPrglhDZfhLzOFTylbiOd29oKCmMvKLzUs5b1DWuP+N76XYkY8JTye6CzQUZimj8f Xxt+stT8H3hn+CjtzRs0kQ3Dtcl96s2bUhrbRa9z7FHIRwrfw4jJh1sJev2W7mDwiZzT IM9w== 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=7Dxgm0Fh4+mVDplG8D4f9NidT6Io7JYvUTeWlAV1zP4=; b=qZrnzR42loeiWDaJ82j4NKF8QB/Bf3/D4XPkHV9hHyI5j6eQEVz92biO2kwIFyYg6d QVlwyuI04jOE9NUL1dkynyCKEnz9eCReul2ZM+cZQjxAXTyiFdAfXSG03WnSwu0vMdIF qMkAgBK6tLn3rGICJ+1F3Ei7WKb6HNtHh+eyMUEPaP99ukm6jMeGT9T+Ndp8VtxNsNFN opaHvzH5Dpfy4BGAa2XcO+4db2HtmnyTqLExxDjfXjugfFmtXsqNJhCqu4W8poQdlfnw EMAEx93kTy9sFScm6xjkhkbtrceoSBqUxOqNLawiBIBXdWGI+tOpO5YuWUmYtz2fTuVW dlhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=pyg5GqOm; 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 a5si4275678edq.470.2020.11.12.08.03.38; Thu, 12 Nov 2020 08:04:07 -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=pyg5GqOm; 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 S1728451AbgKLQAk (ORCPT + 99 others); Thu, 12 Nov 2020 11:00:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728327AbgKLP6Y (ORCPT ); Thu, 12 Nov 2020 10:58:24 -0500 Received: from mail-ej1-x643.google.com (mail-ej1-x643.google.com [IPv6:2a00:1450:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7A55C0613D1; Thu, 12 Nov 2020 07:58:23 -0800 (PST) Received: by mail-ej1-x643.google.com with SMTP id f23so8617555ejk.2; Thu, 12 Nov 2020 07:58:23 -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=7Dxgm0Fh4+mVDplG8D4f9NidT6Io7JYvUTeWlAV1zP4=; b=pyg5GqOmz/eBt9TQplvpB5pKmtX108W5DQ98evVzlZGHIuOOPKz7MlLYU7ITibYDul cIsCs+t0/67siqpQptpTEeRaUUWmSQp9Z6W18I6OowJsnFAsJklx+KtNphB4jUZy41PM Uol+zk3x8GoDED559iX+nt0JqMfpEk8ZOBfYtlYxGWxMjOQKEDIqAZcxVWO0+6mI8PMa pBTTUbc0JNyrbpLhQwq7BJUeqKjWPFANBYEjf6+jsHE5SVB4Tuon2f8tL7Dq4Jmm5/6J XBsNas7qt4DJtHj6BYRfhDVvnGtTcDaihmtlyxzVKoIX1+ikHPsnAsMuaI75/MP21Uhw 4Q8g== 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=7Dxgm0Fh4+mVDplG8D4f9NidT6Io7JYvUTeWlAV1zP4=; b=oNkiI/8U3zz+aOj/V3EkgxSmIiWhQKn2gIuifaRkoFObwV/Zzm5JgVgfLYoJCjukeT 7+ejXqMMFh4+IItnL9pb4l2kCnOnQq0iXk/jXYs4gZtMZquz7pCdVU3aL9QxbO6Q8Eq/ bBXuouiBv6180nkd4e552+GrbMRxny6L+ISFpGveN33tLcB6Zkp57H6JvlMczXiMU/Yh rRmXf37Hip+Li6nkvYRPCsYLmAV98YednswOKrKebd4lVO+jdFzBqUhuQ/NYc+cMxm9E F0J8NnfBBMSvAOx3upT4JtV5rUqIPxbRkOAUUgNLyMGK4Xjty5QIR65HZ82XlNpnMvAU dAcA== X-Gm-Message-State: AOAM530pkbc6+3YZyiD3TCQGcykbQIW1m947GcGV0AX0nsycMnA8uKuF v/eA6W6ARy9re/wJMaSbjHs= X-Received: by 2002:a17:906:43c7:: with SMTP id j7mr29430502ejn.397.1605196702351; Thu, 12 Nov 2020 07:58:22 -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.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Nov 2020 07:58:21 -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 , Maxim Kochetkov , Baruch Siach , Robert Hancock Subject: [PATCH net-next 05/18] net: phy: marvell: implement generic .handle_interrupt() callback Date: Thu, 12 Nov 2020 17:55:00 +0200 Message-Id: <20201112155513.411604-6-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: Maxim Kochetkov Cc: Baruch Siach Cc: Robert Hancock Signed-off-by: Ioana Ciornei --- drivers/net/phy/marvell.c | 57 ++++++++++++++++++++++++--------------- 1 file changed, 36 insertions(+), 21 deletions(-) diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c index 2563526bf4a6..bb843b960436 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c @@ -327,6 +327,24 @@ static int marvell_config_intr(struct phy_device *phydev) return err; } +static irqreturn_t marvell_handle_interrupt(struct phy_device *phydev) +{ + int irq_status; + + irq_status = phy_read(phydev, MII_M1011_IEVENT); + if (irq_status < 0) { + phy_error(phydev); + return IRQ_NONE; + } + + if (!(irq_status & MII_M1011_IMASK_INIT)) + return IRQ_NONE; + + phy_trigger_machine(phydev); + + return IRQ_HANDLED; +} + static int marvell_set_polarity(struct phy_device *phydev, int polarity) { int reg; @@ -1659,18 +1677,6 @@ static int marvell_aneg_done(struct phy_device *phydev) return (retval < 0) ? retval : (retval & MII_M1011_PHY_STATUS_RESOLVED); } -static int m88e1121_did_interrupt(struct phy_device *phydev) -{ - int imask; - - imask = phy_read(phydev, MII_M1011_IEVENT); - - if (imask & MII_M1011_IMASK_INIT) - return 1; - - return 0; -} - static void m88e1318_get_wol(struct phy_device *phydev, struct ethtool_wolinfo *wol) { @@ -2699,6 +2705,7 @@ static struct phy_driver marvell_drivers[] = { .config_aneg = m88e1101_config_aneg, .ack_interrupt = marvell_ack_interrupt, .config_intr = marvell_config_intr, + .handle_interrupt = marvell_handle_interrupt, .resume = genphy_resume, .suspend = genphy_suspend, .read_page = marvell_read_page, @@ -2717,6 +2724,7 @@ static struct phy_driver marvell_drivers[] = { .config_aneg = marvell_config_aneg, .ack_interrupt = marvell_ack_interrupt, .config_intr = marvell_config_intr, + .handle_interrupt = marvell_handle_interrupt, .resume = genphy_resume, .suspend = genphy_suspend, .read_page = marvell_read_page, @@ -2738,6 +2746,7 @@ static struct phy_driver marvell_drivers[] = { .read_status = marvell_read_status, .ack_interrupt = marvell_ack_interrupt, .config_intr = marvell_config_intr, + .handle_interrupt = marvell_handle_interrupt, .resume = genphy_resume, .suspend = genphy_suspend, .read_page = marvell_read_page, @@ -2759,6 +2768,7 @@ static struct phy_driver marvell_drivers[] = { .read_status = marvell_read_status, .ack_interrupt = marvell_ack_interrupt, .config_intr = marvell_config_intr, + .handle_interrupt = marvell_handle_interrupt, .resume = genphy_resume, .suspend = genphy_suspend, .read_page = marvell_read_page, @@ -2779,6 +2789,7 @@ static struct phy_driver marvell_drivers[] = { .config_aneg = m88e1118_config_aneg, .ack_interrupt = marvell_ack_interrupt, .config_intr = marvell_config_intr, + .handle_interrupt = marvell_handle_interrupt, .resume = genphy_resume, .suspend = genphy_suspend, .read_page = marvell_read_page, @@ -2798,7 +2809,7 @@ static struct phy_driver marvell_drivers[] = { .read_status = marvell_read_status, .ack_interrupt = marvell_ack_interrupt, .config_intr = marvell_config_intr, - .did_interrupt = m88e1121_did_interrupt, + .handle_interrupt = marvell_handle_interrupt, .resume = genphy_resume, .suspend = genphy_suspend, .read_page = marvell_read_page, @@ -2820,7 +2831,7 @@ static struct phy_driver marvell_drivers[] = { .read_status = marvell_read_status, .ack_interrupt = marvell_ack_interrupt, .config_intr = marvell_config_intr, - .did_interrupt = m88e1121_did_interrupt, + .handle_interrupt = marvell_handle_interrupt, .get_wol = m88e1318_get_wol, .set_wol = m88e1318_set_wol, .resume = genphy_resume, @@ -2842,6 +2853,7 @@ static struct phy_driver marvell_drivers[] = { .read_status = genphy_read_status, .ack_interrupt = marvell_ack_interrupt, .config_intr = marvell_config_intr, + .handle_interrupt = marvell_handle_interrupt, .resume = genphy_resume, .suspend = genphy_suspend, .read_page = marvell_read_page, @@ -2862,6 +2874,7 @@ static struct phy_driver marvell_drivers[] = { .config_aneg = m88e1118_config_aneg, .ack_interrupt = marvell_ack_interrupt, .config_intr = marvell_config_intr, + .handle_interrupt = marvell_handle_interrupt, .resume = genphy_resume, .suspend = genphy_suspend, .read_page = marvell_read_page, @@ -2880,6 +2893,7 @@ static struct phy_driver marvell_drivers[] = { .config_aneg = marvell_config_aneg, .ack_interrupt = marvell_ack_interrupt, .config_intr = marvell_config_intr, + .handle_interrupt = marvell_handle_interrupt, .resume = genphy_resume, .suspend = genphy_suspend, .read_page = marvell_read_page, @@ -2897,6 +2911,7 @@ static struct phy_driver marvell_drivers[] = { .config_init = m88e1116r_config_init, .ack_interrupt = marvell_ack_interrupt, .config_intr = marvell_config_intr, + .handle_interrupt = marvell_handle_interrupt, .resume = genphy_resume, .suspend = genphy_suspend, .read_page = marvell_read_page, @@ -2919,7 +2934,7 @@ static struct phy_driver marvell_drivers[] = { .read_status = marvell_read_status, .ack_interrupt = marvell_ack_interrupt, .config_intr = marvell_config_intr, - .did_interrupt = m88e1121_did_interrupt, + .handle_interrupt = marvell_handle_interrupt, .get_wol = m88e1318_get_wol, .set_wol = m88e1318_set_wol, .resume = marvell_resume, @@ -2948,7 +2963,7 @@ static struct phy_driver marvell_drivers[] = { .read_status = marvell_read_status, .ack_interrupt = marvell_ack_interrupt, .config_intr = marvell_config_intr, - .did_interrupt = m88e1121_did_interrupt, + .handle_interrupt = marvell_handle_interrupt, .resume = genphy_resume, .suspend = genphy_suspend, .read_page = marvell_read_page, @@ -2974,7 +2989,7 @@ static struct phy_driver marvell_drivers[] = { .read_status = marvell_read_status, .ack_interrupt = marvell_ack_interrupt, .config_intr = marvell_config_intr, - .did_interrupt = m88e1121_did_interrupt, + .handle_interrupt = marvell_handle_interrupt, .resume = genphy_resume, .suspend = genphy_suspend, .read_page = marvell_read_page, @@ -2999,7 +3014,7 @@ static struct phy_driver marvell_drivers[] = { .read_status = marvell_read_status, .ack_interrupt = marvell_ack_interrupt, .config_intr = marvell_config_intr, - .did_interrupt = m88e1121_did_interrupt, + .handle_interrupt = marvell_handle_interrupt, .resume = genphy_resume, .suspend = genphy_suspend, .read_page = marvell_read_page, @@ -3020,7 +3035,7 @@ static struct phy_driver marvell_drivers[] = { .read_status = marvell_read_status, .ack_interrupt = marvell_ack_interrupt, .config_intr = marvell_config_intr, - .did_interrupt = m88e1121_did_interrupt, + .handle_interrupt = marvell_handle_interrupt, .resume = genphy_resume, .suspend = genphy_suspend, .read_page = marvell_read_page, @@ -3045,7 +3060,7 @@ static struct phy_driver marvell_drivers[] = { .read_status = marvell_read_status, .ack_interrupt = marvell_ack_interrupt, .config_intr = marvell_config_intr, - .did_interrupt = m88e1121_did_interrupt, + .handle_interrupt = marvell_handle_interrupt, .resume = genphy_resume, .suspend = genphy_suspend, .read_page = marvell_read_page, @@ -3067,7 +3082,7 @@ static struct phy_driver marvell_drivers[] = { .read_status = marvell_read_status, .ack_interrupt = marvell_ack_interrupt, .config_intr = marvell_config_intr, - .did_interrupt = m88e1121_did_interrupt, + .handle_interrupt = marvell_handle_interrupt, .resume = genphy_resume, .suspend = genphy_suspend, .read_page = marvell_read_page, -- 2.28.0