Commit 0fd7a820 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Merge tag 'fixes-for-v3.14-rc4' of...

Merge tag 'fixes-for-v3.14-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-linus

Felipe writes:

usb: fixes for v3.14-rc4

Here are 10 fixes for our current -rc cycle. It's likely
the last round of fixes for this merge window. All patches
have soaked for a long time and have all been tested in real
HW.

The most interesting fixes are a fix for enumeration of superspeed
hubs when MUSB is acting as host, and a remote-wakeup fix also on
MUSB.
Signed-of-by: default avatarFelipe Balbi <balbi@ti.com>
parents 64fe1891 9ccfaf74
...@@ -360,24 +360,30 @@ static inline void usb_dma_writel(struct bcm63xx_udc *udc, u32 val, u32 off) ...@@ -360,24 +360,30 @@ static inline void usb_dma_writel(struct bcm63xx_udc *udc, u32 val, u32 off)
bcm_writel(val, udc->iudma_regs + off); bcm_writel(val, udc->iudma_regs + off);
} }
static inline u32 usb_dmac_readl(struct bcm63xx_udc *udc, u32 off) static inline u32 usb_dmac_readl(struct bcm63xx_udc *udc, u32 off, int chan)
{ {
return bcm_readl(udc->iudma_regs + IUDMA_DMAC_OFFSET + off); return bcm_readl(udc->iudma_regs + IUDMA_DMAC_OFFSET + off +
(ENETDMA_CHAN_WIDTH * chan));
} }
static inline void usb_dmac_writel(struct bcm63xx_udc *udc, u32 val, u32 off) static inline void usb_dmac_writel(struct bcm63xx_udc *udc, u32 val, u32 off,
int chan)
{ {
bcm_writel(val, udc->iudma_regs + IUDMA_DMAC_OFFSET + off); bcm_writel(val, udc->iudma_regs + IUDMA_DMAC_OFFSET + off +
(ENETDMA_CHAN_WIDTH * chan));
} }
static inline u32 usb_dmas_readl(struct bcm63xx_udc *udc, u32 off) static inline u32 usb_dmas_readl(struct bcm63xx_udc *udc, u32 off, int chan)
{ {
return bcm_readl(udc->iudma_regs + IUDMA_DMAS_OFFSET + off); return bcm_readl(udc->iudma_regs + IUDMA_DMAS_OFFSET + off +
(ENETDMA_CHAN_WIDTH * chan));
} }
static inline void usb_dmas_writel(struct bcm63xx_udc *udc, u32 val, u32 off) static inline void usb_dmas_writel(struct bcm63xx_udc *udc, u32 val, u32 off,
int chan)
{ {
bcm_writel(val, udc->iudma_regs + IUDMA_DMAS_OFFSET + off); bcm_writel(val, udc->iudma_regs + IUDMA_DMAS_OFFSET + off +
(ENETDMA_CHAN_WIDTH * chan));
} }
static inline void set_clocks(struct bcm63xx_udc *udc, bool is_enabled) static inline void set_clocks(struct bcm63xx_udc *udc, bool is_enabled)
...@@ -638,7 +644,7 @@ static void iudma_write(struct bcm63xx_udc *udc, struct iudma_ch *iudma, ...@@ -638,7 +644,7 @@ static void iudma_write(struct bcm63xx_udc *udc, struct iudma_ch *iudma,
} while (!last_bd); } while (!last_bd);
usb_dmac_writel(udc, ENETDMAC_CHANCFG_EN_MASK, usb_dmac_writel(udc, ENETDMAC_CHANCFG_EN_MASK,
ENETDMAC_CHANCFG_REG(iudma->ch_idx)); ENETDMAC_CHANCFG_REG, iudma->ch_idx);
} }
/** /**
...@@ -694,9 +700,9 @@ static void iudma_reset_channel(struct bcm63xx_udc *udc, struct iudma_ch *iudma) ...@@ -694,9 +700,9 @@ static void iudma_reset_channel(struct bcm63xx_udc *udc, struct iudma_ch *iudma)
bcm63xx_fifo_reset_ep(udc, max(0, iudma->ep_num)); bcm63xx_fifo_reset_ep(udc, max(0, iudma->ep_num));
/* stop DMA, then wait for the hardware to wrap up */ /* stop DMA, then wait for the hardware to wrap up */
usb_dmac_writel(udc, 0, ENETDMAC_CHANCFG_REG(ch_idx)); usb_dmac_writel(udc, 0, ENETDMAC_CHANCFG_REG, ch_idx);
while (usb_dmac_readl(udc, ENETDMAC_CHANCFG_REG(ch_idx)) & while (usb_dmac_readl(udc, ENETDMAC_CHANCFG_REG, ch_idx) &
ENETDMAC_CHANCFG_EN_MASK) { ENETDMAC_CHANCFG_EN_MASK) {
udelay(1); udelay(1);
...@@ -713,10 +719,10 @@ static void iudma_reset_channel(struct bcm63xx_udc *udc, struct iudma_ch *iudma) ...@@ -713,10 +719,10 @@ static void iudma_reset_channel(struct bcm63xx_udc *udc, struct iudma_ch *iudma)
dev_warn(udc->dev, "forcibly halting IUDMA channel %d\n", dev_warn(udc->dev, "forcibly halting IUDMA channel %d\n",
ch_idx); ch_idx);
usb_dmac_writel(udc, ENETDMAC_CHANCFG_BUFHALT_MASK, usb_dmac_writel(udc, ENETDMAC_CHANCFG_BUFHALT_MASK,
ENETDMAC_CHANCFG_REG(ch_idx)); ENETDMAC_CHANCFG_REG, ch_idx);
} }
} }
usb_dmac_writel(udc, ~0, ENETDMAC_IR_REG(ch_idx)); usb_dmac_writel(udc, ~0, ENETDMAC_IR_REG, ch_idx);
/* don't leave "live" HW-owned entries for the next guy to step on */ /* don't leave "live" HW-owned entries for the next guy to step on */
for (d = iudma->bd_ring; d <= iudma->end_bd; d++) for (d = iudma->bd_ring; d <= iudma->end_bd; d++)
...@@ -728,11 +734,11 @@ static void iudma_reset_channel(struct bcm63xx_udc *udc, struct iudma_ch *iudma) ...@@ -728,11 +734,11 @@ static void iudma_reset_channel(struct bcm63xx_udc *udc, struct iudma_ch *iudma)
/* set up IRQs, UBUS burst size, and BD base for this channel */ /* set up IRQs, UBUS burst size, and BD base for this channel */
usb_dmac_writel(udc, ENETDMAC_IR_BUFDONE_MASK, usb_dmac_writel(udc, ENETDMAC_IR_BUFDONE_MASK,
ENETDMAC_IRMASK_REG(ch_idx)); ENETDMAC_IRMASK_REG, ch_idx);
usb_dmac_writel(udc, 8, ENETDMAC_MAXBURST_REG(ch_idx)); usb_dmac_writel(udc, 8, ENETDMAC_MAXBURST_REG, ch_idx);
usb_dmas_writel(udc, iudma->bd_ring_dma, ENETDMAS_RSTART_REG(ch_idx)); usb_dmas_writel(udc, iudma->bd_ring_dma, ENETDMAS_RSTART_REG, ch_idx);
usb_dmas_writel(udc, 0, ENETDMAS_SRAM2_REG(ch_idx)); usb_dmas_writel(udc, 0, ENETDMAS_SRAM2_REG, ch_idx);
} }
/** /**
...@@ -2035,7 +2041,7 @@ static irqreturn_t bcm63xx_udc_data_isr(int irq, void *dev_id) ...@@ -2035,7 +2041,7 @@ static irqreturn_t bcm63xx_udc_data_isr(int irq, void *dev_id)
spin_lock(&udc->lock); spin_lock(&udc->lock);
usb_dmac_writel(udc, ENETDMAC_IR_BUFDONE_MASK, usb_dmac_writel(udc, ENETDMAC_IR_BUFDONE_MASK,
ENETDMAC_IR_REG(iudma->ch_idx)); ENETDMAC_IR_REG, iudma->ch_idx);
bep = iudma->bep; bep = iudma->bep;
rc = iudma_read(udc, iudma); rc = iudma_read(udc, iudma);
...@@ -2175,18 +2181,18 @@ static int bcm63xx_iudma_dbg_show(struct seq_file *s, void *p) ...@@ -2175,18 +2181,18 @@ static int bcm63xx_iudma_dbg_show(struct seq_file *s, void *p)
seq_printf(s, " [ep%d]:\n", seq_printf(s, " [ep%d]:\n",
max_t(int, iudma_defaults[ch_idx].ep_num, 0)); max_t(int, iudma_defaults[ch_idx].ep_num, 0));
seq_printf(s, " cfg: %08x; irqstat: %08x; irqmask: %08x; maxburst: %08x\n", seq_printf(s, " cfg: %08x; irqstat: %08x; irqmask: %08x; maxburst: %08x\n",
usb_dmac_readl(udc, ENETDMAC_CHANCFG_REG(ch_idx)), usb_dmac_readl(udc, ENETDMAC_CHANCFG_REG, ch_idx),
usb_dmac_readl(udc, ENETDMAC_IR_REG(ch_idx)), usb_dmac_readl(udc, ENETDMAC_IR_REG, ch_idx),
usb_dmac_readl(udc, ENETDMAC_IRMASK_REG(ch_idx)), usb_dmac_readl(udc, ENETDMAC_IRMASK_REG, ch_idx),
usb_dmac_readl(udc, ENETDMAC_MAXBURST_REG(ch_idx))); usb_dmac_readl(udc, ENETDMAC_MAXBURST_REG, ch_idx));
sram2 = usb_dmas_readl(udc, ENETDMAS_SRAM2_REG(ch_idx)); sram2 = usb_dmas_readl(udc, ENETDMAS_SRAM2_REG, ch_idx);
sram3 = usb_dmas_readl(udc, ENETDMAS_SRAM3_REG(ch_idx)); sram3 = usb_dmas_readl(udc, ENETDMAS_SRAM3_REG, ch_idx);
seq_printf(s, " base: %08x; index: %04x_%04x; desc: %04x_%04x %08x\n", seq_printf(s, " base: %08x; index: %04x_%04x; desc: %04x_%04x %08x\n",
usb_dmas_readl(udc, ENETDMAS_RSTART_REG(ch_idx)), usb_dmas_readl(udc, ENETDMAS_RSTART_REG, ch_idx),
sram2 >> 16, sram2 & 0xffff, sram2 >> 16, sram2 & 0xffff,
sram3 >> 16, sram3 & 0xffff, sram3 >> 16, sram3 & 0xffff,
usb_dmas_readl(udc, ENETDMAS_SRAM4_REG(ch_idx))); usb_dmas_readl(udc, ENETDMAS_SRAM4_REG, ch_idx));
seq_printf(s, " desc: %d/%d used", iudma->n_bds_used, seq_printf(s, " desc: %d/%d used", iudma->n_bds_used,
iudma->n_bds); iudma->n_bds);
......
...@@ -585,7 +585,6 @@ static ssize_t ffs_epfile_io(struct file *file, ...@@ -585,7 +585,6 @@ static ssize_t ffs_epfile_io(struct file *file,
char __user *buf, size_t len, int read) char __user *buf, size_t len, int read)
{ {
struct ffs_epfile *epfile = file->private_data; struct ffs_epfile *epfile = file->private_data;
struct usb_gadget *gadget = epfile->ffs->gadget;
struct ffs_ep *ep; struct ffs_ep *ep;
char *data = NULL; char *data = NULL;
ssize_t ret, data_len; ssize_t ret, data_len;
...@@ -621,6 +620,12 @@ static ssize_t ffs_epfile_io(struct file *file, ...@@ -621,6 +620,12 @@ static ssize_t ffs_epfile_io(struct file *file,
/* Allocate & copy */ /* Allocate & copy */
if (!halt) { if (!halt) {
/*
* if we _do_ wait above, the epfile->ffs->gadget might be NULL
* before the waiting completes, so do not assign to 'gadget' earlier
*/
struct usb_gadget *gadget = epfile->ffs->gadget;
/* /*
* Controller may require buffer size to be aligned to * Controller may require buffer size to be aligned to
* maxpacketsize of an out endpoint. * maxpacketsize of an out endpoint.
......
...@@ -1157,7 +1157,7 @@ static int __init printer_bind_config(struct usb_configuration *c) ...@@ -1157,7 +1157,7 @@ static int __init printer_bind_config(struct usb_configuration *c)
usb_gadget_set_selfpowered(gadget); usb_gadget_set_selfpowered(gadget);
if (gadget->is_otg) { if (gadget_is_otg(gadget)) {
otg_descriptor.bmAttributes |= USB_OTG_HNP; otg_descriptor.bmAttributes |= USB_OTG_HNP;
printer_cfg_driver.descriptors = otg_desc; printer_cfg_driver.descriptors = otg_desc;
printer_cfg_driver.bmAttributes |= USB_CONFIG_ATT_WAKEUP; printer_cfg_driver.bmAttributes |= USB_CONFIG_ATT_WAKEUP;
......
...@@ -1629,7 +1629,7 @@ static void s3c2410_udc_reinit(struct s3c2410_udc *dev) ...@@ -1629,7 +1629,7 @@ static void s3c2410_udc_reinit(struct s3c2410_udc *dev)
ep->ep.desc = NULL; ep->ep.desc = NULL;
ep->halted = 0; ep->halted = 0;
INIT_LIST_HEAD(&ep->queue); INIT_LIST_HEAD(&ep->queue);
usb_ep_set_maxpacket_limit(&ep->ep, &ep->ep.maxpacket); usb_ep_set_maxpacket_limit(&ep->ep, ep->ep.maxpacket);
} }
} }
......
...@@ -2160,11 +2160,19 @@ static void musb_restore_context(struct musb *musb) ...@@ -2160,11 +2160,19 @@ static void musb_restore_context(struct musb *musb)
void __iomem *musb_base = musb->mregs; void __iomem *musb_base = musb->mregs;
void __iomem *ep_target_regs; void __iomem *ep_target_regs;
void __iomem *epio; void __iomem *epio;
u8 power;
musb_writew(musb_base, MUSB_FRAME, musb->context.frame); musb_writew(musb_base, MUSB_FRAME, musb->context.frame);
musb_writeb(musb_base, MUSB_TESTMODE, musb->context.testmode); musb_writeb(musb_base, MUSB_TESTMODE, musb->context.testmode);
musb_write_ulpi_buscontrol(musb->mregs, musb->context.busctl); musb_write_ulpi_buscontrol(musb->mregs, musb->context.busctl);
musb_writeb(musb_base, MUSB_POWER, musb->context.power);
/* Don't affect SUSPENDM/RESUME bits in POWER reg */
power = musb_readb(musb_base, MUSB_POWER);
power &= MUSB_POWER_SUSPENDM | MUSB_POWER_RESUME;
musb->context.power &= ~(MUSB_POWER_SUSPENDM | MUSB_POWER_RESUME);
power |= musb->context.power;
musb_writeb(musb_base, MUSB_POWER, power);
musb_writew(musb_base, MUSB_INTRTXE, musb->intrtxe); musb_writew(musb_base, MUSB_INTRTXE, musb->intrtxe);
musb_writew(musb_base, MUSB_INTRRXE, musb->intrrxe); musb_writew(musb_base, MUSB_INTRRXE, musb->intrrxe);
musb_writeb(musb_base, MUSB_INTRUSBE, musb->context.intrusbe); musb_writeb(musb_base, MUSB_INTRUSBE, musb->context.intrusbe);
......
...@@ -1183,6 +1183,9 @@ irqreturn_t musb_h_ep0_irq(struct musb *musb) ...@@ -1183,6 +1183,9 @@ irqreturn_t musb_h_ep0_irq(struct musb *musb)
csr = MUSB_CSR0_H_STATUSPKT csr = MUSB_CSR0_H_STATUSPKT
| MUSB_CSR0_TXPKTRDY; | MUSB_CSR0_TXPKTRDY;
/* disable ping token in status phase */
csr |= MUSB_CSR0_H_DIS_PING;
/* flag status stage */ /* flag status stage */
musb->ep0_stage = MUSB_EP0_STATUS; musb->ep0_stage = MUSB_EP0_STATUS;
......
...@@ -659,7 +659,6 @@ static int omap2430_runtime_suspend(struct device *dev) ...@@ -659,7 +659,6 @@ static int omap2430_runtime_suspend(struct device *dev)
OTG_INTERFSEL); OTG_INTERFSEL);
omap2430_low_level_exit(musb); omap2430_low_level_exit(musb);
phy_power_off(musb->phy);
} }
return 0; return 0;
...@@ -674,7 +673,6 @@ static int omap2430_runtime_resume(struct device *dev) ...@@ -674,7 +673,6 @@ static int omap2430_runtime_resume(struct device *dev)
omap2430_low_level_init(musb); omap2430_low_level_init(musb);
musb_writel(musb->mregs, OTG_INTERFSEL, musb_writel(musb->mregs, OTG_INTERFSEL,
musb->context.otg_interfsel); musb->context.otg_interfsel);
phy_power_on(musb->phy);
} }
return 0; return 0;
......
...@@ -159,32 +159,6 @@ static int msm_hsusb_ldo_init(struct msm_otg *motg, int init) ...@@ -159,32 +159,6 @@ static int msm_hsusb_ldo_init(struct msm_otg *motg, int init)
return rc; return rc;
} }
#ifdef CONFIG_PM_SLEEP
#define USB_PHY_SUSP_DIG_VOL 500000
static int msm_hsusb_config_vddcx(int high)
{
int max_vol = USB_PHY_VDD_DIG_VOL_MAX;
int min_vol;
int ret;
if (high)
min_vol = USB_PHY_VDD_DIG_VOL_MIN;
else
min_vol = USB_PHY_SUSP_DIG_VOL;
ret = regulator_set_voltage(hsusb_vddcx, min_vol, max_vol);
if (ret) {
pr_err("%s: unable to set the voltage for regulator "
"HSUSB_VDDCX\n", __func__);
return ret;
}
pr_debug("%s: min_vol:%d max_vol:%d\n", __func__, min_vol, max_vol);
return ret;
}
#endif
static int msm_hsusb_ldo_set_mode(int on) static int msm_hsusb_ldo_set_mode(int on)
{ {
int ret = 0; int ret = 0;
...@@ -440,7 +414,32 @@ static int msm_otg_reset(struct usb_phy *phy) ...@@ -440,7 +414,32 @@ static int msm_otg_reset(struct usb_phy *phy)
#define PHY_SUSPEND_TIMEOUT_USEC (500 * 1000) #define PHY_SUSPEND_TIMEOUT_USEC (500 * 1000)
#define PHY_RESUME_TIMEOUT_USEC (100 * 1000) #define PHY_RESUME_TIMEOUT_USEC (100 * 1000)
#ifdef CONFIG_PM_SLEEP #ifdef CONFIG_PM
#define USB_PHY_SUSP_DIG_VOL 500000
static int msm_hsusb_config_vddcx(int high)
{
int max_vol = USB_PHY_VDD_DIG_VOL_MAX;
int min_vol;
int ret;
if (high)
min_vol = USB_PHY_VDD_DIG_VOL_MIN;
else
min_vol = USB_PHY_SUSP_DIG_VOL;
ret = regulator_set_voltage(hsusb_vddcx, min_vol, max_vol);
if (ret) {
pr_err("%s: unable to set the voltage for regulator "
"HSUSB_VDDCX\n", __func__);
return ret;
}
pr_debug("%s: min_vol:%d max_vol:%d\n", __func__, min_vol, max_vol);
return ret;
}
static int msm_otg_suspend(struct msm_otg *motg) static int msm_otg_suspend(struct msm_otg *motg)
{ {
struct usb_phy *phy = &motg->phy; struct usb_phy *phy = &motg->phy;
...@@ -1733,22 +1732,18 @@ static int msm_otg_pm_resume(struct device *dev) ...@@ -1733,22 +1732,18 @@ static int msm_otg_pm_resume(struct device *dev)
} }
#endif #endif
#ifdef CONFIG_PM
static const struct dev_pm_ops msm_otg_dev_pm_ops = { static const struct dev_pm_ops msm_otg_dev_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(msm_otg_pm_suspend, msm_otg_pm_resume) SET_SYSTEM_SLEEP_PM_OPS(msm_otg_pm_suspend, msm_otg_pm_resume)
SET_RUNTIME_PM_OPS(msm_otg_runtime_suspend, msm_otg_runtime_resume, SET_RUNTIME_PM_OPS(msm_otg_runtime_suspend, msm_otg_runtime_resume,
msm_otg_runtime_idle) msm_otg_runtime_idle)
}; };
#endif
static struct platform_driver msm_otg_driver = { static struct platform_driver msm_otg_driver = {
.remove = msm_otg_remove, .remove = msm_otg_remove,
.driver = { .driver = {
.name = DRIVER_NAME, .name = DRIVER_NAME,
.owner = THIS_MODULE, .owner = THIS_MODULE,
#ifdef CONFIG_PM
.pm = &msm_otg_dev_pm_ops, .pm = &msm_otg_dev_pm_ops,
#endif
}, },
}; };
......
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