Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3186354pxj; Mon, 10 May 2021 21:39:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwto1V8fUJbaEkWZwOeNkn9p2cx8QL/w4d2Ftcq4qJ1ArA3ef71mHsk1HIzQKc+uBkeehI3 X-Received: by 2002:a05:6e02:b41:: with SMTP id f1mr26370204ilu.212.1620707997015; Mon, 10 May 2021 21:39:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620707997; cv=none; d=google.com; s=arc-20160816; b=RMu1kXLw9+4P0zV6q+/MWKmKRVly0D+vff4vOEJmw33BIfihS2Y0ygoym1yryenY3T GoJZHBtE1UiOqf2+VGrwFQC2MfA52bhAYMCRsPfoxk/nehsB6esUEheEXERvD8jgihLg D+AIIAvcSAS31YCUdgB/5IGbGXKnixpUe7Zlmjqym7y2dWJJVdeGb48AItJ1lZS/h9BJ Z7XgK2ht/e2wYvdbaofb7e5D9QmXpzdQV/45WsJVpJadPk7Icb+zze2Rw35IF3M6xCmU u9OGlb77FK5BblJE7t5BmozH437Hrr26QLkcX/B3sONpIoGls+bjZDO7g0qDfIVAmJy8 z2Jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=9j3brsA+Qz+C7iYpuWyr6TAaFuaS5FG5c8BRA7lJjko=; b=hIv4sM9M6mFKkwzIEpAvqaIlNHiZMw+Ax9j/+quhoyf3r3RQpulyojFb8Dk32QIVeS dUXT9ohCk3gsghl4LndjyoT0JanuMBPj5zM/6/hAUdrWaBidVh7ARuJgl9AW1ToGlj64 11P20hwQVsJwnvL1d1HvmM7j8lQ0qyck6Vl0NDmhdSZlHVpNXLgKDYpkbSd5PjpQ08/Y TdnMq3Rtsx4zSerWC42DUK8mdZnmdC6+penBlN13RnkF0FL8GSFlufFb2Z4TMMPMqoJj NzVgGvZfSUsFGAhAHkJ1FviB/1P45EEkk/6BV5nzMGS7IBzYRysdjc1Rcnx2oSClDPpz 960w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g2si1827041jaj.107.2021.05.10.21.39.45; Mon, 10 May 2021 21:39:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230425AbhEKEjj (ORCPT + 99 others); Tue, 11 May 2021 00:39:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230185AbhEKEjP (ORCPT ); Tue, 11 May 2021 00:39:15 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB49BC06138B for ; Mon, 10 May 2021 21:37:58 -0700 (PDT) Received: from dude.hi.pengutronix.de ([2001:67c:670:100:1d::7]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lgK9K-0005c1-39; Tue, 11 May 2021 06:37:38 +0200 Received: from ore by dude.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1lgK9J-0007xy-3B; Tue, 11 May 2021 06:37:37 +0200 From: Oleksij Rempel To: Shawn Guo , Sascha Hauer , Andrew Lunn , Florian Fainelli , Heiner Kallweit Cc: Oleksij Rempel , kernel@pengutronix.de, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-imx@nxp.com, Fabio Estevam , David Jander , Russell King , Philippe Schenker Subject: [PATCH v3 1/7] ARM i.MX6q: remove PHY fixup for KSZ9031 Date: Tue, 11 May 2021 06:37:29 +0200 Message-Id: <20210511043735.30557-2-o.rempel@pengutronix.de> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210511043735.30557-1-o.rempel@pengutronix.de> References: <20210511043735.30557-1-o.rempel@pengutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::7 X-SA-Exim-Mail-From: ore@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Starting with: bcf3440c6dd7 ("net: phy: micrel: add phy-mode support for the KSZ9031 PHY") the micrel phy driver started respecting phy-mode for the KSZ9031 PHY. At least with kernel v5.8 configuration provided by this fixup was overwritten by the micrel driver. This fixup was providing following configuration: RX path: 2.58ns delay rx -0.42 (left shift) + rx_clk +0.96ns (right shift) = 1,38 + 1,2 internal RX delay = 2.58ns TX path: 0.96ns delay tx (no delay) + tx_clk 0.96ns (right shift) = 0.96ns This configuration is outside of the recommended RGMII clock skew delays and about in the middle of: rgmii-idrx and rgmii-id Since most embedded systems do not have enough place to introduce significant clock skew, rgmii-id is the way to go. In case this patch breaks network functionality on your system, build kernel with enabled MICREL_PHY. If it is still not working then try following device tree options: 1. Set (or change) phy-mode in DT to: phy-mode = "rgmii-id"; This actives internal delay for both RX and TX. 1. Set (or change) phy-mode in DT to: phy-mode = "rgmii-idrx"; This actives internal delay for RX only. 3. Use following DT properties: phy-mode = "rgmii"; txen-skew-psec = <0>; rxdv-skew-psec = <0>; rxd0-skew-psec = <0>; rxd1-skew-psec = <0>; rxd2-skew-psec = <0>; rxd3-skew-psec = <0>; rxc-skew-psec = <1860>; txc-skew-psec = <1860>; This activates the internal delays for RX and TX, with the value as the fixup that is removed in this patch. Signed-off-by: Oleksij Rempel --- arch/arm/mach-imx/mach-imx6q.c | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c index 703998ebb52e..78205f90da27 100644 --- a/arch/arm/mach-imx/mach-imx6q.c +++ b/arch/arm/mach-imx/mach-imx6q.c @@ -40,27 +40,6 @@ static int ksz9021rn_phy_fixup(struct phy_device *phydev) return 0; } -static void mmd_write_reg(struct phy_device *dev, int device, int reg, int val) -{ - phy_write(dev, 0x0d, device); - phy_write(dev, 0x0e, reg); - phy_write(dev, 0x0d, (1 << 14) | device); - phy_write(dev, 0x0e, val); -} - -static int ksz9031rn_phy_fixup(struct phy_device *dev) -{ - /* - * min rx data delay, max rx/tx clock delay, - * min rx/tx control delay - */ - mmd_write_reg(dev, 2, 4, 0); - mmd_write_reg(dev, 2, 5, 0); - mmd_write_reg(dev, 2, 8, 0x003ff); - - return 0; -} - /* * fixup for PLX PEX8909 bridge to configure GPIO1-7 as output High * as they are used for slots1-7 PERST# @@ -152,8 +131,6 @@ static void __init imx6q_enet_phy_init(void) if (IS_BUILTIN(CONFIG_PHYLIB)) { phy_register_fixup_for_uid(PHY_ID_KSZ9021, MICREL_PHY_ID_MASK, ksz9021rn_phy_fixup); - phy_register_fixup_for_uid(PHY_ID_KSZ9031, MICREL_PHY_ID_MASK, - ksz9031rn_phy_fixup); phy_register_fixup_for_uid(PHY_ID_AR8031, 0xffffffef, ar8031_phy_fixup); phy_register_fixup_for_uid(PHY_ID_AR8035, 0xffffffef, -- 2.29.2