Re: [linux-usb-devel] isp1362 hack for isp1161x?

2008-01-30 Thread Felipe Balbi
Hi,

On Jan 30, 2008 3:36 AM, Cristian Chiarello [EMAIL PROTECTED] wrote:
 Hi,

 I have readed isp116x embedded programming guide and if I haven't
 misunderstood, it's need to add ITL buffer management and to change irq
 handler routine. Is this the just way?

 Hack the isp1362 nxp open source driver for isp1161x could be another way?

Sorry, couldn't get you. Do you have the isp116x host controller or
the isp1362 otg controller ?

isp116x has already support in kernel: drivers/usb/host/isp116x-hcd.c
isp1362 has nothing to do with isp116x, better writing a new driver
for it. And as it's an isp transceiver, it's probably connected
through i2c. So write a new driver based on isp1301_omap.c (it's
located under drivers/i2c/chips/isp1301_omap.c)

BTW, the list has been moved to linux-usb@vger.kernel.org, use it instead.


-- 
Best Regards,

Felipe Balbi
[EMAIL PROTECTED]
-
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


testers sought: USB autosuspend for sierra

2008-01-30 Thread Oliver Neukum
Hi,

this should implement USB autosuspend and hence some power savings
if enabled for devices using the sierra driver. Please test.

Regards
Oliver



--- linux-2.6.24-sierra/drivers/usb/serial/sierra.c.alt 2008-01-29 
19:34:49.0 +0100
+++ linux-2.6.24-sierra/drivers/usb/serial/sierra.c 2008-01-30 
10:23:24.0 +0100
@@ -42,6 +42,7 @@
 static int debug;
 static int nmea;
 static int truinstall = 1;
+static DEFINE_MUTEX(open_suspend_lock);
 
 enum devicetype {
DEVICE_3_PORT = 0,
@@ -49,6 +50,25 @@ enum devicetype {
DEVICE_INSTALLER =  2,
 };
 
+
+struct sierra_port_private {
+   spinlock_t lock;/* lock the structure */
+   int outstanding_urbs;   /* number of out urbs in flight */
+   struct usb_anchor transmit_urbs;
+
+   /* Input endpoints and buffer for this port */
+   struct urb *in_urbs[N_IN_URB];
+   char in_buffer[N_IN_URB][IN_BUFLEN];
+
+   /* Settings for the port */
+   int rts_state;  /* Handshaking pins (outputs) */
+   int dtr_state;
+   int cts_state;  /* Handshaking pins (inputs) */
+   int dsr_state;
+   int dcd_state;
+   int ri_state;
+};
+
 static int sierra_set_power_state(struct usb_device *udev, __u16 swiState)
 {
int result;
@@ -146,6 +166,68 @@ static int sierra_probe(struct usb_seria
return result;
 }
 
+static int sierra_suspend(struct usb_interface *intf, pm_message_t message)
+{
+   struct usb_serial *serial = usb_get_intfdata(intf);
+   struct usb_serial_port *port;
+   struct sierra_port_private *portdata;
+   struct urb *u;
+   int i, j;
+
+   mutex_lock(open_suspend_lock);
+
+   for (i = 0; i  serial-num_port_pointers; i++) {
+   port = serial-port[i];
+   portdata = usb_get_serial_port_data(port);
+   usb_kill_urb(port-interrupt_in_urb);
+   for (j = 0; j  N_IN_URB; j++) {
+   u = portdata-in_urbs[j];
+   usb_kill_urb(u);
+   }
+   usb_kill_anchored_urbs(portdata-transmit_urbs);
+   }
+
+   mutex_unlock(open_suspend_lock);
+   return 0;
+}
+
+static int sierra_resume (struct usb_interface *intf)
+{
+   struct usb_serial *serial = usb_get_intfdata(intf);
+   struct usb_serial_port *port;
+   struct sierra_port_private *portdata;
+   struct urb *u;
+   int i, j, err = 0;
+
+   mutex_lock(open_suspend_lock);
+   for (i = 0; i  serial-num_port_pointers; i++) {
+   port = serial-port[i];
+   portdata = usb_get_serial_port_data(port);
+   if (port-open_count) {
+   for (j = 0; j  N_IN_URB; j++) {
+   u = portdata-in_urbs[j];
+   err = usb_submit_urb(u, GFP_NOIO);
+   if (err  0) {
+error_kill:
+   for (j = N_IN_URB - 1; j = 0; j--) {
+   u = portdata-in_urbs[j];
+   usb_kill_urb(u);
+   }
+   goto error_bail_out;
+   }
+   }
+   if (port-interrupt_in_urb) {
+   err = usb_submit_urb(port-interrupt_in_urb, 
GFP_NOIO);
+   if (err  0)
+   goto error_kill;
+   }
+   }
+   }
+error_bail_out:
+   mutex_unlock(open_suspend_lock);
+   return err;
+}
+
 static struct usb_device_id id_table [] = {
{ USB_DEVICE(0x1199, 0x0017) }, /* Sierra Wireless EM5625 */
{ USB_DEVICE(0x1199, 0x0018) }, /* Sierra Wireless MC5720 */
@@ -189,25 +271,11 @@ static struct usb_driver sierra_driver =
.name   = sierra,
.probe  = usb_serial_probe,
.disconnect = usb_serial_disconnect,
+   .suspend= sierra_suspend,
+   .resume = sierra_resume,
.id_table   = id_table,
.no_dynamic_id =1,
-};
-
-struct sierra_port_private {
-   spinlock_t lock;/* lock the structure */
-   int outstanding_urbs;   /* number of out urbs in flight */
-
-   /* Input endpoints and buffer for this port */
-   struct urb *in_urbs[N_IN_URB];
-   char in_buffer[N_IN_URB][IN_BUFLEN];
-
-   /* Settings for the port */
-   int rts_state;  /* Handshaking pins (outputs) */
-   int dtr_state;
-   int cts_state;  /* Handshaking pins (inputs) */
-   int dsr_state;
-   int dcd_state;
-   int ri_state;
+   .supports_autosuspend = 1,
 };
 
 static int sierra_send_setup(struct usb_serial_port *port)
@@ -381,11 +449,13 @@ static int sierra_write(struct usb_seria
  buffer, count, sierra_outdat_callback, port);
 
/* 

Re: [patch v6 3/4] USB: add Cypress c67x00 OTG controller HCD driver

2008-01-30 Thread Peter Korsgaard
 Alan == Alan Stern [EMAIL PROTECTED] writes:

 Alan On Tue, 29 Jan 2008, Peter Korsgaard wrote:
  This patch adds HCD support for the Cypress c67x00 family of devices.

  --- /dev/null
  +++ linux-2.6/drivers/usb/c67x00/c67x00-hcd.c

  +int c67x00_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)
  +{
  +   struct c67x00_hcd *c67x00 = hcd_to_c67x00_hcd(hcd);
  +   unsigned long flags;
  +   int rc;
  +
  +   spin_lock_irqsave(c67x00-lock, flags);
  +   rc = usb_hcd_check_unlink_urb(hcd, urb, status);
  +   if (rc)
  +   goto done;
  +
  +   c67x00_release_urb(c67x00, urb);
  +   usb_hcd_unlink_urb_from_ep(hcd, urb);
  +   spin_unlock_irqrestore(c67x00-lock, flags);
  +
  +   usb_hcd_giveback_urb(hcd, urb, status);

 Alan This is wrong.  usb_hcd_giveback_urb() must be called with local
 Alan interrupts disabled.

Ups, good catch. I've put a spin_unlock() / spin_lock() around it and
moved the _irqrestore down below now.

  +/*
  + * pre: urb != NULL and c67x00 locked, urb unlocked
  + */
  +static inline void
  +c67x00_giveback_urb(struct c67x00_hcd *c67x00, struct urb *urb, int status)
  +{
  +   struct c67x00_urb_priv *urbp;
  +
  +   if (!urb)
  +   return;

 Alan Since you have the documented precondition that urb != NULL, and since
 Alan this routine is never called in a context where urb could be NULL,
 Alan there's no need for this test.  Also, I doubt that this routine really
 Alan needs to be inline (and besides, the compiler is better at making such
 Alan decisions than we are).

It can be null in c67x00_check_td_list, so it's actually the comment
that's wrong. I've fixed that.

  +static void c67x00_sched_done(unsigned long __c67x00)
  +{
  +   struct c67x00_hcd *c67x00 = (struct c67x00_hcd *)__c67x00;
  +   struct c67x00_urb_priv *urbp, *tmp;
  +   struct urb *urb;
  +
  +   spin_lock(c67x00-lock);
  +
  +   /* Loop over the done list and give back all the urbs */
  +   list_for_each_entry_safe(urbp, tmp, c67x00-done_list, hep_node) {
  +   urb = urbp-urb;
  +   c67x00_release_urb(c67x00, urb);
  +   if (!usb_hcd_check_unlink_urb(c67x00_hcd_to_hcd(c67x00),
  + urb, urbp-status)) {

 Alan The function call above is completely wrong.  It is meant to be used only
 Alan from within the dequeue method.

Ahh, so should I just unconditionally do the unlink_urb_from_ep and
giveback_urb?

  +   usb_hcd_unlink_urb_from_ep(c67x00_hcd_to_hcd(c67x00),
  +  urb);
  +   spin_unlock(c67x00-lock);
  +   usb_hcd_giveback_urb(c67x00_hcd_to_hcd(c67x00), urb,
  +urbp-status);
  +   spin_lock(c67x00-lock);
  +   }
  +   }
  +   spin_unlock(c67x00-lock);
  +}

 Alan Is there some reason this routine needs to run in a tasklet?  Why not
 Alan just call it directly?

Hmm, I don't actually remember anymore. It's was written back in
Spring 2006 by Jan. I'll try moving it out of the tasklet and see what
it gives.

 Alan Also, the fact that it is in a tasklet means that it runs with
 Alan interrupts enabled.  Hence your spin_lock() and spin_unlock() calls
 Alan will not do the right thing.

Ahh, ofcause.

Thanks for the feedback!

-- 
Bye, Peter Korsgaard
-
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [BUG] 2.6.24-git usb reset problems

2008-01-30 Thread Geert Uytterhoeven
On Tue, 29 Jan 2008, Jens Axboe wrote:
 On Tue, Jan 29 2008, Jens Axboe wrote:
  On Tue, Jan 29 2008, James Bottomley wrote:
   On Tue, 2008-01-29 at 11:10 -0800, Matthew Dharm wrote:
For some reason, usb_sg_init is boned during auto-sense.
   
   OK, that's implicating the scsi_eh_prep_cmnd() in the auto sense
   code ... that was also an update in 2.6.24
  
  yeah, already found the bug - it's assuming -request_buffer holds the
  sglist, oops. Preparing a fix.
 
 ok here goes, this saves and restores the sg table correctly. it also
 fixes the usb bug for me.

I can confirm this patch fixes the errors I was seeing with current
linux-2.6.git for the USB memory card readers in a Dell TFT connected to a PS3.

 diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
 index 547e85a..12770ef 100644
 --- a/drivers/scsi/scsi_error.c
 +++ b/drivers/scsi/scsi_error.c
 @@ -622,13 +622,15 @@ void scsi_eh_prep_cmnd(struct scsi_cmnd *scmd, struct 
 scsi_eh_save *ses,
   ses-use_sg = scmd-use_sg;
   ses-resid = scmd-resid;
   ses-result = scmd-result;
 + memcpy(ses-sense_sgl, scmd-sg_table, sizeof(ses-sense_sgl));
  
   if (sense_bytes) {
   scmd-request_bufflen = min_t(unsigned,
  SCSI_SENSE_BUFFERSIZE, sense_bytes);
   sg_init_one(ses-sense_sgl, scmd-sense_buffer,
  scmd-request_bufflen);
 - scmd-request_buffer = ses-sense_sgl;
 + scmd-sg_table.sgl = ses-sense_sgl;
 + scmd-sg_table.nents = scmd-sg_table.orig_nents = 1;
   scmd-sc_data_direction = DMA_FROM_DEVICE;
   scmd-use_sg = 1;
   memset(scmd-cmnd, 0, sizeof(scmd-cmnd));
 @@ -679,6 +681,7 @@ void scsi_eh_restore_cmnd(struct scsi_cmnd* scmd, struct 
 scsi_eh_save *ses)
   scmd-request_bufflen = ses-bufflen;
   scmd-request_buffer = ses-buffer;
   scmd-use_sg = ses-use_sg;
 + memcpy(scmd-sg_table, ses-sg_table, sizeof(scmd-sg_table));
   scmd-resid = ses-resid;
   scmd-result = ses-result;
  }
 diff --git a/include/scsi/scsi_eh.h b/include/scsi/scsi_eh.h
 index d21b891..d43dc83 100644
 --- a/include/scsi/scsi_eh.h
 +++ b/include/scsi/scsi_eh.h
 @@ -75,6 +75,7 @@ struct scsi_eh_save {
  
   void *buffer;
   unsigned bufflen;
 + struct sg_table sg_table;
   unsigned short use_sg;
   int resid;
  

With kind regards,

Geert Uytterhoeven
Software Architect

Sony Network and Software Technology Center Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium

Phone:+32 (0)2 700 8453
Fax:  +32 (0)2 700 8622
E-mail:   [EMAIL PROTECTED]
Internet: http://www.sony-europe.com/

Sony Network and Software Technology Center Europe
A division of Sony Service Centre (Europe) N.V.
Registered office: Technologielaan 7 · B-1840 Londerzeel · Belgium
VAT BE 0413.825.160 · RPR Brussels
Fortis Bank Zaventem · Swift GEBABEBB08A · IBAN BE39001382358619

some fixes of the sierra driver

2008-01-30 Thread Oliver Neukum
Hi,

while I was adding autosuspend to that driver I noticed a few
issues. You were having DMAed buffers as a part of a structure.
This will fail on platforms that are not DMA-coherent (arm, sparc, ppc, ...)
Please test this patch to fix it.

Regards
Oliver



--- linux-2.6.24-sierra/drivers/usb/serial/sierra.c.alt22008-01-30 
12:03:57.0 +0100
+++ linux-2.6.24-sierra/drivers/usb/serial/sierra.c 2008-01-30 
12:11:39.0 +0100
@@ -56,9 +56,9 @@ struct sierra_port_private {
int outstanding_urbs;   /* number of out urbs in flight */
struct usb_anchor transmit_urbs;
 
-   /* Input endpoints and buffer for this port */
+   /* Input endpoints and buffers for this port */
struct urb *in_urbs[N_IN_URB];
-   char in_buffer[N_IN_URB][IN_BUFLEN];
+   char *in_buffer[N_IN_URB];
 
/* Settings for the port */
int rts_state;  /* Handshaking pins (outputs) */
@@ -714,6 +714,15 @@ static int sierra_startup(struct usb_ser
}
spin_lock_init(portdata-lock);
init_usb_anchor(portdata-transmit_urbs);
+   for (j = 0; j  N_IN_URB; j++) {
+   portdata-in_buffer[j] = kmalloc(IN_BUFLEN, GFP_KERNEL);
+   if (!portdata-in_buffer[j]) {
+   for ( --j; j = 0; j--)
+   kfree(portdata-in_buffer[j]);
+   kfree(portdata);
+   return -ENOMEM;
+   } 
+   }
 
usb_set_serial_port_data(port, portdata);
 
@@ -757,7 +766,7 @@ static void sierra_shutdown(struct usb_s
for (j = 0; j  N_IN_URB; j++) {
usb_kill_urb(portdata-in_urbs[j]);
usb_free_urb(portdata-in_urbs[j]);
-   portdata-in_urbs[j] = NULL;
+   kfree(portdata-in_buffer[j]);
}
kfree(portdata);
usb_set_serial_port_data(port, NULL);
-
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


at91 udc and gadget file storage

2008-01-30 Thread Atsushi Nemoto
Hi.  I'm trying at91_udc driver with g_file_storage on AT91SAM9260-EK
board.  I'm using kernel 2.6.24 and 2.6.22(+at91-exp.patch).

When I load the g_file_storage module, host can detect storage device
soon, but take few _minutes_ to detect its partition table.

This storage image file works fine with another udc driver on another
platform.  So I don't think it is a image problem or host side (or
cable) problem.

Has anyone seen problem like this?

Here is an UDC side log:
# modprobe g_file_storage file=/fatimage
udc: at91_udc version 3 May 2006
g_file_storage gadget: File-backed Storage Gadget, version: 7 August 2007
g_file_storage gadget: Number of LUNs=1
g_file_storage gadget-lun0: ro=0, file: /fatimage
g_file_storage gadget: full speed config #1
... (same message continues 13 times)

And UHC side log:
usb 3-2: new full speed USB device using uhci_hcd and address 15
usb 3-2: configuration #1 chosen from 1 choice
scsi11 : SCSI emulation for USB Mass Storage devices
usb-storage: device found at 15
usb-storage: waiting for device to settle before scanning
scsi 11:0:0:0: Direct-Access LinuxFile-Stor Gadget 0313 PQ: 0 ANSI: 2
sd 11:0:0:0: [sda] 8192 512-byte hardware sectors (4 MB)
usb 3-2: reset full speed USB device using uhci_hcd and address 15
usb 3-2: reset full speed USB device using uhci_hcd and address 15
usb 3-2: reset full speed USB device using uhci_hcd and address 15
usb 3-2: reset full speed USB device using uhci_hcd and address 15
usb 3-2: reset full speed USB device using uhci_hcd and address 15
usb 3-2: reset full speed USB device using uhci_hcd and address 15
sd 11:0:0:0: [sda] Write Protect is off
sd 11:0:0:0: [sda] Mode Sense: 0f 00 00 00
sd 11:0:0:0: [sda] Assuming drive cache: write through
sd 11:0:0:0: [sda] 8192 512-byte hardware sectors (4 MB)
usb 3-2: reset full speed USB device using uhci_hcd and address 15
usb 3-2: reset full speed USB device using uhci_hcd and address 15
usb 3-2: reset full speed USB device using uhci_hcd and address 15
usb 3-2: reset full speed USB device using uhci_hcd and address 15
usb 3-2: reset full speed USB device using uhci_hcd and address 15
usb 3-2: reset full speed USB device using uhci_hcd and address 15
sd 11:0:0:0: [sda] Write Protect is off
sd 11:0:0:0: [sda] Mode Sense: 0f 00 00 00
sd 11:0:0:0: [sda] Assuming drive cache: write through
 sda: sda1
sd 11:0:0:0: [sda] Attached SCSI disk
sd 11:0:0:0: Attached scsi generic sg0 type 0
usb-storage: device scan complete

Any advices are welcome.  Thanks.

---
Atsushi Nemoto
-
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


rfc:issues on suspend and soft disconnect in serial drivers

2008-01-30 Thread Oliver Neukum
Hi,

I've been looking at these issue in usb serial drivers. It seems to me
that kill_traffic() should be enhanced. If this is coupled with the
enhancements of the anchor stuff I posted recently this removes all races
in the drivers not using the standard URBs.
Additionally this modification will make implementations of suspen/resume
and eventually autosuspend easier for the subdrivers.

Thoughts?

Regards
Oliver

--- linux-2.6.24-sierra/include/linux/usb/serial.h.alt  2008-01-30 
12:43:25.0 +0100
+++ linux-2.6.24-sierra/include/linux/usb/serial.h  2008-01-30 
12:50:26.0 +0100
@@ -64,6 +64,7 @@ struct usb_serial_port {
struct usb_serial * serial;
struct tty_struct * tty;
spinlock_t  lock;
+   struct usb_anchor   additional_urbs;
struct mutexmutex;
unsigned char   number;
 
--- linux-2.6.24-sierra/drivers/usb/serial/usb-serial.c.alt 2008-01-30 
12:48:34.0 +0100
+++ linux-2.6.24-sierra/drivers/usb/serial/usb-serial.c 2008-01-30 
12:50:22.0 +0100
@@ -593,6 +593,13 @@ static void kill_traffic(struct usb_seri
usb_kill_urb(port-read_urb);
usb_kill_urb(port-interrupt_in_urb);
usb_kill_urb(port-interrupt_out_urb);
+
+   /*
+* This kills any additional URBs the subdrivers
+* have anchored. This is needed for soft disconnect
+*/
+   usb_kill_anchored_urbs(port-additional_urbs);
+
 }
 
 static void port_free(struct usb_serial_port *port)
@@ -879,6 +886,7 @@ int usb_serial_probe(struct usb_interfac
port-serial = serial;
spin_lock_init(port-lock);
mutex_init(port-mutex);
+   init_usb_anchor(port-additional_urbs);
INIT_WORK(port-work, usb_serial_port_work);
serial-port[i] = port;
}
--- linux-2.6.24-sierra/drivers/usb/serial/airprime.c.alt   2008-01-30 
13:06:38.0 +0100
+++ linux-2.6.24-sierra/drivers/usb/serial/airprime.c   2008-01-30 
13:22:38.0 +0100
@@ -98,10 +98,13 @@ static void airprime_read_bulk_callback(
tty_flip_buffer_push (tty);
}
 
+   usb_anchor_urb(urb, port-additional_urbs);
result = usb_submit_urb (urb, GFP_ATOMIC);
-   if (result)
+   if (result) {
dev_err(port-dev, %s - failed resubmitting read urb, error 
%d\n,
__FUNCTION__, result);
+   usb_unanchor_urb(urb);
+   }
return;
 }
 
@@ -174,8 +177,10 @@ static int airprime_open(struct usb_seri
  
port-bulk_out_endpointAddress),
  buffer, buffer_size,
  airprime_read_bulk_callback, port);
+   usb_anchor_urb(urb, port-additional_urbs);
result = usb_submit_urb(urb, GFP_KERNEL);
if (result) {
+   usb_unanchor_urb(urb);
usb_free_urb(urb);
kfree(buffer);
dev_err(port-dev,
@@ -198,9 +203,10 @@ static int airprime_open(struct usb_seri
while (i-- != 0) {
urb = priv-read_urbp[i];
buffer = urb-transfer_buffer;
-   usb_kill_urb (urb);
-   usb_free_urb (urb);
-   kfree (buffer);
+   usb_kill_urb(urb);
+   usb_unanchor_urb(urb);
+   usb_free_urb(urb);
+   kfree(buffer);
}
 
  out:
@@ -268,6 +274,7 @@ static int airprime_write(struct usb_ser
  port-bulk_out_endpointAddress),
  buffer, count,
  airprime_write_bulk_callback, port);
+   usb_anchor_urb(urb, port-additional_urbs);
 
/* send it down the pipe */
status = usb_submit_urb(urb, GFP_ATOMIC);
@@ -276,6 +283,7 @@ static int airprime_write(struct usb_ser
%s - usb_submit_urb(write bulk) failed with status = 
%d\n,
__FUNCTION__, status);
count = status;
+   usb_unanchor_urb(urb);
kfree (buffer);
} else {
spin_lock_irqsave(priv-lock, flags);
-
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [BUG] 2.6.24-git usb reset problems

2008-01-30 Thread James Bottomley
On Wed, 2008-01-30 at 11:38 +0100, Jens Axboe wrote:
 On Wed, Jan 30 2008, Geert Uytterhoeven wrote:
  On Tue, 29 Jan 2008, Jens Axboe wrote:
   On Tue, Jan 29 2008, Jens Axboe wrote:
On Tue, Jan 29 2008, James Bottomley wrote:
 On Tue, 2008-01-29 at 11:10 -0800, Matthew Dharm wrote:
  For some reason, usb_sg_init is boned during auto-sense.
 
 OK, that's implicating the scsi_eh_prep_cmnd() in the auto sense
 code ... that was also an update in 2.6.24

yeah, already found the bug - it's assuming -request_buffer holds the
sglist, oops. Preparing a fix.
   
   ok here goes, this saves and restores the sg table correctly. it also
   fixes the usb bug for me.
  
  I can confirm this patch fixes the errors I was seeing with current
  linux-2.6.git for the USB memory card readers in a Dell TFT connected
  to a PS3.
 
 James, we need a fix for this pushed asap. So either we should merge the
 below now, or push the bidi patchset that also fixes this. It all
 depends on when you want to merge the bidi patches...

The SCSI patch set (including the bidirectional pieces) is waiting in
scsi-misc ... just for forms sake, could you confirm that it actually
fixes the problem and I'll push it.

James


-
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch]sane memory allocation in option driver

2008-01-30 Thread Oliver Neukum
Hi,

the option driver
- violates DMA coherency rules
- allocates ~16500 bytes in one chunk
This patch splits out the buffers and uses __get_free_page() to avoid
higher order allocations.

Signed-off-by: Oliver Neukum [EMAIL PROTECTED]

Regards
Oliver




--- linux-2.6.24-ser/drivers/usb/serial/option.c.alt2008-01-30 
15:02:12.0 +0100
+++ linux-2.6.24-ser/drivers/usb/serial/option.c2008-01-30 
15:19:15.0 +0100
@@ -247,10 +247,10 @@ static int debug;
 struct option_port_private {
/* Input endpoints and buffer for this port */
struct urb *in_urbs[N_IN_URB];
-   char in_buffer[N_IN_URB][IN_BUFLEN];
+   u8 *in_buffer[N_IN_URB];
/* Output endpoints and buffer for this port */
struct urb *out_urbs[N_OUT_URB];
-   char out_buffer[N_OUT_URB][OUT_BUFLEN];
+   u8 *out_buffer[N_OUT_URB];
unsigned long out_busy; /* Bit vector of URBs in use */
 
/* Settings for the port */
@@ -737,7 +737,7 @@ static int option_send_setup(struct usb_
 
 static int option_startup(struct usb_serial *serial)
 {
-   int i, err;
+   int i, j, err;
struct usb_serial_port *port;
struct option_port_private *portdata;
 
@@ -753,6 +753,18 @@ static int option_startup(struct usb_ser
return (1);
}
 
+   for (j = 0; j  N_IN_URB; j++) {
+   portdata-in_buffer[j] = (u8 
*)__get_free_page(GFP_KERNEL);
+   if (!portdata-in_buffer[j])
+   goto bail_out_error;
+   }
+
+   for (j = 0; j  N_OUT_URB; j++) {
+   portdata-out_buffer[j] = kmalloc(OUT_BUFLEN, 
GFP_KERNEL);
+   if (!portdata-out_buffer[j])
+   goto bail_out_error2;
+   }
+
usb_set_serial_port_data(port, portdata);
 
if (! port-interrupt_in_urb)
@@ -766,6 +778,16 @@ static int option_startup(struct usb_ser
option_setup_urbs(serial);
 
return (0);
+
+bail_out_error2:
+   for (j = 0; j  N_OUT_URB; j++)
+   kfree(portdata-out_buffer[j]);
+bail_out_error:
+   for (j = 0; j  N_IN_URB; j++)
+   if(portdata-in_buffer[j])
+   free_page((unsigned long)portdata-in_buffer[j]);
+   kfree(portdata);
+   return 1;
 }
 
 static void option_shutdown(struct usb_serial *serial)
@@ -794,12 +816,14 @@ static void option_shutdown(struct usb_s
for (j = 0; j  N_IN_URB; j++) {
if (portdata-in_urbs[j]) {
usb_free_urb(portdata-in_urbs[j]);
+   free_page((unsigned 
long)portdata-in_buffer[j]);
portdata-in_urbs[j] = NULL;
}
}
for (j = 0; j  N_OUT_URB; j++) {
if (portdata-out_urbs[j]) {
usb_free_urb(portdata-out_urbs[j]);
+   kfree(portdata-out_buffer[j]);
portdata-out_urbs[j] = NULL;
}
}
-
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch]error handling in trancevibrator

2008-01-30 Thread Oliver Neukum
Hi,

trancevibrator should not pretend success if it returns an error.

Signed-off-by: Oliver Neukum [EMAIL PROTECTED]

Regards
Oliver



--- linux-2.6.24-ser/drivers/usb/misc/trancevibrator.c.alt  2008-01-30 
15:56:49.0 +0100
+++ linux-2.6.24-ser/drivers/usb/misc/trancevibrator.c  2008-01-30 
15:56:58.0 +0100
@@ -59,13 +59,14 @@ static ssize_t set_speed(struct device *
 {
struct usb_interface *intf = to_usb_interface(dev);
struct trancevibrator *tv = usb_get_intfdata(intf);
-   int temp, retval;
+   int temp, retval, old;
 
temp = simple_strtoul(buf, NULL, 10);
if (temp  255)
temp = 255;
else if (temp  0)
temp = 0;
+   old = tv-speed;
tv-speed = temp;
 
dev_dbg(tv-udev-dev, speed = %d\n, tv-speed);
@@ -77,6 +78,7 @@ static ssize_t set_speed(struct device *
 tv-speed, /* speed value */
 0, NULL, 0, USB_CTRL_GET_TIMEOUT);
if (retval) {
+   tv-speed = old;
dev_dbg(tv-udev-dev, retval = %d\n, retval);
return retval;
}
-
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [patch v6 3/4] USB: add Cypress c67x00 OTG controller HCD driver

2008-01-30 Thread Alan Stern
On Wed, 30 Jan 2008, Peter Korsgaard wrote:

   +static void c67x00_sched_done(unsigned long __c67x00)
   +{
   + struct c67x00_hcd *c67x00 = (struct c67x00_hcd *)__c67x00;
   + struct c67x00_urb_priv *urbp, *tmp;
   + struct urb *urb;
   +
   + spin_lock(c67x00-lock);
   +
   + /* Loop over the done list and give back all the urbs */
   + list_for_each_entry_safe(urbp, tmp, c67x00-done_list, hep_node) {
   + urb = urbp-urb;
   + c67x00_release_urb(c67x00, urb);
   + if (!usb_hcd_check_unlink_urb(c67x00_hcd_to_hcd(c67x00),
   +   urb, urbp-status)) {
 
  Alan The function call above is completely wrong.  It is meant to be used 
 only
  Alan from within the dequeue method.
 
 Ahh, so should I just unconditionally do the unlink_urb_from_ep and
 giveback_urb?

Yes, that's right.  The check_unlink_urb routine merely verifies that 
an unlink is valid.  If you're about to giveback an URB then you 
already know it's valid to do so.

Alan Stern

-
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Problem: Device RESET when reading hiddev

2008-01-30 Thread Salvador Eduardo Tropea
Hello!

My name is Salvador and I'm designing a hardware implementation of an
USB HID device. My current target is an FPGA and I'm using Linux to test
my device.
I'm using Debian GNU/Linux 4.0 (etch) with kernel 2.6.18.
I found a problem that looks like a bug in hiddev kernel code, but I'm
not sure. Here is what I found:
During initialization the kernel sends a SET_IDLE to the device
indicating the idle rate as 0. It means: never send a report unless
something changed. It means the device will NAK until  it have something
really useful to report.
That's ok, the problem is when my device is mapped to an hiddev (i.e.
/dev/usb/hiddev0) and I do a read, i.e.

$ cat /dev/usb/hiddev0

After aprox. 10 seconds the kernel sends a RESET to my device!
It looks quite wrong. Looking at the sources I see the NAK is
interpreted as ETIMEOUT by hid-core making a call to hid_error and
scheduling a RESET from there. But these NAKs aren't any error, they are
the normal behavior of a device that configured with SET_IDLE(0). If I
force my device to reply a change every second this problem goes away.

Note that this only happends when I read from the hiddev device, if
nobody reads from there the kernel doesn't send any RESET.

Is that a bug or is it something I'm doing wrong?

Regards, SET

-- 
___
Ing. Salvador Eduardo Tropea  http://utic.inti.gov.ar/
INTI-Electrónica e InformáticaTel: (+54 11) 4724 6315
Colectora de Av. General Paz 5445 San Martín - B1650KNA
Casilla de Correo 157 FAX: (+54 11) 4754 5194
Buenos Aires * Argentina  http://www.inti.gov.ar/


-
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Problem: hiddev stops sending events after some error recoveries

2008-01-30 Thread Alan Stern
On Wed, 30 Jan 2008, Salvador Eduardo Tropea wrote:

 Hello!
 
 Here another problem I found (see the Problem: Device RESET when
 reading hiddev thread):
 I'm using Debian GNU/Linux 4.0 (etch) with kernel 2.6.18.
 I found a problem that looks like a bug in hiddev kernel code, but I'm
 not sure. Here is what I found:
 The problem happends when I'm reading from an hiddev device (i.e.
 /dev/usb/hiddev0). If the kernel tries to recover from an error (sending
 a RESET) and the SET_INTERFACE request fails (used to recreate the
 current interface state) then the kernel re-enumerates the device. It
 means the device have a new address. The problem is that the hiddev
 device doesn't really know about this change and it gets useless, I must
 close the device and open it again (so it gets the new address). The
 device doesn't report any kind of read error.
 
 Is that a bug or is it something I'm doing wrong?

It's a bug for Set-Interface to fail.  Following a reset, the device 
has no reason to fail such a request.

I'm not terribly familiar with the hiddev driver, but I think it's not
a bug that it doesn't report any kind of read error when this happens.  
The situation should be exactly the same as if you had unplugged the
HID device -- reads should return an end-of-file indication rather than
an error.  However I could be wrong about this.

Alan Stern

-
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


please test: autosuspend for idmouse

2008-01-30 Thread Oliver Neukum
Hi,

could you please get in touch with me about testing this patch implementing
autosuspend for the fingerprint function of devices driven by the idmouse 
driver?

Regards
Oliver



--- linux-2.6.24-ser/drivers/usb/misc/idmouse.c.alt 2008-01-30 
17:35:17.0 +0100
+++ linux-2.6.24-ser/drivers/usb/misc/idmouse.c 2008-01-30 17:35:22.0 
+0100
@@ -97,6 +97,16 @@ static int idmouse_probe(struct usb_inte
 
 static void idmouse_disconnect(struct usb_interface *interface);
 
+static int idmouse_suspend(struct usb_interface *intf, pm_message_t message)
+{
+   return 0;
+}
+
+static int idmouse_resume (struct usb_interface *intf)
+{
+   return 0;
+}
+
 /* file operation pointers */
 static const struct file_operations idmouse_fops = {
.owner = THIS_MODULE,
@@ -117,7 +127,10 @@ static struct usb_driver idmouse_driver 
.name = DRIVER_SHORT,
.probe = idmouse_probe,
.disconnect = idmouse_disconnect,
+   .suspend = idmouse_suspend,
+   .resume = idmouse_resume,
.id_table = idmouse_table,
+   .supports_autosuspend = 1,
 };
 
 static int idmouse_create_image(struct usb_idmouse *dev)
@@ -234,8 +247,12 @@ static int idmouse_open(struct inode *in
 
} else {
 
+   result = usb_autopm_get_interface(dev-interface);
+   if (result  0)
+   goto error;
/* create a new image and check for success */
result = idmouse_create_image (dev);
+   usb_autopm_put_interface(dev-interface);
if (result)
goto error;
 
-
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: some fixes of the sierra driver

2008-01-30 Thread Kevin Lloyd
Hi Oliver,

I will get to testing this and get back to you with the results asap.

I expect that this will work as I have seen it implemented this way
before.

Thanks,
 -Kevin
-Original Message-
From: Oliver Neukum [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, January 30, 2008 3:22 AM
To: Linux Development Group; linux-usb@vger.kernel.org
Subject: some fixes of the sierra driver

Hi,

while I was adding autosuspend to that driver I noticed a few
issues. You were having DMAed buffers as a part of a structure.
This will fail on platforms that are not DMA-coherent (arm, sparc, ppc,
...)
Please test this patch to fix it.

Regards
Oliver



--- linux-2.6.24-sierra/drivers/usb/serial/sierra.c.alt2
2008-01-30 12:03:57.0 +0100
+++ linux-2.6.24-sierra/drivers/usb/serial/sierra.c 2008-01-30
12:11:39.0 +0100
@@ -56,9 +56,9 @@ struct sierra_port_private {
int outstanding_urbs;   /* number of out urbs in flight */
struct usb_anchor transmit_urbs;
 
-   /* Input endpoints and buffer for this port */
+   /* Input endpoints and buffers for this port */
struct urb *in_urbs[N_IN_URB];
-   char in_buffer[N_IN_URB][IN_BUFLEN];
+   char *in_buffer[N_IN_URB];
 
/* Settings for the port */
int rts_state;  /* Handshaking pins (outputs) */
@@ -714,6 +714,15 @@ static int sierra_startup(struct usb_ser
}
spin_lock_init(portdata-lock);
init_usb_anchor(portdata-transmit_urbs);
+   for (j = 0; j  N_IN_URB; j++) {
+   portdata-in_buffer[j] = kmalloc(IN_BUFLEN,
GFP_KERNEL);
+   if (!portdata-in_buffer[j]) {
+   for ( --j; j = 0; j--)
+   kfree(portdata-in_buffer[j]);
+   kfree(portdata);
+   return -ENOMEM;
+   } 
+   }
 
usb_set_serial_port_data(port, portdata);
 
@@ -757,7 +766,7 @@ static void sierra_shutdown(struct usb_s
for (j = 0; j  N_IN_URB; j++) {
usb_kill_urb(portdata-in_urbs[j]);
usb_free_urb(portdata-in_urbs[j]);
-   portdata-in_urbs[j] = NULL;
+   kfree(portdata-in_buffer[j]);
}
kfree(portdata);
usb_set_serial_port_data(port, NULL);

-
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [BUG] 2.6.24-git usb reset problems

2008-01-30 Thread Jens Axboe
On Wed, Jan 30 2008, James Bottomley wrote:
 On Wed, 2008-01-30 at 11:38 +0100, Jens Axboe wrote:
  On Wed, Jan 30 2008, Geert Uytterhoeven wrote:
   On Tue, 29 Jan 2008, Jens Axboe wrote:
On Tue, Jan 29 2008, Jens Axboe wrote:
 On Tue, Jan 29 2008, James Bottomley wrote:
  On Tue, 2008-01-29 at 11:10 -0800, Matthew Dharm wrote:
   For some reason, usb_sg_init is boned during auto-sense.
  
  OK, that's implicating the scsi_eh_prep_cmnd() in the auto sense
  code ... that was also an update in 2.6.24
 
 yeah, already found the bug - it's assuming -request_buffer holds the
 sglist, oops. Preparing a fix.

ok here goes, this saves and restores the sg table correctly. it also
fixes the usb bug for me.
   
   I can confirm this patch fixes the errors I was seeing with current
   linux-2.6.git for the USB memory card readers in a Dell TFT connected
   to a PS3.
  
  James, we need a fix for this pushed asap. So either we should merge the
  below now, or push the bidi patchset that also fixes this. It all
  depends on when you want to merge the bidi patches...
 
 The SCSI patch set (including the bidirectional pieces) is waiting in
 scsi-misc ... just for forms sake, could you confirm that it actually
 fixes the problem and I'll push it.

Certainly, I'll give it a spin tonight.

-- 
Jens Axboe

-
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: at91 udc and gadget file storage

2008-01-30 Thread David Brownell
On Wednesday 30 January 2008, Atsushi Nemoto wrote:
 When I load the g_file_storage module, host can detect storage device
 soon, but take few _minutes_ to detect its partition table.

That's a common symptom when the underlying controller driver has
issues with handling stalls.  modprobe g_storage stall=n will
often make them go away.

- Dave

-
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [BUG] 2.6.24-git usb reset problems

2008-01-30 Thread Jens Axboe
On Wed, Jan 30 2008, Jens Axboe wrote:
 On Wed, Jan 30 2008, James Bottomley wrote:
  On Wed, 2008-01-30 at 11:38 +0100, Jens Axboe wrote:
   On Wed, Jan 30 2008, Geert Uytterhoeven wrote:
On Tue, 29 Jan 2008, Jens Axboe wrote:
 On Tue, Jan 29 2008, Jens Axboe wrote:
  On Tue, Jan 29 2008, James Bottomley wrote:
   On Tue, 2008-01-29 at 11:10 -0800, Matthew Dharm wrote:
For some reason, usb_sg_init is boned during auto-sense.
   
   OK, that's implicating the scsi_eh_prep_cmnd() in the auto sense
   code ... that was also an update in 2.6.24
  
  yeah, already found the bug - it's assuming -request_buffer holds 
  the
  sglist, oops. Preparing a fix.
 
 ok here goes, this saves and restores the sg table correctly. it also
 fixes the usb bug for me.

I can confirm this patch fixes the errors I was seeing with current
linux-2.6.git for the USB memory card readers in a Dell TFT connected
to a PS3.
   
   James, we need a fix for this pushed asap. So either we should merge the
   below now, or push the bidi patchset that also fixes this. It all
   depends on when you want to merge the bidi patches...
  
  The SCSI patch set (including the bidirectional pieces) is waiting in
  scsi-misc ... just for forms sake, could you confirm that it actually
  fixes the problem and I'll push it.
 
 Certainly, I'll give it a spin tonight.

Confirmed, pulling your scsi-misc branch into current -git makes the
problem go away as well.

-- 
Jens Axboe

-
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: request: patch for oracom mp3 stick -- usb-storage: unusual_devs.h

2008-01-30 Thread Alan Stern
On Wed, 30 Jan 2008, Robert Spitzenpfeil wrote:

 * unusual_devs.h: entry which does NOT work ( lacks: 
 US_FL_IGNORE_RESIDUE | US_FL_FIX_INQUIRY), )
 
 UNUSUAL_DEV(  0x0f19, 0x0103, 0x0100, 0x0100,
Oracom Co., Ltd,
ORC-200M,
 US_SC_DEVICE, US_PR_DEVICE, NULL,
 US_FL_IGNORE_RESIDUE),
 
 
 * /sys/module/usb_storage/parameters/delay_use = 1 (5 or 15 seconds does 
 not help either. tested for opensuse people)
 
 * /var/log/messages: plugin/unplug of mp3 stick
...
 usbmon trace:
...

Thanks for the detailed logs.  This device seems to have at least two
serious bugs.  We were able to recover from the first one (the device
sent a 13-byte packet containing garbage instead of the 36-byte INQUIRY
data), but the second one was a killer (the device responded correctly
to INQUIRY but then claimed that the command was invalid).

Does this device work okay under Windows?  If it does, can you provide 
a SnoopyPro trace showing the initialization?

Alan Stern

-
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [linux-usb-devel] 2.6.24: NULL scatter-gather pointer in usb_storage:usb_stor_access_xfer_buf?

2008-01-30 Thread Alan Stern
Boaz:

This looks like it might have something to do with your changes.

Alan Stern


On Wed, 30 Jan 2008, Mark Glines wrote:

 : 
 Mime-Version: 1.0
 Content-Type: text/plain; charset=US-ASCII
 Content-Transfer-Encoding: 7bit
 
 Hi,
 
 
 [   95.406864] usb 4-1: new full speed USB device using uhci_hcd and address 2
 [   95.550372] usb 4-1: configuration #1 chosen from 1 choice
 [   95.622808] usbcore: registered new interface driver libusual
 [   95.681971] Initializing USB Mass Storage driver...
 [   95.775056] scsi3 : SCSI emulation for USB Mass Storage devices
 [   95.777071] usbcore: registered new interface driver usb-storage
 [   95.777084] USB Mass Storage support registered.
 [   95.777928] usb-storage: device found at 2
 [   95.777935] usb-storage: waiting for device to settle before scanning
 [   97.291557] Unable to handle kernel NULL pointer dereference at 
  RIP:
 [   97.291567]  [8835fa4e] 
 :usb_storage:usb_stor_access_xfer_buf+0xde/0x270
 [   97.291587] PGD 6a25c067 PUD 6a3f1067 PMD 0
 [   97.291596] Oops:  [1] PREEMPT SMP
 [   97.291603] CPU 1
 [   97.291607] Modules linked in: usb_storage libusual i915 drm ipv6 nfsd 
 lockd nfs_acl auth_rpcgss sunrpc exportfs rfcomm l2cap dm_mod fuse dock tun 
 kvm_intel kvm acpi_cpufreq rfkill_input rfkill coretemp bonding hci_usb 
 bluetooth arc4 ecb iwl4965 snd_hda_intel mac80211 snd_pcm uhci_hcd ehci_hcd 
 usbcore pcmcia snd_timer snd_page_alloc ide_cd firmware_class psmouse 
 snd_hwdep parport_pc yenta_socket snd 8250_pnp parport 8250 rsrc_nonstatic 
 cdrom thermal video cfg80211 pcmcia_core i2c_i801 ac serial_core battery 
 intel_agp button output sg evdev
 [   97.291706] Pid: 7107, comm: usb-storage Not tainted 2.6.24 #3
 [   97.291711] RIP: 0010:[8835fa4e]  [8835fa4e] 
 :usb_storage:usb_stor_access_xfer_buf+0xde/0x270
 [   97.291727] RSP: 0018:810067e71db0  EFLAGS: 00010283
 [   97.291732] RAX: 810074586600 RBX: 87654321 RCX: 
 
 [   97.291737] RDX: 0004 RSI: 810067cfb424 RDI: 
 810074586624
 [   97.291742] RBP: 810067e71e10 R08: 810002973550 R09: 
 
 [   97.291747] R10: 81006a236000 R11:  R12: 
 
 [   97.291751] R13: 0024 R14: 0024 R15: 
 0600
 [   97.291757] FS:  () GS:81007d00d500() 
 knlGS:
 [   97.291763] CS:  0010 DS: 0018 ES: 0018 CR0: 8005003b
 [   97.291768] CR2:  CR3: 6a2ea000 CR4: 
 26e0
 [   97.291772] DR0:  DR1:  DR2: 
 
 [   97.291777] DR3:  DR6: 0ff0 DR7: 
 0400
 [   97.291783] Process usb-storage (pid: 7107, threadinfo 810067e7, 
 task 810067d10f20)
 [   97.291788] Stack:  0003  810067e71e2c 
 810067e71e20
 [   97.291800]  006067d10f20 810067cfb400 810002973550 
 0060
 [   97.291810]  81006a236000 810067d14c78 810067d14df0 
 810067e71eb0
 [   97.291820] Call Trace:
 [   97.291840]  [8835fc14] 
 :usb_storage:usb_stor_set_xfer_buf+0x34/0x60
 [   97.291857]  [88366d58] 
 :usb_storage:isd200_ata_command+0x188/0x530
 [   97.291877]  [8836142e] 
 :usb_storage:usb_stor_control_thread+0x1be/0x250
 [   97.291892]  [812b5106] _spin_unlock_irqrestore+0x16/0x40
 [   97.291906]  [88361270] 
 :usb_storage:usb_stor_control_thread+0x0/0x250
 [   97.291918]  [8105290d] kthread+0x4d/0x80
 [   97.291928]  [8100d2e8] child_rip+0xa/0x12
 [   97.291943]  [810528c0] kthread+0x0/0x80
 [   97.291950]  [8100d2de] child_rip+0x0/0x12
 [   97.291956]
 [   97.291958]
 [   97.291959] Code: 49 39 1c 24 0f 85 78 01 00 00 4d 8b 44 24 08 41 f6 c0 01 
 0f
 [   97.291985] RIP  [8835fa4e] 
 :usb_storage:usb_stor_access_xfer_buf+0xde/0x270
 [   97.291999]  RSP 810067e71db0
 [   97.292002] CR2: 
 [   97.292009] ---[ end trace 77e35c70f05f8a11 ]---
 
 
 :usb_storage:usb_stor_access_xfer_buf+0xde is the first pointer
 dereference in an inlined call to sg_page().
 
 
 static inline struct page *sg_page(struct scatterlist *sg)
 {
 #ifdef CONFIG_DEBUG_SG
 BUG_ON(sg-sg_magic != SG_MAGIC);
 BUG_ON(sg_is_chain(sg));
 #endif
 return (struct page *)((sg)-page_link  ~0x3);
 }
 
 
 Turning on CONFIG_DEBUG_SG didn't make much difference, because the sg
 pointer itself is NULL.  Thus, it segfaulted before BUG_ON was actually
 called.
 
 This hardware worked fine with 2.6.23.12... though my kernel config is
 rather different from that one.  Before I start digging and trying to
 work out all the details and hopefully fix it, I was wondering if you've
 already seen this?
 
 Thanks,
 
 Mark
 
 -
 This SF.net email is sponsored by: Microsoft
 Defy 

Re: at91 udc and gadget file storage

2008-01-30 Thread Atsushi Nemoto
On Wed, 30 Jan 2008 10:28:32 -0500 (EST), Alan Stern [EMAIL PROTECTED] wrote:
  When I load the g_file_storage module, host can detect storage device
  soon, but take few _minutes_ to detect its partition table.
...
  usb 3-2: reset full speed USB device using uhci_hcd and address 15
  usb 3-2: reset full speed USB device using uhci_hcd and address 15
  usb 3-2: reset full speed USB device using uhci_hcd and address 15
 
 Clearly there is a problem.  Some device controllers (I don't recall 
 whether the at91 is among them) are not able to stall bulk endpoints 
 correctly; on those devices you must use the stall=n module parameter 
 for g_file_storage.

The stall=n works well.  I got same advice from David Brownell and
Nicolas Ferre too.  Thank you all!

---
Atsushi Nemoto
-
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html