From nobody Fri Dec 19 17:08:48 2025 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=1592912994; cv=none; d=zohomail.com; s=zohoarc; b=Z3CpHrBjpehR0Fzf1dS8s8AWR50a/P+acO1/2s811QMwrK63tk0VcZX6ydtZbGwe9KmCQHG210oiVALBICaHL5otQRqpkErSjWXomLq9CEELVIETIl4Zvu00dAZDmO7c2Z7r4mmf1+7QOrJJuliuKDiC1fV5vl06E6/iXGWRBz4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592912994; h=Content-Type:Content-Transfer-Encoding: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=mmdsLUjFh7ohZWxR1J/P4GhrVs/dAJ8di+ouWpFUciU=; b=E5CgdFjEoRNPm6LBt+ASafx8WPS0lagGlfGJ8t527Qx+B1ttUa03eWAkD1Bkap3g+3cnx0IUaBjS1uoM/Q0zvlIaPCiuAeiCKAV3XzSa9Sw4AWKiuXsHOYkxstSLiWnSK4bAg5ze4V560PPmDY9bvCe2SHq6V+KaMBn50+ruLj8= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592912994367776.7383862712445; Tue, 23 Jun 2020 04:49:54 -0700 (PDT) Received: from localhost ([::1]:35514 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jnhR2-0003qs-Vq for importer@patchew.org; Tue, 23 Jun 2020 07:49:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44320) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jnhHD-0003Mc-04 for qemu-devel@nongnu.org; Tue, 23 Jun 2020 07:39:43 -0400 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]:46058) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jnhHB-0003MN-6T for qemu-devel@nongnu.org; Tue, 23 Jun 2020 07:39:42 -0400 Received: by mail-wr1-x430.google.com with SMTP id s10so210599wrw.12 for ; Tue, 23 Jun 2020 04:39:40 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id m10sm4022177wru.4.2020.06.23.04.39.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jun 2020 04:39:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=mmdsLUjFh7ohZWxR1J/P4GhrVs/dAJ8di+ouWpFUciU=; b=T0ypwWmRk24gC3ZDBC25X0HhIN5Jxx9PX0sO+rezghTlT6JuI8E0W77x4iHYuTyN4w sMfugxxeigTtUmpjvzbQYA3BBh4zVAJzawwMXOIxv7MZAEJGhD/Xn4bSRR1UgRx6VSKy s6+YjePxDLWQbMTRlw3p0uZdfKb/itjVvex7vSpozNgId1OPU8v4oMBLBNNYsoE4spLc Mb7cdwm8ev37N4+Ele5r2JbJhSeomGo/YhfZxNhE7Denvk5tj9eOLdbR7sS+ePlv2aAx zH+B/X6cwyL1s/JpZ4pXbcr757XdeCcVcYLpLXOm7p4gDXo6tknh9CyQzqudVzUIu6UL cFuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mmdsLUjFh7ohZWxR1J/P4GhrVs/dAJ8di+ouWpFUciU=; b=X1jmn6pbaKbpg/pvxD66+a9mBpqBTQG91qSH8IrKQ+sdxOsg2gESH+utHtCTMSDIUr ClqUbFij97ukT19fcrMc2DIt3ExxijvUod86Bs6/hjHIt3nJAN+iaHa247gMgp5jwbcr Zw3se906O3cX78sBkNqR8GU3tIA8pbQpOhphfzUR3b5nZWRt7HvWBpGfk5kPgT0Zr9vd QgJ5bEXIJojbXKu3ACnPYyF0tZQtt5xK2GmawRutNbe6mEJa2RPjDh5+FepVEhI4PE3u HdrepOxH3D8/xIS7oalbvGRv1Wh/DeqXXYCdHG/S+Ihc8qMWAvSyP5biSUtoXFZyp8/1 FzWg== X-Gm-Message-State: AOAM533HZYkzvrm4udBDXfGaMNLpu6ox7Ks+E/AYMpaP7i+wXFWcc8GF DqehUarDH2TaSkQ2s9ZX2e+F7mEyffnHow== X-Google-Smtp-Source: ABdhPJxxI1Y4SbbD6SenTw8tMgCZZFRAX0qLUOQ6qpWuwZ70CKDPVW0xCljwh0/aLWV9KNlT6LPcBA== X-Received: by 2002:adf:db4d:: with SMTP id f13mr20905928wrj.336.1592912379587; Tue, 23 Jun 2020 04:39:39 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 28/42] hw/i2c/versatile_i2c: Add SCL/SDA definitions Date: Tue, 23 Jun 2020 12:38:50 +0100 Message-Id: <20200623113904.28805-29-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200623113904.28805-1-peter.maydell@linaro.org> References: <20200623113904.28805-1-peter.maydell@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::430; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x430.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: -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=_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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) From: Philippe Mathieu-Daud=C3=A9 Use self-explicit definitions instead of magic values. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20200617072539.32686-4-f4bug@amsat.org Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/i2c/versatile_i2c.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/hw/i2c/versatile_i2c.c b/hw/i2c/versatile_i2c.c index 040139d701b..0ce10a1bcc0 100644 --- a/hw/i2c/versatile_i2c.c +++ b/hw/i2c/versatile_i2c.c @@ -45,6 +45,9 @@ REG32(CONTROL_GET, 0) REG32(CONTROL_SET, 0) REG32(CONTROL_CLR, 4) =20 +#define SCL BIT(0) +#define SDA BIT(1) + static uint64_t versatile_i2c_read(void *opaque, hwaddr offset, unsigned size) { @@ -76,8 +79,8 @@ static void versatile_i2c_write(void *opaque, hwaddr offs= et, qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%x\n", __func__, (int)offset); } - bitbang_i2c_set(&s->bitbang, BITBANG_I2C_SCL, (s->out & 1) !=3D 0); - s->in =3D bitbang_i2c_set(&s->bitbang, BITBANG_I2C_SDA, (s->out & 2) != =3D 0); + bitbang_i2c_set(&s->bitbang, BITBANG_I2C_SCL, (s->out & SCL) !=3D 0); + s->in =3D bitbang_i2c_set(&s->bitbang, BITBANG_I2C_SDA, (s->out & SDA)= !=3D 0); } =20 static const MemoryRegionOps versatile_i2c_ops =3D { --=20 2.20.1