Skip to content

Commit 60ed39d

Browse files
committed
Merge tag 'usb-v5.13-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/peter.chen/usb into usb-linus
Peter writes: One bug fix for USB charger detection at imx7d and imx8m series SoCs * tag 'usb-v5.13-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/peter.chen/usb: usb: chipidea: imx: Fix Battery Charger 1.2 CDP detection
2 parents 4bf584a + c6d580d commit 60ed39d

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

drivers/usb/chipidea/usbmisc_imx.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -686,6 +686,16 @@ static int imx7d_charger_secondary_detection(struct imx_usbmisc_data *data)
686686
int val;
687687
unsigned long flags;
688688

689+
/* Clear VDATSRCENB0 to disable VDP_SRC and IDM_SNK required by BC 1.2 spec */
690+
spin_lock_irqsave(&usbmisc->lock, flags);
691+
val = readl(usbmisc->base + MX7D_USB_OTG_PHY_CFG2);
692+
val &= ~MX7D_USB_OTG_PHY_CFG2_CHRG_VDATSRCENB0;
693+
writel(val, usbmisc->base + MX7D_USB_OTG_PHY_CFG2);
694+
spin_unlock_irqrestore(&usbmisc->lock, flags);
695+
696+
/* TVDMSRC_DIS */
697+
msleep(20);
698+
689699
/* VDM_SRC is connected to D- and IDP_SINK is connected to D+ */
690700
spin_lock_irqsave(&usbmisc->lock, flags);
691701
val = readl(usbmisc->base + MX7D_USB_OTG_PHY_CFG2);
@@ -695,7 +705,8 @@ static int imx7d_charger_secondary_detection(struct imx_usbmisc_data *data)
695705
usbmisc->base + MX7D_USB_OTG_PHY_CFG2);
696706
spin_unlock_irqrestore(&usbmisc->lock, flags);
697707

698-
usleep_range(1000, 2000);
708+
/* TVDMSRC_ON */
709+
msleep(40);
699710

700711
/*
701712
* Per BC 1.2, check voltage of D+:
@@ -798,7 +809,8 @@ static int imx7d_charger_primary_detection(struct imx_usbmisc_data *data)
798809
usbmisc->base + MX7D_USB_OTG_PHY_CFG2);
799810
spin_unlock_irqrestore(&usbmisc->lock, flags);
800811

801-
usleep_range(1000, 2000);
812+
/* TVDPSRC_ON */
813+
msleep(40);
802814

803815
/* Check if D- is less than VDAT_REF to determine an SDP per BC 1.2 */
804816
val = readl(usbmisc->base + MX7D_USB_OTG_PHY_STATUS);

0 commit comments

Comments
 (0)