mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>
To: Krzysztof Kozlowski <krzk@kernel.org>
Cc: Rob Herring <robh@kernel.org>, Conor Dooley <conor+dt@kernel.org>,
	Alim Akhtar <alim.akhtar@samsung.com>,
	Sam Protsenko <semen.protsenko@linaro.org>,
	devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/3] dt-bindings: soc: samsung: usi: add USIv1 and samsung,exynos8895-usi
Date: Sun, 5 Jan 2025 11:51:08 +0200	[thread overview]
Message-ID: <e7444f6c-f280-404a-8172-ae4869e3d492@gmail.com> (raw)
In-Reply-To: <nk7rifc5mcsdlmgpncrpoumerajrpdekxpvqwwe2hz4b63rgci@flowtxwchm7y>

On 1/5/25 11:18, Krzysztof Kozlowski wrote:
> On Sat, Jan 04, 2025 at 06:29:14PM +0200, Ivaylo Ivanov wrote:
>>  
>>    reg:
>>      maxItems: 1
>> @@ -64,7 +75,6 @@ properties:
>>  
>>    samsung,mode:
>>      $ref: /schemas/types.yaml#/definitions/uint32
>> -    enum: [0, 1, 2, 3]
> Widest constraints stay here, so minimum/maximum.

Why? If we are going to add new enum values specific for each USI version,
isn't it better to selectively constrain them in the binding?

>
>>      description:
>>        Selects USI function (which serial protocol to use). Refer to
>>        <include/dt-bindings/soc/samsung,exynos-usi.h> for valid USI mode values.
>> @@ -101,18 +111,42 @@ required:
>>    - samsung,sysreg
>>    - samsung,mode
>>  
>> +allOf:
>> +  - if:
>> +      properties:
>> +        compatible:
>> +          contains:
>> +            enum:
>> +              - samsung,exynos850-usi
>> +    then:
>> +      properties:
>> +        reg:
>> +          maxItems: 1
>> +
>> +        samsung,mode:
>> +          enum: [0, 1, 2, 3]
>> +
>> +      required:
>> +        - reg
>> +
>> +    else:
>> +      properties:
>> +        reg: false
>> +        samsung,clkreq-on: false
>> +
>> +        samsung,mode:
>> +          enum: [4, 5, 6, 7, 8, 9, 10]
> Is it really true? Previously for example GS101 had values 0-3, now you
> claim has values 4-10, so an ABI change without explanation.

How is it unexplained? Citing the commit message:
"Add constants for choosing USIv1 configuration mode in device tree.
Those are further used in the USI driver to figure out which value to
write into SW_CONF register."

USIv1 and v2 write different values to the SW_CONF register. For example:

#define USI_V1_SW_CONF_UART        0x8
#define USI_V2_SW_CONF_UART    BIT(0)

..
 [USI_V2_UART] =    { .name = "uart", .val = USI_V2_SW_CONF_UART },
 [USI_V1_UART] =    { .name = "uart", .val = USI_V1_SW_CONF_UART },
..

Hence the decision to have separate constants for different USI versions,
which in my opinion is cleaner than meshing the enums together and
choosing what to use with IFs in the driver code.

>
>> +
>>  if:
> Missing allOf:
>
>>    properties:
>>      compatible:
>>        contains:
>>          enum:
>>            - samsung,exynos850-usi
>> +          - samsung,exynos8895-usi
> Effect is not readable and not correct. You have two if:then:else.
> Usually it is easier to just have separate if: for each group of
> variants and define/constrain complete for such group within its if:.
>
>>  
>>  then:
>>    properties:
>> -    reg:
>> -      maxItems: 1
>> -
>>      clocks:
>>        items:
>>          - description: Bus (APB) clock
>> @@ -122,16 +156,13 @@ then:
>>        maxItems: 2
>>  
>>    required:
>> -    - reg
>>      - clocks
>>      - clock-names
>>  
>>  else:
>>    properties:
>> -    reg: false
>>      clocks: false
>>      clock-names: false
>> -    samsung,clkreq-on: false
>>  
>>  additionalProperties: false
>>  
>> diff --git a/include/dt-bindings/soc/samsung,exynos-usi.h b/include/dt-bindings/soc/samsung,exynos-usi.h
>> index a01af169d..4c077c9a8 100644
>> --- a/include/dt-bindings/soc/samsung,exynos-usi.h
>> +++ b/include/dt-bindings/soc/samsung,exynos-usi.h
>> @@ -13,5 +13,12 @@
>>  #define USI_V2_UART		1
>>  #define USI_V2_SPI		2
>>  #define USI_V2_I2C		3
>> +#define USI_V1_NONE		4
> Drop, it is already there.
>
>> +#define USI_V1_I2C0		5
>> +#define USI_V1_I2C1		6
>> +#define USI_V1_I2C0_1		7
>> +#define USI_V1_SPI		8
> Drop
>
>> +#define USI_V1_UART		9
> Drop

How so? These bring different configuration values. Could you specify how
exactly you want me to implement these in the driver?

Thanks for the feedback!

Best regards,
Ivaylo

>
>> +#define USI_V1_UART_I2C1	10
>
> Best regards,
> Krzysztof
>


  reply	other threads:[~2025-01-05  9:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-04 16:29 [PATCH v2 0/3] soc: samsung: usi: implement support for USIv1 Ivaylo Ivanov
2025-01-04 16:29 ` [PATCH v2 1/3] dt-bindings: soc: samsung: exynos-sysreg: add sysreg compatibles for exynos8895 Ivaylo Ivanov
2025-01-05  9:22   ` (subset) " Krzysztof Kozlowski
2025-01-04 16:29 ` [PATCH v2 2/3] dt-bindings: soc: samsung: usi: add USIv1 and samsung,exynos8895-usi Ivaylo Ivanov
2025-01-05  9:18   ` Krzysztof Kozlowski
2025-01-05  9:51     ` Ivaylo Ivanov [this message]
2025-01-05 10:39       ` Krzysztof Kozlowski
2025-01-05 10:51         ` Ivaylo Ivanov
2025-01-04 16:29 ` [PATCH v2 3/3] soc: samsung: usi: implement support for USIv1 Ivaylo Ivanov

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=e7444f6c-f280-404a-8172-ae4869e3d492@gmail.com \
    --to=ivo.ivanov.ivanov1@gmail.com \
    --cc=alim.akhtar@samsung.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=semen.protsenko@linaro.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®