Skip to content

Commit 734643d

Browse files
Gregory HerreroFelipe Balbi
Gregory Herrero
authored and
Felipe Balbi
committed
usb: dwc2: host: add flag to reflect bus state
lx_state must be used to reflect controller power state only and not bus state. Thus add a flag to track state during bus suspend. Signed-off-by: Gregory Herrero <[email protected]> Signed-off-by: Mian Yousaf Kaukab <[email protected]> Tested-by: Robert Baldyga <[email protected]> Tested-by: Dinh Nguyen <[email protected]> Tested-by: John Youn <[email protected]> Acked-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
1 parent 30db103 commit 734643d

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

drivers/usb/dwc2/core.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,7 @@ struct dwc2_hsotg {
764764
u16 frame_usecs[8];
765765
u16 frame_number;
766766
u16 periodic_qh_count;
767+
bool bus_suspended;
767768

768769
#ifdef CONFIG_USB_DWC2_TRACK_MISSED_SOFS
769770
#define FRAME_NUM_ARRAY_SIZE 1000

drivers/usb/dwc2/hcd.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1425,6 +1425,7 @@ static void dwc2_wakeup_detected(unsigned long data)
14251425
dev_dbg(hsotg->dev, "Clear Resume: HPRT0=%0x\n",
14261426
dwc2_readl(hsotg->regs + HPRT0));
14271427

1428+
hsotg->bus_suspended = 0;
14281429
dwc2_hcd_rem_wakeup(hsotg);
14291430

14301431
/* Change to L0 state */
@@ -1461,8 +1462,7 @@ static void dwc2_port_suspend(struct dwc2_hsotg *hsotg, u16 windex)
14611462
hprt0 |= HPRT0_SUSP;
14621463
dwc2_writel(hprt0, hsotg->regs + HPRT0);
14631464

1464-
/* Update lx_state */
1465-
hsotg->lx_state = DWC2_L2;
1465+
hsotg->bus_suspended = 1;
14661466

14671467
/* Suspend the Phy Clock */
14681468
pcgctl = dwc2_readl(hsotg->regs + PCGCTL);
@@ -1510,6 +1510,7 @@ static void dwc2_port_resume(struct dwc2_hsotg *hsotg)
15101510
hprt0 = dwc2_read_hprt0(hsotg);
15111511
hprt0 &= ~(HPRT0_RES | HPRT0_SUSP);
15121512
dwc2_writel(hprt0, hsotg->regs + HPRT0);
1513+
hsotg->bus_suspended = 0;
15131514
spin_unlock_irqrestore(&hsotg->lock, flags);
15141515
}
15151516

0 commit comments

Comments
 (0)