From patchwork Thu Jul 14 18:28:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hao Wu X-Patchwork-Id: 12918406 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 98AC9C43334 for ; Thu, 14 Jul 2022 18:41:53 +0000 (UTC) Received: from localhost ([::1]:40264 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oC3ma-0004gY-M3 for qemu-devel@archiver.kernel.org; Thu, 14 Jul 2022 14:41:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36964) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <3WWDQYggKCngsqdWkpodckkcha.Ykimaiq-Zarahjkjcjq.knc@flex--wuhaotsh.bounces.google.com>) id 1oC3Zu-0005ZN-D8 for qemu-devel@nongnu.org; Thu, 14 Jul 2022 14:28:46 -0400 Received: from mail-pg1-x549.google.com ([2607:f8b0:4864:20::549]:55208) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <3WWDQYggKCngsqdWkpodckkcha.Ykimaiq-Zarahjkjcjq.knc@flex--wuhaotsh.bounces.google.com>) id 1oC3Zr-00082F-PS for qemu-devel@nongnu.org; Thu, 14 Jul 2022 14:28:46 -0400 Received: by mail-pg1-x549.google.com with SMTP id h13-20020a63e14d000000b0040df75eaa2eso1588263pgk.21 for ; Thu, 14 Jul 2022 11:28:43 -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=U0Asrr7Jv/ZFnHlT0Qk4uee3mXE69YZfediDI5cas+O1Aoex9I2XQOXZGwEml/0roL VsrwY46sUpytgtCIZgJtpWTJ9cLoAa2Dnlj5j7dlTWnVhrdYF1AC9C13OevS015PAd37 p8JpWaJjmVuUS1ZqV3A/TGPNeMppRY5xaONrU8cjkPbCkzE2NsHpGf2RUjebXB8iE1aj PjKSG7sB0N/U1MRcDPddHVLxtPWG1zMbGgt76hzvuk0Q7pX2D3/3gdp22PkjA/CjnyEP hmV4Vj0nZidqxwAYHjhNllfIncoQp8J+DoD353WP4B1w5WQpWx01zvbX2VNMTZrJtnDJ /akA== 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=wfF8IzmiAYLvYcUNsawuKJ5P3kfWvPF2MT86tqXhgZYhWvKBqhhN7U1YHmgGzIOHns Weto8FlIUA+hYRzAwBFW45lSrMRWptuYACtrsLXmorW91OTKXkgOYQM1orWQPh0DicS+ eAak6AitdN3hfspA7Zqr0dxCNSqBAnuUPtyPDfzjLyCqvUa7kjKbv7O0V7SL7eHn/eJF rBzqJYZKsP2uxfFnNqSLTEYWqnXMTlrVEX64O+6nMsBRrx2N/pu9swv7mjpZjOKshrQ9 idqzCc2oGwq6ErseEDaE/05u+BgmaHNXJ6McjjhI7POKYVvF4KN8j6SLXgbHwtSbDsMs TQrw== X-Gm-Message-State: AJIora/Tp8NvsCBgrtYPeJCHvlz6bIyGMSUxZ7H6TKGRCBC9ZeH/MTY3 v0bGIZQXciQUlO5YbQfbXAnYeyH0Ny+I2Q== X-Google-Smtp-Source: AGRyM1t2cwd2+Ip+/eEZgOIqudNV0MxEv8SbL+KCv+fnVCxvWr9gDKpN6THSAikm7dW/MaiVvWnGJMxZgFznqA== X-Received: from mimik.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:4e]) (user=wuhaotsh job=sendgmr) by 2002:a17:90a:c4f:b0:1df:a178:897f with SMTP id u15-20020a17090a0c4f00b001dfa178897fmr11084385pje.19.1657823321270; Thu, 14 Jul 2022 11:28:41 -0700 (PDT) Date: Thu, 14 Jul 2022 11:28:29 -0700 In-Reply-To: <20220714182836.89602-1-wuhaotsh@google.com> Message-Id: <20220714182836.89602-2-wuhaotsh@google.com> Mime-Version: 1.0 References: <20220714182836.89602-1-wuhaotsh@google.com> X-Mailer: git-send-email 2.37.0.170.g444d1eabd0-goog Subject: [PATCH v5 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::549; envelope-from=3WWDQYggKCngsqdWkpodckkcha.Ykimaiq-Zarahjkjcjq.knc@flex--wuhaotsh.bounces.google.com; helo=mail-pg1-x549.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:28:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hao Wu X-Patchwork-Id: 12918411 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 D7B5BC43334 for ; Thu, 14 Jul 2022 18:44:58 +0000 (UTC) Received: from localhost ([::1]:48414 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oC3pa-0001qV-1h for qemu-devel@archiver.kernel.org; Thu, 14 Jul 2022 14:44:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37014) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <3WmDQYggKCnktreXlqpedlldib.Zljnbjr-absbiklkdkr.lod@flex--wuhaotsh.bounces.google.com>) id 1oC3Zv-0005cg-L1 for qemu-devel@nongnu.org; Thu, 14 Jul 2022 14:28:47 -0400 Received: from mail-pl1-x649.google.com ([2607:f8b0:4864:20::649]:55859) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <3WmDQYggKCnktreXlqpedlldib.Zljnbjr-absbiklkdkr.lod@flex--wuhaotsh.bounces.google.com>) id 1oC3Zt-00082n-SN for qemu-devel@nongnu.org; Thu, 14 Jul 2022 14:28:47 -0400 Received: by mail-pl1-x649.google.com with SMTP id k11-20020a170902ce0b00b0016a15fe2627so588021plg.22 for ; Thu, 14 Jul 2022 11:28:44 -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=MLn3dePojaqOfuYboTRLKZVoCwOEvHwBDCuU+uURDISko1txFuo8ogiJvFR0qzgTDJ hi5njeMpS6Y2RJ2VZcxZKs1Qi6kaRpb/H4wImmuk/7FSekY6ofs+nlhhuKKWTAdt7XdY CZs60l9OutALiiRm98T2m2Cxoy1oCcOY+I38anILmozB8mwAzpVckdFnwU+tXDrbo7cS nDELiHm5l5Ptjhyqio6sRjUnh8TE6ycdrmas2dtkG9XPM1NPDFwxzOQeIk/pIsOFl1DB eXqdqKocyr+FCUtN0ru4CfIqKJneNVNvvnSiu/Txcvd2pWbdUZu1QIuWL6/ok9mjf9tr 6SOA== 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=pA7zJyz54ADOTyc63W/l/yRccDbBAIvCijPtGUcwrW8sm1wjvCaKGnou5VBIt7XOia 760UR+/AXngUSmleT8SH2PQIETb5z+qQv0aZwDgnTx7colS/tIZvIqyPefksheVROPb8 3qxrsmwgp1te/miIVtvK/XUXTnBpM98G+vu7akH/XpbTfh2zQm9gqqOSsw5LGkQQbVLg 7P9O30fukjdJZ9heDe5f/1A7WwJV3IPkUlfvCSquCkpwEPEr0NIS7dGj3wlCS8JJGzNd 2pVPSH+O9AhGU5FgA7iu33rJpDaF4lVmQg4dG01HGfOjetzwyBFq8nLPXKUhWQrGdKKh GYiQ== X-Gm-Message-State: AJIora+ypCJoSoOMG81m36fNKfT2kyskIo8NMojqA5RKovkEf3eIuHQD MIJgeBxB7gSbHv101f1dgw3yZuYpLMeMkw== X-Google-Smtp-Source: AGRyM1uUwR3eymv4q+rq9S0ETumR29OKMSec2ejnxNiPYOo1pjnw5iZC+EEKa49zy6T5wBCsW2XAUT6Eml4GhQ== X-Received: from mimik.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:4e]) (user=wuhaotsh job=sendgmr) by 2002:a17:90a:249:b0:1e0:a8a3:3c6c with SMTP id t9-20020a17090a024900b001e0a8a33c6cmr627282pje.0.1657823322905; Thu, 14 Jul 2022 11:28:42 -0700 (PDT) Date: Thu, 14 Jul 2022 11:28:30 -0700 In-Reply-To: <20220714182836.89602-1-wuhaotsh@google.com> Message-Id: <20220714182836.89602-3-wuhaotsh@google.com> Mime-Version: 1.0 References: <20220714182836.89602-1-wuhaotsh@google.com> X-Mailer: git-send-email 2.37.0.170.g444d1eabd0-goog Subject: [PATCH v5 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::649; envelope-from=3WmDQYggKCnktreXlqpedlldib.Zljnbjr-absbiklkdkr.lod@flex--wuhaotsh.bounces.google.com; helo=mail-pl1-x649.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" 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:28:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hao Wu X-Patchwork-Id: 12918408 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 C4581C433EF for ; Thu, 14 Jul 2022 18:42:32 +0000 (UTC) Received: from localhost ([::1]:41840 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oC3nD-0005jy-V2 for qemu-devel@archiver.kernel.org; Thu, 14 Jul 2022 14:42:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37032) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <3XWDQYggKCnw1zmftyxmlttlqj.htrvjrz-ij0jqstslsz.twl@flex--wuhaotsh.bounces.google.com>) id 1oC3Zw-0005dy-F2 for qemu-devel@nongnu.org; Thu, 14 Jul 2022 14:28:48 -0400 Received: from mail-pl1-x649.google.com ([2607:f8b0:4864:20::649]:43536) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <3XWDQYggKCnw1zmftyxmlttlqj.htrvjrz-ij0jqstslsz.twl@flex--wuhaotsh.bounces.google.com>) id 1oC3Zu-00083G-Vz for qemu-devel@nongnu.org; Thu, 14 Jul 2022 14:28:48 -0400 Received: by mail-pl1-x649.google.com with SMTP id u12-20020a170902e5cc00b0016c20d40ec1so585142plf.10 for ; Thu, 14 Jul 2022 11:28:46 -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=kr16O2/EBSfwSF7VcawKdkp/AJaEhmm7UE+3USm5wXnMc+CTFt9frlkM1Z/A7MUXpH Uw7vKwqmSH0M+8DY+9jUNv9cWb0YBtSgXpWeIcnE3z/0LnOedoqIiaZtVB82U6RP1LyM f0kHk+S6YLxXsdg9Z/jHBnGB1bSHMEtQ4KYpR8Eug/IIOLKviXHOeTVnNBi2y/tfZYuN 12Hw+DmqsbiRQMVhNAd0Vji0M3LsYcFb9Z07RI4gJc9BoY8lPtcx9KLetw52MRgP72yD QnRrwHslTnFcT9i67oKtn/30QKgu8Byx41Zbvxi7ymug6PvpUpTtCeUpoQAi6KSLIT8s gReQ== 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=LMMIUPIyDdx19iAg/O5vUXLrXdUQVsMmFlu9zmdqGUxQx/3fFGr8znlymF7KDE6R9g GaDjzBW5Tag5qXOcKs53gmVKewPfOHB2CZ05s8LIMD5/JCp3zK0i/Z0zxT6Vrw3sxYDb TJ/2gue2K8AZistHg+58ufhxV89PWUv/vK2uHd9Lwfo7l6Edmoeos513k0IMkDGFdEbP 017IkyfFTpXG/cQLC1rapn0K2Stg98OCh+YBs5ZreJzQ5ZKTvpeIEBvMvgiHTWrEUoGS rj9odwGSvvwPGWycz8GetYALMyiXBbqYgY/CyE2+l4o+WY64fEGzwPC7e6eTIM1fXJuC 4xsw== X-Gm-Message-State: AJIora9MmUTM47Iavgq0d2vbBDoDnthwc7/v5xFkBjgjTsgiD1w5ljIL 1T2HE29pVIeM5X1npiXJM2zUpEVPviuYag== X-Google-Smtp-Source: AGRyM1tHz8svYXQGLYVJOw1RvC2wduk1EUO4iFWdbpTan9FUboZMFx3KZCTHhGjNjHVuUy2eO/bIXz9J8eYzKg== X-Received: from mimik.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:4e]) (user=wuhaotsh job=sendgmr) by 2002:a17:90b:1bc7:b0:1ef:d6f3:b3d0 with SMTP id oa7-20020a17090b1bc700b001efd6f3b3d0mr17441090pjb.4.1657823325466; Thu, 14 Jul 2022 11:28:45 -0700 (PDT) Date: Thu, 14 Jul 2022 11:28:31 -0700 In-Reply-To: <20220714182836.89602-1-wuhaotsh@google.com> Message-Id: <20220714182836.89602-4-wuhaotsh@google.com> Mime-Version: 1.0 References: <20220714182836.89602-1-wuhaotsh@google.com> X-Mailer: git-send-email 2.37.0.170.g444d1eabd0-goog Subject: [PATCH v5 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::649; envelope-from=3XWDQYggKCnw1zmftyxmlttlqj.htrvjrz-ij0jqstslsz.twl@flex--wuhaotsh.bounces.google.com; helo=mail-pl1-x649.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:28:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hao Wu X-Patchwork-Id: 12918413 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 0A7D4C43334 for ; Thu, 14 Jul 2022 18:47:01 +0000 (UTC) Received: from localhost ([::1]:50536 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oC3rY-0003RS-3P for qemu-devel@archiver.kernel.org; Thu, 14 Jul 2022 14:47:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37154) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <3X2DQYggKCn4ywjcqvujiqqing.eqosgow-fgxgnpqpipw.qti@flex--wuhaotsh.bounces.google.com>) id 1oC3a0-0005r2-KX for qemu-devel@nongnu.org; Thu, 14 Jul 2022 14:28:52 -0400 Received: from mail-pl1-x64a.google.com ([2607:f8b0:4864:20::64a]:35715) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <3X2DQYggKCn4ywjcqvujiqqing.eqosgow-fgxgnpqpipw.qti@flex--wuhaotsh.bounces.google.com>) id 1oC3Zx-00085F-WA for qemu-devel@nongnu.org; Thu, 14 Jul 2022 14:28:52 -0400 Received: by mail-pl1-x64a.google.com with SMTP id l16-20020a170902f69000b0016bf6a77effso577322plg.2 for ; Thu, 14 Jul 2022 11:28:49 -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=mf0oDkX7fjw1v48O0pywLMLCuTCMDdPWLFJp44Qw4B7l6CV+7FO38XDw+8tvASslJN hyUiCc6pMp5XkHZSDV6pB5dNqVKR84RW7+sV56uXOmAmZVJMkQ8gAS2UKQLCgsgoixQd sxDrywkKOqe0YoIF9ggx9yMkUY9RKDTY1VkQsHC0PS3oxm0OKnAEzYyurE0CoyoQNROh tGqUtCNuVp8hWnxbNFZDJUSAAdYm5+aGTSxyL3g1w8DKbtaWQQMhMARvRVXUzbe7tsN3 7YTQ2b0TEw9/o9RhnQuK0sRjnrhmbAHQJcxPd1TnT94btxVhtlHuihj+6G7zfLylzPHY JIBg== 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=RFTYIuU2wFwOkHDXpofU5kpUTPF0fg2OEx1PJgEsqEickS1GBmrXcn17VGChrj0sTj v+Elo6VUyOP0UeTXR/j0QHgVWMjsN2p8coQQ8d4y1kokE1UaImoOaTDJ0YFAjYk7Oigb XfoQuoyX2PELhpOPEX+EpbMY4vRiUCMCikDYkK5g06OYbTsGaiXvvrIa+N3hJvar1rd8 Dh8Hl5oiu+DcBb7rVWW32jaKjFG24u4HaYstjY72+qDVP1T55+c6VNCJu3h7qqJULfTz u46aBGfmachezOfXywYPMa0BE379CslzkH7CjZ2FymixuvIFF3yXzE6HNRHTaC7BxtWd 57CA== X-Gm-Message-State: AJIora+DBUVBSN0cf1x46jS8S9BAPzGmuwLoGhWmRBR5HufD81PZVrB3 V7hLgBk5oPpQ2kIM2H7qSwuSMqCihFcAmA== X-Google-Smtp-Source: AGRyM1st6RhAplA74H0c+ffisHfRmkY5ozgz7DSxEM4Y6vG+SK5T1iyWdVzlsazPVSrNJtXNJ2iwnNZCLKCovA== X-Received: from mimik.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:4e]) (user=wuhaotsh job=sendgmr) by 2002:a17:90a:249:b0:1e0:a8a3:3c6c with SMTP id t9-20020a17090a024900b001e0a8a33c6cmr627285pje.0.1657823327147; Thu, 14 Jul 2022 11:28:47 -0700 (PDT) Date: Thu, 14 Jul 2022 11:28:32 -0700 In-Reply-To: <20220714182836.89602-1-wuhaotsh@google.com> Message-Id: <20220714182836.89602-5-wuhaotsh@google.com> Mime-Version: 1.0 References: <20220714182836.89602-1-wuhaotsh@google.com> X-Mailer: git-send-email 2.37.0.170.g444d1eabd0-goog Subject: [PATCH v5 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::64a; envelope-from=3X2DQYggKCn4ywjcqvujiqqing.eqosgow-fgxgnpqpipw.qti@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" 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:28:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hao Wu X-Patchwork-Id: 12918405 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 7F4F1C43334 for ; Thu, 14 Jul 2022 18:39:21 +0000 (UTC) Received: from localhost ([::1]:34722 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oC3k8-0000nK-J2 for qemu-devel@archiver.kernel.org; Thu, 14 Jul 2022 14:39:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37168) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <3YWDQYggKCoA0ylesxwlksskpi.gsquiqy-hiziprsrkry.svk@flex--wuhaotsh.bounces.google.com>) id 1oC3a1-0005sw-6E for qemu-devel@nongnu.org; Thu, 14 Jul 2022 14:28:53 -0400 Received: from mail-pg1-x549.google.com ([2607:f8b0:4864:20::549]:38567) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <3YWDQYggKCoA0ylesxwlksskpi.gsquiqy-hiziprsrkry.svk@flex--wuhaotsh.bounces.google.com>) id 1oC3Zz-00085h-Gx for qemu-devel@nongnu.org; Thu, 14 Jul 2022 14:28:52 -0400 Received: by mail-pg1-x549.google.com with SMTP id v202-20020a6361d3000000b0041615ebed02so1580144pgb.5 for ; Thu, 14 Jul 2022 11:28:50 -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=Wv8eRwP/9XrCa7R54Lef86tuEJ23mJfrbeZjpkLIFtxI/ubS+Gb6V3g4cSJaDpMObb 2b+C1CHaE7DniNtosnVIFA41BtmQpoB/pMg4AxGjv31P82x7u+G2Zog0VnSnNouM4cRK 9CX4Mc9ZFMa1iTEgBPbKop1OoxJeDyk2mU+lBL4h6ex/hzPLiXHfVhL1hRhy44vopJ6M htj243tIBd9lY6hlzy6lYgR+lVYaTYgewvm8YXxySBARNUovDS1Gy8SXHIK+PGKjJ6Mv ysg6sYH9zacOrhT/65ptlVzGYdgwmtC59q7vS1VHYdqaY+BKUFfOOQ2YmwBqjD+8fSEL buiA== 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=prn5BikvGTxL+T2eAjDjh7w58x/7dVu2XkGCxJub0TDb95qOXgdjA2gwT/mvq7oZHB OeHw6gNdqtAIXStI1gezeQ4ts00ycGiPa8hkNGV/Shd2OYRDZZd1CJpLY+XpuRH/M3GA LpREN2E2SD7620te6lHb4uP4U6gu54WUgNB7Wcd3qzza/0Ex4d79LjLq9RnHA+3ReC5P xTrR101Qt60gQfrjs259rJCd1QoPZLTELoDvg6HaxMMqBY3fjn9VJJJp+oiS4FyAoJPy M2XDlksujN89sCRrUfdBtW5K3FsyEolATJWS5icbD2DhClJUkUvD/40SMWmn93ulbTug HDrg== X-Gm-Message-State: AJIora8RXUO0G8m2HX5T4tC7sXUrof70GiaGF5yoIGVIDcKunEwd1lRH mnKARadDQiNqDDGP7HQ+KUonUU+rCrhJ2A== X-Google-Smtp-Source: AGRyM1veImpiKcY7FOZgGI12Z8lvcatrEfdtIE851KtmtMPqXaIEAjodTs1GjPvpFf1cm7YNGIia0J4SbWYQnQ== X-Received: from mimik.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:4e]) (user=wuhaotsh job=sendgmr) by 2002:a17:903:40cf:b0:16c:6c93:9734 with SMTP id t15-20020a17090340cf00b0016c6c939734mr9998631pld.98.1657823329827; Thu, 14 Jul 2022 11:28:49 -0700 (PDT) Date: Thu, 14 Jul 2022 11:28:33 -0700 In-Reply-To: <20220714182836.89602-1-wuhaotsh@google.com> Message-Id: <20220714182836.89602-6-wuhaotsh@google.com> Mime-Version: 1.0 References: <20220714182836.89602-1-wuhaotsh@google.com> X-Mailer: git-send-email 2.37.0.170.g444d1eabd0-goog Subject: [PATCH v5 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::549; envelope-from=3YWDQYggKCoA0ylesxwlksskpi.gsquiqy-hiziprsrkry.svk@flex--wuhaotsh.bounces.google.com; helo=mail-pg1-x549.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" 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; From patchwork Thu Jul 14 18:28:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hao Wu X-Patchwork-Id: 12918416 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 2D68CC433EF for ; Thu, 14 Jul 2022 18:51:50 +0000 (UTC) Received: from localhost ([::1]:58778 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oC3wD-0001IY-4a for qemu-devel@archiver.kernel.org; Thu, 14 Jul 2022 14:51:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37220) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <3Y2DQYggKCoI20nguzynmuumrk.iuswks0-jk1krtutmt0.uxm@flex--wuhaotsh.bounces.google.com>) id 1oC3a3-00060O-IV for qemu-devel@nongnu.org; Thu, 14 Jul 2022 14:28:55 -0400 Received: from mail-yw1-x1149.google.com ([2607:f8b0:4864:20::1149]:45651) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <3Y2DQYggKCoI20nguzynmuumrk.iuswks0-jk1krtutmt0.uxm@flex--wuhaotsh.bounces.google.com>) id 1oC3a0-000867-F7 for qemu-devel@nongnu.org; Thu, 14 Jul 2022 14:28:54 -0400 Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-2eb7d137101so21353367b3.12 for ; Thu, 14 Jul 2022 11:28:51 -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=ZPy/+0dqgBOB4uWjUnv2kiH/6vyYCxfU19RjpK4Qvr8=; b=Ut4AStBjr8MlQaAsJa9lSYqGFU2Es/qTrkneU9bH8Bu9j//US/GJWQFpq5hkRCbDdt hhHQA0hmQtLDdfspzD1BmneqCfhtbCmSI6vjEg/pdwZ/LGrAGH8SfLsEe5CjgwGj+CzG cuoEQgL+dUOSXfywvrbOg8Xc8t3XjKefranhvG7EA/7roPMwLnSa9wt9YSXMJNoAufIn /eh3J3Y6KKzrfZYfcktb4/1OisTI8b+FLppwBNAMyOxgWEk6UwwHh+0iSjelIVu3kOd9 dxS38HDIr1+TUyy8e0MBMabLeVVZEmRTvVtRQgUue3mnLDjEi7OtpvKdtHVCWuIbKHo0 sB9A== 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=ZPy/+0dqgBOB4uWjUnv2kiH/6vyYCxfU19RjpK4Qvr8=; b=lr/OV2CpmVklErLwXxCjfs0NWt+3OeWEAChKQecuWcQGsC1sg9KNKLbeZoJ6Ado6G+ bvCvQGpw7Z5+3Z2a4EEdPL+8sVK95coUaCA7m4yvJXi/QYVZ0m8urqSJab+SoFjph/jh rbVvsIvWEaKekpdR6sYZ3OKCWkVdxhyknfA0SJ7VfkE4SXQM1eT+L4V8C8ZhelbJw+Uf lkpsrWkjWArQAJUHFPeYsQnWvhrRqGU74sIll+aqwMaYfmLThjZm1sF9pvl0tnJN9pgy lLxwej5FhZeKK4G5VFyRMM8wXuRqBPLHTkgV10Dl+7VaFVxT+rYXKXBlBJstnFUsWRum MVlw== X-Gm-Message-State: AJIora/LvE4joFN+BF3a4DpZid4gVjqvACnyzriOiKDh9FFFn7PVGNyi SfY1kJWvug0+4vrVxaOBmU5TA/5qwuZ3tQ== X-Google-Smtp-Source: AGRyM1t3xYLq7RXK1GteiUEi0VgyPxHRvwvoPmes3nmP+aeAMPOxyEmd3zmSPh4ZXG13XXyGiRApRNGpRHZkXQ== X-Received: from mimik.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:4e]) (user=wuhaotsh job=sendgmr) by 2002:a25:3b11:0:b0:66e:ccf2:76dc with SMTP id i17-20020a253b11000000b0066eccf276dcmr9964429yba.247.1657823331277; Thu, 14 Jul 2022 11:28:51 -0700 (PDT) Date: Thu, 14 Jul 2022 11:28:34 -0700 In-Reply-To: <20220714182836.89602-1-wuhaotsh@google.com> Message-Id: <20220714182836.89602-7-wuhaotsh@google.com> Mime-Version: 1.0 References: <20220714182836.89602-1-wuhaotsh@google.com> X-Mailer: git-send-email 2.37.0.170.g444d1eabd0-goog Subject: [PATCH v5 6/8] hw/arm: npcm8xx_boards: EEPROMs can take bus as parameter 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::1149; envelope-from=3Y2DQYggKCoI20nguzynmuumrk.iuswks0-jk1krtutmt0.uxm@flex--wuhaotsh.bounces.google.com; helo=mail-yw1-x1149.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" We allow at24c_eeprom_init to take a I2CBus* as parameter. This allows us to attach an EEPROM device behind an I2C mux which is not possible with the old method. Signed-off-by: Hao Wu --- hw/arm/npcm7xx_boards.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/hw/arm/npcm7xx_boards.c b/hw/arm/npcm7xx_boards.c index 6bc6f5d2fe..b083b0c572 100644 --- a/hw/arm/npcm7xx_boards.c +++ b/hw/arm/npcm7xx_boards.c @@ -140,10 +140,9 @@ static I2CBus *npcm7xx_i2c_get_bus(NPCM7xxState *soc, uint32_t num) return I2C_BUS(qdev_get_child_bus(DEVICE(&soc->smbus[num]), "i2c-bus")); } -static void at24c_eeprom_init(NPCM7xxState *soc, int bus, uint8_t addr, +static void at24c_eeprom_init(I2CBus *i2c_bus, int bus, uint8_t addr, uint32_t rsize) { - I2CBus *i2c_bus = npcm7xx_i2c_get_bus(soc, bus); I2CSlave *i2c_dev = i2c_slave_new("at24c-eeprom", addr); DeviceState *dev = DEVICE(i2c_dev); @@ -253,8 +252,8 @@ static void quanta_gsj_i2c_init(NPCM7xxState *soc) i2c_slave_create_simple(npcm7xx_i2c_get_bus(soc, 3), "tmp105", 0x5c); i2c_slave_create_simple(npcm7xx_i2c_get_bus(soc, 4), "tmp105", 0x5c); - at24c_eeprom_init(soc, 9, 0x55, 8192); - at24c_eeprom_init(soc, 10, 0x55, 8192); + at24c_eeprom_init(npcm7xx_i2c_get_bus(soc, 9), 9, 0x55, 8192); + at24c_eeprom_init(npcm7xx_i2c_get_bus(soc, 10), 10, 0x55, 8192); /* * i2c-11: @@ -360,7 +359,8 @@ static void kudo_bmc_i2c_init(NPCM7xxState *soc) i2c_slave_create_simple(npcm7xx_i2c_get_bus(soc, 4), TYPE_PCA9548, 0x77); - at24c_eeprom_init(soc, 4, 0x50, 8192); /* mbfru */ + /* mbfru */ + at24c_eeprom_init(npcm7xx_i2c_get_bus(soc, 4), 4, 0x50, 8192); i2c_mux = i2c_slave_create_simple(npcm7xx_i2c_get_bus(soc, 13), TYPE_PCA9548, 0x77); @@ -371,7 +371,8 @@ static void kudo_bmc_i2c_init(NPCM7xxState *soc) i2c_slave_create_simple(pca954x_i2c_get_bus(i2c_mux, 4), "tmp105", 0x48); i2c_slave_create_simple(pca954x_i2c_get_bus(i2c_mux, 5), "tmp105", 0x49); - at24c_eeprom_init(soc, 14, 0x55, 8192); /* bmcfru */ + /* bmcfru */ + at24c_eeprom_init(npcm7xx_i2c_get_bus(soc, 14), 14, 0x55, 8192); /* TODO: Add remaining i2c devices. */ } From patchwork Thu Jul 14 18:28:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hao Wu X-Patchwork-Id: 12918417 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 CEF14C433EF for ; Thu, 14 Jul 2022 18:52:12 +0000 (UTC) Received: from localhost ([::1]:60590 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oC3wZ-0002Yn-Rr for qemu-devel@archiver.kernel.org; Thu, 14 Jul 2022 14:52:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37268) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <3ZWDQYggKCoQ42piw10powwotm.kwuymu2-lm3mtvwvov2.wzo@flex--wuhaotsh.bounces.google.com>) id 1oC3a4-000642-PY for qemu-devel@nongnu.org; Thu, 14 Jul 2022 14:28:56 -0400 Received: from mail-pl1-x649.google.com ([2607:f8b0:4864:20::649]:41849) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <3ZWDQYggKCoQ42piw10powwotm.kwuymu2-lm3mtvwvov2.wzo@flex--wuhaotsh.bounces.google.com>) id 1oC3a3-00086v-A5 for qemu-devel@nongnu.org; Thu, 14 Jul 2022 14:28:56 -0400 Received: by mail-pl1-x649.google.com with SMTP id u3-20020a17090341c300b0016c3c083636so577157ple.8 for ; Thu, 14 Jul 2022 11:28:54 -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=rH29rTwqC9tPWRe/rtqEAu2r9YLWMWTi3GrHYsUhaSM=; b=av6pX0GSPeUm7dK5eBakaaFXPfH5v67vU2o9ZQmgkdt+ubqU8DWHKEPIGcFpTQYYty qVSWOvFOWwefgHscQ2hm9k9cUUAY9rUIRQrpT1EK3T1bnLfG5ZkELCGuM93BWdegsj9N wEmrZMITvbQ4t63EBjwJROTORQ9uILGrT66ROp2Pd6vKKe1ipRqqp2F+XgB+Hj+asq1k PYVaE7jUSmOkEgKa44aO3NAhTtK+yFsgM2OAaWu9CQeH80NB1ARl5M5OEI6V9PC3Rkrz Q4DvRnT3Z+3DKcbASfIGODE0b0B8UPZvlXrCxgvEnM7MyBjAc7DaS5m0sqX0CAFDqV0R 8ifw== 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=rH29rTwqC9tPWRe/rtqEAu2r9YLWMWTi3GrHYsUhaSM=; b=tWFT+tFAWzhaWcMdwNTrF3VtPOln2vzf5UgMOV8/JW/oNkETQUxkS3pmoRT3TeG7OB krIcW4gp6/b5weHOgKjJ51pZTYVWU41lgNnV2IfHDA/RJNMqDKg8OvNHUQvL/tcnN2UP f8ula4WwbefWPHRxnldyGncYP+iIEe3LakEK2S4fWVBi7BNJ8CIu/S6JWNSeSDqKb1PI zA4234nnXA/gZP97azvvUTSX/ZAlDE0HM5i754UYAh0eOQAWNj94/grC7pchSSrzcxQi 1dcPr6U0zRqbhyAXKgGeUSLwNDAGpNJsmSWmFdq5/62dWteRHuAE6T842z8hiUvFKpFS 7zPw== X-Gm-Message-State: AJIora8VGytOpv6LrhMUfKcE2OvzFqDGligiLIJykEND6xhqDssQ4bnO u2TWOSytahIetH94+tVyhd75blSjqOIKpw== X-Google-Smtp-Source: AGRyM1sJ1lFTdctBNdUU+jsIu1MRyUFBaw4ZpdToFuOcaCHE92vmFG3Gaa/TdySWDmRgJTqXg2nFFtVdEHYtbw== X-Received: from mimik.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:4e]) (user=wuhaotsh job=sendgmr) by 2002:a17:902:eccf:b0:16b:f555:d42e with SMTP id a15-20020a170902eccf00b0016bf555d42emr9455517plh.75.1657823333237; Thu, 14 Jul 2022 11:28:53 -0700 (PDT) Date: Thu, 14 Jul 2022 11:28:35 -0700 In-Reply-To: <20220714182836.89602-1-wuhaotsh@google.com> Message-Id: <20220714182836.89602-8-wuhaotsh@google.com> Mime-Version: 1.0 References: <20220714182836.89602-1-wuhaotsh@google.com> X-Mailer: git-send-email 2.37.0.170.g444d1eabd0-goog Subject: [PATCH v5 7/8] hw/arm: Set drive property for at24c eeprom 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::649; envelope-from=3ZWDQYggKCoQ42piw10powwotm.kwuymu2-lm3mtvwvov2.wzo@flex--wuhaotsh.bounces.google.com; helo=mail-pl1-x649.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" This patch allows the user to attach an external drive as a property for an onboard at24c eeprom device. It uses an unit number to distinguish different devices. Signed-off-by: Hao Wu --- hw/arm/npcm7xx_boards.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/hw/arm/npcm7xx_boards.c b/hw/arm/npcm7xx_boards.c index b083b0c572..b8337871ba 100644 --- a/hw/arm/npcm7xx_boards.c +++ b/hw/arm/npcm7xx_boards.c @@ -141,11 +141,16 @@ static I2CBus *npcm7xx_i2c_get_bus(NPCM7xxState *soc, uint32_t num) } static void at24c_eeprom_init(I2CBus *i2c_bus, int bus, uint8_t addr, - uint32_t rsize) + uint32_t rsize, int unit) { I2CSlave *i2c_dev = i2c_slave_new("at24c-eeprom", addr); DeviceState *dev = DEVICE(i2c_dev); + DriveInfo *dinfo; + dinfo = drive_get(IF_OTHER, bus, unit); + if (dinfo) { + qdev_prop_set_drive(dev, "drive", blk_by_legacy_dinfo(dinfo)); + } qdev_prop_set_uint32(dev, "rom-size", rsize); i2c_slave_realize_and_unref(i2c_dev, i2c_bus, &error_abort); } @@ -252,8 +257,8 @@ static void quanta_gsj_i2c_init(NPCM7xxState *soc) i2c_slave_create_simple(npcm7xx_i2c_get_bus(soc, 3), "tmp105", 0x5c); i2c_slave_create_simple(npcm7xx_i2c_get_bus(soc, 4), "tmp105", 0x5c); - at24c_eeprom_init(npcm7xx_i2c_get_bus(soc, 9), 9, 0x55, 8192); - at24c_eeprom_init(npcm7xx_i2c_get_bus(soc, 10), 10, 0x55, 8192); + at24c_eeprom_init(npcm7xx_i2c_get_bus(soc, 9), 9, 0x55, 8192, 0); + at24c_eeprom_init(npcm7xx_i2c_get_bus(soc, 10), 10, 0x55, 8192, 1); /* * i2c-11: @@ -360,7 +365,7 @@ static void kudo_bmc_i2c_init(NPCM7xxState *soc) i2c_slave_create_simple(npcm7xx_i2c_get_bus(soc, 4), TYPE_PCA9548, 0x77); /* mbfru */ - at24c_eeprom_init(npcm7xx_i2c_get_bus(soc, 4), 4, 0x50, 8192); + at24c_eeprom_init(npcm7xx_i2c_get_bus(soc, 4), 4, 0x50, 8192, 0); i2c_mux = i2c_slave_create_simple(npcm7xx_i2c_get_bus(soc, 13), TYPE_PCA9548, 0x77); @@ -372,7 +377,7 @@ static void kudo_bmc_i2c_init(NPCM7xxState *soc) i2c_slave_create_simple(pca954x_i2c_get_bus(i2c_mux, 5), "tmp105", 0x49); /* bmcfru */ - at24c_eeprom_init(npcm7xx_i2c_get_bus(soc, 14), 14, 0x55, 8192); + at24c_eeprom_init(npcm7xx_i2c_get_bus(soc, 14), 14, 0x55, 8192, 1); /* TODO: Add remaining i2c devices. */ } From patchwork Thu Jul 14 18:28:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hao Wu X-Patchwork-Id: 12918407 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 DFC2BC433EF for ; Thu, 14 Jul 2022 18:42:22 +0000 (UTC) Received: from localhost ([::1]:40890 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oC3n4-000569-0J for qemu-devel@archiver.kernel.org; Thu, 14 Jul 2022 14:42:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37320) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <3ZmDQYggKCoU53qjx21qpxxpun.lxvznv3-mn4nuwxwpw3.x0p@flex--wuhaotsh.bounces.google.com>) id 1oC3a6-00068K-IU for qemu-devel@nongnu.org; Thu, 14 Jul 2022 14:28:59 -0400 Received: from mail-pl1-x649.google.com ([2607:f8b0:4864:20::649]:35714) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <3ZmDQYggKCoU53qjx21qpxxpun.lxvznv3-mn4nuwxwpw3.x0p@flex--wuhaotsh.bounces.google.com>) id 1oC3a3-00083E-TB for qemu-devel@nongnu.org; Thu, 14 Jul 2022 14:28:57 -0400 Received: by mail-pl1-x649.google.com with SMTP id l16-20020a170902f69000b0016bf6a77effso577430plg.2 for ; Thu, 14 Jul 2022 11:28:55 -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=YlaS2Gn+M7J56MUm3aAdhmb9BSTR0X4xwnRU+8E1xMI=; b=L14cs+Gbb/T/SU3W0zM0Qr5FJmommGyh8je60D0OtDArgi+Ob5ViAnt/LA8nQ+nPYS aFnXNwUmsb6HT+iz2TwEg8O3YlMAUhClnaXPiMbNt21OX0p0aWWXus95OgMMffkgq0Fv EerZHEcRY/fIcEBNymhspCI2yHK9XCo7CQ9iK60C+gRwHw/akEZOwdSkxMvPeV/gKCpl RRiRfRwJGUNK5tSyun03Tk7lqVTTBGxy96VGIINOD3r6m32bWU8+JOs3oofZVp5HWHZ/ mAynMMEUWNP6JBtUcmO2ae4fewecRN9mNHhGI12nY3Bu6JwojXC31SlQxmMq9GHwQJpa b7aw== 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=YlaS2Gn+M7J56MUm3aAdhmb9BSTR0X4xwnRU+8E1xMI=; b=Ly8C1aQdNVvRt4Kb1Qd+p7FU1nVprdLi14HGL+ncgjLKswzhqU18KAJIhYrnYMSkVT vAJPddMxmw2dnf7H15ZzaZGEwySUsz8UUHPkLV4MDJfTk2t3oo1wiicjb4/4VNeFe95e Jzzc+vNX7UMp3DSoUjwG0l9Lrbe6dWSzsRRoO/ekDLULHN6NLuwVs0VvFe2sNwqvOMKh rf+u3JdvhUYjoRhiXkokDhwQ8fGd+pildaVaWKhRDUbaVVuOVFyeY2Nz6XUH1evLQ2LF Npb4z8DH3ERsaLf9z0yi51RtSaM4JNyVn9KVGatflWM6wH6cp1y3/CxvptnIEfsevOjv r10w== X-Gm-Message-State: AJIora94KmnYj/lwE2O4gOnw2FBjDEn8EHKfNgJ/p4u0XJuOTWfJvZuT tm8Ulz2eSQO6Z6lPq+iCXCEElgPpDAkeNA== X-Google-Smtp-Source: AGRyM1t5AWfRElc4yA4AIvFGkD/oRsdjo60Wtx5oy4AvGAPDHMk3gDybPb2qE2yzUVYmuMDc2LUkxRTq1KiCGA== X-Received: from mimik.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:4e]) (user=wuhaotsh job=sendgmr) by 2002:a17:902:c14a:b0:16b:d07c:ad60 with SMTP id 10-20020a170902c14a00b0016bd07cad60mr9456631plj.141.1657823334813; Thu, 14 Jul 2022 11:28:54 -0700 (PDT) Date: Thu, 14 Jul 2022 11:28:36 -0700 In-Reply-To: <20220714182836.89602-1-wuhaotsh@google.com> Message-Id: <20220714182836.89602-9-wuhaotsh@google.com> Mime-Version: 1.0 References: <20220714182836.89602-1-wuhaotsh@google.com> X-Mailer: git-send-email 2.37.0.170.g444d1eabd0-goog Subject: [PATCH v5 8/8] hw/arm: quanta-gbs-bmc add i2c devices 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::649; envelope-from=3ZmDQYggKCoU53qjx21qpxxpun.lxvznv3-mn4nuwxwpw3.x0p@flex--wuhaotsh.bounces.google.com; helo=mail-pl1-x649.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" From: Patrick Venture Adds supported i2c devices to the quanta-gbc-bmc board. Signed-off-by: Patrick Venture Reviewed-by: Hao Wu --- hw/arm/npcm7xx_boards.c | 82 ++++++++++++++++++++++++----------------- 1 file changed, 49 insertions(+), 33 deletions(-) diff --git a/hw/arm/npcm7xx_boards.c b/hw/arm/npcm7xx_boards.c index b8337871ba..4bae5589f0 100644 --- a/hw/arm/npcm7xx_boards.c +++ b/hw/arm/npcm7xx_boards.c @@ -290,10 +290,12 @@ static void quanta_gsj_fan_init(NPCM7xxMachine *machine, NPCM7xxState *soc) static void quanta_gbs_i2c_init(NPCM7xxState *soc) { + I2CSlave *i2c_mux; + + /* i2c-0: */ + i2c_slave_create_simple(npcm7xx_i2c_get_bus(soc, 0), TYPE_PCA9546, 0x71); + /* - * i2c-0: - * pca9546@71 - * * i2c-1: * pca9535@24 * pca9535@20 @@ -302,46 +304,60 @@ static void quanta_gbs_i2c_init(NPCM7xxState *soc) * pca9535@23 * pca9535@25 * pca9535@26 - * - * i2c-2: - * sbtsi@4c - * - * i2c-5: - * atmel,24c64@50 mb_fru - * pca9546@71 - * - channel 0: max31725@54 - * - channel 1: max31725@55 - * - channel 2: max31725@5d - * atmel,24c64@51 fan_fru - * - channel 3: atmel,24c64@52 hsbp_fru - * + */ + + /* i2c-2: sbtsi@4c */ + + /* i2c-5: */ + /* mb_fru */ + at24c_eeprom_init(npcm7xx_i2c_get_bus(soc, 5), 5, 0x50, 8192, 0); + i2c_mux = i2c_slave_create_simple(npcm7xx_i2c_get_bus(soc, 5), + TYPE_PCA9546, 0x71); + /* max31725 is tmp105 compatible. */ + i2c_slave_create_simple(pca954x_i2c_get_bus(i2c_mux, 0), "tmp105", 0x54); + i2c_slave_create_simple(pca954x_i2c_get_bus(i2c_mux, 1), "tmp105", 0x55); + i2c_slave_create_simple(pca954x_i2c_get_bus(i2c_mux, 2), "tmp105", 0x5d); + /* fan_fru */ + at24c_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 2), 5, 0x51, 8192, 1); + /* hsbp_fru */ + at24c_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 3), 5, 0x52, 8192, 2); + + /* * i2c-6: * pca9545@73 * * i2c-7: * pca9545@72 - * - * i2c-8: - * adi,adm1272@10 - * - * i2c-9: - * pca9546@71 - * - channel 0: isil,isl68137@60 - * - channel 1: isil,isl68137@61 - * - channel 2: isil,isl68137@63 - * - channel 3: isil,isl68137@45 - * + */ + + /* i2c-8: */ + i2c_slave_create_simple(npcm7xx_i2c_get_bus(soc, 8), "adm1272", 0x10); + + /* i2c-9: */ + i2c_slave_create_simple(npcm7xx_i2c_get_bus(soc, 9), TYPE_PCA9546, 0x71); + /* + * - channel 0: isil,isl68137@60 + * - channel 1: isil,isl68137@61 + * - channel 2: isil,isl68137@63 + * - channel 3: isil,isl68137@45 + */ + + /* * i2c-10: * pca9545@71 * * i2c-11: * pca9545@76 - * - * i2c-12: - * maxim,max34451@4e - * isil,isl68137@5d - * isil,isl68137@5e - * + */ + + /* i2c-12: */ + i2c_slave_create_simple(npcm7xx_i2c_get_bus(soc, 12), "max34451", 0x4e); + /* + * isil,isl68137@5d + * isil,isl68137@5e + */ + + /* * i2c-14: * pca9545@70 */