[U-Boot] [PATCH v4] usb: new board-specific USB init interface

Mateusz Zalega
2013-09-26T10:04:53Z

On 09/26/13 03:50, Marek Vasut wrote:
> Dear Mateusz Zalega,
>
>> On 09/19/13 16:34, Marek Vasut wrote:
>>> I checked powerpc and "arches" "glacier" and "glacier_nand" don't build.
>>> Can you please check and fix ? You can get the ELDK 5.4 PPC toolchain
>>> from [1].
>>>
>>> http://www.denx.de/wiki/ELDK-5/
>>
>> Hello,
>> it's because I moved some function declarations and had to include usb.h
>> in their code.
>
> Can you please elabore which functions did you exactly move that cause this to
> fail now ?

172 /*
173 * You can initialize platform's USB host or device
174 * ports by passing this enum as an argument to
175 * board_usb_init().
176 */
177 enum board_usb_init_type {
178 USB_INIT_HOST,
179 USB_INIT_DEVICE
180 };
181
182 /*
183 * board-specific hardware initialization, called by
184 * usb drivers and u-boot commands
185 *
186 * @param index USB controller number
187 * @param init initializes controller as USB host or device
188 */
189 int board_usb_init(int index, enum board_usb_init_type init);
190
191 /*
192 * can be used to clean up after failed USB initialization attempt
193 * vide: board_usb_init()
194 *
195 * @param index USB controller number for selective cleanup
196 * @param init board_usb_init_type passed to board_usb_init()
197 */
198 int board_usb_cleanup(int index, enum board_usb_init_type init);

>> @usb.h, this giant ifdef fails:
>> 134 #if defined(CONFIG_USB_UHCI) || defined(CONFIG_USB_OHCI) || \
>> 135 defined(CONFIG_USB_EHCI) || defined(CONFIG_USB_OHCI_NEW) || \
>> 136 defined(CONFIG_USB_SL811HS) ||
>> defined(CONFIG_USB_ISP116X_HCD) || \
>> 137 defined(CONFIG_USB_R8A66597_HCD) ||
>> defined(CONFIG_USB_DAVINCI) || \
>> 138 defined(CONFIG_USB_OMAP3) || defined(CONFIG_USB_DA8XX) || \
>> 139 defined(CONFIG_USB_BLACKFIN) || defined(CONFIG_USB_AM35X) || \
>> 140 defined(CONFIG_USB_MUSB_DSPS) ||
>> defined(CONFIG_USB_MUSB_AM35X) || \
>> 141 defined(CONFIG_USB_MUSB_OMAP2PLUS)
>>
>> and results in:
>> 169 #error USB Lowlevel not defined
>>
>> I don't like the notion of using board-specific CONFIG_* defines in
>> usb.h. Any ideas on where can we move it? Maybe one generic
>> CONFIG_USB_HOST specified in board code would do?
>
> The ifdef is pretty much what would CONFIG_USB_HOST do.

Yeah, but it would be nice to be able to add more boards to u-boot
without touching usb.h.

CONFIG_USB_OMAP3 <-- what happens in arch/board code should stay there

--
Mateusz Zalega
Samsung R&D Institute Poland