mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-05 10:29:37 +00:00
usb: fixes for v3.16-rc2
dwc3-omap won't crash anymore on module removal and suspend/resume won't kill xHCI interrupts. MUSB got a fix to handle Babble condition only in host mode, how it should be. The f_fs function driver got a fix for a NULL pointer dereference. Renesas gadget got a fix for Status stage handling. Signed-of-by: Felipe Balbi <balbi@ti.com> -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJTpEX2AAoJEIaOsuA1yqREcccP/is1rX6M+SDH0TaM2Vq1+VoV 4Bm4jnjYpshYKYUvFoF4nTvo19JGXZOkJXD+TEyxpXnWTvpMFLAhVIXAXLMTFC9H N8OsX5k19dtMMsWn6E4cRetNgr4dUtkhlWBp7a06MfqOvLBgn1pfuRYa58hKMs63 dfkT/HAk4txMN6ad2E5P+ProHD5s9oGU4fOUaEQLvJ+Gm5L9yAZgN/Odpv1z+56q pwMT+NgCN77XJnuYepxZaPbz8oOKXS7L+2XOeo+uLBRcCw7dKZVcqIjf39QzQHij 1ucOJtXLQxOeraqATTQ7NczR79fqC3WdI+G6s+HRzDIQmYRTxEklauY9o4lEWLER pXBnohPe1/kN0TfAaEN7wxySiTZj8GDFanDoN97w+QoYuLyOKrdw92Mfp/J85puk 7Dt1eyaj2S/6cdY+FKhGkTu3qls88SYRrWm/xj6OLhpbx8iGI8F7g7lxN5p7Mi/M 9eKiKtynk3yXhPugwKbXdZ32WufUQe80MJzEa+rElKSgN6cWYG2okUa6MyQhzLSV x61F9caN6QgDpaeorj0YWjhOvrz55/BIwUD18BxtW7DZN8H1kCvulKNRq8RJ2PiJ jJmNIXqHc/fBQzgGpAzyyGbqlhl12K3Z3SYaZSh2g5XOfB0U9E5MayYPtuTeW9/t znreJWiUzUE2sz35kTjn =ZVy4 -----END PGP SIGNATURE----- Merge tag 'fixes-for-v3.16-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-linus usb: fixes for v3.16-rc2 dwc3-omap won't crash anymore on module removal and suspend/resume won't kill xHCI interrupts. MUSB got a fix to handle Babble condition only in host mode, how it should be. The f_fs function driver got a fix for a NULL pointer dereference. Renesas gadget got a fix for Status stage handling. Signed-of-by: Felipe Balbi <balbi@ti.com>
This commit is contained in:
commit
135e7d0d4a
15 changed files with 92 additions and 39 deletions
|
@ -45,6 +45,7 @@ comment "Platform Glue Driver Support"
|
|||
config USB_DWC3_OMAP
|
||||
tristate "Texas Instruments OMAP5 and similar Platforms"
|
||||
depends on EXTCON && (ARCH_OMAP2PLUS || COMPILE_TEST)
|
||||
depends on OF
|
||||
default USB_DWC3
|
||||
help
|
||||
Some platforms from Texas Instruments like OMAP5, DRA7xxx and
|
||||
|
|
|
@ -322,7 +322,7 @@ static int dwc3_omap_remove_core(struct device *dev, void *c)
|
|||
{
|
||||
struct platform_device *pdev = to_platform_device(dev);
|
||||
|
||||
platform_device_unregister(pdev);
|
||||
of_device_unregister(pdev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -599,7 +599,7 @@ static int dwc3_omap_prepare(struct device *dev)
|
|||
{
|
||||
struct dwc3_omap *omap = dev_get_drvdata(dev);
|
||||
|
||||
dwc3_omap_disable_irqs(omap);
|
||||
dwc3_omap_write_irqmisc_set(omap, 0x00);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -607,8 +607,19 @@ static int dwc3_omap_prepare(struct device *dev)
|
|||
static void dwc3_omap_complete(struct device *dev)
|
||||
{
|
||||
struct dwc3_omap *omap = dev_get_drvdata(dev);
|
||||
u32 reg;
|
||||
|
||||
dwc3_omap_enable_irqs(omap);
|
||||
reg = (USBOTGSS_IRQMISC_OEVT |
|
||||
USBOTGSS_IRQMISC_DRVVBUS_RISE |
|
||||
USBOTGSS_IRQMISC_CHRGVBUS_RISE |
|
||||
USBOTGSS_IRQMISC_DISCHRGVBUS_RISE |
|
||||
USBOTGSS_IRQMISC_IDPULLUP_RISE |
|
||||
USBOTGSS_IRQMISC_DRVVBUS_FALL |
|
||||
USBOTGSS_IRQMISC_CHRGVBUS_FALL |
|
||||
USBOTGSS_IRQMISC_DISCHRGVBUS_FALL |
|
||||
USBOTGSS_IRQMISC_IDPULLUP_FALL);
|
||||
|
||||
dwc3_omap_write_irqmisc_set(omap, reg);
|
||||
}
|
||||
|
||||
static int dwc3_omap_suspend(struct device *dev)
|
||||
|
|
|
@ -828,10 +828,6 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep,
|
|||
length, last ? " last" : "",
|
||||
chain ? " chain" : "");
|
||||
|
||||
/* Skip the LINK-TRB on ISOC */
|
||||
if (((dep->free_slot & DWC3_TRB_MASK) == DWC3_TRB_NUM - 1) &&
|
||||
usb_endpoint_xfer_isoc(dep->endpoint.desc))
|
||||
dep->free_slot++;
|
||||
|
||||
trb = &dep->trb_pool[dep->free_slot & DWC3_TRB_MASK];
|
||||
|
||||
|
@ -843,6 +839,10 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep,
|
|||
}
|
||||
|
||||
dep->free_slot++;
|
||||
/* Skip the LINK-TRB on ISOC */
|
||||
if (((dep->free_slot & DWC3_TRB_MASK) == DWC3_TRB_NUM - 1) &&
|
||||
usb_endpoint_xfer_isoc(dep->endpoint.desc))
|
||||
dep->free_slot++;
|
||||
|
||||
trb->size = DWC3_TRB_SIZE_LENGTH(length);
|
||||
trb->bpl = lower_32_bits(dma);
|
||||
|
|
|
@ -1145,15 +1145,15 @@ static struct configfs_item_operations interf_item_ops = {
|
|||
.store_attribute = usb_os_desc_attr_store,
|
||||
};
|
||||
|
||||
static ssize_t rndis_grp_compatible_id_show(struct usb_os_desc *desc,
|
||||
char *page)
|
||||
static ssize_t interf_grp_compatible_id_show(struct usb_os_desc *desc,
|
||||
char *page)
|
||||
{
|
||||
memcpy(page, desc->ext_compat_id, 8);
|
||||
return 8;
|
||||
}
|
||||
|
||||
static ssize_t rndis_grp_compatible_id_store(struct usb_os_desc *desc,
|
||||
const char *page, size_t len)
|
||||
static ssize_t interf_grp_compatible_id_store(struct usb_os_desc *desc,
|
||||
const char *page, size_t len)
|
||||
{
|
||||
int l;
|
||||
|
||||
|
@ -1171,20 +1171,20 @@ static ssize_t rndis_grp_compatible_id_store(struct usb_os_desc *desc,
|
|||
return len;
|
||||
}
|
||||
|
||||
static struct usb_os_desc_attribute rndis_grp_attr_compatible_id =
|
||||
static struct usb_os_desc_attribute interf_grp_attr_compatible_id =
|
||||
__CONFIGFS_ATTR(compatible_id, S_IRUGO | S_IWUSR,
|
||||
rndis_grp_compatible_id_show,
|
||||
rndis_grp_compatible_id_store);
|
||||
interf_grp_compatible_id_show,
|
||||
interf_grp_compatible_id_store);
|
||||
|
||||
static ssize_t rndis_grp_sub_compatible_id_show(struct usb_os_desc *desc,
|
||||
char *page)
|
||||
static ssize_t interf_grp_sub_compatible_id_show(struct usb_os_desc *desc,
|
||||
char *page)
|
||||
{
|
||||
memcpy(page, desc->ext_compat_id + 8, 8);
|
||||
return 8;
|
||||
}
|
||||
|
||||
static ssize_t rndis_grp_sub_compatible_id_store(struct usb_os_desc *desc,
|
||||
const char *page, size_t len)
|
||||
static ssize_t interf_grp_sub_compatible_id_store(struct usb_os_desc *desc,
|
||||
const char *page, size_t len)
|
||||
{
|
||||
int l;
|
||||
|
||||
|
@ -1202,20 +1202,21 @@ static ssize_t rndis_grp_sub_compatible_id_store(struct usb_os_desc *desc,
|
|||
return len;
|
||||
}
|
||||
|
||||
static struct usb_os_desc_attribute rndis_grp_attr_sub_compatible_id =
|
||||
static struct usb_os_desc_attribute interf_grp_attr_sub_compatible_id =
|
||||
__CONFIGFS_ATTR(sub_compatible_id, S_IRUGO | S_IWUSR,
|
||||
rndis_grp_sub_compatible_id_show,
|
||||
rndis_grp_sub_compatible_id_store);
|
||||
interf_grp_sub_compatible_id_show,
|
||||
interf_grp_sub_compatible_id_store);
|
||||
|
||||
static struct configfs_attribute *interf_grp_attrs[] = {
|
||||
&rndis_grp_attr_compatible_id.attr,
|
||||
&rndis_grp_attr_sub_compatible_id.attr,
|
||||
&interf_grp_attr_compatible_id.attr,
|
||||
&interf_grp_attr_sub_compatible_id.attr,
|
||||
NULL
|
||||
};
|
||||
|
||||
int usb_os_desc_prepare_interf_dir(struct config_group *parent,
|
||||
int n_interf,
|
||||
struct usb_os_desc **desc,
|
||||
char **names,
|
||||
struct module *owner)
|
||||
{
|
||||
struct config_group **f_default_groups, *os_desc_group,
|
||||
|
@ -1257,8 +1258,8 @@ int usb_os_desc_prepare_interf_dir(struct config_group *parent,
|
|||
d = desc[n_interf];
|
||||
d->owner = owner;
|
||||
config_group_init_type_name(&d->group, "", interface_type);
|
||||
config_item_set_name(&d->group.cg_item, "interface.%d",
|
||||
n_interf);
|
||||
config_item_set_name(&d->group.cg_item, "interface.%s",
|
||||
names[n_interf]);
|
||||
interface_groups[n_interf] = &d->group;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ void unregister_gadget_item(struct config_item *item);
|
|||
int usb_os_desc_prepare_interf_dir(struct config_group *parent,
|
||||
int n_interf,
|
||||
struct usb_os_desc **desc,
|
||||
char **names,
|
||||
struct module *owner);
|
||||
|
||||
static inline struct usb_os_desc *to_usb_os_desc(struct config_item *item)
|
||||
|
|
|
@ -1483,11 +1483,13 @@ static int functionfs_bind(struct ffs_data *ffs, struct usb_composite_dev *cdev)
|
|||
ffs->ep0req->context = ffs;
|
||||
|
||||
lang = ffs->stringtabs;
|
||||
for (lang = ffs->stringtabs; *lang; ++lang) {
|
||||
struct usb_string *str = (*lang)->strings;
|
||||
int id = first_id;
|
||||
for (; str->s; ++id, ++str)
|
||||
str->id = id;
|
||||
if (lang) {
|
||||
for (; *lang; ++lang) {
|
||||
struct usb_string *str = (*lang)->strings;
|
||||
int id = first_id;
|
||||
for (; str->s; ++id, ++str)
|
||||
str->id = id;
|
||||
}
|
||||
}
|
||||
|
||||
ffs->gadget = cdev->gadget;
|
||||
|
|
|
@ -687,7 +687,7 @@ rndis_bind(struct usb_configuration *c, struct usb_function *f)
|
|||
f->os_desc_table = kzalloc(sizeof(*f->os_desc_table),
|
||||
GFP_KERNEL);
|
||||
if (!f->os_desc_table)
|
||||
return PTR_ERR(f->os_desc_table);
|
||||
return -ENOMEM;
|
||||
f->os_desc_n = 1;
|
||||
f->os_desc_table[0].os_desc = &rndis_opts->rndis_os_desc;
|
||||
}
|
||||
|
@ -905,6 +905,7 @@ static struct usb_function_instance *rndis_alloc_inst(void)
|
|||
{
|
||||
struct f_rndis_opts *opts;
|
||||
struct usb_os_desc *descs[1];
|
||||
char *names[1];
|
||||
|
||||
opts = kzalloc(sizeof(*opts), GFP_KERNEL);
|
||||
if (!opts)
|
||||
|
@ -922,8 +923,9 @@ static struct usb_function_instance *rndis_alloc_inst(void)
|
|||
INIT_LIST_HEAD(&opts->rndis_os_desc.ext_prop);
|
||||
|
||||
descs[0] = &opts->rndis_os_desc;
|
||||
names[0] = "rndis";
|
||||
usb_os_desc_prepare_interf_dir(&opts->func_inst.group, 1, descs,
|
||||
THIS_MODULE);
|
||||
names, THIS_MODULE);
|
||||
config_group_init_type_name(&opts->func_inst.group, "",
|
||||
&rndis_func_type);
|
||||
|
||||
|
|
|
@ -1264,8 +1264,13 @@ dev_release (struct inode *inode, struct file *fd)
|
|||
|
||||
kfree (dev->buf);
|
||||
dev->buf = NULL;
|
||||
put_dev (dev);
|
||||
|
||||
/* other endpoints were all decoupled from this device */
|
||||
spin_lock_irq(&dev->lock);
|
||||
dev->state = STATE_DEV_DISABLED;
|
||||
spin_unlock_irq(&dev->lock);
|
||||
|
||||
put_dev (dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1120,7 +1120,10 @@ void gether_disconnect(struct gether *link)
|
|||
|
||||
DBG(dev, "%s\n", __func__);
|
||||
|
||||
netif_tx_lock(dev->net);
|
||||
netif_stop_queue(dev->net);
|
||||
netif_tx_unlock(dev->net);
|
||||
|
||||
netif_carrier_off(dev->net);
|
||||
|
||||
/* disable endpoints, forcing (synchronous) completion
|
||||
|
|
|
@ -849,7 +849,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
|
|||
}
|
||||
|
||||
/* handle babble condition */
|
||||
if (int_usb & MUSB_INTR_BABBLE)
|
||||
if (int_usb & MUSB_INTR_BABBLE && is_host_active(musb))
|
||||
schedule_work(&musb->recover_work);
|
||||
|
||||
#if 0
|
||||
|
|
|
@ -274,7 +274,6 @@ static int ux500_probe(struct platform_device *pdev)
|
|||
musb->dev.parent = &pdev->dev;
|
||||
musb->dev.dma_mask = &pdev->dev.coherent_dma_mask;
|
||||
musb->dev.coherent_dma_mask = pdev->dev.coherent_dma_mask;
|
||||
musb->dev.of_node = pdev->dev.of_node;
|
||||
|
||||
glue->dev = &pdev->dev;
|
||||
glue->musb = musb;
|
||||
|
|
|
@ -681,6 +681,14 @@ static int usbhsf_pio_try_pop(struct usbhs_pkt *pkt, int *is_done)
|
|||
usbhs_pipe_number(pipe),
|
||||
pkt->length, pkt->actual, *is_done, pkt->zero);
|
||||
|
||||
/*
|
||||
* Transmission end
|
||||
*/
|
||||
if (*is_done) {
|
||||
if (usbhs_pipe_is_dcp(pipe))
|
||||
usbhs_dcp_control_transfer_done(pipe);
|
||||
}
|
||||
|
||||
usbhs_fifo_read_busy:
|
||||
usbhsf_fifo_unselect(pipe, fifo);
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ struct usb_endpoint_descriptor_no_audio {
|
|||
* structure. Any flags that are not recognised cause the whole block to be
|
||||
* rejected with -ENOSYS.
|
||||
*
|
||||
* Legacy descriptors format:
|
||||
* Legacy descriptors format (deprecated as of 3.14):
|
||||
*
|
||||
* | off | name | type | description |
|
||||
* |-----+-----------+--------------+--------------------------------------|
|
||||
|
|
|
@ -6,7 +6,11 @@ WARNINGS = -Wall -Wextra
|
|||
CFLAGS = $(WARNINGS) -g -I../include
|
||||
LDFLAGS = $(PTHREAD_LIBS)
|
||||
|
||||
all: testusb ffs-test
|
||||
all: testusb ffs-test ffs-test-legacy
|
||||
|
||||
ffs-test-legacy: ffs-test.c
|
||||
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) -DUSE_LEGACY_DESC_HEAD
|
||||
|
||||
%: %.c
|
||||
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* ffs-test.c.c -- user mode filesystem api for usb composite function
|
||||
* ffs-test.c -- user mode filesystem api for usb composite function
|
||||
*
|
||||
* Copyright (C) 2010 Samsung Electronics
|
||||
* Author: Michal Nazarewicz <mina86@mina86.com>
|
||||
|
@ -21,6 +21,8 @@
|
|||
|
||||
/* $(CROSS_COMPILE)cc -Wall -Wextra -g -o ffs-test ffs-test.c -lpthread */
|
||||
|
||||
/* Uncomment to make the tool use legacy FFS descriptor headers. */
|
||||
/* #define USE_LEGACY_DESC_HEAD */
|
||||
|
||||
#define _BSD_SOURCE /* for endian.h */
|
||||
|
||||
|
@ -106,7 +108,15 @@ static void _msg(unsigned level, const char *fmt, ...)
|
|||
/******************** Descriptors and Strings *******************************/
|
||||
|
||||
static const struct {
|
||||
struct usb_functionfs_descs_head header;
|
||||
struct {
|
||||
__le32 magic;
|
||||
__le32 length;
|
||||
#ifndef USE_LEGACY_DESC_HEAD
|
||||
__le32 flags;
|
||||
#endif
|
||||
__le32 fs_count;
|
||||
__le32 hs_count;
|
||||
} __attribute__((packed)) header;
|
||||
struct {
|
||||
struct usb_interface_descriptor intf;
|
||||
struct usb_endpoint_descriptor_no_audio sink;
|
||||
|
@ -114,7 +124,13 @@ static const struct {
|
|||
} __attribute__((packed)) fs_descs, hs_descs;
|
||||
} __attribute__((packed)) descriptors = {
|
||||
.header = {
|
||||
#ifdef USE_LEGACY_DESC_HEAD
|
||||
.magic = cpu_to_le32(FUNCTIONFS_DESCRIPTORS_MAGIC),
|
||||
#else
|
||||
.magic = cpu_to_le32(FUNCTIONFS_DESCRIPTORS_MAGIC_V2),
|
||||
.flags = cpu_to_le32(FUNCTIONFS_HAS_FS_DESC |
|
||||
FUNCTIONFS_HAS_HS_DESC),
|
||||
#endif
|
||||
.length = cpu_to_le32(sizeof descriptors),
|
||||
.fs_count = 3,
|
||||
.hs_count = 3,
|
||||
|
|
Loading…
Reference in a new issue