Timo Juhani Lindfors <timo.lindf...@iki.fi> writes:

Hi,


[ unfortunately, it's been a long time since I've played with the udc
stuff, so please, bear with me and take into account that there may be
some errors ]

> [ Cc added to authors of s3c2410_udc.c ]
>
> Andy Green <a...@openmoko.com> writes:
>> Somebody in the thread at some point said:
>>
>> |   "USB device controller allows bulk transfer with DMA, interrupt and
>> |    control transfer."
>> |
>> | However, the document does not mention interrupt transfers anywhere
>> | else and IN_CSR2_REG, bit ISO, makes me think that maybe only bulk
>> | transfers are possible:
>>
>> The docs repeatedly say that interrupt transfer is supported... but I
>> don't know enough about it to know how.  I guess maybe you get further
>> examining the udc driver looking for APIs around it?

You have to take care about the words used here, the manual is not
always clear. Often in the 2410 manual iirc, what they're calling
"interrupt transfert" is the mode currently used (something like
pio). It's opposed to DMA transferts. [ warning: this is not valid for
ep0 which is used for control stuff ]

>
> I read through drivers/usb/gadget/s3c2410_udc.c but could not spot
> anything obvious. arch/arm/plat-s3c24xx/include/plat/regs-udc.h
> defines S3C2410_UDC_ICSR2_ISO but nothing seems to use it.

This ISO bit is not documented in the 2410 manual. In fact all things
related to the ISO mode is not documented in the 2410 manual. My guess
about that, is for isochronous transferts. As the 2410 and 2442 don't
support iso transferts, they didn't bother to document that. Try to find
a s3cxxxx SoC which support iso transferts (if there are some), that
would confirm or not this hypothesis.
iirc, even the old 2.4.18 stuff from Mizi did not use it.

>
> Just to have something to compare against I also read
> drivers/usb/gadget/omap_udc.c which does talk about interrupt
> transfers when it calls
>
> #define OMAP_INT_EP(name,addr, maxp) \
>         buf = omap_ep_setup(name "-int", addr, \
>                         USB_ENDPOINT_XFER_INT, buf, maxp, 0);

afaik interrupts are bulk endpoints with a different handling : you have
periodic transferts on the interrupt endpoints so imho any bulk endpoint
can be used as interrupt endpoint as long as you provide the right usb
descriptor when the host is asking for it.
If you look at all linux udc drivers, I would not be surprised to see no
difference int and bulk endpoint handling except in the name. Look also
at the gadget drivers, for instance the file_storage or ethernet stuff
which require interrupt endpoints iirc. Looking at the epautoconf stuff
may be interesting for you too.

As regard your application of keyboard or pointing device, you can try
changing the ep3 and ep4 definitions to -int instead of -bulk (and
update other fields in the structure accordingly) like in the *not*
*tested* appended patch. I didn't even build tested it :)
If it works for you, I'll try to submit it for next merge window.

On a side note, I'm surprised that there's no hid gadget driver
and fixes for that if needed. I already heard of people wanting to do
that on 2410 monthes and maybe years ago :/ 

>
> which just puts the endpoint type to bmAttributes but I can't see
> where that would be sent to
> hardware. http://www.ti.com/lit/gpn/omap5910 says "The exact endpoint
> configuration is software-programmable." but does not elaborate
> further what this means. Does the hardware read it from the
> descriptor? Where is the descriptor sent to hardware?

I didn't look at the Omap 5910 manual but I guess they're saying what
I've just said: the interrupt endpoints are the bulk endpoint with a
different usb descriptor.

Regards,
Arnaud
Index: linux-2.6/drivers/usb/gadget/s3c2410_udc.c
===================================================================
--- linux-2.6.orig/drivers/usb/gadget/s3c2410_udc.c
+++ linux-2.6/drivers/usb/gadget/s3c2410_udc.c
@@ -1110,7 +1110,7 @@ static int s3c2410_udc_ep_enable(struct 
 
 	/* print some debug message */
 	tmp = desc->bEndpointAddress;
-	dprintk (DEBUG_NORMAL, "enable %s(%d) ep%x%s-blk max %02x\n",
+	dprintk (DEBUG_NORMAL, "enable %s(%d) ep%x%s max %02x\n",
 		 _ep->name,ep->num, tmp,
 		 desc->bEndpointAddress & USB_DIR_IN ? "in" : "out", max);
 
@@ -1766,26 +1766,26 @@ static struct s3c2410_udc memory = {
 	.ep[3] = {
 		.num		= 3,
 		.ep = {
-			.name		= "ep3-bulk",
+			.name		= "ep3-int",
 			.ops		= &s3c2410_ep_ops,
 			.maxpacket	= EP_FIFO_SIZE,
 		},
 		.dev		= &memory,
 		.fifo_size	= EP_FIFO_SIZE,
 		.bEndpointAddress = 3,
-		.bmAttributes	= USB_ENDPOINT_XFER_BULK,
+		.bmAttributes	= USB_ENDPOINT_XFER_INT,
 	},
 	.ep[4] = {
 		.num		= 4,
 		.ep = {
-			.name		= "ep4-bulk",
+			.name		= "ep4-int",
 			.ops		= &s3c2410_ep_ops,
 			.maxpacket	= EP_FIFO_SIZE,
 		},
 		.dev		= &memory,
 		.fifo_size	= EP_FIFO_SIZE,
 		.bEndpointAddress = 4,
-		.bmAttributes	= USB_ENDPOINT_XFER_BULK,
+		.bmAttributes	= USB_ENDPOINT_XFER_INT,
 	}
 
 };
_______________________________________________
devel mailing list
devel@lists.openmoko.org
https://lists.openmoko.org/mailman/listinfo/devel

Reply via email to