
Hi,
Of course, if you agree with my analyses, I will send patches to fix them.
Great!
- The status_req buffer is static allocated as u8. However, in
eth_status_complete is referenced with a 32 bit pointer:
__le32 *data = req->buf
In most case the buffer is not 32-bit aligned and causes an exception.
nice catch.
- In eth_bind a wrong ep is allocated.
#if defined(DEV_CONFIG_CDC) if (dev->status_ep) { dev->stat_req = usb_ep_alloc_request(gadget->ep0, GFP_KERNEL);
This should be:
dev->stat_req = usb_ep_alloc_request(dev->status_ep, GFP_KERNEL);
OK.
- Not sure about the handling in usb_eth_send. I do not know if the fix
I propone works only for the musb driver or could be general and it was to me not clear as the packet_sent variable is managed:
1834 while(!packet_sent) 1835 { 1836 packet_sent=0; 1837 } It seems there is no possibility to change packet_sent if we run in the loop....
I managed to call handle_interrupts() inside the loop to get it working. I can only assume that on your Atmel Core, tx_complete is called directly after running into usb_ep_queue, and then you have not this issue. But for most drivers, it should be required to call the interrupt routine (or something like that, but we have already handle_interrupts()) to manage all events.
Sounds okay. Indeed the Atmel core calls tx_complete(). Calling handle_interrupts() here might indeed do the job...
Kind regards,
Remy