usb: musb: remove duplicated port mode enum

include/linux/usb/musb.h already defines enum for musb port mode, so
remove the duplicate in musb_core.h and use the definition in musb.h.

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Bin Liu 2018-05-21 08:42:15 -05:00 committed by Greg Kroah-Hartman
parent 55479956f3
commit 7ad76955c6
7 changed files with 16 additions and 22 deletions

View File

@ -1038,7 +1038,7 @@ void musb_start(struct musb *musb)
* (b) vbus present/connect IRQ, peripheral mode; * (b) vbus present/connect IRQ, peripheral mode;
* (c) peripheral initiates, using SRP * (c) peripheral initiates, using SRP
*/ */
if (musb->port_mode != MUSB_PORT_MODE_HOST && if (musb->port_mode != MUSB_HOST &&
musb->xceiv->otg->state != OTG_STATE_A_WAIT_BCON && musb->xceiv->otg->state != OTG_STATE_A_WAIT_BCON &&
(devctl & MUSB_DEVCTL_VBUS) == MUSB_DEVCTL_VBUS) { (devctl & MUSB_DEVCTL_VBUS) == MUSB_DEVCTL_VBUS) {
musb->is_active = 1; musb->is_active = 1;
@ -2323,19 +2323,19 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
} }
switch (musb->port_mode) { switch (musb->port_mode) {
case MUSB_PORT_MODE_HOST: case MUSB_HOST:
status = musb_host_setup(musb, plat->power); status = musb_host_setup(musb, plat->power);
if (status < 0) if (status < 0)
goto fail3; goto fail3;
status = musb_platform_set_mode(musb, MUSB_HOST); status = musb_platform_set_mode(musb, MUSB_HOST);
break; break;
case MUSB_PORT_MODE_GADGET: case MUSB_PERIPHERAL:
status = musb_gadget_setup(musb); status = musb_gadget_setup(musb);
if (status < 0) if (status < 0)
goto fail3; goto fail3;
status = musb_platform_set_mode(musb, MUSB_PERIPHERAL); status = musb_platform_set_mode(musb, MUSB_PERIPHERAL);
break; break;
case MUSB_PORT_MODE_DUAL_ROLE: case MUSB_OTG:
status = musb_host_setup(musb, plat->power); status = musb_host_setup(musb, plat->power);
if (status < 0) if (status < 0)
goto fail3; goto fail3;

View File

@ -53,12 +53,6 @@ struct musb_ep;
#define is_peripheral_active(m) (!(m)->is_host) #define is_peripheral_active(m) (!(m)->is_host)
#define is_host_active(m) ((m)->is_host) #define is_host_active(m) ((m)->is_host)
enum {
MUSB_PORT_MODE_HOST = 1,
MUSB_PORT_MODE_GADGET,
MUSB_PORT_MODE_DUAL_ROLE,
};
/****************************** CONSTANTS ********************************/ /****************************** CONSTANTS ********************************/
#ifndef MUSB_C_NUM_EPS #ifndef MUSB_C_NUM_EPS
@ -351,7 +345,7 @@ struct musb {
u8 min_power; /* vbus for periph, in mA/2 */ u8 min_power; /* vbus for periph, in mA/2 */
int port_mode; /* MUSB_PORT_MODE_* */ enum musb_mode port_mode;
bool session; bool session;
unsigned long quirk_retries; unsigned long quirk_retries;
bool is_host; bool is_host;

View File

@ -183,7 +183,7 @@ static void dsps_musb_enable(struct musb *musb)
musb_writel(reg_base, wrp->coreintr_set, coremask); musb_writel(reg_base, wrp->coreintr_set, coremask);
/* start polling for ID change in dual-role idle mode */ /* start polling for ID change in dual-role idle mode */
if (musb->xceiv->otg->state == OTG_STATE_B_IDLE && if (musb->xceiv->otg->state == OTG_STATE_B_IDLE &&
musb->port_mode == MUSB_PORT_MODE_DUAL_ROLE) musb->port_mode == MUSB_OTG)
dsps_mod_timer(glue, -1); dsps_mod_timer(glue, -1);
} }
@ -231,7 +231,7 @@ static int dsps_check_status(struct musb *musb, void *unused)
break; break;
case OTG_STATE_A_WAIT_BCON: case OTG_STATE_A_WAIT_BCON:
/* keep VBUS on for host-only mode */ /* keep VBUS on for host-only mode */
if (musb->port_mode == MUSB_PORT_MODE_HOST) { if (musb->port_mode == MUSB_HOST) {
dsps_mod_timer_optional(glue); dsps_mod_timer_optional(glue);
break; break;
} }
@ -1028,7 +1028,7 @@ static int dsps_resume(struct device *dev)
musb_writel(mbase, wrp->tx_mode, glue->context.tx_mode); musb_writel(mbase, wrp->tx_mode, glue->context.tx_mode);
musb_writel(mbase, wrp->rx_mode, glue->context.rx_mode); musb_writel(mbase, wrp->rx_mode, glue->context.rx_mode);
if (musb->xceiv->otg->state == OTG_STATE_B_IDLE && if (musb->xceiv->otg->state == OTG_STATE_B_IDLE &&
musb->port_mode == MUSB_PORT_MODE_DUAL_ROLE) musb->port_mode == MUSB_OTG)
dsps_mod_timer(glue, -1); dsps_mod_timer(glue, -1);
pm_runtime_put(dev); pm_runtime_put(dev);

View File

@ -1823,7 +1823,7 @@ err:
void musb_gadget_cleanup(struct musb *musb) void musb_gadget_cleanup(struct musb *musb)
{ {
if (musb->port_mode == MUSB_PORT_MODE_HOST) if (musb->port_mode == MUSB_HOST)
return; return;
cancel_delayed_work_sync(&musb->gadget_work); cancel_delayed_work_sync(&musb->gadget_work);

View File

@ -2735,7 +2735,7 @@ int musb_host_alloc(struct musb *musb)
void musb_host_cleanup(struct musb *musb) void musb_host_cleanup(struct musb *musb)
{ {
if (musb->port_mode == MUSB_PORT_MODE_GADGET) if (musb->port_mode == MUSB_PERIPHERAL)
return; return;
usb_remove_hcd(musb->hcd); usb_remove_hcd(musb->hcd);
} }
@ -2750,7 +2750,7 @@ int musb_host_setup(struct musb *musb, int power_budget)
int ret; int ret;
struct usb_hcd *hcd = musb->hcd; struct usb_hcd *hcd = musb->hcd;
if (musb->port_mode == MUSB_PORT_MODE_HOST) { if (musb->port_mode == MUSB_HOST) {
MUSB_HST_MODE(musb); MUSB_HST_MODE(musb);
musb->xceiv->otg->default_a = 1; musb->xceiv->otg->default_a = 1;
musb->xceiv->otg->state = OTG_STATE_A_IDLE; musb->xceiv->otg->state = OTG_STATE_A_IDLE;

View File

@ -254,7 +254,7 @@ static int musb_has_gadget(struct musb *musb)
#ifdef CONFIG_USB_MUSB_HOST #ifdef CONFIG_USB_MUSB_HOST
return 1; return 1;
#else #else
return musb->port_mode == MUSB_PORT_MODE_HOST; return musb->port_mode == MUSB_HOST;
#endif #endif
} }

View File

@ -347,7 +347,7 @@ static int sunxi_musb_set_mode(struct musb *musb, u8 mode)
if (glue->phy_mode == new_mode) if (glue->phy_mode == new_mode)
return 0; return 0;
if (musb->port_mode != MUSB_PORT_MODE_DUAL_ROLE) { if (musb->port_mode != MUSB_OTG) {
dev_err(musb->controller->parent, dev_err(musb->controller->parent,
"Error changing modes is only supported in dual role mode\n"); "Error changing modes is only supported in dual role mode\n");
return -EINVAL; return -EINVAL;
@ -690,19 +690,19 @@ static int sunxi_musb_probe(struct platform_device *pdev)
switch (usb_get_dr_mode(&pdev->dev)) { switch (usb_get_dr_mode(&pdev->dev)) {
#if defined CONFIG_USB_MUSB_DUAL_ROLE || defined CONFIG_USB_MUSB_HOST #if defined CONFIG_USB_MUSB_DUAL_ROLE || defined CONFIG_USB_MUSB_HOST
case USB_DR_MODE_HOST: case USB_DR_MODE_HOST:
pdata.mode = MUSB_PORT_MODE_HOST; pdata.mode = MUSB_HOST;
glue->phy_mode = PHY_MODE_USB_HOST; glue->phy_mode = PHY_MODE_USB_HOST;
break; break;
#endif #endif
#if defined CONFIG_USB_MUSB_DUAL_ROLE || defined CONFIG_USB_MUSB_GADGET #if defined CONFIG_USB_MUSB_DUAL_ROLE || defined CONFIG_USB_MUSB_GADGET
case USB_DR_MODE_PERIPHERAL: case USB_DR_MODE_PERIPHERAL:
pdata.mode = MUSB_PORT_MODE_GADGET; pdata.mode = MUSB_PERIPHERAL;
glue->phy_mode = PHY_MODE_USB_DEVICE; glue->phy_mode = PHY_MODE_USB_DEVICE;
break; break;
#endif #endif
#ifdef CONFIG_USB_MUSB_DUAL_ROLE #ifdef CONFIG_USB_MUSB_DUAL_ROLE
case USB_DR_MODE_OTG: case USB_DR_MODE_OTG:
pdata.mode = MUSB_PORT_MODE_DUAL_ROLE; pdata.mode = MUSB_OTG;
glue->phy_mode = PHY_MODE_USB_OTG; glue->phy_mode = PHY_MODE_USB_OTG;
break; break;
#endif #endif