From 5853e1335cfc76c230cc28c4226b4d513ddb7542 Mon Sep 17 00:00:00 2001 From: Vivek Gautam Date: Sat, 14 Sep 2013 14:02:45 +0530 Subject: USB: xHCI: Add stack support for xHCI This adds stack layer for eXtensible Host Controller Interface which facilitates use of USB 3.0 in host mode. Adapting xHCI host controller driver in linux-kernel by Sarah Sharp to needs in u-boot. Initial porting from Linux kernel version 3.4, with following top commit history of drivers/usb/host/xhci* : cf84055 xHCI: Cleanup isoc transfer ring when TD length mismatch found This adds the basic xHCI host controller driver with bare minimum features: - Control/Bulk transfer support has been added with required infrastructure for necessary xHC data structures. - Stream protocol hasn't been supported yet. - No support for quirky devices has been added. Signed-off-by: Vikas C Sajjan Signed-off-by: Julius Werner Signed-off-by: Vivek Gautam Cc: Simon Glass Cc: Minkyu Kang Cc: Dan Murphy Cc: Marek Vasut --- common/usb.c | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) (limited to 'common') diff --git a/common/usb.c b/common/usb.c index c97f522bedd..e23d7888552 100644 --- a/common/usb.c +++ b/common/usb.c @@ -854,6 +854,16 @@ void usb_free_device(void) usb_dev[dev_index].devnum = -1; } +/* + * XHCI issues Enable Slot command and thereafter + * allocates device contexts. Provide a weak alias + * function for the purpose, so that XHCI overrides it + * and EHCI/OHCI just work out of the box. + */ +__weak int usb_alloc_device(struct usb_device *udev) +{ + return 0; +} /* * By the time we get here, the device has gotten a new device ID * and is in the default state. We need to identify the thing and @@ -867,6 +877,17 @@ int usb_new_device(struct usb_device *dev) int tmp; ALLOC_CACHE_ALIGN_BUFFER(unsigned char, tmpbuf, USB_BUFSIZ); + /* + * Allocate usb 3.0 device context. + * USB 3.0 (xHCI) protocol tries to allocate device slot + * and related data structures first. This call does that. + * Refer to sec 4.3.2 in xHCI spec rev1.0 + */ + if (usb_alloc_device(dev)) { + printf("Cannot allocate device context to get SLOT_ID\n"); + return -1; + } + /* We still haven't set the Address yet */ addr = dev->devnum; dev->devnum = 0; @@ -897,7 +918,7 @@ int usb_new_device(struct usb_device *dev) * http://sourceforge.net/mailarchive/forum.php? * thread_id=5729457&forum_id=5398 */ - struct usb_device_descriptor *desc; + __maybe_unused struct usb_device_descriptor *desc; int port = -1; struct usb_device *parent = dev->parent; unsigned short portstatus; @@ -914,6 +935,13 @@ int usb_new_device(struct usb_device *dev) dev->epmaxpacketin[0] = 64; dev->epmaxpacketout[0] = 64; + /* + * XHCI needs to issue a Address device command to setup + * proper device context structures, before it can interact + * with the device. So a get_descriptor will fail before any + * of that is done for XHCI unlike EHCI. + */ +#ifndef CONFIG_USB_XHCI err = usb_get_descriptor(dev, USB_DT_DEVICE, 0, desc, 64); if (err < 0) { debug("usb_new_device: usb_get_descriptor() failed\n"); @@ -926,11 +954,12 @@ int usb_new_device(struct usb_device *dev) * to differentiate between HUB and DEVICE. */ dev->descriptor.bDeviceClass = desc->bDeviceClass; +#endif - /* find the port number we're at */ if (parent) { int j; + /* find the port number we're at */ for (j = 0; j < parent->maxchild; j++) { if (parent->children[j] == dev) { port = j; -- cgit v1.2.3 From 16297cfb2a20c9d89834cd9e31edac5184a777a1 Mon Sep 17 00:00:00 2001 From: Mateusz Zalega Date: Fri, 4 Oct 2013 19:22:26 +0200 Subject: usb: new board-specific USB init interface This commit unifies board-specific USB initialization implementations under one symbol (usb_board_init), declaration of which is available in usb.h. New API allows selective initialization of USB controllers whenever needed. Signed-off-by: Mateusz Zalega Signed-off-by: Kyungmin Park Reviewed-by: Lukasz Majewski Cc: Marek Vasut Cc: Lukasz Majewski --- arch/arm/include/asm/arch-tegra/usb.h | 3 +- arch/arm/include/asm/ehci-omap.h | 4 +-- board/amcc/canyonlands/canyonlands.c | 5 +-- board/balloon3/balloon3.c | 7 +++-- board/compulab/cm_t35/cm_t35.c | 2 +- board/esd/apc405/apc405.c | 8 ++--- board/esd/pmc440/pmc440.c | 8 ++--- board/htkw/mcx/mcx.c | 2 +- board/icpdas/lp8x4x/lp8x4x.c | 7 +++-- board/nvidia/common/board.c | 4 ++- board/samsung/trats/trats.c | 5 +-- board/technexion/twister/twister.c | 2 +- board/teejet/mt_ventoux/mt_ventoux.c | 2 +- board/ti/beagle/beagle.c | 2 +- board/ti/omap5_uevm/evm.c | 2 +- board/ti/panda/panda.c | 2 +- board/toradex/colibri_pxa270/colibri_pxa270.c | 7 +++-- board/trizepsiv/conxs.c | 7 +++-- board/vpac270/vpac270.c | 7 +++-- common/cmd_dfu.c | 30 ++++++++++-------- common/cmd_usb_mass_storage.c | 44 ++++++++++++++------------- common/usb.c | 6 ++++ drivers/dfu/dfu.c | 2 +- drivers/usb/host/ehci-omap.c | 12 ++------ drivers/usb/host/ehci-tegra.c | 2 +- drivers/usb/host/ohci-hcd.c | 4 +-- drivers/usb/host/ohci.h | 11 +++---- include/g_dnl.h | 2 -- include/usb.h | 30 ++++++++++++++++-- include/usb_mass_storage.h | 13 +++----- 30 files changed, 138 insertions(+), 104 deletions(-) (limited to 'common') diff --git a/arch/arm/include/asm/arch-tegra/usb.h b/arch/arm/include/asm/arch-tegra/usb.h index f66257c9f7a..a1efd07c7d9 100644 --- a/arch/arm/include/asm/arch-tegra/usb.h +++ b/arch/arm/include/asm/arch-tegra/usb.h @@ -131,8 +131,7 @@ /* USB3_IF_USB_PHY_VBUS_SENSORS_0 */ #define VBUS_VLD_STS (1 << 26) - /* Setup USB on the board */ -int board_usb_init(const void *blob); +int usb_process_devicetree(const void *blob); #endif /* _TEGRA_USB_H_ */ diff --git a/arch/arm/include/asm/ehci-omap.h b/arch/arm/include/asm/ehci-omap.h index ac83a539a82..c7bca05682a 100644 --- a/arch/arm/include/asm/ehci-omap.h +++ b/arch/arm/include/asm/ehci-omap.h @@ -145,8 +145,8 @@ struct omap_ehci { struct ehci_hccr; struct ehci_hcor; -int omap_ehci_hcd_init(struct omap_usbhs_board_data *usbhs_pdata, - struct ehci_hccr **hccr, struct ehci_hcor **hcor); +int omap_ehci_hcd_init(int index, struct omap_usbhs_board_data *usbhs_pdata, + struct ehci_hccr **hccr, struct ehci_hcor **hcor); int omap_ehci_hcd_stop(void); #endif /* _OMAP_COMMON_EHCI_H_ */ diff --git a/board/amcc/canyonlands/canyonlands.c b/board/amcc/canyonlands/canyonlands.c index cc36f4587ca..395095e459c 100644 --- a/board/amcc/canyonlands/canyonlands.c +++ b/board/amcc/canyonlands/canyonlands.c @@ -16,6 +16,7 @@ #include #include #include +#include extern flash_info_t flash_info[CONFIG_SYS_MAX_FLASH_BANKS]; /* info for FLASH chips */ @@ -188,7 +189,7 @@ int board_early_init_f(void) } #if defined(CONFIG_USB_OHCI_NEW) && defined(CONFIG_SYS_USB_OHCI_BOARD_INIT) -int usb_board_init(void) +int board_usb_init(int index, enum board_usb_init_type init) { struct board_bcsr *bcsr_data = (struct board_bcsr *)CONFIG_SYS_BCSR_BASE; @@ -229,7 +230,7 @@ int usb_board_stop(void) return 0; } -int usb_board_init_fail(void) +int board_usb_cleanup(int index, enum board_usb_init_type init) { return usb_board_stop(); } diff --git a/board/balloon3/balloon3.c b/board/balloon3/balloon3.c index ecbac16d590..19c0e023a0e 100644 --- a/board/balloon3/balloon3.c +++ b/board/balloon3/balloon3.c @@ -13,6 +13,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -59,7 +60,7 @@ void dram_init_banksize(void) } #ifdef CONFIG_CMD_USB -int usb_board_init(void) +int board_usb_init(int index, enum board_usb_init_type init) { writel((readl(UHCHR) | UHCHR_PCPL | UHCHR_PSPL) & ~(UHCHR_SSEP0 | UHCHR_SSEP1 | UHCHR_SSEP2 | UHCHR_SSE), @@ -90,9 +91,9 @@ int usb_board_init(void) return 0; } -void usb_board_init_fail(void) +int board_usb_cleanup(int index, enum board_usb_init_type init) { - return; + return 0; } void usb_board_stop(void) diff --git a/board/compulab/cm_t35/cm_t35.c b/board/compulab/cm_t35/cm_t35.c index 3caa5be8455..7626abc02e6 100644 --- a/board/compulab/cm_t35/cm_t35.c +++ b/board/compulab/cm_t35/cm_t35.c @@ -591,7 +591,7 @@ int ehci_hcd_init(int index, struct ehci_hccr **hccr, struct ehci_hcor **hcor) twl4030_i2c_write_u8(TWL4030_CHIP_GPIO, offset, 0xC0); udelay(1); - return omap_ehci_hcd_init(&usbhs_bdata, hccr, hcor); + return omap_ehci_hcd_init(index, &usbhs_bdata, hccr, hcor); } int ehci_hcd_stop(void) diff --git a/board/esd/apc405/apc405.c b/board/esd/apc405/apc405.c index f13f088d551..79341f5fdb1 100644 --- a/board/esd/apc405/apc405.c +++ b/board/esd/apc405/apc405.c @@ -17,6 +17,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -428,7 +429,7 @@ void reset_phy(void) } #if defined(CONFIG_USB_OHCI_NEW) && defined(CONFIG_SYS_USB_OHCI_BOARD_INIT) -int usb_board_init(void) +int board_usb_init(int index, enum board_usb_init_type init) { return 0; } @@ -453,9 +454,8 @@ int usb_board_stop(void) return 0; } -int usb_board_init_fail(void) +int board_usb_cleanup(int index, enum board_usb_init_type init) { - usb_board_stop(); - return 0; + return usb_board_stop(); } #endif /* defined(CONFIG_USB_OHCI) && defined(CONFIG_SYS_USB_OHCI_BOARD_INIT) */ diff --git a/board/esd/pmc440/pmc440.c b/board/esd/pmc440/pmc440.c index 549b3b73ce1..44b86da380a 100644 --- a/board/esd/pmc440/pmc440.c +++ b/board/esd/pmc440/pmc440.c @@ -27,6 +27,7 @@ #endif #include #include +#include #include "fpga.h" #include "pmc440.h" @@ -821,7 +822,7 @@ int bootstrap_eeprom_read (unsigned dev_addr, unsigned offset, } #if defined(CONFIG_USB_OHCI_NEW) && defined(CONFIG_SYS_USB_OHCI_BOARD_INIT) -int usb_board_init(void) +int board_usb_init(int index, enum board_usb_init_type init) { char *act = getenv("usbact"); int i; @@ -845,10 +846,9 @@ int usb_board_stop(void) return 0; } -int usb_board_init_fail(void) +int board_usb_cleanup(int index, enum board_usb_init_type init) { - usb_board_stop(); - return 0; + return usb_board_stop(); } #endif /* defined(CONFIG_USB_OHCI) && defined(CONFIG_SYS_USB_OHCI_BOARD_INIT) */ diff --git a/board/htkw/mcx/mcx.c b/board/htkw/mcx/mcx.c index 653d7ea71d5..6f85b47a0f0 100644 --- a/board/htkw/mcx/mcx.c +++ b/board/htkw/mcx/mcx.c @@ -42,7 +42,7 @@ static struct omap_usbhs_board_data usbhs_bdata = { int ehci_hcd_init(int index, struct ehci_hccr **hccr, struct ehci_hcor **hcor) { - return omap_ehci_hcd_init(&usbhs_bdata, hccr, hcor); + return omap_ehci_hcd_init(index, &usbhs_bdata, hccr, hcor); } int ehci_hcd_stop(int index) diff --git a/board/icpdas/lp8x4x/lp8x4x.c b/board/icpdas/lp8x4x/lp8x4x.c index 1b68ef332a7..a96bed6aaa2 100644 --- a/board/icpdas/lp8x4x/lp8x4x.c +++ b/board/icpdas/lp8x4x/lp8x4x.c @@ -15,6 +15,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -58,7 +59,7 @@ int board_mmc_init(bd_t *bis) #endif #ifdef CONFIG_CMD_USB -int usb_board_init(void) +int board_usb_init(int index, enum board_usb_init_type init) { writel((UHCHR | UHCHR_PCPL | UHCHR_PSPL) & ~(UHCHR_SSEP0 | UHCHR_SSEP1 | UHCHR_SSEP2 | UHCHR_SSE), @@ -89,9 +90,9 @@ int usb_board_init(void) return 0; } -void usb_board_init_fail(void) +int board_usb_cleanup(int index, enum board_usb_init_type init) { - return; + return 0; } void usb_board_stop(void) diff --git a/board/nvidia/common/board.c b/board/nvidia/common/board.c index 126e56e97af..1972527e7d1 100644 --- a/board/nvidia/common/board.c +++ b/board/nvidia/common/board.c @@ -32,6 +32,7 @@ #ifdef CONFIG_USB_EHCI_TEGRA #include #include +#include #endif #ifdef CONFIG_TEGRA_MMC #include @@ -153,8 +154,9 @@ int board_init(void) #ifdef CONFIG_USB_EHCI_TEGRA pin_mux_usb(); - board_usb_init(gd->fdt_blob); + usb_process_devicetree(gd->fdt_blob); #endif + #ifdef CONFIG_LCD tegra_lcd_check_next_stage(gd->fdt_blob, 0); #endif diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c index 7f61d17abb2..58d925ff1cb 100644 --- a/board/samsung/trats/trats.c +++ b/board/samsung/trats/trats.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include "setup.h" @@ -495,10 +496,10 @@ struct s3c_plat_otg_data s5pc210_otg_data = { .usb_flags = PHY0_SLEEP, }; -void board_usb_init(void) +int board_usb_init(int index, enum board_usb_init_type init) { debug("USB_udc_probe\n"); - s3c_udc_probe(&s5pc210_otg_data); + return s3c_udc_probe(&s5pc210_otg_data); } #endif diff --git a/board/technexion/twister/twister.c b/board/technexion/twister/twister.c index cd91d8fea07..6f2ff55a126 100644 --- a/board/technexion/twister/twister.c +++ b/board/technexion/twister/twister.c @@ -53,7 +53,7 @@ static struct omap_usbhs_board_data usbhs_bdata = { int ehci_hcd_init(int index, struct ehci_hccr **hccr, struct ehci_hcor **hcor) { - return omap_ehci_hcd_init(&usbhs_bdata, hccr, hcor); + return omap_ehci_hcd_init(index, &usbhs_bdata, hccr, hcor); } int ehci_hcd_stop(int index) diff --git a/board/teejet/mt_ventoux/mt_ventoux.c b/board/teejet/mt_ventoux/mt_ventoux.c index b4e01d15625..df873f52a37 100644 --- a/board/teejet/mt_ventoux/mt_ventoux.c +++ b/board/teejet/mt_ventoux/mt_ventoux.c @@ -104,7 +104,7 @@ static struct omap_usbhs_board_data usbhs_bdata = { int ehci_hcd_init(int index, struct ehci_hccr **hccr, struct ehci_hcor **hcor) { - return omap_ehci_hcd_init(&usbhs_bdata, hccr, hcor); + return omap_ehci_hcd_init(index, &usbhs_bdata, hccr, hcor); } int ehci_hcd_stop(int index) diff --git a/board/ti/beagle/beagle.c b/board/ti/beagle/beagle.c index 62e9beaef35..41fed54fdb4 100644 --- a/board/ti/beagle/beagle.c +++ b/board/ti/beagle/beagle.c @@ -523,7 +523,7 @@ static struct omap_usbhs_board_data usbhs_bdata = { int ehci_hcd_init(int index, struct ehci_hccr **hccr, struct ehci_hcor **hcor) { - return omap_ehci_hcd_init(&usbhs_bdata, hccr, hcor); + return omap_ehci_hcd_init(index, &usbhs_bdata, hccr, hcor); } int ehci_hcd_stop(int index) diff --git a/board/ti/omap5_uevm/evm.c b/board/ti/omap5_uevm/evm.c index 5fc3473ecc2..228df29b421 100644 --- a/board/ti/omap5_uevm/evm.c +++ b/board/ti/omap5_uevm/evm.c @@ -184,7 +184,7 @@ int ehci_hcd_init(int index, struct ehci_hccr **hccr, struct ehci_hcor **hcor) eth_setenv_enetaddr("usbethaddr", device_mac); } - ret = omap_ehci_hcd_init(&usbhs_bdata, hccr, hcor); + ret = omap_ehci_hcd_init(index, &usbhs_bdata, hccr, hcor); if (ret < 0) { puts("Failed to initialize ehci\n"); return ret; diff --git a/board/ti/panda/panda.c b/board/ti/panda/panda.c index bc3c29220e1..3724e816c22 100644 --- a/board/ti/panda/panda.c +++ b/board/ti/panda/panda.c @@ -279,7 +279,7 @@ int ehci_hcd_init(int index, struct ehci_hccr **hccr, struct ehci_hcor **hcor) utmi_clk |= HSUSBHOST_CLKCTRL_CLKSEL_UTMI_P1_MASK; sr32((void *)CM_L3INIT_HSUSBHOST_CLKCTRL, 0, 32, utmi_clk); - ret = omap_ehci_hcd_init(&usbhs_bdata, hccr, hcor); + ret = omap_ehci_hcd_init(index, &usbhs_bdata, hccr, hcor); if (ret < 0) return ret; diff --git a/board/toradex/colibri_pxa270/colibri_pxa270.c b/board/toradex/colibri_pxa270/colibri_pxa270.c index c1e25623488..b70c1e38c81 100644 --- a/board/toradex/colibri_pxa270/colibri_pxa270.c +++ b/board/toradex/colibri_pxa270/colibri_pxa270.c @@ -13,6 +13,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -39,7 +40,7 @@ int dram_init(void) } #ifdef CONFIG_CMD_USB -int usb_board_init(void) +int board_usb_init(int index, enum board_usb_init_type init) { writel((readl(UHCHR) | UHCHR_PCPL | UHCHR_PSPL) & ~(UHCHR_SSEP0 | UHCHR_SSEP1 | UHCHR_SSEP2 | UHCHR_SSE), @@ -70,9 +71,9 @@ int usb_board_init(void) return 0; } -void usb_board_init_fail(void) +int board_usb_cleanup(int index, enum board_usb_init_type init) { - return; + return 0; } void usb_board_stop(void) diff --git a/board/trizepsiv/conxs.c b/board/trizepsiv/conxs.c index c0c318f3287..830d5a86f15 100644 --- a/board/trizepsiv/conxs.c +++ b/board/trizepsiv/conxs.c @@ -21,6 +21,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -42,7 +43,7 @@ extern struct serial_device serial_stuart_device; * Miscelaneous platform dependent initialisations */ -int usb_board_init(void) +int board_usb_init(int index, enum board_usb_init_type init) { writel((readl(UHCHR) | UHCHR_PCPL | UHCHR_PSPL) & ~(UHCHR_SSEP0 | UHCHR_SSEP1 | UHCHR_SSEP2 | UHCHR_SSE), @@ -69,9 +70,9 @@ int usb_board_init(void) return 0; } -void usb_board_init_fail(void) +int board_usb_cleanup(int index, enum board_usb_init_type init) { - return; + return 0; } void usb_board_stop(void) diff --git a/board/vpac270/vpac270.c b/board/vpac270/vpac270.c index 616736f5c47..fab4636ad95 100644 --- a/board/vpac270/vpac270.c +++ b/board/vpac270/vpac270.c @@ -13,6 +13,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -66,7 +67,7 @@ int board_mmc_init(bd_t *bis) #endif #ifdef CONFIG_CMD_USB -int usb_board_init(void) +int board_usb_init(int index, enum board_usb_init_type init) { writel((UHCHR | UHCHR_PCPL | UHCHR_PSPL) & ~(UHCHR_SSEP0 | UHCHR_SSEP1 | UHCHR_SSEP2 | UHCHR_SSE), @@ -97,9 +98,9 @@ int usb_board_init(void) return 0; } -void usb_board_init_fail(void) +int board_usb_cleanup(int index, enum board_usb_init_type init) { - return; + return 0; } void usb_board_stop(void) diff --git a/common/cmd_dfu.c b/common/cmd_dfu.c index 7ce92cec87f..5547678208a 100644 --- a/common/cmd_dfu.c +++ b/common/cmd_dfu.c @@ -11,27 +11,32 @@ #include #include #include +#include static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { + if (argc < 4) + return CMD_RET_USAGE; + + char *usb_controller = argv[1]; + char *interface = argv[2]; + char *devstring = argv[3]; + char *s = "dfu"; int ret, i = 0; - if (argc < 3) - return CMD_RET_USAGE; - - ret = dfu_init_env_entities(argv[1], simple_strtoul(argv[2], NULL, 10)); + ret = dfu_init_env_entities(interface, simple_strtoul(devstring, + NULL, 10)); if (ret) return ret; - if (argc > 3 && strcmp(argv[3], "list") == 0) { + if (argc > 4 && strcmp(argv[4], "list") == 0) { dfu_show_entities(); goto done; } -#ifdef CONFIG_TRATS - board_usb_init(); -#endif + int controller_index = simple_strtoul(usb_controller, NULL, 0); + board_usb_init(controller_index, USB_INIT_DEVICE); g_dnl_register(s); while (1) { @@ -62,8 +67,9 @@ done: U_BOOT_CMD(dfu, CONFIG_SYS_MAXARGS, 1, do_dfu, "Device Firmware Upgrade", - " [list]\n" - " - device firmware upgrade on a device \n" - " attached to interface \n" - " [list] - list available alt settings" + " [list]\n" + " - device firmware upgrade via \n" + " on device , attached to interface\n" + " \n" + " [list] - list available alt settings\n" ); diff --git a/common/cmd_usb_mass_storage.c b/common/cmd_usb_mass_storage.c index ccf7195946e..f583cafa35a 100644 --- a/common/cmd_usb_mass_storage.c +++ b/common/cmd_usb_mass_storage.c @@ -8,51 +8,53 @@ #include #include #include +#include #include int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { - char *ep; - unsigned int dev_num = 0, offset = 0, part_size = 0; - int rc; + if (argc < 3) + return CMD_RET_USAGE; - struct ums_board_info *ums_info; - static char *s = "ums"; - - if (argc < 2) { - printf("usage: ums - e.g. ums 0\n"); - return 0; - } - - dev_num = (int)simple_strtoul(argv[1], &ep, 16); + const char *usb_controller = argv[1]; + const char *mmc_devstring = argv[2]; + unsigned int dev_num = (unsigned int)(simple_strtoul(mmc_devstring, + NULL, 0)); if (dev_num) { - puts("\nSet eMMC device to 0! - e.g. ums 0\n"); + error("Set eMMC device to 0! - e.g. ums 0"); goto fail; } - board_usb_init(); - ums_info = board_ums_init(dev_num, offset, part_size); + unsigned int controller_index = (unsigned int)(simple_strtoul( + usb_controller, NULL, 0)); + if (board_usb_init(controller_index, USB_INIT_DEVICE)) { + error("Couldn't init USB controller."); + goto fail; + } + struct ums_board_info *ums_info = board_ums_init(dev_num, 0, 0); if (!ums_info) { - printf("MMC: %d -> NOT available\n", dev_num); + error("MMC: %d -> NOT available", dev_num); goto fail; } - rc = fsg_init(ums_info); + + int rc = fsg_init(ums_info); if (rc) { - printf("cmd ums: fsg_init failed\n"); + error("fsg_init failed"); goto fail; } - g_dnl_register(s); + g_dnl_register("ums"); while (1) { /* Handle control-c and timeouts */ if (ctrlc()) { - printf("The remote end did not respond in time.\n"); + error("The remote end did not respond in time."); goto exit; } + usb_gadget_handle_interrupts(); /* Check if USB cable has been detached */ if (fsg_main_thread(NULL) == EIO) @@ -68,5 +70,5 @@ fail: U_BOOT_CMD(ums, CONFIG_SYS_MAXARGS, 1, do_usb_mass_storage, "Use the UMS [User Mass Storage]", - "ums - User Mass Storage Gadget" + " " ); diff --git a/common/usb.c b/common/usb.c index e23d7888552..a61fcac855e 100644 --- a/common/usb.c +++ b/common/usb.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #ifdef CONFIG_4xx @@ -1066,4 +1067,9 @@ int usb_new_device(struct usb_device *dev) return 0; } +__weak +int board_usb_init(int index, enum board_usb_init_type init) +{ + return 0; +} /* EOF */ diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c index 56b21c78abc..f3287359db9 100644 --- a/drivers/dfu/dfu.c +++ b/drivers/dfu/dfu.c @@ -330,7 +330,7 @@ int dfu_read(struct dfu_entity *dfu, void *buf, int size, int blk_seq_num) } static int dfu_fill_entity(struct dfu_entity *dfu, char *s, int alt, - char *interface, int num) + char *interface, int num) { char *st; diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c index 3c58f9e656c..c4ce4870875 100644 --- a/drivers/usb/host/ehci-omap.c +++ b/drivers/usb/host/ehci-omap.c @@ -96,12 +96,6 @@ static void omap_ehci_soft_phy_reset(int port) } #endif -inline int __board_usb_init(void) -{ - return 0; -} -int board_usb_init(void) __attribute__((weak, alias("__board_usb_init"))); - #if defined(CONFIG_OMAP_EHCI_PHY1_RESET_GPIO) || \ defined(CONFIG_OMAP_EHCI_PHY2_RESET_GPIO) || \ defined(CONFIG_OMAP_EHCI_PHY3_RESET_GPIO) @@ -157,15 +151,15 @@ int omap_ehci_hcd_stop(void) * Based on "drivers/usb/host/ehci-omap.c" from Linux 3.1 * See there for additional Copyrights. */ -int omap_ehci_hcd_init(struct omap_usbhs_board_data *usbhs_pdata, - struct ehci_hccr **hccr, struct ehci_hcor **hcor) +int omap_ehci_hcd_init(int index, struct omap_usbhs_board_data *usbhs_pdata, + struct ehci_hccr **hccr, struct ehci_hcor **hcor) { int ret; unsigned int i, reg = 0, rev = 0; debug("Initializing OMAP EHCI\n"); - ret = board_usb_init(); + ret = board_usb_init(index, USB_INIT_HOST); if (ret < 0) return ret; diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c index c6da449e4b0..cc23133f8c4 100644 --- a/drivers/usb/host/ehci-tegra.c +++ b/drivers/usb/host/ehci-tegra.c @@ -699,7 +699,7 @@ static int process_usb_nodes(const void *blob, int node_list[], int count) return 0; } -int board_usb_init(const void *blob) +int usb_process_devicetree(const void *blob) { int node_list[USB_PORTS_MAX]; int count, err = 0; diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index c33c487ee54..756f2fa7ffd 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c @@ -1861,7 +1861,7 @@ int usb_lowlevel_init(int index, void **controller) #ifdef CONFIG_SYS_USB_OHCI_BOARD_INIT /* board dependant init */ - if (usb_board_init()) + if (board_usb_init(index, USB_INIT_HOST)) return -1; #endif memset(&gohci, 0, sizeof(ohci_t)); @@ -1918,7 +1918,7 @@ int usb_lowlevel_init(int index, void **controller) err ("can't reset usb-%s", gohci.slot_name); #ifdef CONFIG_SYS_USB_OHCI_BOARD_INIT /* board dependant cleanup */ - usb_board_init_fail(); + board_usb_cleanup(index, USB_INIT_HOST); #endif #ifdef CONFIG_SYS_USB_OHCI_CPU_INIT diff --git a/drivers/usb/host/ohci.h b/drivers/usb/host/ohci.h index d977e8ff3ce..9a4a2c24759 100644 --- a/drivers/usb/host/ohci.h +++ b/drivers/usb/host/ohci.h @@ -19,14 +19,11 @@ #endif /* CONFIG_SYS_OHCI_SWAP_REG_ACCESS */ /* functions for doing board or CPU specific setup/cleanup */ -extern int usb_board_init(void); -extern int usb_board_stop(void); -extern int usb_board_init_fail(void); - -extern int usb_cpu_init(void); -extern int usb_cpu_stop(void); -extern int usb_cpu_init_fail(void); +int usb_board_stop(void); +int usb_cpu_init(void); +int usb_cpu_stop(void); +int usb_cpu_init_fail(void); static int cc_to_error[16] = { diff --git a/include/g_dnl.h b/include/g_dnl.h index 2b2f11a62f4..b6c4dd4ac3a 100644 --- a/include/g_dnl.h +++ b/include/g_dnl.h @@ -14,6 +14,4 @@ int g_dnl_bind_fixup(struct usb_device_descriptor *); int g_dnl_register(const char *s); void g_dnl_unregister(void); -/* USB initialization declaration - board specific */ -void board_usb_init(void); #endif /* __G_DOWNLOAD_H_ */ diff --git a/include/usb.h b/include/usb.h index a96ec235c85..17fb68cf16a 100644 --- a/include/usb.h +++ b/include/usb.h @@ -167,10 +167,36 @@ int submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer, extern void udc_disconnect(void); -#else -#error USB Lowlevel not defined #endif +/* + * You can initialize platform's USB host or device + * ports by passing this enum as an argument to + * board_usb_init(). + */ +enum board_usb_init_type { + USB_INIT_HOST, + USB_INIT_DEVICE +}; + +/* + * board-specific hardware initialization, called by + * usb drivers and u-boot commands + * + * @param index USB controller number + * @param init initializes controller as USB host or device + */ +int board_usb_init(int index, enum board_usb_init_type init); + +/* + * can be used to clean up after failed USB initialization attempt + * vide: board_usb_init() + * + * @param index USB controller number for selective cleanup + * @param init board_usb_init_type passed to board_usb_init() + */ +int board_usb_cleanup(int index, enum board_usb_init_type init); + #ifdef CONFIG_USB_STORAGE #define USB_MAX_STOR_DEV 5 diff --git a/include/usb_mass_storage.h b/include/usb_mass_storage.h index e08deb4ddf1..13f535ce2e4 100644 --- a/include/usb_mass_storage.h +++ b/include/usb_mass_storage.h @@ -31,14 +31,11 @@ struct ums_board_info { struct ums_device ums_dev; }; -extern void board_usb_init(void); - -extern int fsg_init(struct ums_board_info *); -extern void fsg_cleanup(void); -extern struct ums_board_info *board_ums_init(unsigned int, - unsigned int, unsigned int); -extern int usb_gadget_handle_interrupts(void); -extern int fsg_main_thread(void *); +int fsg_init(struct ums_board_info *); +void fsg_cleanup(void); +struct ums_board_info *board_ums_init(unsigned int, unsigned int, + unsigned int); +int fsg_main_thread(void *); #ifdef CONFIG_USB_GADGET_MASS_STORAGE int fsg_add(struct usb_configuration *c); -- cgit v1.2.3 From 3402b0534353677933ad33eea602bf78b4f8cdb0 Mon Sep 17 00:00:00 2001 From: Lukasz Majewski Date: Tue, 8 Oct 2013 14:30:44 +0200 Subject: cmd:thor: Support for TIZEN's download command (thordown) New command - thordown - has been added to support downloading data via lthor TIZEN program. It is similar to dfu command syntax and reuses its code for flashing data. Signed-off-by: Lukasz Majewski --- common/Makefile | 1 + common/cmd_thordown.c | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 common/cmd_thordown.c (limited to 'common') diff --git a/common/Makefile b/common/Makefile index 288690bca5f..8daca5b3780 100644 --- a/common/Makefile +++ b/common/Makefile @@ -168,6 +168,7 @@ COBJS-y += usb.o usb_hub.o COBJS-$(CONFIG_USB_STORAGE) += usb_storage.o endif COBJS-$(CONFIG_CMD_USB_MASS_STORAGE) += cmd_usb_mass_storage.o +COBJS-$(CONFIG_CMD_THOR_DOWNLOAD) += cmd_thordown.o COBJS-$(CONFIG_CMD_XIMG) += cmd_ximg.o COBJS-$(CONFIG_YAFFS2) += cmd_yaffs2.o COBJS-$(CONFIG_CMD_SPL) += cmd_spl.o diff --git a/common/cmd_thordown.c b/common/cmd_thordown.c new file mode 100644 index 00000000000..c4b35114587 --- /dev/null +++ b/common/cmd_thordown.c @@ -0,0 +1,72 @@ +/* + * cmd_thordown.c -- USB TIZEN "THOR" Downloader gadget + * + * Copyright (C) 2013 Lukasz Majewski + * All rights reserved. + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include +#include +#include +#include +#include + +int do_thor_down(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) +{ + if (argc < 4) + return CMD_RET_USAGE; + + char *usb_controller = argv[1]; + char *interface = argv[2]; + char *devstring = argv[3]; + + const char *s = "thor"; + int ret; + + puts("TIZEN \"THOR\" Downloader\n"); + + ret = dfu_init_env_entities(interface, simple_strtoul(devstring, + NULL, 10)); + if (ret) + return ret; + + int controller_index = simple_strtoul(usb_controller, NULL, 0); + ret = board_usb_init(controller_index, USB_INIT_DEVICE); + if (ret) { + error("USB init failed: %d", ret); + ret = CMD_RET_FAILURE; + goto exit; + } + + g_dnl_register(s); + + ret = thor_init(); + if (ret) { + error("THOR DOWNLOAD failed: %d", ret); + ret = CMD_RET_FAILURE; + goto exit; + } + + ret = thor_handle(); + if (ret) { + error("THOR failed: %d", ret); + ret = CMD_RET_FAILURE; + goto exit; + } + +exit: + g_dnl_unregister(); + dfu_free_entities(); + + return ret; +} + +U_BOOT_CMD(thordown, CONFIG_SYS_MAXARGS, 1, do_thor_down, + "TIZEN \"THOR\" downloader", + " \n" + " - device software upgrade via LTHOR TIZEN dowload\n" + " program via on device ,\n" + " attached to interface \n" +); -- cgit v1.2.3 From bba679144d25b91bcd7befff5a96728a30875f54 Mon Sep 17 00:00:00 2001 From: Troy Kisky Date: Thu, 10 Oct 2013 15:27:55 -0700 Subject: usb: rename board_usb_init_type to usb_init_type This will be used by usb_lowlevel_init so it will no longer be used by only board specific functions. Move definition of enum usb_init_type higher in file so that it will be available for usb_low_level_init. Signed-off-by: Troy Kisky --- board/amcc/canyonlands/canyonlands.c | 4 ++-- board/balloon3/balloon3.c | 4 ++-- board/esd/apc405/apc405.c | 4 ++-- board/esd/pmc440/pmc440.c | 4 ++-- board/icpdas/lp8x4x/lp8x4x.c | 4 ++-- board/samsung/trats/trats.c | 2 +- board/toradex/colibri_pxa270/colibri_pxa270.c | 4 ++-- board/trizepsiv/conxs.c | 4 ++-- board/vpac270/vpac270.c | 4 ++-- common/usb.c | 2 +- include/usb.h | 26 +++++++++++++------------- 11 files changed, 31 insertions(+), 31 deletions(-) (limited to 'common') diff --git a/board/amcc/canyonlands/canyonlands.c b/board/amcc/canyonlands/canyonlands.c index 395095e459c..2b5f1a62cc2 100644 --- a/board/amcc/canyonlands/canyonlands.c +++ b/board/amcc/canyonlands/canyonlands.c @@ -189,7 +189,7 @@ int board_early_init_f(void) } #if defined(CONFIG_USB_OHCI_NEW) && defined(CONFIG_SYS_USB_OHCI_BOARD_INIT) -int board_usb_init(int index, enum board_usb_init_type init) +int board_usb_init(int index, enum usb_init_type init) { struct board_bcsr *bcsr_data = (struct board_bcsr *)CONFIG_SYS_BCSR_BASE; @@ -230,7 +230,7 @@ int usb_board_stop(void) return 0; } -int board_usb_cleanup(int index, enum board_usb_init_type init) +int board_usb_cleanup(int index, enum usb_init_type init) { return usb_board_stop(); } diff --git a/board/balloon3/balloon3.c b/board/balloon3/balloon3.c index 19c0e023a0e..04e0574658a 100644 --- a/board/balloon3/balloon3.c +++ b/board/balloon3/balloon3.c @@ -60,7 +60,7 @@ void dram_init_banksize(void) } #ifdef CONFIG_CMD_USB -int board_usb_init(int index, enum board_usb_init_type init) +int board_usb_init(int index, enum usb_init_type init) { writel((readl(UHCHR) | UHCHR_PCPL | UHCHR_PSPL) & ~(UHCHR_SSEP0 | UHCHR_SSEP1 | UHCHR_SSEP2 | UHCHR_SSE), @@ -91,7 +91,7 @@ int board_usb_init(int index, enum board_usb_init_type init) return 0; } -int board_usb_cleanup(int index, enum board_usb_init_type init) +int board_usb_cleanup(int index, enum usb_init_type init) { return 0; } diff --git a/board/esd/apc405/apc405.c b/board/esd/apc405/apc405.c index 79341f5fdb1..5cc1d0d9d64 100644 --- a/board/esd/apc405/apc405.c +++ b/board/esd/apc405/apc405.c @@ -429,7 +429,7 @@ void reset_phy(void) } #if defined(CONFIG_USB_OHCI_NEW) && defined(CONFIG_SYS_USB_OHCI_BOARD_INIT) -int board_usb_init(int index, enum board_usb_init_type init) +int board_usb_init(int index, enum usb_init_type init) { return 0; } @@ -454,7 +454,7 @@ int usb_board_stop(void) return 0; } -int board_usb_cleanup(int index, enum board_usb_init_type init) +int board_usb_cleanup(int index, enum usb_init_type init) { return usb_board_stop(); } diff --git a/board/esd/pmc440/pmc440.c b/board/esd/pmc440/pmc440.c index 44b86da380a..88fc5f77b6b 100644 --- a/board/esd/pmc440/pmc440.c +++ b/board/esd/pmc440/pmc440.c @@ -822,7 +822,7 @@ int bootstrap_eeprom_read (unsigned dev_addr, unsigned offset, } #if defined(CONFIG_USB_OHCI_NEW) && defined(CONFIG_SYS_USB_OHCI_BOARD_INIT) -int board_usb_init(int index, enum board_usb_init_type init) +int board_usb_init(int index, enum usb_init_type init) { char *act = getenv("usbact"); int i; @@ -846,7 +846,7 @@ int usb_board_stop(void) return 0; } -int board_usb_cleanup(int index, enum board_usb_init_type init) +int board_usb_cleanup(int index, enum usb_init_type init) { return usb_board_stop(); } diff --git a/board/icpdas/lp8x4x/lp8x4x.c b/board/icpdas/lp8x4x/lp8x4x.c index a96bed6aaa2..92dd4ff97a7 100644 --- a/board/icpdas/lp8x4x/lp8x4x.c +++ b/board/icpdas/lp8x4x/lp8x4x.c @@ -59,7 +59,7 @@ int board_mmc_init(bd_t *bis) #endif #ifdef CONFIG_CMD_USB -int board_usb_init(int index, enum board_usb_init_type init) +int board_usb_init(int index, enum usb_init_type init) { writel((UHCHR | UHCHR_PCPL | UHCHR_PSPL) & ~(UHCHR_SSEP0 | UHCHR_SSEP1 | UHCHR_SSEP2 | UHCHR_SSE), @@ -90,7 +90,7 @@ int board_usb_init(int index, enum board_usb_init_type init) return 0; } -int board_usb_cleanup(int index, enum board_usb_init_type init) +int board_usb_cleanup(int index, enum usb_init_type init) { return 0; } diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c index 58d925ff1cb..d31d511e399 100644 --- a/board/samsung/trats/trats.c +++ b/board/samsung/trats/trats.c @@ -496,7 +496,7 @@ struct s3c_plat_otg_data s5pc210_otg_data = { .usb_flags = PHY0_SLEEP, }; -int board_usb_init(int index, enum board_usb_init_type init) +int board_usb_init(int index, enum usb_init_type init) { debug("USB_udc_probe\n"); return s3c_udc_probe(&s5pc210_otg_data); diff --git a/board/toradex/colibri_pxa270/colibri_pxa270.c b/board/toradex/colibri_pxa270/colibri_pxa270.c index b70c1e38c81..8d95e4d1746 100644 --- a/board/toradex/colibri_pxa270/colibri_pxa270.c +++ b/board/toradex/colibri_pxa270/colibri_pxa270.c @@ -40,7 +40,7 @@ int dram_init(void) } #ifdef CONFIG_CMD_USB -int board_usb_init(int index, enum board_usb_init_type init) +int board_usb_init(int index, enum usb_init_type init) { writel((readl(UHCHR) | UHCHR_PCPL | UHCHR_PSPL) & ~(UHCHR_SSEP0 | UHCHR_SSEP1 | UHCHR_SSEP2 | UHCHR_SSE), @@ -71,7 +71,7 @@ int board_usb_init(int index, enum board_usb_init_type init) return 0; } -int board_usb_cleanup(int index, enum board_usb_init_type init) +int board_usb_cleanup(int index, enum usb_init_type init) { return 0; } diff --git a/board/trizepsiv/conxs.c b/board/trizepsiv/conxs.c index 830d5a86f15..1ddf05dcdd4 100644 --- a/board/trizepsiv/conxs.c +++ b/board/trizepsiv/conxs.c @@ -43,7 +43,7 @@ extern struct serial_device serial_stuart_device; * Miscelaneous platform dependent initialisations */ -int board_usb_init(int index, enum board_usb_init_type init) +int board_usb_init(int index, enum usb_init_type init) { writel((readl(UHCHR) | UHCHR_PCPL | UHCHR_PSPL) & ~(UHCHR_SSEP0 | UHCHR_SSEP1 | UHCHR_SSEP2 | UHCHR_SSE), @@ -70,7 +70,7 @@ int board_usb_init(int index, enum board_usb_init_type init) return 0; } -int board_usb_cleanup(int index, enum board_usb_init_type init) +int board_usb_cleanup(int index, enum usb_init_type init) { return 0; } diff --git a/board/vpac270/vpac270.c b/board/vpac270/vpac270.c index fab4636ad95..8d777df8464 100644 --- a/board/vpac270/vpac270.c +++ b/board/vpac270/vpac270.c @@ -67,7 +67,7 @@ int board_mmc_init(bd_t *bis) #endif #ifdef CONFIG_CMD_USB -int board_usb_init(int index, enum board_usb_init_type init) +int board_usb_init(int index, enum usb_init_type init) { writel((UHCHR | UHCHR_PCPL | UHCHR_PSPL) & ~(UHCHR_SSEP0 | UHCHR_SSEP1 | UHCHR_SSEP2 | UHCHR_SSE), @@ -98,7 +98,7 @@ int board_usb_init(int index, enum board_usb_init_type init) return 0; } -int board_usb_cleanup(int index, enum board_usb_init_type init) +int board_usb_cleanup(int index, enum usb_init_type init) { return 0; } diff --git a/common/usb.c b/common/usb.c index a61fcac855e..414f9c27fb8 100644 --- a/common/usb.c +++ b/common/usb.c @@ -1068,7 +1068,7 @@ int usb_new_device(struct usb_device *dev) } __weak -int board_usb_init(int index, enum board_usb_init_type init) +int board_usb_init(int index, enum usb_init_type init) { return 0; } diff --git a/include/usb.h b/include/usb.h index 17fb68cf16a..b4fea52cbff 100644 --- a/include/usb.h +++ b/include/usb.h @@ -129,6 +129,16 @@ struct usb_device { unsigned int slot_id; }; +/* + * You can initialize platform's USB host or device + * ports by passing this enum as an argument to + * board_usb_init(). + */ +enum usb_init_type { + USB_INIT_HOST, + USB_INIT_DEVICE +}; + /********************************************************************** * this is how the lowlevel part communicate with the outer world */ @@ -169,16 +179,6 @@ extern void udc_disconnect(void); #endif -/* - * You can initialize platform's USB host or device - * ports by passing this enum as an argument to - * board_usb_init(). - */ -enum board_usb_init_type { - USB_INIT_HOST, - USB_INIT_DEVICE -}; - /* * board-specific hardware initialization, called by * usb drivers and u-boot commands @@ -186,16 +186,16 @@ enum board_usb_init_type { * @param index USB controller number * @param init initializes controller as USB host or device */ -int board_usb_init(int index, enum board_usb_init_type init); +int board_usb_init(int index, enum usb_init_type init); /* * can be used to clean up after failed USB initialization attempt * vide: board_usb_init() * * @param index USB controller number for selective cleanup - * @param init board_usb_init_type passed to board_usb_init() + * @param init usb_init_type passed to board_usb_init() */ -int board_usb_cleanup(int index, enum board_usb_init_type init); +int board_usb_cleanup(int index, enum usb_init_type init); #ifdef CONFIG_USB_STORAGE -- cgit v1.2.3 From 06d513ecb61a6711157707ebe10b968aacc0f2a8 Mon Sep 17 00:00:00 2001 From: Troy Kisky Date: Thu, 10 Oct 2013 15:27:56 -0700 Subject: usb: add enum usb_init_type parameter to usb_lowlevel_init This parameter will later be used to verify OTG ports. Signed-off-by: Troy Kisky --- 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 +- arch/sparc/cpu/leon3/usb_uhci.c | 2 +- board/mpl/common/usb_uhci.c | 2 +- common/usb.c | 2 +- drivers/usb/gadget/mv_udc.c | 2 +- drivers/usb/host/ehci-hcd.c | 2 +- drivers/usb/host/isp116x-hcd.c | 2 +- drivers/usb/host/ohci-hcd.c | 2 +- drivers/usb/host/ohci-s3c24xx.c | 2 +- drivers/usb/host/r8a66597-hcd.c | 2 +- drivers/usb/host/sl811-hcd.c | 2 +- drivers/usb/host/xhci.c | 2 +- drivers/usb/musb-new/musb_uboot.c | 2 +- drivers/usb/musb/musb_hcd.c | 2 +- include/usb.h | 2 +- 17 files changed, 17 insertions(+), 17 deletions(-) (limited to 'common') diff --git a/arch/mips/cpu/mips32/au1x00/au1x00_usb_ohci.c b/arch/mips/cpu/mips32/au1x00/au1x00_usb_ohci.c index 931f95a0da0..fd0ec65959a 100644 --- a/arch/mips/cpu/mips32/au1x00/au1x00_usb_ohci.c +++ b/arch/mips/cpu/mips32/au1x00/au1x00_usb_ohci.c @@ -1548,7 +1548,7 @@ static void hc_release_ohci (ohci_t *ohci) */ static char ohci_inited = 0; -int usb_lowlevel_init(int index, void **controller) +int usb_lowlevel_init(int index, enum usb_init_type init, void **controller) { u32 pin_func; u32 sys_freqctrl, sys_clksrc; diff --git a/arch/powerpc/cpu/mpc5xxx/usb_ohci.c b/arch/powerpc/cpu/mpc5xxx/usb_ohci.c index 3d345ff53ef..a68f9d65984 100644 --- a/arch/powerpc/cpu/mpc5xxx/usb_ohci.c +++ b/arch/powerpc/cpu/mpc5xxx/usb_ohci.c @@ -1544,7 +1544,7 @@ static void hc_release_ohci (ohci_t *ohci) */ static char ohci_inited = 0; -int usb_lowlevel_init(int index, void **controller) +int usb_lowlevel_init(int index, enum usb_init_type init, void **controller) { /* Set the USB Clock */ diff --git a/arch/powerpc/cpu/ppc4xx/usb_ohci.c b/arch/powerpc/cpu/ppc4xx/usb_ohci.c index b371a752f96..fafc15e2e1f 100644 --- a/arch/powerpc/cpu/ppc4xx/usb_ohci.c +++ b/arch/powerpc/cpu/ppc4xx/usb_ohci.c @@ -1549,7 +1549,7 @@ static void hc_release_ohci (ohci_t *ohci) */ static char ohci_inited = 0; -int usb_lowlevel_init(int index, void **controller) +int usb_lowlevel_init(int index, enum usb_init_type init, void **controller) { memset (&gohci, 0, sizeof (ohci_t)); memset (&urb_priv, 0, sizeof (urb_priv_t)); diff --git a/arch/sparc/cpu/leon3/usb_uhci.c b/arch/sparc/cpu/leon3/usb_uhci.c index 5de48c11c2b..c411ded861e 100644 --- a/arch/sparc/cpu/leon3/usb_uhci.c +++ b/arch/sparc/cpu/leon3/usb_uhci.c @@ -688,7 +688,7 @@ void handle_usb_interrupt(void) /* init uhci */ -int usb_lowlevel_init(int index, void **controller) +int usb_lowlevel_init(int index, enum usb_init_type init, void **controller) { unsigned char temp; ambapp_ahbdev ahbdev; diff --git a/board/mpl/common/usb_uhci.c b/board/mpl/common/usb_uhci.c index ff7ce828c6a..6bbb527dab5 100644 --- a/board/mpl/common/usb_uhci.c +++ b/board/mpl/common/usb_uhci.c @@ -584,7 +584,7 @@ void handle_usb_interrupt(void) /* init uhci */ -int usb_lowlevel_init(int index, void **controller) +int usb_lowlevel_init(int index, enum usb_init_type init, void **controller) { unsigned char temp; int busdevfunc; diff --git a/common/usb.c b/common/usb.c index 414f9c27fb8..60daa100522 100644 --- a/common/usb.c +++ b/common/usb.c @@ -75,7 +75,7 @@ int usb_init(void) for (i = 0; i < CONFIG_USB_MAX_CONTROLLER_COUNT; i++) { /* init low_level USB */ printf("USB%d: ", i); - if (usb_lowlevel_init(i, &ctrl)) { + if (usb_lowlevel_init(i, USB_INIT_HOST, &ctrl)) { puts("lowlevel init failed\n"); continue; } diff --git a/drivers/usb/gadget/mv_udc.c b/drivers/usb/gadget/mv_udc.c index c64d5970532..83bd07596a6 100644 --- a/drivers/usb/gadget/mv_udc.c +++ b/drivers/usb/gadget/mv_udc.c @@ -692,7 +692,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver) if (driver->speed != USB_SPEED_FULL && driver->speed != USB_SPEED_HIGH) return -EINVAL; - ret = usb_lowlevel_init(0, (void **)&controller.ctrl); + ret = usb_lowlevel_init(0, USB_INIT_DEVICE, (void **)&controller.ctrl); if (ret) return ret; diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 3ae04c0253b..6c21f47413b 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c @@ -919,7 +919,7 @@ int usb_lowlevel_stop(int index) return ehci_hcd_stop(index); } -int usb_lowlevel_init(int index, void **controller) +int usb_lowlevel_init(int index, enum usb_init_type init, void **controller) { uint32_t reg; uint32_t cmd; diff --git a/drivers/usb/host/isp116x-hcd.c b/drivers/usb/host/isp116x-hcd.c index 934550ad88e..5aa190b52d1 100644 --- a/drivers/usb/host/isp116x-hcd.c +++ b/drivers/usb/host/isp116x-hcd.c @@ -1377,7 +1377,7 @@ int isp116x_check_id(struct isp116x *isp116x) return 0; } -int usb_lowlevel_init(int index, void **controller)) +int usb_lowlevel_init(int index, enum usb_init_type init, void **controller)) { struct isp116x *isp116x = &isp116x_dev; diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index 756f2fa7ffd..4ed07da842e 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c @@ -1847,7 +1847,7 @@ static void hc_release_ohci(ohci_t *ohci) */ static char ohci_inited = 0; -int usb_lowlevel_init(int index, void **controller) +int usb_lowlevel_init(int index, enum usb_init_type init, void **controller) { #ifdef CONFIG_PCI_OHCI pci_dev_t pdev; diff --git a/drivers/usb/host/ohci-s3c24xx.c b/drivers/usb/host/ohci-s3c24xx.c index 879ac166242..42e564ef5e5 100644 --- a/drivers/usb/host/ohci-s3c24xx.c +++ b/drivers/usb/host/ohci-s3c24xx.c @@ -1642,7 +1642,7 @@ static void hc_release_ohci(struct ohci *ohci) */ static char ohci_inited = 0; -int usb_lowlevel_init(int index, void **controller) +int usb_lowlevel_init(int index, enum usb_init_type init, void **controller) { struct s3c24x0_clock_power *clk_power = s3c24x0_get_base_clock_power(); struct s3c24x0_gpio *gpio = s3c24x0_get_base_gpio(); diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c index b503b356ce5..fd30d6726ca 100644 --- a/drivers/usb/host/r8a66597-hcd.c +++ b/drivers/usb/host/r8a66597-hcd.c @@ -903,7 +903,7 @@ int submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer, return 0; } -int usb_lowlevel_init(int index, void **controller) +int usb_lowlevel_init(int index, enum usb_init_type init, void **controller) { struct r8a66597 *r8a66597 = &gr8a66597; diff --git a/drivers/usb/host/sl811-hcd.c b/drivers/usb/host/sl811-hcd.c index 7ff4ffd8800..b29c67e1895 100644 --- a/drivers/usb/host/sl811-hcd.c +++ b/drivers/usb/host/sl811-hcd.c @@ -194,7 +194,7 @@ static int sl811_hc_reset(void) return 1; } -int usb_lowlevel_init(int index, void **controller) +int usb_lowlevel_init(int index, enum usb_init_type init, void **controller) { root_hub_devnum = 0; sl811_hc_reset(); diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 57fa4ff9a77..d1c2e5c4551 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -936,7 +936,7 @@ submit_control_msg(struct usb_device *udev, unsigned long pipe, void *buffer, * @param index index to the host controller data structure * @return pointer to the intialised controller */ -int usb_lowlevel_init(int index, void **controller) +int usb_lowlevel_init(int index, enum usb_init_type init, void **controller) { uint32_t val; uint32_t val2; diff --git a/drivers/usb/musb-new/musb_uboot.c b/drivers/usb/musb-new/musb_uboot.c index c2400328a36..05126803c3f 100644 --- a/drivers/usb/musb-new/musb_uboot.c +++ b/drivers/usb/musb-new/musb_uboot.c @@ -112,7 +112,7 @@ int submit_int_msg(struct usb_device *dev, unsigned long pipe, return submit_urb(&hcd, urb); } -int usb_lowlevel_init(int index, void **controller) +int usb_lowlevel_init(int index, enum usb_init_type init, void **controller) { u8 power; void *mbase; diff --git a/drivers/usb/musb/musb_hcd.c b/drivers/usb/musb/musb_hcd.c index 708fa124a21..799bd30e227 100644 --- a/drivers/usb/musb/musb_hcd.c +++ b/drivers/usb/musb/musb_hcd.c @@ -1089,7 +1089,7 @@ int submit_bulk_msg(struct usb_device *dev, unsigned long pipe, /* * This function initializes the usb controller module. */ -int usb_lowlevel_init(int index, void **controller) +int usb_lowlevel_init(int index, enum usb_init_type init, void **controller) { u8 power; u32 timeout; diff --git a/include/usb.h b/include/usb.h index b4fea52cbff..d9fedeeff7d 100644 --- a/include/usb.h +++ b/include/usb.h @@ -152,7 +152,7 @@ enum usb_init_type { defined(CONFIG_USB_MUSB_DSPS) || defined(CONFIG_USB_MUSB_AM35X) || \ defined(CONFIG_USB_MUSB_OMAP2PLUS) || defined(CONFIG_USB_XHCI) -int usb_lowlevel_init(int index, void **controller); +int usb_lowlevel_init(int index, enum usb_init_type init, void **controller); int usb_lowlevel_stop(int index); int submit_bulk_msg(struct usb_device *dev, unsigned long pipe, -- cgit v1.2.3