From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5D3BC433F5 for ; Mon, 23 May 2022 14:26:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237149AbiEWO0s (ORCPT ); Mon, 23 May 2022 10:26:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237148AbiEWO0p (ORCPT ); Mon, 23 May 2022 10:26:45 -0400 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 836BA2B255 for ; Mon, 23 May 2022 07:26:43 -0700 (PDT) Received: by mail-lf1-x133.google.com with SMTP id y32so25873338lfa.6 for ; Mon, 23 May 2022 07:26:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=G8pSkplAhfSaVtqePqq8XjdcWWlymy9x8EhPSya+xcQ=; b=lyhx55/zAIKWU6MNtflmwMRqCG3WK3SvnlXBXjiHgsLYWJSvlsGHURt2CfjXGw+w5Z 9T/POO0IfWlxnm4ldWUCRi3apjNO415HWjuc39OoXNAAwX4IGXl8DNXTlHR+XFeoSJ9p ANhgfgJGy6QNR135WdYD6NGcQ6YwEPM2b22/HGCJoWDokpUm/cpTJdqUsFkRKzI83br0 lHzoZTZdQLhPjghrdM9RLgmXELx7Y0Hp5ahgfmltIRWRh0vIOfL6daJIuXxC4l3vqGpQ MvPNaDEINtn11/AdRN7lye2gTDxYFv0orSrAwwsS1jgDwvlJjV1ZgVVNrOdTlpgFMDw2 P81A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=G8pSkplAhfSaVtqePqq8XjdcWWlymy9x8EhPSya+xcQ=; b=sqrDZEjP7HG03oUEt83/sfsYNfKwJYgiCwNpT5e5u44p9kcc6W85yY0qtPFsdBdjSB ULgKK3lop4xHXq5FQY4C/G1gWUKfe6QdW6gOeNITVwPTpGr4ScLLyPhvWJJIwJT39v1P EHvrG4QWUL7AbFbDs3dQrgUEZZ1cX5K60zULX2hg/V6LTc7QujCm8ukqtnQRp5JfwTHK qrjiYY63dv3Hn0kJBIfg8R9MqRKj9UbjktiopvRyTB75SXOPRQ9uxWclqpTulArePWMu Mj5+lrMsUFdPJD4e9N5LX0pbVL42iRAQ0vXTrvDaSV4csBIhhMWsSEyioWi3QZx4YSc0 2XDw== X-Gm-Message-State: AOAM531FLABBAD9FYEeAKqGu/t/aDzPZ0XngQgQ23OGKz7SFhGK8464q OH0M8TmliZ0bt01bQYwzfilahg== X-Google-Smtp-Source: ABdhPJz+utSxZTs2n/fqh1e5tT8yA+mZZbm0vbet8rrFRC+nV5H+flGflipWNlxlkpty5umsiRR7UQ== X-Received: by 2002:a05:6512:33ce:b0:478:83ea:9e61 with SMTP id d14-20020a05651233ce00b0047883ea9e61mr433374lfg.264.1653316001764; Mon, 23 May 2022 07:26:41 -0700 (PDT) Received: from [192.168.0.17] (78-11-189-27.static.ip.netia.com.pl. [78.11.189.27]) by smtp.gmail.com with ESMTPSA id h16-20020a0565123c9000b00477a0eb9ab8sm1056497lfv.133.2022.05.23.07.26.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 23 May 2022 07:26:41 -0700 (PDT) Message-ID: <62562cdf-93e3-f642-5bbd-48329eff33ea@linaro.org> Date: Mon, 23 May 2022 16:26:39 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH v1 11/19] dt-bindings: reset: npcm: Add support for NPCM8XX Content-Language: en-US To: Geert Uytterhoeven , Tomer Maimon Cc: Avi Fishman , Tali Perry , Joel Stanley , Patrick Venture , Nancy Yuen , Benjamin Fair , Rob Herring , Krzysztof Kozlowski , Michael Turquette , Stephen Boyd , Philipp Zabel , Greg KH , Daniel Lezcano , Thomas Gleixner , Wim Van Sebroeck , Guenter Roeck , Catalin Marinas , Will Deacon , Arnd Bergmann , Olof Johansson , Jiri Slaby , Shawn Guo , =?UTF-8?Q?Bj=c3=b6rn_Andersson?= , Geert Uytterhoeven , Marcel Ziswiler , Vinod Koul , Biju Das , Nobuhiro Iwamatsu , Robert Hancock , =?UTF-8?Q?Jonathan_Neusch=c3=a4fer?= , Lubomir Rintel , arm-soc , devicetree , Linux Kernel Mailing List , linux-clk , "open list:SERIAL DRIVERS" , Linux Watchdog Mailing List , Linux ARM References: <20220522155046.260146-1-tmaimon77@gmail.com> <20220522155046.260146-12-tmaimon77@gmail.com> <86cd6a37-70ad-3a90-bc8a-dcd8b41f1175@linaro.org> From: Krzysztof Kozlowski In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 23/05/2022 16:22, Geert Uytterhoeven wrote: > Hi Tomer, > > On Mon, May 23, 2022 at 4:03 PM Tomer Maimon wrote: >> On Mon, 23 May 2022 at 12:01, Krzysztof Kozlowski wrote: >>> On 22/05/2022 17:50, Tomer Maimon wrote: >>>> Add binding document and device tree binding >>>> constants for Nuvoton BMC NPCM8XX reset controller. >>>> >>>> Signed-off-by: Tomer Maimon > >>>> --- /dev/null >>>> +++ b/include/dt-bindings/reset/nuvoton,npcm8xx-reset.h >>>> @@ -0,0 +1,124 @@ >>>> +/* SPDX-License-Identifier: GPL-2.0 */ >>>> +// Copyright (c) 2022 Nuvoton Technology corporation. >>>> + >>>> +#ifndef _DT_BINDINGS_NPCM8XX_RESET_H >>>> +#define _DT_BINDINGS_NPCM8XX_RESET_H >>>> + >>>> +#define NPCM8XX_RESET_IPSRST1 0x20 >>>> +#define NPCM8XX_RESET_IPSRST2 0x24 >>>> +#define NPCM8XX_RESET_IPSRST3 0x34 >>>> +#define NPCM8XX_RESET_IPSRST4 0x74 >>> >>> What are these? All IDs should be incremental, decimal and start from 0. >> >> Register offset, we use the same method in NPCM7xx. please refer >> https://elixir.bootlin.com/linux/v5.18/source/include/dt-bindings/reset/nuvoton,npcm7xx-reset.h >> >> and the driver asserts the reset according to the reset include definitions > > So if they're easy to look up the values, you could do without the > definitions? Cfr. the interrupts properties in .dtsi files, where we > typically just use the hardcoded numbers. > > If you do decide to keep them, a comment explaining their origins > would be useful. > >>>> + >>>> +/* Reset lines on IP1 reset module (NPCM8XX_RESET_IPSRST1) */ >>>> +#define NPCM8XX_RESET_GDMA0 3 >>> >>> IDs start from 0 and do not have holes. >> >> This represents the reset BIT in the reset register. > > Likewise, I think it's a good idea to document that in a comment, cfr. > https://elixir.bootlin.com/linux/v5.18/source/include/dt-bindings/power/r8a7795-sysc.h#L8 Renesas is also doing it not correct (just like many others). The bindings are not for register bits or offsets. Such data can be DTS but not part of bindings. Imagine now you made mistake in this register offset and hardware uses slightly different value. What now? Change bindings? No. Bindings hold here ID, the abstraction, and ID stays fixed. Best regards, Krzysztof From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6B0E3C433F5 for ; Mon, 23 May 2022 14:28:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=rYoY5jTzh+E0sT9/CBEBO3S2UDSNBgfhRHSdwXyc304=; b=qKJUxn9fNKo0Ka X0iqOusYnBX6ojvweMha8YXktHfFzFDDH5ySic6q2CWRjnlre4EHVt8UBAs8gO7wgij/yWICj+Gyw whxa+HWZXFIuNH9NvymJUH5lWkgLBrx8kPAd/4oSagOoPfEHgPJhZ0wCdUvoNa8l5IW8T/cAyt5wF X9kHZ2FJWfwYLOAwsZKMkXDhiclPcCsR7pJit8PV5VKGlnR0O6v9YZB6YzIYRRSO/w2Qzrt4H9t8p DbFG9WSW08O5T4MaurMwgNvpVgf/oYNqNvxZyXxxW5uL166dQxqRJ/JdRQRE9uxFle3sxtRb/M8aS pOkY1e88EArvBrAMPWJQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nt91D-004i3u-KB; Mon, 23 May 2022 14:26:47 +0000 Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nt919-004i2I-PB for linux-arm-kernel@lists.infradead.org; Mon, 23 May 2022 14:26:45 +0000 Received: by mail-lf1-x134.google.com with SMTP id t25so25890731lfg.7 for ; Mon, 23 May 2022 07:26:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=G8pSkplAhfSaVtqePqq8XjdcWWlymy9x8EhPSya+xcQ=; b=lyhx55/zAIKWU6MNtflmwMRqCG3WK3SvnlXBXjiHgsLYWJSvlsGHURt2CfjXGw+w5Z 9T/POO0IfWlxnm4ldWUCRi3apjNO415HWjuc39OoXNAAwX4IGXl8DNXTlHR+XFeoSJ9p ANhgfgJGy6QNR135WdYD6NGcQ6YwEPM2b22/HGCJoWDokpUm/cpTJdqUsFkRKzI83br0 lHzoZTZdQLhPjghrdM9RLgmXELx7Y0Hp5ahgfmltIRWRh0vIOfL6daJIuXxC4l3vqGpQ MvPNaDEINtn11/AdRN7lye2gTDxYFv0orSrAwwsS1jgDwvlJjV1ZgVVNrOdTlpgFMDw2 P81A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=G8pSkplAhfSaVtqePqq8XjdcWWlymy9x8EhPSya+xcQ=; b=YUWfvZlhD6Vsj0Of+a4QFn+Lubj3R7q1KLi+rKPnIAufErLPDUn9RXcbalR0hj0dUT NEH6lxwbb+K5G7xL1X5w40zrC+7v52537Kyk00nyZQUZoIg/sHg0sC84dBn+mf+j3Nnl 54bSbZ1psVt1NXpmow+bjuAF+3vMhwunuWirWCiNEN4Po1WzwORmShIrrmh6h1FRCCgV 7UMRRyGnWFiK6Q7/6AVL6gRgJ+7KiM5HVnKv1LDEbMQJ5G6KrG4juRtmNA/oEgn/xDSH HzjrzDRv7JWKgqMAei+Awlyi9Q/M3VmwcD3TKLm6VHygnamS8B6sUa3YEyvwJNllURpH vG3Q== X-Gm-Message-State: AOAM531SiLJc1XyIYzHZ5I8pAi6cVV1n1QHi6cduuVl79tH91WCk9v0J LY2ePRNvX3VBh91/bgzBWOi2Nw== X-Google-Smtp-Source: ABdhPJz+utSxZTs2n/fqh1e5tT8yA+mZZbm0vbet8rrFRC+nV5H+flGflipWNlxlkpty5umsiRR7UQ== X-Received: by 2002:a05:6512:33ce:b0:478:83ea:9e61 with SMTP id d14-20020a05651233ce00b0047883ea9e61mr433374lfg.264.1653316001764; Mon, 23 May 2022 07:26:41 -0700 (PDT) Received: from [192.168.0.17] (78-11-189-27.static.ip.netia.com.pl. [78.11.189.27]) by smtp.gmail.com with ESMTPSA id h16-20020a0565123c9000b00477a0eb9ab8sm1056497lfv.133.2022.05.23.07.26.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 23 May 2022 07:26:41 -0700 (PDT) Message-ID: <62562cdf-93e3-f642-5bbd-48329eff33ea@linaro.org> Date: Mon, 23 May 2022 16:26:39 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH v1 11/19] dt-bindings: reset: npcm: Add support for NPCM8XX Content-Language: en-US To: Geert Uytterhoeven , Tomer Maimon Cc: Avi Fishman , Tali Perry , Joel Stanley , Patrick Venture , Nancy Yuen , Benjamin Fair , Rob Herring , Krzysztof Kozlowski , Michael Turquette , Stephen Boyd , Philipp Zabel , Greg KH , Daniel Lezcano , Thomas Gleixner , Wim Van Sebroeck , Guenter Roeck , Catalin Marinas , Will Deacon , Arnd Bergmann , Olof Johansson , Jiri Slaby , Shawn Guo , =?UTF-8?Q?Bj=c3=b6rn_Andersson?= , Geert Uytterhoeven , Marcel Ziswiler , Vinod Koul , Biju Das , Nobuhiro Iwamatsu , Robert Hancock , =?UTF-8?Q?Jonathan_Neusch=c3=a4fer?= , Lubomir Rintel , arm-soc , devicetree , Linux Kernel Mailing List , linux-clk , "open list:SERIAL DRIVERS" , Linux Watchdog Mailing List , Linux ARM References: <20220522155046.260146-1-tmaimon77@gmail.com> <20220522155046.260146-12-tmaimon77@gmail.com> <86cd6a37-70ad-3a90-bc8a-dcd8b41f1175@linaro.org> From: Krzysztof Kozlowski In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220523_072643_870802_AECAC3C1 X-CRM114-Status: GOOD ( 22.08 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 23/05/2022 16:22, Geert Uytterhoeven wrote: > Hi Tomer, > > On Mon, May 23, 2022 at 4:03 PM Tomer Maimon wrote: >> On Mon, 23 May 2022 at 12:01, Krzysztof Kozlowski wrote: >>> On 22/05/2022 17:50, Tomer Maimon wrote: >>>> Add binding document and device tree binding >>>> constants for Nuvoton BMC NPCM8XX reset controller. >>>> >>>> Signed-off-by: Tomer Maimon > >>>> --- /dev/null >>>> +++ b/include/dt-bindings/reset/nuvoton,npcm8xx-reset.h >>>> @@ -0,0 +1,124 @@ >>>> +/* SPDX-License-Identifier: GPL-2.0 */ >>>> +// Copyright (c) 2022 Nuvoton Technology corporation. >>>> + >>>> +#ifndef _DT_BINDINGS_NPCM8XX_RESET_H >>>> +#define _DT_BINDINGS_NPCM8XX_RESET_H >>>> + >>>> +#define NPCM8XX_RESET_IPSRST1 0x20 >>>> +#define NPCM8XX_RESET_IPSRST2 0x24 >>>> +#define NPCM8XX_RESET_IPSRST3 0x34 >>>> +#define NPCM8XX_RESET_IPSRST4 0x74 >>> >>> What are these? All IDs should be incremental, decimal and start from 0. >> >> Register offset, we use the same method in NPCM7xx. please refer >> https://elixir.bootlin.com/linux/v5.18/source/include/dt-bindings/reset/nuvoton,npcm7xx-reset.h >> >> and the driver asserts the reset according to the reset include definitions > > So if they're easy to look up the values, you could do without the > definitions? Cfr. the interrupts properties in .dtsi files, where we > typically just use the hardcoded numbers. > > If you do decide to keep them, a comment explaining their origins > would be useful. > >>>> + >>>> +/* Reset lines on IP1 reset module (NPCM8XX_RESET_IPSRST1) */ >>>> +#define NPCM8XX_RESET_GDMA0 3 >>> >>> IDs start from 0 and do not have holes. >> >> This represents the reset BIT in the reset register. > > Likewise, I think it's a good idea to document that in a comment, cfr. > https://elixir.bootlin.com/linux/v5.18/source/include/dt-bindings/power/r8a7795-sysc.h#L8 Renesas is also doing it not correct (just like many others). The bindings are not for register bits or offsets. Such data can be DTS but not part of bindings. Imagine now you made mistake in this register offset and hardware uses slightly different value. What now? Change bindings? No. Bindings hold here ID, the abstraction, and ID stays fixed. Best regards, Krzysztof _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel