[U-Boot] [RFC PATCH v3 0/13] Port of MUSB driver from Linux (changes from Linux)

Ilya Yanok ilya.yanok at cogentembedded.com
Thu Oct 18 20:51:47 CEST 2012


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 USB serial gadget which
uses old API and there is no support for serial with new API
for now.

OTG and DMA are not supported. Ported drivers include:
musb_dsps (should work both with TI AM33xx and TI81xx, tested only on
AM33xx), am35x (tested on AM3517 EVM) and omap2plus (should work on
OMAP2/3/4, tested on omap3_beagle, omap4_panda doesn't work and needs
more work). 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.

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-v3


Changes in v3:
 - fix old MUSB code compilation
 - bugfix: struct musb should be zeroed after alloc
 - fix musb gadget_chips entry
 - fix for new multi-interface usb API
 - use clrsetbits_le32 for USB PHY ops

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

Ilya Yanok (13):
  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
  musb-new: am35x backend driver
  OMAP3: am35x_def.h: add USB defines
  OMAP3: am35x: add musb functions
  am3517_evm: switch to musb-new
  musb-new: omap2plus backend driver
  omap3_beagle: add musb-new init
  omap3_beagle: use new MUSB intstead of the old one

 Makefile                                      |    1 +
 arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c       |    2 +-
 arch/arm/cpu/armv7/am33xx/board.c             |  103 +-
 arch/arm/cpu/armv7/am33xx/clock.c             |    8 +
 arch/arm/cpu/armv7/omap3/Makefile             |    1 +
 arch/arm/cpu/armv7/omap3/am35x_musb.c         |   75 +
 arch/arm/include/asm/arch-am33xx/cpu.h        |   11 +-
 arch/arm/include/asm/arch-am33xx/hardware.h   |    4 +
 arch/arm/include/asm/arch-omap3/am35x_def.h   |   27 +
 arch/arm/include/asm/arch-omap3/musb.h        |   28 +
 arch/arm/include/asm/omap_musb.h              |   32 +
 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 +-
 board/logicpd/am3517evm/am3517evm.c           |   74 +
 board/ti/beagle/beagle.c                      |   43 +
 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             |    4 +-
 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                 |   39 +
 drivers/usb/musb-new/am35x.c                  |  709 +++++++
 drivers/usb/musb-new/linux-compat.h           |  119 ++
 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/omap2430.c               |  626 +++++++
 drivers/usb/musb-new/omap2430.h               |   56 +
 drivers/usb/musb-new/usb-compat.h             |   88 +
 drivers/usb/musb/musb_core.h                  |    3 +-
 drivers/usb/musb/musb_hcd.c                   |    5 +-
 include/configs/am335x_evm.h                  |   27 +
 include/configs/am3517_evm.h                  |   37 +-
 include/configs/omap3_beagle.h                |   13 +-
 include/linux/usb/ch9.h                       |  514 ++++-
 include/linux/usb/musb.h                      |  162 ++
 include/usb.h                                 |   19 +-
 include/usb/s3c_udc.h                         |    1 -
 include/usb_defs.h                            |    6 -
 57 files changed, 14015 insertions(+), 90 deletions(-)
 create mode 100644 arch/arm/cpu/armv7/omap3/am35x_musb.c
 create mode 100644 arch/arm/include/asm/arch-omap3/musb.h
 create mode 100644 arch/arm/include/asm/omap_musb.h
 create mode 100644 drivers/usb/musb-new/Makefile
 create mode 100644 drivers/usb/musb-new/am35x.c
 create mode 100644 drivers/usb/musb-new/linux-compat.h
 create mode 100644 drivers/usb/musb-new/musb_core.c
 create mode 100644 drivers/usb/musb-new/musb_core.h
 create mode 100644 drivers/usb/musb-new/musb_debug.h
 create mode 100644 drivers/usb/musb-new/musb_dma.h
 create mode 100644 drivers/usb/musb-new/musb_dsps.c
 create mode 100644 drivers/usb/musb-new/musb_gadget.c
 create mode 100644 drivers/usb/musb-new/musb_gadget.h
 create mode 100644 drivers/usb/musb-new/musb_gadget_ep0.c
 create mode 100644 drivers/usb/musb-new/musb_host.c
 create mode 100644 drivers/usb/musb-new/musb_host.h
 create mode 100644 drivers/usb/musb-new/musb_io.h
 create mode 100644 drivers/usb/musb-new/musb_regs.h
 create mode 100644 drivers/usb/musb-new/musb_uboot.c
 create mode 100644 drivers/usb/musb-new/omap2430.c
 create mode 100644 drivers/usb/musb-new/omap2430.h
 create mode 100644 drivers/usb/musb-new/usb-compat.h
 create mode 100644 include/linux/usb/musb.h

-- 
1.7.10.4



More information about the U-Boot mailing list