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 DC233C19F2B for ; Thu, 4 Aug 2022 11:04:01 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 272DF84209; Thu, 4 Aug 2022 13:04:00 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org 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=kernel.org header.i=@kernel.org header.b="nL5WZESI"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B560A83FE9; Thu, 4 Aug 2022 13:03:57 +0200 (CEST) Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 2D8C0845C0 for ; Thu, 4 Aug 2022 13:03:55 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=pali@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EBD24616C4; Thu, 4 Aug 2022 11:03:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30D2FC433D6; Thu, 4 Aug 2022 11:03:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1659611033; bh=wGnIExef4H+Lnd/dEKkUgtpSXu/VNMGp7LW38oSjZcw=; h=From:To:Cc:Subject:Date:From; b=nL5WZESIHTgR4Uk5+rcGGFB8lI/uQEbcs1OupJ+f+kKCpxF/hUBlh97fSD7aXlFqr EU3x7O1uBzn4ZGeoVF3ZcnbXNPh2UsBAHko5D2Xi/xIgk7DDvCUyvttuvvz+eikCp9 UUdsDCBSFJaFNTseNqXIhZHd2I8+e3lTzDFOXah/e84fi7pr5MeAfHeeV/zKtis5D3 VOQyayb3sFNdo7RC5R7JT1mG2cnQqslbtXrhDO77MCiiiH3oi9evhC2vvvj99fwpHR fxSP7b3FgYS5q8Tcpd3cVmdSvhhPmj11stRIJFke2EnPlNuH+OPHOEcqQkoa/WLI7C x7hykKEzhN2FQ== Received: by pali.im (Postfix) id A30EE80A; Thu, 4 Aug 2022 13:03:50 +0200 (CEST) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: Stefan Roese , =?UTF-8?q?Marek=20Beh=C3=BAn?= , =?UTF-8?q?Pawe=C5=82=20Anikiel?= , Adrian Fiergolski , Simon Glass Cc: u-boot@lists.denx.de Subject: [PATCH] misc: atsha204a: Don't check for error when waking up the device Date: Thu, 4 Aug 2022 13:03:44 +0200 Message-Id: <20220804110344.24268-1-pali@kernel.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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.6 at phobos.denx.de X-Virus-Status: Clean The device ignores any levels or transitions on the SCL pin when the device is idle, asleep or during waking up. Linux kernel driver for atsha204a (atmel-sha204a.ko) also ignores return value from i2c wakeup send command, see: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/crypto/atmel-i2c.c?h=v5.19#n174 And also userspace Turris libatsha204 library ignores return value from wakeup send command, see: https://gitlab.nic.cz/turris/libatsha204/-/blob/v29.2/src/libatsha204/layer_ni2c.c#L75-76 U-Boot driver should do same thing. Fixes waking up ATSHA204 on Turris 1.x boards. Signed-off-by: Pali Rohár --- drivers/misc/atsha204a-i2c.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/misc/atsha204a-i2c.c b/drivers/misc/atsha204a-i2c.c index 81ecb5b6177b..fa2d5948f128 100644 --- a/drivers/misc/atsha204a-i2c.c +++ b/drivers/misc/atsha204a-i2c.c @@ -103,12 +103,13 @@ int atsha204a_wakeup(struct udevice *dev) for (try = 1; try <= 10; ++try) { debug("Try %i... ", try); + /* + * The device ignores any levels or transitions on the SCL pin + * when the device is idle, asleep or during waking up. + * Don't check for error when waking up the device. + */ memset(req, 0, 4); - res = atsha204a_send(dev, req, 4); - if (res) { - debug("failed on I2C send, trying again\n"); - continue; - } + atsha204a_send(dev, req, 4); udelay(ATSHA204A_TWLO_US + ATSHA204A_TWHI_US); -- 2.20.1