public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [RFC 00/10] New board-specific USB initialization interface
@ 2013-08-06 10:50 Mateusz Zalega
  2013-08-06 10:50 ` [U-Boot] [RFC 01/10] " Mateusz Zalega
  0 siblings, 1 reply; 5+ messages in thread
From: Mateusz Zalega @ 2013-08-06 10:50 UTC (permalink / raw)
  To: u-boot

Current implementation of do_dfu() and do_usb_mass_storage() requires
board-specific board_usb_init() which performs USB hardware initialization.

I noticed that several boards have such a function defined, named either
usb_board_init() (which binds to ohci-hcd.c driver and had been used solely
by it) or board_usb_init() (as in ehci-omap.c). I _assumed_ that these functions
do what's required by do_*() and renamed the earlier in order to unify the naming
convention.

It would:
+ make enabling DFU and UMS in these boards easier
+ clean up the namespace
+ improve code reusability
+ enable devs to postpone hardware init until it's needed (as in do_dfu())

Declarations of these functions were scattered all over the codebase. Seeing it
as a bad practice, I added declaration of usb_board_init() in usb.h and removed
the other.

I added a weak symbol for usb_board_init() in usb.c so that boards which do not
require USB initialization or have to initialize hardware earlier would compile
and run.

For boards which offer both USB device and host capabilities, you can specify
which part, host or device, to initialize, via function argument.

Does this approach sound good and/or reasonable?

Code compiles successfully for all ARM boards and was tested on Samsung Goni.

Mateusz Zalega (10):
  New board-specific USB initialization interface
  nvidia, tegra: new USB hardware init interface
  Voipac PXA270: new USB hardware init interface
  Trizeps IV: new USB hardware init interface
  Colibri PXA270: new USB hardware init interface
  icpdas lp8x4x: new USB hardware init interface
  esd pmc440: new USB hardware init interface
  esd apc405: new USB hardware init interface
  balloon3: new USB hardware init interface
  canyonlands: new USB hardware init interface

 arch/arm/include/asm/arch-tegra/usb.h         |  3 +--
 board/amcc/canyonlands/canyonlands.c          |  5 +++--
 board/balloon3/balloon3.c                     |  5 +++--
 board/esd/apc405/apc405.c                     |  5 +++--
 board/esd/pmc440/pmc440.c                     |  5 +++--
 board/icpdas/lp8x4x/lp8x4x.c                  |  5 +++--
 board/nvidia/common/board.c                   | 14 ++++++++++----
 board/toradex/colibri_pxa270/colibri_pxa270.c |  5 +++--
 board/trizepsiv/conxs.c                       |  5 +++--
 board/vpac270/vpac270.c                       |  5 +++--
 common/cmd_dfu.c                              |  5 ++---
 common/cmd_usb_mass_storage.c                 |  3 ++-
 common/usb.c                                  |  5 +++++
 drivers/usb/host/ehci-omap.c                  |  8 +-------
 drivers/usb/host/ehci-tegra.c                 |  2 +-
 drivers/usb/host/ohci-hcd.c                   |  4 ++--
 drivers/usb/host/ohci.h                       | 12 +++++-------
 include/g_dnl.h                               |  2 --
 include/usb.h                                 | 17 ++++++++++++++++-
 include/usb_mass_storage.h                    | 12 +++++-------
 20 files changed, 74 insertions(+), 53 deletions(-)

-- 
1.8.2.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-08-12  9:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <52027F05.3010309@samsung.com>
2013-08-07 17:09 ` [U-Boot] [RFC 01/10] New board-specific USB initialization interface Mateusz Zalega
2013-08-06 10:50 [U-Boot] [RFC 00/10] " Mateusz Zalega
2013-08-06 10:50 ` [U-Boot] [RFC 01/10] " Mateusz Zalega
2013-08-07 16:23   ` Stephen Warren
2013-08-11 18:04   ` Marek Vasut
2013-08-12  9:33     ` Mateusz Zalega

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox