Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp4572rwj; Thu, 22 Dec 2022 04:13:24 -0800 (PST) X-Google-Smtp-Source: AMrXdXu/9g2MocHbhm346l9BaTt8s5CMuhqxcx/4x19DvuEvz9aHjO0d6e2dfqRvUr1DjsWo6InK X-Received: by 2002:a17:90a:9a82:b0:20d:bd60:a100 with SMTP id e2-20020a17090a9a8200b0020dbd60a100mr5862004pjp.49.1671711203887; Thu, 22 Dec 2022 04:13:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671711203; cv=none; d=google.com; s=arc-20160816; b=HoDbF869mNdC27UMzr/OgJovwvVpXncJjAWZlHrPQK14P4X2A4D7q9X7/M76eqPXPx RFMWbiuyb1uEWkUdTR3gaj4h3Pah4TE5cEQxBAAKRr9XtWlPLEYne/rXHooTM9HV3sCf oTi17qykNTCTmNJ34s9O0UgtiJ0eDAlpyjOVaPBOEDjWK20aHn/w78WYv4xrBESmKa0i ndpjr5PRWjD+qPpxA0LOotivoVPWIg1DUwvsq/VryosEHna3kN1Hf4CVDQEeskgCYOlW C9eFSoGIDdbehchuL59t8tZ3uI5oovEY6jp4pLzYgCM0wkgYuM8nIjLmol+GCQbWmu5F tYoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=KJeiwtCwvbFZRIQTLTx02v7vDRrPNqXpj4utmGnBGBM=; b=ne5zD4KOIcCAxt6znVAXephBAl/UgI61VmG0yLIERS2QpExDI9qz4+ocrA0rlq7Hb+ n3crvrDufEh2jz2bXbUbVegc0G0UFF20LN7RB9PV6RKZLArFoSPJpR6XyItXhFnnEACU mu01/4zTCG0ThaDPtEWz34ZTOg1dSFSiVcRecHPN5GyUBe/q4LAHJxX+m7Oj06TS4Qfe fB3tcm2ehVLJ5QDqByJQUXEqZNkYO0hI5w2d5jWNkllGFv0+WNLKbhsOSZ4Eo3URURMb LhokqTw1bM9XZCSfokzsbjXUe04NUWXTn5TwiBMD0f0JkhVKyw7egth//1/JV080C5iY VA+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=RvDMYvCf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q136-20020a632a8e000000b004402f48dee0si636878pgq.629.2022.12.22.04.13.14; Thu, 22 Dec 2022 04:13:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=RvDMYvCf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235744AbiLVL5f (ORCPT + 67 others); Thu, 22 Dec 2022 06:57:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235741AbiLVLzv (ORCPT ); Thu, 22 Dec 2022 06:55:51 -0500 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5034E28E38; Thu, 22 Dec 2022 03:50:01 -0800 (PST) Received: by mail-ej1-x635.google.com with SMTP id u9so4438785ejo.0; Thu, 22 Dec 2022 03:50:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=KJeiwtCwvbFZRIQTLTx02v7vDRrPNqXpj4utmGnBGBM=; b=RvDMYvCfFf6vYNpg3Ev2D3liLm4RIqRGg7xA7Sq7wO+ZDOg5tU8i8roFWbTJ4QSb2u XOGbTjBnY6P43RWrFOJcGzen7WHP8IZOGMi/XN4buBEX58cOW0ylHc7MsZR5YhBChvD4 IYn2y560lNjGW+MI0uWs54rX/E8ekLdU43QeLurDFg4Exk+w2xQ7SknEk+REnbIvvair VTM92pU76YEElFttcHpUr/CDa7eg7WoS+1keuJ277doeMnjt+oKfDQVuy2yiyW7/WWJ1 eM0bvC0njqsIkeDsUbWKc13jqlb8RZg73AjJ82TINx23U7DiYNg6p0Ujtq48wtVHpT4Y gqOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=KJeiwtCwvbFZRIQTLTx02v7vDRrPNqXpj4utmGnBGBM=; b=vQMALmeqL/8oNjIccTxVV/gf0ugMqjO1APjmhj3JLzm5NuhvwF9PC7Mc5DwF4wxbuL I7n2nCZEDwrBUaBBgoB5p21FZuwrLxUObVb4RjjttmiNL4oSNcXh8R8OVMTVG3sAkE2W f/3YypaKMUyVB1+ExBU9JzbepF4adE4tzV/Nc7SgEFaa5CFIRFNOdgFDp9lWVvuEPDTd T2ei+LMQJr8SXejPjIHF1P8hcrUUtP3yb55BQ3kYYcNUUNYfBPC7bioHQ4AQW+l3cHKV 3rsJdddNeAKSnQr5Yq0Ei8WpybB02iXi26SaDMP0j4udv/Z32z2buEZUc7BleEzcPZuM K8pQ== X-Gm-Message-State: AFqh2krlAyrwCn2o95eSNXZ4BplYPqMV9wWUyXHRShycdv5Ckp9HIeZN Qn73fdHFrnKMabC4NcPig6t8k4RUP1tRbd8KBfI= X-Received: by 2002:a17:906:b01:b0:7c1:808e:765b with SMTP id u1-20020a1709060b0100b007c1808e765bmr340302ejg.196.1671709799747; Thu, 22 Dec 2022 03:49:59 -0800 (PST) MIME-Version: 1.0 References: <20221221000242.340202-1-prabhakar.mahadev-lad.rj@bp.renesas.com> <20221221000242.340202-5-prabhakar.mahadev-lad.rj@bp.renesas.com> <86o7rxawhn.wl-maz@kernel.org> In-Reply-To: From: "Lad, Prabhakar" Date: Thu, 22 Dec 2022 11:49:33 +0000 Message-ID: Subject: Re: [PATCH v2 4/9] irqchip: irq-renesas-rzg2l: Add support for RZ/G2UL SoC To: Geert Uytterhoeven Cc: Marc Zyngier , Thomas Gleixner , Rob Herring , Krzysztof Kozlowski , Geert Uytterhoeven , Magnus Damm , Linus Walleij , linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-gpio@vger.kernel.org, Biju Das , Lad Prabhakar Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 Hi Geert, On Wed, Dec 21, 2022 at 12:18 PM Geert Uytterhoeven wrote: > > On Wed, Dec 21, 2022 at 11:20 AM Marc Zyngier wrote: > > On Wed, 21 Dec 2022 00:02:37 +0000, > > Prabhakar wrote: > > > > > > From: Lad Prabhakar > > > > > > The IRQC block on RZ/G2UL SoC is almost identical to one found on the > > > RZ/G2L SoC the only difference being it can support BUS_ERR_INT for > > > which it has additional registers. > > > > > > This patch adds a new entry for "renesas,rzg2ul-irqc" compatible string > > > and now that we have interrupt-names property the driver code parses the > > > interrupts based on names and for backward compatibility we fallback to > > > parse interrupts based on index. > > > > > > For now we will be using rzg2l_irqc_init() as a callback for RZ/G2UL SoC > > > too and in future when the interrupt handler will be registered for > > > BUS_ERR_INT we will have to implement a new callback. > > > > > > Signed-off-by: Lad Prabhakar > > > > +/* Parse hierarchy domain interrupts ie only IRQ0-7 and TINT0-31 */ > > > +static int rzg2l_irqc_parse_hierarchy_interrupts(struct rzg2l_irqc_priv *priv, > > > + struct device_node *np) > > > +{ > > > + struct property *pp; > > > unsigned int i; > > > int ret; > > > > > > + /* > > > + * first check if interrupt-names property exists if so parse them by name > > > + * or else parse them by index for backward compatibility. > > > + */ > > > + pp = of_find_property(np, "interrupt-names", NULL); > > > + if (pp) { > > > + char *irq_name; > > > + > > > + /* parse IRQ0-7 */ > > > + for (i = 0; i < IRQC_IRQ_COUNT; i++) { > > > + irq_name = kasprintf(GFP_KERNEL, "irq%d", i); > > %u > Ok. > > > + if (!irq_name) > > > + return -ENOMEM; > > > + > > > + ret = rzg2l_irqc_parse_interrupt_by_name_to_fwspec(priv, np, irq_name, i); > > > > Am I the only one that find it rather odd to construct a name from an > > index, only to get another index back? > > The issue is that there are two number ranges ("irq%u" and "tint%u"), > stored in a single interrupts property. > > An alternative solution would be to get rid of the "interrupt-names", > and use two separate prefixed interrupts properties instead, like is > common for e.g. gpios: "irq-interrupts" and "tint-interrupts". > Maybe I will read all the interrupts based on index only for all the SoCs and we still add interrupt-names in dt bindings with the dt_binding check we can make sure all the interrupts for each SoC exist in the DT and the driver still reads them based on index. Does that sound good? Cheers, Prabhakar