From patchwork Fri Dec 14 16:48:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wunderlich X-Patchwork-Id: 10731457 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 67E67924 for ; Fri, 14 Dec 2018 16:50:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CF1772890F for ; Fri, 14 Dec 2018 16:50:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C2A922D861; Fri, 14 Dec 2018 16:50:35 +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 73B122890F for ; Fri, 14 Dec 2018 16:50:35 +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=eUm1yg7SIHEi+pgivORbwAw1/ye7mm03TOVtbV79T2c=; b=FQiN8eIJ45nwCwrtN8bwNq0l06 ZQskaQx4Y5geUeWLdLog4muhR7ASbgGv9PEeOE7T1AT4Olr5t7XSTMxIGfIoWSm91pGgr2oaMGDrE P9+bty9zhKAvHqHRKXPHp56CWkG9Yoj5dsjZjKp4q4qRz2jSpKzCiD4FgctclRWFCZkActDZ5dub1 8rAEhy50gcaWiJQNJYNTm2bsOTQZQ3YtKduAyVLX0xarS0A7EkMOIskAtY636PZ9eFYCYdodkJqQ0 48fVbkgy9qulPu0MmmP3UKISr19zlQkgvVdrVVG4lp6Ve8ogCMbLGkTEF/K6jy7wfoajTesLYNwL7 ooixvt4A==; 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 1gXqfa-0000yD-BQ; Fri, 14 Dec 2018 16:50:34 +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 1gXqfN-0008Ak-NT for linux-mediatek@lists.infradead.org; Fri, 14 Dec 2018 16:50:26 +0000 Received: from localhost.localdomain ([91.14.94.237]) by mail.gmx.com (mrgmx002 [212.227.17.190]) with ESMTPSA (Nemesis) id 0LhOSG-1hBKHI10BE-00mXcJ; Fri, 14 Dec 2018 17:49:12 +0100 From: Frank Wunderlich To: Matthias Brugger , netdev@vger.kernel.org, Sean Wang , Andrew Lunn , linux-mediatek@lists.infradead.org Subject: [PATCH 1/8] net: dsa: adding fields for holding information about upstream-port Date: Fri, 14 Dec 2018 17:48:40 +0100 Message-Id: <20181214164847.4851-2-frank-w@public-files.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181214164847.4851-1-frank-w@public-files.de> References: <20181214164847.4851-1-frank-w@public-files.de> X-Provags-ID: V03:K1:ovUUBPJLPAQf2zRMjVDF1oSgXzC70FRGtdEio7Ezn9WL4B1MIlH Z0Eg+hZpJPIUECikF90RaaDoQwEsAin8BBze8SPu17MNCpEJ90FLYmqEo/Bau67RnxafXo3 VJtp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+aZaAbPQiY X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181214_085022_195214_ADBE9FCD X-CRM114-Status: UNSURE ( 9.71 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP for multiple cpu-Ports aech port needs storing the the cpu-port to be used this Patch adds the needed fields for this 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 Fri Dec 14 16:48:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wunderlich X-Patchwork-Id: 10731445 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 AA2BE112C for ; Fri, 14 Dec 2018 16:50:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1B4C52D85A for ; Fri, 14 Dec 2018 16:50:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0F27E2D865; Fri, 14 Dec 2018 16:50:27 +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 9B09E2D85A for ; Fri, 14 Dec 2018 16:50:26 +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=B2U2y6yf/HonUDNKdOkRtc6YSg00xNLk8BVkMDHriC4=; b=pLfO1Tqu66MH6rSV60djBeQpBA AGM4D1kAH6MMci+czLmLGWVdwe0uAb3I+6GceVCOnyWOLxQNY8WjjtQN16JJWvfnXJ3GyCdhj+mIh yzC2bZDcAEQnVm66t8/nMdSyPCpQ61WUN0l5JBTyKcQ/8uK1MQD1GU2+2Q/Kaj2muOloRBrQl/lVW yoilxXJ+284VBRmfhVPWsVcH8LCCSI0BCHOrduZaJPVdIXB9SrnTjc0+0z5GIJkW10pX/taoFhvZC yIvSUKGUMA6Mk5h5QsjszGlePPbjMeaK55Bu+EHnpXwwCHr/umaiC4pZv1B7ydLIIe41zu2egJzP5 ZsKm8hPA==; 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 1gXqfR-0000sM-Nx; Fri, 14 Dec 2018 16:50:25 +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 1gXqfM-0008KK-Tq for linux-mediatek@lists.infradead.org; Fri, 14 Dec 2018 16:50:23 +0000 Received: from localhost.localdomain ([91.14.94.237]) by mail.gmx.com (mrgmx002 [212.227.17.190]) with ESMTPSA (Nemesis) id 0LiDnn-1hAUvr2Chf-00nMYy; Fri, 14 Dec 2018 17:49:12 +0100 From: Frank Wunderlich To: Matthias Brugger , netdev@vger.kernel.org, Sean Wang , Andrew Lunn , linux-mediatek@lists.infradead.org Subject: [PATCH 2/8] net: dsa: add helper functions Date: Fri, 14 Dec 2018 17:48:41 +0100 Message-Id: <20181214164847.4851-3-frank-w@public-files.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181214164847.4851-1-frank-w@public-files.de> References: <20181214164847.4851-1-frank-w@public-files.de> X-Provags-ID: V03:K1:8Y/ysQdttt6vSxa2xsYkPMW3601sKcRiBd9NtuKZEK+iwZfpbBd F3uz3d40RnfxDRhC7wFHBONNxLPk0H2YByh9cGbgfrpyP9MBgDXyQW+m4HRMHOtHW+s0Ppj b4O0wDafSK0GkkMg9ZN4SbmFaj1FE9aEkjHhvy075X/b/xhGbCAMp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8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181214_085021_258943_8F449D50 X-CRM114-Status: UNSURE ( 9.51 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP for using mutliple cpu-Ports 3 additional functions are defined to read dts-option (dsa_user_parse) and check if current port is a upstream-port (dsa_port_upstream_port, dsa_is_upstream_port) 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..b7c6da2f1f08 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, "default_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 Fri Dec 14 16:48:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wunderlich X-Patchwork-Id: 10731461 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 9BD75746 for ; Fri, 14 Dec 2018 16:55:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 09DB72C9FA for ; Fri, 14 Dec 2018 16:55:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F1DB22D85A; Fri, 14 Dec 2018 16:55:58 +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 989902C9FA for ; Fri, 14 Dec 2018 16:55:58 +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=9VvCT5Ht4GlO7NsbvI+RLbFAMURFtca7P4ozWLfYjqo=; b=hGJHtEKiU2i4TncEO9ok1T5VIL UG2rpwfW6WytQMf8/oEHyIZHL3H+XTVTGbClTvPXNAgl85RrE7OiJD5ju0nrRshy66CrqiDdOWumF TY3Ysq2SHkB+5rpqXkSBNQo94uPaeoPn8vnNLjC81/Du9Ui3weLq2E50ldcNDad1C2ZwSRovxu3yy P4M7Sc8dSbI5H/9OBuKFeWdNYLPjJJ72MTPNfa+uqv+cVhHNhVnoZBXRCglXArX+l/YvMf6nfwLlV recWmgWPrheWePFtbknftSrViLR2kcK1EkF/6T8Pobcs1FLfR42q85a6wIDZmLfruiIlBd+Fp9uve lXN+4s3g==; 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 1gXqkn-0002iC-PO; Fri, 14 Dec 2018 16:55:57 +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 1gXqkk-0002g3-GE for linux-mediatek@lists.infradead.org; Fri, 14 Dec 2018 16:55:56 +0000 Received: from localhost.localdomain ([91.14.94.237]) by mail.gmx.com (mrgmx002 [212.227.17.190]) with ESMTPSA (Nemesis) id 0MI5JG-1gaaCk3TRe-003uXl; Fri, 14 Dec 2018 17:49:13 +0100 From: Frank Wunderlich To: Matthias Brugger , netdev@vger.kernel.org, Sean Wang , Andrew Lunn , linux-mediatek@lists.infradead.org Subject: [PATCH 3/8] net: dsa: adding handling of second CPU-Port Date: Fri, 14 Dec 2018 17:48:42 +0100 Message-Id: <20181214164847.4851-4-frank-w@public-files.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181214164847.4851-1-frank-w@public-files.de> References: <20181214164847.4851-1-frank-w@public-files.de> X-Provags-ID: V03:K1:2S9q7pROCez+K0fN+z5NnnFToli31OS89Q/sWYu7SjtvgQWbvw8 H3N90r712vWcv5Q5hnkXiTtcPx7I/K5wNMMvaWhas9LJod+5pOi967HbLFvnDPyCxlrCcEa qTVqSKRiNqyz8/d6QwREDvPl5HqBuIi+kTWJ9TV/47PkN83sJjhJaP4+Slrh0uFRjBcyNcy PjJwYw3r7dFX5GMO75TfQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:T4LxaTIpfwo=:3OwqJQJElMO0cpJK9xEJhz A8BQAD06zQisdUFD3IOBolSvmi2RlVWWvAisW2/Zbrs5VONum2d+vWsNeH+TLZWr/QX3bVQzJ cr8Be+QbjdVn1+R6wDQ12ZNNtHuoVsSoPnXdu0qu8L7bV5wpGgsTZIZIX36hmJQyXVIM/OiSf dxHrTNSNcPTFuYFazLorivpRMj9GX9D02ujcxfipA0cLNcEIGAYZ57FdlkJPVwGxbZVWcaLvp n/8xVTd1B9+eUEB5b5yOLCRkVBxQtsTZ4xWSJF2cxQVTfjIxrL3LBGNCpm2rIeVHjpMiFOAc6 OJx4mRWYdNab3XX+mjBoeT55PP5hxXOT9WO43CNZhX7CXxQ6xKoGQ44UwL/amFmmZIAh0wyqK yK7fmaOAfhD0ZITmcCa94P2Zc+1WeNllsSxdNfIyfRF6IA2clB0qx2gmfS6OFj2GV+ZAXnlDI 64us2EV2MQJgEkfAcRpMuQoUu79QF4O9ofWCIdYSqSVVOsd4O0ThUVlDjaoa4CzpihmAhdyfT bOImtbBlxI3B4SB6pYr6O3/7k8L//17zAe/wwyBeqqE2oUUoZN16xPgIE/s/esmW2foWxzlBg U6G8L7kypqSCgu1TW46qgE28MvVYVeJWX5n9aeaYuKp1dmtI8cM+XPnsOh2KEe2fbiyESKFON n38hx2Q/uqsU1PAeWenqoP2bZAXlGgVuXBjDTwbgEQtxHN09r7upyehvLCG24nlUWuMBOMnVN +OwH0X7VnBALKqUxYaVkbjAoQa0jh7cWiAVlmPmQIBiu3T5SUltsdAJu49Ytjq9pnQD/xjE+q ZvwFNGkn6eJBRUHhnzLjkDlxo0G3KSY6zVhRBCTUeqW6n8I2ZFTxtggHW/rmtBOnWq3S5F3Zz usN70ZsfrrHf+CIAfhF6exS+mVLfEdHNCr9YVTDXq9FfH9aaqw+SPDgNtKdfLK X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181214_085554_857805_13C0DFCA X-CRM114-Status: GOOD ( 12.22 ) X-BeenThere: linux-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP this patch adds the core-functionality of multiple cpu-ports currently it uses definition in dts to make connection between cpu and user-port 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 b7c6da2f1f08..8f64535fd2a0 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 Fri Dec 14 16:48:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wunderlich X-Patchwork-Id: 10731455 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 54196924 for ; Fri, 14 Dec 2018 16:50:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BA5372890F for ; Fri, 14 Dec 2018 16:50:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AEA512D861; Fri, 14 Dec 2018 16:50: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 682C92890F for ; Fri, 14 Dec 2018 16:50:34 +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=pJuD5ZTwLLPy2O1GoMlQmOfKphGf8wJD7VRYJ4+iIPA=; b=HlbGcRv4x9Gkl76mwcPYt4bViz qp/icd0fCvVKia180qAj/8CKWzPjUj01u9uDwZwPB/KDgMbVhXrv5jcVNixFbualmJVtTgLA64vRY LLrmeDO9KAr8oQqQr7QsQdZeidmxPrZuAwmUX2i7zZWicb4AshdJ9DTjjnEbVxdp56wsplAPuNp9P ik8/Jg44K4WCLrTIox8hTW77M+1Y2OcJc4iZpNOkkoH5zSmU4pidB+9yhmjQgwn+oAwPm/3cs5m26 xBV4cC4mpX+EvSAyAgE6f8ZRswIaDrHKV0tjFrfl7TcBgnmqqOPl5QX8aXfHheil3Vw6bBS1BQONG U6zhRiKw==; 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 1gXqfZ-0000wf-8h; Fri, 14 Dec 2018 16:50:33 +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 1gXqfN-0008Lf-2U for linux-mediatek@lists.infradead.org; Fri, 14 Dec 2018 16:50:25 +0000 Received: from localhost.localdomain ([91.14.94.237]) by mail.gmx.com (mrgmx002 [212.227.17.190]) with ESMTPSA (Nemesis) id 0MQ2zr-1gSbSU1h1n-005GO0; Fri, 14 Dec 2018 17:49:13 +0100 From: Frank Wunderlich To: Matthias Brugger , netdev@vger.kernel.org, Sean Wang , Andrew Lunn , linux-mediatek@lists.infradead.org Subject: [PATCH 4/8] net: dsa: add support for GMAC2 wired to ext Date: Fri, 14 Dec 2018 17:48:43 +0100 Message-Id: <20181214164847.4851-5-frank-w@public-files.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181214164847.4851-1-frank-w@public-files.de> References: <20181214164847.4851-1-frank-w@public-files.de> X-Provags-ID: V03:K1:YFCEhwlPFO+v0hZAMxyoP4y4wefwlCFqhd4FFfD2m6wQ8OdgmXR Auf8Gt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QlCxKbXl2ecZu7kOE1soV5xGEHsoC6skt/f8 RQaxmZ0ufmN9Hz6GDt2ANKJ7cNZlJUuvtFvRCYHxuZk5r1xgV7ifpXzXs3fIeK X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181214_085021_597800_57E6B540 X-CRM114-Status: UNSURE ( 6.77 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP cpu-ports of mt7530 need some special flags to be set 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 Fri Dec 14 16:48:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wunderlich X-Patchwork-Id: 10731459 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 C94E0746 for ; Fri, 14 Dec 2018 16:55:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 348312C9FA for ; Fri, 14 Dec 2018 16:55:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 287782D85A; Fri, 14 Dec 2018 16:55:58 +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 B455E2C9FA for ; Fri, 14 Dec 2018 16:55:57 +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=URjonrAsd/zd+bhWBNcGADqRY4Uhbyx9vRWnWHMmuz8=; b=LvhyKT5L4iuWm9Ch2QYj3+ogJ1 2t1hPVOGAj6dTbu+t5D/LZLSL5XVg0p85CMWvb+uzKVgTQ6/OSYaOkUmmvnAZfriMQjxU2sfiQzSW nFF93FR/dNLaxTELTZPGv6NP1c5IK1i4u2FqKBuHShrOa9MK4vg8BYrv1UCBjxaBS5BNgFXtRzh06 1cGeEQA3eir/3opvLP4JlaFR3uUFZAB1UGxy7SEEM23ix4aFna7kQBJUJ974P4rFd4/3jwXSem3Pd ct89QDnsTSuCLheb8ojYkcEbqZz2v2KTyAZv/T3eiV9BABQtLpJjcg9GAjNVyV3P6lCGYIG34wObr jMBQWN2w==; 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 1gXqkn-0002ht-Al; Fri, 14 Dec 2018 16:55:57 +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 1gXqkk-0002g4-GD for linux-mediatek@lists.infradead.org; Fri, 14 Dec 2018 16:55:56 +0000 Received: from localhost.localdomain ([91.14.94.237]) by mail.gmx.com (mrgmx002 [212.227.17.190]) with ESMTPSA (Nemesis) id 0MCtql-1gfr0U3055-009e6C; Fri, 14 Dec 2018 17:49:13 +0100 From: Frank Wunderlich To: Matthias Brugger , netdev@vger.kernel.org, Sean Wang , Andrew Lunn , linux-mediatek@lists.infradead.org Subject: [PATCH 5/8] net: dsa: dsa multi cpu (mt7530.c) Date: Fri, 14 Dec 2018 17:48:44 +0100 Message-Id: <20181214164847.4851-6-frank-w@public-files.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181214164847.4851-1-frank-w@public-files.de> References: <20181214164847.4851-1-frank-w@public-files.de> X-Provags-ID: V03:K1:rOldRIXQjk6Jj4M4ljadTmh8ugrQIzZTHXwLF9aMCm5Jw8yVH9/ hzYWKph7N/KdheyxbO9GEu8ozYNyBSELqcPUvr12XxZ7X17y7oBMK9xUu7DAnaaQvIlHrxk SCBKcmgAh6gjAsvIuGpPrfU5Zrmg4IbPTALZrl9yRjhPLpPzlMDnETeB44yOhBg/M660K3Z KX7LxJ3xUku096d4+8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M114-CacheID: sfid-20181214_085554_843931_897650CC X-CRM114-Status: GOOD ( 12.67 ) X-BeenThere: linux-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP implementing changes to mt7530 switch driver for supporting multiple (2) cpu-ports 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 Fri Dec 14 16:48:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wunderlich X-Patchwork-Id: 10731449 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 E3F7914E2 for ; Fri, 14 Dec 2018 16:50:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 56BBA2D85A for ; Fri, 14 Dec 2018 16:50:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4A5692D865; Fri, 14 Dec 2018 16:50:29 +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 EFFFD2D85A for ; Fri, 14 Dec 2018 16:50:28 +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=axB+IkHIsRbNIBW0lwTUwv0EFcKbaeWTyR8iBfZKi1w=; b=eQnVtap4lXCT/uPabYMVCswFUl ibIFDU+4bnCfFmOZ3fZYQhdTDVgkeQWLPzU4C28gLsX4VbGm7YJw2UVe+h/+UNOtGkwDo+pfd8pFq T0JePvThXAqHAqx8HmrFBQb7ivdupUA/RVQ8L0A4gOh67dfYsMxBV2gkMNCpek2haqs3EHjHyFz9R OrFsVxFM668RUK8kaZvzpa7yGtgaUz1nFPChxL/sqwjSLjOovcqFgbwoIHfbOsMlanl05ED20ynfr wxM9ws31sekxBW3mrOFNSFSAZjfU5ZdtYkQgkz2WDc8FVxFZzVopoIsO7U6Kc3X2PmOylP277wuLr l7w8klOw==; 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 1gXqfT-0000tM-HW; Fri, 14 Dec 2018 16:50:27 +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 1gXqfM-00087V-Ul for linux-mediatek@lists.infradead.org; Fri, 14 Dec 2018 16:50:23 +0000 Received: from localhost.localdomain ([91.14.94.237]) by mail.gmx.com (mrgmx002 [212.227.17.190]) with ESMTPSA (Nemesis) id 0M5Lmp-1hMTtl0LdP-00zZMi; Fri, 14 Dec 2018 17:49:14 +0100 From: Frank Wunderlich To: Matthias Brugger , netdev@vger.kernel.org, Sean Wang , Andrew Lunn , linux-mediatek@lists.infradead.org Subject: [PATCH 6/8] net: dsa: tell GDMA when we are turning on the special tag Date: Fri, 14 Dec 2018 17:48:45 +0100 Message-Id: <20181214164847.4851-7-frank-w@public-files.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181214164847.4851-1-frank-w@public-files.de> References: <20181214164847.4851-1-frank-w@public-files.de> X-Provags-ID: V03:K1:JPDICO2Ts0bLANIY8dEuEZS+Re/fdWEsbIzEDXIrVROzYLpn19k 4DrDEDPUiGZlPqXsh3XpPVP8fq7PdmE/61RlO91WMyVOQWhJctIqWZ+LkD2gHuvA+xFOoWx ZQpzyC76cBdzuWCdjByjSdSLTK2OM0I8YMoM9Km6ccphCLeDaL97Ae5Jr4hp+/SHKJMx+EZ w920l0L63Or3BItEXiC9Q== X-UI-Out-Filterresults: notjunk:1;V03:K0:X8bwpFtINFA=:lj9EVAIELlw3VMjmDsXCbc rINd8IwJC6LaCN4L4+BRfat89P5lN/zHxqgyRS1BABs+jxpJK3F3tvBgTx/PsfEAKJ6Nxct5a UnjIE0dnrlVhNP4MXTqsJ3Ne0vgY5FyxCY7bjZ4L4zehsoCpsHgU8d+9tBjuKjhvu6Sak+Q9Q 50SCdO0alP9w7J26IDVyKfP9dKFTh+db/+jz2cGB1F7mf7H3T/wvtDIj/TnETJoV5lKSadPgB aAXQfc8p8QRAVSnadTVMS9dq42ck/3OVpQksvEolbB1e3FOFfV0PVa5qH2wUpuPZIiKvqpKiC goApqBTrNNnNkYDvmeF5uul7hflEiwlFavTUHKwqsBjS350xTfcHQTewnEFWg/O1vcC7JuTdp 0ajtkC4zQgnaxxG9LL0PIrjlI/KHeT1XY6CCR4UoQpBCCt84POmeIyT52Gj+Y5YIvawNcQ7Au JXuisfTJWj9530WOhEyn04J8z1HSvlgUrSfFSAH/U1PG0z6NPjjJRfvJrNzxmY5g04ggBbEw3 bTa1ekechRpgqt/5rfP0ehTiOehN9fobBEU338oQ8gX7ku5hP1sdR3LXkbWrl44qLR3+LSCVV BYHphmBUbFlQqR4bTlB88DBZvoC3jG3uNPgoDQ41J8gN7lC4Je+cce8BRzPDwc4mHa1mh8VxB iMoLiQOUSA+UB2H58iUW1ISSpKYULB9mTZlvD6cRX8mKrEJ8aY9PEaImlHA3HE3YTum5ZGfKF EMUS93sXIXNfj6m+1vTANeByyqRAT6/4Au2QGutL0S2Znur3WbZO7XVj1NhEtnQOoOBu1V+rS lFILe2QKalH1fvmhg0HmbnTDihkD0CyVsnaTAUQUxLl76aDog95rLCFl8YAibti6PZtH8vRv5 XEmphIP2M2bhwa4HgheitgOFgQrccgrUOsmTeZXnmFsFinINIMpUzaaxDQh0B5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181214_085021_285540_254FE55D X-CRM114-Status: UNSURE ( 8.36 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Enabling this bit will make the RX DMA descriptor enable the SP bit for all ingress traffic inside the return descriptor. The PPE needs this to know that a SP is present. 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 Fri Dec 14 16:48:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wunderlich X-Patchwork-Id: 10731453 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 2E570746 for ; Fri, 14 Dec 2018 16:50:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 93FF92890F for ; Fri, 14 Dec 2018 16:50:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 87D2A2D861; Fri, 14 Dec 2018 16:50:33 +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 24FE82890F for ; Fri, 14 Dec 2018 16:50: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=4VFqUNc2Lv4mB2IjwArUrOTtn6ThDywIno51skR7Yvg=; b=RMX2lQ2pcZgfYSNL5+cwcjOY3d Kv5WOhbDkhbC6wMu9QK9IOuuHYSrUOsLiXphAsbNXzMWSop8DVTC68JdCB0ZGyR8yRh5BX+5LE6/t 0nZyIyjUH/rmof/qJWvcHN+iFdujdPdizGEtuc/mBk4ryivTIYu1mI5UhS2nAoGVZsrKmjHrGdHUR jo+mCp+3F057wO+wVnHSQa3TYKJCXSUCoaNlDkErxyjom8jWBUBHKcFVa7aRWi+SSxwGRnxzYMbc8 mq7Q9XMffDCdFVAjA/X67HjGJpcJOknDCLEi8Yk6+dBTvR416klYnFgAHq+ad9fgooeRAJigQpFYc vBaX5pkg==; 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 1gXqfX-0000vU-Ob; Fri, 14 Dec 2018 16:50:31 +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 1gXqfN-00089t-1S for linux-mediatek@lists.infradead.org; Fri, 14 Dec 2018 16:50:25 +0000 Received: from localhost.localdomain ([91.14.94.237]) by mail.gmx.com (mrgmx002 [212.227.17.190]) with ESMTPSA (Nemesis) id 0M86PB-1hJkLL1hPV-00viY6; Fri, 14 Dec 2018 17:49:14 +0100 From: Frank Wunderlich To: Matthias Brugger , netdev@vger.kernel.org, Sean Wang , Andrew Lunn , linux-mediatek@lists.infradead.org Subject: [PATCH 7/8] net: dsa: mt7530 add linking to mdio Date: Fri, 14 Dec 2018 17:48:46 +0100 Message-Id: <20181214164847.4851-8-frank-w@public-files.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181214164847.4851-1-frank-w@public-files.de> References: <20181214164847.4851-1-frank-w@public-files.de> X-Provags-ID: V03:K1:DOg1IJMsyfHMnSc57Is3TycfnVBOJ/ngDHbLOmqfCCqJAG3DtzI FwtTqvcJU3Me3W1L5faGamJuTfFx2UX9aQvo2csN7Ki1XVRGLaY+B/NisubaWMe8A+PZma5 NinlqtJ1kdzlygRpjJ2Z4RjmZS3Xa88MCOZUnr+3mFRet9MGpuymA1T+mDrgTBn3s6tdtzB KQSIuU5uYWOGOSlYJXcLw== X-UI-Out-Filterresults: notjunk:1;V03:K0:PsMuGbhx1hg=:rQZyjmPaUa6p67BCvOa7sh dKs4AYI/FNR+E02kveLGgNUcsIgyc/Nft4BOUzvdUbTTNlXP2gvoeApHOhPfQ9FCQ3PpOLKBb o7Nitt1+DtkVsd+t/HO3KibTXEm4V6v8qOmhmITCf6xh5N5RVBP9tZgcu/PK73rSy/nK7nTN3 Hf05c5EfEi+OWYl+Su3D63d6XO2BKu1xlqq+/fpbsLntkM1K/RE2TgpWUXrTekjLaGDvYqcAr VjGEAseDXDf0vZzfboCuEb0QK47XJIFmFE1q5rnl0DUKnhr4f87TK7H5hqDY4NQsZm/p+G9Z1 Ia2sQWbbzNYX/LkYxSPnjnDjiLASlqdVPp40fxKeet6ybb6uIrQ9+u6Zd9hQjH0a4wQdDiRgc Hj06rA++QvIX/3nvuCDBNXiqHvyA4oSHGovwomKAfuSA5evWqxwhzWqN1EH0iAoK8ldmrJqns zMkcpg5YnY4otj/76aDSZb5C9hemyabqFSU62C0rVEunif1fjq/nCZakl1ulSetHwLxzo/Mdq 7rBt91QWCebrIJpmwjgDmLbMLv5CXeIoTaY37+XFk/unR/A1U255eLhEaa8uBl0B2deX4bqvf OsThUTcwEh4VgyMTtG2Ge0qBMhfgwCuS9B7mF3gWWN/r1fNTyh29zw68Dddp3RFtsqusgU4Rv q+5czRbN3U/+CwHuRnEewdnU3nDPzL/32nOnWENio6CL6hf5w6U0FoD8rkHnTAnLLI4HF/jZp YPAjN/Xz9VfTrnA+M0ANFteBQ264duFZxjl+vhhnfLHRwafW1aFZ+fFBnkwQcp7JO8YEUBDgh PKQCTFM5sVLsM9HoO23YYbsE0fmhEnfMi68TpaFjhOGO2wls1ZY2S5dJXReSdb0EDonE2AbIu mDVzt1DK8jDNt+8OFQS4u/EGvmvd2qEznqKsqqO9d3mg06wXlD6yNTlB8kwHL/ X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181214_085021_581709_CC967AC6 X-CRM114-Status: UNSURE ( 8.64 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP switch (7530) needs to to be linked to mdio-bus 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; From patchwork Fri Dec 14 16:48:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wunderlich X-Patchwork-Id: 10731447 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 3B90B158E for ; Fri, 14 Dec 2018 16:50:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A2B502D85A for ; Fri, 14 Dec 2018 16:50:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 962BB2D865; Fri, 14 Dec 2018 16:50:28 +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 4EC7D2D85A for ; Fri, 14 Dec 2018 16:50:28 +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=IfGfbZRGFC0oEDh9xRY2RmQKcPISNrXrDGabM92cMBw=; b=oOA0kMVOaiDynWViBUxGksJOlf avUQnI8yT/tv/5ykADVgsyf5sKwqVALw3a5xxOVlf4USAOJ2HfZ/cXb9acp5odO1orMOcBDbkdJiv Yhz29OI7DNDrfWorBvwESkb/udSUOJSF3vo9c4Sn+YVxSAg+oFQIEvgmgOX7t2S5l2XSiH/0RyxQn o11hgSBcP3bGQcDDbXFL7VMXTpQIWycSqTohUI8qT8laumMFmsBTLPbZxkFBBGq5n2kC6y8QTz+sp N2ZGQobF6bmr8YGzri/bIbZR3HcUHmrGPS20NFJHk7tSPdQTrDtQdLk4CmjS/Y4XXRwcb2SqBri18 +V0C95xA==; 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 1gXqfS-0000so-IL; Fri, 14 Dec 2018 16:50:26 +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 1gXqfN-0008DU-1v for linux-mediatek@lists.infradead.org; Fri, 14 Dec 2018 16:50:23 +0000 Received: from localhost.localdomain ([91.14.94.237]) by mail.gmx.com (mrgmx002 [212.227.17.190]) with ESMTPSA (Nemesis) id 0LoE4f-1h4PJb2wBN-00gG5y; Fri, 14 Dec 2018 17:49:14 +0100 From: Frank Wunderlich To: Matthias Brugger , netdev@vger.kernel.org, Sean Wang , Andrew Lunn , linux-mediatek@lists.infradead.org Subject: [PATCH 8/8] net: dsa: changes to dts Date: Fri, 14 Dec 2018 17:48:47 +0100 Message-Id: <20181214164847.4851-9-frank-w@public-files.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181214164847.4851-1-frank-w@public-files.de> References: <20181214164847.4851-1-frank-w@public-files.de> X-Provags-ID: V03:K1:G2Z2G1q5nnvg/w0zv+b3rquTEOeAbnRszZkwSrpw9eN1leR5ZD9 aseofOWWaIUSemoeYgVs13Yb1Ul85ZPz1zQjwhCjLoZ2ZxtsJQsTKPhtcqG/xJmihnb7Yel 1NmZitIJvZakaeVhrFQowIQ0IthsLGvVk6sWge8BW5fuzucbjekCHd3Yfrbjz5XyzMD6GTC v+rNR/lcLdjLQsMhijlbg== X-UI-Out-Filterresults: notjunk:1;V03:K0:v0W8zvsJUPE=:eguXkXPuchvlKhvc6ATOgX 5ohu+4IoyUXfmo55PcYNugsaLEJIDLif8wYGdxuGxY90jL6lGYnC+6xAbuzemD8/3VJwqxtVu XXii6V6dpi2BLWbEf3KO5xHsv1cl7o564MhCjsWlxddcg6rDMQYpfUElePSpeWD8QXiBMrLjj /t98xNkz9VW8RpQiteMblXF1C45AOBIyeBgNVZxVhRQpdt5+WL0eY3zlk/7THQkc4UUlTbo1w q5UDBqvdf0r8/db6FgXEjHg3zBuCBwpSX+BX6XYyVr+f2dKgxv4J9oQ46IbrkTf7+fD3rOOCI nioRJKL6QH1ky+lm3LERgD5obg9MGTsDz28Olnvo5cG3ldfqg+uRiHtQZqFFbteWi6uZ0Sb3N 4yZ9/Mfx5AqBxALGZQ9vfJWI5FwsJAeWRtX0OVUb0HXYMiw5ASqad0VXtaaST5IIElAlI+meF 6t7IIbeapd/Uz24H5oe8LCdK05UKL2NYZ7HfF/oEmo6k36JnDOm7bbeyK41rgFrEBVYNA+E47 RYMb3sE21v9l4EKBWS4bYEiLlmR9nWyLyGYOUzIzaY1AH00OGD4VugyZupZ/Nn/87kGxZ7Lfd l7jvF62Bg2bd6TOoy/L6yLLO2BG6eSeReCZrdv+ZlhGkIbGZgw9gCClaf1v94j0EwzCzsDNQN pcM+GjZN6JWv3ZI+adFZimYnZJw8NOzjJwX87qhBmd0l4Y9dnPspFJ1ireIRaq2NHSyZKEVC0 94LgRNM76wtp/O/wgLAa0oebBHYx9l6Gs2ykyfCexGsQesQU/pyCh4s5lAKPodbyUO+xK7ANa DCAIhcBI2YkCrUGytdHx4+nIU4SEDRBIaOTCDFhmjbI6sMQp5ib+Ve6OgEJfYNL7Fh3DGeUx7 CBmEnEF4qJuNbeZZikQkg7gPPVhb4ygUpZaHwdtCHcLUGi8TxoTlU9lNAOhBm8 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181214_085021_532395_EABDA9E3 X-CRM114-Status: UNSURE ( 7.68 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP --- arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts b/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts index 2b760f90f38c..64f3da148dbb 100644 --- a/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts +++ b/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts @@ -143,6 +143,18 @@ }; }; + gmac1: mac@1 { + compatible = "mediatek,eth-mac"; + reg = <1>; + phy-mode = "trgmii"; + + fixed-link { + speed = <1000>; + full-duplex; + pause; + }; + }; + mdio: mdio-bus { #address-cells = <1>; #size-cells = <0>; @@ -161,29 +173,44 @@ port@0 { reg = <0>; label = "wan"; + default_cpu = <&cpu_port1>; }; port@1 { reg = <1>; label = "lan0"; + default_cpu = <&cpu_port0>; }; port@2 { reg = <2>; label = "lan1"; + default_cpu = <&cpu_port0>; }; port@3 { reg = <3>; label = "lan2"; + default_cpu = <&cpu_port0>; }; port@4 { reg = <4>; label = "lan3"; + default_cpu = <&cpu_port0>; }; - port@6 { + cpu_port1: port@5 { + reg = <5>; + label = "cpu"; + ethernet = <&gmac1>; + phy-mode = "trgmii"; + fixed-link { + speed = <1000>; + full-duplex; + }; + }; + cpu_port0: port@6 { reg = <6>; label = "cpu"; ethernet = <&gmac0>;