From mboxrd@z Thu Jan 1 00:00:00 1970 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=-3.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=no 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 1147DC2D0C0 for ; Sun, 22 Dec 2019 09:43:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DA8B92070A for ; Sun, 22 Dec 2019 09:43:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726162AbfLVJnQ (ORCPT ); Sun, 22 Dec 2019 04:43:16 -0500 Received: from guitar.tcltek.co.il ([192.115.133.116]:37068 "EHLO mx.tkos.co.il" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725899AbfLVJnQ (ORCPT ); Sun, 22 Dec 2019 04:43:16 -0500 Received: from tarshish (unknown [10.0.8.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx.tkos.co.il (Postfix) with ESMTPS id 852F544030A; Sun, 22 Dec 2019 11:43:12 +0200 (IST) References: <20191220142725.GB2458874@t480s.localdomain> User-agent: mu4e 1.2.0; emacs 26.1 From: Baruch Siach To: Vivien Didelot Cc: Andrew Lunn , Marek =?utf-8?Q?Beh=C3=BAn?= , netdev@vger.kernel.org, Denis Odintsov Subject: Re: [PATCH] net: dsa: mv88e6xxx: force cmode write on 6141/6341 In-reply-to: <20191220142725.GB2458874@t480s.localdomain> Date: Sun, 22 Dec 2019 11:43:12 +0200 Message-ID: <87r20w4rwv.fsf@tarshish> MIME-Version: 1.0 Content-Type: text/plain Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Hi Vivien, On Fri, Dec 20 2019, Vivien Didelot wrote: > On Thu, 19 Dec 2019 11:48:22 +0200, Baruch Siach wrote: >> mv88e6xxx_port_set_cmode() relies on cmode stored in struct >> mv88e6xxx_port to skip cmode update when the requested value matches the >> cached value. It turns out that mv88e6xxx_port_hidden_write() might >> change the port cmode setting as a side effect, so we can't rely on the >> cached value to determine that cmode update in not necessary. >> >> Force cmode update in mv88e6341_port_set_cmode(), to make >> serdes configuration work again. Other mv88e6xxx_port_set_cmode() >> callers keep the current behaviour. >> >> This fixes serdes configuration of the 6141 switch on SolidRun Clearfog >> GT-8K. >> >> Fixes: 7a3007d22e8 ("net: dsa: mv88e6xxx: fully support SERDES on Topaz family") >> Reported-by: Denis Odintsov >> Signed-off-by: Baruch Siach > > Andrew, > > We tend to avoid caching values in the mv88e6xxx driver the more we can and > query the hardware instead to avoid errors like this. We can consider calling a > new mv88e6xxx_port_get_cmode() helper when needed (e.g. in higher level callers > like mv88e6xxx_serdes_power() and mv88e6xxx_serdes_irq_thread_fn()) and pass > the value down to the routines previously accessing chip->ports[port].cmode, > as a new argument. I can prepare a patch doing this. What do you think? I'm not sure that cmode read would always give a valid value. On 6141 I see an invalid 0x6 value after mv88e6xxx_port_hidden_write(). As I understand, this cache elimination work would target v5.6+. Would you ack this patch for v5.5-rc to fix currently broken setup? Thanks, baruch -- http://baruch.siach.name/blog/ ~. .~ Tk Open Systems =}------------------------------------------------ooO--U--Ooo------------{= - baruch@tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -