From nobody Tue Apr 7 21:26:11 2026 Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 93D853E867D for ; Wed, 11 Mar 2026 19:25:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773257114; cv=none; b=FlmBCRIU6sqkA0WVr3FRx2U8rBs5eEFNgEILYXowx0hEefuDnP7Xt0uoZn09oYrRtqGp82sbqGwCVQ10sAW3oH+fmzk3T/PMP7q4sOYZyfSjURsrTlZMhy+GWL7bEQWk0aMC+RExLPXq9jQBx4cmSIPWVa61DpQHqSe7t93it8I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773257114; c=relaxed/simple; bh=PSfwYK1tXTapMT0D8jCCWRXSRC9BazGoInJA7J6QycE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=i0yRFVy9Sn+BAmYL9GdIDbhLeT9tLOZWWexAh6k5YmwzBcfrgSkY5y+O/AEXg2PnW7JcuffUF/5dxEd0kELuyE66z3/LsYdDWK4SS8X7rMTHLSlZvzAQ32cC2+R6OX5qj+V9hQc0NMj+ioL+UETpD+aT2xlU4o/RJjJh2+m4cr8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=gm3QlmdG; arc=none smtp.client-ip=209.85.221.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gm3QlmdG" Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-439b9b190easo174696f8f.2 for ; Wed, 11 Mar 2026 12:25:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773257111; x=1773861911; 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=KOdd25/rjFXlgKhvKXBBsn1bWfxNxa2TmQT044x9Rlw=; b=gm3QlmdG8+8qFJQaeGNjFJJ0+TlLJkBDez6uj2h1CL8I7ZWW4kc3sLP8mcNusX3a7S lLeNmquPhT5FWa/SW/U1ibRSKT09wZkKzv/Hye1+4dJZaxm8FtmqbeinOkDOsU8vXM/E B3J/wvHE4SnVueQg/D2C2097vRlhffrgxzGBf5Ao152GZbFwCB2REJ4XQhSRCLwkoAsg qiXr4+j/+oI9f8YMSce7pOzyxZz+VGZH4LaUofkNi7Btb5E6ivlVBCJzgKDUmQI6xMsn jzjKKmrVscsfqAAZvfgHdpKMxqoergeR+0tBjiCrdeGslY7vnpNGN1J00oR+3Vu7Q0k1 Zq1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773257111; x=1773861911; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=KOdd25/rjFXlgKhvKXBBsn1bWfxNxa2TmQT044x9Rlw=; b=IX+2Q1UFwa9S2rTbYtPT2hy8kXqWJ4n0bm+MokS1jn+HoDVPPG218ZCAU4izR2Osww h8vGpN7nFix6jgUs5uTQxPioggO6xiefcXAfxgngmwdqnwIyhT5HTmVqZSQaomVz8kH2 0WZE6qH0mfaQXXFTKLSwVndEYMwTOktP07KL6UxaG3INZMEA8GRL/iyLxgZSzZGdciEz S/wRdgiFO9blnKl7paF8ZKy6EuOvo3LM9tSgm85aPk15G4PMuonu3TKU6bw7yqRrliy0 wl1FuJjja+1IzftTNL/PAMV5OHbCN2/54ffMc29RQWpSuHsslZtjeSChlFh7nmrncev8 GDyA== X-Forwarded-Encrypted: i=1; AJvYcCUPn3cmWIJgT+z9/Sj6AfCAJSmnEfTgTxFef88d9ecTTxW/vEgUI02VjN1HplIckxxVWh3tK+dAW3c9Oos=@vger.kernel.org X-Gm-Message-State: AOJu0YyI558No6tuJGYEVtLwnBm0BxcbRp7YvmHLEqgGSjSIYJ7R7nh3 2LXPBC/bWxB0WJkXPhhJApFBAQGoMfq4aKxi3aPWrq5tOmL+7TQbiKHp X-Gm-Gg: ATEYQzzp0UK3fSudU62/bd4fj/JLhWaAdJ+ocvbJWjzn93zO5FyskMfzGAjww2559go v6LpkRhs5k3oUAG5pPSHqG+kxoh5DQGm/mEcUM5ir6VNU5FHU7J7Nm5Otao6GkUb/cTivMUTpdf FSwAhCQf8z6saWMwCaFbYASs/0werewBdvZ/3EWy7p/iSfl2Eydn8Y6jZz31m+rMbERJ3N0iARP U87IsVw0U/KMRXHEEOZZGLgRABK9eTzdqPBQI1GKL7L/n2gZcIncEc6bG6GZqSsjEHTpmxUc2W2 XWn+cSTL5olpvOj7fokExMHbEUGugDUz9ck519NTJS546ge9VSi8go3zVNVa1NSJh3pn/en7asM VIDKjvvN/I8jzd5sqcc/tOBjbLtKxMti4kU+DBIK3ncdaompKztGEFGdk5C9BN7PEICOO59DLvj FKz1D1xlaoAunmKCjOrTqeLCDoRuu2vBHiigRhiCnLWssqLCtP X-Received: by 2002:a05:6000:2c03:b0:439:b539:787 with SMTP id ffacd0b85a97d-439f843cc76mr7128309f8f.53.1773257110925; Wed, 11 Mar 2026 12:25:10 -0700 (PDT) Received: from localhost.localdomain ([2a00:23c4:a758:8a01:38b7:8ca3:cb55:d344]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-439fe20bd9csm1323210f8f.21.2026.03.11.12.25.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Mar 2026 12:25:10 -0700 (PDT) From: Biju X-Google-Original-From: Biju To: Thomas Gleixner Cc: Biju Das , linux-kernel@vger.kernel.org, Geert Uytterhoeven , Prabhakar Mahadev Lad , Biju Das , linux-renesas-soc@vger.kernel.org Subject: [PATCH v5 11/15] irqchip/renesas-rzg2l: Drop IRQC_NUM_IRQ macro Date: Wed, 11 Mar 2026 19:24:42 +0000 Message-ID: <20260311192459.609064-12-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260311192459.609064-1-biju.das.jz@bp.renesas.com> References: <20260311192459.609064-1-biju.das.jz@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Biju Das The total number of interrupts in RZ/G2L and RZ/G3L SoC are different. Introduce struct rzg2l_hw_info to handle the hardware differences and replace the macro IRQC_NUM_IRQ with num_irq variable in struct rzg2l_hw_info. Signed-off-by: Biju Das --- v4->v5: * Dropped the hw_irq range check involving info.num_irq v3->v4: * Updated commit description IRQs->interrupts * Replaced the variable type for num_irq in struct rzg2l_hw_info from u8->unsigned int * Replaced the pointer variable info from irqc_priv and instead embed a struct hwinfo into irqc_priv and copy the data into it at probe time. * Replaced the check 'hwirq > (priv->info->num_irq - 1)' with hwirq >=3D priv->info.num_irq v2->v3: * No change v1->v2: * No change --- drivers/irqchip/irq-renesas-rzg2l.c | 34 ++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/drivers/irqchip/irq-renesas-rzg2l.c b/drivers/irqchip/irq-rene= sas-rzg2l.c index cd850c7dc6f3..11fff8fdf4b3 100644 --- a/drivers/irqchip/irq-renesas-rzg2l.c +++ b/drivers/irqchip/irq-renesas-rzg2l.c @@ -24,7 +24,6 @@ #define IRQC_IRQ_COUNT 8 #define IRQC_TINT_START (IRQC_IRQ_START + IRQC_IRQ_COUNT) #define IRQC_TINT_COUNT 32 -#define IRQC_NUM_IRQ (IRQC_TINT_START + IRQC_TINT_COUNT) =20 #define ISCR 0x10 #define IITSR 0x14 @@ -68,6 +67,14 @@ struct rzg2l_irqc_reg_cache { u32 titsr[2]; }; =20 +/** + * struct rzg2l_hw_info - Interrupt Control Unit controller hardware info = structure. + * @num_irq: Total Number of interrupts + */ +struct rzg2l_hw_info { + unsigned int num_irq; +}; + /** * struct rzg2l_irqc_priv - IRQ controller private data structure * @base: Controller's base address @@ -75,6 +82,7 @@ struct rzg2l_irqc_reg_cache { * @tint_chip: Pointer to struct irq_chip for tint * @fwspec: IRQ firmware specific data * @lock: Lock to serialize access to hardware registers + * @info: Hardware specific data * @cache: Registers cache for suspend/resume */ static struct rzg2l_irqc_priv { @@ -83,6 +91,7 @@ static struct rzg2l_irqc_priv { const struct irq_chip *tint_chip; struct irq_fwspec *fwspec; raw_spinlock_t lock; + struct rzg2l_hw_info info; struct rzg2l_irqc_reg_cache cache; } *rzg2l_irqc_data; =20 @@ -577,7 +586,7 @@ static int rzg2l_irqc_alloc(struct irq_domain *domain, = unsigned int virq, chip =3D priv->irq_chip; } =20 - if (hwirq > (IRQC_NUM_IRQ - 1)) + if (hwirq >=3D priv->info.num_irq) return -EINVAL; =20 ret =3D irq_domain_set_hwirq_and_chip(domain, virq, hwirq, chip, (void *)= (uintptr_t)tint); @@ -600,7 +609,7 @@ static int rzg2l_irqc_parse_interrupts(struct rzg2l_irq= c_priv *priv, unsigned int i; int ret; =20 - for (i =3D 0; i < IRQC_NUM_IRQ; i++) { + for (i =3D 0; i < priv->info.num_irq; i++) { ret =3D of_irq_parse_one(np, i, &map); if (ret) return ret; @@ -613,7 +622,8 @@ static int rzg2l_irqc_parse_interrupts(struct rzg2l_irq= c_priv *priv, =20 static int rzg2l_irqc_common_probe(struct platform_device *pdev, struct de= vice_node *parent, const struct irq_chip *irq_chip, - const struct irq_chip *tint_chip) + const struct irq_chip *tint_chip, + const struct rzg2l_hw_info info) { struct irq_domain *irq_domain, *parent_domain; struct device_node *node =3D pdev->dev.of_node; @@ -636,7 +646,9 @@ static int rzg2l_irqc_common_probe(struct platform_devi= ce *pdev, struct device_n if (IS_ERR(rzg2l_irqc_data->base)) return PTR_ERR(rzg2l_irqc_data->base); =20 - rzg2l_irqc_data->fwspec =3D devm_kcalloc(&pdev->dev, IRQC_NUM_IRQ, + rzg2l_irqc_data->info =3D info; + + rzg2l_irqc_data->fwspec =3D devm_kcalloc(&pdev->dev, info.num_irq, sizeof(*rzg2l_irqc_data->fwspec), GFP_KERNEL); if (!rzg2l_irqc_data->fwspec) return -ENOMEM; @@ -661,7 +673,7 @@ static int rzg2l_irqc_common_probe(struct platform_devi= ce *pdev, struct device_n =20 raw_spin_lock_init(&rzg2l_irqc_data->lock); =20 - irq_domain =3D irq_domain_create_hierarchy(parent_domain, 0, IRQC_NUM_IRQ= , dev_fwnode(dev), + irq_domain =3D irq_domain_create_hierarchy(parent_domain, 0, info.num_irq= , dev_fwnode(dev), &rzg2l_irqc_domain_ops, rzg2l_irqc_data); if (!irq_domain) { pm_runtime_put(dev); @@ -673,14 +685,20 @@ static int rzg2l_irqc_common_probe(struct platform_de= vice *pdev, struct device_n return 0; } =20 +static const struct rzg2l_hw_info rzg2l_hw_params =3D { + .num_irq =3D IRQC_IRQ_START + IRQC_IRQ_COUNT + IRQC_TINT_COUNT, +}; + static int rzg2l_irqc_probe(struct platform_device *pdev, struct device_no= de *parent) { - return rzg2l_irqc_common_probe(pdev, parent, &rzg2l_irqc_irq_chip, &rzg2l= _irqc_tint_chip); + return rzg2l_irqc_common_probe(pdev, parent, &rzg2l_irqc_irq_chip, &rzg2l= _irqc_tint_chip, + rzg2l_hw_params); } =20 static int rzfive_irqc_probe(struct platform_device *pdev, struct device_n= ode *parent) { - return rzg2l_irqc_common_probe(pdev, parent, &rzfive_irqc_irq_chip, &rzfi= ve_irqc_tint_chip); + return rzg2l_irqc_common_probe(pdev, parent, &rzfive_irqc_irq_chip, &rzfi= ve_irqc_tint_chip, + rzg2l_hw_params); } =20 IRQCHIP_PLATFORM_DRIVER_BEGIN(rzg2l_irqc) --=20 2.43.0