Skip to content

Commit

Permalink
Merge branch 'for-next/gadget' of git://git.kernel.org/pub/scm/linux/…
Browse files Browse the repository at this point in the history
…kernel/git/balbi/usb into usb-next

* 'for-next/gadget' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb: (50 commits)
  usb: renesas_usbhs: show error reason on usbhsh_urb_enqueu()
  usb: renesas_usbhs: add force packet remove method
  usb: renesas_usbhs: care usb_hcd_giveback_urb() status
  usb: renesas_usbhs: add usbhsh_is_running()
  usb: renesas_usbhs: disable attch irq after device attached
  usb: renesas_usbhs: care pipe sequence
  usb: renesas_usbhs: add usbhs_pipe_attach() method
  usb: renesas_usbhs: add usbhsh_endpoint_detach_all() for error case
  usb: renesas_usbhs: modify device attach method
  usb: renesas_usbhs: pop packet when urb dequeued
  usb: renesas_usbhs: add lost error value when enqueue
  usb: gadget: mv_udc: replace some debug info
  usb: gadget: mv_udc: refine suspend/resume function
  usb: gadget: mv_udc: refine the clock relative code
  usb: gadget: mv_udc: disable ISR when stopped
  usb: gadget: mv_udc: add otg relative code
  usb: gadget: Use kcalloc instead of kzalloc to allocate array
  usb: renesas_usbhs: remove the_controller_link
  usb: renesas_usbhs: add test-mode support
  usb: renesas_usbhs: call usbhsg_queue_pop() when pipe disable.
  ...
  • Loading branch information
Greg Kroah-Hartman committed Dec 13, 2011
2 parents a1016ce + 15a3838 commit 121a8cd
Show file tree
Hide file tree
Showing 49 changed files with 1,134 additions and 595 deletions.
14 changes: 14 additions & 0 deletions Documentation/feature-removal-schedule.txt
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,20 @@ Why: In 3.0, we can now autodetect internal 3G device and already have
information log when acer-wmi initial.
Who: Lee, Chun-Yi <jlee@novell.com>

---------------------------

What: /sys/devices/platform/_UDC_/udc/_UDC_/is_dualspeed file and
is_dualspeed line in /sys/devices/platform/ci13xxx_*/udc/device file.
When: 3.8
Why: The is_dualspeed file is superseded by maximum_speed in the same
directory and is_dualspeed line in device file is superseded by
max_speed line in the same file.

The maximum_speed/max_speed specifies maximum speed supported by UDC.
To check if dualspeeed is supported, check if the value is >= 3.
Various possible speeds are defined in <linux/usb/ch9.h>.
Who: Michal Nazarewicz <mina86@mina86.com>

----------------------------

What: The XFS nodelaylog mount option
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/dwc3/gadget.c
Original file line number Diff line number Diff line change
Expand Up @@ -2087,7 +2087,7 @@ int __devinit dwc3_gadget_init(struct dwc3 *dwc)
dev_set_name(&dwc->gadget.dev, "gadget");

dwc->gadget.ops = &dwc3_gadget_ops;
dwc->gadget.is_dualspeed = true;
dwc->gadget.max_speed = USB_SPEED_SUPER;
dwc->gadget.speed = USB_SPEED_UNKNOWN;
dwc->gadget.dev.parent = dwc->dev;

Expand Down
1 change: 0 additions & 1 deletion drivers/usb/gadget/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,6 @@ config USB_R8A66597

config USB_RENESAS_USBHS_UDC
tristate 'Renesas USBHS controller'
depends on SUPERH || ARCH_SHMOBILE
depends on USB_RENESAS_USBHS
select USB_GADGET_DUALSPEED
help
Expand Down
4 changes: 2 additions & 2 deletions drivers/usb/gadget/amd5536udc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1959,7 +1959,7 @@ static int amd5536_start(struct usb_gadget_driver *driver,
u32 tmp;

if (!driver || !bind || !driver->setup
|| driver->speed < USB_SPEED_HIGH)
|| driver->max_speed < USB_SPEED_HIGH)
return -EINVAL;
if (!dev)
return -ENODEV;
Expand Down Expand Up @@ -3349,7 +3349,7 @@ static int udc_probe(struct udc *dev)
dev_set_name(&dev->gadget.dev, "gadget");
dev->gadget.dev.release = gadget_release;
dev->gadget.name = name;
dev->gadget.is_dualspeed = 1;
dev->gadget.max_speed = USB_SPEED_HIGH;

/* init registers, interrupts, ... */
startup_registers(dev);
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/gadget/at91_udc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1633,7 +1633,7 @@ static int at91_start(struct usb_gadget_driver *driver,
unsigned long flags;

if (!driver
|| driver->speed < USB_SPEED_FULL
|| driver->max_speed < USB_SPEED_FULL
|| !bind
|| !driver->setup) {
DBG("bad parameter.\n");
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/gadget/atmel_usba_udc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1038,7 +1038,7 @@ static struct usba_udc the_udc = {
.gadget = {
.ops = &usba_udc_ops,
.ep_list = LIST_HEAD_INIT(the_udc.gadget.ep_list),
.is_dualspeed = 1,
.max_speed = USB_SPEED_HIGH,
.name = "atmel_usba_udc",
.dev = {
.init_name = "gadget",
Expand Down
36 changes: 24 additions & 12 deletions drivers/usb/gadget/ci13xxx_udc.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,16 @@ static inline int hw_ep_bit(int num, int dir)
return num + (dir ? 16 : 0);
}

static int ep_to_bit(int n)
{
int fill = 16 - hw_ep_max / 2;

if (n >= hw_ep_max / 2)
n += fill;

return n;
}

/**
* hw_aread: reads from register bitfield
* @addr: address relative to bus map
Expand Down Expand Up @@ -440,12 +450,13 @@ static int hw_ep_get_halt(int num, int dir)
/**
* hw_test_and_clear_setup_status: test & clear setup status (execute without
* interruption)
* @n: bit number (endpoint)
* @n: endpoint number
*
* This function returns setup status
*/
static int hw_test_and_clear_setup_status(int n)
{
n = ep_to_bit(n);
return hw_ctest_and_clear(CAP_ENDPTSETUPSTAT, BIT(n));
}

Expand Down Expand Up @@ -641,12 +652,13 @@ static int hw_register_write(u16 addr, u32 data)
/**
* hw_test_and_clear_complete: test & clear complete status (execute without
* interruption)
* @n: bit number (endpoint)
* @n: endpoint number
*
* This function returns complete status
*/
static int hw_test_and_clear_complete(int n)
{
n = ep_to_bit(n);
return hw_ctest_and_clear(CAP_ENDPTCOMPLETE, BIT(n));
}

Expand Down Expand Up @@ -754,8 +766,11 @@ static ssize_t show_device(struct device *dev, struct device_attribute *attr,

n += scnprintf(buf + n, PAGE_SIZE - n, "speed = %d\n",
gadget->speed);
n += scnprintf(buf + n, PAGE_SIZE - n, "max_speed = %d\n",
gadget->max_speed);
/* TODO: Scheduled for removal in 3.8. */
n += scnprintf(buf + n, PAGE_SIZE - n, "is_dualspeed = %d\n",
gadget->is_dualspeed);
gadget_is_dualspeed(gadget));
n += scnprintf(buf + n, PAGE_SIZE - n, "is_otg = %d\n",
gadget->is_otg);
n += scnprintf(buf + n, PAGE_SIZE - n, "is_a_peripheral = %d\n",
Expand Down Expand Up @@ -798,7 +813,7 @@ static ssize_t show_driver(struct device *dev, struct device_attribute *attr,
n += scnprintf(buf + n, PAGE_SIZE - n, "function = %s\n",
(driver->function ? driver->function : ""));
n += scnprintf(buf + n, PAGE_SIZE - n, "max speed = %d\n",
driver->speed);
driver->max_speed);

return n;
}
Expand Down Expand Up @@ -2563,9 +2578,7 @@ static int ci13xxx_start(struct usb_gadget_driver *driver,
if (driver == NULL ||
bind == NULL ||
driver->setup == NULL ||
driver->disconnect == NULL ||
driver->suspend == NULL ||
driver->resume == NULL)
driver->disconnect == NULL)
return -EINVAL;
else if (udc == NULL)
return -ENODEV;
Expand Down Expand Up @@ -2693,8 +2706,6 @@ static int ci13xxx_stop(struct usb_gadget_driver *driver)
driver->unbind == NULL ||
driver->setup == NULL ||
driver->disconnect == NULL ||
driver->suspend == NULL ||
driver->resume == NULL ||
driver != udc->driver)
return -EINVAL;

Expand Down Expand Up @@ -2793,7 +2804,7 @@ static irqreturn_t udc_irq(void)
isr_statistics.pci++;
udc->gadget.speed = hw_port_is_high_speed() ?
USB_SPEED_HIGH : USB_SPEED_FULL;
if (udc->suspended) {
if (udc->suspended && udc->driver->resume) {
spin_unlock(udc->lock);
udc->driver->resume(&udc->gadget);
spin_lock(udc->lock);
Expand All @@ -2807,7 +2818,8 @@ static irqreturn_t udc_irq(void)
isr_tr_complete_handler(udc);
}
if (USBi_SLI & intr) {
if (udc->gadget.speed != USB_SPEED_UNKNOWN) {
if (udc->gadget.speed != USB_SPEED_UNKNOWN &&
udc->driver->suspend) {
udc->suspended = 1;
spin_unlock(udc->lock);
udc->driver->suspend(&udc->gadget);
Expand Down Expand Up @@ -2871,7 +2883,7 @@ static int udc_probe(struct ci13xxx_udc_driver *driver, struct device *dev,

udc->gadget.ops = &usb_gadget_ops;
udc->gadget.speed = USB_SPEED_UNKNOWN;
udc->gadget.is_dualspeed = 1;
udc->gadget.max_speed = USB_SPEED_HIGH;
udc->gadget.is_otg = 0;
udc->gadget.name = driver->name;

Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/gadget/ci13xxx_udc.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ struct ci13xxx {
struct ci13xxx_ep ci13xxx_ep[ENDPT_MAX]; /* extended endpts */
u32 ep0_dir; /* ep0 direction */
#define ep0out ci13xxx_ep[0]
#define ep0in ci13xxx_ep[16]
#define ep0in ci13xxx_ep[hw_ep_max / 2]
u8 remote_wakeup; /* Is remote wakeup feature
enabled by the host? */
u8 suspended; /* suspended by the host */
Expand Down
8 changes: 4 additions & 4 deletions drivers/usb/gadget/composite.c
Original file line number Diff line number Diff line change
Expand Up @@ -1535,9 +1535,9 @@ composite_resume(struct usb_gadget *gadget)

static struct usb_gadget_driver composite_driver = {
#ifdef CONFIG_USB_GADGET_SUPERSPEED
.speed = USB_SPEED_SUPER,
.max_speed = USB_SPEED_SUPER,
#else
.speed = USB_SPEED_HIGH,
.max_speed = USB_SPEED_HIGH,
#endif

.unbind = composite_unbind,
Expand Down Expand Up @@ -1584,8 +1584,8 @@ int usb_composite_probe(struct usb_composite_driver *driver,
driver->iProduct = driver->name;
composite_driver.function = (char *) driver->name;
composite_driver.driver.name = driver->name;
composite_driver.speed = min((u8)composite_driver.speed,
(u8)driver->max_speed);
composite_driver.max_speed =
min_t(u8, composite_driver.max_speed, driver->max_speed);
composite = driver;
composite_gadget_bind = bind;

Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/gadget/dbgp.c
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ static int dbgp_setup(struct usb_gadget *gadget,

static struct usb_gadget_driver dbgp_driver = {
.function = "dbgp",
.speed = USB_SPEED_HIGH,
.max_speed = USB_SPEED_HIGH,
.unbind = dbgp_unbind,
.setup = dbgp_setup,
.disconnect = dbgp_disconnect,
Expand Down
15 changes: 7 additions & 8 deletions drivers/usb/gadget/dummy_hcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -823,19 +823,18 @@ static int dummy_pullup (struct usb_gadget *_gadget, int value)

if (value && dum->driver) {
if (mod_data.is_super_speed)
dum->gadget.speed = dum->driver->speed;
dum->gadget.speed = dum->driver->max_speed;
else if (mod_data.is_high_speed)
dum->gadget.speed = min_t(u8, USB_SPEED_HIGH,
dum->driver->speed);
dum->driver->max_speed);
else
dum->gadget.speed = USB_SPEED_FULL;
dummy_udc_udpate_ep0(dum);

if (dum->gadget.speed < dum->driver->speed)
if (dum->gadget.speed < dum->driver->max_speed)
dev_dbg(udc_dev(dum), "This device can perform faster"
" if you connect it to a %s port...\n",
(dum->driver->speed == USB_SPEED_SUPER ?
"SuperSpeed" : "HighSpeed"));
" if you connect it to a %s port...\n",
usb_speed_string(dum->driver->max_speed));
}
dum_hcd = gadget_to_dummy_hcd(_gadget);

Expand Down Expand Up @@ -898,7 +897,7 @@ static int dummy_udc_start(struct usb_gadget *g,
struct dummy_hcd *dum_hcd = gadget_to_dummy_hcd(g);
struct dummy *dum = dum_hcd->dum;

if (driver->speed == USB_SPEED_UNKNOWN)
if (driver->max_speed == USB_SPEED_UNKNOWN)
return -EINVAL;

/*
Expand Down Expand Up @@ -977,7 +976,7 @@ static int dummy_udc_probe (struct platform_device *pdev)

dum->gadget.name = gadget_name;
dum->gadget.ops = &dummy_ops;
dum->gadget.is_dualspeed = 1;
dum->gadget.max_speed = USB_SPEED_SUPER;

dev_set_name(&dum->gadget.dev, "gadget");
dum->gadget.dev.parent = &pdev->dev;
Expand Down
6 changes: 3 additions & 3 deletions drivers/usb/gadget/epautoconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,20 +152,20 @@ ep_matches (
switch (type) {
case USB_ENDPOINT_XFER_INT:
/* INT: limit 64 bytes full speed, 1024 high/super speed */
if (!gadget->is_dualspeed && max > 64)
if (!gadget_is_dualspeed(gadget) && max > 64)
return 0;
/* FALLTHROUGH */

case USB_ENDPOINT_XFER_ISOC:
/* ISO: limit 1023 bytes full speed, 1024 high/super speed */
if (ep->maxpacket < max)
return 0;
if (!gadget->is_dualspeed && max > 1023)
if (!gadget_is_dualspeed(gadget) && max > 1023)
return 0;

/* BOTH: "high bandwidth" works only at high speed */
if ((desc->wMaxPacketSize & cpu_to_le16(3<<11))) {
if (!gadget->is_dualspeed)
if (!gadget_is_dualspeed(gadget))
return 0;
/* configure your hardware with enough buffering!! */
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/gadget/f_fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1408,7 +1408,7 @@ static int ffs_epfiles_create(struct ffs_data *ffs)
ENTER();

count = ffs->eps_count;
epfiles = kzalloc(count * sizeof *epfiles, GFP_KERNEL);
epfiles = kcalloc(count, sizeof(*epfiles), GFP_KERNEL);
if (!epfiles)
return -ENOMEM;

Expand Down
Loading

0 comments on commit 121a8cd

Please sign in to comment.