mbox series

[v12,0/3] Add QCOM SNPS PHY overriding params support

Message ID 1662201048-26049-1-git-send-email-quic_kriskura@quicinc.com
Headers show
Series Add QCOM SNPS PHY overriding params support | expand

Message

Krishna Kurapati Sept. 3, 2022, 10:30 a.m. UTC
Added support for overriding tuning parameters in QCOM SNPS PHY
from device tree. This parameter tuning is required to tune the
hs signal on dp/dm lines for electrical compliance to be successful.

Changes in v12:
Fixed nitpicks in driver code.

Changes in v11:
Made changes to logs added in phy driver.
Fixed nitpicks in code.

Changes in v10:
Fixed patch headers.

changes in v9:
Fixed nitpick in driver code.

changes in v8:
Fixed nitpick in driver code.

changes in v7:
Fixed nitpick in driver code and dtsi file.

changes in v6:
Fixed errors in dt-bindings.
Fixed nitpick in driver code.

changes in v5:
Fixed nitpicks in code.
Added minimum and maximum for each parameter added in dt-bindings.
Added proper suffixes to each parameter as per dtschema.

changes in v4:
Fixed nitpicks in code.
Initial compliance test results showed overshoot in the middle of eye
diagram. The current dt values were put in place to correct it and fix
overshoot issue.

changes in v3:
Added support for phy tuning parameters to be represented in bps and
corresponding register values to be written are obtained by traversing
through data map declared in the driver.

changes in v2:
Reading the individual fields in each overriding register from
device tree.

Krishna Kurapati (2):
  phy: qcom-snps: Add support for overriding phy tuning parameters
  arm64: dts: qcom: sc7280: Update SNPS Phy params for SC7280 IDP device

Sandeep Maheswaram (1):
  dt-bindings: phy: qcom,usb-snps-femto-v2: Add phy override params
    bindings

 .../bindings/phy/qcom,usb-snps-femto-v2.yaml       |  88 +++++++
 arch/arm64/boot/dts/qcom/sc7280-idp.dtsi           |   6 +
 drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c      | 252 ++++++++++++++++++++-
 3 files changed, 344 insertions(+), 2 deletions(-)

Comments

Bjorn Andersson Sept. 6, 2022, 2:45 a.m. UTC | #1
On Sat, Sep 03, 2022 at 04:00:47PM +0530, Krishna Kurapati wrote:
[..]
> +static void qcom_snps_hsphy_read_override_param_seq(struct device *dev)
> +{
> +	struct device_node *node = dev->of_node;
> +	s32 val;
> +	int ret, i;
> +	struct qcom_snps_hsphy *hsphy;
> +	const struct override_param_map *cfg = of_device_get_match_data(dev);

Given that you don't have any .data specified for the other compatibles
(which is fine), cfg would be NULL here and below loop would attempt to
access NULL[0].prop_name and crash.

Please add a check for !cfg and just return here.

With that I think the series looks good.

Regards,
Bjorn
Krishna Kurapati Sept. 6, 2022, 2:48 a.m. UTC | #2
On 9/6/2022 8:15 AM, Bjorn Andersson wrote:
> On Sat, Sep 03, 2022 at 04:00:47PM +0530, Krishna Kurapati wrote:
> [..]
>> +static void qcom_snps_hsphy_read_override_param_seq(struct device *dev)
>> +{
>> +	struct device_node *node = dev->of_node;
>> +	s32 val;
>> +	int ret, i;
>> +	struct qcom_snps_hsphy *hsphy;
>> +	const struct override_param_map *cfg = of_device_get_match_data(dev);
> 
> Given that you don't have any .data specified for the other compatibles
> (which is fine), cfg would be NULL here and below loop would attempt to
> access NULL[0].prop_name and crash.
> 
> Please add a check for !cfg and just return here.
> 
> With that I think the series looks good.
> 
> Regards,
> Bjorn
My bad. Missed this before. Thanks for pointing it out.
Will push updated changes.

Thanks,
Krishna,