[U-Boot] USB CDC Branch: adding gadget for MUSB

Hi Remy,
I would like to add ethernet gadget support for the MUSB driver (used only as peripheral, not otg). I have some problems to understand what is really needed to get it working.
From sources, I see that musb_udc.c was not ported from a corresponding
linux driver, but it was implemented from scratch (ok, maybe not entirely...) for u-boot. And I see also that musb_core.c in u-boot contains a small subsets of the functions we can find in the corresponding file in the linux tree.
After checking the linux driver that supports the ethernet gadget (musb_gadget.c), it seemed to me that the less effort approach should be to implements the missing things in the musb_udc.c driver, compared to port musb_gadget.c from linux. I really started to port it, but I recognize that I have to change a lot of things even in other files (in core and so on), and probably this is the best way to break a lot of boards ;(
So I decided (but it could be not the best solution...any thoughts about this ?) to take the way to update the current UDC musb_udc.c driver to support the gadget framework. I am really unsure about this, because the drawback is to have a completely different implementation from what we currently see under linux.
As I see, there is support in this driver only for the ep0 endpoint, and this should be not enough for the ether gadget. I assume we need at least one bulk endpoint (or two, one for each directions) and then I should add the missing functions for TX/RX fo all endpoints. But again, I need also wrapping functions (or rewriting some of them..) for the ep0 endpoints, because the functions in the ops field of the gadget structure looks like different as what is already implemented.
Probably I used a bad approach to reach my goal. What do you think about it ?
Regards, Stefano

On Tuesday, July 20, 2010 05:46:23 Stefano Babic wrote:
From sources, I see that musb_udc.c was not ported from a corresponding linux driver, but it was implemented from scratch (ok, maybe not entirely...) for u-boot. And I see also that musb_core.c in u-boot contains a small subsets of the functions we can find in the corresponding file in the linux tree.
afaik, they were developed from the same tree. but the u-boot maintainers were more stringent than the Linux maintainers in how the code should be formatted style wise and so they quickly diverged. at this point, it's less effort in the short term to continue the forks. -mike
participants (2)
-
Mike Frysinger
-
Stefano Babic