Re: [U-Boot] [RFC PATCH v2 0/6] Port of MUSB driver from Linux

2012-09-22 Thread Ilya Yanok
Dear Marek,

On Sat, Sep 22, 2012 at 4:55 AM, Marek Vasut ma...@denx.de wrote:

 [...]

 I'm glad about this. But how can we make this work if we already have a
 driver
 for this in u-boot, now we will have another. Tom ?


What's so wrong in letting the two coexist for some time so people could
migrate smoothly? Of course we don't want any duplicate drivers... in the
perfect world. But we are not in the perfect world (look, there is a bunch
of OHCI drivers which are almost the same and they are in the tree for
years) and the drivers are rather different. Of course, we should encourage
people to switch to the new code, probably by marking the old one
deprecated and scheduled for removal.

BTW, anybody here use the current musb code? In my experience it never
worked as expected... Probably we can drop it right away without much
pain...

Regards, Ilya.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [RFC PATCH v2 0/6] Port of MUSB driver from Linux

2012-09-22 Thread Tom Rini
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 09/21/12 17:55, Marek Vasut wrote:
 Dear Ilya Yanok,
 
 Current MUSB driver in U-Boot uses old UDC API while new gagdet 
 client drivers need new gadget API. Also current MUSB driver has 
 some significant limitations (like inability to handle tx for 
 endpoints other than ep0). So I think port of new Linux driver
 is desirable.
 
 This is initial port, performed mostly by putting DM and OTG code
 under #ifndef __UBOOT__ clauses. My intention was to be as close
 as possible to the original to ease of possible resyncs. Some
 warnings are suppressed via CFLAGS. There are some style problems
 but I'm not touching them for now for the above mentioned reason.
 There is obviously some room for optimisation, some structure
 fields are unused as well as (probably) some code.
 
 This is not a replacement for existing MUSB driver (at least for 
 now), cause there are still consumers of the old interface and 
 the only ported backend is for TI AM335X (while the old code has
  a bunch of other backends).
 
 OTG and DMA are not supported. The only ported driver is for TI 
 AM33xx, but others should be easy to port too.
 
 Virtual root hub is not implemented but this shouldn't be a big 
 problem as the old code has virtual root hub support enabled only
 for Blackfin platform.
 
 Tested it on AM335x EVM and BeagleBone with CDC Ethernet gadget 
 and a bunch of storage devices.
 
 Pathes are rather big because of the original code size (and I 
 didn't delete unused code, just disabled it). So it's probably 
 better to look at changes as compared to Linux code. I prepared 
 such version also, you can find it at [1]. Hopefully it will be 
 also useful if resync with the kernel will be needed in future.
 
 [1] https://github.com/yanok/u-boot/tree/musb-changes-from-linux
 
 [...]
 
 I'm glad about this. But how can we make this work if we already 
 have a driver for this in u-boot, now we will have another. Tom ?

Part of our pain point here is that, if I'm following everything
right, we're switching from our home-grown MUSB framework to the
kernel one.  The good thing is that there's not many users of the
existing framework.  Being able to switch to a codebase we can re-sync
with the kernel for is a good thing.  It comes down to how much of an
effort it is to convert and leave untested the other platforms.  The
good news I believe is that aside from am335x everything else already
has a kernel portion to work from.

- -- 
Tom
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQIcBAEBAgAGBQJQXfj2AAoJENk4IS6UOR1WOaYP/2GyTGP2GLxu6R7NymMqXp4N
Q2G3qe7wfBMr89ISqYc05QNXnSBcmEgklMoNr2u4XXws4hvtDawX+KGshJfDlPJD
r9LNWygZ3bPi39d/hrzgjgdrICZLcl6BqArgNSrj0UDhOdW5u5Xh1jK2h9113IVI
2SYcTyWtFgcgCZ7GIk3nd6z7RqMaFarTywKEiShP3hzcS1MVVqodk7js129jEORS
e6WdNK4ijg9xaMY93eprIg7Lr9B4OttLt/Xwo96gQO0ww5tHDY+zZaZ30UXBj9HT
mBIYlAvE9eA53Z5QhX6pUcfUZvg5zWvaYNhXqGnRe7frrA+t2PomKk6WFS7vJ+JM
BT9fDR75n3cXcXwcKm9E0vxNAU9NHMEuLH78erdoJWwTir4F7gFRkg7ykGeQhXl8
W+UFG76OVVSaoSjiEU6XQf34j4OHG1ynej7xCklFBBY57i3n3cuhSN33TpyvfzpW
bfwJjYBFhwZT7y9jEAJIKMeul28hWINPVarE/gOFeCoFJbVu+ZqI7HSg6Gd0+8CV
DE3P4Oj93a96FtUHJ/H8WiYMs5sV6bqE6fDkFxD+edgGbI4ATqJq6JUGJ5kYh1lz
B+yICnu6fyobhAAWTvXqayQbRupQKYskmbBj1o1VGl1qJPRHZJUpVFdPacqDZ5kQ
31wdacKo393lIImQku+5
=NvNG
-END PGP SIGNATURE-
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [RFC PATCH v2 0/6] Port of MUSB driver from Linux

2012-09-21 Thread Marek Vasut
Dear Ilya Yanok,

 Current MUSB driver in U-Boot uses old UDC API while new gagdet
 client drivers need new gadget API. Also current MUSB driver has
 some significant limitations (like inability to handle tx for
 endpoints other than ep0). So I think port of new Linux driver is
 desirable.
 
 This is initial port, performed mostly by putting DM and OTG
 code under #ifndef __UBOOT__ clauses. My intention was to be as
 close as possible to the original to ease of possible resyncs.
 Some warnings are suppressed via CFLAGS. There are some style
 problems but I'm not touching them for now for the above mentioned
 reason. There is obviously some room for optimisation, some
 structure fields are unused as well as (probably) some code.
 
 This is not a replacement for existing MUSB driver (at least for
 now), cause there are still consumers of the old interface and
 the only ported backend is for TI AM335X (while the old code
 has a bunch of other backends).
 
 OTG and DMA are not supported. The only ported driver
 is for TI AM33xx, but others should be easy to port too.
 
 Virtual root hub is not implemented but this shouldn't be
 a big problem as the old code has virtual root hub support
 enabled only for Blackfin platform.
 
 Tested it on AM335x EVM and BeagleBone with CDC Ethernet gadget
 and a bunch of storage devices.
 
 Pathes are rather big because of the original code size (and I didn't
 delete unused code, just disabled it). So it's probably better to
 look at changes as compared to Linux code. I prepared such version
 also, you can find it at [1]. Hopefully it will be also useful
 if resync with the kernel will be needed in future.
 
 [1] https://github.com/yanok/u-boot/tree/musb-changes-from-linux
 
[...]

I'm glad about this. But how can we make this work if we already have a driver 
for this in u-boot, now we will have another. Tom ?

Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [RFC PATCH v2 0/6] Port of MUSB driver from Linux

2012-09-16 Thread Ilya Yanok
Current MUSB driver in U-Boot uses old UDC API while new gagdet
client drivers need new gadget API. Also current MUSB driver has
some significant limitations (like inability to handle tx for
endpoints other than ep0). So I think port of new Linux driver is
desirable.

This is initial port, performed mostly by putting DM and OTG
code under #ifndef __UBOOT__ clauses. My intention was to be as
close as possible to the original to ease of possible resyncs.
Some warnings are suppressed via CFLAGS. There are some style
problems but I'm not touching them for now for the above mentioned
reason. There is obviously some room for optimisation, some
structure fields are unused as well as (probably) some code.

This is not a replacement for existing MUSB driver (at least for
now), cause there are still consumers of the old interface and
the only ported backend is for TI AM335X (while the old code
has a bunch of other backends).

OTG and DMA are not supported. The only ported driver
is for TI AM33xx, but others should be easy to port too.

Virtual root hub is not implemented but this shouldn't be
a big problem as the old code has virtual root hub support
enabled only for Blackfin platform.

Tested it on AM335x EVM and BeagleBone with CDC Ethernet gadget
and a bunch of storage devices.

Pathes are rather big because of the original code size (and I didn't
delete unused code, just disabled it). So it's probably better to
look at changes as compared to Linux code. I prepared such version
also, you can find it at [1]. Hopefully it will be also useful
if resync with the kernel will be needed in future.

[1] https://github.com/yanok/u-boot/tree/musb-changes-from-linux


Changes in v2:
 - add missing linux-compat.h header
 - added host support
 - glue code moved from musb_gadget_uboot.c to musb_uboot.c and
   cleaned up slightly.
 - added check for malloc return value
 - define is_{host,peripheral}_capable conditionally to support
   compilation with only host or gadget enabled
 - added some more is_{host,peripheral}_capable guards to core
   code to support compilation with only host or gadget enabled
 - rename backend config option to CONFIG_USB_MUSB_DSPS
 - we are providing host support now so add yourself to usb.h
 - init both musb IPs (conditionally) from arch_init not
   from eth_initialize
 - host support enabled
 - define CONFIG_ARCH_INIT as now musb_register() is called
   from arch_init()
 - use new config options

Ilya Yanok (6):
  linux/usb/ch9.h: update with the version from Linux tree
  usb: use linux/usb/ch9.h instead of usbdescriptors.h
  musb-new: port of Linux musb driver
  musb-new: dsps backend driver
  am33xx: init OTG hardware and new musb gadget driver
  am335x_evm: enable both musb gadget and host

 Makefile  |1 +
 arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c   |2 +-
 arch/arm/cpu/armv7/am33xx/board.c |  107 +-
 arch/arm/cpu/armv7/am33xx/clock.c |8 +
 arch/arm/include/asm/arch-am33xx/cpu.h|   11 +-
 arch/arm/include/asm/arch-am33xx/hardware.h   |4 +
 arch/arm/include/asm/omap_musb.h  |   25 +
 arch/mips/cpu/mips32/au1x00/au1x00_usb_ohci.c |2 +-
 arch/powerpc/cpu/mpc5xxx/usb_ohci.c   |2 +-
 arch/powerpc/cpu/ppc4xx/usb_ohci.c|2 +-
 common/cmd_usb.c  |2 +-
 common/usb.c  |4 +-
 drivers/usb/gadget/config.c   |1 -
 drivers/usb/gadget/epautoconf.c   |1 -
 drivers/usb/gadget/ether.c|1 -
 drivers/usb/gadget/gadget_chips.h |2 +
 drivers/usb/gadget/s3c_udc_otg.c  |1 -
 drivers/usb/gadget/usbstring.c|1 -
 drivers/usb/host/ehci-hcd.c   |   16 +-
 drivers/usb/host/isp116x-hcd.c|2 +-
 drivers/usb/host/ohci-hcd.c   |2 +-
 drivers/usb/host/sl811-hcd.c  |2 +-
 drivers/usb/musb-new/Makefile |   37 +
 drivers/usb/musb-new/linux-compat.h   |  109 ++
 drivers/usb/musb-new/musb_core.c  | 2497 +
 drivers/usb/musb-new/musb_core.h  |  623 ++
 drivers/usb/musb-new/musb_debug.h |   58 +
 drivers/usb/musb-new/musb_dma.h   |  186 ++
 drivers/usb/musb-new/musb_dsps.c  |  771 
 drivers/usb/musb-new/musb_gadget.c| 2333 +++
 drivers/usb/musb-new/musb_gadget.h|  130 ++
 drivers/usb/musb-new/musb_gadget_ep0.c| 1089 +++
 drivers/usb/musb-new/musb_host.c  | 2400 
 drivers/usb/musb-new/musb_host.h  |  114 ++
 drivers/usb/musb-new/musb_io.h|  146 ++
 drivers/usb/musb-new/musb_regs.h  |  645 +++
 drivers/usb/musb-new/musb_uboot.c |  237 +++
 drivers/usb/musb-new/usb-compat.h |   88 +