Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp7320432pxv; Fri, 30 Jul 2021 15:59:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwmyY6UvlVHCyY8iCKNJRFAVeU0ESN6hsm4GVw4NKp1OW9x2j9/kasFvnX/J+O6QDJMNz9S X-Received: by 2002:a02:2a88:: with SMTP id w130mr3877418jaw.60.1627685950537; Fri, 30 Jul 2021 15:59:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627685950; cv=none; d=google.com; s=arc-20160816; b=PMtD8AYhpkdyy+RvJUYF6H1B4NWSOdKnF8ltiRTwNzMuOCrNPDEd+e1W22P9nsSJuA wv/kwVCllBCI80IohJwQT3ZKf3DtNXc6hfjLeOK7a9h+ropLRLxVFw8Emd760o/4XyPl c7WANVSIVV/MstKU6JwOxvUhDN2mnztlnUcrntGybiCsVf9fFcY5e3k5cgEgObJPVBc/ XGn1bxuAFyAiqgPHSthWBo7Jxxv4q+xi7oa3LdvviGJwHF/88os8Ru4u6BP9w1yLxvsi mbMitmHhBA3QpryMEjwFvDXMx6vFZcNAMd4628yqWq6MXcaUdW7gOeOWGmOB/D9ZBt0I 1AAQ== 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 :dkim-signature; bh=YVFNv/nJzPFLIKlkRvy7UBoWXkQ2+gaA9RIm68msr/k=; b=KNcK9SOT3saxySbgRWXEDxZ27UcG6YhE52Ge6BKJyaSPV6PQKL4xpD6pHCwnYwE8zU epdU5qHtMNtMMn1//j0ECkinCcjQRMx2i4rMDD7xBvoqn2CUa9+qln98dAWuTQ/MF1mQ DH1wzanQWGjnVvlf2I3R9aqbtsx9uiLOJodEZV8d3hc9D9K2AOz8bYDqJ3fb8fGUQEWR qvE89ULbgtpaRyAQfGGOwNeeq7HYEqSZQt4q7ly4IiUQzQpTgR4h46ZJHJRMf2HPKavo ntddXHlTwCMac+93DeLqMIiEitZJU8DOUKV2MQNpcnKDtIDw+ltFrYm6VpB/w90DZZ7s t6dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@workware-net-au.20150623.gappssmtp.com header.s=20150623 header.b=NTj5WuC7; 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 i42si3366560jav.32.2021.07.30.15.58.59; Fri, 30 Jul 2021 15:59:10 -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; dkim=pass header.i=@workware-net-au.20150623.gappssmtp.com header.s=20150623 header.b=NTj5WuC7; 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 S233555AbhG3W6K (ORCPT + 99 others); Fri, 30 Jul 2021 18:58:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232817AbhG3W6J (ORCPT ); Fri, 30 Jul 2021 18:58:09 -0400 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B82EEC06175F for ; Fri, 30 Jul 2021 15:58:04 -0700 (PDT) Received: by mail-pj1-x1033.google.com with SMTP id mz5-20020a17090b3785b0290176ecf64922so22886167pjb.3 for ; Fri, 30 Jul 2021 15:58:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=workware-net-au.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YVFNv/nJzPFLIKlkRvy7UBoWXkQ2+gaA9RIm68msr/k=; b=NTj5WuC7VBzOEvsgIDQyhYVHPtwEDZMYcoRo53rEa1PGSDeWByZ2DAswqLVQbjYvTg YZzyHQEUXHqaHQSGnrZFD1LtNWDrJUt/a6cYq4GB/jpPCJXEBpCqbN1XxPI+tw8jTjBD z0sDFa3eETVYyp10gw8Fivmq+5SiQ1lNliIXZGJnUiPTBiBtPO7lXYfkgwAxKp0GhwKH 4BubNh1FJ+RCyMdT05YFDjyYVWXwSyHU1UjE9jZyqp6b+Cs59xnanSBV1W6ojuh7u4ko lJLhNED9IrtPZ/MWxI1hGUgw6pgYDM2CitXy4vZnhdX0nF0FGIJeEwQFoO8TiumkLrOd NImQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YVFNv/nJzPFLIKlkRvy7UBoWXkQ2+gaA9RIm68msr/k=; b=bFITZ/iE8dbrxUJWInM/ixRq9r3LTrO5izi1vzQkVSnqp12TWLQc2k0FfBANyNAQjN 1vLrUxyPYRKFDGQW8k9AOliq55pTDaHlYBQyhPl9TS7fVQUtRGsxJ0hjTKCb7LptV2Gv er7nbWzcKFrR6jXunMLL3Ud2XeCngDSdqq2H8XB/PMNpfPQYZhmMVcEKZpgdRlfdnVCH jb0PVtwGNDcoyJyMN9UvVDS10SM9I9w0aOYGiJEdhelUkLJ7m3Gheo539TzuXsAz//Bt VHdqvhsQ/MFK8kF++CZzhTQySh4ry/sphWsO3wx/xfo96ifIRzSCI/9roRj5uKxQKgAb /AQA== X-Gm-Message-State: AOAM5337+SmwWk7psAtS2pnAZhN8noS90XUvBy2DRAKOvDi0cC8LoY3Q U3eKiiN9vrdcDeyQzgTeQDM/pA== X-Received: by 2002:a63:ff4d:: with SMTP id s13mr2849739pgk.237.1627685884319; Fri, 30 Jul 2021 15:58:04 -0700 (PDT) Received: from workware.net.au (117-20-69-228.751445.bne.nbn.aussiebb.net. [117.20.69.228]) by smtp.gmail.com with ESMTPSA id w3sm3389178pjq.12.2021.07.30.15.58.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Jul 2021 15:58:03 -0700 (PDT) From: Steve Bennett To: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, andrew@lunn.ch, hkallweit1@gmail.com, linux@armlinux.org.uk, davem@davemloft.net, kuba@kernel.org, marex@denx.de Cc: Steve Bennett Subject: [PATCH v2] net: phy: micrel: Fix detection of ksz87xx switch Date: Sat, 31 Jul 2021 08:57:50 +1000 Message-Id: <20210730225750.98849-1-steveb@workware.net.au> X-Mailer: git-send-email 2.24.2 (Apple Git-127) In-Reply-To: <20210730105120.93743-1-steveb@workware.net.au> References: <20210730105120.93743-1-steveb@workware.net.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The logic for discerning between KSZ8051 and KSZ87XX PHYs is incorrect such that the that KSZ87XX switch is not identified correctly. ksz8051_ksz8795_match_phy_device() uses the parameter ksz_phy_id to discriminate whether it was called from ksz8051_match_phy_device() or from ksz8795_match_phy_device() but since PHY_ID_KSZ87XX is the same value as PHY_ID_KSZ8051, this doesn't work. Instead use a bool to discriminate the caller. Without this patch, the KSZ8795 switch port identifies as: ksz8795-switch spi3.1 ade1 (uninitialized): PHY [dsa-0.1:03] driver [Generic PHY] With the patch, it identifies correctly: ksz8795-switch spi3.1 ade1 (uninitialized): PHY [dsa-0.1:03] driver [Micrel KSZ87XX Switch] Fixes: 8b95599c55ed24b36cf4 ("net: phy: micrel: Discern KSZ8051 and KSZ8795 PHYs") Signed-off-by: Steve Bennett --- drivers/net/phy/micrel.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index 4d53886f7d51..53bdd673ae56 100644 --- a/drivers/net/phy/micrel.c +++ b/drivers/net/phy/micrel.c @@ -401,11 +401,11 @@ static int ksz8041_config_aneg(struct phy_device *phydev) } static int ksz8051_ksz8795_match_phy_device(struct phy_device *phydev, - const u32 ksz_phy_id) + const bool ksz_8051) { int ret; - if ((phydev->phy_id & MICREL_PHY_ID_MASK) != ksz_phy_id) + if ((phydev->phy_id & MICREL_PHY_ID_MASK) != PHY_ID_KSZ8051) return 0; ret = phy_read(phydev, MII_BMSR); @@ -418,7 +418,7 @@ static int ksz8051_ksz8795_match_phy_device(struct phy_device *phydev, * the switch does not. */ ret &= BMSR_ERCAP; - if (ksz_phy_id == PHY_ID_KSZ8051) + if (ksz_8051) return ret; else return !ret; @@ -426,7 +426,7 @@ static int ksz8051_ksz8795_match_phy_device(struct phy_device *phydev, static int ksz8051_match_phy_device(struct phy_device *phydev) { - return ksz8051_ksz8795_match_phy_device(phydev, PHY_ID_KSZ8051); + return ksz8051_ksz8795_match_phy_device(phydev, true); } static int ksz8081_config_init(struct phy_device *phydev) @@ -535,7 +535,7 @@ static int ksz8061_config_init(struct phy_device *phydev) static int ksz8795_match_phy_device(struct phy_device *phydev) { - return ksz8051_ksz8795_match_phy_device(phydev, PHY_ID_KSZ87XX); + return ksz8051_ksz8795_match_phy_device(phydev, false); } static int ksz9021_load_values_from_of(struct phy_device *phydev, -- 2.24.2 (Apple Git-127)