Hi all, 

We try to reproduce the problem on general desktop with ubuntu 12.04.1 and 
12.10, and got some information below:

1. If we use xHci with Ti TUSB7340 chip, do bus reset or plug/unplug 1000+ 
times, the host fail to configure the device.
 If we use xHci with Fresco chip, it operats without error.

2. If the usb device contains only Control/Bulk type endpoints, it's all right. 
If it contains interrupt/isoc (periodic) endpoint, it will fail with bandwidth 
error.
I check the source and find that the bandwidth_error is the TRB_completion_code 
of configure_endpoint command.

In addition, I try to study the usb_reset_and_verify_device and want to consult 
the following question.

When reseting a device, hcd will invoke usb_hcd_alloc_bandwidth,
this function will drop the endpoints and add the endpoints.

When executing drop_endpoint, the function shows error message xHCI called with 
disabled ep.
And I confirm that ep_state of end point context is in disabled state this time.
Then usb_hcd_alloc_bandwidth invokes add_endpoint. 
Last, sending a configure endpoint command to complete the change.

The xHCI spec says configure endpoint should ignore disabled  endpoints drop 
flag and do nothing.
So the source is correct according to spec.
But the overall behavior is adding the endpoint without dropping the old 
endpoint. 

Is this what we want? Don't we need dropping endpoints to release the bandwidth 
and/or resource 
before the endpoints goes to disabled state without freeing bandwidth?


To produce the problem, following these steps

1. prepare a linux and TI host

2. compile the source modify from 
http://marc.info/?l=linux-usb&m=121459435621262&q=p3

/* usbreset -- send a USB port reset to a USB device */

#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/ioctl.h>

#include <linux/usbdevice_fs.h>


int main(int argc, char **argv)
{
        const char *filename;
        int fd;
        int rc;
        int reset_cnt = 0;

        if (argc != 2) {
                fprintf(stderr, "Usage: usbreset device-filename\n");
                return 1;
        }
        filename = argv[1];

        fd = open(filename, O_WRONLY);
        if (fd < 0) {
                perror("Error opening output file");
                return 1;
        }

        while(1)
        {
                printf("%d -th Resetting USB device %s\n", reset_cnt++, 
filename);
                rc = ioctl(fd, USBDEVFS_RESET, 0);
                if (rc < 0) {
                        perror("Error in ioctl");
                        return 1;
                }
                printf("Reset successful\n");
        }

        close(fd);
        return 0;
}

$ gcc usbreset.c -o usbreset
$ sudo ./usbreset /dev/bus/usb/<BUS NUMBER>/<DEVICE NUMBER>

Best regards,
Soar

-----Original Message-----
From: Peter Stuge [mailto:pe...@stuge.se] 
Sent: Monday, January 21, 2013 12:27 PM
To: 洪崇耕
Cc: linux-usb@vger.kernel.org
Subject: Re: Not enough resource for old configuration after USB bus reset

Soar Hung wrote:
> We ported the Linux and related drivers to our embedded system(a 
> customized board), and using TUSB7340 as our host controller.
> 
> We also write a usb interface driver for the tested device, the 
> enumeration and bulk in/out transfers work fine.
> 
> But we encounter problem
..
> Does anybody has the same experience or some guide and would kindly 
> share with us?

It's basically impossible for anyone to help you in any way unless   
you either share the complete and full kernel source code that you are using, 
or reproduce the error with a combination of hardware and software that others 
who will do the debugging also have access to.


//Peter

------Please consider the environment before printing this e-mail.

Reply via email to