Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp934604pxu; Mon, 23 Nov 2020 07:43:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJy9+3wHExAcAtZJ9spCMn7r9K/8RfO4KtvCjc+DSAK7owMRObXyTRM3FqNI7VIxzcWP8b4E X-Received: by 2002:aa7:dc49:: with SMTP id g9mr9272181edu.383.1606146183144; Mon, 23 Nov 2020 07:43:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606146183; cv=none; d=google.com; s=arc-20160816; b=lHi3t4nm/stwnopjw6/c5cdaj/LyP8b0/TBdvvhahN644LKEt7HKCBxaZl2kAKMClC 77WFIqjHoYL4D1pigyJFyBStorcDHScIaQL/CLeLIcJO9j1wKv2BxZi3u1Rp7/No3wUU 6O4Wtpgor/r1Z/UW4xmNpa8Y1drRNQOBpbsy2TXHmtSuymBWffo1cZgPOTPGR3daW+hR RHynY1fWKcUmz5+QatGfCEApn2E9TJ4NZK6MiPvqTyFyDr0M2DVPcS2BSpXfBdKtIsFG 5oVCnQGrCgIag8PEzRehYUCIztL19FC1ypjpwnHcVjLszOPpn2SYmtIRiuUsYhBFa9GS C3TQ== 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=+FeXibTuIgwGfVQRfzn1QNcdeuVRN4zL8aR37xT1P1E=; b=M3O//0R5nKVn9erdN6mUXEEwHVJmMwoohEhEq+Lf5WsJas7SDzelutWQ+nFL2H2bTy 82D1/ZUD37nkODjrR3eutfjOmqIsXCXGtQjffLOkCQ7SfEIzzFRV8cWp4CnTJiafrLLx +QjaGGsQxFiTdcSqSo1+RknHdhEMX4t7M5Cu/if3qBaGvyvEI2i4wzqVjiOTDD72M+Rg f9fV/LlV5fjWeLhPVoz7NGLFRf0W6E+sSbFD2Toj5El5PaHTLUXpu8+ZK4ienKQaDm/r tz+/66u0+svQbZeWbgy1rbDoBK6Hz3J2TDbKTqbLVKCP4UVMs+Ceh6zufJtEezXRa5lP uHYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=IurMSwYn; 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 zn8si5800542ejb.24.2020.11.23.07.42.39; Mon, 23 Nov 2020 07:43:03 -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=IurMSwYn; 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 S2389706AbgKWPjE (ORCPT + 99 others); Mon, 23 Nov 2020 10:39:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389649AbgKWPjC (ORCPT ); Mon, 23 Nov 2020 10:39:02 -0500 Received: from mail-ej1-x644.google.com (mail-ej1-x644.google.com [IPv6:2a00:1450:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D486C061A4D; Mon, 23 Nov 2020 07:39:02 -0800 (PST) Received: by mail-ej1-x644.google.com with SMTP id a16so23935599ejj.5; Mon, 23 Nov 2020 07:39:02 -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=+FeXibTuIgwGfVQRfzn1QNcdeuVRN4zL8aR37xT1P1E=; b=IurMSwYnPKLYb4Iqmtc/C5bWUGna4RmdWi5lMn3oj6+TZM4aoCTJOatM+LSEcqAfc5 5+OU7an60iO34LKtloCoKslhW4st8kvXA5OsUrxRUxWEA92gwFBymUS9GsdWaWW3Wgpm gvru1ESD0UGXOlOPSTK3IqIdLEAL4FJAQv+FFq/W9dk5p5VtDAkay8mm7NvL4ltDHTu5 Tp34i13xf5oxXL8PSikjD2EmuESLBqkfSBZCbcflL17LwLjTVAdzcMKdkpo3EPzYo6xn lI+9KhosO4mGrMrg1furqV/We6lxHj95syomMT2fGggoyFltUu9WORRsatht7Y7awke0 x1pw== 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=+FeXibTuIgwGfVQRfzn1QNcdeuVRN4zL8aR37xT1P1E=; b=cmnUDFsDJEA0ZZWRMmdFlYDKcrYKlV/DJFK4TBcK3UCSTgn9KHyEJAcZGVVOYufPFE SXUh5XpC2/ojiYOR5mPDXLCcZya2+8wBw9zluBhfc5kXNgBNYVITpVVUrFLZTP11+jHO iTDCwldoXvF2laTT5VfZ4J4Nx1d/d5gS0/0qWhXs5zmWmq64ohx/QatBtG0ON3IbEVLv j3cWkma/mmEi9u7aBtmT8tZR+V4sZ9RXxmlLMHsjgXJWOKb4U3X5l0bLc2+QP5r/BOW6 bkn9CmA/U+K6XO221XJ1pQ7UOJ5kuRHSLjIsScsmQGgplRMW4ZGj9DLNgCcS+WpoyZgp bnMg== X-Gm-Message-State: AOAM530/GlpvPZBXgweNDToVJ3aVt/UU9kFeY+4eShaaLK7yWuSA5JyD lOZftWNBWnsD2OnGv8DZqho= X-Received: by 2002:a17:906:f186:: with SMTP id gs6mr162629ejb.171.1606145940827; Mon, 23 Nov 2020 07:39:00 -0800 (PST) Received: from yoga-910.localhost ([188.25.2.177]) by smtp.gmail.com with ESMTPSA id c6sm4800126edy.62.2020.11.23.07.38.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Nov 2020 07:39:00 -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 Subject: [PATCH net-next 14/15] net: phy: qsemi: remove the use of .ack_interrupt() Date: Mon, 23 Nov 2020 17:38:16 +0200 Message-Id: <20201123153817.1616814-15-ciorneiioana@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201123153817.1616814-1-ciorneiioana@gmail.com> References: <20201123153817.1616814-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 preparation of removing the .ack_interrupt() callback, we must replace its occurrences (aka phy_clear_interrupt), from the 2 places where it is called from (phy_enable_interrupts and phy_disable_interrupts), with equivalent functionality. This means that clearing interrupts now becomes something that the PHY driver is responsible of doing, before enabling interrupts and after clearing them. Make this driver follow the new contract. Also, add a comment describing the multiple step interrupt acknoledgement process. Signed-off-by: Ioana Ciornei --- drivers/net/phy/qsemi.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/drivers/net/phy/qsemi.c b/drivers/net/phy/qsemi.c index 97f29ed2f0ca..d5c1aaa8236a 100644 --- a/drivers/net/phy/qsemi.c +++ b/drivers/net/phy/qsemi.c @@ -75,6 +75,10 @@ static int qs6612_ack_interrupt(struct phy_device *phydev) { int err; + /* The Interrupt Source register is not self-clearing, bits 4 and 5 are + * cleared when MII_BMSR is read and bits 1 and 3 are cleared when + * MII_EXPANSION is read + */ err = phy_read(phydev, MII_QS6612_ISR); if (err < 0) @@ -96,11 +100,22 @@ static int qs6612_ack_interrupt(struct phy_device *phydev) static int qs6612_config_intr(struct phy_device *phydev) { int err; - if (phydev->interrupts == PHY_INTERRUPT_ENABLED) + if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { + /* clear any interrupts before enabling them */ + err = qs6612_ack_interrupt(phydev); + if (err) + return err; + err = phy_write(phydev, MII_QS6612_IMR, MII_QS6612_IMR_INIT); - else + } else { err = phy_write(phydev, MII_QS6612_IMR, 0); + if (err) + return err; + + /* clear any leftover interrupts */ + err = qs6612_ack_interrupt(phydev); + } return err; @@ -133,7 +148,6 @@ static struct phy_driver qs6612_driver[] = { { .phy_id_mask = 0xfffffff0, /* PHY_BASIC_FEATURES */ .config_init = qs6612_config_init, - .ack_interrupt = qs6612_ack_interrupt, .config_intr = qs6612_config_intr, .handle_interrupt = qs6612_handle_interrupt, } }; -- 2.28.0