Re: [PATCH v2 1/3] dt-bindings: phy: imx8mq-usb: improve some tuning properties

Frank Li
2025-04-29T14:13:19Z

On Tue, Apr 29, 2025 at 02:26:40PM +0800, Xu Yang wrote:
> Hi Frank,
>
> On Tue, Apr 29, 2025 at 01:55:26AM -0400, Frank Li wrote:
> > On Tue, Apr 29, 2025 at 11:30:07AM +0800, Xu Yang wrote:
> > > Commit b2e75563dc39 ("dt-bindings: phy: imx8mq-usb: add phy tuning
> > > properties") add many tuning properties, but some parameter value doesn't
> > > match the register description. It made some changes based on the original
> > > value: add offset to a negative number so turn it to a non-negative number.
> > > However, it's not easy to find an exact tuning value from register field
> > > with such conversion.
> > >
> > > Because device-tree supports negative parameter number, this will improve
> > > some propertie's parameter.
> > >
> > > Mainly include below properties:
> > > - fsl,phy-tx-vref-tune-percent
> > > - fsl,phy-tx-rise-tune-percent
> > > - fsl,phy-comp-dis-tune-percent
> >
> > It should be standard unit. for example 0% to 100%. DT don't prefer you
> > direct use register value.
>
> Yes. The dtschema and driver already use standard unit.
> This patch is going to correct the unintuitive expression.
>
> Take tx-rise-tune as example, register field as below:
>
> 00b - + 3%
> [21:20] 01b - 0 (default)
> TXRISETUNE 10b - - 1%
> 11b - - 3%
>
> The valid value of tx-rise-tune is [-3%, +3%]. However, the current dtschema
> add an offset which caused the valid value to [97%, 103%].
>

I think [97%, 103%] make sense. (Normal value) * (fsl,phy-tx-vref-tune-percent)

Your formual will be (Normal value) * (100% + fsl,phy-tx-vref-tune-percent)

DT scheme don't care register implement.

Frank

> fsl,phy-tx-rise-tune-percent:
> minimum: 97
> maximum: 103
>
> When I first added tuning property to DTS, I thought I was reading the wrong
> dtschema. Other users may meet such confuse too.
>
> Thanks,
> Xu Yang
>
> >
> > Frank
> >
> > >
> > > The parameter value of above 3 properties are USB PHY specific. i.MX8MP
> > > and i.MX95 USB PHY has different meanings. So this add restrictions for
> > > them.
> > >
> > > - fsl,phy-tx-vboost-level-microvolt
> > >
> > > For this property, the parameter value is wrong in register description.
> > > This will correct it according to true value.
> > >
> > > For detailed info, please refer to i.MX8MP and i.MX95 latest reference
> > > manual.
> > >
> > > Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
> > >
> > > ---
> > > Changes in v2:
> > > - keep widest constraints
> > > - use multipleOf for some properties
> > > ---
> > > .../bindings/phy/fsl,imx8mq-usb-phy.yaml | 60 +++++++++++++++----
> > > 1 file changed, 49 insertions(+), 11 deletions(-)
> > >
> > > diff --git a/Documentation/devicetree/bindings/phy/fsl,imx8mq-usb-phy.yaml b/Documentation/devicetree/bindings/phy/fsl,imx8mq-usb-phy.yaml
> > > index daee0c0fc915..71e5940ef4b8 100644
> > > --- a/Documentation/devicetree/bindings/phy/fsl,imx8mq-usb-phy.yaml
> > > +++ b/Documentation/devicetree/bindings/phy/fsl,imx8mq-usb-phy.yaml
> > > @@ -42,16 +42,17 @@ properties:
> > >
> > > fsl,phy-tx-vref-tune-percent:
> > > description:
> > > - Tunes the HS DC level relative to the nominal level
> > > - minimum: 94
> > > - maximum: 124
> > > + Tunes the HS DC level relative to the nominal level. It varies
> > > + between different PHY versions
> > > + minimum: -1000
> > > + maximum: 875
> > >
> > > fsl,phy-tx-rise-tune-percent:
> > > description:
> > > Adjusts the rise/fall time duration of the HS waveform relative to
> > > - its nominal value
> > > - minimum: 97
> > > - maximum: 103
> > > + its nominal value. It varies between different PHY versions
> > > + minimum: -10
> > > + maximum: 20
> > >
> > > fsl,phy-tx-preemp-amp-tune-microamp:
> > > description:
> > > @@ -63,15 +64,14 @@ properties:
> > > fsl,phy-tx-vboost-level-microvolt:
> > > description:
> > > Adjust the boosted transmit launch pk-pk differential amplitude
> > > - minimum: 880
> > > - maximum: 1120
> > > + enum: [844, 1008, 1156]
> > >
> > > fsl,phy-comp-dis-tune-percent:
> > > description:
> > > Adjust the voltage level used to detect a disconnect event at the host
> > > - relative to the nominal value
> > > - minimum: 91
> > > - maximum: 115
> > > + relative to the nominal value. It varies between different PHY versions
> > > + minimum: -60
> > > + maximum: 45
> > >
> > > fsl,phy-pcs-tx-deemph-3p5db-attenuation-db:
> > > description:
> > > @@ -112,6 +112,44 @@ allOf:
> > > reg:
> > > maxItems: 1
> > >
> > > + - if:
> > > + properties:
> > > + compatible:
> > > + enum:
> > > + - fsl,imx8mq-usb-phy
> > > + - fsl,imx8mp-usb-phy
> > > + then:
> > > + properties:
> > > + fsl,phy-tx-vref-tune-percent:
> > > + minimum: -6
> > > + maximum: 24
> > > + multipleOf: 2
> > > + fsl,phy-tx-rise-tune-percent:
> > > + enum: [-3, -1, 0, 3]
> > > + fsl,phy-comp-dis-tune-percent:
> > > + enum: [-9, -6, -3, 0, 4, 7, 11, 15]
> > > +
> > > + - if:
> > > + properties:
> > > + compatible:
> > > + contains:
> > > + enum:
> > > + - fsl,imx95-usb-phy
> > > + then:
> > > + properties:
> > > + fsl,phy-tx-vref-tune-percent:
> > > + description: 100x the original
> > > + minimum: -1000
> > > + maximum: 875
> > > + multipleOf: 125
> > > + fsl,phy-tx-rise-tune-percent:
> > > + enum: [-10, 0, 15, 20]
> > > + fsl,phy-comp-dis-tune-percent:
> > > + description: 10x the original
> > > + minimum: -60
> > > + maximum: 45
> > > + multipleOf: 15
> > > +
> > > - if:
> > > required:
> > > - orientation-switch
> > > --
> > > 2.34.1
> > >