Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp2144076pxm; Fri, 4 Mar 2022 10:10:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJz4hLZ/3dFY6D7uAxvcW0a7i4mcXX6tjPM2aB/6gI4MBQCXVs+eRTtZEEVtnLtKnzYNDumd X-Received: by 2002:a17:907:6d28:b0:6b8:1a4f:9eff with SMTP id sa40-20020a1709076d2800b006b81a4f9effmr33555716ejc.703.1646417410023; Fri, 04 Mar 2022 10:10:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646417410; cv=none; d=google.com; s=arc-20160816; b=Gt5aoILs33VuluQvMa/IEaPYPtTU+n/d4eXgjCutdHnsr1OL5yMk54xk+X5VaLjUoz eiP72AkMMeP4OSOnb5W1RK7mS1UIlJsj+S54z3Yqt/IR2j/gw/nQaNGoEJnwT5PPW/+B NoxWyfJ0NSB/0HNJ2NCVIuWnjBWySbaIs6M0X3gvsCLDwRZ1rnMHQWPOchSNx/xYkVnN HuHrkEEQlUHPSRaFeUKMOJkqjLa/l9JOLSHPb10VNNBHRb5F15NXeId1j5KTCpEStnEV 8ZRycqXM4PnOebqH4zTlUvpn05YsAy+3GL6Ol+xG5zZ5ahX+N4NE9j+KYBm7Udt8pP7k 5rWw== 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=dltIpB2nUhzsRC/sXicHQ9rU5qGjSlQ3XTO+C8tgyRg=; b=ttfBgksTQUG1MwOSHzmN+ie700jr3zPxbUJMFLaeyQD+urT1q732d7FiwRiKz/woEf dMwUHw4qqx+kUvemrnss/u4DZoCOMc78wXooWEZCskflICDLfqF7YINNhtJzBI6hgz5g i5Q4Bc7iYGInF3CXKQLkZ5E//+1NPwncmoYDa1669vq8MMJyCdkTL8084rksN/IFi2si DzcsD/Mhos95Z5pEhTJgEddSHE2aC+RVzKwrtPrWSdICTKoa72kZ6voAaeX6Vdsf9JSi PbTtEOyUmcwUbidAdrkuMdMAJwZJex6I2sg7s0Y4yVuenXA8gi/Dui44uMlTVV10vVVy 17mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@microchip.com header.s=mchp header.b=2LDYNPQ2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bx1-20020a0564020b4100b0041295c9096asi3694859edb.20.2022.03.04.10.09.45; Fri, 04 Mar 2022 10:10:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@microchip.com header.s=mchp header.b=2LDYNPQ2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236864AbiCDPMg (ORCPT + 99 others); Fri, 4 Mar 2022 10:12:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229517AbiCDPMf (ORCPT ); Fri, 4 Mar 2022 10:12:35 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3643C1C2F69; Fri, 4 Mar 2022 07:11:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1646406707; x=1677942707; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=fHlxRZZcpjsjTvmpnhwoxhUu7CXawq+gIe2yYQ7VRi8=; b=2LDYNPQ2WO1RdLm5d6d/+7gdf8tSe2vqVH6o7ejCosiba4Q6BB7CrNnd /rgCJsrYeJOFhTxLGpKVA1nyMmNdZenRRrV2R98oxhwDPOZ2BYPgLDLV4 5YMeRDK/V2f4RecaAmBkIpYI5+HD4AvSwVV3VXvmzBoQYoN9/nL2Bmybn XsDTGblt6Mstn4e1QzhDqGLCrSPOoHrzV8fqCH6pG3UXXTsQuCuy4NZin DaEG96nuwq8Dcg9f3aUYZGChaI9cnRjCQDuUbdax50+Bkd6KJotAYn2Bt Mt2SsgNz63nvo6GdvuFhNnyoDZkVUbdsboWnZasPdmGdKPk0t2qhPjTLq A==; X-IronPort-AV: E=Sophos;i="5.90,155,1643698800"; d="scan'208";a="155279457" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 04 Mar 2022 08:11:25 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Fri, 4 Mar 2022 08:11:25 -0700 Received: from localhost (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2375.17 via Frontend Transport; Fri, 4 Mar 2022 08:11:25 -0700 Date: Fri, 4 Mar 2022 16:14:15 +0100 From: Horatiu Vultur To: Michael Walle CC: Lars Povlsen , Steen Hegelund , Linus Walleij , , , , , Colin Foster Subject: Re: [PATCH v1 5/5] pinctrl: microchip-sgpio: wait until output is actually set Message-ID: <20220304151415.ypqye2hg7j26wy6z@soft-dev3-1.localhost> References: <20220224161021.2197263-1-michael@walle.cc> <20220224161021.2197263-6-michael@walle.cc> <20220225092427.jjilv3qo52crsmuw@soft-dev3-1.localhost> <2f8a215c67269d639290515931d10b78@walle.cc> <20220304120911.i5rngplg5l6gnnyy@soft-dev3-1.localhost> <40ccf0647d7ec0487f71f662eec80528@walle.cc> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline In-Reply-To: <40ccf0647d7ec0487f71f662eec80528@walle.cc> X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,T_SCC_BODY_TEXT_LINE, T_SPF_PERMERROR 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 The 03/04/2022 13:46, Michael Walle wrote: > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe > > Hi Horatiu, > > Am 2022-03-04 13:09, schrieb Horatiu Vultur: > > The 02/25/2022 12:29, Michael Walle wrote: > > > EXTERNAL EMAIL: Do not click links or open attachments unless you know > > > the content is safe > > > > > > Hi Horatiu, > > > > > > Am 2022-02-25 10:24, schrieb Horatiu Vultur: > > > > The 02/24/2022 17:10, Michael Walle wrote: > > > > > Right now, when a gpio value is set, the actual hardware pin gets set > > > > > asynchronously. When linux write the output register, it takes some > > > > > time > > > > > until it is actually propagated to the output shift registers. If that > > > > > output port is connected to an I2C mux for example, the linux driver > > > > > assumes the I2C bus is already switched although it is not. > > > > > > > > > > Fortunately, there is a single shot mode with a feedback: you can > > > > > trigger the single shot and the hardware will clear that bit once it > > > > > has > > > > > finished the clocking and strobed the load signal of the shift > > > > > registers. This can take a considerable amount of time though. > > > > > Measuremens have shown that it takes up to a whole burst cycle gap > > > > > which > > > > > is about 50ms on the largest setting. Therefore, we have to mark the > > > > > output bank as sleepable. To avoid unnecessary waiting, just trigger > > > > > the > > > > > single shot if the value was actually changed. > > > > > > > > I have tested this patch series on our lan9668 board and it worked > > > > fine. Thanks! > > > > > > Thanks for testing! > > > > > > > I just have few questions: > > > > 1. What about other boards/chips that have this sgpio, do they have > > > > also > > > > the same issue? Because from what I recall on sparx5 they don't have > > > > this issue. I have seen it only on lan9668. > > > > > > Unfortunatly, I don't have any knowledge what IP core is used in > > > which SoC. I assumed the lan9668 used the same as the sparx5. If > > > that is not the case, we need a new compatible. Do you know if it > > > the same? > > > > From what I see, it is the same IP. > > Good to know. > > > > On the sparx5 are there any peripheral who you would actually > > > notice that the timing is off? > > > > There are some SFP connected, similar to lan966x. So I don't understand > > why that issue is not seen there. > > Is there an I2C mux, too? It looks like also on sparx5 is an i2c mux[1]. The only difference is that is controlled by pinctrl and not by SGPIO. > Or just the SFP signals connected to > the SGPIO? What I was seeing is that during probing of the SFPs > the SFPs EEPROM is read and when the I2C mux is controlled by the > SGPIO it will switch too late - or even worse, in the middle of > a transaction. I would speculate the timing isn't that critical > with signals just connected directly to the SFP. > > In any case, I think it is pretty clear that it cannot work the > way it is right now, no? See the very next paragraph... Yes, I agree, this needs to be fixed. > > > > That being said, I'd assume all the serial gpio controller has > > > this "flaw". Simply because a register write won't block until the > > > value is shifted out to the shift register and actualy loaded by > > > strobing the load signal. It just depends on your burst setting > > > (even with bursts off, and clocking all the time) on how large > > > the delay is. So you might or might not notice it on a board. > > .. here > > -michael [1] https://elixir.bootlin.com/linux/v5.17-rc6/source/arch/arm64/boot/dts/microchip/sparx5_pcb134_board.dtsi#L404 -- /Horatiu