Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1420045ybb; Sun, 29 Mar 2020 04:18:19 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsObt/pmSd11fKWOP88Qz7O+8MYu2j2LLmuIoZ0j4MQj9UdBex5D0YSlUm9+JfIZucCpIYP X-Received: by 2002:a05:6830:110c:: with SMTP id w12mr5066542otq.175.1585480699336; Sun, 29 Mar 2020 04:18:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585480699; cv=none; d=google.com; s=arc-20160816; b=lfIKPqWY7dILr3q3PR011inSne2lXQba5SdDxMLgFitOw43hTSN9B4EJHs+7xcj6s2 p3Eaz/Rr+PzvV7LKrBZ4gvZHCIvTqvXLN6LbWKo8jzb9y8YfHiLd/cJvRcxuabh44juj vnKR89qEXp4BQVF+sVJCABaOsS0RCRXA/qePUywVI9fwmI1SaIyJPUjZKxviwB2ceuY4 3yiDr+14IHaFSyhwFvETDmlaiH2CZQi03DNWq6HWksgaWQ25hGWmh7CITDOs9rKUxUJq 2gkk8BLZkPMOnpvVuQVaJChAvrb7lr7gySZOwp9DXk6Ph6bmPWbcc1wfxwWYrT4J/Br4 EgQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=Xduv5DxW5w8Tq2Rz6Qt5yT3jTeuRsIz0VvRjqewUnWo=; b=mX2XxDHHWFKqf13tFKhFEHS/jm+eyylp/XR15Z4nA6FM1dsG/LpvFuBYDaeWzYtKHA xCp8aWOxjROsIMUPCu2rLx29LUAl6hpjEI1ldktSHsynmz7dYlRzX/dqXIfZ0KzG7e0e g80+2MTMLjxxvNvMzBBYWE/bl2B1ttNsJ2Ry52eXDZmw5/kfV7smOHEhkF/zN4pm8aOI 2Ovu/GdF0AQJ3I1SqiMsfZugm20wiO0++r3p8TSZ+roVv3Q/cVYUmTysF4PRqkY6NOAZ OmNNSdIJRfjQdEWSN+dVdtOfgU/fEmZV12v8yfVNmbx/UPUBXjQWn0R8EQ/LLD/84rAE Dv/A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l18si4439087oig.223.2020.03.29.04.18.04; Sun, 29 Mar 2020 04:18:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728092AbgC2LFJ (ORCPT + 99 others); Sun, 29 Mar 2020 07:05:09 -0400 Received: from metis.ext.pengutronix.de ([85.220.165.71]:42061 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727875AbgC2LFI (ORCPT ); Sun, 29 Mar 2020 07:05:08 -0400 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 1jIVkS-0006s2-Qt; Sun, 29 Mar 2020 13:05:00 +0200 Received: from ore by dude.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1jIVkQ-00015E-4v; Sun, 29 Mar 2020 13:04:58 +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 Subject: [PATCH v2] ARM: imx: allow to disable board specific PHY fixups Date: Sun, 29 Mar 2020 13:04:57 +0200 Message-Id: <20200329110457.4113-1-o.rempel@pengutronix.de> X-Mailer: git-send-email 2.26.0.rc2 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org All PHY fixups located in imx and mxs machine code are PHY and/or board specific. Never the less, they are applied to all boards independent on how related PHY is actually connected. As result: - we have boards with wrong PHY defaults which are not overwritten or not properly handled by PHY drivers. - Some PHY driver changes was never tested and bugs was never detected due the fixups. - Same PHY specific errata was fixed by SoC specific fixup, so the same issues should be investigated again after switching to different SoC on same board. Since removing this fixups will brake may existing boards, we'll provide a Kconfig option which can be used by kernel developers and system integrators. Signed-off-by: Oleksij Rempel --- arch/arm/mach-imx/mach-imx6q.c | 3 ++- arch/arm/mach-imx/mach-imx6sx.c | 3 ++- arch/arm/mach-imx/mach-imx7d.c | 3 ++- arch/arm/mach-mxs/mach-mxs.c | 3 ++- drivers/net/phy/Kconfig | 16 ++++++++++++++++ 5 files changed, 24 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c index edd26e0ffeec..aabf0d8c23a9 100644 --- a/arch/arm/mach-imx/mach-imx6q.c +++ b/arch/arm/mach-imx/mach-imx6q.c @@ -162,7 +162,8 @@ static int ar8035_phy_fixup(struct phy_device *dev) static void __init imx6q_enet_phy_init(void) { - if (IS_BUILTIN(CONFIG_PHYLIB)) { + if (IS_BUILTIN(CONFIG_PHYLIB) && + IS_BUILTIN(CONFIG_DEPRECATED_PHY_FIXUPS)) { 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, diff --git a/arch/arm/mach-imx/mach-imx6sx.c b/arch/arm/mach-imx/mach-imx6sx.c index d5310bf307ff..fdd9bef27625 100644 --- a/arch/arm/mach-imx/mach-imx6sx.c +++ b/arch/arm/mach-imx/mach-imx6sx.c @@ -35,7 +35,8 @@ static int ar8031_phy_fixup(struct phy_device *dev) #define PHY_ID_AR8031 0x004dd074 static void __init imx6sx_enet_phy_init(void) { - if (IS_BUILTIN(CONFIG_PHYLIB)) + if (IS_BUILTIN(CONFIG_PHYLIB) && + IS_BUILTIN(CONFIG_DEPRECATED_PHY_FIXUPS)) phy_register_fixup_for_uid(PHY_ID_AR8031, 0xffffffff, ar8031_phy_fixup); } diff --git a/arch/arm/mach-imx/mach-imx7d.c b/arch/arm/mach-imx/mach-imx7d.c index ebb27592a9f7..1d3d67c247a3 100644 --- a/arch/arm/mach-imx/mach-imx7d.c +++ b/arch/arm/mach-imx/mach-imx7d.c @@ -49,7 +49,8 @@ static int bcm54220_phy_fixup(struct phy_device *dev) static void __init imx7d_enet_phy_init(void) { - if (IS_BUILTIN(CONFIG_PHYLIB)) { + if (IS_BUILTIN(CONFIG_PHYLIB) && + IS_BUILTIN(CONFIG_DEPRECATED_PHY_FIXUPS)) { phy_register_fixup_for_uid(PHY_ID_AR8031, 0xffffffff, ar8031_phy_fixup); phy_register_fixup_for_uid(PHY_ID_BCM54220, 0xffffffff, diff --git a/arch/arm/mach-mxs/mach-mxs.c b/arch/arm/mach-mxs/mach-mxs.c index c109f47e9cbc..b4b631242080 100644 --- a/arch/arm/mach-mxs/mach-mxs.c +++ b/arch/arm/mach-mxs/mach-mxs.c @@ -257,7 +257,8 @@ static void __init apx4devkit_init(void) { enable_clk_enet_out(); - if (IS_BUILTIN(CONFIG_PHYLIB)) + if (IS_BUILTIN(CONFIG_PHYLIB) && + IS_BUILTIN(CONFIG_DEPRECATED_PHY_FIXUPS)) phy_register_fixup_for_uid(PHY_ID_KSZ8051, MICREL_PHY_ID_MASK, apx4devkit_phy_fixup); } diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig index 9dabe03a668c..f54428ddf058 100644 --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig @@ -249,6 +249,22 @@ config LED_TRIGGER_PHY Mbps OR Gbps OR link for any speed known to the PHY. +config DEPRECATED_PHY_FIXUPS + bool "Enable deprecated PHY fixups" + default y + ---help--- + In the early days it was common practice to configure PHYs by adding a + phy_register_fixup*() in the machine code. This practice turned out to + be potentially dangerous, because: + - it affects all PHYs in the system + - these register changes are usually not preserved during PHY reset + or suspend/resume cycle. + - it complicates debugging, since these configuration changes were not + done by the actual PHY driver. + This option allows to disable all fixups which are identified as + potentially harmful and give the developers a chance to implement the + proper configuration via the device tree (e.g.: phy-mode) and/or the + related PHY drivers. comment "MII PHY device drivers" -- 2.26.0.rc2