Message ID | 20230626092952.1115834-1-xu.yang_2@nxp.com |
---|---|
State | Superseded |
Headers | show |
Series | [1/3] usb: chipidea: imx: improve logic if samsung,picophy-* parameter is 0 | expand |
On 26/06/2023 11:29, Xu Yang wrote: > The samsung,picophy-rise-fall-time-adjust property can help to adjust the > rise/fall times of the high-speed transmitter waveform. The value can be > 0~3. > > Signed-off-by: Xu Yang <xu.yang_2@nxp.com> > --- > .../devicetree/bindings/usb/ci-hdrc-usb2.yaml | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.yaml b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.yaml > index 782402800d4a..d84c66c342ac 100644 > --- a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.yaml > +++ b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.yaml > @@ -292,6 +292,16 @@ properties: > minimum: 0x0 > maximum: 0xf > > + samsung,picophy-rise-fall-time-adjust: > + description: > + HS Transmitter Rise/Fall Time Adjustment. Adjust the rise/fall times Adjust with/by what? What are the units? > + of the high-speed transmitter waveform. The range is from 0x0 to 0x3, > + the default value is 0x1. Details can refer to TXRISETUNE0 bit of default: 1 Don't repeat constraints in free form text. > + USBNC_n_PHY_CFG1. > + $ref: /schemas/types.yaml#/definitions/uint32 > + minimum: 0x0 > + maximum: 0x3 Why "samsung" prefix? If this is specific to samsung, make it specific/narrowed like other properties. There are no Samsung compatibles here, so what is exactly here made by Samsung? Which device? Best regards, Krzysztof
On 27/06/2023 05:10, Xu Yang wrote: > Hi Krzysztof, > >> -----Original Message----- >> From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> >> Sent: Monday, June 26, 2023 11:45 PM >> To: Xu Yang <xu.yang_2@nxp.com>; peter.chen@kernel.org; robh+dt@kernel.org; krzysztof.kozlowski+dt@linaro.org; >> gregkh@linuxfoundation.org >> Cc: conor+dt@kernel.org; shawnguo@kernel.org; s.hauer@pengutronix.de; dl-linux-imx <linux-imx@nxp.com>; Peng Fan >> <peng.fan@nxp.com>; linux-usb@vger.kernel.org; devicetree@vger.kernel.org; Jun Li <jun.li@nxp.com> >> Subject: [EXT] Re: [PATCH 2/3] dt-bindings: usb: ci-hdrc-usb2: add samsung,picophy-rise-fall-time-adjust property >> >> Caution: This is an external email. Please take care when clicking links or opening attachments. When in doubt, report the >> message using the 'Report this email' button >> >> >> On 26/06/2023 11:29, Xu Yang wrote: >>> The samsung,picophy-rise-fall-time-adjust property can help to adjust the >>> rise/fall times of the high-speed transmitter waveform. The value can be >>> 0~3. >>> >>> Signed-off-by: Xu Yang <xu.yang_2@nxp.com> >>> --- >>> .../devicetree/bindings/usb/ci-hdrc-usb2.yaml | 10 ++++++++++ >>> 1 file changed, 10 insertions(+) >>> >>> diff --git a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.yaml b/Documentation/devicetree/bindings/usb/ci- >> hdrc-usb2.yaml >>> index 782402800d4a..d84c66c342ac 100644 >>> --- a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.yaml >>> +++ b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.yaml >>> @@ -292,6 +292,16 @@ properties: >>> minimum: 0x0 >>> maximum: 0xf >>> >>> + samsung,picophy-rise-fall-time-adjust: >>> + description: >>> + HS Transmitter Rise/Fall Time Adjustment. Adjust the rise/fall times >> >> Adjust with/by what? What are the units? > > This property is used to adjust the rise/fall time of the high-speed > transmitter waveform. It has no unit. According to the description of > USBNC_n_PHY_CFG1 register, the rise/fall time will be increased or > decreased by a certain percentage relative to design default time if > a value is given to this property. > > The actions as below: > - 0: -10% > - 1: design default > - 2: +15% > - 3: +20% Include it then in the description or even make the property -percent: https://github.com/devicetree-org/dt-schema/blob/main/dtschema/schemas/property-units.yaml Best regards, Krzysztof
diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c index 336ef6dd8e7d..873539f9a2c0 100644 --- a/drivers/usb/chipidea/ci_hdrc_imx.c +++ b/drivers/usb/chipidea/ci_hdrc_imx.c @@ -175,10 +175,12 @@ static struct imx_usbmisc_data *usbmisc_get_init_data(struct device *dev) if (of_usb_get_phy_mode(np) == USBPHY_INTERFACE_MODE_ULPI) data->ulpi = 1; - of_property_read_u32(np, "samsung,picophy-pre-emp-curr-control", - &data->emp_curr_control); - of_property_read_u32(np, "samsung,picophy-dc-vol-level-adjust", - &data->dc_vol_level_adjust); + if (of_property_read_u32(np, "samsung,picophy-pre-emp-curr-control", + &data->emp_curr_control)) + data->emp_curr_control = -1; + if (of_property_read_u32(np, "samsung,picophy-dc-vol-level-adjust", + &data->dc_vol_level_adjust)) + data->dc_vol_level_adjust = -1; return data; } diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c index 9ee9621e2ccc..1c7932f22218 100644 --- a/drivers/usb/chipidea/usbmisc_imx.c +++ b/drivers/usb/chipidea/usbmisc_imx.c @@ -659,13 +659,15 @@ static int usbmisc_imx7d_init(struct imx_usbmisc_data *data) usbmisc->base + MX7D_USBNC_USB_CTRL2); /* PHY tuning for signal quality */ reg = readl(usbmisc->base + MX7D_USB_OTG_PHY_CFG1); - if (data->emp_curr_control && data->emp_curr_control <= + if (data->emp_curr_control >= 0 && + data->emp_curr_control <= (TXPREEMPAMPTUNE0_MASK >> TXPREEMPAMPTUNE0_BIT)) { reg &= ~TXPREEMPAMPTUNE0_MASK; reg |= (data->emp_curr_control << TXPREEMPAMPTUNE0_BIT); } - if (data->dc_vol_level_adjust && data->dc_vol_level_adjust <= + if (data->dc_vol_level_adjust >= 0 && + data->dc_vol_level_adjust <= (TXVREFTUNE0_MASK >> TXVREFTUNE0_BIT)) { reg &= ~TXVREFTUNE0_MASK; reg |= (data->dc_vol_level_adjust << TXVREFTUNE0_BIT);
In current driver, the value of tuning parameter will not take effect if samsung,picophy-* is assigned as 0. Because 0 is also a valid value acccording to the description of USB_PHY_CFG1 register, this will improve the logic to let it work. Fixes: 58a3cefb3840 ("usb: chipidea: imx: add two samsung picophy parameters tuning implementation") cc: <stable@vger.kernel.org> Signed-off-by: Xu Yang <xu.yang_2@nxp.com> --- drivers/usb/chipidea/ci_hdrc_imx.c | 10 ++++++---- drivers/usb/chipidea/usbmisc_imx.c | 6 ++++-- 2 files changed, 10 insertions(+), 6 deletions(-)