From patchwork Sun Feb 24 00:11:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 159141 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp496275jad; Sat, 23 Feb 2019 16:12:07 -0800 (PST) X-Google-Smtp-Source: AHgI3IadXrS0QBEK99tCVxnWzgMQVCN/Q0uBnox/NIV0vJN95FuAVNmKba2M3Rsdoa7x0B4jBGZL X-Received: by 2002:a63:d709:: with SMTP id d9mr6343527pgg.157.1550967127740; Sat, 23 Feb 2019 16:12:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550967127; cv=none; d=google.com; s=arc-20160816; b=Gk4AezRmfwI2cnyamk2WwCdgSj1ercBw3YEvNuTyQVu/xA8RjuyA80WuvPdXaS+l0K A7gxDNvkgdr+9QXN1kMBuMM/DhIEJQMasKKKYhUeL7PJfLPyLhBEwJFVxnMBD1Pg1YBC qqmUzve8drM6SqpM6ri3mD614TZppXoDsltc++lypN9rThzOVuUXj9V5V1VShQiWrB46 b2n10i1coBbUfCcu+u/DKfMyDXlZRJiP3wFdrqptRF4Bw6PIRCCIIDgth/8N3Zk/3AAy 7SFxHYxMcIUU+Z3zSjSQJe+sSAbKUAvrSrorDUAo3bBnYeDSNBpb48uzP8QcgIXXlgxg 6bhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=BaSm8/lD2XwheS4JXMeupFFlBb3aPQZmqQPqWkNsc5M=; b=Xo5D4Ef0o42pZ+hohUq2vuX9BxjI8igjynx8p1V3Ef/Bj6WzZoEGJPhLWPHKdHtb5O stthas72buVO+VtZ6Xax1HMbf17/SqB5xEBQvswJ+TGNQVkYxr8iiaToqN+c149n4CBz oVZXXeaf+7fmeNXhRtr+KoY2S3wrEknp7iSnwSthLwcD9Jy1LHbPpLNYTFZI/8+4rost wqjaDiG5acBC8UsPgHQOWI6vCycjpyN1RDnCaDMHhbXit+9+R5FTPwfgwbWVRvp4sHwE d+SjVckIW0ug3s7JE323BkWJf7jPDnci6drfwoLA+5FALef700jGaLgkmrv2YvEGD7q0 SV+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sIO5nZdZ; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r8si4807486pls.174.2019.02.23.16.12.07; Sat, 23 Feb 2019 16:12:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sIO5nZdZ; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728018AbfBXAMC (ORCPT + 10 others); Sat, 23 Feb 2019 19:12:02 -0500 Received: from mail-lj1-f194.google.com ([209.85.208.194]:42707 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727475AbfBXAMB (ORCPT ); Sat, 23 Feb 2019 19:12:01 -0500 Received: by mail-lj1-f194.google.com with SMTP id d14so4488118ljl.9 for ; Sat, 23 Feb 2019 16:12:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=BaSm8/lD2XwheS4JXMeupFFlBb3aPQZmqQPqWkNsc5M=; b=sIO5nZdZ2wV7lXxgWnw2iYy85ivv/IdnCWjxIYlGXD1as15yeRm3fakELookWkqDjx E8QkEbSGXVt2gI0IBEarX5XJZyjLWZXE0/IXa3Hg5G7HAcT9gil/Fvgdajdg+7IXAZrA 9su9qoBvMBhGaH6ir0ZqOPqInuPubHqZ8E+qTkw9XmCQn0y/IKgDNOL3N3VUfC5c7+bL 5Hqfr3oU2s4s7WCkM8foyJhfzqSyMG7XdwnNBam1OPD23oFrcNnZUdCAWPDslQB8RuV1 S4C/AHGuI2FlwZuCyVDtrMvaSSu6D7dS/CQM4MjTvdAeVsfKZEdj3lModFC+BJtPXYJC uDtQ== 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:mime-version :content-transfer-encoding; bh=BaSm8/lD2XwheS4JXMeupFFlBb3aPQZmqQPqWkNsc5M=; b=XCUgX9bd680MUzII0mihw9MOHhH0HVpYUHghAbZJ9L+NaVdmtBFmvYqfx9GhLvYhUO /UWbASZooe+t9qVQdh6cGK+jF2JkJ9p247IJw574MnIkKso7CM/qVv2vP1yyKGKTNei6 raVkMhm1qd8Bb/QYjOpTzgSHuWuRsewDx2v99Ru7gNU2EUxXYTJCdouugMQgCxjMhebX sHi6c5C5ZZdqIC0FAgeQu1cg4hvedgpnFp5jX9kS4/7YKHdC/TmQy2WERNp/CHvgF2zS MOGPNY4vdD+R9lBzHJ+oPj2Rb5W9ERnbii78X3ICrOj7AGv4fOixf2Comdb3ybYsRY2o eGLQ== X-Gm-Message-State: AHQUAua9yXAW3yLloKin7csyoduvrYcYf8c0TKZrrPgFD4oac96T7JHK BlcnKriy3nk6cTZwheCOHVyQOA== X-Received: by 2002:a2e:9b05:: with SMTP id u5mr6076606lji.144.1550967119827; Sat, 23 Feb 2019 16:11:59 -0800 (PST) Received: from localhost.bredbandsbolaget (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id i15sm1539297ljb.48.2019.02.23.16.11.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 23 Feb 2019 16:11:54 -0800 (PST) From: Linus Walleij To: Andrew Lunn , Florian Fainelli Cc: netdev@vger.kernel.org, Linus Walleij , Heiner Kallweit Subject: [PATCH v2] net: phy: realtek: Dummy IRQ calls for RTL8366RB Date: Sun, 24 Feb 2019 01:11:15 +0100 Message-Id: <20190224001115.17497-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This fixes a regression introduced by commit 0d2e778e38e0ddffab4bb2b0e9ed2ad5165c4bf7 "net: phy: replace PHY_HAS_INTERRUPT with a check for config_intr and ack_interrupt". This assumes that a PHY cannot trigger interrupt unless it has .config_intr() or .ack_interrupt() implemented. A later patch makes the code assume both need to be implemented for interrupts to be present. But this PHY (which is inside a DSA) will happily fire interrupts without either callback. Implement dummy callbacks for .config_intr() and .ack_interrupt() in the phy header to fix this. Tested on the RTL8366RB on D-Link DIR-685. Fixes: 0d2e778e38e0 ("net: phy: replace PHY_HAS_INTERRUPT with a check for config_intr and ack_interrupt") Cc: Heiner Kallweit Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Define generic inline helpers for genphy_no_ack_interrupt and genphy_no_config_intr - Add a comment block explaining how interrupts are unmasked and ACKed in the RTL8366RB internal irqchip so it is clear what is going on. --- drivers/net/phy/realtek.c | 7 +++++++ include/linux/phy.h | 8 ++++++++ 2 files changed, 15 insertions(+) -- 2.20.1 Reviewed-by: Andrew Lunn diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c index c6010fb1aa0f..cb4a23041a94 100644 --- a/drivers/net/phy/realtek.c +++ b/drivers/net/phy/realtek.c @@ -282,6 +282,13 @@ static struct phy_driver realtek_drvs[] = { .name = "RTL8366RB Gigabit Ethernet", .features = PHY_GBIT_FEATURES, .config_init = &rtl8366rb_config_init, + /* These interrupts are handled by the irq controller + * embedded inside the RTL8366RB, they get unmasked when the + * irq is requested and ACKed by reading the status register, + * which is done by the irqchip code. + */ + .ack_interrupt = genphy_no_ack_interrupt, + .config_intr = genphy_no_config_intr, .suspend = genphy_suspend, .resume = genphy_resume, }, diff --git a/include/linux/phy.h b/include/linux/phy.h index 127fcc9c3778..333b56d8f746 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -992,6 +992,14 @@ static inline int genphy_no_soft_reset(struct phy_device *phydev) { return 0; } +static inline int genphy_no_ack_interrupt(struct phy_device *phydev) +{ + return 0; +} +static inline int genphy_no_config_intr(struct phy_device *phydev) +{ + return 0; +} int genphy_read_mmd_unsupported(struct phy_device *phdev, int devad, u16 regnum); int genphy_write_mmd_unsupported(struct phy_device *phdev, int devnum,