All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: qemu-devel@nongnu.org, BALATON Zoltan <balaton@eik.bme.hu>
Cc: "Corey Minyard" <cminyard@mvista.com>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Alistair Francis" <alistair@alistair23.me>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	qemu-ppc@nongnu.org, "Frederic Konrad" <konrad@adacore.com>,
	"David Gibson" <david@gibson.dropbear.id.au>
Subject: [RFC PATCH v2 3/3] hw/misc/auxbus: Fix MOT/classic I2C mode
Date: Tue, 23 Jun 2020 08:31:23 +0200	[thread overview]
Message-ID: <20200623063123.20776-4-f4bug@amsat.org> (raw)
In-Reply-To: <20200623063123.20776-1-f4bug@amsat.org>

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 <balaton@eik.bme.hu>
Suggested-by: BALATON Zoltan <balaton@eik.bme.hu>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
RFC because untested (probably never was anyway)
Cc: Frederic Konrad <konrad@adacore.com>
Cc: Alistair Francis <alistair@alistair23.me>
Cc: Peter Maydell <peter.maydell@linaro.org>
---
 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;
             }
         }
-- 
2.21.3



  parent reply	other threads:[~2020-06-23  6:35 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-23  6:31 [PATCH v2 0/3] i2c: Match parameters of i2c_start_transfer and i2c_send_recv Philippe Mathieu-Daudé
2020-06-23  6:31 ` [PATCH v2 1/3] " Philippe Mathieu-Daudé
2020-06-23  6:31 ` [PATCH v2 2/3] i2c: Make i2c_start_transfer() direction argument a boolean Philippe Mathieu-Daudé
2020-06-23  6:31 ` Philippe Mathieu-Daudé [this message]
2020-06-23 11:06   ` [RFC PATCH v2 3/3] hw/misc/auxbus: Fix MOT/classic I2C mode BALATON Zoltan
2020-07-04 16:54     ` Philippe Mathieu-Daudé
2020-07-04 16:54 ` [PATCH v2 0/3] i2c: Match parameters of i2c_start_transfer and i2c_send_recv Philippe Mathieu-Daudé
2021-06-12 19:33 ` BALATON Zoltan
2021-06-14  9:56   ` Philippe Mathieu-Daudé
2021-06-14 10:02     ` BALATON Zoltan
2021-06-14 16:48       ` Philippe Mathieu-Daudé
2021-06-14 19:34         ` Corey Minyard
2021-06-16 15:09           ` Philippe Mathieu-Daudé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200623063123.20776-4-f4bug@amsat.org \
    --to=f4bug@amsat.org \
    --cc=alistair@alistair23.me \
    --cc=balaton@eik.bme.hu \
    --cc=cminyard@mvista.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=konrad@adacore.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.