From: Shawn Guo <shawnguo@kernel.org>
To: Fabio Estevam <festevam@gmail.com>
Cc: Peter.Chen@nxp.com, linux-usb@vger.kernel.org,
andrew.smirnov@gmail.com, l.stach@pengutronix.de,
sebastian.reichel@collabora.co.uk, linux-imx@nxp.com,
kernel@pengutronix.de, Fabio Estevam <fabio.estevam@nxp.com>
Subject: [v2] USB: chipidea: Do not hang when CONFIG_USB_CHIPIDEA_ULPI is not selected
Date: Tue, 3 Jul 2018 10:06:31 +0800 [thread overview]
Message-ID: <20180703020629.GZ4348@dragon> (raw)
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
next reply other threads:[~2018-07-03 2:06 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-03 2:06 Shawn Guo [this message]
-- strict thread matches above, loose matches on Subject: below --
2018-07-04 13:11 [v2] USB: chipidea: Do not hang when CONFIG_USB_CHIPIDEA_ULPI is not selected Fabio Estevam
2018-07-04 8:24 Peter Chen
2018-07-03 12:38 Shawn Guo
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: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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180703020629.GZ4348@dragon \
--to=shawnguo@kernel.org \
--cc=Peter.Chen@nxp.com \
--cc=andrew.smirnov@gmail.com \
--cc=fabio.estevam@nxp.com \
--cc=festevam@gmail.com \
--cc=kernel@pengutronix.de \
--cc=l.stach@pengutronix.de \
--cc=linux-imx@nxp.com \
--cc=linux-usb@vger.kernel.org \
--cc=sebastian.reichel@collabora.co.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.