Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp2870843rdh; Wed, 27 Sep 2023 15:50:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGAAgYPE4kRbRcdIexqPw/IRnixN6jefgoOapI7LDjpxA7yeOCjFlNLG2fVZXqcS9/H8Ief X-Received: by 2002:adf:e3c6:0:b0:321:6dc9:14d4 with SMTP id k6-20020adfe3c6000000b003216dc914d4mr3031141wrm.19.1695855019050; Wed, 27 Sep 2023 15:50:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695855019; cv=none; d=google.com; s=arc-20160816; b=MAulOrzD0S+kNP19wnv7znh8Ivfa6MhMgkx3JC0X8UF8ZxW0HEOvZmuOwey8Wu2myB IF8r4Px6ocXwO+NJtcW6I2ALkjdPXqcw6J7CMxNfaiz9TnZnpfo8z1YG5IN5+wGa6Aot +OWMS2d3K6gT37J+/IRI9FSlkvAIqmPLEq4qD57gzr4DJro960+kJAoDmcVqDSdjEOb6 lA6uMgPQwsVoQHIT2Vt5ym67w3TlS7FL3r9S3GpsiymD7VnK5Mh4d1YsqiCaOfp4d+zU JD3m1ZpvVhpZeLWl4UJS2Zht+lJsW+4mr0uH3a/VjtIbY0r5ZOVsKBdMfWOATQZ68joR RiHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=d5tO3SJe0PbhXSHcNIaSFxP5tmPTcC6s9xX4wQoAzZ0=; fh=HQxI4R1lWofH+HlUaLjwPlnUyVoz0rfrFd6xk9Sh/Yo=; b=VWN/ZdY6TCvqQIGm47Fq2lXPjFs7TWvgBkmcgA7F2t9JDwbryldSxuhaCGGwBQQs1m jKOL8pL+gqlGzRlmwshV+9zEoORJ/MU+gadJ0uBiA37bUpL29UyGRAgUPzdtJXnOrzfA /cSfJ0GKnLgA1sLFkeqREOK8T4kvDeRtJAoeNkyixCsGF7pCsE+BL2OSY9KFyjzsXmsU zsbbNEC+Rkil+w5LsVYApy9wxiYhkYuPl08jrtaN4iSNAdVw2Ih2WvQ8da0LxDY1AUET 2nh3mt3wEgmA5LJgt/qmfdVb3lnRfvGU+6UeLHBBqo7O3ycDAkmjHQjw9kzR40f0XYXR deOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=ZablrPU2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id j19-20020a170906051300b009a586694dabsi14025546eja.950.2023.09.27.15.50.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 15:50:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=ZablrPU2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 9197B802D465; Wed, 27 Sep 2023 05:13:14 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231625AbjI0MNJ (ORCPT + 99 others); Wed, 27 Sep 2023 08:13:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231628AbjI0MM6 (ORCPT ); Wed, 27 Sep 2023 08:12:58 -0400 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A270CE5; Wed, 27 Sep 2023 05:12:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=d5tO3SJe0PbhXSHcNIaSFxP5tmPTcC6s9xX4wQoAzZ0=; b=ZablrPU2QM8KpWRjlgYITy1Ms6 Qh21MIe3GVHTRiYyahZs34c2IRIM0yVs4mCf2Dbe3m8oWACYw2839DrDwpLotGLIzRPyjA2m5Y9Ah C4Nvtp4I9EMvxnpBLXFKrtEN5txZh59RL6soVOvpFDtPz3WXtWMqclIgPUYqdPduoh6I=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1qlTPD-007dgP-5g; Wed, 27 Sep 2023 14:12:39 +0200 Date: Wed, 27 Sep 2023 14:12:39 +0200 From: Andrew Lunn To: Fabio Estevam Cc: kuba@kernel.org, f.fainelli@gmail.com, olteanv@gmail.com, davem@davemloft.net, edumazet@google.com, pabeni@redhat.com, l00g33k@gmail.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Fabio Estevam , Florian Fainelli Subject: Re: [PATCH v3 net] net: dsa: mv88e6xxx: Avoid EEPROM timeout when EEPROM is absent Message-ID: <3f3acf78-f4be-47ff-a976-b60b327c2c28@lunn.ch> References: <20230922124741.360103-1-festevam@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230922124741.360103-1-festevam@gmail.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Wed, 27 Sep 2023 05:13:14 -0700 (PDT) On Fri, Sep 22, 2023 at 09:47:41AM -0300, Fabio Estevam wrote: > From: Fabio Estevam > > Since commit 23d775f12dcd ("net: dsa: mv88e6xxx: Wait for EEPROM done > before HW reset") the following error is seen on a imx8mn board with > a 88E6320 switch: > > mv88e6085 30be0000.ethernet-1:00: Timeout waiting for EEPROM done > > This board does not have an EEPROM attached to the switch though. > > This problem is well explained by Andrew Lunn: > > "If there is an EEPROM, and the EEPROM contains a lot of data, it could > be that when we perform a hardware reset towards the end of probe, it > interrupts an I2C bus transaction, leaving the I2C bus in a bad state, > and future reads of the EEPROM do not work. > > The work around for this was to poll the EEInt status and wait for it > to go true before performing the hardware reset. > > However, we have discovered that for some boards which do not have an > EEPROM, EEInt never indicates complete. As a result, > mv88e6xxx_g1_wait_eeprom_done() spins for a second and then prints a > warning. > > We probably need a different solution than calling > mv88e6xxx_g1_wait_eeprom_done(). The datasheet for 6352 documents the > EEPROM Command register: > > bit 15 is: > > EEPROM Unit Busy. This bit must be set to a one to start an EEPROM > operation (see EEOp below). Only one EEPROM operation can be > executing at one time so this bit must be zero before setting it to > a one. When the requested EEPROM operation completes this bit will > automatically be cleared to a zero. The transition of this bit from > a one to a zero can be used to generate an interrupt (the EEInt in > Global 1, offset 0x00). > > and more interesting is bit 11: > > Register Loader Running. This bit is set to one whenever the > register loader is busy executing instructions contained in the > EEPROM." > > Change to using mv88e6xxx_g2_eeprom_wait() to fix the timeout error > when the EEPROM chip is not present. > > Fixes: 23d775f12dcd ("net: dsa: mv88e6xxx: Wait for EEPROM done before HW reset") > Suggested-by: Andrew Lunn > Signed-off-by: Fabio Estevam > Reviewed-by: Florian Fainelli Reviewed-by: Andrew Lunn Andrew