* [PATCH 1/3] usb: chipidea: imx: change hsic power regulator as optional
@ 2019-10-11 5:42 Peter Chen
2019-10-11 5:42 ` [PATCH 2/3] usb: chipidea: imx: refine the error handling for hsic Peter Chen
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Peter Chen @ 2019-10-11 5:42 UTC (permalink / raw)
To: linux-usb; +Cc: dl-linux-imx, git, Peter Chen
Not every platform needs this regulator.
Signed-off-by: Peter Chen <peter.chen@nxp.com>
---
drivers/usb/chipidea/ci_hdrc_imx.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c
index 16700170bc34..25a38ed27aa8 100644
--- a/drivers/usb/chipidea/ci_hdrc_imx.c
+++ b/drivers/usb/chipidea/ci_hdrc_imx.c
@@ -359,7 +359,8 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
return PTR_ERR(data->pinctrl_hsic_active);
}
- data->hsic_pad_regulator = devm_regulator_get(dev, "hsic");
+ data->hsic_pad_regulator =
+ devm_regulator_get_optional(dev, "hsic");
if (PTR_ERR(data->hsic_pad_regulator) == -EPROBE_DEFER) {
return -EPROBE_DEFER;
} else if (PTR_ERR(data->hsic_pad_regulator) == -ENODEV) {
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/3] usb: chipidea: imx: refine the error handling for hsic
2019-10-11 5:42 [PATCH 1/3] usb: chipidea: imx: change hsic power regulator as optional Peter Chen
@ 2019-10-11 5:42 ` Peter Chen
2019-10-11 5:42 ` [PATCH 3/3] usb: chipidea: imx: pinctrl for HSIC is optional Peter Chen
2019-10-18 15:13 ` [PATCH 1/3] usb: chipidea: imx: change hsic power regulator as optional André Draszik
2 siblings, 0 replies; 4+ messages in thread
From: Peter Chen @ 2019-10-11 5:42 UTC (permalink / raw)
To: linux-usb; +Cc: dl-linux-imx, git, Peter Chen
- -EPROBE_DEFER is an error, but without need show error message
- If pintrol is not existed, as pintrol is NULL
Signed-off-by: Peter Chen <peter.chen@nxp.com>
---
drivers/usb/chipidea/ci_hdrc_imx.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c
index 25a38ed27aa8..c34fcc079cd4 100644
--- a/drivers/usb/chipidea/ci_hdrc_imx.c
+++ b/drivers/usb/chipidea/ci_hdrc_imx.c
@@ -330,8 +330,11 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
pdata.flags |= CI_HDRC_IMX_IS_HSIC;
data->usbmisc_data->hsic = 1;
data->pinctrl = devm_pinctrl_get(dev);
- if (IS_ERR(data->pinctrl)) {
- dev_err(dev, "pinctrl get failed, err=%ld\n",
+ if (PTR_ERR(data->pinctrl) == -ENODEV)
+ data->pinctrl = NULL;
+ else if (IS_ERR(data->pinctrl)) {
+ if (PTR_ERR(data->pinctrl) != -EPROBE_DEFER)
+ dev_err(dev, "pinctrl get failed, err=%ld\n",
PTR_ERR(data->pinctrl));
return PTR_ERR(data->pinctrl);
}
@@ -361,13 +364,13 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
data->hsic_pad_regulator =
devm_regulator_get_optional(dev, "hsic");
- if (PTR_ERR(data->hsic_pad_regulator) == -EPROBE_DEFER) {
- return -EPROBE_DEFER;
- } else if (PTR_ERR(data->hsic_pad_regulator) == -ENODEV) {
+ if (PTR_ERR(data->hsic_pad_regulator) == -ENODEV) {
/* no pad regualator is needed */
data->hsic_pad_regulator = NULL;
} else if (IS_ERR(data->hsic_pad_regulator)) {
- dev_err(dev, "Get HSIC pad regulator error: %ld\n",
+ if (PTR_ERR(data->hsic_pad_regulator) != -EPROBE_DEFER)
+ dev_err(dev,
+ "Get HSIC pad regulator error: %ld\n",
PTR_ERR(data->hsic_pad_regulator));
return PTR_ERR(data->hsic_pad_regulator);
}
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 3/3] usb: chipidea: imx: pinctrl for HSIC is optional
2019-10-11 5:42 [PATCH 1/3] usb: chipidea: imx: change hsic power regulator as optional Peter Chen
2019-10-11 5:42 ` [PATCH 2/3] usb: chipidea: imx: refine the error handling for hsic Peter Chen
@ 2019-10-11 5:42 ` Peter Chen
2019-10-18 15:13 ` [PATCH 1/3] usb: chipidea: imx: change hsic power regulator as optional André Draszik
2 siblings, 0 replies; 4+ messages in thread
From: Peter Chen @ 2019-10-11 5:42 UTC (permalink / raw)
To: linux-usb; +Cc: dl-linux-imx, git, Peter Chen
For imx chipidea controllers, if they use mxs PHY, they need pinctrl
for HSIC. Otherwise, it doesn't need pinctrl and usbmisc control. Like
imx7d and imx8mm.
Reported-by: AndréDraszik <git@andred.net>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
---
drivers/usb/chipidea/ci_hdrc_imx.c | 63 +++++++++++++++++-------------
1 file changed, 35 insertions(+), 28 deletions(-)
diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c
index c34fcc079cd4..d8e7eb2f97b9 100644
--- a/drivers/usb/chipidea/ci_hdrc_imx.c
+++ b/drivers/usb/chipidea/ci_hdrc_imx.c
@@ -274,11 +274,14 @@ static int ci_hdrc_imx_notify_event(struct ci_hdrc *ci, unsigned int event)
switch (event) {
case CI_HDRC_IMX_HSIC_ACTIVE_EVENT:
- ret = pinctrl_select_state(data->pinctrl,
- data->pinctrl_hsic_active);
- if (ret)
- dev_err(dev, "hsic_active select failed, err=%d\n",
- ret);
+ if (data->pinctrl) {
+ ret = pinctrl_select_state(data->pinctrl,
+ data->pinctrl_hsic_active);
+ if (ret)
+ dev_err(dev,
+ "hsic_active select failed, err=%d\n",
+ ret);
+ }
break;
case CI_HDRC_IMX_HSIC_SUSPEND_EVENT:
ret = imx_usbmisc_hsic_set_connect(data->usbmisc_data);
@@ -306,7 +309,6 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
const struct ci_hdrc_imx_platform_flag *imx_platform_flag;
struct device_node *np = pdev->dev.of_node;
struct device *dev = &pdev->dev;
- struct pinctrl_state *pinctrl_hsic_idle;
of_id = of_match_device(ci_hdrc_imx_dt_ids, dev);
if (!of_id)
@@ -339,6 +341,33 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
return PTR_ERR(data->pinctrl);
}
+ data->hsic_pad_regulator =
+ devm_regulator_get_optional(dev, "hsic");
+ if (PTR_ERR(data->hsic_pad_regulator) == -ENODEV) {
+ /* no pad regualator is needed */
+ data->hsic_pad_regulator = NULL;
+ } else if (IS_ERR(data->hsic_pad_regulator)) {
+ if (PTR_ERR(data->hsic_pad_regulator) != -EPROBE_DEFER)
+ dev_err(dev,
+ "Get HSIC pad regulator error: %ld\n",
+ PTR_ERR(data->hsic_pad_regulator));
+ return PTR_ERR(data->hsic_pad_regulator);
+ }
+
+ if (data->hsic_pad_regulator) {
+ ret = regulator_enable(data->hsic_pad_regulator);
+ if (ret) {
+ dev_err(dev,
+ "Failed to enable HSIC pad regulator\n");
+ return ret;
+ }
+ }
+ }
+
+ /* HSIC pinctrl handling */
+ if (data->pinctrl) {
+ struct pinctrl_state *pinctrl_hsic_idle;
+
pinctrl_hsic_idle = pinctrl_lookup_state(data->pinctrl, "idle");
if (IS_ERR(pinctrl_hsic_idle)) {
dev_err(dev,
@@ -361,28 +390,6 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
PTR_ERR(data->pinctrl_hsic_active));
return PTR_ERR(data->pinctrl_hsic_active);
}
-
- data->hsic_pad_regulator =
- devm_regulator_get_optional(dev, "hsic");
- if (PTR_ERR(data->hsic_pad_regulator) == -ENODEV) {
- /* no pad regualator is needed */
- data->hsic_pad_regulator = NULL;
- } else if (IS_ERR(data->hsic_pad_regulator)) {
- if (PTR_ERR(data->hsic_pad_regulator) != -EPROBE_DEFER)
- dev_err(dev,
- "Get HSIC pad regulator error: %ld\n",
- PTR_ERR(data->hsic_pad_regulator));
- return PTR_ERR(data->hsic_pad_regulator);
- }
-
- if (data->hsic_pad_regulator) {
- ret = regulator_enable(data->hsic_pad_regulator);
- if (ret) {
- dev_err(dev,
- "Failed to enable HSIC pad regulator\n");
- return ret;
- }
- }
}
if (pdata.flags & CI_HDRC_PMQOS)
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/3] usb: chipidea: imx: change hsic power regulator as optional
2019-10-11 5:42 [PATCH 1/3] usb: chipidea: imx: change hsic power regulator as optional Peter Chen
2019-10-11 5:42 ` [PATCH 2/3] usb: chipidea: imx: refine the error handling for hsic Peter Chen
2019-10-11 5:42 ` [PATCH 3/3] usb: chipidea: imx: pinctrl for HSIC is optional Peter Chen
@ 2019-10-18 15:13 ` André Draszik
2 siblings, 0 replies; 4+ messages in thread
From: André Draszik @ 2019-10-18 15:13 UTC (permalink / raw)
To: Peter Chen; +Cc: dl-linux-imx, linux-usb
Peter,
Thank you for this series, I was out so I will test it early next week
and report.
Cheers,
Andre'
On Fri, 2019-10-11 at 05:42 +0000, Peter Chen wrote:
> Not every platform needs this regulator.
>
> Signed-off-by: Peter Chen <peter.chen@nxp.com>
> ---
> drivers/usb/chipidea/ci_hdrc_imx.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c
> index 16700170bc34..25a38ed27aa8 100644
> --- a/drivers/usb/chipidea/ci_hdrc_imx.c
> +++ b/drivers/usb/chipidea/ci_hdrc_imx.c
> @@ -359,7 +359,8 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
> return PTR_ERR(data->pinctrl_hsic_active);
> }
>
> - data->hsic_pad_regulator = devm_regulator_get(dev, "hsic");
> + data->hsic_pad_regulator =
> + devm_regulator_get_optional(dev, "hsic");
> if (PTR_ERR(data->hsic_pad_regulator) == -EPROBE_DEFER) {
> return -EPROBE_DEFER;
> } else if (PTR_ERR(data->hsic_pad_regulator) == -ENODEV) {
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-10-18 15:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-11 5:42 [PATCH 1/3] usb: chipidea: imx: change hsic power regulator as optional Peter Chen
2019-10-11 5:42 ` [PATCH 2/3] usb: chipidea: imx: refine the error handling for hsic Peter Chen
2019-10-11 5:42 ` [PATCH 3/3] usb: chipidea: imx: pinctrl for HSIC is optional Peter Chen
2019-10-18 15:13 ` [PATCH 1/3] usb: chipidea: imx: change hsic power regulator as optional André Draszik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).