Received: by 2002:a05:7412:b101:b0:e2:908c:2ebd with SMTP id az1csp2632374rdb; Wed, 15 Nov 2023 06:30:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IGcdiaZNNzkHdb/HjIzDX6ic7o47Cp6o5uF/mRyKAIb2llwmZ0FGQohpXk8OIElObVveLP+ X-Received: by 2002:a17:902:ee12:b0:1cc:6a09:a489 with SMTP id z18-20020a170902ee1200b001cc6a09a489mr4813010plb.33.1700058601578; Wed, 15 Nov 2023 06:30:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700058601; cv=none; d=google.com; s=arc-20160816; b=mD+eGyqugcF4+rPCPntpyCOIQQNKqaljFajy96t+Ox9mMtI7G9nE6rsEnY3x/eTel/ 6L+GXHlEon2kZL4W/yvp4ZnB9yMSVsn9E1MXA4ts6ROq64wmdXbX8HNW8eSdJ2HGztFq OOPgNeLFBu7YSPlCkOPDrcc2hhfDtdlUHyVXSI8F6zxb4D/vlcN+FDZ9v8F9ToPK16sd 6voXxmYWoorEF5TiTOeTlsrgpzQE4fARyyNUB/B2Q74Y5EVG89T7/gNEM5mTLJ1tp6Y4 dBJUjiB7P/1T2O0i/wddgvHmYIKJ2YlDYvlO0MKvvPWD06goC0s4n8RW9m99BPztro5Q QUrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ewZ9xRCba+P0eMIANOBLPqwHZjc7NQgwGPmpIitVuvg=; fh=CQguB+n6r06JQXnFVunp33cNF9RxNOye30Wf9y705lI=; b=TTh87xejbkNjoHzCa0JTnp4VICb8SqcOtkFnCowgvnxBAREywWkDG2BwkUU1Sgp8zU VKmByR1ufwbIJoIce6KrzhDlwKmYP6HsgAkGvrlnJ2D0pXtdckUlJc2xE5zLeKJKTZec xmzaBDPZQ10eA8SxXLyQTs1+oKp85f5e7YZYA9ifHFT1nYu68R9i0JO0gUzo27QOzOTd vM31Q6oUJFrGRouOeymg9URxVflZbEQYszXtu1vbDrnL4zOl33LYmz/4j7he4UcCIylz i2J6Q8N1ojmPL7B34qLab1GNA4oBgqVbiRFnw5b2IzxfGFjtHEoDFvL1eQA0Xs0hJZnf ifGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=ramrNADH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id y12-20020a17090322cc00b001b9f55d28a2si10608335plg.205.2023.11.15.06.30.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 06:30:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=ramrNADH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 66B3381A6E75; Wed, 15 Nov 2023 06:29:23 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344297AbjKOO3D (ORCPT + 99 others); Wed, 15 Nov 2023 09:29:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344249AbjKOO25 (ORCPT ); Wed, 15 Nov 2023 09:28:57 -0500 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C9A118F for ; Wed, 15 Nov 2023 06:28:47 -0800 (PST) Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-53dd3f169d8so10276317a12.3 for ; Wed, 15 Nov 2023 06:28:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1700058525; x=1700663325; darn=vger.kernel.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=ewZ9xRCba+P0eMIANOBLPqwHZjc7NQgwGPmpIitVuvg=; b=ramrNADHtyRQFkdp114gxzCYwEKCMLSWuntKvmc5fsXBQpLGSjSd2XKJWiHA6tEi43 lc8xzN87POLshqDqEwuIXMcCOPuMEWuOsUmNsyBq6KxGJHcze3Z998qzpx6d03g6DICl /7rIs9teYJvl8cpsE6PoWPIW95bqj5CAW5mNzO5tmHv9s3i5dbnnkJUPc48bHZV1cNhe 3LJ3Ho9wRf4iSPuunhZ6rPHJhO9Xe/IzQgVEot/HlLFpazVrxzdZaLrGSDS6xJveu2/o QIUNg1GvXmgqb6y75Dh1jFrsaiuiaQcQiyK1M5Em+miZSciqRI/K7tEom4Y5eUt/h8xl VgIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700058525; x=1700663325; 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=ewZ9xRCba+P0eMIANOBLPqwHZjc7NQgwGPmpIitVuvg=; b=LS+gFr8gCz2Wg7Pf1sf7zov2lNmL4EHLG9r9JPtzr0JOrWT3EZtqNK5nLwy9SyQHAc jPNzhiNdc0e59h7o0bqiKx9xPz+r6XizTyrxIJJM96to6NaVRVeexWr677h78rS5hkzL nmO0amnnq5iR+JCM+EI5UIKA7swMa+x5VeJj+VZ8bKDp8DFCQL/C/ap/AffGafxv1kLg U261IEvF3I5HpiXMTs5iwFvc6gqSyQBujB/NO3AbSfj66rbBBKFPSsSWcBJU3e08zv9R PRSU16zdlUHZZdDxxzWmmeCu/OV5qbu3mBciJNzhCZLit08aOT22AtJkhZxzVMJlwwL/ 0spg== X-Gm-Message-State: AOJu0YxY7tmzfFnE7AmFpJgdLSXf6/hpOCtC8aFSWllIE6vBH+KZ0Rct vQ/k6GvOoV3ZWv8NH2IuCgxoTg== X-Received: by 2002:a17:906:e8c:b0:9e5:e9ef:a322 with SMTP id p12-20020a1709060e8c00b009e5e9efa322mr9524778ejf.31.1700058525328; Wed, 15 Nov 2023 06:28:45 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.119]) by smtp.gmail.com with ESMTPSA id i11-20020a170906264b00b0099bd5d28dc4sm7186394ejc.195.2023.11.15.06.28.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 06:28:44 -0800 (PST) From: Claudiu X-Google-Original-From: Claudiu To: tglx@linutronix.de, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, geert+renesas@glider.be, magnus.damm@gmail.com, mturquette@baylibre.com, sboyd@kernel.org, prabhakar.mahadev-lad.rj@bp.renesas.com Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-clk@vger.kernel.org, Claudiu Beznea Subject: [PATCH v2 6/9] irqchip/renesas-rzg2l: Implement restriction when writing ISCR register Date: Wed, 15 Nov 2023 16:27:46 +0200 Message-Id: <20231115142749.853106-7-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231115142749.853106-1-claudiu.beznea.uj@bp.renesas.com> References: <20231115142749.853106-1-claudiu.beznea.uj@bp.renesas.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 15 Nov 2023 06:29:23 -0800 (PST) From: Claudiu Beznea The RZ/G2L manual (chapter "IRQ Status Control Register (ISCR)") describes the operation to clear interrupts through the ISCR register as follows: [Write operation] When "Falling-edge detection", "Rising-edge detection" or "Falling/Rising-edge detection" is set in IITSR: - In case ISTAT is 1 0: IRQn interrupt detection status is cleared. 1: Invalid to write. - In case ISTAT is 0 Invalid to write. When “Low-level detection” is set in IITSR.: Invalid to write. Take the interrupt type into account when clearing interrupts through the ISCR register to avoid writing the ISCR when interrupt type is level. Signed-off-by: Claudiu Beznea --- Changes in v2: - adapted according to review comments - improved commit description - used uppercase letter after ":" in patch title drivers/irqchip/irq-renesas-rzg2l.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/irqchip/irq-renesas-rzg2l.c b/drivers/irqchip/irq-renesas-rzg2l.c index d666912adc74..a77ac6e1606f 100644 --- a/drivers/irqchip/irq-renesas-rzg2l.c +++ b/drivers/irqchip/irq-renesas-rzg2l.c @@ -78,11 +78,17 @@ static void rzg2l_irq_eoi(struct irq_data *d) unsigned int hw_irq = irqd_to_hwirq(d) - IRQC_IRQ_START; struct rzg2l_irqc_priv *priv = irq_data_to_priv(d); u32 bit = BIT(hw_irq); - u32 reg; + u32 iitsr, iscr; - reg = readl_relaxed(priv->base + ISCR); - if (reg & bit) - writel_relaxed(reg & ~bit, priv->base + ISCR); + iscr = readl_relaxed(priv->base + ISCR); + iitsr = readl_relaxed(priv->base + IITSR); + + /* + * ISCR can only be cleared if the type is falling-edge, rising-edge or + * falling/rising-edge. + */ + if ((iscr & bit) && (iitsr & IITSR_IITSEL_MASK(hw_irq))) + writel_relaxed(iscr & ~bit, priv->base + ISCR); } static void rzg2l_tint_eoi(struct irq_data *d) -- 2.39.2