Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 141C4C43603 for ; Mon, 9 Dec 2019 15:19:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D87152077B for ; Mon, 9 Dec 2019 15:19:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="oy1pbdkq" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726888AbfLIPTr (ORCPT ); Mon, 9 Dec 2019 10:19:47 -0500 Received: from pandora.armlinux.org.uk ([78.32.30.218]:35548 "EHLO pandora.armlinux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726335AbfLIPTq (ORCPT ); Mon, 9 Dec 2019 10:19:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=s6T459SnT95vLOb60Er94Do1O4ZqrTnavwtfrNVVSyM=; b=oy1pbdkq0jS3hhSsfIxPjOzwrM U0N/ErsrXJqcrtg4+xHg85EpB9YVzNwqzZTdsyDR/+vgovkluLZ3Lfie91mECqV39/G/JwZIyGmgO rXTPgPUZ4LjYA/vsnRi+QXs/tN7SxjMCgUnEqEOHlASVS68XM/ZFpC2oFHhAm8Uvs3lCZFF1ytKVe lhg5fL1cN2L/mPn5Cc16aSgQdGYHAeyw3xDhzsbTT6S5mmrwjOHogO1QuC2QbLE3mFzS+Hww/yO8P oWk0kI1D2XKcywXsVM9oKJ/9pvmYlyfIA64F6quT+mZKVUSd377cnOHaT6MyufDEsAfGpgMuc5KS5 dMpxFxdg==; Received: from e0022681537dd.dyn.armlinux.org.uk ([2001:4d48:ad52:3201:222:68ff:fe15:37dd]:38192 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ieKos-0003rX-Tj; Mon, 09 Dec 2019 15:19:31 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1ieKoq-0004vp-2C; Mon, 09 Dec 2019 15:19:28 +0000 In-Reply-To: <20191209151553.GP25745@shell.armlinux.org.uk> References: <20191209151553.GP25745@shell.armlinux.org.uk> From: Russell King To: Andrew Lunn , Florian Fainelli , Heiner Kallweit Cc: "David S. Miller" , netdev@vger.kernel.org Subject: [PATCH net-next v2 12/14] net: phylink: make Broadcom BCM84881 based SFPs work MIME-Version: 1.0 Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="utf-8" Message-Id: Date: Mon, 09 Dec 2019 15:19:28 +0000 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The Broadcom BCM84881 does not appear to send the SGMII control word when operating in SGMII mode, which causes network adapters to fail to link with the PHY, or decide to operate at fixed 1G speed, even if the PHY negotiated 100M. Work around this by detecting the Broadcom BCM84881 and switch to phy mode rather than inband mode. Signed-off-by: Russell King --- drivers/net/phy/phylink.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index c3eda3800357..66b4357ccbda 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -1842,10 +1842,20 @@ static void phylink_sfp_link_up(void *upstream) phylink_run_resolve(pl); } +/* The Broadcom BCM84881 in the Methode DM7052 is unable to provide a SGMII + * or 802.3z control word, so inband will not work. + */ +static bool phylink_phy_no_inband(struct phy_device *phy) +{ + return phy->is_c45 && + (phy->c45_ids.device_ids[1] & 0xfffffff0) == 0xae025150; +} + static int phylink_sfp_connect_phy(void *upstream, struct phy_device *phy) { struct phylink *pl = upstream; phy_interface_t interface; + u8 mode; int ret; /* @@ -1857,9 +1867,13 @@ static int phylink_sfp_connect_phy(void *upstream, struct phy_device *phy) */ phy_support_asym_pause(phy); + if (phylink_phy_no_inband(phy)) + mode = MLO_AN_PHY; + else + mode = MLO_AN_INBAND; + /* Do the initial configuration */ - ret = phylink_sfp_config(pl, ML_AN_INBAND, phy->supported, - phy->advertising); + ret = phylink_sfp_config(pl, mode, phy->supported, phy->advertising); if (ret < 0) return ret; -- 2.20.1