Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp246627iob; Mon, 2 May 2022 18:25:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxjIHNpDrxSXY0yR1+c+HjLrFedRyM7CeGlV/Q8NovKvw88P0PLJsm0804vi+sWo+98UZGn X-Received: by 2002:a17:902:edc5:b0:156:68e4:416 with SMTP id q5-20020a170902edc500b0015668e40416mr14314496plk.87.1651541119375; Mon, 02 May 2022 18:25:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651541119; cv=none; d=google.com; s=arc-20160816; b=qkWV8r7IXgjOhxUZ80D2aQ/3MwRjC2y63yDRC0FwE6DFER3n+T7uzLKyMM4YLprCq3 WuACrrqm4jT/4NyDmlaubpBZ6WcYR9mW4gsIJcmJkFuNQVNxHdJDE+Fvt8wnqkdZK5Rr x1ULQHe6lMq4jNmiPSv5pQ6US1ka374gVZoeNYv2jvGjzmC4dj06AqtGvI7KtMJL2a4y oeScWO5e2ySU/fh2U9pobf9ZtHHzCVRwWGykc7hL4MR7huYuQkviuUl2Ylq21k+mS6MD h/aa7goVk9sMUWJLxt4lWfA14vrQHoipoqyOcRVtg0vCbpEfJgfGZhoGc7PSoo3Fva4B vEZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :message-id:date:subject:cc:from:dkim-signature; bh=NCEj5GMAzzn+PrpVx+OQFAucjbV/+hpyT4Q10dBlXEU=; b=n0LyCu309IynWLMDSmHXyP2BtcUZE9GzmK4FLpuGnilVMor60wkciaVMzXm4hj9E4P BXLHDzfgV7vSBkrjk2GwMf5Fw+XKcd5GZJOLicUQYl7v6vN5TkzhSrPz4Fp4SMSqFs8q mJ408OaZfiV7ccdsu9J7nCWOTeqORfkT0uOqsZUWH2NoXcBD0dDHv0qp92RweCooKt6s AZpE2/EscSqU+pUuTVZgXxdsiYjRxnHInX9hEAFTMkKFoLdkkiQO2KlQ5albPHm3OTPM WqZJxwYodR9bx4DVbHai+SW9pnYY7cDaOefx4tLms9a1p9YS3FpvYBN66UUsG2j9t5vF Iibg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20210112 header.b=LWsRTqbs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id h70-20020a638349000000b003c219413b58si4214887pge.598.2022.05.02.18.25.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 May 2022 18:25:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20210112 header.b=LWsRTqbs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EB6F169CE5; Mon, 2 May 2022 18:04:15 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232769AbiEBWgz (ORCPT + 99 others); Mon, 2 May 2022 18:36:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345562AbiEBWgy (ORCPT ); Mon, 2 May 2022 18:36:54 -0400 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78271101C5; Mon, 2 May 2022 15:33:21 -0700 (PDT) Received: by mail-wr1-x42a.google.com with SMTP id k2so21194062wrd.5; Mon, 02 May 2022 15:33:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=NCEj5GMAzzn+PrpVx+OQFAucjbV/+hpyT4Q10dBlXEU=; b=LWsRTqbs1XNCflqZ21mUl3rc0f8DxhKJqSu+tqf6Vz72OyAwDqIwup6swLoyMW1tw6 PRUP5y82v9AKO7H+ZY7qYabv0VWd9XTIrlqf1CFKZv5rUvPTPFPaOBPd6oAvTTmleyQ1 mpO0pXHfgkv7W7oKa1fRe7waTVbVAHxv6RMluypQyHEzV463uIuqn6KXZhiiE4Pc+mIG kzFZ0TCz4waoQQAKwvBuJ8kW0QkFwLYs4vGtCgy2cwxfhlPqXnOPTaAULc7DHOeEL4Vz fOIxgupb1io7kfcJzkTQVC7BWUabG3kduYhwLTkbmSuYvJ0LmriTF50NKwo9na1aXg/m bCIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=NCEj5GMAzzn+PrpVx+OQFAucjbV/+hpyT4Q10dBlXEU=; b=7n0CHecF6ngTBCaVt/ibVPV6HTA0F+YhaQjo8BXfuKAY/oEs623K8txtGe/zK/uJsM d5FXFi8ci5++NFXk/zKEx4pKImbC5MbkiiWYWxZJT94GLt/LXuGQO1oVjUrUEL6dp9Oz 56CocnxN87t4hILLpQvM4w0MoKa+gueBdU7Jpp1j8e5LIOYGNCzycYl/LPQdjM1qVGrD 4TL3mZ9cFiBZ4/TU2X8ogroOSqicwDy84GS+S7ZF/VBBOtKEkt2VFSOmnk1b1Zz6VEBC NFePfoh+FN+v8BPZybbjPfk5MnqDzBes8BlnoXvNHC86gtloBJN8Px4kjqgf2NyibgGr 7XYA== X-Gm-Message-State: AOAM530XU/QQ5SUTuHo1OJeGvtrpIUxY4/PuM41sWxhDXiMwYUlca1bK 2qqCfYd6coBCqNnLRTbIYB0= X-Received: by 2002:adf:d1ec:0:b0:20c:61ef:93b6 with SMTP id g12-20020adfd1ec000000b0020c61ef93b6mr5704971wrd.694.1651530799883; Mon, 02 May 2022 15:33:19 -0700 (PDT) Received: from localhost.localdomain ([2603:c020:c001:7eff:ffff:ffff:ffff:ff00]) by smtp.googlemail.com with ESMTPSA id bh19-20020a05600c3d1300b003942a244f45sm346682wmb.30.2022.05.02.15.33.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 May 2022 15:33:19 -0700 (PDT) From: Matthew Hagan Cc: Matthew Hagan , Russell King , Andrew Lunn , Heiner Kallweit , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] net: sfp: Add tx-fault workaround for Huawei MA5671A SFP ONT Date: Mon, 2 May 2022 23:33:15 +0100 Message-Id: <20220502223315.1973376-1-mnhagan88@gmail.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,SPOOFED_FREEMAIL_NO_RDNS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As noted elsewhere, various GPON SFP modules exhibit non-standard TX-fault behaviour. In the tested case, the Huawei MA5671A, when used in combination with a Marvell mv88e6085 switch, was found to persistently assert TX-fault, resulting in the module being disabled. This patch adds a quirk to ignore the SFP_F_TX_FAULT state, allowing the module to function. Change from v1: removal of erroneous return statment (Andrew Lunn) Signed-off-by: Matthew Hagan --- drivers/net/phy/sfp.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c index 4dfb79807823..9a5d5a10560f 100644 --- a/drivers/net/phy/sfp.c +++ b/drivers/net/phy/sfp.c @@ -250,6 +250,7 @@ struct sfp { struct sfp_eeprom_id id; unsigned int module_power_mW; unsigned int module_t_start_up; + bool tx_fault_ignore; #if IS_ENABLED(CONFIG_HWMON) struct sfp_diag diag; @@ -1956,6 +1957,12 @@ static int sfp_sm_mod_probe(struct sfp *sfp, bool report) else sfp->module_t_start_up = T_START_UP; + if (!memcmp(id.base.vendor_name, "HUAWEI ", 16) && + !memcmp(id.base.vendor_pn, "MA5671A ", 16)) + sfp->tx_fault_ignore = true; + else + sfp->tx_fault_ignore = false; + return 0; } @@ -2409,7 +2416,10 @@ static void sfp_check_state(struct sfp *sfp) mutex_lock(&sfp->st_mutex); state = sfp_get_state(sfp); changed = state ^ sfp->state; - changed &= SFP_F_PRESENT | SFP_F_LOS | SFP_F_TX_FAULT; + if (sfp->tx_fault_ignore) + changed &= SFP_F_PRESENT | SFP_F_LOS; + else + changed &= SFP_F_PRESENT | SFP_F_LOS | SFP_F_TX_FAULT; for (i = 0; i < GPIO_MAX; i++) if (changed & BIT(i)) -- 2.27.0