All of lore.kernel.org
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzk@kernel.org>
To: Gatien CHEVALLIER <gatien.chevallier@foss.st.com>,
	alexandre.torgue@foss.st.com, robh+dt@kernel.org,
	Oleksii_Moisieiev@epam.com, linus.walleij@linaro.org,
	gregkh@linuxfoundation.org
Cc: linux-stm32@st-md-mailman.stormreply.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, loic.pallardy@st.com,
	devicetree@vger.kernel.org, mark.rutland@arm.com, arnd@arndb.de
Subject: Re: [RFC PATCH 3/7] dt-bindings: bus: add STM32MP15 ETZPC firewall bus bindings
Date: Thu, 5 Jan 2023 22:53:58 +0100	[thread overview]
Message-ID: <dfe328fc-349b-3357-a8ac-6fc363f403fc@kernel.org> (raw)
In-Reply-To: <8f022dc8-d728-ba91-35ed-8a4006855f0d@foss.st.com>

On 04/01/2023 14:43, Gatien CHEVALLIER wrote:
> Hello Krzysztof,
> 
> On 12/22/22 14:57, Krzysztof Kozlowski wrote:
>> On 22/12/2022 14:51, Gatien CHEVALLIER wrote:
>>> Hello,
>>>
>>> On 12/22/22 11:26, Krzysztof Kozlowski wrote:
>>>> On 21/12/2022 18:30, Gatien Chevallier wrote:
>>>>> Adds the list of peripherals IDs under firewall bus on STM32MP15.
>>>>>
>>>>> Signed-off-by: Gatien Chevallier <gatien.chevallier@foss.st.com>
>>>>> ---
>>>>>    include/dt-bindings/bus/stm32mp15_sys_bus.h | 98 +++++++++++++++++++++
>>>>>    1 file changed, 98 insertions(+)
>>>>>    create mode 100644 include/dt-bindings/bus/stm32mp15_sys_bus.h
>>>>>
>>>>> diff --git a/include/dt-bindings/bus/stm32mp15_sys_bus.h b/include/dt-bindings/bus/stm32mp15_sys_bus.h
>>>>> new file mode 100644
>>>>> index 000000000000..97eacc7b5f16
>>>>> --- /dev/null
>>>>> +++ b/include/dt-bindings/bus/stm32mp15_sys_bus.h
>>>>
>>>> That's wrong in multiple ways:
>>>> 1. No underscores
>>>> 2. Missing vendor prefix
>>>> 3. Name not matching compatible.
>>>
>>> Sure, will comply in V3.
>>>
>>>>
>>>>> @@ -0,0 +1,98 @@
>>>>> +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
>>>>> +/*
>>>>> + * Copyright (C) STMicroelectronics 2022 - All Rights Reserved
>>>>> + */
>>>>> +#ifndef _DT_BINDINGS_BUS_STM32MP15_SYS_BUS_H
>>>>> +#define _DT_BINDINGS_BUS_STM32MP15_SYS_BUS_H
>>>>> +
>>>>> +/* ETZPC IDs */
>>>>> +#define STM32MP1_ETZPC_STGENC_ID	0
>>>>> +#define STM32MP1_ETZPC_BKPSRAM_ID	1
>>>>> +#define STM32MP1_ETZPC_IWDG1_ID		2
>>>>> +#define STM32MP1_ETZPC_USART1_ID	3
>>>>> +#define STM32MP1_ETZPC_SPI6_ID		4
>>>>> +#define STM32MP1_ETZPC_I2C4_ID		5
>>>>> +/* ID 6 reserved */
>>>>
>>>> Reserved why? These are IDs so they start from 0 and go by 0. Don't
>>>> hard-code some register offsets.
>>>
>>> Here, I do define IDs. Some appear as reserved based on what I've seen
>>> in the SoC datasheet that states these as "indexes"
>>>
>>> Please see the table 94 in chapter 15.6 (ETZPC) of the STM32MP157
>>> Reference manual:
>>> [1] https://www.st.com/resource/en/reference_manual/DM00327659-.pdf
>>
>> Then why do you define them in bindings? Use raw numbers. Do you see
>> anywhere in arm/arm64 bindings for GIC_SPI interrupt numbers?
>>
> 
> What would you think of simply removing the comments that state that IDs 
> are reserved, mimicking the way it is for qcom bindings? Fundamentally, 
> they are indeed only IDs and could be raw numbers.

If these are IDs then there are no reserved numbers and they are
continuous from 0 to X. Without gaps.

> IMO, this makes reading the device tree harder. Because you'd have to 
> look what the raw number corresponds to.

Sure, but that's not the reason to put numbers to the bindings... You
mix defines with bindings.

> To take an example, it has already been done for SCMI clocks and I find 
> it eases comprehension.

You need to be a bit more specific...

Anyway, IDs should be placed in bindings. Some mapping of
internal/hardware ports, registers, offsets, values - usually not.

I don't know where exactly your case fits, but when some IDs are
reserved it is a clear sign that these are not IDs (again - IDs start
from 0 and go incrementally by one, without gaps).


Best regards,
Krzysztof


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: Krzysztof Kozlowski <krzk@kernel.org>
To: Gatien CHEVALLIER <gatien.chevallier@foss.st.com>,
	alexandre.torgue@foss.st.com, robh+dt@kernel.org,
	Oleksii_Moisieiev@epam.com, linus.walleij@linaro.org,
	gregkh@linuxfoundation.org
Cc: linux-stm32@st-md-mailman.stormreply.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, loic.pallardy@st.com,
	devicetree@vger.kernel.org, mark.rutland@arm.com, arnd@arndb.de
Subject: Re: [RFC PATCH 3/7] dt-bindings: bus: add STM32MP15 ETZPC firewall bus bindings
Date: Thu, 5 Jan 2023 22:53:58 +0100	[thread overview]
Message-ID: <dfe328fc-349b-3357-a8ac-6fc363f403fc@kernel.org> (raw)
In-Reply-To: <8f022dc8-d728-ba91-35ed-8a4006855f0d@foss.st.com>

On 04/01/2023 14:43, Gatien CHEVALLIER wrote:
> Hello Krzysztof,
> 
> On 12/22/22 14:57, Krzysztof Kozlowski wrote:
>> On 22/12/2022 14:51, Gatien CHEVALLIER wrote:
>>> Hello,
>>>
>>> On 12/22/22 11:26, Krzysztof Kozlowski wrote:
>>>> On 21/12/2022 18:30, Gatien Chevallier wrote:
>>>>> Adds the list of peripherals IDs under firewall bus on STM32MP15.
>>>>>
>>>>> Signed-off-by: Gatien Chevallier <gatien.chevallier@foss.st.com>
>>>>> ---
>>>>>    include/dt-bindings/bus/stm32mp15_sys_bus.h | 98 +++++++++++++++++++++
>>>>>    1 file changed, 98 insertions(+)
>>>>>    create mode 100644 include/dt-bindings/bus/stm32mp15_sys_bus.h
>>>>>
>>>>> diff --git a/include/dt-bindings/bus/stm32mp15_sys_bus.h b/include/dt-bindings/bus/stm32mp15_sys_bus.h
>>>>> new file mode 100644
>>>>> index 000000000000..97eacc7b5f16
>>>>> --- /dev/null
>>>>> +++ b/include/dt-bindings/bus/stm32mp15_sys_bus.h
>>>>
>>>> That's wrong in multiple ways:
>>>> 1. No underscores
>>>> 2. Missing vendor prefix
>>>> 3. Name not matching compatible.
>>>
>>> Sure, will comply in V3.
>>>
>>>>
>>>>> @@ -0,0 +1,98 @@
>>>>> +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
>>>>> +/*
>>>>> + * Copyright (C) STMicroelectronics 2022 - All Rights Reserved
>>>>> + */
>>>>> +#ifndef _DT_BINDINGS_BUS_STM32MP15_SYS_BUS_H
>>>>> +#define _DT_BINDINGS_BUS_STM32MP15_SYS_BUS_H
>>>>> +
>>>>> +/* ETZPC IDs */
>>>>> +#define STM32MP1_ETZPC_STGENC_ID	0
>>>>> +#define STM32MP1_ETZPC_BKPSRAM_ID	1
>>>>> +#define STM32MP1_ETZPC_IWDG1_ID		2
>>>>> +#define STM32MP1_ETZPC_USART1_ID	3
>>>>> +#define STM32MP1_ETZPC_SPI6_ID		4
>>>>> +#define STM32MP1_ETZPC_I2C4_ID		5
>>>>> +/* ID 6 reserved */
>>>>
>>>> Reserved why? These are IDs so they start from 0 and go by 0. Don't
>>>> hard-code some register offsets.
>>>
>>> Here, I do define IDs. Some appear as reserved based on what I've seen
>>> in the SoC datasheet that states these as "indexes"
>>>
>>> Please see the table 94 in chapter 15.6 (ETZPC) of the STM32MP157
>>> Reference manual:
>>> [1] https://www.st.com/resource/en/reference_manual/DM00327659-.pdf
>>
>> Then why do you define them in bindings? Use raw numbers. Do you see
>> anywhere in arm/arm64 bindings for GIC_SPI interrupt numbers?
>>
> 
> What would you think of simply removing the comments that state that IDs 
> are reserved, mimicking the way it is for qcom bindings? Fundamentally, 
> they are indeed only IDs and could be raw numbers.

If these are IDs then there are no reserved numbers and they are
continuous from 0 to X. Without gaps.

> IMO, this makes reading the device tree harder. Because you'd have to 
> look what the raw number corresponds to.

Sure, but that's not the reason to put numbers to the bindings... You
mix defines with bindings.

> To take an example, it has already been done for SCMI clocks and I find 
> it eases comprehension.

You need to be a bit more specific...

Anyway, IDs should be placed in bindings. Some mapping of
internal/hardware ports, registers, offsets, values - usually not.

I don't know where exactly your case fits, but when some IDs are
reserved it is a clear sign that these are not IDs (again - IDs start
from 0 and go incrementally by one, without gaps).


Best regards,
Krzysztof


  reply	other threads:[~2023-01-05 23:40 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-21 17:30 [RFC PATCH 0/7] Introduce STM32 system bus Gatien Chevallier
2022-12-21 17:30 ` Gatien Chevallier
2022-12-21 17:30 ` [RFC PATCH 1/7] dt-bindings: Document common device controller bindings Gatien Chevallier
2022-12-21 17:30   ` Gatien Chevallier
2022-12-22 10:22   ` Krzysztof Kozlowski
2022-12-22 10:22     ` Krzysztof Kozlowski
2022-12-22 13:01     ` Gatien CHEVALLIER
2022-12-22 13:01       ` Gatien CHEVALLIER
2022-12-22 13:51       ` Krzysztof Kozlowski
2022-12-22 13:51         ` Krzysztof Kozlowski
2022-12-21 17:30 ` [RFC PATCH 2/7] dt-bindings: bus: add STM32 System Bus Gatien Chevallier
2022-12-21 17:30   ` Gatien Chevallier
2022-12-21 20:09   ` Rob Herring
2022-12-21 20:09     ` Rob Herring
2022-12-22 10:24   ` Krzysztof Kozlowski
2022-12-22 10:24     ` Krzysztof Kozlowski
2022-12-22 13:39     ` Gatien CHEVALLIER
2022-12-22 13:39       ` Gatien CHEVALLIER
2022-12-22 13:55       ` Krzysztof Kozlowski
2022-12-22 13:55         ` Krzysztof Kozlowski
2022-12-21 17:30 ` [RFC PATCH 3/7] dt-bindings: bus: add STM32MP15 ETZPC firewall bus bindings Gatien Chevallier
2022-12-21 17:30   ` Gatien Chevallier
2022-12-22 10:26   ` Krzysztof Kozlowski
2022-12-22 10:26     ` Krzysztof Kozlowski
2022-12-22 13:51     ` Gatien CHEVALLIER
2022-12-22 13:51       ` Gatien CHEVALLIER
2022-12-22 13:57       ` Krzysztof Kozlowski
2022-12-22 13:57         ` Krzysztof Kozlowski
2023-01-04 13:43         ` Gatien CHEVALLIER
2023-01-04 13:43           ` Gatien CHEVALLIER
2023-01-05 21:53           ` Krzysztof Kozlowski [this message]
2023-01-05 21:53             ` Krzysztof Kozlowski
2023-01-09 11:54             ` Gatien CHEVALLIER
2023-01-09 11:54               ` Gatien CHEVALLIER
2023-01-11 12:32               ` Krzysztof Kozlowski
2023-01-11 12:32                 ` Krzysztof Kozlowski
2023-01-16 14:06                 ` Gatien CHEVALLIER
2023-01-16 14:06                   ` Gatien CHEVALLIER
2022-12-21 17:30 ` [RFC PATCH 4/7] dt-bindings: bus: add STM32MP13 " Gatien Chevallier
2022-12-21 17:30   ` Gatien Chevallier
2022-12-22 10:26   ` Krzysztof Kozlowski
2022-12-22 10:26     ` Krzysztof Kozlowski
2022-12-22 13:53     ` Gatien CHEVALLIER
2022-12-22 13:53       ` Gatien CHEVALLIER
2022-12-21 17:30 ` [RFC PATCH 5/7] bus: stm32_sys_bus: add support for STM32MP15 and STM32MP13 system bus Gatien Chevallier
2022-12-21 17:30   ` Gatien Chevallier
2022-12-22 10:28   ` Krzysztof Kozlowski
2022-12-22 10:28     ` Krzysztof Kozlowski
2022-12-22 14:30     ` Gatien CHEVALLIER
2022-12-22 14:30       ` Gatien CHEVALLIER
2022-12-22 15:19       ` Krzysztof Kozlowski
2022-12-22 15:19         ` Krzysztof Kozlowski
2022-12-21 17:30 ` [RFC PATCH 6/7] ARM: dts: stm32: add ETZPC as a system bus for STM32MP15x boards Gatien Chevallier
2022-12-21 17:30   ` Gatien Chevallier
2022-12-22 10:30   ` Krzysztof Kozlowski
2022-12-22 10:30     ` Krzysztof Kozlowski
2022-12-22 14:42     ` Gatien CHEVALLIER
2022-12-22 14:42       ` Gatien CHEVALLIER
2022-12-22 15:21       ` Krzysztof Kozlowski
2022-12-22 15:21         ` Krzysztof Kozlowski
2022-12-22 15:57         ` Gatien CHEVALLIER
2022-12-22 15:57           ` Gatien CHEVALLIER
2022-12-22 16:00           ` Krzysztof Kozlowski
2022-12-22 16:00             ` Krzysztof Kozlowski
2022-12-21 17:30 ` [RFC PATCH 7/7] ARM: dts: stm32: add ETZPC as a system bus for STM32MP13x boards Gatien Chevallier
2022-12-21 17:30   ` Gatien Chevallier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=dfe328fc-349b-3357-a8ac-6fc363f403fc@kernel.org \
    --to=krzk@kernel.org \
    --cc=Oleksii_Moisieiev@epam.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=arnd@arndb.de \
    --cc=devicetree@vger.kernel.org \
    --cc=gatien.chevallier@foss.st.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=loic.pallardy@st.com \
    --cc=mark.rutland@arm.com \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.