From patchwork Thu Jul 14 18:27:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hao Wu X-Patchwork-Id: 12918398 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2409BC43334 for ; Thu, 14 Jul 2022 18:36:49 +0000 (UTC) Received: from localhost ([::1]:57352 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oC3hg-0005Qg-4e for qemu-devel@archiver.kernel.org; Thu, 14 Jul 2022 14:36:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36534) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <3MGDQYggKCk8DByr5A9yx55x2v.t537v3B-uvCv2454x4B.58x@flex--wuhaotsh.bounces.google.com>) id 1oC3ZE-0004J5-7E for qemu-devel@nongnu.org; Thu, 14 Jul 2022 14:28:04 -0400 Received: from mail-pf1-x449.google.com ([2607:f8b0:4864:20::449]:42794) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <3MGDQYggKCk8DByr5A9yx55x2v.t537v3B-uvCv2454x4B.58x@flex--wuhaotsh.bounces.google.com>) id 1oC3ZC-0007Mn-Nr for qemu-devel@nongnu.org; Thu, 14 Jul 2022 14:28:03 -0400 Received: by mail-pf1-x449.google.com with SMTP id cu3-20020a056a00448300b0052ae559108fso1510903pfb.9 for ; Thu, 14 Jul 2022 11:28:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=vhcn9HX+W8BDC3zc9EzHTKhU6VuXS2Qk41Wg69c1pG8=; b=tBQdneFk1mZ3l+qSjTrc7swcXUrArsAjIK7JSlXHfs9mMU1T+GXX+1JzNeRPZUVhLZ 8fphVp/crtIfCay4H/u7cwDF8cRdum8s1gq4LIRni/jZcdbb+Kvm2wKHBUHKNjiSfjcF k+v4VWkRUQFbNfdbo3DJMwxJ/LeXocq6r2qpliEyrdws0LbtQEHosChiWsdKXKEQoKEH steCSxWKWMDdhQ53lYADXQajyKaOo6SioTNHvxIiZn8y8Txc/Jrl/zs576JRo5W/ozxS r5+ALQyOia4QG4+jnef3SC0Juv18jMGKyHqaJw2tBSpZvllcjEr3O0DHjoIbOonP+gyC WQhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=vhcn9HX+W8BDC3zc9EzHTKhU6VuXS2Qk41Wg69c1pG8=; b=4ZunG2zRmHlEiwnqRnnlPuClJpHkN91BROpNtmyMbz1n8s4Za57muVHClYhF++jabW osDuLaYW3P9Li1bXl8EoOreTlaEbcUpw7VnUs42t4SZ2kKMxjy7RrR+uyAbo0gKMms2w EPokeXXrQZp398o+pU7pcXCzw6ZdvGZIve9Qm67ZPhh6yy5SP2czyMK3yBDEUMpJrs1t OhOh6t7jz1xPFvfZsculr0dJ1vcEYwjLRdrnC5ogeN5SebCvSrVhgXTOF0qeIQU33mMh VrhQSiSBz20YSO/RY62fsoX+IK6bViyuOrimH8YyMjzuu8TSkjMnRi5litmtmG66/822 vEzA== X-Gm-Message-State: AJIora9FnURzyTpfSzIuzcyH4ENuef5RQOCrxyoO6cOvuFCIE0loIaXR B4l0Yb6t2ZmY+z+CQn/x8YcGU8jPobv1xg== X-Google-Smtp-Source: AGRyM1tlxa/879nc1eRONpvWhDyUKu3hiZow9ESzRrsjDRClvMMJZRTIVXQqQREl+VnTkF3OueQxO8/fX9/L9Q== X-Received: from mimik.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:4e]) (user=wuhaotsh job=sendgmr) by 2002:a62:6183:0:b0:52a:c31d:11b7 with SMTP id v125-20020a626183000000b0052ac31d11b7mr9562442pfb.74.1657823280730; Thu, 14 Jul 2022 11:28:00 -0700 (PDT) Date: Thu, 14 Jul 2022 11:27:40 -0700 In-Reply-To: <20220714182756.85664-1-wuhaotsh@google.com> Message-Id: <20220714182756.85664-2-wuhaotsh@google.com> Mime-Version: 1.0 References: <20220714182756.85664-1-wuhaotsh@google.com> X-Mailer: git-send-email 2.37.0.170.g444d1eabd0-goog Subject: [PATCH 1/8] hw/i2c: Clear ACK bit in NPCM7xx SMBus module From: Hao Wu To: peter.maydell@linaro.org Cc: richard.henderson@linaro.org, qemu-arm@nongnu.org, qemu-devel@nongnu.org, wuhaotsh@google.com, venture@google.com, Avi.Fishman@nuvoton.com, kfting@nuvoton.com, hskinnemoen@google.com, f4bug@amsat.org, bin.meng@windriver.com, qemu-block@nongnu.org, armbru@redhat.com, thuth@redhat.com, Titus Rwantare Received-SPF: pass client-ip=2607:f8b0:4864:20::449; envelope-from=3MGDQYggKCk8DByr5A9yx55x2v.t537v3B-uvCv2454x4B.58x@flex--wuhaotsh.bounces.google.com; helo=mail-pf1-x449.google.com X-Spam_score_int: -95 X-Spam_score: -9.6 X-Spam_bar: --------- X-Spam_report: (-9.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, 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, T_SCC_BODY_TEXT_LINE=-0.01, USER_IN_DEF_DKIM_WL=-7.5 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" The ACK bit in NPCM7XX SMBus module should be cleared each time it sends out a NACK signal. This patch fixes the bug that it fails to do so. Signed-off-by: Hao Wu Reviewed-by: Titus Rwantare Reviewed-by: Peter Maydell --- hw/i2c/npcm7xx_smbus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/i2c/npcm7xx_smbus.c b/hw/i2c/npcm7xx_smbus.c index e7e0ba66fe..f18e311556 100644 --- a/hw/i2c/npcm7xx_smbus.c +++ b/hw/i2c/npcm7xx_smbus.c @@ -270,7 +270,7 @@ static void npcm7xx_smbus_recv_byte(NPCM7xxSMBusState *s) if (s->st & NPCM7XX_SMBCTL1_ACK) { trace_npcm7xx_smbus_nack(DEVICE(s)->canonical_path); i2c_nack(s->bus); - s->st &= NPCM7XX_SMBCTL1_ACK; + s->st &= ~NPCM7XX_SMBCTL1_ACK; } trace_npcm7xx_smbus_recv_byte((DEVICE(s)->canonical_path), s->sda); npcm7xx_smbus_update_irq(s); From patchwork Thu Jul 14 18:27:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hao Wu X-Patchwork-Id: 12918388 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 94DC4C433EF for ; Thu, 14 Jul 2022 18:32:27 +0000 (UTC) Received: from localhost ([::1]:49366 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oC3dS-0008I9-LT for qemu-devel@archiver.kernel.org; Thu, 14 Jul 2022 14:32:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36588) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <3MmDQYggKClEFD0t7CB0z77z4x.v759x5D-wxEx4676z6D.7Az@flex--wuhaotsh.bounces.google.com>) id 1oC3ZF-0004M3-Kf for qemu-devel@nongnu.org; Thu, 14 Jul 2022 14:28:05 -0400 Received: from mail-pl1-x64a.google.com ([2607:f8b0:4864:20::64a]:51109) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <3MmDQYggKClEFD0t7CB0z77z4x.v759x5D-wxEx4676z6D.7Az@flex--wuhaotsh.bounces.google.com>) id 1oC3ZE-0007T5-5d for qemu-devel@nongnu.org; Thu, 14 Jul 2022 14:28:05 -0400 Received: by mail-pl1-x64a.google.com with SMTP id q4-20020a170902dac400b0016becde3dfbso587397plx.17 for ; Thu, 14 Jul 2022 11:28:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=TM8Kh0gGU2hIWoEk51Qm6WG9lPFo5JxHmzkWdY1yzZE=; b=p0cH6IXxkzUspP/eJTqe5KW03kk2E7qB9PtS3r7Q3gCJPA0R4DBuHl7UhHgEvRWf2o iGppc1bcFzVQMvXmaxAG2fIgtjpfmtaAiiIX/uNZDeAa5Jq74DmFHxs54fTGnNyPBZa+ vKMUtD5VcSIBpbfTmjt1A0oJkP62y6OKVPtfhUNZyCqx0IvmblQPg/xMuTjI4yb/zf1b IG45GNNOcPJTZjJ7vHY1OFNkZ/CNwLWeoH7w5nZFxnqDlpI9e5VEFxo5uzMQ/7mD93gE Z9gTlZtueZQb6uW07jV1aArwpUBdrk3j4yrMppLqhJm64Wyy8qQu8QI+1vgFJdrb1ge/ tnWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=TM8Kh0gGU2hIWoEk51Qm6WG9lPFo5JxHmzkWdY1yzZE=; b=M062l/273tzaHSwC/dIcPWTAlWELrP9CXF1x6Y4XMWjPybT2l6+v7iicQvryxPYqqS 0xYlDGJliQphkHUwb5egznaEs8KUpaIMzvJka28wY30vIL0jxtSlYeU8jJNaOwLlChnn vvU4conO1lXTnOd8lmz95VdE3tMCrcYYd9b3e+xpPK1MDiP32xZPehffjOJuKIaopEPM OJkNSDlVEiX7pgoW9gc8pQXrqIfTwFWxgSy16oFpUchKaXgJatx8y7yGeYXAo4FNQay1 hp1gXk8haNkgEj0ht9r0wez2og0d8jxkx27y5q93CbNWSL0LY5d0uG9Qc2CTpTUN3r0j mUNA== X-Gm-Message-State: AJIora+BDdGcYy2fnxlwCEDgxCT0bvO8K3aaC68BrwtQu0hnQ9ig00MS h7/8CSTBEqs9bVbnVdXsEWeAiD21f+v7Zw== X-Google-Smtp-Source: AGRyM1tiqkW+LZRX69MsCTxdtJgFEImXitzC4obqVUIWPcgUvh9OcrRDwlVfwC7PJr6m4OEBQP8ZB5TDusWqWg== X-Received: from mimik.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:4e]) (user=wuhaotsh job=sendgmr) by 2002:a05:6a00:c91:b0:52a:cad7:d755 with SMTP id a17-20020a056a000c9100b0052acad7d755mr9830300pfv.66.1657823282162; Thu, 14 Jul 2022 11:28:02 -0700 (PDT) Date: Thu, 14 Jul 2022 11:27:41 -0700 In-Reply-To: <20220714182756.85664-1-wuhaotsh@google.com> Message-Id: <20220714182756.85664-3-wuhaotsh@google.com> Mime-Version: 1.0 References: <20220714182756.85664-1-wuhaotsh@google.com> X-Mailer: git-send-email 2.37.0.170.g444d1eabd0-goog Subject: [PATCH 2/8] hw/i2c: Read FIFO during RXF_CTL change in NPCM7XX SMBus From: Hao Wu To: peter.maydell@linaro.org Cc: richard.henderson@linaro.org, qemu-arm@nongnu.org, qemu-devel@nongnu.org, wuhaotsh@google.com, venture@google.com, Avi.Fishman@nuvoton.com, kfting@nuvoton.com, hskinnemoen@google.com, f4bug@amsat.org, bin.meng@windriver.com, qemu-block@nongnu.org, armbru@redhat.com, thuth@redhat.com, Titus Rwantare , Corey Minyard Received-SPF: pass client-ip=2607:f8b0:4864:20::64a; envelope-from=3MmDQYggKClEFD0t7CB0z77z4x.v759x5D-wxEx4676z6D.7Az@flex--wuhaotsh.bounces.google.com; helo=mail-pl1-x64a.google.com X-Spam_score_int: -95 X-Spam_score: -9.6 X-Spam_bar: --------- X-Spam_report: (-9.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, 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, T_SCC_BODY_TEXT_LINE=-0.01, USER_IN_DEF_DKIM_WL=-7.5 autolearn=ham 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Originally we read in from SMBus when RXF_STS is cleared. However, the driver clears RXF_STS before setting RXF_CTL, causing the SM bus module to read incorrect amount of bytes in FIFO mode when the number of bytes read changed. This patch fixes this issue. Signed-off-by: Hao Wu Reviewed-by: Titus Rwantare Acked-by: Corey Minyard --- hw/i2c/npcm7xx_smbus.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/i2c/npcm7xx_smbus.c b/hw/i2c/npcm7xx_smbus.c index f18e311556..1435daea94 100644 --- a/hw/i2c/npcm7xx_smbus.c +++ b/hw/i2c/npcm7xx_smbus.c @@ -637,9 +637,6 @@ static void npcm7xx_smbus_write_rxf_sts(NPCM7xxSMBusState *s, uint8_t value) { if (value & NPCM7XX_SMBRXF_STS_RX_THST) { s->rxf_sts &= ~NPCM7XX_SMBRXF_STS_RX_THST; - if (s->status == NPCM7XX_SMBUS_STATUS_RECEIVING) { - npcm7xx_smbus_recv_fifo(s); - } } } @@ -651,6 +648,9 @@ static void npcm7xx_smbus_write_rxf_ctl(NPCM7xxSMBusState *s, uint8_t value) new_ctl = KEEP_OLD_BIT(s->rxf_ctl, new_ctl, NPCM7XX_SMBRXF_CTL_LAST); } s->rxf_ctl = new_ctl; + if (s->status == NPCM7XX_SMBUS_STATUS_RECEIVING) { + npcm7xx_smbus_recv_fifo(s); + } } static uint64_t npcm7xx_smbus_read(void *opaque, hwaddr offset, unsigned size) From patchwork Thu Jul 14 18:27:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hao Wu X-Patchwork-Id: 12918399 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0E862C433EF for ; Thu, 14 Jul 2022 18:36:54 +0000 (UTC) Received: from localhost ([::1]:57772 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oC3hk-0005iJ-TR for qemu-devel@archiver.kernel.org; Thu, 14 Jul 2022 14:36:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36626) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <3M2DQYggKClIGE1u8DC108805y.w86Ay6E-xyFy578707E.8B0@flex--wuhaotsh.bounces.google.com>) id 1oC3ZH-0004P5-B7 for qemu-devel@nongnu.org; Thu, 14 Jul 2022 14:28:07 -0400 Received: from mail-pl1-x64a.google.com ([2607:f8b0:4864:20::64a]:42689) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <3M2DQYggKClIGE1u8DC108805y.w86Ay6E-xyFy578707E.8B0@flex--wuhaotsh.bounces.google.com>) id 1oC3ZF-0007ZT-S5 for qemu-devel@nongnu.org; Thu, 14 Jul 2022 14:28:07 -0400 Received: by mail-pl1-x64a.google.com with SMTP id h11-20020a170902f54b00b0016bfdca124fso579215plf.9 for ; Thu, 14 Jul 2022 11:28:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=9RSMCVtgEUKdUpQ4wTwqsgQXo0b+gCf5+b6+bpknwSs=; b=kB9++DeA7Tuwm65j9dS/PIkc3ajOl7RxD50DCUI+//OeUMsQE0AWmS94p4OhIm/fn1 oiNfku8QN5qD+fTJbnebnVWgiOlY85giWrdslJjXZsjyM2M7YzgZK+OK5z9l0ttdNBTn +/QBcmWbzf2IMAFmAT4Jmj71uAnlCUcPYPrxmU6a06bO74F0rfRfVLYgEZi19NNDvXCK Hdecs54kt/PmGniwMEPQqtSB7vEQ+TPmEmkcpQWZ5A54GyDSqc0VV72ELMJO5NRLZG46 ++jDsvfVQ+14HqMWxyiR1czTkTqXM/rtDscJh4rm91tF+/c28g8+SwWbBkbnnqeTa04a A1DA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=9RSMCVtgEUKdUpQ4wTwqsgQXo0b+gCf5+b6+bpknwSs=; b=v+OD0aipnm0kzrZGmoRsbLUa/DYUZ1mmyl2zA7f0XJ5/TdX2CkMOMzeiC0bd5NFj4V f1ZAsVGGa1SyWgsusEc0WZcybDDH1V06JHZGBAjSvCNvvW9pOuwq87Mtr6fLrQRouEeq coOb7Zlfdhtzn4fZ/sKMFw98+PSWBjdBLz2+i58AaMIQb2s6/pxEIfvIJGt+8bTelaGV nj75d0bA2MEYAwpyW8uLwQkqBe4tgW/OCsdCvEMHlAlZ8sFJnFy51sEhbD9QXVZuLw7d +dK2CdDpenTmbs4hb3fmTolqMPyREkcxn3SGkK8dOQobobtUHVDjMfbkp5Ui+Pol0kM0 7IOQ== X-Gm-Message-State: AJIora+hEiyh25DMMZSoh/5o0s/kEuZFA5pTeiXZDuhDJz7cJCOsGrwu CnepKtcLK/Lc4hfCby8sSNCbddLZPXFcBA== X-Google-Smtp-Source: AGRyM1vXJ0ABwDa022SILpCpo/T0vAt11/A2wcndrzr4au279rxVtgcHSosNvZ6Tv/4kFnis6ATiQz2HMXvvwg== X-Received: from mimik.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:4e]) (user=wuhaotsh job=sendgmr) by 2002:a05:6a00:188e:b0:52a:b545:559f with SMTP id x14-20020a056a00188e00b0052ab545559fmr9756292pfh.18.1657823283979; Thu, 14 Jul 2022 11:28:03 -0700 (PDT) Date: Thu, 14 Jul 2022 11:27:42 -0700 In-Reply-To: <20220714182756.85664-1-wuhaotsh@google.com> Message-Id: <20220714182756.85664-4-wuhaotsh@google.com> Mime-Version: 1.0 References: <20220714182756.85664-1-wuhaotsh@google.com> X-Mailer: git-send-email 2.37.0.170.g444d1eabd0-goog Subject: [PATCH 3/8] hw/adc: Fix CONV bit in NPCM7XX ADC CON register From: Hao Wu To: peter.maydell@linaro.org Cc: richard.henderson@linaro.org, qemu-arm@nongnu.org, qemu-devel@nongnu.org, wuhaotsh@google.com, venture@google.com, Avi.Fishman@nuvoton.com, kfting@nuvoton.com, hskinnemoen@google.com, f4bug@amsat.org, bin.meng@windriver.com, qemu-block@nongnu.org, armbru@redhat.com, thuth@redhat.com Received-SPF: pass client-ip=2607:f8b0:4864:20::64a; envelope-from=3M2DQYggKClIGE1u8DC108805y.w86Ay6E-xyFy578707E.8B0@flex--wuhaotsh.bounces.google.com; helo=mail-pl1-x64a.google.com X-Spam_score_int: -95 X-Spam_score: -9.6 X-Spam_bar: --------- X-Spam_report: (-9.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, 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, T_SCC_BODY_TEXT_LINE=-0.01, USER_IN_DEF_DKIM_WL=-7.5 autolearn=ham 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" The correct bit for the CONV bit in NPCM7XX ADC is bit 13. This patch fixes that in the module, and also lower the IRQ when the guest is done handling an interrupt event from the ADC module. Signed-off-by: Hao Wu Reviewed-by: Patrick Venture Reviewed-by: Peter Maydell --- hw/adc/npcm7xx_adc.c | 2 +- tests/qtest/npcm7xx_adc-test.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/adc/npcm7xx_adc.c b/hw/adc/npcm7xx_adc.c index 0f0a9f63e2..47fb9e5f74 100644 --- a/hw/adc/npcm7xx_adc.c +++ b/hw/adc/npcm7xx_adc.c @@ -36,7 +36,7 @@ REG32(NPCM7XX_ADC_DATA, 0x4) #define NPCM7XX_ADC_CON_INT BIT(18) #define NPCM7XX_ADC_CON_EN BIT(17) #define NPCM7XX_ADC_CON_RST BIT(16) -#define NPCM7XX_ADC_CON_CONV BIT(14) +#define NPCM7XX_ADC_CON_CONV BIT(13) #define NPCM7XX_ADC_CON_DIV(rv) extract32(rv, 1, 8) #define NPCM7XX_ADC_MAX_RESULT 1023 diff --git a/tests/qtest/npcm7xx_adc-test.c b/tests/qtest/npcm7xx_adc-test.c index 3fa6d9ece0..8048044d28 100644 --- a/tests/qtest/npcm7xx_adc-test.c +++ b/tests/qtest/npcm7xx_adc-test.c @@ -50,7 +50,7 @@ #define CON_INT BIT(18) #define CON_EN BIT(17) #define CON_RST BIT(16) -#define CON_CONV BIT(14) +#define CON_CONV BIT(13) #define CON_DIV(rv) extract32(rv, 1, 8) #define FST_RDST BIT(1) From patchwork Thu Jul 14 18:27:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hao Wu X-Patchwork-Id: 12918389 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 734D3C433EF for ; Thu, 14 Jul 2022 18:33:12 +0000 (UTC) Received: from localhost ([::1]:50624 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oC3eB-0000jl-99 for qemu-devel@archiver.kernel.org; Thu, 14 Jul 2022 14:33:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36712) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <3NWDQYggKClQIG3wAFE32AA270.yA8C08G-z0H079A929G.AD2@flex--wuhaotsh.bounces.google.com>) id 1oC3ZK-0004Rg-If for qemu-devel@nongnu.org; Thu, 14 Jul 2022 14:28:10 -0400 Received: from mail-pf1-x44a.google.com ([2607:f8b0:4864:20::44a]:35766) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <3NWDQYggKClQIG3wAFE32AA270.yA8C08G-z0H079A929G.AD2@flex--wuhaotsh.bounces.google.com>) id 1oC3ZH-0007cr-D4 for qemu-devel@nongnu.org; Thu, 14 Jul 2022 14:28:09 -0400 Received: by mail-pf1-x44a.google.com with SMTP id d18-20020aa78692000000b0052abaa9a6bbso1515039pfo.2 for ; Thu, 14 Jul 2022 11:28:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=v6m/uiCVYIYdHovo0UBGiIH0rA+CsNRH+5x6YrDpxrQ=; b=XcGRWi+Uq3bUGrRo38ZAwYEz0iHOnCK64maUEl9ROXqzjgKpP48sWNnZyOooRbl0dJ 9neIX9YJNRFq+0paZCzCQi0dl2zrVZlFbgtRU4j24Q26wqSHxRr3FJ8XI6RD0o8e8VPx /WOCBfHL2kxq7r7pXGCExeFXSQaxQoYbT7HBa6l5VxVO9ZGODKkNpNgd9ZDtu7kFBxeu wrWOTMQ2tLXrZwQhimiAeNREQ0u7HhY3wQPh2j7toNqoDXJHYmLzwALcyr7IpgKmUfWu 0xtKENKVAHx60e8cSbeSd1WTX+90jvQt/yWYLdawU0rVZM9PfFDItjae5UWTXFRtIXqS 7eHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=v6m/uiCVYIYdHovo0UBGiIH0rA+CsNRH+5x6YrDpxrQ=; b=wMKMBMgHbCh30yAf3TILzQExiJAXBhCU/OG/pdU1T10M/u3uql0mplr8i6Q3ZUXdkJ 3AoBF6Qh3KgG+IF+MdS6UAjv02+v4lRHea5U7HDyxj4ypb0ZtkIiWaGoBJp1KS6mbK81 9XEfBFPPG2IXiywnnvjd+43Gh+ZhLR7j7KmPgY54eLJvtdPcRefas7WmB2dRBP5K9SFB Jm3Qfmo7TgsP8PS5H2P3X9SMHUnSH8860FPzCjLd73PJ44RrsYeWCkXHk9hP73bRZW8T oMexG8HmyPdDxZMHgzsGXHqelpIu/3s5Ihe6RgAZ3Zj5L4RzFdUUrVvkd/jIRCtqFjBL D9bg== X-Gm-Message-State: AJIora86lD1Cwltd5t2S+sjXezoO1ryRrsIHh6EMFpiy543pGbNz/hft ZUUj1mqcgqdHLBuuhGbehZaoVy+BWccnjQ== X-Google-Smtp-Source: AGRyM1tPKMAm9k3QuNHnZzgWS42WVpY/7SIxkke1Gz871CO8p6+jbx1kVJCKY1d6JyS16YGp4iGCl02PzIbsYA== X-Received: from mimik.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:4e]) (user=wuhaotsh job=sendgmr) by 2002:a17:902:e5d1:b0:16b:ece4:79e6 with SMTP id u17-20020a170902e5d100b0016bece479e6mr9673854plf.83.1657823285678; Thu, 14 Jul 2022 11:28:05 -0700 (PDT) Date: Thu, 14 Jul 2022 11:27:43 -0700 In-Reply-To: <20220714182756.85664-1-wuhaotsh@google.com> Message-Id: <20220714182756.85664-5-wuhaotsh@google.com> Mime-Version: 1.0 References: <20220714182756.85664-1-wuhaotsh@google.com> X-Mailer: git-send-email 2.37.0.170.g444d1eabd0-goog Subject: [PATCH 4/8] hw/adc: Make adci[*] R/W in NPCM7XX ADC From: Hao Wu To: peter.maydell@linaro.org Cc: richard.henderson@linaro.org, qemu-arm@nongnu.org, qemu-devel@nongnu.org, wuhaotsh@google.com, venture@google.com, Avi.Fishman@nuvoton.com, kfting@nuvoton.com, hskinnemoen@google.com, f4bug@amsat.org, bin.meng@windriver.com, qemu-block@nongnu.org, armbru@redhat.com, thuth@redhat.com, Titus Rwantare Received-SPF: pass client-ip=2607:f8b0:4864:20::44a; envelope-from=3NWDQYggKClQIG3wAFE32AA270.yA8C08G-z0H079A929G.AD2@flex--wuhaotsh.bounces.google.com; helo=mail-pf1-x44a.google.com X-Spam_score_int: -95 X-Spam_score: -9.6 X-Spam_bar: --------- X-Spam_report: (-9.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, 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, T_SCC_BODY_TEXT_LINE=-0.01, USER_IN_DEF_DKIM_WL=-7.5 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Our sensor test requires both reading and writing from a sensor's QOM property. So we need to make the input of ADC module R/W instead of write only for that to work. Signed-off-by: Hao Wu Reviewed-by: Titus Rwantare Reviewed-by: Peter Maydell --- hw/adc/npcm7xx_adc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/adc/npcm7xx_adc.c b/hw/adc/npcm7xx_adc.c index 47fb9e5f74..bc6f3f55e6 100644 --- a/hw/adc/npcm7xx_adc.c +++ b/hw/adc/npcm7xx_adc.c @@ -242,7 +242,7 @@ static void npcm7xx_adc_init(Object *obj) for (i = 0; i < NPCM7XX_ADC_NUM_INPUTS; ++i) { object_property_add_uint32_ptr(obj, "adci[*]", - &s->adci[i], OBJ_PROP_FLAG_WRITE); + &s->adci[i], OBJ_PROP_FLAG_READWRITE); } object_property_add_uint32_ptr(obj, "vref", &s->vref, OBJ_PROP_FLAG_WRITE); From patchwork Thu Jul 14 18:27:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hao Wu X-Patchwork-Id: 12918397 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6202AC433EF for ; Thu, 14 Jul 2022 18:33:56 +0000 (UTC) Received: from localhost ([::1]:51396 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oC3et-0001JK-Ah for qemu-devel@archiver.kernel.org; Thu, 14 Jul 2022 14:33:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36736) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <3N2DQYggKClYKI5yCHG54CC492.0CAE2AI-12J29BCB4BI.CF4@flex--wuhaotsh.bounces.google.com>) id 1oC3ZL-0004Sv-PZ for qemu-devel@nongnu.org; Thu, 14 Jul 2022 14:28:12 -0400 Received: from mail-pl1-x64a.google.com ([2607:f8b0:4864:20::64a]:46603) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <3N2DQYggKClYKI5yCHG54CC492.0CAE2AI-12J29BCB4BI.CF4@flex--wuhaotsh.bounces.google.com>) id 1oC3ZI-0007kv-UY for qemu-devel@nongnu.org; Thu, 14 Jul 2022 14:28:11 -0400 Received: by mail-pl1-x64a.google.com with SMTP id o5-20020a170902d4c500b0016c643623e8so583117plg.13 for ; Thu, 14 Jul 2022 11:28:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=W5HdIYZvabDXn88OiY+HL0ZIRBJ+FpGhhsFX/xssn/M=; b=TsjDMTFyTE6prRqAJ2cjQUdwmtvh1yxWKiWHGVHGAWCa+wb05IpZDy5f0UOa1VWDkx 6bxxwbGBJ8R0TuS3iXBvW/0jMC4fOLh6GUNBVkSBBCRy+e97hSNrWCcDQ+L2wPx5n6k7 cpw4K98+VUlk3aqIJ7fi9QgiH2lu9KwmmKiyqHppUr0l1Klpa9EFJvL0AOUlSVAjNRLN iinNzSVFa1ovK0Ql2Cg8ot0N13IJi6OWzo3t7dyPw61Hdl4jyo6X7IWeL7kVnGop5fCq waQ73caFoqB7hGQcTwjlq9BAgXzyMP6ymsbJ4EawiAM9YWYRrjalk3K7VB/Jdd6dq3IZ FdOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=W5HdIYZvabDXn88OiY+HL0ZIRBJ+FpGhhsFX/xssn/M=; b=tEVO/WyDFrdLASJFtTcIWCu9cb4aCCAOkf5WUv+9akSSu9Vh4JLPz9eyt/yvKhBJjA rct3g+OlugTkN/J6iGCxTndj9TuO1nuT85mUvngfSRzXiZlhQ4RedUK9dWc044EgRv2h f0EMlUPgfjFB6Oj/VZdmHJGe+tWTGnSBYU7neTmlAbITX9E5trU3PDvpnnjh3ZnU8yqp I2pXTW2skHEkYtT1qy4fJD2H+yI94m+/ntRAWK9G0zWKmHkjwsmtgju7RlVKQPQJqPh6 PzdnHlcWTx0g/N2c70YGM0aqB1V+NE9jsatnJvfI2xuw+lvJ9GneiJ+RXxYnBnjgUO0T Pyqw== X-Gm-Message-State: AJIora+MzkznrJmX0ZuMi2oo6cU1wlHMiDHos53dF+9TUpfaDbqxLFg/ mdioORhQUHsWnaWpRcPxSM1yhfAZ2NvaJw== X-Google-Smtp-Source: AGRyM1ufDam9QlwSSz2aRCgjbZTY052xlgvZ5VOzieTmj3DRnnZ9eazqfbEFSk4e7SO+kcTgMeRiaKhWd30S+g== X-Received: from mimik.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:4e]) (user=wuhaotsh job=sendgmr) by 2002:a17:90a:408f:b0:1d1:d1ba:2abb with SMTP id l15-20020a17090a408f00b001d1d1ba2abbmr17792151pjg.152.1657823287351; Thu, 14 Jul 2022 11:28:07 -0700 (PDT) Date: Thu, 14 Jul 2022 11:27:44 -0700 In-Reply-To: <20220714182756.85664-1-wuhaotsh@google.com> Message-Id: <20220714182756.85664-6-wuhaotsh@google.com> Mime-Version: 1.0 References: <20220714182756.85664-1-wuhaotsh@google.com> X-Mailer: git-send-email 2.37.0.170.g444d1eabd0-goog Subject: [PATCH 5/8] blockdev: Add a new IF type IF_OTHER From: Hao Wu To: peter.maydell@linaro.org Cc: richard.henderson@linaro.org, qemu-arm@nongnu.org, qemu-devel@nongnu.org, wuhaotsh@google.com, venture@google.com, Avi.Fishman@nuvoton.com, kfting@nuvoton.com, hskinnemoen@google.com, f4bug@amsat.org, bin.meng@windriver.com, qemu-block@nongnu.org, armbru@redhat.com, thuth@redhat.com Received-SPF: pass client-ip=2607:f8b0:4864:20::64a; envelope-from=3N2DQYggKClYKI5yCHG54CC492.0CAE2AI-12J29BCB4BI.CF4@flex--wuhaotsh.bounces.google.com; helo=mail-pl1-x64a.google.com X-Spam_score_int: -95 X-Spam_score: -9.6 X-Spam_bar: --------- X-Spam_report: (-9.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, 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, T_SCC_BODY_TEXT_LINE=-0.01, USER_IN_DEF_DKIM_WL=-7.5 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" This type is used to represent block devs that are not suitable to be represented by other existing types. A sample use is to represent an at24c eeprom device defined in hw/nvram/eeprom_at24c.c. The block device can be used to contain the content of the said eeprom device. Signed-off-by: Hao Wu --- blockdev.c | 4 +++- include/sysemu/blockdev.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/blockdev.c b/blockdev.c index 9230888e34..befd69ac5f 100644 --- a/blockdev.c +++ b/blockdev.c @@ -82,6 +82,7 @@ static const char *const if_name[IF_COUNT] = { [IF_MTD] = "mtd", [IF_SD] = "sd", [IF_VIRTIO] = "virtio", + [IF_OTHER] = "other", [IF_XEN] = "xen", }; @@ -726,7 +727,8 @@ QemuOptsList qemu_legacy_drive_opts = { },{ .name = "if", .type = QEMU_OPT_STRING, - .help = "interface (ide, scsi, sd, mtd, floppy, pflash, virtio)", + .help = "interface (ide, scsi, sd, mtd, floppy, pflash, virtio," + " other)", },{ .name = "file", .type = QEMU_OPT_STRING, diff --git a/include/sysemu/blockdev.h b/include/sysemu/blockdev.h index 3211b16513..d9dd5af291 100644 --- a/include/sysemu/blockdev.h +++ b/include/sysemu/blockdev.h @@ -21,6 +21,7 @@ typedef enum { */ IF_NONE = 0, IF_IDE, IF_SCSI, IF_FLOPPY, IF_PFLASH, IF_MTD, IF_SD, IF_VIRTIO, IF_XEN, + IF_OTHER, IF_COUNT } BlockInterfaceType;