All of lore.kernel.org
 help / color / mirror / Atom feed
* [v2] USB: chipidea: Do not hang when CONFIG_USB_CHIPIDEA_ULPI is not selected
@ 2018-07-03 12:38 Shawn Guo
  0 siblings, 0 replies; 15+ messages in thread
From: Shawn Guo @ 2018-07-03 12:38 UTC (permalink / raw)
  To: Fabio Estevam
  Cc: Peter Chen, USB list, Andrey Smirnov, Lucas Stach,
	Sebastian Reichel, NXP Linux Team, Sascha Hauer, Fabio Estevam

On Tue, Jul 03, 2018 at 07:52:07AM -0300, Fabio Estevam wrote:
> Hi Shawn,
> 
> On Tue, Jul 3, 2018 at 12:40 AM, Shawn Guo <shawnguo@kernel.org> wrote:
> 
> > We can have the options in defconfig, but they can still be turned off
> > for whatever reason and we get the hang.  Really, missing a user
> > selectable option in defconfig shouldn't result in a system hang.
> 
> Yes, 100% agree and this is exactly what this USB patch is all about :-)
> 
> The whole point of this USB patch is not to let the the system to hang
> when the defconfig options are turned off.
> 
> It will warn the user that CONFIG_USB_CHIPIDEA_ULPI needs to be
> selected, will propagate an error, but at least the system will not
> hang.
> 
> The user will certainly notice the big warning which says "Select
> CONFIG_USB_CHIPIDEA_ULPI in order to use ULPI mode"
> 
> Please check the original patch of this thread:
> https://patchwork.kernel.org/patch/10486371/

I'm still not convinced this is the best way to go.  But that's USB
maintainer's call.  I will just apply defconfig patches which shouldn't
hurt anyway.

Shawn
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [v2] USB: chipidea: Do not hang when CONFIG_USB_CHIPIDEA_ULPI is not selected
@ 2018-07-04 13:11 Fabio Estevam
  0 siblings, 0 replies; 15+ messages in thread
From: Fabio Estevam @ 2018-07-04 13:11 UTC (permalink / raw)
  To: Peter Chen
  Cc: Shawn Guo, USB list, Andrey Smirnov, Lucas Stach,
	Sebastian Reichel, dl-linux-imx, Sascha Hauer, Fabio Estevam

Hi Peter,

On Wed, Jul 4, 2018 at 5:24 AM, Peter Chen <peter.chen@nxp.com> wrote:

> It seems there is no harm if we always include drivers/usb/chipidea/ulpi.c except increasing
> a little code size, how about always build ulpi.c for the whole chipidea at Makefile, delete
> CONFIG_USB_CHIPIDEA_ULPI as well, meanwhile, we need to select USB_ULPI_BUS
> at Kconfig?
>
> Besides, at function ci_ulpi_resume for ulpi.c, we need to add condition to quit for non-ulpi interface.

Yes, I sent a v2 letting ulpi.c to be always built-in.
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [v2] USB: chipidea: Do not hang when CONFIG_USB_CHIPIDEA_ULPI is not selected
@ 2018-07-04  8:24 Peter Chen
  0 siblings, 0 replies; 15+ messages in thread
From: Peter Chen @ 2018-07-04  8:24 UTC (permalink / raw)
  To: Fabio Estevam, Shawn Guo
  Cc: USB list, Andrey Smirnov, Lucas Stach, Sebastian Reichel,
	dl-linux-imx, Sascha Hauer, Fabio Estevam

> On Tue, Jul 3, 2018 at 12:40 AM, Shawn Guo <shawnguo@kernel.org> wrote:
> 
> > We can have the options in defconfig, but they can still be turned off
> > for whatever reason and we get the hang.  Really, missing a user
> > selectable option in defconfig shouldn't result in a system hang.
> 
> Yes, 100% agree and this is exactly what this USB patch is all about :-)
> 
> The whole point of this USB patch is not to let the the system to hang when the
> defconfig options are turned off.
> 
> It will warn the user that CONFIG_USB_CHIPIDEA_ULPI needs to be selected, will
> propagate an error, but at least the system will not hang.
> 
> The user will certainly notice the big warning which says "Select
> CONFIG_USB_CHIPIDEA_ULPI in order to use ULPI mode"
> 
 


Hi Fabio, Shawn's suggestion seems reasonable.

It seems there is no harm if we always include drivers/usb/chipidea/ulpi.c except increasing
a little code size, how about always build ulpi.c for the whole chipidea at Makefile, delete
CONFIG_USB_CHIPIDEA_ULPI as well, meanwhile, we need to select USB_ULPI_BUS
at Kconfig?

Besides, at function ci_ulpi_resume for ulpi.c, we need to add condition to quit for non-ulpi interface.

Peter

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [v2] USB: chipidea: Do not hang when CONFIG_USB_CHIPIDEA_ULPI is not selected
@ 2018-07-03 10:52 Fabio Estevam
  0 siblings, 0 replies; 15+ messages in thread
From: Fabio Estevam @ 2018-07-03 10:52 UTC (permalink / raw)
  To: Shawn Guo
  Cc: Peter Chen, USB list, Andrey Smirnov, Lucas Stach,
	Sebastian Reichel, NXP Linux Team, Sascha Hauer, Fabio Estevam

Hi Shawn,

On Tue, Jul 3, 2018 at 12:40 AM, Shawn Guo <shawnguo@kernel.org> wrote:

> We can have the options in defconfig, but they can still be turned off
> for whatever reason and we get the hang.  Really, missing a user
> selectable option in defconfig shouldn't result in a system hang.

Yes, 100% agree and this is exactly what this USB patch is all about :-)

The whole point of this USB patch is not to let the the system to hang
when the defconfig options are turned off.

It will warn the user that CONFIG_USB_CHIPIDEA_ULPI needs to be
selected, will propagate an error, but at least the system will not
hang.

The user will certainly notice the big warning which says "Select
CONFIG_USB_CHIPIDEA_ULPI in order to use ULPI mode"

Please check the original patch of this thread:
https://patchwork.kernel.org/patch/10486371/
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [v2] USB: chipidea: Do not hang when CONFIG_USB_CHIPIDEA_ULPI is not selected
@ 2018-07-03  3:40 Shawn Guo
  0 siblings, 0 replies; 15+ messages in thread
From: Shawn Guo @ 2018-07-03  3:40 UTC (permalink / raw)
  To: Fabio Estevam
  Cc: Peter Chen, USB list, Andrey Smirnov, Lucas Stach,
	Sebastian Reichel, NXP Linux Team, Sascha Hauer, Fabio Estevam

On Mon, Jul 02, 2018 at 11:22:55PM -0300, Fabio Estevam wrote:
> Hi Shawn,
> 
> On Mon, Jul 2, 2018 at 11:06 PM, Shawn Guo <shawnguo@kernel.org> wrote:
> 
> > A second thought on this - shouldn't such dependency be solved by
> > Kconfig select clause?
> 
> I suspect we are not able to fix it via Kconfig as we really don't
> know if a system uses ULPI interface or not via Kconfig perspective.
> 
> If we always select the chipidea ULPI driver, then it will be dead
> code for boards that do not use ULPI.
> 
> Currently there are some defconfigs that explicitly select the
> chipidea ulpi driver:
> 
> arch/arm/configs/qcom_defconfig:CONFIG_USB_CHIPIDEA_ULPI=y
> arch/arm64/configs/defconfig:CONFIG_USB_CHIPIDEA_ULPI=y
> 
> I would be interested to get feedback whether it would be possible to
> fix it on a different way.

We can have the options in defconfig, but they can still be turned off
for whatever reason and we get the hang.  Really, missing a user
selectable option in defconfig shouldn't result in a system hang. 

Shawn
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [v2] USB: chipidea: Do not hang when CONFIG_USB_CHIPIDEA_ULPI is not selected
@ 2018-07-03  2:22 Fabio Estevam
  0 siblings, 0 replies; 15+ messages in thread
From: Fabio Estevam @ 2018-07-03  2:22 UTC (permalink / raw)
  To: Shawn Guo
  Cc: Peter Chen, USB list, Andrey Smirnov, Lucas Stach,
	Sebastian Reichel, NXP Linux Team, Sascha Hauer, Fabio Estevam

Hi Shawn,

On Mon, Jul 2, 2018 at 11:06 PM, Shawn Guo <shawnguo@kernel.org> wrote:

> A second thought on this - shouldn't such dependency be solved by
> Kconfig select clause?

I suspect we are not able to fix it via Kconfig as we really don't
know if a system uses ULPI interface or not via Kconfig perspective.

If we always select the chipidea ULPI driver, then it will be dead
code for boards that do not use ULPI.

Currently there are some defconfigs that explicitly select the
chipidea ulpi driver:

arch/arm/configs/qcom_defconfig:CONFIG_USB_CHIPIDEA_ULPI=y
arch/arm64/configs/defconfig:CONFIG_USB_CHIPIDEA_ULPI=y

I would be interested to get feedback whether it would be possible to
fix it on a different way.

Thanks
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [v2] USB: chipidea: Do not hang when CONFIG_USB_CHIPIDEA_ULPI is not selected
@ 2018-07-03  2:06 Shawn Guo
  0 siblings, 0 replies; 15+ messages in thread
From: Shawn Guo @ 2018-07-03  2:06 UTC (permalink / raw)
  To: Fabio Estevam
  Cc: Peter.Chen, linux-usb, andrew.smirnov, l.stach,
	sebastian.reichel, linux-imx, kernel, Fabio Estevam

On Mon, Jun 25, 2018 at 11:25:12AM -0300, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@nxp.com>
> 
> Since commit 03e6275ae381087bd8 ("usb: chipidea: Fix ULPI on imx51") the
> kernel hangs on a imx51-babbage board, when using the ULPI interface with
> the CONFIG_USB_CHIPIDEA_ULPI option unselected.
> 
> Instead of hanging the kernel, let's warn the user that
> CONFIG_USB_CHIPIDEA_ULPI needs to be selected, propagate an error
> and continue with booting the kernel.
> 
> The user can then react to the warning and select
> CONFIG_USB_CHIPIDEA_ULPI as needed.

A second thought on this - shouldn't such dependency be solved by
Kconfig select clause?

Shawn

> 
> Fixes: 03e6275ae381087bd8 ("usb: chipidea: Fix ULPI on imx51")
> Suggested-by: Lucas Stach <l.stach@pengutronix.de>
> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
> ---
> Changes since v1:
> - Only propagate the error when CONFIG_USB_CHIPIDEA_ULPI is unselected
> 
>  drivers/usb/chipidea/core.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
> index 85fc6db..e7018a1 100644
> --- a/drivers/usb/chipidea/core.c
> +++ b/drivers/usb/chipidea/core.c
> @@ -608,6 +608,17 @@ static int ci_get_platdata(struct device *dev,
>  	if (!platdata->phy_mode)
>  		platdata->phy_mode = of_usb_get_phy_mode(dev->of_node);
>  
> +	if (platdata->phy_mode == USBPHY_INTERFACE_MODE_ULPI) {
> +		/*
> +		 * CONFIG_USB_CHIPIDEA_ULPI needs to be selected
> +		 * for proper usage of the ULPI mode
> +		 */
> +		if (!IS_ENABLED(CONFIG_USB_CHIPIDEA_ULPI)) {
> +			WARN_ONCE(1, "Select CONFIG_USB_CHIPIDEA_ULPI in order to use ULPI mode\n");
> +			return -EINVAL;
> +		}
> +	}
> +
>  	if (!platdata->dr_mode)
>  		platdata->dr_mode = usb_get_dr_mode(dev);
>  
> -- 
> 2.7.4
>
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [v2] USB: chipidea: Do not hang when CONFIG_USB_CHIPIDEA_ULPI is not selected
@ 2018-07-03  2:00 Fabio Estevam
  0 siblings, 0 replies; 15+ messages in thread
From: Fabio Estevam @ 2018-07-03  2:00 UTC (permalink / raw)
  To: Shawn Guo
  Cc: Peter Chen, Andrey Smirnov, linux-usb, Lucas Stach,
	Sebastian Reichel, dl-linux-imx, Sascha Hauer, Fabio Estevam

On Mon, Jul 2, 2018 at 10:48 PM, Shawn Guo <shawnguo@kernel.org> wrote:

> I will make sure both defconfig patches go into 4.18-rc.

Thanks, Shawn!

Peter,

Could you please then queue this chipidea patch for 4.18-rc?

Thanks
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [v2] USB: chipidea: Do not hang when CONFIG_USB_CHIPIDEA_ULPI is not selected
@ 2018-07-03  1:48 Shawn Guo
  0 siblings, 0 replies; 15+ messages in thread
From: Shawn Guo @ 2018-07-03  1:48 UTC (permalink / raw)
  To: Fabio Estevam
  Cc: Peter Chen, Andrey Smirnov, linux-usb, Lucas Stach,
	Sebastian Reichel, dl-linux-imx, Sascha Hauer, Fabio Estevam

On Mon, Jul 02, 2018 at 08:52:34AM -0300, Fabio Estevam wrote:
> Hi Peter,
> 
> On Mon, Jul 2, 2018 at 12:08 AM, Peter Chen <peter.chen@nxp.com> wrote:
> 
> > Fabio, since this function has dependency with defconfig, is the defconfig change a fix for v4.18-rc
> > or for v4.19-rc1?
> 
> I have sent the defconfig changes for imx_v6_v7_defconfig and
> imx_v4_v5_defconfig and hope that they could be applied for 4.18-rc.

I will make sure both defconfig patches go into 4.18-rc.

Shawn
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [v2] USB: chipidea: Do not hang when CONFIG_USB_CHIPIDEA_ULPI is not selected
@ 2018-07-02 11:52 Fabio Estevam
  0 siblings, 0 replies; 15+ messages in thread
From: Fabio Estevam @ 2018-07-02 11:52 UTC (permalink / raw)
  To: Peter Chen
  Cc: Andrey Smirnov, linux-usb, Lucas Stach, Sebastian Reichel,
	Shawn Guo, dl-linux-imx, Sascha Hauer, Fabio Estevam

Hi Peter,

On Mon, Jul 2, 2018 at 12:08 AM, Peter Chen <peter.chen@nxp.com> wrote:

> Fabio, since this function has dependency with defconfig, is the defconfig change a fix for v4.18-rc
> or for v4.19-rc1?

I have sent the defconfig changes for imx_v6_v7_defconfig and
imx_v4_v5_defconfig and hope that they could be applied for 4.18-rc.

Maybe they could go to the same tree?
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [v2] USB: chipidea: Do not hang when CONFIG_USB_CHIPIDEA_ULPI is not selected
@ 2018-07-02  3:08 Peter Chen
  0 siblings, 0 replies; 15+ messages in thread
From: Peter Chen @ 2018-07-02  3:08 UTC (permalink / raw)
  To: Andrey Smirnov,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dGRhdGEtPnBoeV9tb2RlID09IFVTQlBIWV9J
TlRFUkZBQ0VfTU9ERV9VTFBJKSB7DQo+ID4gKyAgICAgICAgICAgICAgIC8qDQo+ID4gKyAgICAg
ICAgICAgICAgICAqIENPTkZJR19VU0JfQ0hJUElERUFfVUxQSSBuZWVkcyB0byBiZSBzZWxlY3Rl
ZA0KPiA+ICsgICAgICAgICAgICAgICAgKiBmb3IgcHJvcGVyIHVzYWdlIG9mIHRoZSBVTFBJIG1v
ZGUNCj4gPiArICAgICAgICAgICAgICAgICovDQo+ID4gKyAgICAgICAgICAgICAgIGlmICghSVNf
RU5BQkxFRChDT05GSUdfVVNCX0NISVBJREVBX1VMUEkpKSB7DQo+ID4gKyAgICAgICAgICAgICAg
ICAgICAgICAgV0FSTl9PTkNFKDEsICJTZWxlY3QgQ09ORklHX1VTQl9DSElQSURFQV9VTFBJIGlu
IG9yZGVyDQo+IHRvIHVzZSBVTFBJIG1vZGVcbiIpOw0KPiA+ICsgICAgICAgICAgICAgICAgICAg
ICAgIHJldHVybiAtRUlOVkFMOw0KPiA+ICsgICAgICAgICAgICAgICB9DQo+ID4gKyAgICAgICB9
DQo+ID4gKw0KPiA+ICAgICAgICAgaWYgKCFwbGF0ZGF0YS0+ZHJfbW9kZSkNCj4gPiAgICAgICAg
ICAgICAgICAgcGxhdGRhdGEtPmRyX21vZGUgPSB1c2JfZ2V0X2RyX21vZGUoZGV2KTsNCj4gPg0K
DQpGYWJpbywgc2luY2UgdGhpcyBmdW5jdGlvbiBoYXMgZGVwZW5kZW5jeSB3aXRoIGRlZmNvbmZp
ZywgaXMgdGhlIGRlZmNvbmZpZyBjaGFuZ2UgYSBmaXggZm9yIHY0LjE4LXJjDQpvciBmb3IgdjQu
MTktcmMxPw0KDQpQZXRlcg0K
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [v2] USB: chipidea: Do not hang when CONFIG_USB_CHIPIDEA_ULPI is not selected
@ 2018-06-27  4:10 Andrey Smirnov
  0 siblings, 0 replies; 15+ messages in thread
From: Andrey Smirnov @ 2018-06-27  4:10 UTC (permalink / raw)
  To: Fabio Estevam
  Cc: Peter Chen, linux-usb, Lucas Stach, Sebastian Reichel, Shawn Guo,
	linux-imx, Sascha Hauer, Fabio Estevam

On Mon, Jun 25, 2018 at 7:24 AM Fabio Estevam <festevam@gmail.com> wrote:
>
> From: Fabio Estevam <fabio.estevam@nxp.com>
>
> Since commit 03e6275ae381087bd8 ("usb: chipidea: Fix ULPI on imx51") the
> kernel hangs on a imx51-babbage board, when using the ULPI interface with
> the CONFIG_USB_CHIPIDEA_ULPI option unselected.
>
> Instead of hanging the kernel, let's warn the user that
> CONFIG_USB_CHIPIDEA_ULPI needs to be selected, propagate an error
> and continue with booting the kernel.
>
> The user can then react to the warning and select
> CONFIG_USB_CHIPIDEA_ULPI as needed.
>
> Fixes: 03e6275ae381087bd8 ("usb: chipidea: Fix ULPI on imx51")
> Suggested-by: Lucas Stach <l.stach@pengutronix.de>
> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>

FWIW:

Tested-by: Andrey Smirnov <andrew.smirnov@gmail.com>

> ---
> Changes since v1:
> - Only propagate the error when CONFIG_USB_CHIPIDEA_ULPI is unselected
>
>  drivers/usb/chipidea/core.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
>
> diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
> index 85fc6db..e7018a1 100644
> --- a/drivers/usb/chipidea/core.c
> +++ b/drivers/usb/chipidea/core.c
> @@ -608,6 +608,17 @@ static int ci_get_platdata(struct device *dev,
>         if (!platdata->phy_mode)
>                 platdata->phy_mode = of_usb_get_phy_mode(dev->of_node);
>
> +       if (platdata->phy_mode == USBPHY_INTERFACE_MODE_ULPI) {
> +               /*
> +                * CONFIG_USB_CHIPIDEA_ULPI needs to be selected
> +                * for proper usage of the ULPI mode
> +                */
> +               if (!IS_ENABLED(CONFIG_USB_CHIPIDEA_ULPI)) {
> +                       WARN_ONCE(1, "Select CONFIG_USB_CHIPIDEA_ULPI in order to use ULPI mode\n");
> +                       return -EINVAL;
> +               }
> +       }
> +
>         if (!platdata->dr_mode)
>                 platdata->dr_mode = usb_get_dr_mode(dev);
>
> --
> 2.7.4
>
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [v2] USB: chipidea: Do not hang when CONFIG_USB_CHIPIDEA_ULPI is not selected
@ 2018-06-26 11:26 Fabio Estevam
  0 siblings, 0 replies; 15+ messages in thread
From: Fabio Estevam @ 2018-06-26 11:26 UTC (permalink / raw)
  To: Peter Chen
  Cc: linux-usb, andrew.smirnov, l.stach, sebastian.reichel, shawnguo,
	dl-linux-imx, kernel, Fabio Estevam

Hi Peter,

On Mon, Jun 25, 2018 at 11:51 PM, Peter Chen <peter.chen@nxp.com> wrote:

> Fabio, I wonder it may cause the USB not work at imx27 which
> do not use this configuration now. Any possibilities to test and verify it?

I don't have access to a mx27 board, but I can send a patch that
selects CONFIG_USB_CHIPIDEA_ULPI in imx_v4_v5_defconfig.

I have already sent a patch that selects CONFIG_USB_CHIPIDEA_ULPI in
imx_v6_v7_defconfig.
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [v2] USB: chipidea: Do not hang when CONFIG_USB_CHIPIDEA_ULPI is not selected
@ 2018-06-26  2:51 Peter Chen
  0 siblings, 0 replies; 15+ messages in thread
From: Peter Chen @ 2018-06-26  2:51 UTC (permalink / raw)
  To: Fabio Estevam
  Cc: linux-usb, andrew.smirnov, l.stach, sebastian.reichel, shawnguo,
	dl-linux-imx, kernel, Fabio Estevam

> 
> Fixes: 03e6275ae381087bd8 ("usb: chipidea: Fix ULPI on imx51")
> Suggested-by: Lucas Stach <l.stach@pengutronix.de>
> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
> ---
> Changes since v1:
> - Only propagate the error when CONFIG_USB_CHIPIDEA_ULPI is unselected
> 
>  drivers/usb/chipidea/core.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index
> 85fc6db..e7018a1 100644
> --- a/drivers/usb/chipidea/core.c
> +++ b/drivers/usb/chipidea/core.c
> @@ -608,6 +608,17 @@ static int ci_get_platdata(struct device *dev,
>  	if (!platdata->phy_mode)
>  		platdata->phy_mode = of_usb_get_phy_mode(dev->of_node);
> 
> +	if (platdata->phy_mode == USBPHY_INTERFACE_MODE_ULPI) {
> +		/*
> +		 * CONFIG_USB_CHIPIDEA_ULPI needs to be selected
> +		 * for proper usage of the ULPI mode
> +		 */
> +		if (!IS_ENABLED(CONFIG_USB_CHIPIDEA_ULPI)) {
> +			WARN_ONCE(1, "Select CONFIG_USB_CHIPIDEA_ULPI in
> order to use ULPI mode\n");
> +			return -EINVAL;
> +		}
> +	}
> +
>  	if (!platdata->dr_mode)
>  		platdata->dr_mode = usb_get_dr_mode(dev);
> 

Fabio, I wonder it may cause the USB not work at imx27 which
do not use this configuration now. Any possibilities to test and verify it?

b29397@b29397-desktop:~/work/projects/usb$ find arch/arm/boot/dts/ -name imx* | xargs grep -rn "ulpi"
arch/arm/boot/dts/imx53-ppd.dts:630:	phy_type = "ulpi";
arch/arm/boot/dts/imx53-ppd.dts:640:	phy_type = "ulpi";
arch/arm/boot/dts/imx51-eukrea-mbimxsd51-baseboard.dts:280:	phy_type = "ulpi";
arch/arm/boot/dts/imx51-digi-connectcore-jsk.dts:57:	phy_type = "ulpi";
arch/arm/boot/dts/imx27-phytec-phycore-som.dtsi:320:	phy_type = "ulpi";
arch/arm/boot/dts/imx27-pdk.dts:113:	phy_type = "ulpi";
arch/arm/boot/dts/imx51-zii-rdu1.dts:592:	phy_type = "ulpi";
arch/arm/boot/dts/imx51-zii-rdu1.dts:604:	phy_type = "ulpi";
arch/arm/boot/dts/imx27-phytec-phycore-rdk.dts:303:	phy_type = "ulpi";
arch/arm/boot/dts/imx27-eukrea-cpuimx27.dtsi:81:	phy_type = "ulpi";
arch/arm/boot/dts/imx27-eukrea-cpuimx27.dtsi:90:	phy_type = "ulpi";
arch/arm/boot/dts/imx51-babbage.dts:433:	phy_type = "ulpi";

Peter
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [v2] USB: chipidea: Do not hang when CONFIG_USB_CHIPIDEA_ULPI is not selected
@ 2018-06-25 14:25 Fabio Estevam
  0 siblings, 0 replies; 15+ messages in thread
From: Fabio Estevam @ 2018-06-25 14:25 UTC (permalink / raw)
  To: Peter.Chen
  Cc: linux-usb, andrew.smirnov, l.stach, sebastian.reichel, shawnguo,
	linux-imx, kernel, Fabio Estevam

From: Fabio Estevam <fabio.estevam@nxp.com>

Since commit 03e6275ae381087bd8 ("usb: chipidea: Fix ULPI on imx51") the
kernel hangs on a imx51-babbage board, when using the ULPI interface with
the CONFIG_USB_CHIPIDEA_ULPI option unselected.

Instead of hanging the kernel, let's warn the user that
CONFIG_USB_CHIPIDEA_ULPI needs to be selected, propagate an error
and continue with booting the kernel.

The user can then react to the warning and select
CONFIG_USB_CHIPIDEA_ULPI as needed.

Fixes: 03e6275ae381087bd8 ("usb: chipidea: Fix ULPI on imx51")
Suggested-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
---
Changes since v1:
- Only propagate the error when CONFIG_USB_CHIPIDEA_ULPI is unselected

 drivers/usb/chipidea/core.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 85fc6db..e7018a1 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -608,6 +608,17 @@ static int ci_get_platdata(struct device *dev,
 	if (!platdata->phy_mode)
 		platdata->phy_mode = of_usb_get_phy_mode(dev->of_node);
 
+	if (platdata->phy_mode == USBPHY_INTERFACE_MODE_ULPI) {
+		/*
+		 * CONFIG_USB_CHIPIDEA_ULPI needs to be selected
+		 * for proper usage of the ULPI mode
+		 */
+		if (!IS_ENABLED(CONFIG_USB_CHIPIDEA_ULPI)) {
+			WARN_ONCE(1, "Select CONFIG_USB_CHIPIDEA_ULPI in order to use ULPI mode\n");
+			return -EINVAL;
+		}
+	}
+
 	if (!platdata->dr_mode)
 		platdata->dr_mode = usb_get_dr_mode(dev);
 

^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2018-07-04 13:11 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-03 12:38 [v2] USB: chipidea: Do not hang when CONFIG_USB_CHIPIDEA_ULPI is not selected Shawn Guo
  -- strict thread matches above, loose matches on Subject: below --
2018-07-04 13:11 Fabio Estevam
2018-07-04  8:24 Peter Chen
2018-07-03 10:52 Fabio Estevam
2018-07-03  3:40 Shawn Guo
2018-07-03  2:22 Fabio Estevam
2018-07-03  2:06 Shawn Guo
2018-07-03  2:00 Fabio Estevam
2018-07-03  1:48 Shawn Guo
2018-07-02 11:52 Fabio Estevam
2018-07-02  3:08 Peter Chen
2018-06-27  4:10 Andrey Smirnov
2018-06-26 11:26 Fabio Estevam
2018-06-26  2:51 Peter Chen
2018-06-25 14:25 Fabio Estevam

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.