From patchwork Fri Sep 11 13:48:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Landen Chao X-Patchwork-Id: 1362536 Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=mediatek.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=mediatek.com header.i=@mediatek.com header.a=rsa-sha256 header.s=dk header.b=N55bqLu/; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4Bp1hd57m9z9sTS for ; Sat, 12 Sep 2020 02:40:33 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726428AbgIKQk2 (ORCPT ); Fri, 11 Sep 2020 12:40:28 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:41905 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726295AbgIKPLd (ORCPT ); Fri, 11 Sep 2020 11:11:33 -0400 X-UUID: 367ed8fe597b4281bbaebc8ef530fe36-20200911 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=MkU2LaCnOssekgPwIVl1I9pETqJ6+L8geigHE05ACLc=; b=N55bqLu/1TsTmbMTWL77Hg/vTkHJllWvm74QB/BzWYjuf4pQmoTnNqyk5wfD0L6vySN8nN5m5MM52XhxrEqwI5wvE6hRHgIzLBI+WJscmof48qxS5ojtl1HK+jsVpjDajCJKNP+PrW+6jPtAv2ULfXdnIbOdPqg9YID50so8R74=; X-UUID: 367ed8fe597b4281bbaebc8ef530fe36-20200911 Received: from mtkcas10.mediatek.inc [(172.21.101.39)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.14 Build 0819 with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 655240207; Fri, 11 Sep 2020 21:49:13 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 11 Sep 2020 21:49:09 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 11 Sep 2020 21:49:09 +0800 From: Landen Chao To: Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S . Miller" , Jakub Kicinski , Rob Herring , Matthias Brugger , Sean Wang , Philipp Zabel , Russell King CC: , , , , , , , , Landen Chao Subject: [PATCH net-next v5 0/6] net-next: dsa: mt7530: add support for MT7531 Date: Fri, 11 Sep 2020 21:48:50 +0800 Message-ID: X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 X-MTK: N Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This patch series adds support for MT7531. MT7531 is the next generation of MT7530 which could be found on Mediatek router platforms such as MT7622 or MT7629. It is also a 7-ports switch with 5 giga embedded phys, 2 cpu ports, and the same MAC logic of MT7530. Cpu port 6 only supports SGMII interface. Cpu port 5 supports either RGMII or SGMII in different HW SKU, but cannot be muxed to PHY of port 0/4 like mt7530. Due to support for SGMII interface, pll, and pad setting are different from MT7530. MT7531 SGMII interface can be configured in following mode: - 'SGMII AN mode' with in-band negotiation capability which is compatible with PHY_INTERFACE_MODE_SGMII. - 'SGMII force mode' without in-band negotiation which is compatible with 10B/8B encoding of PHY_INTERFACE_MODE_1000BASEX with fixed full-duplex and fixed pause. - 2.5 times faster clocked 'SGMII force mode' without in-band negotiation which is compatible with 10B/8B encoding of PHY_INTERFACE_MODE_2500BASEX with fixed full-duplex and fixed pause. v4 -> v5 - Add fixed-link node to dsa cpu port in dts file by suggestion of Vladimir Oltean. v3 -> v4 - Adjust the coding style by suggestion of Jakub Kicinski. Remove unnecessary jumping label, merge continuous numeric 'switch cases' into one line, and keep the variables longest to shortest (reverse xmas tree). v2 -> v3 - Keep the same setup logic of mt7530/mt7621 because these series of patches is for adding mt7531 hardware. - Do not adjust rgmii delay when vendor phy driver presents in order to prevent double adjustment by suggestion of Andrew Lunn. - Remove redundant 'Example 4' from dt-bindings by suggestion of Rob Herring. - Fix typo. v1 -> v2 - change phylink_validate callback function to support full-duplex gigabit only to match hardware capability. - add description of SGMII interface. - configure mt7531 cpu port in fastest speed by default. - parse SGMII control word for in-band negotiation mode. - configure RGMII delay based on phy.rst. - Rename the definition in the header file to avoid potential conflicts. - Add wrapper function for mdio read/write to support both C22 and C45. - correct fixed-link speed of 2500base-x in dts. - add MT7531 port mirror setting. Landen Chao (6): net: dsa: mt7530: Refine message in Kconfig net: dsa: mt7530: Extend device data ready for adding a new hardware dt-bindings: net: dsa: add new MT7531 binding to support MT7531 net: dsa: mt7530: Add the support of MT7531 switch arm64: dts: mt7622: add mt7531 dsa to mt7622-rfb1 board arm64: dts: mt7622: add mt7531 dsa to bananapi-bpi-r64 board .../devicetree/bindings/net/dsa/mt7530.txt | 13 +- .../dts/mediatek/mt7622-bananapi-bpi-r64.dts | 50 + arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts | 63 +- drivers/net/dsa/Kconfig | 6 +- drivers/net/dsa/mt7530.c | 1192 +++++++++++++++-- drivers/net/dsa/mt7530.h | 259 +++- 6 files changed, 1467 insertions(+), 116 deletions(-)