[U-Boot] [RFC 00/10] New board-specific USB initialization interface
Mateusz Zalega
m.zalega at samsung.com
Tue Aug 6 12:50:32 CEST 2013
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
More information about the U-Boot
mailing list