Commit bae73e80 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'usb-4.9-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb

Pull USB fixes from Greg KH:
 "Here are a few small USB fixes and new device ids for 4.9-rc7.

  The majority of these fixes are in the musb driver, fixing a number of
  regressions that have been reported but took a while to resolve. The
  other fixes are all small ones, to resolve other reported minor
  issues.

  All have been in linux-next for a while with no reported issues"

* tag 'usb-4.9-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
  usb: gadget: f_fs: fix wrong parenthesis in ffs_func_req_match()
  phy: twl4030-usb: Fix for musb session bit based PM
  usb: musb: Drop pointless PM runtime code for dsps glue
  usb: musb: Add missing pm_runtime_disable and drop 2430 PM timeout
  usb: musb: Fix PM for hub disconnect
  usb: musb: Fix sleeping function called from invalid context for hdrc glue
  usb: musb: Fix broken use of static variable for multiple instances
  USB: serial: cp210x: add ID for the Zone DPMX
  usb: chipidea: move the lock initialization to core file
  Fix USB CB/CBI storage devices with CONFIG_VMAP_STACK=y
  USB: serial: ftdi_sio: add support for TI CC3200 LaunchPad
parents e2b6535d c0da038d
...@@ -459,8 +459,6 @@ static int twl4030_phy_power_off(struct phy *phy) ...@@ -459,8 +459,6 @@ static int twl4030_phy_power_off(struct phy *phy)
struct twl4030_usb *twl = phy_get_drvdata(phy); struct twl4030_usb *twl = phy_get_drvdata(phy);
dev_dbg(twl->dev, "%s\n", __func__); dev_dbg(twl->dev, "%s\n", __func__);
pm_runtime_mark_last_busy(twl->dev);
pm_runtime_put_autosuspend(twl->dev);
return 0; return 0;
} }
...@@ -472,6 +470,8 @@ static int twl4030_phy_power_on(struct phy *phy) ...@@ -472,6 +470,8 @@ static int twl4030_phy_power_on(struct phy *phy)
dev_dbg(twl->dev, "%s\n", __func__); dev_dbg(twl->dev, "%s\n", __func__);
pm_runtime_get_sync(twl->dev); pm_runtime_get_sync(twl->dev);
schedule_delayed_work(&twl->id_workaround_work, HZ); schedule_delayed_work(&twl->id_workaround_work, HZ);
pm_runtime_mark_last_busy(twl->dev);
pm_runtime_put_autosuspend(twl->dev);
return 0; return 0;
} }
......
...@@ -914,6 +914,7 @@ static int ci_hdrc_probe(struct platform_device *pdev) ...@@ -914,6 +914,7 @@ static int ci_hdrc_probe(struct platform_device *pdev)
if (!ci) if (!ci)
return -ENOMEM; return -ENOMEM;
spin_lock_init(&ci->lock);
ci->dev = dev; ci->dev = dev;
ci->platdata = dev_get_platdata(dev); ci->platdata = dev_get_platdata(dev);
ci->imx28_write_fix = !!(ci->platdata->flags & ci->imx28_write_fix = !!(ci->platdata->flags &
......
...@@ -1889,8 +1889,6 @@ static int udc_start(struct ci_hdrc *ci) ...@@ -1889,8 +1889,6 @@ static int udc_start(struct ci_hdrc *ci)
struct usb_otg_caps *otg_caps = &ci->platdata->ci_otg_caps; struct usb_otg_caps *otg_caps = &ci->platdata->ci_otg_caps;
int retval = 0; int retval = 0;
spin_lock_init(&ci->lock);
ci->gadget.ops = &usb_gadget_ops; ci->gadget.ops = &usb_gadget_ops;
ci->gadget.speed = USB_SPEED_UNKNOWN; ci->gadget.speed = USB_SPEED_UNKNOWN;
ci->gadget.max_speed = USB_SPEED_HIGH; ci->gadget.max_speed = USB_SPEED_HIGH;
......
...@@ -3225,11 +3225,11 @@ static bool ffs_func_req_match(struct usb_function *f, ...@@ -3225,11 +3225,11 @@ static bool ffs_func_req_match(struct usb_function *f,
switch (creq->bRequestType & USB_RECIP_MASK) { switch (creq->bRequestType & USB_RECIP_MASK) {
case USB_RECIP_INTERFACE: case USB_RECIP_INTERFACE:
return ffs_func_revmap_intf(func, return (ffs_func_revmap_intf(func,
le16_to_cpu(creq->wIndex) >= 0); le16_to_cpu(creq->wIndex)) >= 0);
case USB_RECIP_ENDPOINT: case USB_RECIP_ENDPOINT:
return ffs_func_revmap_ep(func, return (ffs_func_revmap_ep(func,
le16_to_cpu(creq->wIndex) >= 0); le16_to_cpu(creq->wIndex)) >= 0);
default: default:
return (bool) (func->ffs->user_flags & return (bool) (func->ffs->user_flags &
FUNCTIONFS_ALL_CTRL_RECIP); FUNCTIONFS_ALL_CTRL_RECIP);
......
...@@ -986,7 +986,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, ...@@ -986,7 +986,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
} }
#endif #endif
schedule_work(&musb->irq_work); schedule_delayed_work(&musb->irq_work, 0);
return handled; return handled;
} }
...@@ -1855,14 +1855,23 @@ static void musb_pm_runtime_check_session(struct musb *musb) ...@@ -1855,14 +1855,23 @@ static void musb_pm_runtime_check_session(struct musb *musb)
MUSB_DEVCTL_HR; MUSB_DEVCTL_HR;
switch (devctl & ~s) { switch (devctl & ~s) {
case MUSB_QUIRK_B_INVALID_VBUS_91: case MUSB_QUIRK_B_INVALID_VBUS_91:
if (!musb->session && !musb->quirk_invalid_vbus) { if (musb->quirk_retries--) {
musb->quirk_invalid_vbus = true;
musb_dbg(musb, musb_dbg(musb,
"First invalid vbus, assume no session"); "Poll devctl on invalid vbus, assume no session");
schedule_delayed_work(&musb->irq_work,
msecs_to_jiffies(1000));
return; return;
} }
break;
case MUSB_QUIRK_A_DISCONNECT_19: case MUSB_QUIRK_A_DISCONNECT_19:
if (musb->quirk_retries--) {
musb_dbg(musb,
"Poll devctl on possible host mode disconnect");
schedule_delayed_work(&musb->irq_work,
msecs_to_jiffies(1000));
return;
}
if (!musb->session) if (!musb->session)
break; break;
musb_dbg(musb, "Allow PM on possible host mode disconnect"); musb_dbg(musb, "Allow PM on possible host mode disconnect");
...@@ -1886,9 +1895,9 @@ static void musb_pm_runtime_check_session(struct musb *musb) ...@@ -1886,9 +1895,9 @@ static void musb_pm_runtime_check_session(struct musb *musb)
if (error < 0) if (error < 0)
dev_err(musb->controller, "Could not enable: %i\n", dev_err(musb->controller, "Could not enable: %i\n",
error); error);
musb->quirk_retries = 3;
} else { } else {
musb_dbg(musb, "Allow PM with no session: %02x", devctl); musb_dbg(musb, "Allow PM with no session: %02x", devctl);
musb->quirk_invalid_vbus = false;
pm_runtime_mark_last_busy(musb->controller); pm_runtime_mark_last_busy(musb->controller);
pm_runtime_put_autosuspend(musb->controller); pm_runtime_put_autosuspend(musb->controller);
} }
...@@ -1899,7 +1908,7 @@ static void musb_pm_runtime_check_session(struct musb *musb) ...@@ -1899,7 +1908,7 @@ static void musb_pm_runtime_check_session(struct musb *musb)
/* Only used to provide driver mode change events */ /* Only used to provide driver mode change events */
static void musb_irq_work(struct work_struct *data) static void musb_irq_work(struct work_struct *data)
{ {
struct musb *musb = container_of(data, struct musb, irq_work); struct musb *musb = container_of(data, struct musb, irq_work.work);
musb_pm_runtime_check_session(musb); musb_pm_runtime_check_session(musb);
...@@ -1969,6 +1978,7 @@ static struct musb *allocate_instance(struct device *dev, ...@@ -1969,6 +1978,7 @@ static struct musb *allocate_instance(struct device *dev,
INIT_LIST_HEAD(&musb->control); INIT_LIST_HEAD(&musb->control);
INIT_LIST_HEAD(&musb->in_bulk); INIT_LIST_HEAD(&musb->in_bulk);
INIT_LIST_HEAD(&musb->out_bulk); INIT_LIST_HEAD(&musb->out_bulk);
INIT_LIST_HEAD(&musb->pending_list);
musb->vbuserr_retry = VBUSERR_RETRY_COUNT; musb->vbuserr_retry = VBUSERR_RETRY_COUNT;
musb->a_wait_bcon = OTG_TIME_A_WAIT_BCON; musb->a_wait_bcon = OTG_TIME_A_WAIT_BCON;
...@@ -2018,6 +2028,84 @@ static void musb_free(struct musb *musb) ...@@ -2018,6 +2028,84 @@ static void musb_free(struct musb *musb)
musb_host_free(musb); musb_host_free(musb);
} }
struct musb_pending_work {
int (*callback)(struct musb *musb, void *data);
void *data;
struct list_head node;
};
/*
* Called from musb_runtime_resume(), musb_resume(), and
* musb_queue_resume_work(). Callers must take musb->lock.
*/
static int musb_run_resume_work(struct musb *musb)
{
struct musb_pending_work *w, *_w;
unsigned long flags;
int error = 0;
spin_lock_irqsave(&musb->list_lock, flags);
list_for_each_entry_safe(w, _w, &musb->pending_list, node) {
if (w->callback) {
error = w->callback(musb, w->data);
if (error < 0) {
dev_err(musb->controller,
"resume callback %p failed: %i\n",
w->callback, error);
}
}
list_del(&w->node);
devm_kfree(musb->controller, w);
}
spin_unlock_irqrestore(&musb->list_lock, flags);
return error;
}
/*
* Called to run work if device is active or else queue the work to happen
* on resume. Caller must take musb->lock and must hold an RPM reference.
*
* Note that we cowardly refuse queuing work after musb PM runtime
* resume is done calling musb_run_resume_work() and return -EINPROGRESS
* instead.
*/
int musb_queue_resume_work(struct musb *musb,
int (*callback)(struct musb *musb, void *data),
void *data)
{
struct musb_pending_work *w;
unsigned long flags;
int error;
if (WARN_ON(!callback))
return -EINVAL;
if (pm_runtime_active(musb->controller))
return callback(musb, data);
w = devm_kzalloc(musb->controller, sizeof(*w), GFP_ATOMIC);
if (!w)
return -ENOMEM;
w->callback = callback;
w->data = data;
spin_lock_irqsave(&musb->list_lock, flags);
if (musb->is_runtime_suspended) {
list_add_tail(&w->node, &musb->pending_list);
error = 0;
} else {
dev_err(musb->controller, "could not add resume work %p\n",
callback);
devm_kfree(musb->controller, w);
error = -EINPROGRESS;
}
spin_unlock_irqrestore(&musb->list_lock, flags);
return error;
}
EXPORT_SYMBOL_GPL(musb_queue_resume_work);
static void musb_deassert_reset(struct work_struct *work) static void musb_deassert_reset(struct work_struct *work)
{ {
struct musb *musb; struct musb *musb;
...@@ -2065,6 +2153,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) ...@@ -2065,6 +2153,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
} }
spin_lock_init(&musb->lock); spin_lock_init(&musb->lock);
spin_lock_init(&musb->list_lock);
musb->board_set_power = plat->set_power; musb->board_set_power = plat->set_power;
musb->min_power = plat->min_power; musb->min_power = plat->min_power;
musb->ops = plat->platform_ops; musb->ops = plat->platform_ops;
...@@ -2208,7 +2297,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) ...@@ -2208,7 +2297,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
musb_generic_disable(musb); musb_generic_disable(musb);
/* Init IRQ workqueue before request_irq */ /* Init IRQ workqueue before request_irq */
INIT_WORK(&musb->irq_work, musb_irq_work); INIT_DELAYED_WORK(&musb->irq_work, musb_irq_work);
INIT_DELAYED_WORK(&musb->deassert_reset_work, musb_deassert_reset); INIT_DELAYED_WORK(&musb->deassert_reset_work, musb_deassert_reset);
INIT_DELAYED_WORK(&musb->finish_resume_work, musb_host_finish_resume); INIT_DELAYED_WORK(&musb->finish_resume_work, musb_host_finish_resume);
...@@ -2291,6 +2380,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) ...@@ -2291,6 +2380,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
if (status) if (status)
goto fail5; goto fail5;
musb->is_initialized = 1;
pm_runtime_mark_last_busy(musb->controller); pm_runtime_mark_last_busy(musb->controller);
pm_runtime_put_autosuspend(musb->controller); pm_runtime_put_autosuspend(musb->controller);
...@@ -2304,7 +2394,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) ...@@ -2304,7 +2394,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
musb_host_cleanup(musb); musb_host_cleanup(musb);
fail3: fail3:
cancel_work_sync(&musb->irq_work); cancel_delayed_work_sync(&musb->irq_work);
cancel_delayed_work_sync(&musb->finish_resume_work); cancel_delayed_work_sync(&musb->finish_resume_work);
cancel_delayed_work_sync(&musb->deassert_reset_work); cancel_delayed_work_sync(&musb->deassert_reset_work);
if (musb->dma_controller) if (musb->dma_controller)
...@@ -2371,7 +2461,7 @@ static int musb_remove(struct platform_device *pdev) ...@@ -2371,7 +2461,7 @@ static int musb_remove(struct platform_device *pdev)
*/ */
musb_exit_debugfs(musb); musb_exit_debugfs(musb);
cancel_work_sync(&musb->irq_work); cancel_delayed_work_sync(&musb->irq_work);
cancel_delayed_work_sync(&musb->finish_resume_work); cancel_delayed_work_sync(&musb->finish_resume_work);
cancel_delayed_work_sync(&musb->deassert_reset_work); cancel_delayed_work_sync(&musb->deassert_reset_work);
pm_runtime_get_sync(musb->controller); pm_runtime_get_sync(musb->controller);
...@@ -2557,6 +2647,7 @@ static int musb_suspend(struct device *dev) ...@@ -2557,6 +2647,7 @@ static int musb_suspend(struct device *dev)
musb_platform_disable(musb); musb_platform_disable(musb);
musb_generic_disable(musb); musb_generic_disable(musb);
WARN_ON(!list_empty(&musb->pending_list));
spin_lock_irqsave(&musb->lock, flags); spin_lock_irqsave(&musb->lock, flags);
...@@ -2578,9 +2669,11 @@ static int musb_suspend(struct device *dev) ...@@ -2578,9 +2669,11 @@ static int musb_suspend(struct device *dev)
static int musb_resume(struct device *dev) static int musb_resume(struct device *dev)
{ {
struct musb *musb = dev_to_musb(dev); struct musb *musb = dev_to_musb(dev);
u8 devctl; unsigned long flags;
u8 mask; int error;
u8 devctl;
u8 mask;
/* /*
* For static cmos like DaVinci, register values were preserved * For static cmos like DaVinci, register values were preserved
...@@ -2614,6 +2707,13 @@ static int musb_resume(struct device *dev) ...@@ -2614,6 +2707,13 @@ static int musb_resume(struct device *dev)
musb_start(musb); musb_start(musb);
spin_lock_irqsave(&musb->lock, flags);
error = musb_run_resume_work(musb);
if (error)
dev_err(musb->controller, "resume work failed with %i\n",
error);
spin_unlock_irqrestore(&musb->lock, flags);
return 0; return 0;
} }
...@@ -2622,14 +2722,16 @@ static int musb_runtime_suspend(struct device *dev) ...@@ -2622,14 +2722,16 @@ static int musb_runtime_suspend(struct device *dev)
struct musb *musb = dev_to_musb(dev); struct musb *musb = dev_to_musb(dev);
musb_save_context(musb); musb_save_context(musb);
musb->is_runtime_suspended = 1;
return 0; return 0;
} }
static int musb_runtime_resume(struct device *dev) static int musb_runtime_resume(struct device *dev)
{ {
struct musb *musb = dev_to_musb(dev); struct musb *musb = dev_to_musb(dev);
static int first = 1; unsigned long flags;
int error;
/* /*
* When pm_runtime_get_sync called for the first time in driver * When pm_runtime_get_sync called for the first time in driver
...@@ -2640,9 +2742,10 @@ static int musb_runtime_resume(struct device *dev) ...@@ -2640,9 +2742,10 @@ static int musb_runtime_resume(struct device *dev)
* Also context restore without save does not make * Also context restore without save does not make
* any sense * any sense
*/ */
if (!first) if (!musb->is_initialized)
musb_restore_context(musb); return 0;
first = 0;
musb_restore_context(musb);
if (musb->need_finish_resume) { if (musb->need_finish_resume) {
musb->need_finish_resume = 0; musb->need_finish_resume = 0;
...@@ -2650,6 +2753,14 @@ static int musb_runtime_resume(struct device *dev) ...@@ -2650,6 +2753,14 @@ static int musb_runtime_resume(struct device *dev)
msecs_to_jiffies(USB_RESUME_TIMEOUT)); msecs_to_jiffies(USB_RESUME_TIMEOUT));
} }
spin_lock_irqsave(&musb->lock, flags);
error = musb_run_resume_work(musb);
if (error)
dev_err(musb->controller, "resume work failed with %i\n",
error);
musb->is_runtime_suspended = 0;
spin_unlock_irqrestore(&musb->lock, flags);
return 0; return 0;
} }
......
...@@ -303,13 +303,14 @@ struct musb_context_registers { ...@@ -303,13 +303,14 @@ struct musb_context_registers {
struct musb { struct musb {
/* device lock */ /* device lock */
spinlock_t lock; spinlock_t lock;
spinlock_t list_lock; /* resume work list lock */
struct musb_io io; struct musb_io io;
const struct musb_platform_ops *ops; const struct musb_platform_ops *ops;
struct musb_context_registers context; struct musb_context_registers context;
irqreturn_t (*isr)(int, void *); irqreturn_t (*isr)(int, void *);
struct work_struct irq_work; struct delayed_work irq_work;
struct delayed_work deassert_reset_work; struct delayed_work deassert_reset_work;
struct delayed_work finish_resume_work; struct delayed_work finish_resume_work;
struct delayed_work gadget_work; struct delayed_work gadget_work;
...@@ -337,6 +338,7 @@ struct musb { ...@@ -337,6 +338,7 @@ struct musb {
struct list_head control; /* of musb_qh */ struct list_head control; /* of musb_qh */
struct list_head in_bulk; /* of musb_qh */ struct list_head in_bulk; /* of musb_qh */
struct list_head out_bulk; /* of musb_qh */ struct list_head out_bulk; /* of musb_qh */
struct list_head pending_list; /* pending work list */
struct timer_list otg_timer; struct timer_list otg_timer;
struct notifier_block nb; struct notifier_block nb;
...@@ -379,12 +381,15 @@ struct musb { ...@@ -379,12 +381,15 @@ struct musb {
int port_mode; /* MUSB_PORT_MODE_* */ int port_mode; /* MUSB_PORT_MODE_* */
bool session; bool session;
bool quirk_invalid_vbus; unsigned long quirk_retries;
bool is_host; bool is_host;
int a_wait_bcon; /* VBUS timeout in msecs */ int a_wait_bcon; /* VBUS timeout in msecs */
unsigned long idle_timeout; /* Next timeout in jiffies */ unsigned long idle_timeout; /* Next timeout in jiffies */
unsigned is_initialized:1;
unsigned is_runtime_suspended:1;
/* active means connected and not suspended */ /* active means connected and not suspended */
unsigned is_active:1; unsigned is_active:1;
...@@ -540,6 +545,10 @@ extern irqreturn_t musb_interrupt(struct musb *); ...@@ -540,6 +545,10 @@ extern irqreturn_t musb_interrupt(struct musb *);
extern void musb_hnp_stop(struct musb *musb); extern void musb_hnp_stop(struct musb *musb);
int musb_queue_resume_work(struct musb *musb,
int (*callback)(struct musb *musb, void *data),
void *data);
static inline void musb_platform_set_vbus(struct musb *musb, int is_on) static inline void musb_platform_set_vbus(struct musb *musb, int is_on)
{ {
if (musb->ops->set_vbus) if (musb->ops->set_vbus)
......
...@@ -185,24 +185,19 @@ static void dsps_musb_disable(struct musb *musb) ...@@ -185,24 +185,19 @@ static void dsps_musb_disable(struct musb *musb)
musb_writel(reg_base, wrp->coreintr_clear, wrp->usb_bitmap); musb_writel(reg_base, wrp->coreintr_clear, wrp->usb_bitmap);
musb_writel(reg_base, wrp->epintr_clear, musb_writel(reg_base, wrp->epintr_clear,
wrp->txep_bitmap | wrp->rxep_bitmap); wrp->txep_bitmap | wrp->rxep_bitmap);
del_timer_sync(&glue->timer);
musb_writeb(musb->mregs, MUSB_DEVCTL, 0); musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
} }
static void otg_timer(unsigned long _musb) /* Caller must take musb->lock */
static int dsps_check_status(struct musb *musb, void *unused)
{ {
struct musb *musb = (void *)_musb;
void __iomem *mregs = musb->mregs; void __iomem *mregs = musb->mregs;
struct device *dev = musb->controller; struct device *dev = musb->controller;
struct dsps_glue *glue = dev_get_drvdata(dev->parent); struct dsps_glue *glue = dev_get_drvdata(dev->parent);
const struct dsps_musb_wrapper *wrp = glue->wrp; const struct dsps_musb_wrapper *wrp = glue->wrp;
u8 devctl; u8 devctl;
unsigned long flags;
int skip_session = 0; int skip_session = 0;
int err;
err = pm_runtime_get_sync(dev);
if (err < 0)
dev_err(dev, "Poll could not pm_runtime_get: %i\n", err);
/* /*
* We poll because DSPS IP's won't expose several OTG-critical * We poll because DSPS IP's won't expose several OTG-critical
...@@ -212,7 +207,6 @@ static void otg_timer(unsigned long _musb) ...@@ -212,7 +207,6 @@ static void otg_timer(unsigned long _musb)
dev_dbg(musb->controller, "Poll devctl %02x (%s)\n", devctl, dev_dbg(musb->controller, "Poll devctl %02x (%s)\n", devctl,
usb_otg_state_string(musb->xceiv->otg->state)); usb_otg_state_string(musb->xceiv->otg->state));
spin_lock_irqsave(&musb->lock, flags);
switch (musb->xceiv->otg->state) { switch (musb->xceiv->otg->state) {
case OTG_STATE_A_WAIT_VRISE: case OTG_STATE_A_WAIT_VRISE:
mod_timer(&glue->timer, jiffies + mod_timer(&glue->timer, jiffies +
...@@ -245,8 +239,30 @@ static void otg_timer(unsigned long _musb) ...@@ -245,8 +239,30 @@ static void otg_timer(unsigned long _musb)
default: default:
break; break;
} }
spin_unlock_irqrestore(&musb->lock, flags);
return 0;
}
static void otg_timer(unsigned long _musb)
{
struct musb *musb = (void *)_musb;
struct device *dev = musb->controller;
unsigned long flags;
int err;
err = pm_runtime_get(dev);
if ((err != -EINPROGRESS) && err < 0) {
dev_err(dev, "Poll could not pm_runtime_get: %i\n", err);
pm_runtime_put_noidle(dev);
return;
}
spin_lock_irqsave(&musb->lock, flags);
err = musb_queue_resume_work(musb, dsps_check_status, NULL);
if (err < 0)
dev_err(dev, "%s resume work: %i\n", __func__, err);
spin_unlock_irqrestore(&musb->lock, flags);
pm_runtime_mark_last_busy(dev); pm_runtime_mark_last_busy(dev);
pm_runtime_put_autosuspend(dev); pm_runtime_put_autosuspend(dev);
} }
...@@ -767,28 +783,13 @@ static int dsps_probe(struct platform_device *pdev) ...@@ -767,28 +783,13 @@ static int dsps_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, glue); platform_set_drvdata(pdev, glue);
pm_runtime_enable(&pdev->dev); pm_runtime_enable(&pdev->dev);
pm_runtime_use_autosuspend(&pdev->dev);
pm_runtime_set_autosuspend_delay(&pdev->dev, 200);
ret = pm_runtime_get_sync(&pdev->dev);
if (ret < 0) {
dev_err(&pdev->dev, "pm_runtime_get_sync FAILED");
goto err2;
}
ret = dsps_create_musb_pdev(glue, pdev); ret = dsps_create_musb_pdev(glue, pdev);
if (ret) if (ret)
goto err3; goto err;
pm_runtime_mark_last_busy(&pdev->dev);
pm_runtime_put_autosuspend(&pdev->dev);
return 0; return 0;
err3: err:
pm_runtime_put_sync(&pdev->dev);
err2:
pm_runtime_dont_use_autosuspend(&pdev->dev);
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
return ret; return ret;
} }
...@@ -799,9 +800,6 @@ static int dsps_remove(struct platform_device *pdev) ...@@ -799,9 +800,6 @@ static int dsps_remove(struct platform_device *pdev)
platform_device_unregister(glue->musb); platform_device_unregister(glue->musb);
/* disable usbss clocks */
pm_runtime_dont_use_autosuspend(&pdev->dev);
pm_runtime_put_sync(&pdev->dev);
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
return 0; return 0;
......
...@@ -1114,7 +1114,7 @@ static int musb_gadget_enable(struct usb_ep *ep, ...@@ -1114,7 +1114,7 @@ static int musb_gadget_enable(struct usb_ep *ep,
musb_ep->dma ? "dma, " : "", musb_ep->dma ? "dma, " : "",
musb_ep->packet_sz); musb_ep->packet_sz);
schedule_work(&musb->irq_work); schedule_delayed_work(&musb->irq_work, 0);
fail: fail:
spin_unlock_irqrestore(&musb->lock, flags); spin_unlock_irqrestore(&musb->lock, flags);
...@@ -1158,7 +1158,7 @@ static int musb_gadget_disable(struct usb_ep *ep) ...@@ -1158,7 +1158,7 @@ static int musb_gadget_disable(struct usb_ep *ep)
musb_ep->desc = NULL; musb_ep->desc = NULL;
musb_ep->end_point.desc = NULL; musb_ep->end_point.desc = NULL;
schedule_work(&musb->irq_work); schedule_delayed_work(&musb->irq_work, 0);
spin_unlock_irqrestore(&(musb->lock), flags); spin_unlock_irqrestore(&(musb->lock), flags);
...@@ -1222,13 +1222,22 @@ void musb_ep_restart(struct musb *musb, struct musb_request *req) ...@@ -1222,13 +1222,22 @@ void musb_ep_restart(struct musb *musb, struct musb_request *req)
rxstate(musb, req); rxstate(musb, req);
} }
static int musb_ep_restart_resume_work(struct musb *musb, void *data)
{
struct musb_request *req = data;
musb_ep_restart(musb, req);
return 0;
}
static int musb_gadget_queue(struct usb_ep *ep, struct usb_request *req, static int musb_gadget_queue(struct usb_ep *ep, struct usb_request *req,
gfp_t gfp_flags) gfp_t gfp_flags)
{ {
struct musb_ep *musb_ep; struct musb_ep *musb_ep;
struct musb_request *request; struct musb_request *request;
struct musb *musb; struct musb *musb;
int status = 0; int status;
unsigned long lockflags; unsigned long lockflags;
if (!ep || !req) if (!ep || !req)
...@@ -1245,6 +1254,17 @@ static int musb_gadget_queue(struct usb_ep *ep, struct usb_request *req, ...@@ -1245,6 +1254,17 @@ static int musb_gadget_queue(struct usb_ep *ep, struct usb_request *req,
if (request->ep != musb_ep) if (request->ep != musb_ep)
return -EINVAL; return -EINVAL;
status = pm_runtime_get(musb->controller);
if ((status != -EINPROGRESS) && status < 0) {
dev_err(musb->controller,
"pm runtime get failed in %s\n",
__func__);
pm_runtime_put_noidle(musb->controller);
return status;
}
status = 0;
trace_musb_req_enq(request); trace_musb_req_enq(request);
/* request is mine now... */ /* request is mine now... */
...@@ -1255,7 +1275,6 @@ static int musb_gadget_queue(struct usb_ep *ep, struct usb_request *req, ...@@ -1255,7 +1275,6 @@ static int musb_gadget_queue(struct usb_ep *ep, struct usb_request *req,
map_dma_buffer(request, musb, musb_ep); map_dma_buffer(request, musb, musb_ep);
pm_runtime_get_sync(musb->controller);
spin_lock_irqsave(&musb->lock, lockflags); spin_lock_irqsave(&musb->lock, lockflags);
/* don't queue if the ep is down */ /* don't queue if the ep is down */
...@@ -1271,8 +1290,14 @@ static int musb_gadget_queue(struct usb_ep *ep, struct usb_request *req, ...@@ -1271,8 +1290,14 @@ static int musb_gadget_queue(struct usb_ep *ep, struct usb_request *req,
list_add_tail(&request->list, &musb_ep->req_list); list_add_tail(&request->list, &musb_ep->req_list);
/* it this is the head of the queue, start i/o ... */ /* it this is the head of the queue, start i/o ... */
if (!musb_ep->busy && &request->list == musb_ep->req_list.next) if (!musb_ep->busy && &request->list == musb_ep->req_list.next) {
musb_ep_restart(musb, request); status = musb_queue_resume_work(musb,
musb_ep_restart_resume_work,
request);
if (status < 0)
dev_err(musb->controller, "%s resume work: %i\n",
__func__, status);
}
unlock: unlock:
spin_unlock_irqrestore(&musb->lock, lockflags); spin_unlock_irqrestore(&musb->lock, lockflags);
...@@ -1969,7 +1994,7 @@ static int musb_gadget_stop(struct usb_gadget *g) ...@@ -1969,7 +1994,7 @@ static int musb_gadget_stop(struct usb_gadget *g)
*/ */
/* Force check of devctl register for PM runtime */ /* Force check of devctl register for PM runtime */
schedule_work(&musb->irq_work); schedule_delayed_work(&musb->irq_work, 0);
pm_runtime_mark_last_busy(musb->controller); pm_runtime_mark_last_busy(musb->controller);
pm_runtime_put_autosuspend(musb->controller); pm_runtime_put_autosuspend(musb->controller);
......
...@@ -513,17 +513,18 @@ static int omap2430_probe(struct platform_device *pdev) ...@@ -513,17 +513,18 @@ static int omap2430_probe(struct platform_device *pdev)
} }
pm_runtime_enable(glue->dev); pm_runtime_enable(glue->dev);
pm_runtime_use_autosuspend(glue->dev);
pm_runtime_set_autosuspend_delay(glue->dev, 100);
ret = platform_device_add(musb); ret = platform_device_add(musb);
if (ret) { if (ret) {
dev_err(&pdev->dev, "failed to register musb device\n"); dev_err(&pdev->dev, "failed to register musb device\n");
goto err2; goto err3;
} }
return 0; return 0;
err3:
pm_runtime_disable(glue->dev);
err2: err2:
platform_device_put(musb); platform_device_put(musb);
...@@ -535,10 +536,7 @@ static int omap2430_remove(struct platform_device *pdev) ...@@ -535,10 +536,7 @@ static int omap2430_remove(struct platform_device *pdev)
{ {
struct omap2430_glue *glue = platform_get_drvdata(pdev); struct omap2430_glue *glue = platform_get_drvdata(pdev);
pm_runtime_get_sync(glue->dev);
platform_device_unregister(glue->musb); platform_device_unregister(glue->musb);
pm_runtime_put_sync(glue->dev);
pm_runtime_dont_use_autosuspend(glue->dev);
pm_runtime_disable(glue->dev); pm_runtime_disable(glue->dev);
return 0; return 0;
......
...@@ -724,7 +724,7 @@ tusb_otg_ints(struct musb *musb, u32 int_src, void __iomem *tbase) ...@@ -724,7 +724,7 @@ tusb_otg_ints(struct musb *musb, u32 int_src, void __iomem *tbase)
dev_dbg(musb->controller, "vbus change, %s, otg %03x\n", dev_dbg(musb->controller, "vbus change, %s, otg %03x\n",
usb_otg_state_string(musb->xceiv->otg->state), otg_stat); usb_otg_state_string(musb->xceiv->otg->state), otg_stat);
idle_timeout = jiffies + (1 * HZ); idle_timeout = jiffies + (1 * HZ);
schedule_work(&musb->irq_work); schedule_delayed_work(&musb->irq_work, 0);
} else /* A-dev state machine */ { } else /* A-dev state machine */ {
dev_dbg(musb->controller, "vbus change, %s, otg %03x\n", dev_dbg(musb->controller, "vbus change, %s, otg %03x\n",
...@@ -814,7 +814,7 @@ tusb_otg_ints(struct musb *musb, u32 int_src, void __iomem *tbase) ...@@ -814,7 +814,7 @@ tusb_otg_ints(struct musb *musb, u32 int_src, void __iomem *tbase)
break; break;
} }
} }
schedule_work(&musb->irq_work); schedule_delayed_work(&musb->irq_work, 0);
return idle_timeout; return idle_timeout;
} }
...@@ -864,7 +864,7 @@ static irqreturn_t tusb_musb_interrupt(int irq, void *__hci) ...@@ -864,7 +864,7 @@ static irqreturn_t tusb_musb_interrupt(int irq, void *__hci)
musb_writel(tbase, TUSB_PRCM_WAKEUP_CLEAR, reg); musb_writel(tbase, TUSB_PRCM_WAKEUP_CLEAR, reg);
if (reg & ~TUSB_PRCM_WNORCS) { if (reg & ~TUSB_PRCM_WNORCS) {
musb->is_active = 1; musb->is_active = 1;
schedule_work(&musb->irq_work); schedule_delayed_work(&musb->irq_work, 0);
} }
dev_dbg(musb->controller, "wake %sactive %02x\n", dev_dbg(musb->controller, "wake %sactive %02x\n",
musb->is_active ? "" : "in", reg); musb->is_active ? "" : "in", reg);
......
...@@ -131,6 +131,7 @@ static const struct usb_device_id id_table[] = { ...@@ -131,6 +131,7 @@ static const struct usb_device_id id_table[] = {
{ USB_DEVICE(0x10C4, 0x88A4) }, /* MMB Networks ZigBee USB Device */ { USB_DEVICE(0x10C4, 0x88A4) }, /* MMB Networks ZigBee USB Device */
{ USB_DEVICE(0x10C4, 0x88A5) }, /* Planet Innovation Ingeni ZigBee USB Device */ { USB_DEVICE(0x10C4, 0x88A5) }, /* Planet Innovation Ingeni ZigBee USB Device */
{ USB_DEVICE(0x10C4, 0x8946) }, /* Ketra N1 Wireless Interface */ { USB_DEVICE(0x10C4, 0x8946) }, /* Ketra N1 Wireless Interface */
{ USB_DEVICE(0x10C4, 0x8962) }, /* Brim Brothers charging dock */
{ USB_DEVICE(0x10C4, 0x8977) }, /* CEL MeshWorks DevKit Device */ { USB_DEVICE(0x10C4, 0x8977) }, /* CEL MeshWorks DevKit Device */
{ USB_DEVICE(0x10C4, 0x8998) }, /* KCF Technologies PRN */ { USB_DEVICE(0x10C4, 0x8998) }, /* KCF Technologies PRN */
{ USB_DEVICE(0x10C4, 0x8A2A) }, /* HubZ dual ZigBee and Z-Wave dongle */ { USB_DEVICE(0x10C4, 0x8A2A) }, /* HubZ dual ZigBee and Z-Wave dongle */
......
...@@ -1012,6 +1012,8 @@ static const struct usb_device_id id_table_combined[] = { ...@@ -1012,6 +1012,8 @@ static const struct usb_device_id id_table_combined[] = {
{ USB_DEVICE(ICPDAS_VID, ICPDAS_I7561U_PID) }, { USB_DEVICE(ICPDAS_VID, ICPDAS_I7561U_PID) },
{ USB_DEVICE(ICPDAS_VID, ICPDAS_I7563U_PID) }, { USB_DEVICE(ICPDAS_VID, ICPDAS_I7563U_PID) },
{ USB_DEVICE(WICED_VID, WICED_USB20706V2_PID) }, { USB_DEVICE(WICED_VID, WICED_USB20706V2_PID) },
{ USB_DEVICE(TI_VID, TI_CC3200_LAUNCHPAD_PID),
.driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
{ } /* Terminating entry */ { } /* Terminating entry */
}; };
......
...@@ -595,6 +595,12 @@ ...@@ -595,6 +595,12 @@
#define ATMEL_VID 0x03eb /* Vendor ID */ #define ATMEL_VID 0x03eb /* Vendor ID */
#define STK541_PID 0x2109 /* Zigbee Controller */ #define STK541_PID 0x2109 /* Zigbee Controller */
/*
* Texas Instruments
*/
#define TI_VID 0x0451
#define TI_CC3200_LAUNCHPAD_PID 0xC32A /* SimpleLink Wi-Fi CC3200 LaunchPad */
/* /*
* Blackfin gnICE JTAG * Blackfin gnICE JTAG
* http://docs.blackfin.uclinux.org/doku.php?id=hw:jtag:gnice * http://docs.blackfin.uclinux.org/doku.php?id=hw:jtag:gnice
......
...@@ -954,10 +954,15 @@ int usb_stor_CB_transport(struct scsi_cmnd *srb, struct us_data *us) ...@@ -954,10 +954,15 @@ int usb_stor_CB_transport(struct scsi_cmnd *srb, struct us_data *us)
/* COMMAND STAGE */ /* COMMAND STAGE */
/* let's send the command via the control pipe */ /* let's send the command via the control pipe */
/*
* Command is sometime (f.e. after scsi_eh_prep_cmnd) on the stack.
* Stack may be vmallocated. So no DMA for us. Make a copy.
*/
memcpy(us->iobuf, srb->cmnd, srb->cmd_len);
result = usb_stor_ctrl_transfer(us, us->send_ctrl_pipe, result = usb_stor_ctrl_transfer(us, us->send_ctrl_pipe,
US_CBI_ADSC, US_CBI_ADSC,
USB_TYPE_CLASS | USB_RECIP_INTERFACE, 0, USB_TYPE_CLASS | USB_RECIP_INTERFACE, 0,
us->ifnum, srb->cmnd, srb->cmd_len); us->ifnum, us->iobuf, srb->cmd_len);
/* check the return code for the command */ /* check the return code for the command */
usb_stor_dbg(us, "Call to usb_stor_ctrl_transfer() returned %d\n", usb_stor_dbg(us, "Call to usb_stor_ctrl_transfer() returned %d\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment