From patchwork Sun Jun 16 18:20:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ren=C3=A9_van_Dorst?= X-Patchwork-Id: 10997583 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 E2ABF14C0 for ; Sun, 16 Jun 2019 18:20:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D4E5E2857D for ; Sun, 16 Jun 2019 18:20:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C856528607; Sun, 16 Jun 2019 18:20:38 +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 75EE32857D for ; Sun, 16 Jun 2019 18:20:38 +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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=i0TlWoO/ZeJutWod18pdF/YNr+G3BvDT9siKLpdPKwQ=; b=g/BVmd61hjfPb7 XFG1kkHQaafJJt1pdb5MKyDsfObVWR2UQEW9Z+hRideiyAeWb6Aycck3Wf1zTho0ZQ7bUMAXCTLX7 1IYhLZX2rNcyg5Opkd/M4FCcuuRpDvuskHvZDTh4pCmcotINWdaYcqP7hSqu+8vZmr11yF3VHrIFW v2fhrf2qnbpVKcj3sNn2ZzYs0Yae5HenGe/706yrsOTJFSWCUw+O9EEa25LfJERiGSpilR8qPaukM tLggtL3lgO0egCzxT/tHEtzKxqO6hchUiEKtFMVOoKeu6Qd+dWYk5dwV26D7ZUUxxDrz9YYOkysa7 j5mS1LgK1t67DXemFSUA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hcZle-0003qa-5B; Sun, 16 Jun 2019 18:20:38 +0000 Received: from mx.0dd.nl ([2a04:52c0:101:921::25]) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hcZlY-0003ou-U8 for linux-mediatek@lists.infradead.org; Sun, 16 Jun 2019 18:20:34 +0000 Received: from mail.vdorst.com (mail.vdorst.com [IPv6:fd01::250]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx.0dd.nl (Postfix) with ESMTPS id F2C1160743; Sun, 16 Jun 2019 20:20:29 +0200 (CEST) Authentication-Results: mx.0dd.nl; dkim=pass (2048-bit key) header.d=vdorst.com header.i=@vdorst.com header.b="FN0hLvbF"; dkim-atps=neutral Received: from pc-rene.vdorst.com (pc-rene.vdorst.com [192.168.2.125]) by mail.vdorst.com (Postfix) with ESMTPA id B867D1C65C75; Sun, 16 Jun 2019 20:20:29 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 mail.vdorst.com B867D1C65C75 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vdorst.com; s=default; t=1560709229; bh=FVz7Hn4FLBbfcWH9mwHn/c+q2RITenYFgIKX1MKhYCQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FN0hLvbFuwlQgK6xPtWy5fqR54Ff84xdsrphIIXG+WUQ4QJW72tqJF6p8YfBf+aJ7 3GW2x6uBRW9ejmGind7x0drMPvLDJ0NKrSbxj4svV54M9YuSeUm3pIMUjJK+J2YzCc 1TnUt1XpdxYQworIBPiKx/+Yrm7N9t/cAHDwy5DteKdYG6VFyqHImr+By1CxmiG2Pg AWwkbHe7zuowI7rpLBqhGAF8c8tfoGXcbmrWcwMaXavwRp4NfUsCrV326WThnk+JH5 LIgLQ7g6/C3PCQsdxd/Y7+AduwmUIMrs1ZiVbY+rVS5Chz0mUBTMzhKumHFBQbZVMT xFVogJiQQt5Ww== From: =?utf-8?q?Ren=C3=A9_van_Dorst?= To: Sean Wang , Florian Fainelli , "David S . Miller" , Matthias Brugger , Andrew Lunn , Vivien Didelot Subject: [PATCH net-next 2/2] net: dsa: mt7530: Add MT7621 TRGMII mode support Date: Sun, 16 Jun 2019 20:20:10 +0200 Message-Id: <20190616182010.18778-3-opensource@vdorst.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190616182010.18778-1-opensource@vdorst.com> References: <20190616182010.18778-1-opensource@vdorst.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190616_112033_138185_0C89D680 X-CRM114-Status: UNSURE ( 9.62 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Ren=C3=A9_van_Dorst?= , netdev@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-mips@vger.kernel.org, john@phrozen.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP MT7621 internal MT7530 switch also supports TRGMII mode. TRGMII speed is 1200MBit. Signed-off-by: René van Dorst --- drivers/net/dsa/mt7530.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index c7d352da5448..88de4e880417 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -435,11 +435,20 @@ mt7530_pad_clk_setup(struct dsa_switch *ds, int mode) trgint = 0; ncpo1 = 0x0c80; ssc_delta = 0x87; + + /* Port 6 delay settings RGMII central align */ + mt7530_rmw(priv, MT7530_TRGMII_TXCTRL, BIT(30) | BIT(28), 0); + mt7530_write(priv, MT7530_TRGMII_TCK_CTRL, 0x0855); break; case PHY_INTERFACE_MODE_TRGMII: trgint = 1; - ncpo1 = 0x1400; + /* PLL frequency: MT7621 150MHz, other 162.5MHz */ + ncpo1 = (priv->id == ID_MT7621 ? 0x0780 : 0x1400); ssc_delta = 0x57; + + /* Port 6 delay settings TRGMII central align */ + mt7530_rmw(priv, MT7530_TRGMII_TXCTRL, 0, BIT(30)); + mt7530_write(priv, MT7530_TRGMII_TCK_CTRL, 0x0055); break; default: dev_err(priv->dev, "xMII mode %d not supported\n", mode); @@ -507,7 +516,9 @@ mt7530_pad_clk_setup(struct dsa_switch *ds, int mode) mt7530_rmw(priv, MT7530_TRGMII_RD(i), RD_TAP_MASK, RD_TAP(16)); else - mt7623_trgmii_set(priv, GSW_INTF_MODE, INTF_MODE_TRGMII); + if (priv->id != ID_MT7621) + mt7623_trgmii_set(priv, GSW_INTF_MODE, + INTF_MODE_TRGMII); return 0; }