Re: [PATCH 03/19] phy: qualcomm: Add Synopsys Hi-Speed USB PHY driver

From: Philipp Zabel
Date: Wed Jan 15 2020 - 10:08:47 EST


Hi Bryan,

On Wed, 2020-01-15 at 14:13 +0000, Bryan O'Donoghue wrote:
> From: Shawn Guo <shawn.guo@xxxxxxxxxx>
>
> Adds Qualcomm QCS404 Hi-Speed USB PHY driver support. This PHY is usually
> is usually paired with Synopsys DWC3 USB controllers on Qualcomm SoCs.
>
> [bod: Updated qcom_snps_hsphy_set_mode to match new method signature
> Added disjunct on mode > 0
> Removed regulator_set_voltage() in favour of setting floor in dts
> Removed 'snps' and '28nm' from driver name]
>
> Signed-off-by: Shawn Guo <shawn.guo@xxxxxxxxxx>
> Cc: Andy Gross <agross@xxxxxxxxxx>
> Cc: Bjorn Andersson <bjorn.andersson@xxxxxxxxxx>
> Cc: Kishon Vijay Abraham I <kishon@xxxxxx>
> Cc: Philipp Zabel <p.zabel@xxxxxxxxxxxxxx>
> Cc: Jorge Ramirez-Ortiz <jorge.ramirez.ortiz@xxxxxxxxx>
> Cc: linux-arm-msm@xxxxxxxxxxxxxxx
> Cc: linux-kernel@xxxxxxxxxxxxxxx
> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@xxxxxxxxxx>
> ---
> drivers/phy/qualcomm/Kconfig | 10 +
> drivers/phy/qualcomm/Makefile | 1 +
> drivers/phy/qualcomm/phy-qcom-qcs404-usb-hs.c | 415 ++++++++++++++++++
> 3 files changed, 426 insertions(+)
> create mode 100644 drivers/phy/qualcomm/phy-qcom-qcs404-usb-hs.c
>
[...]
> diff --git a/drivers/phy/qualcomm/phy-qcom-qcs404-usb-hs.c b/drivers/phy/qualcomm/phy-qcom-qcs404-usb-hs.c
> new file mode 100644
> index 000000000000..c09b786592b1
> --- /dev/null
> +++ b/drivers/phy/qualcomm/phy-qcom-qcs404-usb-hs.c
> @@ -0,0 +1,415 @@
[...]
> +static int qcom_snps_hsphy_probe(struct platform_device *pdev)
> +{
> + struct device *dev = &pdev->dev;
> + struct phy_provider *provider;
> + struct hsphy_priv *priv;
> + struct phy *phy;
> + int ret;
> + int i;
> +
> + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
> + if (!priv)
> + return -ENOMEM;
> +
> + priv->base = devm_platform_ioremap_resource(pdev, 0);
> + if (IS_ERR(priv->base))
> + return PTR_ERR(priv->base);
> +
> + priv->num_clks = ARRAY_SIZE(qcom_snps_hsphy_clks);
> + priv->clks = devm_kcalloc(dev, priv->num_clks, sizeof(*priv->clks),
> + GFP_KERNEL);
> + if (!priv->clks)
> + return -ENOMEM;
> +
> + for (i = 0; i < priv->num_clks; i++)
> + priv->clks[i].id = qcom_snps_hsphy_clks[i];
> +
> + ret = devm_clk_bulk_get(dev, priv->num_clks, priv->clks);
> + if (ret)
> + return ret;
> +
> + priv->phy_reset = devm_reset_control_get(dev, "phy");

Please use devm_reset_control_get_exclusive(). I'd like drivers to
explicitly state whether they request exclusive or shared control.

> + if (IS_ERR(priv->phy_reset))
> + return PTR_ERR(priv->phy_reset);
> +
> + priv->por_reset = devm_reset_control_get(dev, "por");

Same here.

regards
Philipp