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 Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A4FC3C88CB2 for ; Mon, 12 Jun 2023 20:17:05 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8FB0C8206E; Mon, 12 Jun 2023 22:17:02 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="AeuHjcrY"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 079E18613D; Mon, 12 Jun 2023 22:17:00 +0200 (CEST) Received: from mail-io1-xd34.google.com (mail-io1-xd34.google.com [IPv6:2607:f8b0:4864:20::d34]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 220CC8206E for ; Mon, 12 Jun 2023 22:16:57 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=cfsworks@gmail.com Received: by mail-io1-xd34.google.com with SMTP id ca18e2360f4ac-777a4926555so175649039f.0 for ; Mon, 12 Jun 2023 13:16:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686601016; x=1689193016; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=1wPY3AVv3eH16yWWIFe7scEPQeLQ5YGRuk7soi9Us/Y=; b=AeuHjcrY08l0kVNOd9oPzBwOk87/GHWmWF34vqDBhgLxw5l5LK8prDv+fgxahH1W2Z xGn2CIW78nNX2BVx9JzZlu6UURGhLgi3m3ZoED0x9T66mAe7nY2EVnsa0iE++9OJgZJb tV+iig0pKgXlsqK2KRGJIFK7YV7acGcXi0p91WO0PloPDKkVsw7+y7DMhBSYSVdmFb7a BrDijlnTfbj+jFG3LPEFKd0QTaOaXMZw2q1cKB83y/Os/k7Drt+TQc9SGg1NCVinCgEq L0d96tepjzPsDXfKqSk3SvnKU800CecIvr4gLneXAspgv/FmSAWDOitusyrYtwkMh3jL gFkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686601016; x=1689193016; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=1wPY3AVv3eH16yWWIFe7scEPQeLQ5YGRuk7soi9Us/Y=; b=YSxe0NyXWvEG35gvWgUwUfllI+A5nWYGh9PfA2lw3JYEthmm85F+akjyMi/KDYLKIh 7hq9GUtZzGLE8uRGthpKZfUEexXBEJunXoLr/TiKSLjP7Ymy7HFw0CtqbuT4r+g4gCp7 Jt5zbmBuheHlhPXoLSlDI+QULbyZ4EuPUyZ5iv4daxEisZCwrrjSTIjfyjo/GCdi7rE1 n8E8G+73A6SNbZHg8r0jF/M+CR2s6ROEEWrXpp8UFREG8ig81RqtESAGYIQvDUj4Wmri jCvHBLVL+PCMtE32pgX8cfeZKykUzU62Z8szesWOuqKRiDnWRMRSvRcliaCgm0+aRtS0 88wQ== X-Gm-Message-State: AC+VfDzscZfKezI+7//72ziINMxR0oZofR2KHL74tNtqaCqkQ9pOslf9 fCLlBQUKd8CI48cQijoqbFHXk4U/rTQOw4kZ X-Google-Smtp-Source: ACHHUZ7u/cM0mQ9QeOOBsn9VzZxbZenOjdUzkCjtGo4/YJSnQBO+y2aLIOPk5gkq2EReo+PrvWNhig== X-Received: by 2002:a6b:8d83:0:b0:777:b45a:8bea with SMTP id p125-20020a6b8d83000000b00777b45a8beamr9766546iod.9.1686601015755; Mon, 12 Jun 2023 13:16:55 -0700 (PDT) Received: from ?IPV6:2001:470:42c4:101:857:833a:c057:fc99? ([2001:470:42c4:101:857:833a:c057:fc99]) by smtp.gmail.com with ESMTPSA id r23-20020a056638101700b0040fbb3bd38csm3041828jab.145.2023.06.12.13.16.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 12 Jun 2023 13:16:55 -0700 (PDT) Message-ID: Date: Mon, 12 Jun 2023 14:16:54 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [RFC PATCH] i2c: mvtwsi: reinitialize controller to clear bus errors Content-Language: en-US To: hs@denx.de, u-boot@lists.denx.de Cc: Stefan Roese References: <20230610061500.119123-1-CFSworks@gmail.com> <1bf44310-1d33-79fd-a116-578c8b5c47ce@denx.de> From: Sam Edwards In-Reply-To: <1bf44310-1d33-79fd-a116-578c8b5c47ce@denx.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Hey there Heiko, On 6/12/23 06:35, Heiko Schocher wrote: > I have not the deep knowledge of this specific i2c driver, but may > also an option is to set > > int (*deblock)(struct udevice *bus); > > in > > static const struct dm_i2c_ops mvtwsi_i2c_ops = { > > for this driver and do there the stuff needed to deblock the bus, > as you have done in twsi_i2c_reinit() in your patch? I'm not sure that this is a good fit. The comment explaining deblock says this is for situations where "Resetting the I2C master does not help. The only way is to force the bus through a series of transitions to make sure that all slaves are done with the transaction." Which reads to me like it's for situations where some slave is holding down SDA (making it impossible for us to send a start/stop) and several SCL pulses are required in order to shake it loose. In this case, the *bus* is okay and the *master* is upset (ironically, I think, because the Realtek just did its own "deblock" equivalent), so a master reset is really all that's required here. We also know the specific state that it runs off to, so it's easy to detect this situation and resolve it. > Currently this deblock function is only used from i2c core in > i2c command, but may it makes sense to add in dm_i2c_xfer function in > > drivers/i2c/i2c-uclass.c > > a call to i2c_deblock() in case bus is blocked? I wouldn't object to such a change, but since deblock is an "active" operation that might have side effects, this probably needs a bigger discussion (beyond what I'm trying to do here) since other users might be unhappy about this happening without their explicit say-so. Thanks for your feedback, Sam