From patchwork Tue Dec 11 19:33:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wunderlich X-Patchwork-Id: 10724579 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C194713BF for ; Tue, 11 Dec 2018 19:35:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B081A2ADA3 for ; Tue, 11 Dec 2018 19:35:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A49822B454; Tue, 11 Dec 2018 19:35:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3F1392ADA3 for ; Tue, 11 Dec 2018 19:35:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=og1AlZimzCk/UKh4hFKmRZdUNtL7HsaK/Aoe9HcAXOI=; b=RqH JVJ3hdWURmIyZWCdNVEA5Cja4WT7mISW20L92jiqHQGi/yquO4ckZ8J2CNB1xJ5KcZ0u0EZwYHczt dbP4lam/Il9ESjZpWjFvgizbAz/1Wi9cW2DeARyH/pDPG7P0IngFhWXRfDxVXqtNJF7z2NPFOe4uv YOR1I6lxmPqYF7U3rqd7RnwzW/DwpHMFnnxb1ZtnhEq3fUAvYFKVRxEfCTFyJzPyy+D/QfILdMFZ3 CQWh8DNUFs7EPIvFZUBpyvVW2GEWfmiIvXokr3f4VQ1OLAV4v88cRC7qp2uClcGhvi7VvnPmj+UJh K1WvbHZ+R37XwSIPQBfDDgUTgqzOHGg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gWnom-00038c-Uh; Tue, 11 Dec 2018 19:35:44 +0000 Received: from mout.gmx.net ([212.227.15.18]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gWnnG-0000RZ-VC; Tue, 11 Dec 2018 19:34:14 +0000 Received: from localhost.localdomain ([91.14.83.44]) by mail.gmx.com (mrgmx002 [212.227.17.190]) with ESMTPSA (Nemesis) id 0MVui8-1gv5yW0MwK-00X4CI; Tue, 11 Dec 2018 20:33:32 +0100 From: Frank Wunderlich To: Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S. Miller" , Matthias Brugger , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH 1/7] [DSA] adding fields for holding information about upstream-port Date: Tue, 11 Dec 2018 20:33:08 +0100 Message-Id: <20181211193314.10695-1-frank-w@public-files.de> X-Mailer: git-send-email 2.17.1 X-Provags-ID: V03:K1:6e4Tt0QPCv1129zyq1CTat5YbKXl3QuCfFVnI8ILsXDi2GCjTem y9EFJSDGzeyReuMagnPqrmKiAoMyiGYotXfr4phS/lZpwyoyIAUyBi4yPn933lGaJHi5f6F Gh/Wq+TeM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auqAWx2PTS X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181211_113411_295406_283C625F X-CRM114-Status: UNSURE ( 9.04 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Frank Wunderlich MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP based on https://github.com/openwrt/openwrt/blob/master/target/linux/mediatek/patches-4.14/0033-dsa-multi-cpu.patch Signed-off-by: Frank Wunderlich --- include/net/dsa.h | 4 ++++ net/dsa/dsa_priv.h | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/include/net/dsa.h b/include/net/dsa.h index 23690c44e167..3efa81e08993 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h @@ -203,6 +203,10 @@ struct dsa_port { struct net_device *bridge_dev; struct devlink_port devlink_port; struct phylink *pl; + + struct net_device *ethernet; + int upstream; + /* * Original copy of the master netdev ethtool_ops */ diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h index 9e4fd04ab53c..cc0cd7675117 100644 --- a/net/dsa/dsa_priv.h +++ b/net/dsa/dsa_priv.h @@ -81,6 +81,8 @@ struct dsa_slave_priv { /* TC context */ struct list_head mall_tc_list; + + struct net_device *master; }; /* dsa.c */ @@ -188,7 +190,10 @@ static inline struct net_device * dsa_slave_to_master(const struct net_device *dev) { struct dsa_port *dp = dsa_slave_to_port(dev); + struct dsa_slave_priv *p = netdev_priv(dev); + if (p->master) + return p->master; return dp->cpu_dp->master; } From patchwork Tue Dec 11 19:33:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wunderlich X-Patchwork-Id: 10724581 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7E3B013BF for ; Tue, 11 Dec 2018 19:36:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6E2192B41F for ; Tue, 11 Dec 2018 19:36:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 62A2F2B463; Tue, 11 Dec 2018 19:36:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CFD362B41F for ; Tue, 11 Dec 2018 19:36:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=uiYIecX2SYf9yNzQo+6HyoyM9rf5DXpQ5jOQAWGE2EM=; b=jSiLgVp0FU3pyO5eRDk3qL2420 3NpKwWTtmnYz7nuw/+TOtq6j8QuC9mypt6F1rIUND2vKSg2B+N97ojQtswIzxrvgGPExUKwe3zsYK jyR2+uFAtsM62IA/cOwWpbAmFJYwxdjfrmH0RUj7Rw3LI+zWJ60jm+8sNy3WPRgcuZovjFvua3vJH G2JIHWWmxWzERQUlxyCMf93r20v8Uh74H/BN5EWqvMcsCXO67/qS6vti6dGAPlCau8xD0uXkxUUoX ZsWi/A5qPfF1fvwZ02T9U7VNiMAL1Ca/e9sI+RVSCVBcpPUwGF12LU/nLxmyxp52esnWy7hBo/Cw3 aNGdFcNA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gWnp5-0003QC-IM; Tue, 11 Dec 2018 19:36:03 +0000 Received: from mout.gmx.net ([212.227.15.19]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gWnnH-0000Rc-5J; Tue, 11 Dec 2018 19:34:14 +0000 Received: from localhost.localdomain ([91.14.83.44]) by mail.gmx.com (mrgmx002 [212.227.17.190]) with ESMTPSA (Nemesis) id 0MWBpJ-1gvMxT2drN-00XLBD; Tue, 11 Dec 2018 20:33:34 +0100 From: Frank Wunderlich To: Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S. Miller" , Matthias Brugger , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH 2/7] [DSA] add helper functions Date: Tue, 11 Dec 2018 20:33:09 +0100 Message-Id: <20181211193314.10695-2-frank-w@public-files.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181211193314.10695-1-frank-w@public-files.de> References: <20181211193314.10695-1-frank-w@public-files.de> X-Provags-ID: V03:K1:Q/my6UytJVxyZLtJc7lh5FOPR8E+ADY9dIGQJ6QokjLi/F4DiGf 6YXNBT8dwo2tASrHjKJ0CTlhZxNHf+mRzlED69h8/IjldXLg78KujPVtRfkiIgE5cPO2YnY M6iUHKu8Vw4yPN3RNfZg3QUEn3L7HvZSS/wJnhnux4ROIWF/tE93C1preTXR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TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181211_113411_498688_892089D2 X-CRM114-Status: GOOD ( 10.51 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Frank Wunderlich MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP based on https://github.com/openwrt/openwrt/blob/master/target/linux/mediatek/patches-4.14/0033-dsa-multi-cpu.patch Signed-off-by: Frank Wunderlich --- include/net/dsa.h | 18 ++++++++++++++++++ net/dsa/dsa2.c | 18 ++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/include/net/dsa.h b/include/net/dsa.h index 3efa81e08993..612942ac56de 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h @@ -319,6 +319,12 @@ static inline unsigned int dsa_towards_port(struct dsa_switch *ds, int device, return ds->rtable[device]; } + +static inline bool dsa_is_upstream_port(struct dsa_switch *ds, int p) +{ + return dsa_is_cpu_port(ds, p) || dsa_is_dsa_port(ds, p); +} + /* Return the local port used to reach the dedicated CPU port */ static inline unsigned int dsa_upstream_port(struct dsa_switch *ds, int port) { @@ -331,6 +337,18 @@ static inline unsigned int dsa_upstream_port(struct dsa_switch *ds, int port) return dsa_towards_port(ds, cpu_dp->ds->index, cpu_dp->index); } +static inline u8 dsa_port_upstream_port(struct dsa_switch *ds, int port) +{ + /* + * If this port has a specific upstream cpu port, use it, + * otherwise use the switch default. + */ + if (ds->ports[port].upstream) + return ds->ports[port].upstream; + else + return dsa_upstream_port(ds, port); +} + typedef int dsa_fdb_dump_cb_t(const unsigned char *addr, u16 vid, bool is_static, void *data); struct dsa_switch_ops { diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c index a1917025e155..77420675e9ed 100644 --- a/net/dsa/dsa2.c +++ b/net/dsa/dsa2.c @@ -255,6 +255,24 @@ static void dsa_tree_teardown_default_cpu(struct dsa_switch_tree *dst) dst->cpu_dp = NULL; } +static int dsa_user_parse(struct dsa_port *port, u32 index, + struct dsa_switch *ds) +{ + struct device_node *cpu_port; + const unsigned int *cpu_port_reg; + int cpu_port_index; + + cpu_port = of_parse_phandle(port->dn, "cpu", 0); + if (cpu_port) { + cpu_port_reg = of_get_property(cpu_port, "reg", NULL); + if (!cpu_port_reg) + return -EINVAL; + cpu_port_index = be32_to_cpup(cpu_port_reg); + ds->ports[index].upstream = cpu_port_index; + } + return 0; +} + static int dsa_port_setup(struct dsa_port *dp) { struct dsa_switch *ds = dp->ds; From patchwork Tue Dec 11 19:33:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wunderlich X-Patchwork-Id: 10724575 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6AE6A15A6 for ; Tue, 11 Dec 2018 19:35:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5AD582ADA3 for ; Tue, 11 Dec 2018 19:35:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4F1222B454; Tue, 11 Dec 2018 19:35:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C5FB42ADA3 for ; Tue, 11 Dec 2018 19:35:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=U+/EAFEn1IFwc6hTGp6NeEAMsYy2OpQ5bpv33OL7sOI=; b=rwINBUrgrpqjxyERP/nAxUf2X7 XMsJ1y4N2km5A8/L2O4k16Uc0Qkp89KcOwJ3y0MAXE4LSFf5AvpGqKDJAZZmozXoLF4a8zP6jnmkB nLpfHU6Au13euVLXuZk9U64Kxh9AyWi2MWaBkIxifowUuRABvQWT5jRdo2w7+/BawsB7mQT9sPsbe 3AT74sQjqz/sjzFRmpBVGvQ49HAUKLZgJ0Co25dwlixgiyVXaeVGK94OUE2+LVsfimD9imBKVoNXW wcE4A51PrpBAz4XJzv2eRv6h+mKNjHSt4vnB2lUNHC9mV2vN+JSIvXVV5hE5HonR5jgzT6LQg3IEO 0ZwIgHtA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gWnoM-0002F8-BP; Tue, 11 Dec 2018 19:35:18 +0000 Received: from mout.gmx.net ([212.227.15.15]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gWnnG-0000RW-9Q; Tue, 11 Dec 2018 19:34:14 +0000 Received: from localhost.localdomain ([91.14.83.44]) by mail.gmx.com (mrgmx002 [212.227.17.190]) with ESMTPSA (Nemesis) id 0LsCdj-1hamJM3fcl-013wyj; Tue, 11 Dec 2018 20:33:36 +0100 From: Frank Wunderlich To: Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S. Miller" , Matthias Brugger , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH 3/7] [DSA] adding handling of second CPU-Port Date: Tue, 11 Dec 2018 20:33:10 +0100 Message-Id: <20181211193314.10695-3-frank-w@public-files.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181211193314.10695-1-frank-w@public-files.de> References: <20181211193314.10695-1-frank-w@public-files.de> X-Provags-ID: V03:K1:uULslvaJwqYnz381Koxpp6SKyzdTC4qeUILpCFIU4cdT8rKSU56 iv/wHJ6crRXZ/tTwcyFwxGkf8fi9XMcpX08h7hsiMoaUzBNf7gG7URiKAKS6pIHeEmAZxSz CofnXo9NEkz0YCFB2C/LjRBv0M2+OZcSVf3kLjI9C37axiUhtijlR/0RUzG7/3fSEEQPrEx xYxLjEitSJkFVYBU+lxEQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:ek4UThKCdyQ=:meMDkmieU45Eup87jixZrk FYAlrUIMSYNp119ik5EV9+s1Gwx84nXo9SrCSG/G9Q9tGzOYTcnPCD1nEtEwOvA+MT7J8ovUH N1dYWMa5MW5o+aLpH7GT6R7yxgZg6ftYUWfv48ORI1UtQtWHKi63h8nV1fflVEoZ4Y1ietwWK o3liUs8DoqiHDoZ+EbwiAamJd76Q6TH9unSf4zEBIO6WjOaMh0IVRqHfZvvqmBOgNiNJbYFx2 Y9ZuI0cpr91mDEI2wDT5KYUxXEMCZ03sst6vbFpwIzVd1xCGmDW1h6/uHvwRUj1OUryZpcTbC C+FzVbkOxGXeRolng7+NXaPENhol7G5UH3nQ2qtZEWb0j1T7foHhR/ogTwMQm7OVks4VrEvug r7kXkbC6bAkxyEB19BuMjvFynCzdTlLxDKI4Nyj2EvSMWcojIw4d6rBcHcljyzmDWxL23M/sZ wZXFqelrqY6EojZYjGTkOtHZkFauTYL8ON35nh5gRQ0UBpkY5JEo97Vs42likl4BBrJJEatB5 490LOV0zCLrx41XUsLsEu3IfpE08uCS9KeU6HrvPm690T1QU0mtV7I0awh270y1l+0Sp8mL8D UW3x7SDhXulGHYFaE9ReabvE0XqtEY4FCCn6y7fNnn1vjozFrQC9ULYW84EtLnhqWa6Sr3M9s U/0ntKQ3k8aBA6cvVJ1IRaGkw/59pBu2s4+QYHEYDPLMIfwZhVpFb0mDg7jyRQG/Xfn2zOri7 yGVWEtb7s1feRfgRr8Bx/hqO//1ahvWV061/RT4ZrgXjLKdF2vI5GBucoflPZemLdxyf5VND1 qyAGRokZOZCmj4X+H2S2unEuuJj63lp4nlRBVE/6SdWQTuwmQygC/CIIZIQsao5hXfyUa+H9v wQlr6P82Lp0x+uKB3hLdaKu3/5rJWj3as7MTThsmBTU0jMOFK6+S+C5M14F+4/ X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181211_113410_687399_B7A48729 X-CRM114-Status: GOOD ( 12.01 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Frank Wunderlich MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP based on https://github.com/openwrt/openwrt/blob/master/target/linux/mediatek/patches-4.14/0033-dsa-multi-cpu.patch Signed-off-by: Frank Wunderlich --- net/dsa/dsa2.c | 18 ++++++++++++++++++ net/dsa/slave.c | 3 ++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c index 77420675e9ed..4a6ebfe647f0 100644 --- a/net/dsa/dsa2.c +++ b/net/dsa/dsa2.c @@ -303,6 +303,8 @@ static int dsa_port_setup(struct dsa_port *dp) ds->index, dp->index); return err; } + if (dp->master) + dp->master->dsa_ptr = dp; break; case DSA_PORT_TYPE_DSA: /* dp->index is used now as port_number. However @@ -323,12 +325,17 @@ static int dsa_port_setup(struct dsa_port *dp) devlink_port_attrs_set(&dp->devlink_port, DEVLINK_PORT_FLAVOUR_PHYSICAL, dp->index, false, 0); + err = dsa_user_parse(dp, dp->index, ds); + if (err) + return err; + err = dsa_slave_create(dp); if (err) dev_err(ds->dev, "failed to create slave for port %d.%d\n", ds->index, dp->index); else devlink_port_type_eth_set(&dp->devlink_port, dp->slave); + break; } @@ -344,6 +351,14 @@ static void dsa_port_teardown(struct dsa_port *dp) case DSA_PORT_TYPE_UNUSED: break; case DSA_PORT_TYPE_CPU: + dsa_port_link_unregister_of(dp); + if (dp->master) + dp->master->dsa_ptr = NULL; + if (dp->ethernet) { + dev_put(dp->ethernet); + dp->ethernet = NULL; + } + break; case DSA_PORT_TYPE_DSA: dsa_port_link_unregister_of(dp); break; @@ -598,6 +613,9 @@ static int dsa_port_parse_cpu(struct dsa_port *dp, struct net_device *master) dp->master = master; dp->dst = dst; + dev_hold(master); + ds->ports[dp->index].ethernet = master; + return 0; } diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 7d0c19e7edcf..f0fdb9e5d05f 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -1312,11 +1312,11 @@ static void dsa_slave_notify(struct net_device *dev, unsigned long val) int dsa_slave_create(struct dsa_port *port) { const struct dsa_port *cpu_dp = port->cpu_dp; - struct net_device *master = cpu_dp->master; struct dsa_switch *ds = port->ds; const char *name = port->name; struct net_device *slave_dev; struct dsa_slave_priv *p; + struct net_device *master = ds->ports[port->upstream].ethernet; int ret; if (!ds->num_tx_queues) @@ -1355,6 +1355,7 @@ int dsa_slave_create(struct dsa_port *port) p->dp = port; INIT_LIST_HEAD(&p->mall_tc_list); p->xmit = cpu_dp->tag_ops->xmit; + p->master = master; port->slave = slave_dev; netif_carrier_off(slave_dev); From patchwork Tue Dec 11 19:33:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wunderlich X-Patchwork-Id: 10724561 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5BF3015A6 for ; Tue, 11 Dec 2018 19:34:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4BF122ADA3 for ; Tue, 11 Dec 2018 19:34:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3F4822B454; Tue, 11 Dec 2018 19:34:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 95C682ADA3 for ; Tue, 11 Dec 2018 19:34:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=K3KLg3eKRrK8dkmDC4RCHhQb4q/QaALFR5L+7YaCf0g=; b=kYrdA5nfY/7fGZbac89uf8WIcL QvSBUAD/pL+hx+/hNqlbJvpTl0Jy7PimzJBhj4Mrqakl1H4TDJKP6TgDdSCwbVJXJgsT+K/2lkAuH NXxDW8RiM72leMkZMOcWzsqGzW5LEX8MXsTzvsQWEznsVPLJVO04X1F7l50KZyX459mOpLYrdIKeO LP+282GvLEA32rLiGRpF7oIRVagkqHu6K0s3qfgXSefTyH/Da6JeSW38p65TO+VdSgZwsOAyO2lGd DEpb+GPsHteqVbkfqJa0x8uI9aXpW98Kxxl/h6f7AI2ARKr+l2Buak0715Irs2Wqmrc3j6/8Xaata +FQq55ag==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gWnnX-0000hm-29; Tue, 11 Dec 2018 19:34:27 +0000 Received: from mout.gmx.net ([212.227.15.15]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gWnnG-0000RV-9W; Tue, 11 Dec 2018 19:34:12 +0000 Received: from localhost.localdomain ([91.14.83.44]) by mail.gmx.com (mrgmx002 [212.227.17.190]) with ESMTPSA (Nemesis) id 0M08ia-1hR7Ou3at2-00uML8; Tue, 11 Dec 2018 20:33:36 +0100 From: Frank Wunderlich To: Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S. Miller" , Matthias Brugger , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH 4/7] [DSA] add support for GMAC2 wired to ext Date: Tue, 11 Dec 2018 20:33:11 +0100 Message-Id: <20181211193314.10695-4-frank-w@public-files.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181211193314.10695-1-frank-w@public-files.de> References: <20181211193314.10695-1-frank-w@public-files.de> X-Provags-ID: V03:K1:mNf+lMJ6ZYyVAuGoQxrUK+NE4jg2KXrE9YW3eDBUMs0VsSBu+ru 7NDUQwiFjxltR9n9InSwmxnPcc7OSowC2jtwrHOCn9ePD39GW2JO19SEeC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VwXh/TNQ72GkM40PR9LLyjjrAkzpn5GbMqZTZ5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181211_113410_695537_D9DD135B X-CRM114-Status: UNSURE ( 8.06 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Frank Wunderlich MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP based on https://github.com/openwrt/openwrt/blob/master/target/linux/mediatek/patches-4.14/0032-net-dsa-mediatek-add-support-for-GMAC2-wired-to-ext-.patch Signed-off-by: Frank Wunderlich --- drivers/net/dsa/mt7530.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index a5de9bffe5be..a6a15a063e3e 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -1277,6 +1277,11 @@ mt7530_setup(struct dsa_switch *ds) val = mt7530_read(priv, MT7530_MHWTRAP); val &= ~MHWTRAP_P6_DIS & ~MHWTRAP_PHY_ACCESS; val |= MHWTRAP_MANUAL; + if (!dsa_is_cpu_port(ds, 5)) { + val |= MHWTRAP_P5_DIS; + val |= MHWTRAP_P5_MAC_SEL; + val |= MHWTRAP_P5_RGMII_MODE; + } mt7530_write(priv, MT7530_MHWTRAP, val); /* Enable and reset MIB counters */ From patchwork Tue Dec 11 19:33:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wunderlich X-Patchwork-Id: 10724573 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 08BC513BF for ; Tue, 11 Dec 2018 19:35:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EC9112ADA3 for ; Tue, 11 Dec 2018 19:35:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E08C32B454; Tue, 11 Dec 2018 19:35:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5B3F22ADA3 for ; Tue, 11 Dec 2018 19:35:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=s9bMc5Id2QOC3oK/V2fhJNyv0jWxL1DV0mHOPiu6lWQ=; b=c/DiSSfKlwSGrU3LPGDsNziRSY ZfKnFyoBA7Bvb2AvEJlU98sJlNT7ZN8qEAs4OKQpOcYN2WTHIQF0q7GiR8sCT+d4xXhyjBprSmQwv uU8S14qRIlfr3Ea1/9dpxhx25mUB7cDr2cT3lp+yEQWevYAZhlhdjBjSF1Q2T72gd/mXcA09BloCY CPod7eXAWDuKmsxE/fOHGQNuOZUgYedwlFzeBndEZ9Vil9lgIR9uL/ENT5g3sx88u/HsWmu9bwMXU KLO2aUKKSBUVdxdt4FR2vl5Llgvyv1hzAt/nu65rrHHuu4Wh2z5MQr/Gbqimc0YcSBWQdq9ShxnmA DYvzUIOQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gWno8-0001Ir-AR; Tue, 11 Dec 2018 19:35:04 +0000 Received: from mout.gmx.net ([212.227.15.19]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gWnnH-0000Rb-5K; Tue, 11 Dec 2018 19:34:14 +0000 Received: from localhost.localdomain ([91.14.83.44]) by mail.gmx.com (mrgmx002 [212.227.17.190]) with ESMTPSA (Nemesis) id 0MIMQR-1gawO50CBr-004BML; Tue, 11 Dec 2018 20:33:38 +0100 From: Frank Wunderlich To: Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S. Miller" , Matthias Brugger , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH 5/7] [DSA] dsa multi cpu (mt7530.c) Date: Tue, 11 Dec 2018 20:33:12 +0100 Message-Id: <20181211193314.10695-5-frank-w@public-files.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181211193314.10695-1-frank-w@public-files.de> References: <20181211193314.10695-1-frank-w@public-files.de> X-Provags-ID: V03:K1:5uvOk/q14HGD/2jzna7B3U2QGMeJRss93L6l5tAEsPqt/qo3/Hw t7VaXEHRIIA7NMGwrxTwhiX8YWXtwfc11WQHdBJ1SWuQqRvy5JKjYFxEgWMT2HoVlUUIT6C PCumzkRhSKMVPZOCsVVLgByZK/mcQb5qnDR0S5uAQV7A29uuY5YeCgJ4lSfy9ZgCcEVclLy buWSmwu++8+erchKPNfCQ== X-UI-Out-Filterresults: notjunk:1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X-CRM114-Status: GOOD ( 12.30 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Frank Wunderlich MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP based on https://github.com/openwrt/openwrt/blob/master/target/linux/mediatek/patches-4.14/0033-dsa-multi-cpu.patch Signed-off-by: Frank Wunderlich --- drivers/net/dsa/mt7530.c | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index a6a15a063e3e..441320d4d779 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -674,6 +674,9 @@ static int mt7530_cpu_port_enable(struct mt7530_priv *priv, int port) { + u8 port_mask = 0; + int i; + /* Enable Mediatek header mode on the cpu port */ mt7530_write(priv, MT7530_PVC_P(port), PORT_SPEC_TAG); @@ -690,8 +693,14 @@ mt7530_cpu_port_enable(struct mt7530_priv *priv, /* CPU port gets connected to all user ports of * the switch */ + + for (i = 0; i < MT7530_NUM_PORTS; i++) + if ((priv->ds->ports[port].type == DSA_PORT_TYPE_USER) && + (dsa_port_upstream_port(priv->ds, i) == port)) + port_mask |= BIT(i); + mt7530_write(priv, MT7530_PCR_P(port), - PCR_MATRIX(dsa_user_ports(priv->ds))); + PCR_MATRIX(port_mask)); return 0; } @@ -701,6 +710,7 @@ mt7530_port_enable(struct dsa_switch *ds, int port, struct phy_device *phy) { struct mt7530_priv *priv = ds->priv; + u8 upstream = dsa_port_upstream_port(ds, port); mutex_lock(&priv->reg_mutex); @@ -711,7 +721,7 @@ mt7530_port_enable(struct dsa_switch *ds, int port, * restore the port matrix if the port is the member of a certain * bridge. */ - priv->ports[port].pm |= PCR_MATRIX(BIT(MT7530_CPU_PORT)); + priv->ports[port].pm |= PCR_MATRIX(BIT(upstream)); priv->ports[port].enable = true; mt7530_rmw(priv, MT7530_PCR_P(port), PCR_MATRIX_MASK, priv->ports[port].pm); @@ -774,7 +784,8 @@ mt7530_port_bridge_join(struct dsa_switch *ds, int port, struct net_device *bridge) { struct mt7530_priv *priv = ds->priv; - u32 port_bitmap = BIT(MT7530_CPU_PORT); + u8 upstream = dsa_port_upstream_port(ds, port); + u32 port_bitmap = BIT(upstream); int i; mutex_lock(&priv->reg_mutex); @@ -875,6 +886,7 @@ mt7530_port_bridge_leave(struct dsa_switch *ds, int port, struct net_device *bridge) { struct mt7530_priv *priv = ds->priv; + u8 upstream = dsa_port_upstream_port(ds, port); int i; mutex_lock(&priv->reg_mutex); @@ -902,8 +914,8 @@ mt7530_port_bridge_leave(struct dsa_switch *ds, int port, */ if (priv->ports[port].enable) mt7530_rmw(priv, MT7530_PCR_P(port), PCR_MATRIX_MASK, - PCR_MATRIX(BIT(MT7530_CPU_PORT))); - priv->ports[port].pm = PCR_MATRIX(BIT(MT7530_CPU_PORT)); + PCR_MATRIX(BIT(upstream))); + priv->ports[port].pm = PCR_MATRIX(BIT(upstream)); mt7530_port_set_vlan_unaware(ds, port); @@ -1194,15 +1206,7 @@ mt7530_port_vlan_del(struct dsa_switch *ds, int port, static enum dsa_tag_protocol mtk_get_tag_protocol(struct dsa_switch *ds, int port) { - struct mt7530_priv *priv = ds->priv; - - if (port != MT7530_CPU_PORT) { - dev_warn(priv->dev, - "port not matched with tagging CPU port\n"); - return DSA_TAG_PROTO_NONE; - } else { - return DSA_TAG_PROTO_MTK; - } + return DSA_TAG_PROTO_MTK; } static int @@ -1275,7 +1279,7 @@ mt7530_setup(struct dsa_switch *ds) /* Enable Port 6 only; P5 as GMAC5 which currently is not supported */ val = mt7530_read(priv, MT7530_MHWTRAP); - val &= ~MHWTRAP_P6_DIS & ~MHWTRAP_PHY_ACCESS; + val &= ~MHWTRAP_P5_DIS & ~MHWTRAP_P6_DIS & ~MHWTRAP_PHY_ACCESS; val |= MHWTRAP_MANUAL; if (!dsa_is_cpu_port(ds, 5)) { val |= MHWTRAP_P5_DIS; From patchwork Tue Dec 11 19:33:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wunderlich X-Patchwork-Id: 10724577 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 777A613BF for ; Tue, 11 Dec 2018 19:35:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 684382ADA3 for ; Tue, 11 Dec 2018 19:35:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5C5BC2B454; Tue, 11 Dec 2018 19:35:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id EC6912ADA3 for ; Tue, 11 Dec 2018 19:35:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=7TiP5xNkvoEq6eXdC9AILawAmzyOnydeAnFB29RNAMU=; b=NVGkyc6+Qbh8NdVVEucxCByc0z 2pWrOL0eXCGkinbgigr5zdS6pnvYUbgnkJBBxTsDAQ3vdeGyHBMDrrdJWSLOhM2Cah7OR8pa0PGuP v6jDwOxyh0Sc2tLJREwbddYzO21+YaB43UeFmU+L0EcrGEionVJUlef/g/0Ckq32cux3IKtKk5rv9 LEV9c4z18pGn9GMdP7a1QU0/mwZDM1QibeyosSOfNcYaWKau0+pbCCVylQ9TIz+T4hKa9BPSjRd0O j6FaBH65TEffBcwCEdNjamVnYHCOgEJxc47xT6k7/m/OgiY4QBepBvvQsB2pwhjdwomi05rsqWJlY Zn9czhUA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gWnob-0002xT-Ew; Tue, 11 Dec 2018 19:35:33 +0000 Received: from mout.gmx.net ([212.227.15.18]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gWnnG-0000Ra-Sb; Tue, 11 Dec 2018 19:34:14 +0000 Received: from localhost.localdomain ([91.14.83.44]) by mail.gmx.com (mrgmx002 [212.227.17.190]) with ESMTPSA (Nemesis) id 0M54fe-1hNFmP0NIc-00zIHc; Tue, 11 Dec 2018 20:33:39 +0100 From: Frank Wunderlich To: Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S. Miller" , Matthias Brugger , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH 6/7] [DSA] tell GDMA when we are turning on the special tag Date: Tue, 11 Dec 2018 20:33:13 +0100 Message-Id: <20181211193314.10695-6-frank-w@public-files.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181211193314.10695-1-frank-w@public-files.de> References: <20181211193314.10695-1-frank-w@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0G5WrfyB9xr+boHBzVqWZN1hAjhsUdo0jixJqigCW w8nWL6CTh4Kal4+vTX4ojDozl5WDtejsCgblaZzWkHBGv2hra+95Wf6lBQw6GOOGciWfGv85v U1JVf8V4RIc0+n9nGv0t8ikqKEh0pOAnZd+ND5Md0FsEDw+lMMkW5YnKB7IZAx X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181211_113411_218482_4969AB10 X-CRM114-Status: UNSURE ( 9.01 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Frank Wunderlich MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP based on https://github.com/openwrt/openwrt/blob/master/target/linux/mediatek/patches-4.14/0044-net-next-dsa-mediatek-tell-GDMA-when-we-are-turning-.patch Signed-off-by: Frank Wunderlich --- drivers/net/dsa/mt7530.c | 6 ++++++ drivers/net/dsa/mt7530.h | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index 441320d4d779..83669f53cb36 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -681,6 +681,12 @@ mt7530_cpu_port_enable(struct mt7530_priv *priv, mt7530_write(priv, MT7530_PVC_P(port), PORT_SPEC_TAG); + /* Enable Mediatek header mode on the GMAC that the cpu port + * connects to + */ + regmap_write_bits(priv->ethernet, MTK_GDMA_FWD_CFG(port), + GDMA_SPEC_TAG, GDMA_SPEC_TAG); + /* Setup the MAC by default for the cpu port */ mt7530_write(priv, MT7530_PMCR_P(port), PMCR_CPUP_LINK); diff --git a/drivers/net/dsa/mt7530.h b/drivers/net/dsa/mt7530.h index d9b407a22a58..310f2536175b 100644 --- a/drivers/net/dsa/mt7530.h +++ b/drivers/net/dsa/mt7530.h @@ -23,6 +23,10 @@ #define TRGMII_BASE(x) (0x10000 + (x)) +/* Registers for GDMA configuration access */ +#define MTK_GDMA_FWD_CFG(x) (0x500 + (x * 0x1000)) +#define GDMA_SPEC_TAG BIT(24) + /* Registers to ethsys access */ #define ETHSYS_CLKCFG0 0x2c #define ETHSYS_TRGMII_CLK_SEL362_5 BIT(11) From patchwork Tue Dec 11 19:33:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wunderlich X-Patchwork-Id: 10724555 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4BE5E13BF for ; Tue, 11 Dec 2018 19:34:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3C8F52ADA3 for ; Tue, 11 Dec 2018 19:34:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 30C342B454; Tue, 11 Dec 2018 19:34:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 950252ADA3 for ; Tue, 11 Dec 2018 19:34:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=ZmUcF6J0PkCe3epI1WVLirXujhQdmh4quIGGGqromHk=; b=n1sHwExmN7qgoNtbzwda8lwPvB dUXCC9Ow/IRfWQ0HamcjyFmlN9xTD3EOOPzM96L/LANKL8WadsuJagGwlThEe2066dng2qmkufnFm Smp6S78AsiJuWD4Y5UsBQGS1Dp8TTn6kfgjFlLc67HIsD3IV01Sc3hkixECBAjw0BCJg6xWQktdrQ 7dWbFUdx0qNp8auFAyEPAcBWpOzJoB0vP8jyP724SiPahzv2yjUXhwex8UPSaHii8VKRzx9HBFSng 6jFI7mRaGB9BFs9MZl+6wFqThoZ8QlzS4xfoMgqRBYEJLQIvMZnBQaNncoOL9MqLGwWqNAhRplaRR VovkeWqg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gWnnJ-0000TX-WB; Tue, 11 Dec 2018 19:34:14 +0000 Received: from mout.gmx.net ([212.227.15.15]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gWnnG-0000RX-61; Tue, 11 Dec 2018 19:34:12 +0000 Received: from localhost.localdomain ([91.14.83.44]) by mail.gmx.com (mrgmx002 [212.227.17.190]) with ESMTPSA (Nemesis) id 0MBWo2-1ghIBO0hd8-00ATwi; Tue, 11 Dec 2018 20:33:40 +0100 From: Frank Wunderlich To: Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S. Miller" , Matthias Brugger , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH 7/7] [DSA] mt7530 add linking to mdio Date: Tue, 11 Dec 2018 20:33:14 +0100 Message-Id: <20181211193314.10695-7-frank-w@public-files.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181211193314.10695-1-frank-w@public-files.de> References: <20181211193314.10695-1-frank-w@public-files.de> X-Provags-ID: V03:K1:/kdyN1LlQRxSXve23iYRsooYQC7XQPE+MLFtGKmyRq6aCx7CaWF FFL6X0ozaLhzOaPZ3eJCcfEwGzk3S1V9Zo7ZboAQYEsgKPf/nwlEUPzIFwssc85YdjqdhTI JKif1PECzon/COVE/8r0ICX+VLuqtLg/NrMAjNUUUXjJYgNy+taT3P8yofBNTQR2Luwut+W 6g7qSqdsx6j994w1a/V7w== X-UI-Out-Filterresults: notjunk:1;V03:K0:sZLol5aRfGU=:S/NLkB66pQ1JpOSRV6VaBg mZQkqCMr6AAsAqw8AIO3kNQaYc87G8ISC9zFztrd+Bu3WyotEIEsqPfUgJVr0IauWbYS+yKSx 5o7FC09dWNdbHkP2JZFwkb2T2Fqe2wHrIUPGcqtNve2lf3Tm75Tt+WXVBH0L0yu6qe9E4Q0an okgJVM74knJ8iScSOW6jRYHr0zpoiWW8UYpg1ITvVrXLpFMlJtwxvu+jVYxvIN/IEOgaR3hw4 4wxrNRCQu56Ozu2vdvpkOa7A9P7GHkp7jDAwubgdYihOQ9BFJsqYRFAy9FIY5mPWi6ZeUiQOY H+2DfHacy+/KH2fZXUW/THAHBvCMTQ6jYuyCmSgBuwj7nCR8peeVUF3YtwZkWJIxG/xnX/KTS TKA18J+NcPRiaJuM4anQl/mf8MZ+F6/BwcT4OEOuo8MR0bh4LmWEaSSx1ZTE4WGVMWW4F1Adp /irA6jNdSJ3i8Z2gShraycWxAKhDV/QCL97v2mAjkmqHFOi6+Fv5ZuXV2y8/zPmSK6Xun6eMA tZTEXa8SduPQlvTOiqp6aF6MR1yd05sU0ZgM8jnzB5R8k5ogvEh6/2fIKyWWHYjlkluu98SvP eJ2VF64PEhqmi4XyQrXlbH+i+xIsHMIzVD9/EDeKeu/mo1Y0kDsPJkrpzuIzKZRDkn+d1ylwO KrKMLXmd0qCJWoaGbbhNoQ1ODOv+P8NtuGM/B0CsoETcPKXv5hatDqday83Bh1xuamBa4hy+v jMTUXAKD9lq+gGyzuQUggVXk5HG24S03kKlOewFXCRvVj+ErxHaHh1YBJ9FbwaY0DFyB6wqK9 fHjM8FJiTY61DPAMDTA82uS3LaOb0D1bf4EHB4A88+e1Nc4iM6WlGlRQAjfas7AGAOkyN8eUI 2HmbsWyYREDqIS90ZVBb4UIoA9nqMg8SBLkwOPO4LB8aXjIlfjpM03JTE+/FJ1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181211_113410_526237_2E7503E5 X-CRM114-Status: UNSURE ( 9.97 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Frank Wunderlich MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP based on https://github.com/openwrt/openwrt/blob/master/target/linux/mediatek/patches-4.14/0045-net-dsa-mediatek-turn-into-platform-driver.patch Signed-off-by: Frank Wunderlich --- drivers/net/dsa/mt7530.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index 83669f53cb36..e529bc334459 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -1345,7 +1345,7 @@ static int mt7530_probe(struct mdio_device *mdiodev) { struct mt7530_priv *priv; - struct device_node *dn; + struct device_node *dn, *mdio; dn = mdiodev->dev.of_node; @@ -1392,8 +1392,14 @@ mt7530_probe(struct mdio_device *mdiodev) return PTR_ERR(priv->reset); } } + mdio = of_get_parent(dn); + if (!mdio) + return -EINVAL; + + priv->bus = of_mdio_find_bus(mdio); + if (!priv->bus) + return -EPROBE_DEFER; - priv->bus = mdiodev->bus; priv->dev = &mdiodev->dev; priv->ds->priv = priv; priv->ds->ops = &mt7530_switch_ops;