Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp10359588rwb; Fri, 25 Nov 2022 04:02:42 -0800 (PST) X-Google-Smtp-Source: AA0mqf75JbvKYyty41GcH5ZnyFzALX2r5nB9zruwoitOokYp5I5tsXzJIUO0nFOxuM1EHLNRiUp9 X-Received: by 2002:a17:90a:448a:b0:218:48f3:2e48 with SMTP id t10-20020a17090a448a00b0021848f32e48mr39443652pjg.36.1669377762439; Fri, 25 Nov 2022 04:02:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669377762; cv=none; d=google.com; s=arc-20160816; b=vekpX51ZNIH1dKigoDqO7yaldmPs4xEtzcjZL8W7rOC79DBpWsVResu+aC7srbnniT jgjC4G2uCEmKprqUmpC69QwPG6IuRaEqoytJWh7qNmFNpZqJjbqSRmg4Y3jhOTGio0cF XJNg7BhWslv+KQz7m+OXvpczbjikM9XF0t/chZ2utvJU08QKT4SofX6WJIaVysL/UJt3 qMklNJNpSUxmzTY9/fmnvOZMEdbW1L/lDxmZmL71cdfejTqrzB9il8Guvp3RxMnorq6w IeNIOLAHzkS4/YdUuTyox25oeI//4b4tnbM3nz4au6Fn9Qgh975W+rMLigJUFMzBg1Ct n6CQ== 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; bh=6Zo8eiAW4zN+rDEorAgGhPKfwHubATfFtXeTA+vPKZw=; b=rCkV/7z+GzUZOgsyCHhmznWUZ9v7X+7wsgLtM47FTXEYTzHwF7nLF3p7HMYBAN8vMu +i7oJmzQH5Z4JtM3x6wDNRYLS0qbSozoyz99k2sUzrRhvGuvxTx4ehcmvMxtmgksx6bg /KSn0eX8CVi6Fi6OQ0jQ2ZhS12fqvSNQ2wmCpsPWbgpMXmsOgYyfESYBYdj7iweA4pRD 9P+kZCIBpunzIh9cwCMqf8h3qgCvdY2nCysvVSqUVT7idydqsKnk1sgNomPM5GsqKC4D jSyYOH2XSwabvBe60X+NUKGmbGri94owBWmu6/nS4eO+TAN15/lDiNRAqsPvs4dWTm7L LPhA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i5-20020a63e445000000b0046fc9e82c99si3778193pgk.206.2022.11.25.04.02.30; Fri, 25 Nov 2022 04:02:42 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229701AbiKYLYx (ORCPT + 86 others); Fri, 25 Nov 2022 06:24:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229601AbiKYLY3 (ORCPT ); Fri, 25 Nov 2022 06:24:29 -0500 Received: from mail-qt1-f176.google.com (mail-qt1-f176.google.com [209.85.160.176]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC1A31BEA9; Fri, 25 Nov 2022 03:24:27 -0800 (PST) Received: by mail-qt1-f176.google.com with SMTP id cg5so2335280qtb.12; Fri, 25 Nov 2022 03:24:27 -0800 (PST) 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=6Zo8eiAW4zN+rDEorAgGhPKfwHubATfFtXeTA+vPKZw=; b=Jfo5/yLvXWXEpU5RoKTZ1ivfTPiaZqBuMjPCSp9rbV4uMq2Ttl8m1mIZddp6I8KQdU ZPe5BblFnT/BjrB7gbQQKqDVcmZMlbKG57GMuX9FiR0WPX7Z5naetoDoUtPSLL+/nAYK G6t/jxGHnOx1j94aiJdFPq37id97phUqnkREoKYPCAhTHw3scFgTaVQqgQagidlW8TTn 2axKAy0cd7xI4SmPnLRCBUczih/1w/Fx7oTda1hPLoN95b6AZc0xckKDkdXXsMZlj+vk VqiCHqvG6+9ekdOe8LYdM9tq2yy+pgSKrq9SADs1tcEuctVccyfbULRXg0Anel6Ey3w2 XbMA== X-Gm-Message-State: ANoB5pmzoJNqUR9lQa2+vqOSEE6XG9TCGdcqdxJpwWSev8pKhSZjScYG zDeavqrol0mOmqSclxe8Z17ktRN0p17onA== X-Received: by 2002:ac8:528f:0:b0:38a:9db4:8006 with SMTP id s15-20020ac8528f000000b0038a9db48006mr16442615qtn.166.1669375466668; Fri, 25 Nov 2022 03:24:26 -0800 (PST) Received: from mail-yb1-f173.google.com (mail-yb1-f173.google.com. [209.85.219.173]) by smtp.gmail.com with ESMTPSA id k8-20020ac84748000000b003a569a0afcasm2035904qtp.66.2022.11.25.03.24.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 25 Nov 2022 03:24:26 -0800 (PST) Received: by mail-yb1-f173.google.com with SMTP id z192so4780948yba.0; Fri, 25 Nov 2022 03:24:26 -0800 (PST) X-Received: by 2002:a25:2343:0:b0:6f3:c535:4e9c with SMTP id j64-20020a252343000000b006f3c5354e9cmr86466ybj.380.1669375077609; Fri, 25 Nov 2022 03:17:57 -0800 (PST) MIME-Version: 1.0 References: <20221124172207.153718-1-prabhakar.mahadev-lad.rj@bp.renesas.com> <20221124172207.153718-7-prabhakar.mahadev-lad.rj@bp.renesas.com> <70d1bfde-f57f-1741-08d3-23e362793595@linaro.org> In-Reply-To: From: Geert Uytterhoeven Date: Fri, 25 Nov 2022 12:17:45 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v4 6/7] dt-bindings: cache: r9a07g043f-l2-cache: Add DT binding documentation for L2 cache controller To: "Lad, Prabhakar" Cc: Krzysztof Kozlowski , Paul Walmsley , Palmer Dabbelt , Albert Ou , Geert Uytterhoeven , Magnus Damm , Heiko Stuebner , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Guo Ren , Jisheng Zhang , Atish Patra , Anup Patel , Andrew Jones , Nathan Chancellor , Philipp Tomsich , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-renesas-soc@vger.kernel.org, Biju Das , Lad Prabhakar Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no 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 Prabhakar, On Fri, Nov 25, 2022 at 11:34 AM Lad, Prabhakar wrote: > On Fri, Nov 25, 2022 at 8:16 AM Krzysztof Kozlowski > wrote: > > On 24/11/2022 18:22, Prabhakar wrote: > > > From: Lad Prabhakar > > > > > > Add DT binding documentation for L2 cache controller found on RZ/Five SoC. > > > > > > The Renesas RZ/Five microprocessor includes a RISC-V CPU Core (AX45MP > > > Single) from Andes. The AX45MP core has an L2 cache controller, this patch > > > describes the L2 cache block. > > > > > > Signed-off-by: Lad Prabhakar > > > --- > > > RFC v3 -> v4 > > > * Dropped l2 cache configuration parameters > > > * s/larger/large > > > * Added minItems/maxItems for andestech,pma-regions > > > --- /dev/null > > > +++ b/Documentation/devicetree/bindings/cache/andestech,ax45mp-cache.yaml > > > +examples: > > > + - | > > > + #include > > > + #include > > > + > > > + cache-controller@2010000 { > > > + reg = <0x13400000 0x100000>; > > > + compatible = "andestech,ax45mp-cache", "cache"; > > > + interrupts = <508 IRQ_TYPE_LEVEL_HIGH>; > > > + cache-line-size = <64>; > > > + cache-level = <2>; > > > + cache-sets = <1024>; > > > + cache-size = <262144>; > > > + cache-unified; > > > + andestech,pma-regions = <0x58000000 0x08000000 > > > + (AX45MP_PMACFG_ETYP_NAPOT | AX45MP_PMACFG_MTYP_MEM_NON_CACHE_BUF)>; > > > + }; > > > diff --git a/include/dt-bindings/cache/andestech,ax45mp-cache.h b/include/dt-bindings/cache/andestech,ax45mp-cache.h > > > new file mode 100644 > > > index 000000000000..aa1cad24075d > > > --- /dev/null > > > +++ b/include/dt-bindings/cache/andestech,ax45mp-cache.h > > > @@ -0,0 +1,38 @@ > > > +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ > > > +/* > > > + * This header provides constants for Andes AX45MP PMA configuration > > > + * > > > + * Copyright (C) 2022 Renesas Electronics Corp. > > > + */ > > > + > > > +#ifndef __DT_BINDINGS_ANDESTECH_AX45MP_CACHE_H > > > +#define __DT_BINDINGS_ANDESTECH_AX45MP_CACHE_H > > > + > > > +/* OFF: PMA entry is disabled */ > > > +#define AX45MP_PMACFG_ETYP_DISABLED 0 > > > +/* Naturally aligned power of 2 region */ > > > +#define AX45MP_PMACFG_ETYP_NAPOT 3 > > > + > > > +/* Device, Non-bufferable */ > > > +#define AX45MP_PMACFG_MTYP_DEV_NON_BUF (0 << 2) > > > +/* Device, bufferable */ > > > +#define AX45MP_PMACFG_MTYP_DEV_BUF (1 << 2) > > > +/* Memory, Non-cacheable, Non-bufferable */ > > > +#define AX45MP_PMACFG_MTYP_MEM_NON_CACHE_NON_BUF (2 << 2) > > > +/* Memory, Non-cacheable, Bufferable */ > > > +#define AX45MP_PMACFG_MTYP_MEM_NON_CACHE_BUF (3 << 2) > > > > What are all these? They don't look like flags, because 3 = 1 | 2... > > they don't look like constants, because we do not use shifts in > > constants. Are these some register values? I also do not see the header > > being used in the code, so why having a bindings header if it is not > > used (DTS is not usage...)? > > > These are register bit values for the MTYP[5:2] field. The DTS example > in the binding doc (above) uses these macros. I haven't included the > DTS/I patches with this patchset yet do think I should? I think the main objection from Rob is that these look too much like raw register values to be written unchanged to registers, which is frowned upon in DT. Now, can we make this more generic? 1. Do you need AX45MP_PMACFG_ETYP_DISABLED, i.e. will it ever be specified in DTS, or is this a pure software thing? 2. Obviously you can let the driver decide if AX45MP_PMACFG_ETYP_NAPOT can be set, based on address/size? 3. If the two above are removed, the shifts can be handled in the driver instead, 4. Are there existing (more generic) definitions that can be used instead? BTW, what's the difference between non-bufferable and non-cacheable? Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds