* usb: phy: mxs: Do not run charger detection on i.MX23/28
@ 2018-01-18 0:24 Jun Li
0 siblings, 0 replies; 2+ messages in thread
From: Jun Li @ 2018-01-18 0:24 UTC (permalink / raw)
To: Fabio Estevam, balbi; +Cc: baolin.wang, Peter Chen, linux-usb
Hi Fabio,
> -----Original Message-----
> From: Fabio Estevam [mailto:fabio.estevam@nxp.com]
> Sent: Thursday, January 18, 2018 12:16 AM
> To: balbi@kernel.org
> Cc: Jun Li <jun.li@nxp.com>; baolin.wang@linaro.org; Peter Chen
> <peter.chen@nxp.com>; linux-usb@vger.kernel.org; Fabio Estevam
> <fabio.estevam@nxp.com>
> Subject: [PATCH] usb: phy: mxs: Do not run charger detection on i.MX23/28
>
> Commit e93650994a95 ("usb: phy: mxs: add usb charger type detection") causes
> the following kernel hang on i.MX28:
>
> [ 2.207973] usbcore: registered new interface driver usb-storage
> [ 2.235659] Unable to handle kernel NULL pointer dereference at virtual
> address 00000188
> [ 2.244195] pgd = (ptrval)
> [ 2.246994] [00000188] *pgd=00000000
> [ 2.250676] Internal error: Oops: 5 [#1] ARM
> [ 2.254979] Modules linked in:
> [ 2.258089] CPU: 0 PID: 1 Comm: swapper Not tainted 4.15.0-rc8-next-
> 20180117-00002-g75d5f21 #7
> [ 2.266724] Hardware name: Freescale MXS (Device Tree)
> [ 2.271921] PC is at regmap_read+0x0/0x5c
> [ 2.275977] LR is at mxs_phy_charger_detect+0x34/0x1dc
>
> The USB PHY present on i.MX23/28 does not support charger detection so do
> not attempt to run it on these SoCs.
>
> Fixes: e93650994a95 ("usb: phy: mxs: add usb charger type detection")
> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
> ---
> drivers/usb/phy/phy-mxs-usb.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c
> index da031c4..54a887c 100644
> --- a/drivers/usb/phy/phy-mxs-usb.c
> +++ b/drivers/usb/phy/phy-mxs-usb.c
> @@ -129,6 +129,9 @@
> */
> #define MXS_PHY_NEED_IP_FIX BIT(3)
>
> +/* MX23 and MX28 USB PHY does not support charger detecttion */
> +#define MXS_PHY_NO_CHARGER BIT(4)
> +
> /* Minimum and maximum values for device tree entries */
> #define MXS_PHY_TX_CAL45_MIN 30
> #define MXS_PHY_TX_CAL45_MAX 55
> @@ -140,7 +143,8 @@ struct mxs_phy_data { };
>
> static const struct mxs_phy_data imx23_phy_data = {
> - .flags = MXS_PHY_ABNORMAL_IN_SUSPEND |
> MXS_PHY_SENDING_SOF_TOO_FAST,
> + .flags = MXS_PHY_ABNORMAL_IN_SUSPEND |
> MXS_PHY_SENDING_SOF_TOO_FAST |
> + MXS_PHY_NO_CHARGER,
> };
>
> static const struct mxs_phy_data imx6q_phy_data = { @@ -602,6 +606,9 @@
> static enum usb_charger_type mxs_phy_charger_detect(struct usb_phy *phy)
> void __iomem *base = phy->io_priv;
> enum usb_charger_type chgr_type = UNKNOWN_TYPE;
>
> + if (mxs_phy->data->flags & MXS_PHY_NO_CHARGER)
> + return UNKNOWN_TYPE;
> +
I guess your hang is caused by NULL mxs_phy->regmap_anatop, if that
is the case, below check should be able to fix it. To be safe, I think
anyway a check needed here.
if (!mxs_phy->regmap_anatop)
return UNKNOWN_TYPE;
Li Jun
> if (mxs_charger_data_contact_detect(mxs_phy))
> return chgr_type;
>
> --
> 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] 2+ messages in thread
* usb: phy: mxs: Do not run charger detection on i.MX23/28
@ 2018-01-17 16:16 Fabio Estevam
0 siblings, 0 replies; 2+ messages in thread
From: Fabio Estevam @ 2018-01-17 16:16 UTC (permalink / raw)
To: balbi; +Cc: jun.li, baolin.wang, peter.chen, linux-usb, Fabio Estevam
Commit e93650994a95 ("usb: phy: mxs: add usb charger type detection")
causes the following kernel hang on i.MX28:
[ 2.207973] usbcore: registered new interface driver usb-storage
[ 2.235659] Unable to handle kernel NULL pointer dereference at virtual address 00000188
[ 2.244195] pgd = (ptrval)
[ 2.246994] [00000188] *pgd=00000000
[ 2.250676] Internal error: Oops: 5 [#1] ARM
[ 2.254979] Modules linked in:
[ 2.258089] CPU: 0 PID: 1 Comm: swapper Not tainted 4.15.0-rc8-next-20180117-00002-g75d5f21 #7
[ 2.266724] Hardware name: Freescale MXS (Device Tree)
[ 2.271921] PC is at regmap_read+0x0/0x5c
[ 2.275977] LR is at mxs_phy_charger_detect+0x34/0x1dc
The USB PHY present on i.MX23/28 does not support charger
detection so do not attempt to run it on these SoCs.
Fixes: e93650994a95 ("usb: phy: mxs: add usb charger type detection")
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
---
drivers/usb/phy/phy-mxs-usb.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c
index da031c4..54a887c 100644
--- a/drivers/usb/phy/phy-mxs-usb.c
+++ b/drivers/usb/phy/phy-mxs-usb.c
@@ -129,6 +129,9 @@
*/
#define MXS_PHY_NEED_IP_FIX BIT(3)
+/* MX23 and MX28 USB PHY does not support charger detecttion */
+#define MXS_PHY_NO_CHARGER BIT(4)
+
/* Minimum and maximum values for device tree entries */
#define MXS_PHY_TX_CAL45_MIN 30
#define MXS_PHY_TX_CAL45_MAX 55
@@ -140,7 +143,8 @@ struct mxs_phy_data {
};
static const struct mxs_phy_data imx23_phy_data = {
- .flags = MXS_PHY_ABNORMAL_IN_SUSPEND | MXS_PHY_SENDING_SOF_TOO_FAST,
+ .flags = MXS_PHY_ABNORMAL_IN_SUSPEND | MXS_PHY_SENDING_SOF_TOO_FAST |
+ MXS_PHY_NO_CHARGER,
};
static const struct mxs_phy_data imx6q_phy_data = {
@@ -602,6 +606,9 @@ static enum usb_charger_type mxs_phy_charger_detect(struct usb_phy *phy)
void __iomem *base = phy->io_priv;
enum usb_charger_type chgr_type = UNKNOWN_TYPE;
+ if (mxs_phy->data->flags & MXS_PHY_NO_CHARGER)
+ return UNKNOWN_TYPE;
+
if (mxs_charger_data_contact_detect(mxs_phy))
return chgr_type;
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-01-18 0:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-18 0:24 usb: phy: mxs: Do not run charger detection on i.MX23/28 Jun Li
-- strict thread matches above, loose matches on Subject: below --
2018-01-17 16:16 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.