* [PATCH v2 2/4] phy: qcom-ufs: Correct usage of regulator_get()
2017-01-22 21:17 [PATCH v2 1/4] phy: qcom-ufs: Don't kfree devres resource Bjorn Andersson
@ 2017-01-22 21:17 ` Bjorn Andersson
2017-01-22 21:17 ` [PATCH v2 3/4] phy: qcom-ufs: Remove -always-on property Bjorn Andersson
2017-01-22 21:17 ` [PATCH v2 4/4] phy: qcom-ufs: Suppress extraneous logging Bjorn Andersson
2 siblings, 0 replies; 6+ messages in thread
From: Bjorn Andersson @ 2017-01-22 21:17 UTC (permalink / raw)
To: Kishon Vijay Abraham I; +Cc: linux-kernel, linux-arm-msm
When regulator_get() tries to resolve a regulator supply but fail to
find a matching property in DeviceTree it returns a dummy regulator, if
a matching supply is specified but unavailable the regulator core will
return an error.
Based on this we should not ignore errors upon failing to acquire the
optional "vddp-ref-clk" supply.
Reviewed-by: Vivek Gautam <vivek.gautam@codeaurora.org>
Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
---
Changes since v1:
- Picked up reviewd-bys from Vivek and Subhash
drivers/phy/phy-qcom-ufs.c | 21 +++++++--------------
1 file changed, 7 insertions(+), 14 deletions(-)
diff --git a/drivers/phy/phy-qcom-ufs.c b/drivers/phy/phy-qcom-ufs.c
index 4d7f3c018223..bbd317158084 100644
--- a/drivers/phy/phy-qcom-ufs.c
+++ b/drivers/phy/phy-qcom-ufs.c
@@ -210,8 +210,9 @@ int ufs_qcom_phy_init_clks(struct ufs_qcom_phy *phy_common)
}
EXPORT_SYMBOL_GPL(ufs_qcom_phy_init_clks);
-static int __ufs_qcom_phy_init_vreg(struct device *dev,
- struct ufs_qcom_phy_vreg *vreg, const char *name, bool optional)
+static int ufs_qcom_phy_init_vreg(struct device *dev,
+ struct ufs_qcom_phy_vreg *vreg,
+ const char *name)
{
int err = 0;
@@ -221,9 +222,7 @@ static int __ufs_qcom_phy_init_vreg(struct device *dev,
vreg->reg = devm_regulator_get(dev, name);
if (IS_ERR(vreg->reg)) {
err = PTR_ERR(vreg->reg);
- vreg->reg = NULL;
- if (!optional)
- dev_err(dev, "failed to get %s, %d\n", name, err);
+ dev_err(dev, "failed to get %s, %d\n", name, err);
goto out;
}
@@ -263,12 +262,6 @@ static int __ufs_qcom_phy_init_vreg(struct device *dev,
return err;
}
-static int ufs_qcom_phy_init_vreg(struct device *dev,
- struct ufs_qcom_phy_vreg *vreg, const char *name)
-{
- return __ufs_qcom_phy_init_vreg(dev, vreg, name, false);
-}
-
int ufs_qcom_phy_init_vregulators(struct ufs_qcom_phy *phy_common)
{
int err;
@@ -284,9 +277,9 @@ int ufs_qcom_phy_init_vregulators(struct ufs_qcom_phy *phy_common)
if (err)
goto out;
- /* vddp-ref-clk-* properties are optional */
- __ufs_qcom_phy_init_vreg(phy_common->dev, &phy_common->vddp_ref_clk,
- "vddp-ref-clk", true);
+ err = ufs_qcom_phy_init_vreg(phy_common->dev, &phy_common->vddp_ref_clk,
+ "vddp-ref-clk");
+
out:
return err;
}
--
2.11.0
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH v2 3/4] phy: qcom-ufs: Remove -always-on property
2017-01-22 21:17 [PATCH v2 1/4] phy: qcom-ufs: Don't kfree devres resource Bjorn Andersson
2017-01-22 21:17 ` [PATCH v2 2/4] phy: qcom-ufs: Correct usage of regulator_get() Bjorn Andersson
@ 2017-01-22 21:17 ` Bjorn Andersson
2017-01-22 21:17 ` [PATCH v2 4/4] phy: qcom-ufs: Suppress extraneous logging Bjorn Andersson
2 siblings, 0 replies; 6+ messages in thread
From: Bjorn Andersson @ 2017-01-22 21:17 UTC (permalink / raw)
To: Kishon Vijay Abraham I; +Cc: linux-kernel, linux-arm-msm, devicetree
The fact that a regulator is always-on is a property of the regulator,
not a specific consumer. Implementing this in the driver leads to a
system behaviour that is dependent on if the Qualcomm UFS PHY was ever
(partially) probed.
If the specific regulator should be always on in a particular device,
mark it so by specifying "regulator-always-on" in the regulator node.
Reviewed-by: Vivek Gautam <vivek.gautam@codeaurora.org>
Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
---
Changes since v1:
- Picked up reviewd-bys from Vivek and Subhash
Documentation/devicetree/bindings/ufs/ufs-qcom.txt | 1 -
drivers/phy/phy-qcom-ufs-i.h | 1 -
drivers/phy/phy-qcom-ufs.c | 5 +----
3 files changed, 1 insertion(+), 6 deletions(-)
diff --git a/Documentation/devicetree/bindings/ufs/ufs-qcom.txt b/Documentation/devicetree/bindings/ufs/ufs-qcom.txt
index b6b5130e5f65..1f69ee1a61ea 100644
--- a/Documentation/devicetree/bindings/ufs/ufs-qcom.txt
+++ b/Documentation/devicetree/bindings/ufs/ufs-qcom.txt
@@ -29,7 +29,6 @@ Optional properties:
- vdda-pll-max-microamp : specifies max. load that can be drawn from pll supply
- vddp-ref-clk-supply : phandle to UFS device ref_clk pad power supply
- vddp-ref-clk-max-microamp : specifies max. load that can be drawn from this supply
-- vddp-ref-clk-always-on : specifies if this supply needs to be kept always on
Example:
diff --git a/drivers/phy/phy-qcom-ufs-i.h b/drivers/phy/phy-qcom-ufs-i.h
index d505d98cf5f8..13b02b7de30b 100644
--- a/drivers/phy/phy-qcom-ufs-i.h
+++ b/drivers/phy/phy-qcom-ufs-i.h
@@ -77,7 +77,6 @@ struct ufs_qcom_phy_vreg {
int min_uV;
int max_uV;
bool enabled;
- bool is_always_on;
};
struct ufs_qcom_phy {
diff --git a/drivers/phy/phy-qcom-ufs.c b/drivers/phy/phy-qcom-ufs.c
index bbd317158084..c145fa6e824c 100644
--- a/drivers/phy/phy-qcom-ufs.c
+++ b/drivers/phy/phy-qcom-ufs.c
@@ -242,9 +242,6 @@ static int ufs_qcom_phy_init_vreg(struct device *dev,
}
err = 0;
}
- snprintf(prop_name, MAX_PROP_NAME, "%s-always-on", name);
- vreg->is_always_on = of_property_read_bool(dev->of_node,
- prop_name);
}
if (!strcmp(name, "vdda-pll")) {
@@ -402,7 +399,7 @@ static int ufs_qcom_phy_disable_vreg(struct device *dev,
{
int ret = 0;
- if (!vreg || !vreg->enabled || vreg->is_always_on)
+ if (!vreg || !vreg->enabled)
goto out;
ret = regulator_disable(vreg->reg);
--
2.11.0
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH v2 4/4] phy: qcom-ufs: Suppress extraneous logging
2017-01-22 21:17 [PATCH v2 1/4] phy: qcom-ufs: Don't kfree devres resource Bjorn Andersson
2017-01-22 21:17 ` [PATCH v2 2/4] phy: qcom-ufs: Correct usage of regulator_get() Bjorn Andersson
2017-01-22 21:17 ` [PATCH v2 3/4] phy: qcom-ufs: Remove -always-on property Bjorn Andersson
@ 2017-01-22 21:17 ` Bjorn Andersson
2017-01-26 15:26 ` Kishon Vijay Abraham I
2 siblings, 1 reply; 6+ messages in thread
From: Bjorn Andersson @ 2017-01-22 21:17 UTC (permalink / raw)
To: Kishon Vijay Abraham I; +Cc: linux-kernel, linux-arm-msm
The error paths of the common qcom-ufs functions for registering the
phy, acquiring clocks and acquiring regulators all print specific error
messages before returning an error, so there is no value in printing yet
another - more generic - message when this occur.
Reviewed-by: Vivek Gautam <vivek.gautam@codeaurora.org>
Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
---
Changes since v1:
- Picked up reviewed-bys from Vivek and Subhash
drivers/phy/phy-qcom-ufs-qmp-14nm.c | 15 +++------------
drivers/phy/phy-qcom-ufs-qmp-20nm.c | 12 ++----------
2 files changed, 5 insertions(+), 22 deletions(-)
diff --git a/drivers/phy/phy-qcom-ufs-qmp-14nm.c b/drivers/phy/phy-qcom-ufs-qmp-14nm.c
index c71c84734916..12a1b498dc4b 100644
--- a/drivers/phy/phy-qcom-ufs-qmp-14nm.c
+++ b/drivers/phy/phy-qcom-ufs-qmp-14nm.c
@@ -132,27 +132,18 @@ static int ufs_qcom_phy_qmp_14nm_probe(struct platform_device *pdev)
&ufs_qcom_phy_qmp_14nm_phy_ops, &phy_14nm_ops);
if (!generic_phy) {
- dev_err(dev, "%s: ufs_qcom_phy_generic_probe() failed\n",
- __func__);
err = -EIO;
goto out;
}
err = ufs_qcom_phy_init_clks(phy_common);
- if (err) {
- dev_err(phy_common->dev,
- "%s: ufs_qcom_phy_init_clks() failed %d\n",
- __func__, err);
+ if (err)
goto out;
- }
err = ufs_qcom_phy_init_vregulators(phy_common);
- if (err) {
- dev_err(phy_common->dev,
- "%s: ufs_qcom_phy_init_vregulators() failed %d\n",
- __func__, err);
+ if (err)
goto out;
- }
+
phy_common->vdda_phy.max_uV = UFS_PHY_VDDA_PHY_UV;
phy_common->vdda_phy.min_uV = UFS_PHY_VDDA_PHY_UV;
diff --git a/drivers/phy/phy-qcom-ufs-qmp-20nm.c b/drivers/phy/phy-qcom-ufs-qmp-20nm.c
index 1a26a64e06d3..4f68acb58b73 100644
--- a/drivers/phy/phy-qcom-ufs-qmp-20nm.c
+++ b/drivers/phy/phy-qcom-ufs-qmp-20nm.c
@@ -190,25 +190,17 @@ static int ufs_qcom_phy_qmp_20nm_probe(struct platform_device *pdev)
&ufs_qcom_phy_qmp_20nm_phy_ops, &phy_20nm_ops);
if (!generic_phy) {
- dev_err(dev, "%s: ufs_qcom_phy_generic_probe() failed\n",
- __func__);
err = -EIO;
goto out;
}
err = ufs_qcom_phy_init_clks(phy_common);
- if (err) {
- dev_err(phy_common->dev, "%s: ufs_qcom_phy_init_clks() failed %d\n",
- __func__, err);
+ if (err)
goto out;
- }
err = ufs_qcom_phy_init_vregulators(phy_common);
- if (err) {
- dev_err(phy_common->dev, "%s: ufs_qcom_phy_init_vregulators() failed %d\n",
- __func__, err);
+ if (err)
goto out;
- }
ufs_qcom_phy_qmp_20nm_advertise_quirks(phy_common);
--
2.11.0
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH v2 4/4] phy: qcom-ufs: Suppress extraneous logging
2017-01-22 21:17 ` [PATCH v2 4/4] phy: qcom-ufs: Suppress extraneous logging Bjorn Andersson
@ 2017-01-26 15:26 ` Kishon Vijay Abraham I
0 siblings, 0 replies; 6+ messages in thread
From: Kishon Vijay Abraham I @ 2017-01-26 15:26 UTC (permalink / raw)
To: Bjorn Andersson; +Cc: linux-kernel, linux-arm-msm
On Monday 23 January 2017 02:47 AM, Bjorn Andersson wrote:
> The error paths of the common qcom-ufs functions for registering the
> phy, acquiring clocks and acquiring regulators all print specific error
> messages before returning an error, so there is no value in printing yet
> another - more generic - message when this occur.
>
> Reviewed-by: Vivek Gautam <vivek.gautam@codeaurora.org>
> Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org>
> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
merged the series, thanks.
-Kishon
> ---
>
> Changes since v1:
> - Picked up reviewed-bys from Vivek and Subhash
>
> drivers/phy/phy-qcom-ufs-qmp-14nm.c | 15 +++------------
> drivers/phy/phy-qcom-ufs-qmp-20nm.c | 12 ++----------
> 2 files changed, 5 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/phy/phy-qcom-ufs-qmp-14nm.c b/drivers/phy/phy-qcom-ufs-qmp-14nm.c
> index c71c84734916..12a1b498dc4b 100644
> --- a/drivers/phy/phy-qcom-ufs-qmp-14nm.c
> +++ b/drivers/phy/phy-qcom-ufs-qmp-14nm.c
> @@ -132,27 +132,18 @@ static int ufs_qcom_phy_qmp_14nm_probe(struct platform_device *pdev)
> &ufs_qcom_phy_qmp_14nm_phy_ops, &phy_14nm_ops);
>
> if (!generic_phy) {
> - dev_err(dev, "%s: ufs_qcom_phy_generic_probe() failed\n",
> - __func__);
> err = -EIO;
> goto out;
> }
>
> err = ufs_qcom_phy_init_clks(phy_common);
> - if (err) {
> - dev_err(phy_common->dev,
> - "%s: ufs_qcom_phy_init_clks() failed %d\n",
> - __func__, err);
> + if (err)
> goto out;
> - }
>
> err = ufs_qcom_phy_init_vregulators(phy_common);
> - if (err) {
> - dev_err(phy_common->dev,
> - "%s: ufs_qcom_phy_init_vregulators() failed %d\n",
> - __func__, err);
> + if (err)
> goto out;
> - }
> +
> phy_common->vdda_phy.max_uV = UFS_PHY_VDDA_PHY_UV;
> phy_common->vdda_phy.min_uV = UFS_PHY_VDDA_PHY_UV;
>
> diff --git a/drivers/phy/phy-qcom-ufs-qmp-20nm.c b/drivers/phy/phy-qcom-ufs-qmp-20nm.c
> index 1a26a64e06d3..4f68acb58b73 100644
> --- a/drivers/phy/phy-qcom-ufs-qmp-20nm.c
> +++ b/drivers/phy/phy-qcom-ufs-qmp-20nm.c
> @@ -190,25 +190,17 @@ static int ufs_qcom_phy_qmp_20nm_probe(struct platform_device *pdev)
> &ufs_qcom_phy_qmp_20nm_phy_ops, &phy_20nm_ops);
>
> if (!generic_phy) {
> - dev_err(dev, "%s: ufs_qcom_phy_generic_probe() failed\n",
> - __func__);
> err = -EIO;
> goto out;
> }
>
> err = ufs_qcom_phy_init_clks(phy_common);
> - if (err) {
> - dev_err(phy_common->dev, "%s: ufs_qcom_phy_init_clks() failed %d\n",
> - __func__, err);
> + if (err)
> goto out;
> - }
>
> err = ufs_qcom_phy_init_vregulators(phy_common);
> - if (err) {
> - dev_err(phy_common->dev, "%s: ufs_qcom_phy_init_vregulators() failed %d\n",
> - __func__, err);
> + if (err)
> goto out;
> - }
>
> ufs_qcom_phy_qmp_20nm_advertise_quirks(phy_common);
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH v2 4/4] phy: qcom-ufs: Suppress extraneous logging
@ 2017-01-26 15:26 ` Kishon Vijay Abraham I
0 siblings, 0 replies; 6+ messages in thread
From: Kishon Vijay Abraham I @ 2017-01-26 15:26 UTC (permalink / raw)
To: Bjorn Andersson; +Cc: linux-kernel, linux-arm-msm
On Monday 23 January 2017 02:47 AM, Bjorn Andersson wrote:
> The error paths of the common qcom-ufs functions for registering the
> phy, acquiring clocks and acquiring regulators all print specific error
> messages before returning an error, so there is no value in printing yet
> another - more generic - message when this occur.
>
> Reviewed-by: Vivek Gautam <vivek.gautam@codeaurora.org>
> Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org>
> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
merged the series, thanks.
-Kishon
> ---
>
> Changes since v1:
> - Picked up reviewed-bys from Vivek and Subhash
>
> drivers/phy/phy-qcom-ufs-qmp-14nm.c | 15 +++------------
> drivers/phy/phy-qcom-ufs-qmp-20nm.c | 12 ++----------
> 2 files changed, 5 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/phy/phy-qcom-ufs-qmp-14nm.c b/drivers/phy/phy-qcom-ufs-qmp-14nm.c
> index c71c84734916..12a1b498dc4b 100644
> --- a/drivers/phy/phy-qcom-ufs-qmp-14nm.c
> +++ b/drivers/phy/phy-qcom-ufs-qmp-14nm.c
> @@ -132,27 +132,18 @@ static int ufs_qcom_phy_qmp_14nm_probe(struct platform_device *pdev)
> &ufs_qcom_phy_qmp_14nm_phy_ops, &phy_14nm_ops);
>
> if (!generic_phy) {
> - dev_err(dev, "%s: ufs_qcom_phy_generic_probe() failed\n",
> - __func__);
> err = -EIO;
> goto out;
> }
>
> err = ufs_qcom_phy_init_clks(phy_common);
> - if (err) {
> - dev_err(phy_common->dev,
> - "%s: ufs_qcom_phy_init_clks() failed %d\n",
> - __func__, err);
> + if (err)
> goto out;
> - }
>
> err = ufs_qcom_phy_init_vregulators(phy_common);
> - if (err) {
> - dev_err(phy_common->dev,
> - "%s: ufs_qcom_phy_init_vregulators() failed %d\n",
> - __func__, err);
> + if (err)
> goto out;
> - }
> +
> phy_common->vdda_phy.max_uV = UFS_PHY_VDDA_PHY_UV;
> phy_common->vdda_phy.min_uV = UFS_PHY_VDDA_PHY_UV;
>
> diff --git a/drivers/phy/phy-qcom-ufs-qmp-20nm.c b/drivers/phy/phy-qcom-ufs-qmp-20nm.c
> index 1a26a64e06d3..4f68acb58b73 100644
> --- a/drivers/phy/phy-qcom-ufs-qmp-20nm.c
> +++ b/drivers/phy/phy-qcom-ufs-qmp-20nm.c
> @@ -190,25 +190,17 @@ static int ufs_qcom_phy_qmp_20nm_probe(struct platform_device *pdev)
> &ufs_qcom_phy_qmp_20nm_phy_ops, &phy_20nm_ops);
>
> if (!generic_phy) {
> - dev_err(dev, "%s: ufs_qcom_phy_generic_probe() failed\n",
> - __func__);
> err = -EIO;
> goto out;
> }
>
> err = ufs_qcom_phy_init_clks(phy_common);
> - if (err) {
> - dev_err(phy_common->dev, "%s: ufs_qcom_phy_init_clks() failed %d\n",
> - __func__, err);
> + if (err)
> goto out;
> - }
>
> err = ufs_qcom_phy_init_vregulators(phy_common);
> - if (err) {
> - dev_err(phy_common->dev, "%s: ufs_qcom_phy_init_vregulators() failed %d\n",
> - __func__, err);
> + if (err)
> goto out;
> - }
>
> ufs_qcom_phy_qmp_20nm_advertise_quirks(phy_common);
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread