diff mbox series

[7/9] dt-bindings: spi: mtk-snfi: add two timing delay property

Message ID 20221128020613.14821-8-xiangsheng.hou@mediatek.com (mailing list archive)
State New, archived
Headers show
Series Add MediaTek MT7986 SPI NAND and ECC support | expand

Commit Message

Xiangsheng Hou Nov. 28, 2022, 2:06 a.m. UTC
add rx-sample-delay and rx-latch-latency property.

Signed-off-by: Xiangsheng Hou <xiangsheng.hou@mediatek.com>
---
 .../bindings/spi/mediatek,spi-mtk-snfi.yaml      | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Comments

Krzysztof Kozlowski Nov. 28, 2022, 9:04 a.m. UTC | #1
On 28/11/2022 03:06, Xiangsheng Hou wrote:
> add rx-sample-delay and rx-latch-latency property.

Start sentences with capital letter.

Here and in commit subject: property->properties

> 
> Signed-off-by: Xiangsheng Hou <xiangsheng.hou@mediatek.com>
> ---
>  .../bindings/spi/mediatek,spi-mtk-snfi.yaml      | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/spi/mediatek,spi-mtk-snfi.yaml b/Documentation/devicetree/bindings/spi/mediatek,spi-mtk-snfi.yaml
> index ee20075cd0e7..367862688e92 100644
> --- a/Documentation/devicetree/bindings/spi/mediatek,spi-mtk-snfi.yaml
> +++ b/Documentation/devicetree/bindings/spi/mediatek,spi-mtk-snfi.yaml
> @@ -55,6 +55,22 @@ properties:
>      description: device-tree node of the accompanying ECC engine.
>      $ref: /schemas/types.yaml#/definitions/phandle
>  
> +  rx-sample-delay:

No, use existing property, don't invent your own stuff - missing unit
suffix. See spi-peripheral-props.yaml.

> +    description: Rx delay to sample data with this value, the valid
> +                 values are from 0 to 47. The delay is smaller than
> +                 the rx-latch-latency.
> +    $ref: /schemas/types.yaml#/definitions/uint32

Drop $ref.

> +    minItems: 0
> +    maxItems: 47
> +    default: 0
> +
> +  rx-latch-latency:

Same problems. Did you check spi-peripheral-props.yaml or other SPI
controller schemas for such property?

> +    description: Rx delay to sample data with this value, the value
> +                 unit is clock cycle.

I think the unit should be rather time (e.g. us).

> +    $ref: /schemas/types.yaml#/definitions/uint32
> +    enum: [0, 1, 2, 3]
> +    default: 0
> +
>  required:
>    - compatible
>    - reg

Best regards,
Krzysztof
Rob Herring (Arm) Nov. 28, 2022, 12:20 p.m. UTC | #2
On Mon, 28 Nov 2022 10:06:11 +0800, Xiangsheng Hou wrote:
> add rx-sample-delay and rx-latch-latency property.
> 
> Signed-off-by: Xiangsheng Hou <xiangsheng.hou@mediatek.com>
> ---
>  .../bindings/spi/mediatek,spi-mtk-snfi.yaml      | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/spi/mediatek,spi-mtk-snfi.yaml: properties:rx-sample-delay:minItems: 0 is less than the minimum of 1
	from schema $id: http://devicetree.org/meta-schemas/keywords.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/spi/mediatek,spi-mtk-snfi.yaml: properties:rx-sample-delay:maxItems: False schema does not allow 47
	hint: Scalar properties should not have array keywords
	from schema $id: http://devicetree.org/meta-schemas/keywords.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/spi/mediatek,spi-mtk-snfi.yaml: properties:rx-sample-delay:minItems: False schema does not allow 0
	hint: Scalar properties should not have array keywords
	from schema $id: http://devicetree.org/meta-schemas/keywords.yaml#

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20221128020613.14821-8-xiangsheng.hou@mediatek.com

This check can fail if there are any dependencies. The base for a patch
series is generally the most recent rc1.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command.
Xiangsheng Hou Nov. 29, 2022, 2:50 a.m. UTC | #3
Hi Krzysztof,

On Mon, 2022-11-28 at 10:04 +0100, Krzysztof Kozlowski wrote:
> On 28/11/2022 03:06, Xiangsheng Hou wrote:
> > add rx-sample-delay and rx-latch-latency property.
> 
> Start sentences with capital letter.
> 
> Here and in commit subject: property->properties
Will be fixed in next series.

> > 
> > --- a/Documentation/devicetree/bindings/spi/mediatek,spi-mtk-
> > snfi.yaml
> > +++ b/Documentation/devicetree/bindings/spi/mediatek,spi-mtk-
> > snfi.yaml
> > @@ -55,6 +55,22 @@ properties:
> >      description: device-tree node of the accompanying ECC engine.
> >      $ref: /schemas/types.yaml#/definitions/phandle
> >  
> > +  rx-sample-delay:
> 
> No, use existing property, don't invent your own stuff - missing unit
> suffix. See spi-peripheral-props.yaml.
Will change to other private property. The read sample delay with
MediaTek SPI NAND controller can be set with values from 0 to 47.
However, it`s difficult to say the unit of each vaule, because the unit
value will be difference with different chip process or different
corner IC.

> > +    description: Rx delay to sample data with this value, the
> > valid
> > +                 values are from 0 to 47. The delay is smaller
> > than
> > +                 the rx-latch-latency.
> > +    $ref: /schemas/types.yaml#/definitions/uint32
> 
> Drop $ref.
Will do.

> 
> > +    minItems: 0
> > +    maxItems: 47
> > +    default: 0
> > +
> > +  rx-latch-latency:
> 
> Same problems. Did you check spi-peripheral-props.yaml or other SPI
> controller schemas for such property?
> 
> > +    description: Rx delay to sample data with this value, the
> > value
> > +                 unit is clock cycle.
> 
> I think the unit should be rather time (e.g. us).
> 
Yes, I checked the spi-peripheral-props.yaml and the delay values are
described exactly unit with ns or us. However the unit of MediaTek read
latch latency is clock cycle and it`s difference with different clock
frequency.

> > +    $ref: /schemas/types.yaml#/definitions/uint32
> > +    enum: [0, 1, 2, 3]
> > +    default: 0
> > +
> >  required:
> >    - compatible
> >    - reg
> 
Best regards,
Xiangsheng Hou
Krzysztof Kozlowski Nov. 29, 2022, 7:47 a.m. UTC | #4
On 29/11/2022 03:50, Xiangsheng Hou (侯祥胜) wrote:

>>> --- a/Documentation/devicetree/bindings/spi/mediatek,spi-mtk-
>>> snfi.yaml
>>> +++ b/Documentation/devicetree/bindings/spi/mediatek,spi-mtk-
>>> snfi.yaml
>>> @@ -55,6 +55,22 @@ properties:
>>>      description: device-tree node of the accompanying ECC engine.
>>>      $ref: /schemas/types.yaml#/definitions/phandle
>>>  
>>> +  rx-sample-delay:
>>
>> No, use existing property, don't invent your own stuff - missing unit
>> suffix. See spi-peripheral-props.yaml.
> Will change to other private property. The read sample delay with
> MediaTek SPI NAND controller can be set with values from 0 to 47.
> However, it`s difficult to say the unit of each vaule, because the unit
> value will be difference with different chip process or different
> corner IC.

Why you cannot use same formula as other SPI drivers for sample-delay?
And divide/multiple by some factor specific to SoC, which is taken from
driver_data?

> 
>>> +    description: Rx delay to sample data with this value, the
>>> valid
>>> +                 values are from 0 to 47. The delay is smaller
>>> than
>>> +                 the rx-latch-latency.
>>> +    $ref: /schemas/types.yaml#/definitions/uint32
>>
>> Drop $ref.
> Will do.
> 
>>
>>> +    minItems: 0
>>> +    maxItems: 47
>>> +    default: 0
>>> +
>>> +  rx-latch-latency:
>>
>> Same problems. Did you check spi-peripheral-props.yaml or other SPI
>> controller schemas for such property?
>>
>>> +    description: Rx delay to sample data with this value, the
>>> value
>>> +                 unit is clock cycle.
>>
>> I think the unit should be rather time (e.g. us).
>>
> Yes, I checked the spi-peripheral-props.yaml and the delay values are
> described exactly unit with ns or us. However the unit of MediaTek read
> latch latency is clock cycle and it`s difference with different clock
> frequency.

This is fine in such case.

> 
>>> +    $ref: /schemas/types.yaml#/definitions/uint32
>>> +    enum: [0, 1, 2, 3]
>>> +    default: 0
>>> +

Best regards,
Krzysztof
Xiangsheng Hou Nov. 30, 2022, 8:18 a.m. UTC | #5
Hi Krzysztof,

On Tue, 2022-11-29 at 08:47 +0100, Krzysztof Kozlowski wrote:
> On 29/11/2022 03:50, Xiangsheng Hou (侯祥胜) wrote:
> 
> > > > --- a/Documentation/devicetree/bindings/spi/mediatek,spi-mtk-
> > > > snfi.yaml
> > > > +++ b/Documentation/devicetree/bindings/spi/mediatek,spi-mtk-
> > > > snfi.yaml
> > > > @@ -55,6 +55,22 @@ properties:
> > > >      description: device-tree node of the accompanying ECC
> > > > engine.
> > > >      $ref: /schemas/types.yaml#/definitions/phandle
> > > >  
> > > > +  rx-sample-delay:
> > > 
> > > No, use existing property, don't invent your own stuff - missing
> > > unit
> > > suffix. See spi-peripheral-props.yaml.
> > 
> > Will change to other private property. The read sample delay with
> > MediaTek SPI NAND controller can be set with values from 0 to 47.
> > However, it`s difficult to say the unit of each vaule, because the
> > unit
> > value will be difference with different chip process or different
> > corner IC.
> 
> Why you cannot use same formula as other SPI drivers for sample-
> delay?
> And divide/multiple by some factor specific to SoC, which is taken
> from
> driver_data?

Even for specific SoC, the unit of sample delay may be various with
different corner IC.
Besides, whether it`s acceptable by change the property rx-sample-delay 
and rx-latch-latency to mediatek,rx-sample-delay and mediatek,rx-latch-
latency?

Thanks
Xiangsheng Hou
Krzysztof Kozlowski Nov. 30, 2022, 8:35 a.m. UTC | #6
On 30/11/2022 09:18, Xiangsheng Hou (侯祥胜) wrote:
> Hi Krzysztof,
> 
> On Tue, 2022-11-29 at 08:47 +0100, Krzysztof Kozlowski wrote:
>> On 29/11/2022 03:50, Xiangsheng Hou (侯祥胜) wrote:
>>
>>>>> --- a/Documentation/devicetree/bindings/spi/mediatek,spi-mtk-
>>>>> snfi.yaml
>>>>> +++ b/Documentation/devicetree/bindings/spi/mediatek,spi-mtk-
>>>>> snfi.yaml
>>>>> @@ -55,6 +55,22 @@ properties:
>>>>>      description: device-tree node of the accompanying ECC
>>>>> engine.
>>>>>      $ref: /schemas/types.yaml#/definitions/phandle
>>>>>  
>>>>> +  rx-sample-delay:
>>>>
>>>> No, use existing property, don't invent your own stuff - missing
>>>> unit
>>>> suffix. See spi-peripheral-props.yaml.
>>>
>>> Will change to other private property. The read sample delay with
>>> MediaTek SPI NAND controller can be set with values from 0 to 47.
>>> However, it`s difficult to say the unit of each vaule, because the
>>> unit
>>> value will be difference with different chip process or different
>>> corner IC.
>>
>> Why you cannot use same formula as other SPI drivers for sample-
>> delay?
>> And divide/multiple by some factor specific to SoC, which is taken
>> from
>> driver_data?
> 
> Even for specific SoC, the unit of sample delay may be various with
> different corner IC.

Which is easy to achieve with driver_data as I said.

> Besides, whether it`s acceptable by change the property rx-sample-delay 
> and rx-latch-latency to mediatek,rx-sample-delay and mediatek,rx-latch-
> latency?

Not for sample delay, because you should use existing properties. Your
driver implementation is not usually argument to duplicate properties in
the bindings.

Best regards,
Krzysztof
Chuanhong Guo Nov. 30, 2022, 9:08 a.m. UTC | #7
Hi!

On Wed, Nov 30, 2022 at 4:35 PM Krzysztof Kozlowski
<krzysztof.kozlowski@linaro.org> wrote:
> >>> Will change to other private property. The read sample delay with
> >>> MediaTek SPI NAND controller can be set with values from 0 to 47.
> >>> However, it`s difficult to say the unit of each vaule, because the
> >>> unit
> >>> value will be difference with different chip process or different
> >>> corner IC.
> >>
> >> Why you cannot use same formula as other SPI drivers for sample-
> >> delay?
> >> And divide/multiple by some factor specific to SoC, which is taken
> >> from
> >> driver_data?
> >
> > Even for specific SoC, the unit of sample delay may be various with
> > different corner IC.
>
> Which is easy to achieve with driver_data as I said.

I think Xiangsheng means this:
This sample delay isn't achieved using a fixed clock signal. It's
probably some kind of delay circuit whose delay value varies
due to its manufacturing process. Every single chip made got
different delay units, so it's impossible to specify a single unit
for one chip model.

If that's true, shouldn't this be a value calibrated on-the-fly
on probe instead? A single device-tree is supposed to be
applied to all devices of the same model, so a value that
varies on a device-by-device basis probably shouldn't
be a device-tree property.
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/spi/mediatek,spi-mtk-snfi.yaml b/Documentation/devicetree/bindings/spi/mediatek,spi-mtk-snfi.yaml
index ee20075cd0e7..367862688e92 100644
--- a/Documentation/devicetree/bindings/spi/mediatek,spi-mtk-snfi.yaml
+++ b/Documentation/devicetree/bindings/spi/mediatek,spi-mtk-snfi.yaml
@@ -55,6 +55,22 @@  properties:
     description: device-tree node of the accompanying ECC engine.
     $ref: /schemas/types.yaml#/definitions/phandle
 
+  rx-sample-delay:
+    description: Rx delay to sample data with this value, the valid
+                 values are from 0 to 47. The delay is smaller than
+                 the rx-latch-latency.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    minItems: 0
+    maxItems: 47
+    default: 0
+
+  rx-latch-latency:
+    description: Rx delay to sample data with this value, the value
+                 unit is clock cycle.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [0, 1, 2, 3]
+    default: 0
+
 required:
   - compatible
   - reg