Skip to content

Commit 1696d5a

Browse files
jysnpsFelipe Balbi
authored andcommitted
usb: dwc2: Move mode querying functions into core.h
These functions should go in core.h where they can be called from core, device, or host. Signed-off-by: John Youn <[email protected]> Reviewed-by: Douglas Anderson <[email protected]> Tested-by: Douglas Anderson <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
1 parent 5268ed9 commit 1696d5a

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

drivers/usb/dwc2/core.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,6 +1150,18 @@ bool dwc2_hw_is_otg(struct dwc2_hsotg *hsotg);
11501150
bool dwc2_hw_is_host(struct dwc2_hsotg *hsotg);
11511151
bool dwc2_hw_is_device(struct dwc2_hsotg *hsotg);
11521152

1153+
/*
1154+
* Returns the mode of operation, host or device
1155+
*/
1156+
static inline int dwc2_is_host_mode(struct dwc2_hsotg *hsotg)
1157+
{
1158+
return (dwc2_readl(hsotg->regs + GINTSTS) & GINTSTS_CURMODE_HOST) != 0;
1159+
}
1160+
static inline int dwc2_is_device_mode(struct dwc2_hsotg *hsotg)
1161+
{
1162+
return (dwc2_readl(hsotg->regs + GINTSTS) & GINTSTS_CURMODE_HOST) == 0;
1163+
}
1164+
11531165
/*
11541166
* Dump core registers and SPRAM
11551167
*/

drivers/usb/dwc2/hcd.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -383,18 +383,6 @@ static inline void disable_hc_int(struct dwc2_hsotg *hsotg, int chnum, u32 intr)
383383
dwc2_writel(mask, hsotg->regs + HCINTMSK(chnum));
384384
}
385385

386-
/*
387-
* Returns the mode of operation, host or device
388-
*/
389-
static inline int dwc2_is_host_mode(struct dwc2_hsotg *hsotg)
390-
{
391-
return (dwc2_readl(hsotg->regs + GINTSTS) & GINTSTS_CURMODE_HOST) != 0;
392-
}
393-
static inline int dwc2_is_device_mode(struct dwc2_hsotg *hsotg)
394-
{
395-
return (dwc2_readl(hsotg->regs + GINTSTS) & GINTSTS_CURMODE_HOST) == 0;
396-
}
397-
398386
/*
399387
* Reads HPRT0 in preparation to modify. It keeps the WC bits 0 so that if they
400388
* are read as 1, they won't clear when written back.

0 commit comments

Comments
 (0)