Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp104744pxm; Fri, 25 Feb 2022 04:55:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJzKNgfCfgW3SVgaoPeSHdvWPBfMtrcL7kzwokWHLaIUcSJkd8WkHgfc1lTD9K7AnwS5Th5k X-Received: by 2002:a63:d63:0:b0:36c:670d:b6c9 with SMTP id 35-20020a630d63000000b0036c670db6c9mr6013788pgn.343.1645793738503; Fri, 25 Feb 2022 04:55:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645793738; cv=none; d=google.com; s=arc-20160816; b=FPW8Tzgu68I7Qflajqo2wdMVu6T+LY1f/zbWwxKHMxFDMAiF6E4XOKOh5uRjA9Kvoc YFH8sT6+jWK1A2rYLhrD+puVf5iBoPfNWQAkx+NREQRBCeVkdpTV29VjZ4Vr3aS/5to8 vo1mljA54DLGIuXgXzNufUljQvxERHF0/pGHCsj+LmXpWkzngRbdjBbTm32qUQT7t6f6 HsH/6AFFkwjAWc1oh2oxKy8xey1rhT4Ud5lEAzoaX8mQENeSrv2OyvtAynFj3BnwvGS+ TVPqXzMUIvWucNK+TB9zDic01rr8/DMrTPI8vnVIuvyYQzQW1pRFiFk69KFwbK4Gl71U PCqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:user-agent:references:in-reply-to :subject:cc:to:from:date:content-transfer-encoding:mime-version :dkim-signature; bh=t1caUnc7kqr4js1sXxxu1ImeMweeeOsre54LlQ8WC5Y=; b=AfQksLM9cWLTm7RAjjDMkGmfI71p+CKFP765/ySjHF2MuNEENAWS+rMdsbI4/R5RyP RuXSgJ8vtwrS+bVe6xACKdE1AsARcP35WkXcD897WhA+q2WiZE8ZkOOGT/QfxADljQ6H hVK9Um6YF1ZjgyDoayJqvRkkX+wpvT0WMzS8MkJQlyP1JSI2FRh+CEgjNdkZT58WK5My gdg4EPpNulDspfENOESJNsIvUBliLmeSJqPAA5+hd7HwG12JUggeMgAHGEWmr8PapKQC BVAqO/gyHLdoscZLGEEHGY7Hbqr6f4IzRwt4X99yRqzRuzaHeAFgPn+8xkyUjSUFPpDN PlUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=EqD98nxd; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d19-20020a056a0024d300b004e1b9a1ecadsi1825650pfv.53.2022.02.25.04.55.23; Fri, 25 Feb 2022 04:55:38 -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=pass header.i=@walle.cc header.s=mail2016061301 header.b=EqD98nxd; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240130AbiBYLa1 (ORCPT + 99 others); Fri, 25 Feb 2022 06:30:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234860AbiBYLaZ (ORCPT ); Fri, 25 Feb 2022 06:30:25 -0500 Received: from ssl.serverraum.org (ssl.serverraum.org [IPv6:2a01:4f8:151:8464::1:2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E3381AC2A4; Fri, 25 Feb 2022 03:29:53 -0800 (PST) Received: from ssl.serverraum.org (web.serverraum.org [172.16.0.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id E75092222E; Fri, 25 Feb 2022 12:29:50 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1645788591; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=t1caUnc7kqr4js1sXxxu1ImeMweeeOsre54LlQ8WC5Y=; b=EqD98nxdS5l5EzH7RPg1QjHexstlDrV4xLLLBCEuSu100BGC2GrX6bzjpgR/b8TUTcFufX KTqNLEr37Xf/11s8/KNUmc3I2/Fgd/B41+q2I5IsKu0OtCS6mytF9zgtRHCvMzNP1pOzgw eC0QHXXwTVjrHEMseHKakd7Vjp+yMX0= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 25 Feb 2022 12:29:50 +0100 From: Michael Walle To: Horatiu Vultur Cc: Lars Povlsen , Steen Hegelund , Linus Walleij , UNGLinuxDriver@microchip.com, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Colin Foster Subject: Re: [PATCH v1 5/5] pinctrl: microchip-sgpio: wait until output is actually set In-Reply-To: <20220225092427.jjilv3qo52crsmuw@soft-dev3-1.localhost> References: <20220224161021.2197263-1-michael@walle.cc> <20220224161021.2197263-6-michael@walle.cc> <20220225092427.jjilv3qo52crsmuw@soft-dev3-1.localhost> User-Agent: Roundcube Webmail/1.4.12 Message-ID: <2f8a215c67269d639290515931d10b78@walle.cc> X-Sender: michael@walle.cc X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE 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 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? On the sparx5 are there any peripheral who you would actually notice that the timing is off? 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. Could you also have a look at the other supported sgpio block, the ocelot and the luton? I don't have any register description of these. > 2. I remember that I have tried to fix this issue like this [1], but > unfortunetly that was never accepted. Is this something that is > worth > at looking at? That fix is at the wrong place. You'd need to fix every gpio user, no? Instead this tries to fix the controller. > > [1] > https://patchwork.ozlabs.org/project/linux-i2c/patch/20211103091839.1665672-3-horatiu.vultur@microchip.com/ -michael