From nobody Sun May 19 11:37:31 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=1673344384; cv=none; d=zohomail.com; s=zohoarc; b=BF4rlpq+jgX6z7r77ehMHPmtj2Oztq7zOImi7ExYu2qwxVGDCTmPjkyotLQdDS8vLSiQfEhz+UyoiSk322leAGEKRp3nF3og5tS0OkuTxnTeBZSZ/OM2Sp3eZeCLyMAWDWcljhvQWrtJCNteR3LCtBj0xezu0CnvCWIF5ZJyoIc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673344384; 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=BfsfMN7iJZBq98d+oCzp6eGWp4lzZLw4C5Xb9wqKvV6VY0DLQ/Q5p6SgHS4jU8DEqpqUCuMBzomxI697UVdtjRswrw4N5YeebZeEiLb3nKlGv1o0S+hHghz0ayuFHqA6v9AqdwDZj+WBVILkJ+kZ/esC/jRbdmFR6NGDVxrL7jQ= 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 1673344384919107.78201765103006; Tue, 10 Jan 2023 01:53:04 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pFA0x-0006c4-AA; Tue, 10 Jan 2023 03:29:47 -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 1pFA0v-0006ax-C2 for qemu-devel@nongnu.org; Tue, 10 Jan 2023 03:29:45 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pFA0q-0006Hn-Jl for qemu-devel@nongnu.org; Tue, 10 Jan 2023 03:29:42 -0500 Received: by mail-wm1-x333.google.com with SMTP id p1-20020a05600c1d8100b003d8c9b191e0so9187994wms.4 for ; Tue, 10 Jan 2023 00:29:40 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id bg23-20020a05600c3c9700b003d1de805de5sm15998885wmb.16.2023.01.10.00.29.38 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 10 Jan 2023 00:29:38 -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=l3/4IQsQcHjdJ8gVMLyumejQnIBIzZNC4o+TDUN2meomeWY//80u0fa+uJLXb3h0Ou cEiptMY1EKC4c5ZWx5jRP/2ng4NRdoCbdSCxlp5hV+pEx0KGwZYW5CVfshRKupEN+pFA ClFQh9c209MxqQ6KqVBTB5lJXaa89scw2GlJACbx80E7nQPbrpldImBjcs4D3ONNMb3T WJP/GC3chwTWjyl+L0raTUvb0qnConk7L8HXQut47mw0glneKfEcLCD3BU9m8r7pAlED YPHtf50bL8fEo2Bn4d8ISTxZld37fmSrwInhS6+XdKXZNN/DfQSGen6RoDlFIv7ptyPB SVoA== 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=U4bC0DPAyO/ocVCoDEYO20Z85x4FRNFs2tk3li6RxDsbjVffy6TBJx6YZFOhcgqf1v q+R3E0wppHt/UfEYOJB4bkHlQQ0jomAsVX98tj8mzJJIvPsUx2aTpO8+b1cqFK79MLUP BOpOQ7sctMTx9O+9iYK8I4OZqv1CS+fmKSmLPUxS5/AzL3W23cEb3WxDNnWGECxJHBAv rZWMXrrrwk3/LfTUKU671v8jklzkofjknHRRUYSp7X0EcuWsu+Gy7ZRST1Iy+OaHSeJD BGiNrCe9ZfxpG/7wduwMUzGOiCCRzvkHOU2HupBJoToh+hgX7S/c7YY5HUUXT7Ccyr+3 56Ew== X-Gm-Message-State: AFqh2koZ4DK2yyZBolKo9sQPNqeJ0ehseHp+/Fn9neQzMllKEW4l+/9r iBYG7Ca2fBXJdCp5DxNTJidOUjYS8WRnt/3s X-Google-Smtp-Source: AMrXdXsmksKpYFj1w21Vb5Ou+XlScJSgvxIKAUS7GOOBA0fH35GF4YK7ZNwYmDv5YML4Gth3DJLRxw== X-Received: by 2002:a05:600c:ac8:b0:3d7:7cea:b410 with SMTP id c8-20020a05600c0ac800b003d77ceab410mr48540659wmr.33.1673339379237; Tue, 10 Jan 2023 00:29:39 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Thomas Huth , Jan Kiszka , qemu-trivial@nongnu.org, qemu-arm@nongnu.org, Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PATCH v2 1/5] hw/i2c/bitbang_i2c: Define TYPE_GPIO_I2C in public header Date: Tue, 10 Jan 2023 09:29:28 +0100 Message-Id: <20230110082932.24386-2-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230110082932.24386-1-philmd@linaro.org> References: <20230110082932.24386-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::333; envelope-from=philmd@linaro.org; helo=mail-wm1-x333.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: 1673344386459100003 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 --- 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 11:37:31 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=1673343892; cv=none; d=zohomail.com; s=zohoarc; b=M/XOdVXLqxxMKk4e5Fg9Fku0DC5PYD81Q4dqB1rp5nVvF7MDxRvFYOy91zcYaotGjHcT+7W/I7ug5KcVDOGXCUiDSl9TLJ4uzNmX7bP9A7uROla1byq0mAF1czRiWa1aU51DBaedbCH28lK56VGMz/PIvtowRmaHhhWyX8B/Aa0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673343892; 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=GWQWt7HEvQtQau0Tvw9dvYdRW83FB8rDRkentoYualdtIut94xQ+bVXViqUEauEPiKg+P8dvuysJIe3V2NX72R/xBh38LdCBHVI7R25U8hekayQ3OTO5gk6kGZaPETyKBl8vUWtolhee8ezmHGPM6BP0BPOEM5BQIgTAzDhzKIY= 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 1673343892343647.2795611648964; Tue, 10 Jan 2023 01:44:52 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pFA0z-0006dt-VN; Tue, 10 Jan 2023 03:29:49 -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 1pFA0x-0006cg-Sk for qemu-devel@nongnu.org; Tue, 10 Jan 2023 03:29:47 -0500 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pFA0v-0006IH-Gr for qemu-devel@nongnu.org; Tue, 10 Jan 2023 03:29:47 -0500 Received: by mail-wm1-x336.google.com with SMTP id ay12-20020a05600c1e0c00b003d9ea12bafcso5778686wmb.3 for ; Tue, 10 Jan 2023 00:29:45 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id o21-20020a1c7515000000b003d995a704fdsm13949842wmc.33.2023.01.10.00.29.43 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 10 Jan 2023 00:29:43 -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=Th+bt4yJ1lcPNJmp7mm2guWyOANYuNWceYvjvU+oRqcRB4ydQ1ifTIcBQBiktd0C6C cwcedNwb75CB+7lHWfu2nLFJB9IyBS1sjdh2pE+ItF4XdghndWH08OM1bxukCVW7iiNG ttBllF+GcbM5Bi6QyVtkNWCXv/DVs/I0Uo6B1y7KHEVIUAHlSQyp1m+1Vh685t0wQDOT 7lwxoO2stSbFWbes7TREhQ80c7+gKNziZz4ktlaUvZ4OkudyZD/ulLiMUVY383iA7qJ4 a61J93MviWrke6JreQEb4GBpj67WYxVqMtrI4MSe5LhwqEM0aoecQdU71i4ttj8OWuM4 3Yfg== 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=4tHJ3XWi4EyMqWR3npsLfFvab8TKizNfGB6+myyZkf69nVyzfLsf4ztqqs7573uDzI kxyL+qXVnD1ZV5oWob6msqyaH5g0UH03Diw5KYbZ5XeGF5excI04ZHMsDJ+2M5BXlmkU EE7tI9OuRAcEtAJEULdaYLMmS619VrjfmsDEBwLkZPTkIAChHeZ3A9gfDEq0MhgIY2mB 1FAZi5U0Cm+tH4/GrTeU7byqQTzz1GSCKMoG2fKFddXwTeSyAqkKZd3unVmiCWnqcSY0 Nz0VZxy9+XuJCHXlVVyf2ysTmnm05OLH6H9UeO3HEhw/2VZWsIp+Xf4e/pHy9Gi9P0p9 1FpQ== X-Gm-Message-State: AFqh2kq+omMOqduQsRe/XWL0cgNt4F3zJEshS5nBf+nD9Zph45XIv5sX 9lCn3tvknTpu4wJtOhRP/dN1Z7cMScbIcZnw X-Google-Smtp-Source: AMrXdXs9v/Pm0P05MA7IdtYdorpIWPPuxFRgLkIaRNr7x5/ccT9YIEVyC85u3FVEVF1P4vAts4sN5w== X-Received: by 2002:a05:600c:1c11:b0:3d0:a531:5413 with SMTP id j17-20020a05600c1c1100b003d0a5315413mr47868871wms.34.1673339384053; Tue, 10 Jan 2023 00:29:44 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Thomas Huth , Jan Kiszka , qemu-trivial@nongnu.org, qemu-arm@nongnu.org, Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PATCH v2 2/5] hw/i2c/bitbang_i2c: Remove unused dummy MemoryRegion Date: Tue, 10 Jan 2023 09:29:29 +0100 Message-Id: <20230110082932.24386-3-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230110082932.24386-1-philmd@linaro.org> References: <20230110082932.24386-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::336; envelope-from=philmd@linaro.org; helo=mail-wm1-x336.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: 1673343893664100001 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- 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 11:37:31 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=1673343564; cv=none; d=zohomail.com; s=zohoarc; b=AU4wTiiEcg/rWyKv5je0zds+L5mQIDJq73C2KQKXXwBTtgUYDNfGKA2U6oKkqKX1KXF0MmvyIy/kOfc656EBcZnZ+6xMESPiuZrU4xezyhhK4ZM8EOPZv4vrH6ejWRNEXXQuDp3BrOd3NA6SpH8JyzT3AP4+0DB69liElzqoMGE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673343564; 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=JnDCtIvff6FY1+m212QAL+3gZCOeJiv1/uFWTGKnkfmd47V8s8SXYN+L7qO0butbsqd6W1zQqTRpIe7jYwf0DO+gMUTX0DHwzo2PdO+5fZ7SPhM9PVbpz8Heq08ub0SQBE5m8AJ9NxTA9C86L99kE9oJdyzsX8CnvdTVqs5aXao= 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 167334356496571.96019517457012; Tue, 10 Jan 2023 01:39:24 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pFA17-0006fh-5M; Tue, 10 Jan 2023 03:29:57 -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 1pFA11-0006eR-Sm for qemu-devel@nongnu.org; Tue, 10 Jan 2023 03:29:51 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pFA10-0006JN-CH for qemu-devel@nongnu.org; Tue, 10 Jan 2023 03:29:51 -0500 Received: by mail-wm1-x32d.google.com with SMTP id m3so8200357wmq.0 for ; Tue, 10 Jan 2023 00:29:49 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id c18-20020a05600c0ad200b003d9c97d82f2sm13869803wmr.8.2023.01.10.00.29.47 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 10 Jan 2023 00:29:48 -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=IhhgT/jdED5YXPhBH+OO3KYG25RU8oHkoKptSPMMkUnvrq14RWge8xot7+BYF/fYoa IaTA3ZiPJpi6oEoZd6PTQVbWG19MVIgK8ftcN9yXUO8/yWGOsYHDaSs1CIdGaaFKJnFw wYcriEdUxNH7+5Q1kj+bk5xgiBb3YhCFXoiGe1mOwD66anFS+8mTrkHbgJqPX6DkFa9i D15FCq9Yn9OgmbTvVrp2GLhTsFD/wzhs2fxME7j1YGeTo+3AGRUrJCeO72J/hQJNeJgd kF1i1Elf94RvJ51+/XFTS7sHeGD1urKDepnvnANCumMrir4PbVmOwjboXRQHfGItpObo YJ3A== 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=abF+unEnq9nqf3wEKICqsGXcIMEvV8NQdDoklQYSfbDLg+4RAF3Ml84gPDdwT2KOld 4iwNBUI2CRjvDHXMyw9tKWY8cgZVAVM5HDfgoGd5aghvGxG6bjZXjbhLBumJyDYEWPoJ WYP/VML9RZhWqa2onPD7MgXHe3eAA1cbOFhlGBR5tBfiOTV02b6cLZglzVNwqCM3u+Yb k+xVk9HmSbjKnILpHQBRXWZezQ6c/o/JkFLYOfUb9okjFxir36a+ZMVHKN/O2cejkd3P oNzeqc5CoyWU5lcAndmF5aT4bsNdQJeEA0nj2BXrSaHI1gULuzNAqBK2yCy/1VQ7yD2g Tr4Q== X-Gm-Message-State: AFqh2kphh0J50THQq4ET8UjFTcmhMLKCzlIafWHnC3KGAgRvY8ACZUbN gxTylKQ7SuWTrXoJJcnhVT5F8xCRvokFVGQS X-Google-Smtp-Source: AMrXdXsnZYL5fy72RRlieJMCa9sswsYMKs7XxMecV/QeNKHFUz99GzaKKqvHBMG/9giPkjYjOqAaLw== X-Received: by 2002:a05:600c:ac8:b0:3d7:7cea:b410 with SMTP id c8-20020a05600c0ac800b003d77ceab410mr48541017wmr.33.1673339388858; Tue, 10 Jan 2023 00:29:48 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Thomas Huth , Jan Kiszka , qemu-trivial@nongnu.org, qemu-arm@nongnu.org, Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PATCH v2 3/5] hw/i2c/bitbang_i2c: Change state calling bitbang_i2c_set_state() helper Date: Tue, 10 Jan 2023 09:29:30 +0100 Message-Id: <20230110082932.24386-4-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230110082932.24386-1-philmd@linaro.org> References: <20230110082932.24386-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::32d; envelope-from=philmd@linaro.org; helo=mail-wm1-x32d.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: 1673343567469100001 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- 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 11:37:31 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=1673339483; cv=none; d=zohomail.com; s=zohoarc; b=Q7owkJNbsJwNz5krf3y63CahwFweuds6AlkMJji7WTEB1gNn60m2w0xRD9/mB90lnHoiQU4qXcMj2X0PO6A19kXt6D9lkB5190aAkOcPrfLYFGS7DsJA1DpRojnGwpdpDWQN9pP+ocqayLRRmH1jfi4mM6w1I+nvZnMREtXVH+0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673339483; 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=s3fAH0u4CO+FRORAz0QlHL8PSjAcVIMkkv12suNzz80=; b=QHMpo6wIUpOeojHOY/oGpmISPgRW8crw4y9uM2lexPe0h7OBq87s6fiWRNrS19JS+G7C98BpKs0+iCmBhezaltE+szp33hXZVoey1v4zlEwjG9GrdLnGa7KAIWRaj4L7aPvLNjdJZRUygusfvZHzxIdydUpno5WrMgukTzVFjRo= 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 1673339483747347.52761394874153; Tue, 10 Jan 2023 00:31:23 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pFA1A-0006ho-S4; Tue, 10 Jan 2023 03:30:00 -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 1pFA19-0006gx-EB for qemu-devel@nongnu.org; Tue, 10 Jan 2023 03:29:59 -0500 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pFA16-0006KD-M8 for qemu-devel@nongnu.org; Tue, 10 Jan 2023 03:29:59 -0500 Received: by mail-wm1-x32e.google.com with SMTP id k26-20020a05600c1c9a00b003d972646a7dso11167864wms.5 for ; Tue, 10 Jan 2023 00:29:54 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id f11-20020a05600c4e8b00b003d04e4ed873sm20981447wmq.22.2023.01.10.00.29.52 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 10 Jan 2023 00:29:53 -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=s3fAH0u4CO+FRORAz0QlHL8PSjAcVIMkkv12suNzz80=; b=kqb4yADbvtKvCnlbrNu9NIj6vjEzfUz7MjJsVWdfHRHd6SVBf7j6Y2l6Aes7kg+kD2 ttmODfhIPtZ2UOQN3OPJZ+3rRT+n/nnVYzGhYMeUWHny9svEcKlgYOKS9LPcYzOn2YtH pTEsFeyNtdqwiSIspy/7REabfK/W1EYM8RoaFL7kKGsI06KOWTDv6h7fyKfDk3t758Za rRTlAz+HBn6e7+LgWhFPDnhOoPHz+sb6v23dVQ3n/djjFEHPIVK/3IiBHLMoFyusudj6 mpg9YXXB99SwHV2vldlwtZXIcBvnLCZsCcctHF7MBJp3iXDaWfvl2QbmRF/f9/L+8j+l G3ng== 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=s3fAH0u4CO+FRORAz0QlHL8PSjAcVIMkkv12suNzz80=; b=Q17+13NeWW6AUnaG33bxq5cM8IqSNdFz34YRv7gwhYteW6B5Xn5gDAfmGKvsZXSELa Yz0y/wA63QPhaAVrkkhTXN5zSbZwurxe1LNCc791EVB/3tsx78CsucOtTXm0XbRrLaty xLRu5E6doFVSiGFewx5G+N8fSQ/oIR+fLXlAc8cXKQvlgWqBZcGY1y6XZu6KxdDzPKCP ar10RcId1nz5WdBkBeLA7HXgvocJXRhexbULRV+03Nywu9k51yVKGGfF/HjeqXWvws8B jAY4vUoA2hd9/lKZqEEwYmfCDKpXZ54+mnmowtvaRumCqJIo9lgU3p7ipf8AQRF523O6 ebQQ== X-Gm-Message-State: AFqh2krTeeDG682boMC7GuLjcXzrmeheTcolbB37//FCiZVUTaORDn8u LjqEdkp8uuycecUrbi/t6Od0XBJnEcihHpkA X-Google-Smtp-Source: AMrXdXvX9KUk+f52ZZseG4pI7G3oscEZIqgCkVGIlHJg/uOrQY9Irf/nWXxsAG9NvQzylvr2atVT2w== X-Received: by 2002:a05:600c:248:b0:3d3:5d47:271c with SMTP id 8-20020a05600c024800b003d35d47271cmr47600987wmj.12.1673339393679; Tue, 10 Jan 2023 00:29:53 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Thomas Huth , Jan Kiszka , qemu-trivial@nongnu.org, qemu-arm@nongnu.org, Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PATCH v2 4/5] hw/i2c/bitbang_i2c: Trace state changes Date: Tue, 10 Jan 2023 09:29:31 +0100 Message-Id: <20230110082932.24386-5-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230110082932.24386-1-philmd@linaro.org> References: <20230110082932.24386-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::32e; envelope-from=philmd@linaro.org; helo=mail-wm1-x32e.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: 1673339485833100003 Trace bitbang state machine changes with trace events. Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- 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..8a67ff6fae 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 *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 11:37:31 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=1673342287; cv=none; d=zohomail.com; s=zohoarc; b=hUQEnTM0UywgnZWDRvfa6V+3/c9/aBRO9xqZINv4MTbJQLjWarhtL7ZEK+oWYr6CFjc357IS5UzL3r7uXE/M01yMTsA+vaErrsq3CMGgf/7RTxxUm1rfRKES/vtBrZEks/4e3Zbh7kJW7Tr4Qz3ZxcNpH4n9yrlQAmpirmL4cnc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673342287; 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=YTYPqD95cY5TwqXLZ5zIgXtmsM6zTeYLc7VV77204BU=; b=DeOAx8znnzycjNToePVkjFxRRJBz4eAUAnmIPicoNxlw2HJybl2YgKXyiZlHohUYIwkuxDRXI9C8XGiBc9yPIYpHKtaEFAFXkC3NMq2CJ6yY/NhA17FXSMvF0zwkPPsjg+4qPSA69uja9zslMB2mFrygststLLkaW7jhSPFFsUk= 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 1673342287355712.3759380946688; Tue, 10 Jan 2023 01:18:07 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pFA1D-0006l1-NS; Tue, 10 Jan 2023 03:30:03 -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 1pFA1C-0006j4-1p for qemu-devel@nongnu.org; Tue, 10 Jan 2023 03:30:02 -0500 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pFA1A-0006Kk-1U for qemu-devel@nongnu.org; Tue, 10 Jan 2023 03:30:01 -0500 Received: by mail-wm1-x32e.google.com with SMTP id ja17so8178981wmb.3 for ; Tue, 10 Jan 2023 00:29:59 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id o5-20020a05600c510500b003b4ff30e566sm841192wms.3.2023.01.10.00.29.57 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 10 Jan 2023 00:29:58 -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=YTYPqD95cY5TwqXLZ5zIgXtmsM6zTeYLc7VV77204BU=; b=eggjPYCc4xn/NK5p5yg68Sq4fZyFvEQtpAOmXKiQ0G+NdIfSHKHWSriObpl7Cvz1FE 9FV40vwFJmLxn02ypMbOi588HbamYm27/7Cf6fjbwGsgN5dE85Fxn65bFleAmA+5ufdq xjwBI8Zzs+7HyD/6iBW2ufpD3jylMG29FMO8qFzEgfn/oXxp9QtcSf+Z0gs53AGBxR3V +HaXe9wRAXcv9azkxqVxdWQ1p45VMsQDUvOoqU+p4gNTNgqldz/NpSa9/eJs70tM6mt9 uGnwcS2iDhidHTR8n9yY5gELuhYxtY9PJhSCPnljM/fuTIvjOT2cYxkfvQ4I0OCDmHIU ghZA== 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=YTYPqD95cY5TwqXLZ5zIgXtmsM6zTeYLc7VV77204BU=; b=duX4PjxwclOQRMNjQpT0/4KGVamncQ5Y0YFsk2mglzwSVveCyF9zlKwfB1ghejrcFV W3PP0R20Kt09bDoZBcak6sP/NLGTiEP9ZOrcGfIhqvc5T/JVMKGChz4/ae9AAeoJs4th VHplzps+34mgGeMmwamkETrn5bZTyHV8qMdXqGOGiYxUD1z7tZLxOQn5wyKkZF5DnBMg Ntvu2Klzpa90SHNFIXiYr52vDVNGboUsLVyaZSX2VU8QdT+YtK5WtfUhGd3EPJO70UW1 40eVdMuVET6271AK7LP7vfm+QNkk+OjLNlpWSSe55b2/JtB6hKvAhKtcd19dVq8rDoGZ aVmQ== X-Gm-Message-State: AFqh2kqEh7vGI5yXrw2OSdDqKLknf017InUcAxtVaQva/yaaku0sGQZy xDssb5Upb6QOGGzSveLpComfZD7abNUbLxoe X-Google-Smtp-Source: AMrXdXtcXJe/pm61EsruafLc5p6O8B7f0PR/fGDYkhTtJ81G9ReJXYrc/2ULCFzCAf+eZMYJhRNJgw== X-Received: by 2002:a05:600c:4f48:b0:3c6:f7ff:6f87 with SMTP id m8-20020a05600c4f4800b003c6f7ff6f87mr49313237wmq.11.1673339398585; Tue, 10 Jan 2023 00:29:58 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Thomas Huth , Jan Kiszka , qemu-trivial@nongnu.org, qemu-arm@nongnu.org, Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PATCH v2 5/5] hw/i2c/bitbang_i2c: Convert DPRINTF() to trace events Date: Tue, 10 Jan 2023 09:29:32 +0100 Message-Id: <20230110082932.24386-6-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230110082932.24386-1-philmd@linaro.org> References: <20230110082932.24386-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::32e; envelope-from=philmd@linaro.org; helo=mail-wm1-x32e.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: 1673342288851100002 Convert the remaining DPRINTF debug macro uses to tracepoints. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- 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 8a67ff6fae..d6589f0d4a 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 *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