Hello Kernel lovers.
I have an issue of my 2.6.10 embedded Linux
My USB bus is S3C2410, samsung, and my processor is ARM
I am trying to place a "stall" over the USB bus in Linux over the file linux/drivers/usb/gadget/serial.c.
I added set_feature, clear_feature and get_status requests from include/linux/usb.h & usb_gadget.h.
I am intending to use the functions (queue, dequeue, set&clear halt etc in the header file here)
I am supposing set_halt (if returned 0) will set halt on an endpoint - but it is not.
I tried this
if ((ctrl->brequest==SET_FEATURE) && (ctrl->brecepient == endpoint && 0xf))//MASK - 5 endpoints, I receive 0x80 + endpoint is direction in, 0x00 + endpoint direction out
1- I tried:
usb_ep_fifo_flush(ep); //so set_ep_halt succeeds, we need to dequeue, but I am flushing totally
ret = usb_ep_halt (ep); //ret is 0 as I see on debug files
status[endpoint_number] = 0;
On log file, I see endp = 2 or 3, direction in or out and ret = 0
2- I tried:
from USB samsung manual above, page 13-9
USB dev controller special index register:
place the index of an endpoint into the index register, and send value to the hardware according to page 13-12 and 13-13
set_index_reg_value (brecepient & 0xf); //to program the endpoint's index register
u32 value = read (EP0_CSR);
value = value | SERVICED_OUT_PKT_RDY; //clear OUT_PKT_RDY bit 0
value = value | SEND_STALL; // placing this MUST stall by hw
write (EP0_CSR, value);
On clear_halt, I read the same value that I placed last time when set, which means, my write is successful and consistent.
But running the ch9 test
tells me ALWAYS that
Endpoint halt failed for 83
cleared stall 83
Endpoint halt failed for 82
cleared stall on 82
Endpoint halt failed for 1
cleared stall on 1
A device that has Bulk/Interrupt endpoints must support the Halt Endpoint request on those endpoints
I tried http://www.cygnal.org/ubb/Forum9/HTML/001749.html
and changed the interval into 0x8, 0x10, etc, but the test is still consistent on bothering me for a week!!
on my custom structure (gadget_usb_driver) I have 2 endpoints only not 5 (marked as 0x80 in, 0x0 out)
but I cheat with the number bEndpointAddress 0x80 + 1 / + 2 / +3 now and then
Still it fails all the tests 83, 82 and 1, which means it is IRRELATED to the number bEndpointAddress.
please help if you know where I am failing.
Could it be (delay) addition because serial is too slow?
Or must I insert other endpoints and initialize them, bind them and etc?
Or I am programming wrong hardware?
Or any other hint that I am missing?
Is it endianness in ARM? I dont believe so