From patchwork Thu Jan 5 16:43:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 639283 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp324936pvb; Thu, 5 Jan 2023 08:55:34 -0800 (PST) X-Google-Smtp-Source: AMrXdXu4k1xWcSHpHPn4LgWdL4oHs2m2F8P2m12y7EpEU+8FtLDjGyud8ZrgbCcKrXQvjCMbKWlt X-Received: by 2002:a05:622a:20a:b0:3a8:2bf6:85ea with SMTP id b10-20020a05622a020a00b003a82bf685eamr90181236qtx.49.1672937733820; Thu, 05 Jan 2023 08:55:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672937733; cv=none; d=google.com; s=arc-20160816; b=O4Fn+aXVpeEZsbUeAd2GBhm/RjuaW4wxwKDI8MRJnVRUx7gDeV8v7N9H5YJDQSjS1k lUguR7Zsoz3gLw++lIBfvBZeDzssiX6el1mXrcf5q1CxSyu6/OvAlC57+Av+N6eopgdE rw9FpoCzjv1tKpOtAj67c72pz2CnIZcWWsDYtcn0VwoJSiSD/gI4RttFrg44BuQmIxB0 NMvGCLLTwnhlo665bVj4c2xkrfmbf4VJ+I9NYqCzhxG+V+nUrOiEtFCfBzsN41G2CsxG 45W6vWoY38qiwsHdGYCWy2b9gBBiT/QIlUbBBhw54JMX7ShvSXTB8C2z45NwLK42sFMQ AZtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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:to:from :dkim-signature; bh=TK1ZAIb2SC1DPcdzdUgcMa2CLBumxiEB57+So4PesS8=; b=056/Sf8FpTvlANvBRJTc0nkpyRlH2XV8V/T95uT7GMjI31qy0pBwRvAxM1SuHl+PQH dxjYe386lIyPGt7qxsHJIJFowE82MrRWdqzd6gsAtWgylVe5KXiye/vRZ7ZsRdqs4n3m 7/1eWFoDi+R8h+vm/ewZDU1m4msTp/khlqrU50Hj1qOX53Or5XvgjJbrlDVX7hiltIFo Oj25Cx9KTwjVUokNr20ZXwzMh8c6BZPQGGYvvxGTslQPnu5pQsccW4/1vd2Df2tnr2/y AFqynXX0LASSE5fNJPbGSFr0MYwlDj+tZmZvEaIdM5o9r7X3k+rbBQjWfETVOFT5kjrm sCAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="YOxUM/+e"; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id fc20-20020a05622a489400b003a991b9b888si20606777qtb.265.2023.01.05.08.55.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Jan 2023 08:55:33 -0800 (PST) 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="YOxUM/+e"; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pDTM2-0000bU-ML; Thu, 05 Jan 2023 11:44:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pDTLz-0000WT-TF for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:31 -0500 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pDTLy-0007MR-93 for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:31 -0500 Received: by mail-wm1-x32b.google.com with SMTP id ay2-20020a05600c1e0200b003d22e3e796dso1803665wmb.0 for ; Thu, 05 Jan 2023 08:44:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=TK1ZAIb2SC1DPcdzdUgcMa2CLBumxiEB57+So4PesS8=; b=YOxUM/+etWUtZiir+YsugNs3bCaR7ypo2CRlnM5Aw5GTGsYq3rPRUju4H7S7F3Ma+C V1vLnCxTtGA0irMa7Gy+Kot/9tW2IDXOc6JQBuVXhSlSeU8OsRbNZi7PLnaisWJc9AGr 6c8tcGci1Bo55K0lA0cEWKvC9NczPRF22EU6CLmv9+Wb9Dn0fQAwBbN/b4nCM+azbjCm Ka07TikmsyTcADkXEha8RRlJEldTuE3BXfREKieo8RXIyBMd0pUcoHiy3OVZiUzgiKDT DXvEpbGP0i7B0LLuFRVEROYaLxR85QN5oMCjQQhu+0yodC6FJ6HNqdj0Ob9LiMSKx7GU 8vIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TK1ZAIb2SC1DPcdzdUgcMa2CLBumxiEB57+So4PesS8=; b=Iobl2y6Fd5VD960bhU2RwAe88uDyCclhJ2vLUGC1w3oGrtbQjzmX5aEg+6OJNOKNnE kyqUcz2bJLPfO/jxpEuDPMbRxtt99dsKxpAEeLAEZI6IoiwY+CE+sCHcLPDfWlJEKXo/ mCA1QefXXUz+PzVO/RNl/JZpZ99IlVuXtITxTKO/vFQC5c0CwXzv9Ja3ZdaLVkYJWO8g EHvqlIIODaPA9gxuttd5gUCym+pbK9ubIYqYKJ2VR8dIbmnNS3zYPT4R0vMzTnfHAGJs pDlCUDL3GJCndAPhds7L7Ku6ZzQxEhSLtyrunjhnhSbZyYD9y1rYaSXIvnsPF9c+Nj2W cL4g== X-Gm-Message-State: AFqh2kqc2poD085VzWiDU5qT2nJtz+DkZJt+VX6ksJmvVTb4RxFaAuRi vzsheb3p7yAO3tF+RMAjdD6K7kQ/fMW/5cLc X-Received: by 2002:a05:600c:1d0e:b0:3cf:7c8b:a7c7 with SMTP id l14-20020a05600c1d0e00b003cf7c8ba7c7mr36564738wms.39.1672937069176; Thu, 05 Jan 2023 08:44:29 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id hg9-20020a05600c538900b003cf71b1f66csm3055547wmb.0.2023.01.05.08.44.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 08:44:28 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 12/34] hw/timer/imx_epit: define SR_OCIF Date: Thu, 5 Jan 2023 16:43:55 +0000 Message-Id: <20230105164417.3994639-13-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105164417.3994639-1-peter.maydell@linaro.org> References: <20230105164417.3994639-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32b.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=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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Axel Heider Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- include/hw/timer/imx_epit.h | 2 ++ hw/timer/imx_epit.c | 12 ++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/include/hw/timer/imx_epit.h b/include/hw/timer/imx_epit.h index e2cb96229be..783eaf0c3a6 100644 --- a/include/hw/timer/imx_epit.h +++ b/include/hw/timer/imx_epit.h @@ -53,6 +53,8 @@ #define CR_CLKSRC_SHIFT (24) #define CR_CLKSRC_BITS (2) +#define SR_OCIF (1 << 0) + #define EPIT_TIMER_MAX 0XFFFFFFFFUL #define TYPE_IMX_EPIT "imx.epit" diff --git a/hw/timer/imx_epit.c b/hw/timer/imx_epit.c index 661e9158e3b..f148868b8cb 100644 --- a/hw/timer/imx_epit.c +++ b/hw/timer/imx_epit.c @@ -66,7 +66,7 @@ static const IMXClk imx_epit_clocks[] = { */ static void imx_epit_update_int(IMXEPITState *s) { - if (s->sr && (s->cr & CR_OCIEN) && (s->cr & CR_EN)) { + if ((s->sr & SR_OCIF) && (s->cr & CR_OCIEN) && (s->cr & CR_EN)) { qemu_irq_raise(s->irq); } else { qemu_irq_lower(s->irq); @@ -256,9 +256,9 @@ static void imx_epit_write(void *opaque, hwaddr offset, uint64_t value, break; case 1: /* SR - ACK*/ - /* writing 1 to OCIF clears the OCIF bit */ - if (value & 0x01) { - s->sr = 0; + /* writing 1 to SR.OCIF clears this bit and turns the interrupt off */ + if (value & SR_OCIF) { + s->sr = 0; /* SR.OCIF is the only bit in this register anyway */ imx_epit_update_int(s); } break; @@ -309,8 +309,8 @@ static void imx_epit_cmp(void *opaque) IMXEPITState *s = IMX_EPIT(opaque); DPRINTF("sr was %d\n", s->sr); - - s->sr = 1; + /* Set interrupt status bit SR.OCIF and update the interrupt state */ + s->sr |= SR_OCIF; imx_epit_update_int(s); }