From nobody Sun May 19 12:00:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1673427132; cv=none; d=zohomail.com; s=zohoarc; b=CiaypJARiy/XHCsQieGlDuQEJ1e+WkH6Ql7KMJTIXZxG7unL9U2aKTNLEQbPn3AgrBPylGMY+i0MZ2J1RTH0n6oxQnCULPd6npDj9n35WAbJ/Zd4JSnk1ToBvxTmIuuoGnTUFwn/nwQFhiKlhkG1RRojW8RU7k8wE9rzsnkdE50= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673427132; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=rqfudLgvWami2CjesLmeGlPtQtwdVZ+Jj9zyr+J7ES0=; b=RFDXtHG9Wc/RoUHp9cZ8eTONhdpqijOtYuuCpck9/rQUoLqd2i7cDbx4ZdMoOMYsV4jM6W89X6CJCBGg0epL9Y8nO4XkR08y25VuhxHM1CDiyRLpSbELv68HGSJy9RHX6VlL/lf14iV+AyZ02Rkkp03pDMl6QNnzWTsWIe/8sxI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 167342713214865.52927981808648; Wed, 11 Jan 2023 00:52:12 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pFWoa-0003Ex-Rx; Wed, 11 Jan 2023 03:50:34 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pFWoV-0003AS-JR for qemu-devel@nongnu.org; Wed, 11 Jan 2023 03:50:28 -0500 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pFWoT-0007bg-7f for qemu-devel@nongnu.org; Wed, 11 Jan 2023 03:50:27 -0500 Received: by mail-wr1-x434.google.com with SMTP id j7so9288911wrn.9 for ; Wed, 11 Jan 2023 00:50:24 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id j17-20020adff011000000b002a64e575b4esm13421054wro.47.2023.01.11.00.50.22 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 11 Jan 2023 00:50:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rqfudLgvWami2CjesLmeGlPtQtwdVZ+Jj9zyr+J7ES0=; b=jczFMNTWQboy88S4lf0GnHBvBod3ophmlNQm+X0fkQYN7Yokkl3HfouvXkX31GbR6+ MJHIeWdz/SlJq1NJ6q4pW1Bze91qgjXOAz0rbizPv+dOB8ZSLRTCTryqugLb4bMb2K2H ECuv+f9ZxNzWY+xv8H2Dhl9tev8bTIEmhT6TW2BuZLEUK5s2aF2jSv16PdlAwKXXuwFR IugBfUVMwKurlWsV85+PhOjU5boR+ZwP9L1bTRYuo78xJgFt5/NnwWKXN+rjnvqe4Z+t qyPFm9ZAkd2XOmM1EOA0ZxPBG+B/wTkaAhn/JlAYqAnhjHRNWhDGymseT1uDmoM0tfpd 3xGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rqfudLgvWami2CjesLmeGlPtQtwdVZ+Jj9zyr+J7ES0=; b=6ZXN8yRvNKqFWCMn6kkIzZtVxfsXijG9mgt0qd9c5BHQGCHNGxE//CdtTqpdWLZRNR ldyGW5foiCiTeDGCwgaXnho4jiVcF8Ga1aSd0Ecu1fFdg+FP+DAOV9s2ZNkAIqlkLFdP ZBGyr+UHeingvowzRKeb1rUh0KQVmS9PhchP64gWGyXSVDznG6CZSLTUlrRTbH9R58hI y4BXDm4QtiALJRByRsDDRTotasxL1ISPL9mKPtv5NamSJXUqSFlwRiGYyOBIfRdhS0+Q TGUhi1QetCzw0AVkz/IaKrny5ghFtPFtOI/WtIS8+oY/N1GqgtsPuu6/aJqXYB2QxFgN FCEQ== X-Gm-Message-State: AFqh2krLKdcexuCjBC/lvy1qMF0nY8dXMARrXrvNxPSkOPbjyXVg21bf npC0lr9aD34Al3LEszFE3ZC7ZHCWoBL26yiy X-Google-Smtp-Source: AMrXdXt2Lqa1eiSSWrgLTZZ+bwhrCwbEzp7pDW0x7yQbTNrOST4Kz1qbz25egPuPorP8+f9SLJCeTQ== X-Received: by 2002:a05:6000:1e04:b0:273:e385:1a89 with SMTP id bj4-20020a0560001e0400b00273e3851a89mr43507356wrb.67.1673427023360; Wed, 11 Jan 2023 00:50:23 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell , Thomas Huth , Jan Kiszka , qemu-trivial@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PATCH v3 1/5] hw/i2c/bitbang_i2c: Define TYPE_GPIO_I2C in public header Date: Wed, 11 Jan 2023 09:50:12 +0100 Message-Id: <20230111085016.44551-2-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230111085016.44551-1-philmd@linaro.org> References: <20230111085016.44551-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=philmd@linaro.org; helo=mail-wr1-x434.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1673427132528100001 Define TYPE_GPIO_I2C in the public "hw/i2c/bitbang_i2c.h" header and use it in hw/arm/musicpal.c. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Acked-by: Corey Minyard --- hw/arm/musicpal.c | 3 ++- hw/i2c/bitbang_i2c.c | 1 - include/hw/i2c/bitbang_i2c.h | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c index b65c020115..813232682f 100644 --- a/hw/arm/musicpal.c +++ b/hw/arm/musicpal.c @@ -25,6 +25,7 @@ #include "hw/block/flash.h" #include "ui/console.h" #include "hw/i2c/i2c.h" +#include "hw/i2c/bitbang_i2c.h" #include "hw/irq.h" #include "hw/or-irq.h" #include "hw/audio/wm8750.h" @@ -1300,7 +1301,7 @@ static void musicpal_init(MachineState *machine) =20 dev =3D sysbus_create_simple(TYPE_MUSICPAL_GPIO, MP_GPIO_BASE, qdev_get_gpio_in(pic, MP_GPIO_IRQ)); - i2c_dev =3D sysbus_create_simple("gpio_i2c", -1, NULL); + i2c_dev =3D sysbus_create_simple(TYPE_GPIO_I2C, -1, NULL); i2c =3D (I2CBus *)qdev_get_child_bus(i2c_dev, "i2c"); =20 lcd_dev =3D sysbus_create_simple(TYPE_MUSICPAL_LCD, MP_LCD_BASE, NULL); diff --git a/hw/i2c/bitbang_i2c.c b/hw/i2c/bitbang_i2c.c index e9a0612a04..ac84bf0262 100644 --- a/hw/i2c/bitbang_i2c.c +++ b/hw/i2c/bitbang_i2c.c @@ -162,7 +162,6 @@ void bitbang_i2c_init(bitbang_i2c_interface *s, I2CBus = *bus) =20 /* GPIO interface. */ =20 -#define TYPE_GPIO_I2C "gpio_i2c" OBJECT_DECLARE_SIMPLE_TYPE(GPIOI2CState, GPIO_I2C) =20 struct GPIOI2CState { diff --git a/include/hw/i2c/bitbang_i2c.h b/include/hw/i2c/bitbang_i2c.h index 92334e9016..a079e6d70f 100644 --- a/include/hw/i2c/bitbang_i2c.h +++ b/include/hw/i2c/bitbang_i2c.h @@ -3,6 +3,8 @@ =20 #include "hw/i2c/i2c.h" =20 +#define TYPE_GPIO_I2C "gpio_i2c" + typedef struct bitbang_i2c_interface bitbang_i2c_interface; =20 #define BITBANG_I2C_SDA 0 --=20 2.38.1 From nobody Sun May 19 12:00:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1673427224; cv=none; d=zohomail.com; s=zohoarc; b=h6KZ6HAG1FCRoNMYBzrKhAUwVjsGLFMQ9fAmeYQhgiH2MQIZ+KJKeiUwhhg8HUURdR61no4F/DX54cYRTR0UJmEzUhelSfxy+498u+QpWB3gk9UcFXazN0A+yEkm3piKdxFStyREYwa/Jx+pUx249Qg79SzQ7mXecXkQ1luO21k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673427224; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=QqhX9d7OWrlFhlOYzosdT2uap07wVT4JcGVQZKlWVp8=; b=Silipy8exqdPSd4BZvynNbaGiEba8LISmY7DqhthpHgGRCX/Ya7RcvnNdQB2gF/HpsP/Ks8UkH7VYBRoWOU/h96k/75uhPT4gbtqwgtnOVZP0fTnQ8jp4OIDvnjM7f8lZ1NCnHqt6D+4Iz+M5SiI0DlPUwGwnywlEO03AsniSlM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTP id 1673427224881250.26398945524556; Wed, 11 Jan 2023 00:53:44 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pFWos-0003RP-Sc; Wed, 11 Jan 2023 03:50:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pFWoa-0003FF-GT for qemu-devel@nongnu.org; Wed, 11 Jan 2023 03:50:32 -0500 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pFWoY-0007cL-1X for qemu-devel@nongnu.org; Wed, 11 Jan 2023 03:50:32 -0500 Received: by mail-wm1-x32f.google.com with SMTP id l26so10571224wme.5 for ; Wed, 11 Jan 2023 00:50:29 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id o19-20020a05600c511300b003d9862ec435sm5963864wms.20.2023.01.11.00.50.27 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 11 Jan 2023 00:50:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=QqhX9d7OWrlFhlOYzosdT2uap07wVT4JcGVQZKlWVp8=; b=Qs+/e/zaOY/tJH6z6W0tOYMKOhvkFd9y6V+YqgPBZonuTIpeatoplaVdgk5DpTYx9R p59vu8uTu/MlpaznSOIUN6F7I5ksUMELsLmLRzfyJfM1oyvhVvbwnYGekI/VvFt7wolc fyxcMxjHDbV1P+qk1qyfsIGbb0EYr/8b4qQ4C18KNNqpVGqnBo7TEX++7rsVT9btOGNI LjFkGF4cpvrG709+IKOvq+QhoktGMdFjkIzGOJRY6apnmi/5NreOgSrPxnuiq6fBvAic oPxOTCv3Shv0rlRZJCqQ1kRG6VK9uAL7pt9rqfY4mKw+wdEe6uUGjNC0v1VOeUmZu6ha UQTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QqhX9d7OWrlFhlOYzosdT2uap07wVT4JcGVQZKlWVp8=; b=JIoiIxxbtfZZy2xlUxSJnGQ4sfWgk/zNiqp2dMJ51k1sJBJtWRpLUL5V+iKQrNo7Ab AizQ8hcijVThPUuCmLdaxt4Ujb+KW7ztzhNP6kx9aPOJTXEvRgFTL8GyP2MPnRzG90AI Q52pTL48gVbFbMylb/Vm+nMoF2yMR/AHtzw8k9Odbnl4SgKHgrKgwPDrFWSenq50RDdN 5haCqVwQb0YqXIbsSeF2kjW834lLi0LVdUQsXvymPZTkL8PCvEJSne4NV+uS3PO8sWQL b4hIYkKgIMsi38eAn+dsBQR17op2DcADvwRhArwc8C+XHkv++Om2p5gcIKvCLPLNB94h lsqg== X-Gm-Message-State: AFqh2krdXoBY0/KpMndGCbYNx2DO8jevJxDYFzpBusKkgTmimJ7lG9B7 VAH7WKMUUOPHOo3KZEcx1kIbxXVr1pdS3/n7 X-Google-Smtp-Source: AMrXdXuuMuAg00zaVcj1YraGHF9XJZm1E86FSzELXrJU6wGN3B6kr0ZMNjTg4DFjgXhUnqmBgj/Uag== X-Received: by 2002:a05:600c:1da3:b0:3d3:4dbc:75ef with SMTP id p35-20020a05600c1da300b003d34dbc75efmr51264789wms.17.1673427028123; Wed, 11 Jan 2023 00:50:28 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell , Thomas Huth , Jan Kiszka , qemu-trivial@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PATCH v3 2/5] hw/i2c/bitbang_i2c: Remove unused dummy MemoryRegion Date: Wed, 11 Jan 2023 09:50:13 +0100 Message-Id: <20230111085016.44551-3-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230111085016.44551-1-philmd@linaro.org> References: <20230111085016.44551-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=philmd@linaro.org; helo=mail-wm1-x32f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1673427227023100001 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Acked-by: Corey Minyard --- hw/i2c/bitbang_i2c.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/hw/i2c/bitbang_i2c.c b/hw/i2c/bitbang_i2c.c index ac84bf0262..e41cb63daa 100644 --- a/hw/i2c/bitbang_i2c.c +++ b/hw/i2c/bitbang_i2c.c @@ -165,9 +165,10 @@ void bitbang_i2c_init(bitbang_i2c_interface *s, I2CBus= *bus) OBJECT_DECLARE_SIMPLE_TYPE(GPIOI2CState, GPIO_I2C) =20 struct GPIOI2CState { + /*< private >*/ SysBusDevice parent_obj; + /*< public >*/ =20 - MemoryRegion dummy_iomem; bitbang_i2c_interface bitbang; int last_level; qemu_irq out; @@ -188,12 +189,8 @@ static void gpio_i2c_init(Object *obj) { DeviceState *dev =3D DEVICE(obj); GPIOI2CState *s =3D GPIO_I2C(obj); - SysBusDevice *sbd =3D SYS_BUS_DEVICE(obj); I2CBus *bus; =20 - memory_region_init(&s->dummy_iomem, obj, "gpio_i2c", 0); - sysbus_init_mmio(sbd, &s->dummy_iomem); - bus =3D i2c_init_bus(dev, "i2c"); bitbang_i2c_init(&s->bitbang, bus); =20 --=20 2.38.1 From nobody Sun May 19 12:00:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1673427119; cv=none; d=zohomail.com; s=zohoarc; b=MFs4DtN7OwWKqho5OT5jGSy6/b/UZwBkYbr/bmHT9CcaCjD7RZNWJ27nAc4TqkaE0aBwKs5EAWCq4lQCY3mxRbLcUMcINWvvN1Zq4lzPHm46DvmtQQMgoempFTl2+N4G3yCGB7QfSZHcHN8RFtiT41gEhqniJiu75lwgsfwguJ8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673427119; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=iDnNDu+oMICH4wdH8XoWszonkd1H38BArRChhxQlZUY=; b=jfgYAIqDMnmwMYsHSM4jSsg2PVmChC5XEAz4zFOQo4GHV0FB1mb3KhemfX4hIkKcnY/IO1f6pzlivxN432j06IIRqwzjd7z0YsiQxEfhcst6AgvrXGWaxsQg+Vt3xPif9cgUwIOVdDDD/UDen7Sa667O6zTeGoG6MNFHWFM7uMs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16734271198281007.063839217168; Wed, 11 Jan 2023 00:51:59 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pFWos-0003Pf-8U; Wed, 11 Jan 2023 03:50:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pFWof-0003Gd-7m for qemu-devel@nongnu.org; Wed, 11 Jan 2023 03:50:38 -0500 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pFWod-0007e7-5A for qemu-devel@nongnu.org; Wed, 11 Jan 2023 03:50:36 -0500 Received: by mail-wm1-x335.google.com with SMTP id c4-20020a1c3504000000b003d9e2f72093so8981328wma.1 for ; Wed, 11 Jan 2023 00:50:34 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id o19-20020a05600c511300b003d9862ec435sm5964179wms.20.2023.01.11.00.50.32 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 11 Jan 2023 00:50:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=iDnNDu+oMICH4wdH8XoWszonkd1H38BArRChhxQlZUY=; b=pke7i96aicODUbCCMtqiAD2ggXYbBh6JXivqZQnOJcDKrpvoEqSo2zJdwGmIvBl5xg yZwHRTWd1YcQeBG+IwX5uOKCEduo52I6In69jv0X3S+YzGAcTVX6D0+Y6dbTU7Ls/ad6 bpGKkwtYpbh5ye2Mel9659WNHyoPyvd2vAe8xzniRJjNwgIaSltGBiE3KpXY5RDlDjA5 VY1uw59ca2BZAylmcBhhjm7nP30hl6mqix6EXJu7RvSjUvSro24XUOI1CW0k7mff1ME0 8rcb7+Im4ceBdlUokHnO+nITYF+LRaqfnoRhvTL+f/HX6yNDRbhZfgyaTg4dMtayr4Ew lxeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iDnNDu+oMICH4wdH8XoWszonkd1H38BArRChhxQlZUY=; b=mIgS7iGkvehZYr/Or5yNNr9OuQndQjvQTo0A/KtaIsaTDowg0M8n+Yjck2bo0gVEc2 o5NbGstY1STtZXVRRfktv3cS3wj8T9YbWXJp1vZOt+t5JpMAxnxDs0G9qd6xSW2baTrX IWRUmSH92tUqa4xxf92VPIwN2W2z/JOeDCL8z4NRvP4LTKfwCsnsYyLzy553uJ4QleFs OllTGq5HkEdJf2u6YTwmi7GfMuOpm3UD7zglNxuOn6G2brica50Y3o3VHztk2a/praJz yu3koGxfIwYa2b+8fAxroTuVXKMnIPMoIoVkBXN0ZU1Kn1sfOPqPg+dg8WHIaEU/C3Lx ThnQ== X-Gm-Message-State: AFqh2koGtTt4U072lngFBzUC8olu4gKRYv0sjyL1OV0x946s37PPUq4P fO3YCzn5potrhH5fug8Go9VZXhzOumJzEgNw X-Google-Smtp-Source: AMrXdXtR5fpEqXEMcvIzxT3owtyy580OHRs6/GXRuZNjjol0zz/4defvgga/RFXw4+yvcXnASFzN8Q== X-Received: by 2002:a05:600c:1d25:b0:3d3:50b9:b192 with SMTP id l37-20020a05600c1d2500b003d350b9b192mr61983619wms.18.1673427033020; Wed, 11 Jan 2023 00:50:33 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell , Thomas Huth , Jan Kiszka , qemu-trivial@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PATCH v3 3/5] hw/i2c/bitbang_i2c: Change state calling bitbang_i2c_set_state() helper Date: Wed, 11 Jan 2023 09:50:14 +0100 Message-Id: <20230111085016.44551-4-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230111085016.44551-1-philmd@linaro.org> References: <20230111085016.44551-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=philmd@linaro.org; helo=mail-wm1-x335.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1673427120419100001 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Acked-by: Corey Minyard --- hw/i2c/bitbang_i2c.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/hw/i2c/bitbang_i2c.c b/hw/i2c/bitbang_i2c.c index e41cb63daa..bf4b781393 100644 --- a/hw/i2c/bitbang_i2c.c +++ b/hw/i2c/bitbang_i2c.c @@ -26,13 +26,19 @@ do { printf("bitbang_i2c: " fmt , ## __VA_ARGS__); } wh= ile (0) #define DPRINTF(fmt, ...) do {} while(0) #endif =20 +static void bitbang_i2c_set_state(bitbang_i2c_interface *i2c, + bitbang_i2c_state state) +{ + i2c->state =3D state; +} + static void bitbang_i2c_enter_stop(bitbang_i2c_interface *i2c) { DPRINTF("STOP\n"); if (i2c->current_addr >=3D 0) i2c_end_transfer(i2c->bus); i2c->current_addr =3D -1; - i2c->state =3D STOPPED; + bitbang_i2c_set_state(i2c, STOPPED); } =20 /* Set device data pin. */ @@ -69,7 +75,7 @@ int bitbang_i2c_set(bitbang_i2c_interface *i2c, int line,= int level) if (level =3D=3D 0) { DPRINTF("START\n"); /* START condition. */ - i2c->state =3D SENDING_BIT7; + bitbang_i2c_set_state(i2c, SENDING_BIT7); i2c->current_addr =3D -1; } else { /* STOP condition. */ @@ -96,7 +102,7 @@ int bitbang_i2c_set(bitbang_i2c_interface *i2c, int line= , int level) case SENDING_BIT7 ... SENDING_BIT0: i2c->buffer =3D (i2c->buffer << 1) | data; /* will end up in WAITING_FOR_ACK */ - i2c->state++;=20 + bitbang_i2c_set_state(i2c, i2c->state + 1); return bitbang_i2c_ret(i2c, 1); =20 case WAITING_FOR_ACK: @@ -117,13 +123,14 @@ int bitbang_i2c_set(bitbang_i2c_interface *i2c, int l= ine, int level) * device we were sending to decided to NACK us). */ DPRINTF("Got NACK\n"); + bitbang_i2c_set_state(i2c, SENT_NACK); bitbang_i2c_enter_stop(i2c); return bitbang_i2c_ret(i2c, 1); } if (i2c->current_addr & 1) { - i2c->state =3D RECEIVING_BIT7; + bitbang_i2c_set_state(i2c, RECEIVING_BIT7); } else { - i2c->state =3D SENDING_BIT7; + bitbang_i2c_set_state(i2c, SENDING_BIT7); } return bitbang_i2c_ret(i2c, 0); } @@ -134,18 +141,18 @@ int bitbang_i2c_set(bitbang_i2c_interface *i2c, int l= ine, int level) case RECEIVING_BIT6 ... RECEIVING_BIT0: data =3D i2c->buffer >> 7; /* will end up in SENDING_ACK */ - i2c->state++; + bitbang_i2c_set_state(i2c, i2c->state + 1); i2c->buffer <<=3D 1; return bitbang_i2c_ret(i2c, data); =20 case SENDING_ACK: - i2c->state =3D RECEIVING_BIT7; if (data !=3D 0) { DPRINTF("NACKED\n"); - i2c->state =3D SENT_NACK; + bitbang_i2c_set_state(i2c, SENT_NACK); i2c_nack(i2c->bus); } else { DPRINTF("ACKED\n"); + bitbang_i2c_set_state(i2c, RECEIVING_BIT7); } return bitbang_i2c_ret(i2c, 1); } --=20 2.38.1 From nobody Sun May 19 12:00:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1673427324; cv=none; d=zohomail.com; s=zohoarc; b=GuNrXGTq7MuGKnaZovQHE/BCO9fVs4duwwkCmAaEC7XQbudNKOxSGEwVwOS4Kuq2tgOdtXiSVM6odL5OKJgj5X7pgyCatr+wH8dUi/YsJfDUL+MwlQxKtPQTCja28vM/wY6gvhhtypUgIpj58ZWyx2bximBal6F7XlO8xXsUzAc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673427324; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=F1k/7mPGH5gDcWWku0OjBNNAk942aGuA5NQSFVWJSqE=; b=ggPD/YXgZSLuTqjivUIfhX7f+eVvOqNmVkEzX6lgH8UqUaGV/U4Bu96On78wdRFmtBFQ0GujwjehohEMICwiWNgVywwdxeE4MvyS/0poIOWvIwSpxvE2oAa1qDFIvAAujWxnC9pukud4NB+9Me+1ZWPyx2B5Kf3L+cUUCBqTEtc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1673427324261539.0782303158668; Wed, 11 Jan 2023 00:55:24 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pFWot-0003Rt-4j; Wed, 11 Jan 2023 03:50:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pFWoj-0003Jt-NC for qemu-devel@nongnu.org; Wed, 11 Jan 2023 03:50:42 -0500 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pFWoh-0007hK-Kt for qemu-devel@nongnu.org; Wed, 11 Jan 2023 03:50:41 -0500 Received: by mail-wr1-x42e.google.com with SMTP id d17so14307800wrs.2 for ; Wed, 11 Jan 2023 00:50:39 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id m10-20020a056000008a00b002683695bf97sm13029515wrx.58.2023.01.11.00.50.36 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 11 Jan 2023 00:50:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=F1k/7mPGH5gDcWWku0OjBNNAk942aGuA5NQSFVWJSqE=; b=YdQP44UzORDUM2gwiED1ZAncZYIEgNPk70Z3okWesFAwhaGWfhuhu6JLrgH40cEJtF TTpCt2psGRmAcEKuYxWBi3EjnyH0zeyDXAtc1wfDFYIwUr/Sc08EVNfeS5pYFF/86aCm 0LcYjO11dWnRTvtqy+jX5yd3a8YKoLpnOn67MkbtcDjix9WTJLdrcvxpT3I66SlMo9Dm uQjc4WCRLuhxjVvTmQDGprBglJYCqQOVZJ+hKrnM2KxqxLyeFjJzJ3VS/JdE55ZjnAZl rd/dTscwK1UsoJU3wbYzAOr1OqVCFqhpBkXJ+FFvE/+RsOEqMOJxdSWhfsauAaWxbHLz FaiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=F1k/7mPGH5gDcWWku0OjBNNAk942aGuA5NQSFVWJSqE=; b=G8islpwpYhiqsiigudBM/qRCi0c15EZh86kDlmf53NK8wC1/E6iEmEiVEA16n6qdNH ijIvFMI3tpYXcKNHQ9MQ2UdOZ6VxA5MeP4TifKbG6YXmd7JsT4upWbpPrrazrvQloc93 HUjMboaCxr1bDa6nWA8Pad4edpOFCtdU+AfVMLjbWmVwzFu0+FGWTDHsvb7xakItG9/Z yUDCUUF+hC24OyUQ6B+kE7NWr7pdHeSXzhQBQyqZtmEZ1waxtj9uuaf9M+yIQdWFNWRE AbbYRKkgwkPegSOufZNceRYchnsSb0yQGdZr8xY0uy9L7IxNEs8IXhW6EuikDWXZ30Tm 0VNQ== X-Gm-Message-State: AFqh2koqwD259tI1xOE1tZyj89Dyj3smjkUaJlo4AFMN7ZCz4V9aDRYS Uilh2G013l6kDvbjTYMhj4frIsm2i7yrTpbE X-Google-Smtp-Source: AMrXdXvLPAAKcHV8R87KoUQzAUQdVq6/x2i8Rm3Xz9N0drkvk7SF6WV8XxLuQdMTSvAt99FC6MS35g== X-Received: by 2002:a5d:4587:0:b0:27f:a81:b819 with SMTP id p7-20020a5d4587000000b0027f0a81b819mr40538188wrq.22.1673427037903; Wed, 11 Jan 2023 00:50:37 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell , Thomas Huth , Jan Kiszka , qemu-trivial@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PATCH v3 4/5] hw/i2c/bitbang_i2c: Trace state changes Date: Wed, 11 Jan 2023 09:50:15 +0100 Message-Id: <20230111085016.44551-5-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230111085016.44551-1-philmd@linaro.org> References: <20230111085016.44551-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=philmd@linaro.org; helo=mail-wr1-x42e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1673427325973100001 Trace bitbang state machine changes with trace events. Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Corey Minyard --- hw/i2c/bitbang_i2c.c | 33 ++++++++++++++++++++++++++++----- hw/i2c/trace-events | 3 +++ 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/hw/i2c/bitbang_i2c.c b/hw/i2c/bitbang_i2c.c index bf4b781393..efc49b7502 100644 --- a/hw/i2c/bitbang_i2c.c +++ b/hw/i2c/bitbang_i2c.c @@ -16,6 +16,7 @@ #include "hw/sysbus.h" #include "qemu/module.h" #include "qom/object.h" +#include "trace.h" =20 //#define DEBUG_BITBANG_I2C =20 @@ -26,15 +27,41 @@ do { printf("bitbang_i2c: " fmt , ## __VA_ARGS__); } wh= ile (0) #define DPRINTF(fmt, ...) do {} while(0) #endif =20 +/* bitbang_i2c_state enum to name */ +static const char * const sname[] =3D { +#define NAME(e) [e] =3D stringify(e) + NAME(STOPPED), + [SENDING_BIT7] =3D "SENDING_BIT7 (START)", + NAME(SENDING_BIT6), + NAME(SENDING_BIT5), + NAME(SENDING_BIT4), + NAME(SENDING_BIT3), + NAME(SENDING_BIT2), + NAME(SENDING_BIT1), + NAME(SENDING_BIT0), + NAME(WAITING_FOR_ACK), + [RECEIVING_BIT7] =3D "RECEIVING_BIT7 (ACK)", + NAME(RECEIVING_BIT6), + NAME(RECEIVING_BIT5), + NAME(RECEIVING_BIT4), + NAME(RECEIVING_BIT3), + NAME(RECEIVING_BIT2), + NAME(RECEIVING_BIT1), + NAME(RECEIVING_BIT0), + NAME(SENDING_ACK), + NAME(SENT_NACK) +#undef NAME +}; + static void bitbang_i2c_set_state(bitbang_i2c_interface *i2c, bitbang_i2c_state state) { + trace_bitbang_i2c_state(sname[i2c->state], sname[state]); i2c->state =3D state; } =20 static void bitbang_i2c_enter_stop(bitbang_i2c_interface *i2c) { - DPRINTF("STOP\n"); if (i2c->current_addr >=3D 0) i2c_end_transfer(i2c->bus); i2c->current_addr =3D -1; @@ -73,7 +100,6 @@ int bitbang_i2c_set(bitbang_i2c_interface *i2c, int line= , int level) return bitbang_i2c_nop(i2c); } if (level =3D=3D 0) { - DPRINTF("START\n"); /* START condition. */ bitbang_i2c_set_state(i2c, SENDING_BIT7); i2c->current_addr =3D -1; @@ -122,7 +148,6 @@ int bitbang_i2c_set(bitbang_i2c_interface *i2c, int lin= e, int level) /* NACK (either addressing a nonexistent device, or the * device we were sending to decided to NACK us). */ - DPRINTF("Got NACK\n"); bitbang_i2c_set_state(i2c, SENT_NACK); bitbang_i2c_enter_stop(i2c); return bitbang_i2c_ret(i2c, 1); @@ -147,11 +172,9 @@ int bitbang_i2c_set(bitbang_i2c_interface *i2c, int li= ne, int level) =20 case SENDING_ACK: if (data !=3D 0) { - DPRINTF("NACKED\n"); bitbang_i2c_set_state(i2c, SENT_NACK); i2c_nack(i2c->bus); } else { - DPRINTF("ACKED\n"); bitbang_i2c_set_state(i2c, RECEIVING_BIT7); } return bitbang_i2c_ret(i2c, 1); diff --git a/hw/i2c/trace-events b/hw/i2c/trace-events index af181d43ee..2a479c1c12 100644 --- a/hw/i2c/trace-events +++ b/hw/i2c/trace-events @@ -1,5 +1,8 @@ # See docs/devel/tracing.rst for syntax documentation. =20 +# bitbang_i2c.c +bitbang_i2c_state(const char *old_state, const char *new_state) "state %s = -> %s" + # core.c =20 i2c_event(const char *event, uint8_t address) "%s(addr:0x%02x)" --=20 2.38.1 From nobody Sun May 19 12:00:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1673427365; cv=none; d=zohomail.com; s=zohoarc; b=FjD3e1Yk2jRodKiGXjuzBvMttfqrEQ88ZIw9lyU5tCi53Q6vLG89UcjoJU/8OHkoKMWaJzJmCwrUqGIYE8rWDv/Lw9VhC84CYj+Zvd2ldg0Y41eK6v3woGP1o/wALlRN5P33E8K5BZ26YZJYoyHxNFrv1v4pIkQrtfA+kNavUeU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673427365; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Uj4vMJ6IjNLjq+M6XLE4uewGsLuqMTdFQ7srLl6Qez8=; b=JZkAMFb/hO6GiaRBfHFWlQkQjkAw06T1i47FwWnkZKhT+VkFaF0cxybmwi4xon19NTYIESvh2pMmpK327YLqGAF8HL8vZNDZm3T/UjBFCdyowW/9aXerH5b8+4tNkfUpIinRPgtkivy0bHNV/s389KESsmNaGH3f/A3DAkJpFIE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1673427365751419.62569663267607; Wed, 11 Jan 2023 00:56:05 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pFWot-0003SC-QM; Wed, 11 Jan 2023 03:50:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pFWop-0003Lw-7z for qemu-devel@nongnu.org; Wed, 11 Jan 2023 03:50:49 -0500 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pFWom-0007jT-LH for qemu-devel@nongnu.org; Wed, 11 Jan 2023 03:50:46 -0500 Received: by mail-wr1-x433.google.com with SMTP id h16so14288141wrz.12 for ; Wed, 11 Jan 2023 00:50:44 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id l13-20020adfe58d000000b00296730b5c3esm13272686wrm.102.2023.01.11.00.50.41 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 11 Jan 2023 00:50:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Uj4vMJ6IjNLjq+M6XLE4uewGsLuqMTdFQ7srLl6Qez8=; b=nn7K67CqhIZdqQiZ0FRG+l8zJK2tXJlgfvl+gnULYM5YIJhcEFfmSXLfvO+O2kZPHg 5M8QgibkrAU8jtvEWWWn9cdrAQX+n41+4To2eGIdEtzAgSabo+Hm05POkgMtE/BVlLFu c4PUTL53OvDx1MrZfnQHuOli/kl0pVa/4/yvkOKy+myzVeeOJf08vzkuGy0K/7FwDxm2 5yoUuWxBRSROlBK7mx+MxYLreTOaXf2jQTPMNRED15hJwfsbKZaMuVLKH+hJ/beQZQba ihZT0E7Oj03U4VUxwrUSFoo5wiNwkn93PzsQy4RnT5NlrWM6GLYO65nrb9I6a7JObfYs 4TFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Uj4vMJ6IjNLjq+M6XLE4uewGsLuqMTdFQ7srLl6Qez8=; b=RrAHc316aNaDWDEmgiDw9rYqtXgtw6Y5EWJgL0R0GwNV3gtO/QelB3DHr3NlIH8S3z JPgAIqvKzKR9o8U86bI2FrkrVaiDiDahc3IT+3oJsA1u/UEUAbJSWZb/0CMDtdLhdYnd PydT2tl3XO8OaaH8RayrduSRJsclzCncLGTDiCZYQVP6txa/INUyLFf0xYiy2Hon7Y7M FIOHX2v7Y19x2+ij7hSYwPlwL8FTzs3evAuMKs7JrLbdshmhMmE4FQVybDbBZApaYc3j 0GENa0Fqk49UhJwlhxTeiwpUdKmXDr4ehAkV+gC9gWYzEJbdrdhMDdt5j8LSbDZG+mcS HRmA== X-Gm-Message-State: AFqh2kqGrC3BWEy+BOkFzRzG9VQqkaolf5jQvzQ9hgDoLs3ecGA4rzkv avs6o3PzwpWs4s0z9unimwTxOHA9L0QFPIii X-Google-Smtp-Source: AMrXdXsG6xIibaOF4aE0Q7XWZ2QaJtef4d3EXkZ6HAhT9Pxbi0UXa1vO2TJt89ud0Zr/OOsqpaH1ZA== X-Received: by 2002:a5d:630d:0:b0:2ac:5b46:9c85 with SMTP id i13-20020a5d630d000000b002ac5b469c85mr15283173wru.68.1673427042808; Wed, 11 Jan 2023 00:50:42 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell , Thomas Huth , Jan Kiszka , qemu-trivial@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PATCH v3 5/5] hw/i2c/bitbang_i2c: Convert DPRINTF() to trace events Date: Wed, 11 Jan 2023 09:50:16 +0100 Message-Id: <20230111085016.44551-6-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230111085016.44551-1-philmd@linaro.org> References: <20230111085016.44551-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::433; envelope-from=philmd@linaro.org; helo=mail-wr1-x433.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1673427366235100001 Convert the remaining DPRINTF debug macro uses to tracepoints. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Acked-by: Corey Minyard --- hw/i2c/bitbang_i2c.c | 18 ++++++------------ hw/i2c/trace-events | 4 ++++ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/hw/i2c/bitbang_i2c.c b/hw/i2c/bitbang_i2c.c index efc49b7502..bb18954765 100644 --- a/hw/i2c/bitbang_i2c.c +++ b/hw/i2c/bitbang_i2c.c @@ -18,14 +18,6 @@ #include "qom/object.h" #include "trace.h" =20 -//#define DEBUG_BITBANG_I2C - -#ifdef DEBUG_BITBANG_I2C -#define DPRINTF(fmt, ...) \ -do { printf("bitbang_i2c: " fmt , ## __VA_ARGS__); } while (0) -#else -#define DPRINTF(fmt, ...) do {} while(0) -#endif =20 /* bitbang_i2c_state enum to name */ static const char * const sname[] =3D { @@ -71,8 +63,10 @@ static void bitbang_i2c_enter_stop(bitbang_i2c_interface= *i2c) /* Set device data pin. */ static int bitbang_i2c_ret(bitbang_i2c_interface *i2c, int level) { + trace_bitbang_i2c_data(i2c->last_clock, i2c->last_data, + i2c->device_out, level); i2c->device_out =3D level; - //DPRINTF("%d %d %d\n", i2c->last_clock, i2c->last_data, i2c->device_o= ut); + return level & i2c->last_data; } =20 @@ -137,11 +131,11 @@ int bitbang_i2c_set(bitbang_i2c_interface *i2c, int l= ine, int level) =20 if (i2c->current_addr < 0) { i2c->current_addr =3D i2c->buffer; - DPRINTF("Address 0x%02x\n", i2c->current_addr); + trace_bitbang_i2c_addr(i2c->current_addr); ret =3D i2c_start_transfer(i2c->bus, i2c->current_addr >> 1, i2c->current_addr & 1); } else { - DPRINTF("Sent 0x%02x\n", i2c->buffer); + trace_bitbang_i2c_send(i2c->buffer); ret =3D i2c_send(i2c->bus, i2c->buffer); } if (ret) { @@ -161,7 +155,7 @@ int bitbang_i2c_set(bitbang_i2c_interface *i2c, int lin= e, int level) } case RECEIVING_BIT7: i2c->buffer =3D i2c_recv(i2c->bus); - DPRINTF("RX byte 0x%02x\n", i2c->buffer); + trace_bitbang_i2c_recv(i2c->buffer); /* Fall through... */ case RECEIVING_BIT6 ... RECEIVING_BIT0: data =3D i2c->buffer >> 7; diff --git a/hw/i2c/trace-events b/hw/i2c/trace-events index 2a479c1c12..b0ab237b0f 100644 --- a/hw/i2c/trace-events +++ b/hw/i2c/trace-events @@ -2,6 +2,10 @@ =20 # bitbang_i2c.c bitbang_i2c_state(const char *old_state, const char *new_state) "state %s = -> %s" +bitbang_i2c_addr(uint8_t addr) "Address 0x%02x" +bitbang_i2c_send(uint8_t byte) "TX byte 0x%02x" +bitbang_i2c_recv(uint8_t byte) "RX byte 0x%02x" +bitbang_i2c_data(unsigned dat, unsigned clk, unsigned old_out, unsigned ne= w_out) "dat %u clk %u out %u -> %u" =20 # core.c =20 --=20 2.38.1