From patchwork Sun Nov 5 23:19:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 117996 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp2167811qgn; Sun, 5 Nov 2017 15:23:17 -0800 (PST) X-Google-Smtp-Source: ABhQp+Sut5zdcrMbRZblxWkMPLbj8nmsKzpjNGPWVmwmo/pbGRPhppENGme7H/oe4sDO3DotRC3x X-Received: by 10.99.2.23 with SMTP id 23mr4421685pgc.99.1509924197401; Sun, 05 Nov 2017 15:23:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1509924197; cv=none; d=google.com; s=arc-20160816; b=Msoqxwl5Zfp3lggTqETOhrzOfl7Fd32QVKMuoz5AFGCEOJKOCzLcnUbJj431r5FMxA N1I8VvzJWlM+CegptvvaPrRZfojIwWZLJY7vm6I4p/NdqLzzXwd55QaPY1quMycG9h8j TMEBmQrmu89R6cD45AXZdhe9LQFGLdir/sBtLyT0CGaNlotCyl5hkHTF/LOF0KpdV6CX HY5J4dZ50h2NDKiXYNjC2QFD256nDUlSZHWprrOaQsTsUOXbAnVVSe1X0K7P5pEf0KG7 14tds8KcHV1R0Cqet6BTL0cLK4HXbUWpmIwyy3Vz+kiyJUjswocSGFEJ5xYzngdd/RxM 5OAw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=+3SXYDgAt6JyZImA1ko8S6XD62gGxD4I1/+xKF73i8o=; b=QOIUS+7Ov7jbOqQg4QFMOaM9cdPdl8+uJ1xzDo45ZLBWstp3QEJOK8xP4Mdlm3aP21 yP4dbv8YJ19jSpwukhZJx3Lky3jzzXK63P19BIODVUmYsJV/jePEQJJBWu+Nq7QT1yhV 328l2GfCR0fXVoFyJMcDDGmUu+PCRO8Hp2VmrpeD5Ea2EVm7hug6yQAtUdCvnv4Tby9V 322wAhN36jCGEJaXwd0LtC54bLq78cqUBmpZw8S6VSJ8oA+aA2McMGAftiuKjTKeGIng V5zu/b2719oVxr1Bn8FssSjI6QpK/M5DBluSoyWMVGYIfMIMgJFTdig2h9LLe8pUANSs qLbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Pg7hGzdq; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b2si9868323pgt.268.2017.11.05.15.23.17; Sun, 05 Nov 2017 15:23:17 -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=Pg7hGzdq; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750907AbdKEXXO (ORCPT + 7 others); Sun, 5 Nov 2017 18:23:14 -0500 Received: from mail-lf0-f66.google.com ([209.85.215.66]:45050 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750724AbdKEXXN (ORCPT ); Sun, 5 Nov 2017 18:23:13 -0500 Received: by mail-lf0-f66.google.com with SMTP id 75so8630805lfx.1 for ; Sun, 05 Nov 2017 15:23:12 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=+3SXYDgAt6JyZImA1ko8S6XD62gGxD4I1/+xKF73i8o=; b=Pg7hGzdqw9cqsoNg88V6bkSrAOQ8fBRbctosOMr9ygv+5Pilz62S5KzebaxYNcJI3d 3QVkmKLkahVr2M0l+gCjYjA2JBRfZFtqkdHndFdw17JGHpjBZidE87gXSRpScNAzNFo8 /dnYHaRefe/59DrvId0oNxL6AjmEI07EbhuLk= 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=+3SXYDgAt6JyZImA1ko8S6XD62gGxD4I1/+xKF73i8o=; b=Fdc2TtD9sjKigjypjqpcOCWypADO5NfFciQA7HKGknW9k1ew3GJZtMT5Wk6uWaluHo Vyc1bHmXQXOFOYueqm1bw2WQb1lrj19ZRrzH3l9TW4NGzO8uGD7Rs2SJsxbuPvCbfRWP OQvnRBx1O/bTAPEefeaUNGbJFskwk0kRi1YqWPxXHU5BuJ3+FZLf1PKK/1fBfrWXyCFs TlRIZLjLk6SEenfEhqNXp4wpX++sflRx+aUuHfu/Ke6gFt/2C3vmkmINqbfYvI3F6w/f D1vr7+WxbZ/24J7y6UQgF9e3rDPCFfbMTt8Kjypc0b6pj8f9406gphkWELFiN1DgmQWG Sg5w== X-Gm-Message-State: AJaThX6PUQzeXNCZ/UFtOcCvqBFeLN4DV14i3HIE5IF03Q/bInShUo90 p5/UoIx+v9Iz5ltru8oGvAnjeQ== X-Received: by 10.25.234.195 with SMTP id y64mr4602495lfi.36.1509924191832; Sun, 05 Nov 2017 15:23:11 -0800 (PST) Received: from localhost.localdomain (c-567171d5.014-348-6c756e10.cust.bredbandsbolaget.se. [213.113.113.86]) by smtp.gmail.com with ESMTPSA id v29sm2357845ljv.27.2017.11.05.15.23.10 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 05 Nov 2017 15:23:10 -0800 (PST) From: Linus Walleij To: Andrew Lunn , Vivien Didelot , Florian Fainelli Cc: netdev@vger.kernel.org, Linus Walleij , =?utf-8?b?QW50dGkgU2VwcMOkbMOk?= , Roman Yeryomin , Colin Leitner , Gabor Juhos Subject: [PATCH 1/4] RFC: net/dsa: Allow DSA PHYs to define link IRQs Date: Mon, 6 Nov 2017 00:19:06 +0100 Message-Id: <20171105231909.5599-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171105231909.5599-1-linus.walleij@linaro.org> References: <20171105231909.5599-1-linus.walleij@linaro.org> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org PHYs attached to DSAs may provide IRQs from GPIOs or other interrupt controllers in the device tree. For these cases, we need to go and grab the IRQ before registering the slave so the PHY core can grab and enable this IRQ. Cc: Antti Seppälä Cc: Roman Yeryomin Cc: Colin Leitner Cc: Gabor Juhos Cc: Florian Fainelli Signed-off-by: Linus Walleij --- net/dsa/slave.c | 8 ++++++++ 1 file changed, 8 insertions(+) -- 2.13.6 diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 2afa99506f8b..9909d7fe80b1 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -1119,6 +1120,13 @@ static int dsa_slave_phy_connect(struct dsa_slave_priv *p, return -ENODEV; } + /* + * If the PHY has a link IRQ associated with it in the device tree, + * then assign it so it can be claimed by the core. + */ + if (of_irq_count(p->dp->dn)) + p->phy->irq = irq_of_parse_and_map(p->dp->dn, 0); + /* Use already configured phy mode */ if (p->phy_interface == PHY_INTERFACE_MODE_NA) p->phy_interface = p->phy->interface;