From patchwork Tue Jun 23 06:31:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 279757 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B7B96C433DF for ; Tue, 23 Jun 2020 06:35:06 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 81FA2206B7 for ; Tue, 23 Jun 2020 06:35:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DcOW2iG3" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 81FA2206B7 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:48730 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jncWP-0002H6-Gv for qemu-devel@archiver.kernel.org; Tue, 23 Jun 2020 02:35:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44076) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jncSz-00065L-Kl; Tue, 23 Jun 2020 02:31:33 -0400 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:38424) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jncSy-0008J5-0w; Tue, 23 Jun 2020 02:31:33 -0400 Received: by mail-wm1-x341.google.com with SMTP id f18so1921861wml.3; Mon, 22 Jun 2020 23:31:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LTOxNe5hVvJd7RdtO7PCzxTxXTp7qC8fY58BTaDRB40=; b=DcOW2iG3Nl1eQsPhhRK9Jksz4FGA4EtedNc1lUPij9anzxtzIaIIaOrJvNUjPYVVEh sAd/Ih/nB/NbNlKJB1T9Atk4edbxeWY3xnjfmfo2SuoYmk+MMvt4nxGMmFyfuePYDvYm Df/D7FvSAmIpO6amByVwvDa8tqwMbH96tTMECnZWsPetVSAoVkdxZkBj66QJUQcx8R67 fkpjg7g+A51dZ5NWzUtfilJMoKhJXcb0FgXwXwGI8oFY4gXmMEi5tfl48BWyhe/FvJ7V PodIKMYDOsyrzMaw0jj5h281lfa7iwg3I7DtEu/YedeqhjQ07/j60QNnlw2XDn2tB+G+ u6Cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=LTOxNe5hVvJd7RdtO7PCzxTxXTp7qC8fY58BTaDRB40=; b=Z9sxm7d/6DBiJ09q03GnQbjA1PFLAAILb03e+TrLOUWfUIZvSyWrZveUMZStihp4C5 kVHMhAx+Lo7TFAPXtgIhhb3gjxnartHwx2KLbaG/os2V8giu0teupa6R3evsWe0arQOz W/gBGnKldeaAsMSmRtuQX3aMf9szZQVn2MVXRK9IjAho8D6f32rUjWgTkxnVSfidPgMH e1hMnauXDmjJtWL+wiRRia3hmS18L42U7gwMGuVU2vSKpmQsbIMvfCBeKG6s25YymY2x 6FuJ3zHXRP2nEZLTHddelQjyL14k8SrHtuS2QezhbNRuHhJW1wz3Na4IoFfDgkM44JNf 9/UQ== X-Gm-Message-State: AOAM531K1QktQB6n7P/+2u49h0+ejBS2/MBcZ1YU3p6yiUkQIOJj2RmN PTw7ezu0caECi4ai4+WIbPob3OjE X-Google-Smtp-Source: ABdhPJxBu9/a+0p/hd/brJ0NXC3DhelpS6yVWpse2dQkJks3tGJNbsNBaLEBfM1EzPws2FE9zVcy4A== X-Received: by 2002:a1c:55c4:: with SMTP id j187mr20471342wmb.120.1592893889940; Mon, 22 Jun 2020 23:31:29 -0700 (PDT) Received: from localhost.localdomain (1.red-83-51-162.dynamicip.rima-tde.net. [83.51.162.1]) by smtp.gmail.com with ESMTPSA id x205sm2407188wmx.21.2020.06.22.23.31.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jun 2020 23:31:29 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, BALATON Zoltan Subject: [RFC PATCH v2 3/3] hw/misc/auxbus: Fix MOT/classic I2C mode Date: Tue, 23 Jun 2020 08:31:23 +0200 Message-Id: <20200623063123.20776-4-f4bug@amsat.org> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200623063123.20776-1-f4bug@amsat.org> References: <20200623063123.20776-1-f4bug@amsat.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::341; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-x341.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: 0 X-Spam_score: 0.0 X-Spam_bar: / X-Spam_report: (0.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=1, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Corey Minyard , Peter Maydell , Alistair Francis , =?utf-8?q?Philippe_Mathieu?= =?utf-8?q?-Daud=C3=A9?= , qemu-ppc@nongnu.org, Frederic Konrad , David Gibson Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Since its introduction in commit 6fc7f77fd2 i2c_start_transfer() uses incorrectly the direction of the transfer. Fix it now. Fixes: 6fc7f77fd2 ("introduce aux-bus") Reported-by: BALATON Zoltan Suggested-by: BALATON Zoltan Signed-off-by: Philippe Mathieu-Daudé --- RFC because untested (probably never was anyway) Cc: Frederic Konrad Cc: Alistair Francis Cc: Peter Maydell --- hw/misc/auxbus.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/misc/auxbus.c b/hw/misc/auxbus.c index cef0d0d6d0..dc4a5dd10d 100644 --- a/hw/misc/auxbus.c +++ b/hw/misc/auxbus.c @@ -141,7 +141,7 @@ AUXReply aux_request(AUXBus *bus, AUXCommand cmd, uint32_t address, i2c_end_transfer(i2c_bus); } - if (i2c_start_transfer(i2c_bus, address, is_write)) { + if (i2c_start_transfer(i2c_bus, address, !is_write)) { ret = AUX_I2C_NACK; break; } @@ -172,7 +172,7 @@ AUXReply aux_request(AUXBus *bus, AUXCommand cmd, uint32_t address, /* * No transactions started.. */ - if (i2c_start_transfer(i2c_bus, address, is_write)) { + if (i2c_start_transfer(i2c_bus, address, !is_write)) { break; } } else if ((address != bus->last_i2c_address) || @@ -181,7 +181,7 @@ AUXReply aux_request(AUXBus *bus, AUXCommand cmd, uint32_t address, * Transaction started but we need to restart.. */ i2c_end_transfer(i2c_bus); - if (i2c_start_transfer(i2c_bus, address, is_write)) { + if (i2c_start_transfer(i2c_bus, address, !is_write)) { break; } }