From: John Youn Date: Thu, 17 Dec 2015 19:16:45 +0000 (-0800) Subject: UPSTREAM: usb: dwc2: Move mode querying functions into core.h X-Git-Tag: firefly_0821_release~903 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=68bbaccc23628a6f92dba58e6e388a521144dceb;p=firefly-linux-kernel-4.4.55.git UPSTREAM: 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. Change-Id: I03e22ee0f6819998d152fab25c5b0b47e76275e1 Signed-off-by: John Youn Reviewed-by: Douglas Anderson Tested-by: Douglas Anderson Signed-off-by: Felipe Balbi Signed-off-by: Huang, Tao (cherry picked from commit 1696d5ab99ef885ae62da5ad58f9eff16da7ff78) --- diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index 6f5c6afe77ca..36008bcd60b0 100644 --- a/drivers/usb/dwc2/core.h +++ b/drivers/usb/dwc2/core.h @@ -1178,6 +1178,18 @@ bool dwc2_hw_is_otg(struct dwc2_hsotg *hsotg); bool dwc2_hw_is_host(struct dwc2_hsotg *hsotg); bool dwc2_hw_is_device(struct dwc2_hsotg *hsotg); +/* + * Returns the mode of operation, host or device + */ +static inline int dwc2_is_host_mode(struct dwc2_hsotg *hsotg) +{ + return (dwc2_readl(hsotg->regs + GINTSTS) & GINTSTS_CURMODE_HOST) != 0; +} +static inline int dwc2_is_device_mode(struct dwc2_hsotg *hsotg) +{ + return (dwc2_readl(hsotg->regs + GINTSTS) & GINTSTS_CURMODE_HOST) == 0; +} + /* * Dump core registers and SPRAM */ diff --git a/drivers/usb/dwc2/hcd.h b/drivers/usb/dwc2/hcd.h index 6e822661a69e..8f0a29cefdf7 100644 --- a/drivers/usb/dwc2/hcd.h +++ b/drivers/usb/dwc2/hcd.h @@ -383,18 +383,6 @@ static inline void disable_hc_int(struct dwc2_hsotg *hsotg, int chnum, u32 intr) dwc2_writel(mask, hsotg->regs + HCINTMSK(chnum)); } -/* - * Returns the mode of operation, host or device - */ -static inline int dwc2_is_host_mode(struct dwc2_hsotg *hsotg) -{ - return (dwc2_readl(hsotg->regs + GINTSTS) & GINTSTS_CURMODE_HOST) != 0; -} -static inline int dwc2_is_device_mode(struct dwc2_hsotg *hsotg) -{ - return (dwc2_readl(hsotg->regs + GINTSTS) & GINTSTS_CURMODE_HOST) == 0; -} - /* * Reads HPRT0 in preparation to modify. It keeps the WC bits 0 so that if they * are read as 1, they won't clear when written back.