From patchwork Thu May 8 12:25:22 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 888581 Delivered-To: patch@linaro.org Received: by 2002:a5d:4683:0:b0:38f:210b:807b with SMTP id u3csp858859wrq; Thu, 8 May 2025 05:27:11 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXt0Q3oo8H0Ur0ADhLqcBVOtAX38LMuTFTRLmbAbnLrgjWBIdURx3+p/iGGcbtTn+glpsTeMg==@linaro.org X-Google-Smtp-Source: AGHT+IFoK7KWVOb8rQabPuiNkEANW64AKi9CqhYUmk48TqI+prjdtW+6BWK9Ph4jOk/gJmWc661D X-Received: by 2002:ad4:5dc3:0:b0:6e8:fee2:aadf with SMTP id 6a1803df08f44-6f542ad1713mr133909296d6.31.1746707220621; Thu, 08 May 2025 05:27:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1746707220; cv=none; d=google.com; s=arc-20240605; b=iJ+cWRR4EGPceqL+mFOAnR7XXCGKQWek6Y9paEASxO1miZbJ9rTrg2Q0Zwm8HJUY6v eX0dzj+cmJmtWBbnazCS3XwvvqsxSQ7MSIQK7+h6+YAhI0XM7pFQTOGA9bmOr9iSSnI0 KWPAFcH5OGVA7eacUpQ5OGVatJNYVtylop+20ZBkWHxgyHcZow2uHzF0d4nV5G2ILqbJ u7F7BaQlHI6It9raifdfar9V2yQMDTy6n9/1Jm47JpTewZ4n0JXLp3in1hYEJGIiBF0z 3vsgZQbkdnWMwzC2hzoWJrjsYUhvX0h4bmyCrCi8hek7dPOHo2b7TzX9h4N088zgq+Gw qnyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YPZMshn98yoJiqlJorSwXssaa0xtfmw+pcoeQEvQkF0=; fh=TSSVkScH/UWXGYK9Urby9J4lA8W4AIpZEPhg5ugPFY0=; b=krqkca9rsCTkLlQONVxjTlKJoeFS36b2Y+GrU7evCXwPily2ALLtd7yyMTxttUoE77 ESt4BZ9eH/0BiSJ9qKhKPnb0PbLkk7iz2x3NnO66SSQCfkrDEZt3Uiu520JXbbuqG7xN 8eCh3Mpjg5MxhP8t7qxWxu72XcubA66xD+AYQbpp8hNyDT/Q3Cz0aSzY9zr4eIr5GaS5 nDLNuD8hEx/eEpek9yrfQn4NW77AVPDa8ZE1o2Ius2al/nbYrn+2ydf77NyNONrd8Y72 Rt5asgF9YoIp8AZ9ozN2b/4fwA3u0cMxg2vLQJFSIQpfst3Jz0H/AExHzeOXUugvqkBn qoyQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kUF53B1X; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6f54278bf2bsi42239376d6.170.2025.05.08.05.27.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 May 2025 05:27:00 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kUF53B1X; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uD0KK-0006OP-GD; Thu, 08 May 2025 08:26:12 -0400 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 1uD0KC-0006B9-IP for qemu-devel@nongnu.org; Thu, 08 May 2025 08:26:05 -0400 Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uD0K7-0002nZ-6i for qemu-devel@nongnu.org; Thu, 08 May 2025 08:26:04 -0400 Received: by mail-pg1-x531.google.com with SMTP id 41be03b00d2f7-7fd35b301bdso894936a12.2 for ; Thu, 08 May 2025 05:25:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1746707156; x=1747311956; darn=nongnu.org; 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=YPZMshn98yoJiqlJorSwXssaa0xtfmw+pcoeQEvQkF0=; b=kUF53B1XkARftKHq6QXz8xhIid2UyHUTI1++UsJe88PjKajIsqY0yqqNLyBVgMNAfa KYWLTIdQ4vzwnPvVcRScp2+Viilvt0c8Bni0LxhS9198ehHwau8JgUf4S+Xr9W0Xg9PO IBzzKN2IPSdRZerNtfU/znnZ7VyBUUGqlxLY/YEFrgCJ5SJhcCvyu39zsU6TwW2nomoc pc8IbXcVNGMivshHz0yxPQZ/zVcJngci0YQFX5pM1CeRxII7UcAzw+hpTmOVz+f5NH7P XKcz/Q0M5hfj2iFVPgE7I1BsPR9MjFlNIS1lyGX7p2zJC38DhTqmofELSUUt1YdD8zB5 gC/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746707156; x=1747311956; 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=YPZMshn98yoJiqlJorSwXssaa0xtfmw+pcoeQEvQkF0=; b=mpChz2uZbtiOiCGByUJg78ZRCUEtDaFT+ES1AZ9fqS1gWB2hv13TVttSEVsRw4URtX MLNlMYsRQty3bnYk806LKxP4wSslJWbMdC4ilhH9I/vTuPeGaA/1dzmeRv+QrxKIdHqF CHC6Gy5SCa2tvGHedYRICkeeai54HtwJ4XfLav8HHtpxm9UW/Wu/KdIEOsvhzq8YyNr0 ZP+1WEvGWSEpPt0MKxJH7CLQfS8rLu7JxswDl2tlpAIgUtWtwVny2ketae9UkWpXLkHm huZYcYxzdca4JkLavfQQ6ZpHyLeBrSlmfxtooDxgAq4WOFeUhNBdgBJnvmD+20sJ/C2v vTXw== X-Gm-Message-State: AOJu0YzRsT1v6rvCW5kXHL6RtJbIG+N0ov7i+WgbN/0wQBQG9KadqnRo Kzt8wATQ07GXm6F0/J9M39JMtDPrfAOiT+sDkMP2C7rIAjzjMDb5uMx+9fsCSN8Z5IQUxn3AuW4 IVQKI7g== X-Gm-Gg: ASbGncsKBuLw/EPs5NQ8igSst+Ulj0LjmBm6HTlWg0xJeL2Hu1FyFjyM7YRlF+zZ/W3 +5MczVO9ssR1j+KRW/KOuiUWa4vpqG9RFRHGBgG8HXgFKIMYbkuosNIDAQwfZIv3Oo29vaU+oaa 5g14RxVRhDNBJFKbEHiBFjhpPxz3kTdGTTxxVcWzvXkWbfrX4Rr4L4kYvC3HTxJ62sjV/2w3rwQ lcTnGsc+9BPbW09P4atehdk0JNSk+KfD8OLf1eHCMrhiguuXN8AvTsKxzv6NJ4MtH/80tjFoaU1 tv8eGXvVckPNNweneY6piFYcc7L4bPdDhhtRX3702rM42xRtrmjF9Iq6o1mvuQOtVngI8a+co/m wdxRpWlx6994Mll4= X-Received: by 2002:a05:6a20:c907:b0:1f5:790c:94a with SMTP id adf61e73a8af0-2148be0e4fcmr10505247637.25.1746707156160; Thu, 08 May 2025 05:25:56 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-b213ae23b0csm549325a12.35.2025.05.08.05.25.52 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 08 May 2025 05:25:55 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Bernhard Beschow , qemu-stable@nongnu.org, Corey Minyard , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 19/19] hw/i2c/imx_i2c: Always set interrupt status bit if interrupt condition occurs Date: Thu, 8 May 2025 14:25:22 +0200 Message-ID: <20250508122522.73786-3-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250508122522.73786-1-philmd@linaro.org> References: <20250508122522.73786-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::531; envelope-from=philmd@linaro.org; helo=mail-pg1-x531.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Bernhard Beschow According to the i.MX 8M Plus reference manual, the status flag I2C_I2SR[IIF] continues to be set when an interrupt condition occurs even when I2C interrupts are disabled (I2C_I2CR[IIEN] is clear). However, the device model only sets the flag when I2C interrupts are enabled which causes U-Boot to loop forever. Fix the device model by always setting the flag and let I2C_I2CR[IIEN] guard I2C interrupts only. Also remove the comment in the code since it merely stated the obvious and would be outdated now. Cc: qemu-stable@nongnu.org Fixes: 20d0f9cf6a41 ("i.MX: Add I2C controller emulator") Signed-off-by: Bernhard Beschow Acked-by: Corey Minyard Message-ID: <20250507124040.425773-1-shentey@gmail.com> Signed-off-by: Philippe Mathieu-Daudé --- hw/i2c/imx_i2c.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/hw/i2c/imx_i2c.c b/hw/i2c/imx_i2c.c index 91f84c2ad7d..d26177c85df 100644 --- a/hw/i2c/imx_i2c.c +++ b/hw/i2c/imx_i2c.c @@ -79,13 +79,12 @@ static void imx_i2c_reset(DeviceState *dev) static inline void imx_i2c_raise_interrupt(IMXI2CState *s) { - /* - * raise an interrupt if the device is enabled and it is configured - * to generate some interrupts. - */ - if (imx_i2c_is_enabled(s) && imx_i2c_interrupt_is_enabled(s)) { + if (imx_i2c_is_enabled(s)) { s->i2sr |= I2SR_IIF; - qemu_irq_raise(s->irq); + + if (imx_i2c_interrupt_is_enabled(s)) { + qemu_irq_raise(s->irq); + } } }