Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 18fbb93f authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

Merge branch 'for-next' of master.kernel.org:/pub/scm/linux/kernel/git/balbi/usb into usb-next

* 'for-next' of master.kernel.org:/pub/scm/linux/kernel/git/balbi/usb:
  usb: gadget: m66592-udc: add pullup function
  usb: gadget: m66592-udc: add function for external controller
  usb: gadget: r8a66597-udc: add pullup function
  usb: gadget: zero: add superspeed support
  usb: gadget: add SS descriptors to Ethernet gadget
  usb: gadget: r8a66597-udc: add support for TEST_MODE
  usb: gadget: m66592-udc: add support for TEST_MODE
  usb: gadget: r8a66597-udc: Make BUSWAIT configurable through platform data
  usb: gadget: r8a66597-udc: fix cannot connect after rmmod gadget driver
  usb: update email address in r8a66597-udc and m66592-udc
  usb: musb: restore INDEX register in resume path
  usb: gadget: fix up depencies
  usb: gadget: fusb300_udc: fix compile warnings
  usb: gadget: ci13xx_udc.c: fix compile warning
  usb: gadget: net2272: fix compile warnings
  usb: gadget: langwell_udc: fix compile warnings
  usb: gadget: fusb300_udc: drop dead code
parents 3b872188 156833dc
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -157,6 +157,7 @@ config USB_FSL_USB2


config USB_FUSB300
config USB_FUSB300
	tristate "Faraday FUSB300 USB Peripheral Controller"
	tristate "Faraday FUSB300 USB Peripheral Controller"
	depends on !PHYS_ADDR_T_64BIT
	select USB_GADGET_DUALSPEED
	select USB_GADGET_DUALSPEED
	help
	help
	   Faraday usb device controller FUSB300 driver
	   Faraday usb device controller FUSB300 driver
@@ -427,6 +428,7 @@ config USB_GOKU
config USB_LANGWELL
config USB_LANGWELL
	tristate "Intel Langwell USB Device Controller"
	tristate "Intel Langwell USB Device Controller"
	depends on PCI
	depends on PCI
	depends on !PHYS_ADDR_T_64BIT
	select USB_GADGET_DUALSPEED
	select USB_GADGET_DUALSPEED
	help
	help
	   Intel Langwell USB Device Controller is a High-Speed USB
	   Intel Langwell USB Device Controller is a High-Speed USB
+10 −2
Original line number Original line Diff line number Diff line
@@ -1214,12 +1214,13 @@ static DEVICE_ATTR(qheads, S_IRUSR, show_qheads, NULL);
 *
 *
 * Check "device.h" for details
 * Check "device.h" for details
 */
 */
#define DUMP_ENTRIES	512
static ssize_t show_registers(struct device *dev,
static ssize_t show_registers(struct device *dev,
			      struct device_attribute *attr, char *buf)
			      struct device_attribute *attr, char *buf)
{
{
	struct ci13xxx *udc = container_of(dev, struct ci13xxx, gadget.dev);
	struct ci13xxx *udc = container_of(dev, struct ci13xxx, gadget.dev);
	unsigned long flags;
	unsigned long flags;
	u32 dump[512];
	u32 *dump;
	unsigned i, k, n = 0;
	unsigned i, k, n = 0;


	dbg_trace("[%s] %p\n", __func__, buf);
	dbg_trace("[%s] %p\n", __func__, buf);
@@ -1228,8 +1229,14 @@ static ssize_t show_registers(struct device *dev,
		return 0;
		return 0;
	}
	}


	dump = kmalloc(sizeof(u32) * DUMP_ENTRIES, GFP_KERNEL);
	if (!dump) {
		dev_err(dev, "%s: out of memory\n", __func__);
		return 0;
	}

	spin_lock_irqsave(udc->lock, flags);
	spin_lock_irqsave(udc->lock, flags);
	k = hw_register_read(dump, sizeof(dump)/sizeof(u32));
	k = hw_register_read(dump, DUMP_ENTRIES);
	spin_unlock_irqrestore(udc->lock, flags);
	spin_unlock_irqrestore(udc->lock, flags);


	for (i = 0; i < k; i++) {
	for (i = 0; i < k; i++) {
@@ -1237,6 +1244,7 @@ static ssize_t show_registers(struct device *dev,
			       "reg[0x%04X] = 0x%08X\n",
			       "reg[0x%04X] = 0x%08X\n",
			       i * (unsigned)sizeof(u32), dump[i]);
			       i * (unsigned)sizeof(u32), dump[i]);
	}
	}
	kfree(dump);


	return n;
	return n;
}
}
+1 −1
Original line number Original line Diff line number Diff line
@@ -401,7 +401,7 @@ static struct usb_composite_driver eth_driver = {
	.name		= "g_ether",
	.name		= "g_ether",
	.dev		= &device_desc,
	.dev		= &device_desc,
	.strings	= dev_strings,
	.strings	= dev_strings,
	.max_speed	= USB_SPEED_HIGH,
	.max_speed	= USB_SPEED_SUPER,
	.unbind		= __exit_p(eth_unbind),
	.unbind		= __exit_p(eth_unbind),
};
};


+98 −2
Original line number Original line Diff line number Diff line
@@ -77,7 +77,9 @@ static inline struct f_ecm *func_to_ecm(struct usb_function *f)
/* peak (theoretical) bulk transfer rate in bits-per-second */
/* peak (theoretical) bulk transfer rate in bits-per-second */
static inline unsigned ecm_bitrate(struct usb_gadget *g)
static inline unsigned ecm_bitrate(struct usb_gadget *g)
{
{
	if (gadget_is_dualspeed(g) && g->speed == USB_SPEED_HIGH)
	if (gadget_is_superspeed(g) && g->speed == USB_SPEED_SUPER)
		return 13 * 1024 * 8 * 1000 * 8;
	else if (gadget_is_dualspeed(g) && g->speed == USB_SPEED_HIGH)
		return 13 * 512 * 8 * 1000 * 8;
		return 13 * 512 * 8 * 1000 * 8;
	else
	else
		return 19 * 64 * 1 * 1000 * 8;
		return 19 * 64 * 1 * 1000 * 8;
@@ -210,8 +212,10 @@ static struct usb_descriptor_header *ecm_fs_function[] = {
	(struct usb_descriptor_header *) &ecm_header_desc,
	(struct usb_descriptor_header *) &ecm_header_desc,
	(struct usb_descriptor_header *) &ecm_union_desc,
	(struct usb_descriptor_header *) &ecm_union_desc,
	(struct usb_descriptor_header *) &ecm_desc,
	(struct usb_descriptor_header *) &ecm_desc,

	/* NOTE: status endpoint might need to be removed */
	/* NOTE: status endpoint might need to be removed */
	(struct usb_descriptor_header *) &fs_ecm_notify_desc,
	(struct usb_descriptor_header *) &fs_ecm_notify_desc,

	/* data interface, altsettings 0 and 1 */
	/* data interface, altsettings 0 and 1 */
	(struct usb_descriptor_header *) &ecm_data_nop_intf,
	(struct usb_descriptor_header *) &ecm_data_nop_intf,
	(struct usb_descriptor_header *) &ecm_data_intf,
	(struct usb_descriptor_header *) &ecm_data_intf,
@@ -231,6 +235,7 @@ static struct usb_endpoint_descriptor hs_ecm_notify_desc = {
	.wMaxPacketSize =	cpu_to_le16(ECM_STATUS_BYTECOUNT),
	.wMaxPacketSize =	cpu_to_le16(ECM_STATUS_BYTECOUNT),
	.bInterval =		LOG2_STATUS_INTERVAL_MSEC + 4,
	.bInterval =		LOG2_STATUS_INTERVAL_MSEC + 4,
};
};

static struct usb_endpoint_descriptor hs_ecm_in_desc = {
static struct usb_endpoint_descriptor hs_ecm_in_desc = {
	.bLength =		USB_DT_ENDPOINT_SIZE,
	.bLength =		USB_DT_ENDPOINT_SIZE,
	.bDescriptorType =	USB_DT_ENDPOINT,
	.bDescriptorType =	USB_DT_ENDPOINT,
@@ -255,8 +260,10 @@ static struct usb_descriptor_header *ecm_hs_function[] = {
	(struct usb_descriptor_header *) &ecm_header_desc,
	(struct usb_descriptor_header *) &ecm_header_desc,
	(struct usb_descriptor_header *) &ecm_union_desc,
	(struct usb_descriptor_header *) &ecm_union_desc,
	(struct usb_descriptor_header *) &ecm_desc,
	(struct usb_descriptor_header *) &ecm_desc,

	/* NOTE: status endpoint might need to be removed */
	/* NOTE: status endpoint might need to be removed */
	(struct usb_descriptor_header *) &hs_ecm_notify_desc,
	(struct usb_descriptor_header *) &hs_ecm_notify_desc,

	/* data interface, altsettings 0 and 1 */
	/* data interface, altsettings 0 and 1 */
	(struct usb_descriptor_header *) &ecm_data_nop_intf,
	(struct usb_descriptor_header *) &ecm_data_nop_intf,
	(struct usb_descriptor_header *) &ecm_data_intf,
	(struct usb_descriptor_header *) &ecm_data_intf,
@@ -265,6 +272,76 @@ static struct usb_descriptor_header *ecm_hs_function[] = {
	NULL,
	NULL,
};
};


/* super speed support: */

static struct usb_endpoint_descriptor ss_ecm_notify_desc = {
	.bLength =		USB_DT_ENDPOINT_SIZE,
	.bDescriptorType =	USB_DT_ENDPOINT,

	.bEndpointAddress =	USB_DIR_IN,
	.bmAttributes =		USB_ENDPOINT_XFER_INT,
	.wMaxPacketSize =	cpu_to_le16(ECM_STATUS_BYTECOUNT),
	.bInterval =		LOG2_STATUS_INTERVAL_MSEC + 4,
};

static struct usb_ss_ep_comp_descriptor ss_ecm_intr_comp_desc = {
	.bLength =		sizeof ss_ecm_intr_comp_desc,
	.bDescriptorType =	USB_DT_SS_ENDPOINT_COMP,

	/* the following 3 values can be tweaked if necessary */
	/* .bMaxBurst =		0, */
	/* .bmAttributes =	0, */
	.wBytesPerInterval =	cpu_to_le16(ECM_STATUS_BYTECOUNT),
};

static struct usb_endpoint_descriptor ss_ecm_in_desc = {
	.bLength =		USB_DT_ENDPOINT_SIZE,
	.bDescriptorType =	USB_DT_ENDPOINT,

	.bEndpointAddress =	USB_DIR_IN,
	.bmAttributes =		USB_ENDPOINT_XFER_BULK,
	.wMaxPacketSize =	cpu_to_le16(1024),
};

static struct usb_endpoint_descriptor ss_ecm_out_desc = {
	.bLength =		USB_DT_ENDPOINT_SIZE,
	.bDescriptorType =	USB_DT_ENDPOINT,

	.bEndpointAddress =	USB_DIR_OUT,
	.bmAttributes =		USB_ENDPOINT_XFER_BULK,
	.wMaxPacketSize =	cpu_to_le16(1024),
};

static struct usb_ss_ep_comp_descriptor ss_ecm_bulk_comp_desc = {
	.bLength =		sizeof ss_ecm_bulk_comp_desc,
	.bDescriptorType =	USB_DT_SS_ENDPOINT_COMP,

	/* the following 2 values can be tweaked if necessary */
	/* .bMaxBurst =		0, */
	/* .bmAttributes =	0, */
};

static struct usb_descriptor_header *ecm_ss_function[] = {
	/* CDC ECM control descriptors */
	(struct usb_descriptor_header *) &ecm_control_intf,
	(struct usb_descriptor_header *) &ecm_header_desc,
	(struct usb_descriptor_header *) &ecm_union_desc,
	(struct usb_descriptor_header *) &ecm_desc,

	/* NOTE: status endpoint might need to be removed */
	(struct usb_descriptor_header *) &ss_ecm_notify_desc,
	(struct usb_descriptor_header *) &ss_ecm_intr_comp_desc,

	/* data interface, altsettings 0 and 1 */
	(struct usb_descriptor_header *) &ecm_data_nop_intf,
	(struct usb_descriptor_header *) &ecm_data_intf,
	(struct usb_descriptor_header *) &ss_ecm_in_desc,
	(struct usb_descriptor_header *) &ss_ecm_bulk_comp_desc,
	(struct usb_descriptor_header *) &ss_ecm_out_desc,
	(struct usb_descriptor_header *) &ss_ecm_bulk_comp_desc,
	NULL,
};

/* string descriptors: */
/* string descriptors: */


static struct usb_string ecm_string_defs[] = {
static struct usb_string ecm_string_defs[] = {
@@ -679,6 +756,20 @@ ecm_bind(struct usb_configuration *c, struct usb_function *f)
			goto fail;
			goto fail;
	}
	}


	if (gadget_is_superspeed(c->cdev->gadget)) {
		ss_ecm_in_desc.bEndpointAddress =
				fs_ecm_in_desc.bEndpointAddress;
		ss_ecm_out_desc.bEndpointAddress =
				fs_ecm_out_desc.bEndpointAddress;
		ss_ecm_notify_desc.bEndpointAddress =
				fs_ecm_notify_desc.bEndpointAddress;

		/* copy descriptors, and track endpoint copies */
		f->ss_descriptors = usb_copy_descriptors(ecm_ss_function);
		if (!f->ss_descriptors)
			goto fail;
	}

	/* NOTE:  all that is done without knowing or caring about
	/* NOTE:  all that is done without knowing or caring about
	 * the network link ... which is unavailable to this code
	 * the network link ... which is unavailable to this code
	 * until we're activated via set_alt().
	 * until we're activated via set_alt().
@@ -688,6 +779,7 @@ ecm_bind(struct usb_configuration *c, struct usb_function *f)
	ecm->port.close = ecm_close;
	ecm->port.close = ecm_close;


	DBG(cdev, "CDC Ethernet: %s speed IN/%s OUT/%s NOTIFY/%s\n",
	DBG(cdev, "CDC Ethernet: %s speed IN/%s OUT/%s NOTIFY/%s\n",
			gadget_is_superspeed(c->cdev->gadget) ? "super" :
			gadget_is_dualspeed(c->cdev->gadget) ? "dual" : "full",
			gadget_is_dualspeed(c->cdev->gadget) ? "dual" : "full",
			ecm->port.in_ep->name, ecm->port.out_ep->name,
			ecm->port.in_ep->name, ecm->port.out_ep->name,
			ecm->notify->name);
			ecm->notify->name);
@@ -696,6 +788,8 @@ ecm_bind(struct usb_configuration *c, struct usb_function *f)
fail:
fail:
	if (f->descriptors)
	if (f->descriptors)
		usb_free_descriptors(f->descriptors);
		usb_free_descriptors(f->descriptors);
	if (f->hs_descriptors)
		usb_free_descriptors(f->hs_descriptors);


	if (ecm->notify_req) {
	if (ecm->notify_req) {
		kfree(ecm->notify_req->buf);
		kfree(ecm->notify_req->buf);
@@ -722,6 +816,8 @@ ecm_unbind(struct usb_configuration *c, struct usb_function *f)


	DBG(c->cdev, "ecm unbind\n");
	DBG(c->cdev, "ecm unbind\n");


	if (gadget_is_superspeed(c->cdev->gadget))
		usb_free_descriptors(f->ss_descriptors);
	if (gadget_is_dualspeed(c->cdev->gadget))
	if (gadget_is_dualspeed(c->cdev->gadget))
		usb_free_descriptors(f->hs_descriptors);
		usb_free_descriptors(f->hs_descriptors);
	usb_free_descriptors(f->descriptors);
	usb_free_descriptors(f->descriptors);
+56 −0
Original line number Original line Diff line number Diff line
@@ -115,6 +115,45 @@ static struct usb_descriptor_header *eem_hs_function[] __initdata = {
	NULL,
	NULL,
};
};


/* super speed support: */

static struct usb_endpoint_descriptor eem_ss_in_desc __initdata = {
	.bLength =		USB_DT_ENDPOINT_SIZE,
	.bDescriptorType =	USB_DT_ENDPOINT,

	.bEndpointAddress =	USB_DIR_IN,
	.bmAttributes =		USB_ENDPOINT_XFER_BULK,
	.wMaxPacketSize =	cpu_to_le16(1024),
};

static struct usb_endpoint_descriptor eem_ss_out_desc __initdata = {
	.bLength =		USB_DT_ENDPOINT_SIZE,
	.bDescriptorType =	USB_DT_ENDPOINT,

	.bEndpointAddress =	USB_DIR_OUT,
	.bmAttributes =		USB_ENDPOINT_XFER_BULK,
	.wMaxPacketSize =	cpu_to_le16(1024),
};

static struct usb_ss_ep_comp_descriptor eem_ss_bulk_comp_desc __initdata = {
	.bLength =		sizeof eem_ss_bulk_comp_desc,
	.bDescriptorType =	USB_DT_SS_ENDPOINT_COMP,

	/* the following 2 values can be tweaked if necessary */
	/* .bMaxBurst =		0, */
	/* .bmAttributes =	0, */
};

static struct usb_descriptor_header *eem_ss_function[] __initdata = {
	/* CDC EEM control descriptors */
	(struct usb_descriptor_header *) &eem_intf,
	(struct usb_descriptor_header *) &eem_ss_in_desc,
	(struct usb_descriptor_header *) &eem_ss_bulk_comp_desc,
	(struct usb_descriptor_header *) &eem_ss_out_desc,
	(struct usb_descriptor_header *) &eem_ss_bulk_comp_desc,
	NULL,
};

/* string descriptors: */
/* string descriptors: */


static struct usb_string eem_string_defs[] = {
static struct usb_string eem_string_defs[] = {
@@ -265,7 +304,20 @@ eem_bind(struct usb_configuration *c, struct usb_function *f)
			goto fail;
			goto fail;
	}
	}


	if (gadget_is_superspeed(c->cdev->gadget)) {
		eem_ss_in_desc.bEndpointAddress =
				eem_fs_in_desc.bEndpointAddress;
		eem_ss_out_desc.bEndpointAddress =
				eem_fs_out_desc.bEndpointAddress;

		/* copy descriptors, and track endpoint copies */
		f->ss_descriptors = usb_copy_descriptors(eem_ss_function);
		if (!f->ss_descriptors)
			goto fail;
	}

	DBG(cdev, "CDC Ethernet (EEM): %s speed IN/%s OUT/%s\n",
	DBG(cdev, "CDC Ethernet (EEM): %s speed IN/%s OUT/%s\n",
			gadget_is_superspeed(c->cdev->gadget) ? "super" :
			gadget_is_dualspeed(c->cdev->gadget) ? "dual" : "full",
			gadget_is_dualspeed(c->cdev->gadget) ? "dual" : "full",
			eem->port.in_ep->name, eem->port.out_ep->name);
			eem->port.in_ep->name, eem->port.out_ep->name);
	return 0;
	return 0;
@@ -273,6 +325,8 @@ eem_bind(struct usb_configuration *c, struct usb_function *f)
fail:
fail:
	if (f->descriptors)
	if (f->descriptors)
		usb_free_descriptors(f->descriptors);
		usb_free_descriptors(f->descriptors);
	if (f->hs_descriptors)
		usb_free_descriptors(f->hs_descriptors);


	/* we might as well release our claims on endpoints */
	/* we might as well release our claims on endpoints */
	if (eem->port.out_ep->desc)
	if (eem->port.out_ep->desc)
@@ -292,6 +346,8 @@ eem_unbind(struct usb_configuration *c, struct usb_function *f)


	DBG(c->cdev, "eem unbind\n");
	DBG(c->cdev, "eem unbind\n");


	if (gadget_is_superspeed(c->cdev->gadget))
		usb_free_descriptors(f->ss_descriptors);
	if (gadget_is_dualspeed(c->cdev->gadget))
	if (gadget_is_dualspeed(c->cdev->gadget))
		usb_free_descriptors(f->hs_descriptors);
		usb_free_descriptors(f->hs_descriptors);
	usb_free_descriptors(f->descriptors);
	usb_free_descriptors(f->descriptors);
Loading