From cea6c8ce2327cfb41a13a8b8655e74dd18c2e6b7 Mon Sep 17 00:00:00 2001 From: Alban Bedel Date: Sat, 10 Sep 2016 03:54:09 +0200 Subject: [PATCH 01/17] net: asix: Fix ASIX 88772B with driver model Commit 147271209a9d ("net: asix: fix operation without eeprom") added a special handling for ASIX 88772B that enable another type of header. This break the driver in DM mode as the extra handling needed in the receive path is missing. However this new header mode is not required and only seems to increase the code complexity, so this patch revert this part of commit 147271209a9d. This also reverts commit 41d1258aceb45b45f9e68f67a9c40f0afbc09dc9 ("net: asix: Fix AX88772B when used with DriverModel") of late. Fixes: 147271209a9d ("net: asix: fix operation without eeprom") Signed-off-by: Alban Bedel Signed-off-by: Marcel Ziswiler --- drivers/usb/eth/asix.c | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) diff --git a/drivers/usb/eth/asix.c b/drivers/usb/eth/asix.c index a610ae447b..1c6e967db1 100644 --- a/drivers/usb/eth/asix.c +++ b/drivers/usb/eth/asix.c @@ -67,11 +67,8 @@ AX_MEDIUM_AC | AX_MEDIUM_RE) /* AX88772 & AX88178 RX_CTL values */ -#define AX_RX_CTL_RH2M 0x0200 /* 32-bit aligned RX IP header */ -#define AX_RX_CTL_RH1M 0x0100 /* Enable RX header format type 1 */ -#define AX_RX_CTL_SO 0x0080 -#define AX_RX_CTL_AB 0x0008 -#define AX_RX_HEADER_DEFAULT (AX_RX_CTL_RH1M | AX_RX_CTL_RH2M) +#define AX_RX_CTL_SO 0x0080 +#define AX_RX_CTL_AB 0x0008 #define AX_DEFAULT_RX_CTL \ (AX_RX_CTL_SO | AX_RX_CTL_AB) @@ -98,8 +95,6 @@ #define FLAG_TYPE_AX88772B (1U << 2) #define FLAG_EEPROM_MAC (1U << 3) /* initial mac address in eeprom */ -#define ASIX_USB_VENDOR_ID 0x0b95 -#define AX88772B_USB_PRODUCT_ID 0x772b /* driver private */ struct asix_private { @@ -431,15 +426,10 @@ static int asix_init_common(struct ueth_data *dev, uint8_t *enetaddr) int timeout = 0; #define TIMEOUT_RESOLUTION 50 /* ms */ int link_detected; - u32 ctl = AX_DEFAULT_RX_CTL; debug("** %s()\n", __func__); - if ((dev->pusb_dev->descriptor.idVendor == ASIX_USB_VENDOR_ID) && - (dev->pusb_dev->descriptor.idProduct == AX88772B_USB_PRODUCT_ID)) - ctl |= AX_RX_HEADER_DEFAULT; - - if (asix_write_rx_ctl(dev, ctl) < 0) + if (asix_write_rx_ctl(dev, AX_DEFAULT_RX_CTL) < 0) goto out_err; if (asix_write_hwaddr_common(dev, enetaddr) < 0) @@ -572,12 +562,6 @@ static int asix_recv(struct eth_device *eth) return -1; } - if ((dev->pusb_dev->descriptor.idVendor == - ASIX_USB_VENDOR_ID) && - (dev->pusb_dev->descriptor.idProduct == - AX88772B_USB_PRODUCT_ID)) - buf_ptr += 2; - /* Notify net stack */ net_process_received_packet(buf_ptr + sizeof(packet_len), packet_len); @@ -819,11 +803,6 @@ int asix_eth_recv(struct udevice *dev, int flags, uchar **packetp) } *packetp = ptr + sizeof(packet_len); - - if ((ueth->pusb_dev->descriptor.idVendor == ASIX_USB_VENDOR_ID) && - (ueth->pusb_dev->descriptor.idProduct == AX88772B_USB_PRODUCT_ID)) - *packetp += 2; - return packet_len; err: From 7f753cbea4c7cb56f278982c987570e6575d3dd7 Mon Sep 17 00:00:00 2001 From: Marcel Ziswiler Date: Sat, 10 Sep 2016 04:20:48 +0200 Subject: [PATCH 02/17] colibri_t30: fix usb ethernet functionality Since commit aa7a648747d8c704a9a81c9e493d386930724e9d ("net: Stop including NFS overhead in defragment max") the following has been reproducibly observed while trying to transfer data over TFTP: Load address: 0x80408000 Loading: EHCI timed out on TD - token=0x8008d80 T EHCI timed out on TD - token=0x88008d80 Rx: failed to receive: -5 This patch fixes this by upping our maximal de-fragmentation aka IP packet size again. Signed-off-by: Marcel Ziswiler --- include/configs/colibri_t30.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/configs/colibri_t30.h b/include/configs/colibri_t30.h index fbb235d82c..3431cde62f 100644 --- a/include/configs/colibri_t30.h +++ b/include/configs/colibri_t30.h @@ -48,6 +48,7 @@ /* General networking support */ #define CONFIG_IP_DEFRAG +#define CONFIG_NET_MAXDEFRAG (16384 + 4096 + 24) #define CONFIG_TFTP_BLOCKSIZE 16384 #define CONFIG_TFTP_TSIZE From e915716a5cdb40939204b3503f9356085e39fbd2 Mon Sep 17 00:00:00 2001 From: Sriram Dash Date: Mon, 22 Aug 2016 17:55:15 +0530 Subject: [PATCH 03/17] drivers: usb: xhci-fsl: Change burst beat and outstanding pipelined transfers requests This is required for better performance, and performs below tuning: 1. Enable burst length set, and define it as 4/8/16. 2. Set burst request limit to 16 requests. Signed-off-by: Rajesh Bhagat Signed-off-by: Sriram Dash --- drivers/usb/host/xhci-fsl.c | 10 ++++++++++ include/linux/usb/xhci-fsl.h | 3 +++ 2 files changed, 13 insertions(+) diff --git a/drivers/usb/host/xhci-fsl.c b/drivers/usb/host/xhci-fsl.c index bda5b5f913..2529d0eb13 100644 --- a/drivers/usb/host/xhci-fsl.c +++ b/drivers/usb/host/xhci-fsl.c @@ -58,6 +58,13 @@ static void fsl_apply_xhci_errata(void) } } +static void fsl_xhci_set_beat_burst_length(struct dwc3 *dwc3_reg) +{ + clrsetbits_le32(&dwc3_reg->g_sbuscfg0, USB3_ENABLE_BEAT_BURST_MASK, + USB3_ENABLE_BEAT_BURST); + setbits_le32(&dwc3_reg->g_sbuscfg1, USB3_SET_BEAT_BURST_LIMIT); +} + static int fsl_xhci_core_init(struct fsl_xhci *fsl_xhci) { int ret = 0; @@ -74,6 +81,9 @@ static int fsl_xhci_core_init(struct fsl_xhci *fsl_xhci) /* Set GFLADJ_30MHZ as 20h as per XHCI spec default value */ dwc3_set_fladj(fsl_xhci->dwc3_reg, GFLADJ_30MHZ_DEFAULT); + /* Change beat burst and outstanding pipelined transfers requests */ + fsl_xhci_set_beat_burst_length(fsl_xhci->dwc3_reg); + return ret; } diff --git a/include/linux/usb/xhci-fsl.h b/include/linux/usb/xhci-fsl.h index d04e3cc95a..15cac40e9d 100644 --- a/include/linux/usb/xhci-fsl.h +++ b/include/linux/usb/xhci-fsl.h @@ -20,6 +20,9 @@ #define USB3_PHY_TX_RX_POWERON (USB3_PHY_RX_POWERON | USB3_PHY_TX_POWERON) #define USB3_PWRCTL_CLK_CMD_SHIFT 14 #define USB3_PWRCTL_CLK_FREQ_SHIFT 22 +#define USB3_ENABLE_BEAT_BURST 0xF +#define USB3_ENABLE_BEAT_BURST_MASK 0xFF +#define USB3_SET_BEAT_BURST_LIMIT 0xF00 /* USBOTGSS_WRAPPER definitions */ #define USBOTGSS_WRAPRESET BIT(17) From bc5dbcb91813a429d168de58b37cb5b291d7be75 Mon Sep 17 00:00:00 2001 From: "B, Ravi" Date: Thu, 28 Jul 2016 17:39:14 +0530 Subject: [PATCH 04/17] spl: dfu: add dfu support in SPL Traditionally the DFU support is available only as part 2nd stage boot loader(u-boot) and DFU is not supported in SPL. The SPL-DFU feature is useful for boards which does not have MMC/SD, ethernet boot mechanism to boot the board and only has USB inteface. This patch add DFU support in SPL with RAM memory device support to load and execute u-boot. And then leverage full functionality DFU in u-boot to flash boot inital binary images to factory or bare-metal boards to memory devices like SPI, eMMC, MMC/SD card using USB interface. This SPL-DFU support can be enabled through Menuconfig->Boot Images->Enable SPL-DFU support Signed-off-by: Ravi Babu Reviewed-by: Tom Rini --- Kconfig | 27 +++++++++++++++++++++++++++ common/Makefile | 1 + scripts/Makefile.spl | 4 ++++ 3 files changed, 32 insertions(+) diff --git a/Kconfig b/Kconfig index a759e4da27..1263d0b612 100644 --- a/Kconfig +++ b/Kconfig @@ -291,6 +291,33 @@ config FIT_IMAGE_POST_PROCESS injected into the FIT creation (i.e. the blobs would have been pre- processed before being added to the FIT image). +config SPL_DFU_SUPPORT + bool "Enable SPL with DFU to load binaries to memory device" + depends on USB + help + Currently the SPL does not have capability to load the + binaries or boot images to boot devices like ram,eMMC,SPI,etc. + This feature enables the DFU (Device Firmware Upgarde) in SPL with + RAM memory device support. The ROM code will load and execute + the SPL built with dfu. The user can load binaries (u-boot/kernel) to + selected device partition from host-pc using dfu-utils. + This feature will be useful to flash the binaries to factory + or bare-metal boards using USB interface. + +choice + bool "DFU device selection" + depends on SPL_DFU_SUPPORT + +config SPL_DFU_RAM + bool "RAM device" + depends on SPL_DFU_SUPPORT + help + select RAM/DDR memory device for loading binary images + (u-boot/kernel) to the selected device partition using + DFU and execute the u-boot/kernel from RAM. + +endchoice + config SYS_CLK_FREQ depends on ARC || ARCH_SUNXI int "CPU clock frequency" diff --git a/common/Makefile b/common/Makefile index 9a9a065ad2..6b4456edff 100644 --- a/common/Makefile +++ b/common/Makefile @@ -89,6 +89,7 @@ obj-$(CONFIG_USB_KEYBOARD) += usb_kbd.o endif # !CONFIG_SPL_BUILD ifdef CONFIG_SPL_BUILD +obj-$(CONFIG_SPL_DFU_SUPPORT) += cli_hush.o obj-$(CONFIG_SPL_HASH_SUPPORT) += hash.o obj-$(CONFIG_ENV_IS_IN_FLASH) += env_flash.o obj-$(CONFIG_SPL_YMODEM_SUPPORT) += xyzModem.o diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl index 5a7f79c25a..4febc6b401 100644 --- a/scripts/Makefile.spl +++ b/scripts/Makefile.spl @@ -66,6 +66,10 @@ endif libs-$(CONFIG_SPL_LIBDISK_SUPPORT) += disk/ libs-y += drivers/ +libs-$(CONFIG_SPL_DFU_SUPPORT) += drivers/dfu/ +libs-$(CONFIG_SPL_DFU_SUPPORT) += drivers/usb/gadget/ +libs-$(CONFIG_SPL_DFU_SUPPORT) += drivers/usb/gadget/udc/ +libs-$(CONFIG_SPL_DFU_SUPPORT) += drivers/usb/dwc3/ libs-y += dts/ libs-y += fs/ libs-$(CONFIG_SPL_POST_MEM_SUPPORT) += post/drivers/ From 05341a87646aceac90a63624fbd5fa620f8dc263 Mon Sep 17 00:00:00 2001 From: "B, Ravi" Date: Thu, 28 Jul 2016 17:39:15 +0530 Subject: [PATCH 05/17] common: dfu: saperate the dfu common functionality The cmd_dfu functionality is been used by both SPL and u-boot, saperating the core dfu functionality moving it to common/dfu.c. Signed-off-by: Ravi Babu Reviewed-by: Tom Rini --- cmd/dfu.c | 61 ++-------------------------------- common/Makefile | 2 ++ common/dfu.c | 87 +++++++++++++++++++++++++++++++++++++++++++++++++ include/g_dnl.h | 1 + 4 files changed, 92 insertions(+), 59 deletions(-) create mode 100644 common/dfu.c diff --git a/cmd/dfu.c b/cmd/dfu.c index d8aae26223..04291f6c08 100644 --- a/cmd/dfu.c +++ b/cmd/dfu.c @@ -21,7 +21,6 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { - bool dfu_reset = false; if (argc < 4) return CMD_RET_USAGE; @@ -30,7 +29,7 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) char *interface = argv[2]; char *devstring = argv[3]; - int ret, i = 0; + int ret; #ifdef CONFIG_DFU_TFTP unsigned long addr = 0; if (!strcmp(argv[1], "tftp")) { @@ -52,67 +51,11 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) } int controller_index = simple_strtoul(usb_controller, NULL, 0); - board_usb_init(controller_index, USB_INIT_DEVICE); - g_dnl_clear_detach(); - g_dnl_register("usb_dnl_dfu"); - while (1) { - if (g_dnl_detach()) { - /* - * Check if USB bus reset is performed after detach, - * which indicates that -R switch has been passed to - * dfu-util. In this case reboot the device - */ - if (dfu_usb_get_reset()) { - dfu_reset = true; - goto exit; - } - /* - * This extra number of usb_gadget_handle_interrupts() - * calls is necessary to assure correct transmission - * completion with dfu-util - */ - if (++i == 10000) - goto exit; - } + run_usb_dnl_gadget(controller_index, "usb_dnl_dfu"); - if (ctrlc()) - goto exit; - - if (dfu_get_defer_flush()) { - /* - * Call to usb_gadget_handle_interrupts() is necessary - * to act on ZLP OUT transaction from HOST PC after - * transmitting the whole file. - * - * If this ZLP OUT packet is NAK'ed, the HOST libusb - * function fails after timeout (by default it is set to - * 5 seconds). In such situation the dfu-util program - * exits with error message. - */ - usb_gadget_handle_interrupts(controller_index); - ret = dfu_flush(dfu_get_defer_flush(), NULL, 0, 0); - dfu_set_defer_flush(NULL); - if (ret) { - error("Deferred dfu_flush() failed!"); - goto exit; - } - } - - WATCHDOG_RESET(); - usb_gadget_handle_interrupts(controller_index); - } -exit: - g_dnl_unregister(); - board_usb_cleanup(controller_index, USB_INIT_DEVICE); done: dfu_free_entities(); - - if (dfu_reset) - run_command("reset", 0); - - g_dnl_clear_detach(); - return ret; } diff --git a/common/Makefile b/common/Makefile index 6b4456edff..ecc23e6fd3 100644 --- a/common/Makefile +++ b/common/Makefile @@ -89,6 +89,7 @@ obj-$(CONFIG_USB_KEYBOARD) += usb_kbd.o endif # !CONFIG_SPL_BUILD ifdef CONFIG_SPL_BUILD +obj-$(CONFIG_SPL_DFU_SUPPORT) += dfu.o obj-$(CONFIG_SPL_DFU_SUPPORT) += cli_hush.o obj-$(CONFIG_SPL_HASH_SUPPORT) += hash.o obj-$(CONFIG_ENV_IS_IN_FLASH) += env_flash.o @@ -172,6 +173,7 @@ obj-$(CONFIG_CMDLINE) += cli_simple.o obj-y += cli.o obj-$(CONFIG_CMDLINE) += cli_readline.o +obj-$(CONFIG_CMD_DFU) += dfu.o obj-y += command.o obj-y += s_record.o obj-y += xyzModem.o diff --git a/common/dfu.c b/common/dfu.c new file mode 100644 index 0000000000..14b60f1fbb --- /dev/null +++ b/common/dfu.c @@ -0,0 +1,87 @@ +/* + * dfu.c -- dfu command + * + * Copyright (C) 2015 + * Lukasz Majewski + * + * Copyright (C) 2012 Samsung Electronics + * authors: Andrzej Pietrasiewicz + * Lukasz Majewski + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include +#include +#include +#include +#include +#include +#include + +int run_usb_dnl_gadget(int usbctrl_index, char *usb_dnl_gadget) +{ + bool dfu_reset = false; + int ret, i = 0; + + board_usb_init(usbctrl_index, USB_INIT_DEVICE); + g_dnl_clear_detach(); + g_dnl_register(usb_dnl_gadget); + while (1) { + if (g_dnl_detach()) { + /* + * Check if USB bus reset is performed after detach, + * which indicates that -R switch has been passed to + * dfu-util. In this case reboot the device + */ + if (dfu_usb_get_reset()) { + dfu_reset = true; + goto exit; + } + + /* + * This extra number of usb_gadget_handle_interrupts() + * calls is necessary to assure correct transmission + * completion with dfu-util + */ + if (++i == 10000) + goto exit; + } + + if (ctrlc()) + goto exit; + + if (dfu_get_defer_flush()) { + /* + * Call to usb_gadget_handle_interrupts() is necessary + * to act on ZLP OUT transaction from HOST PC after + * transmitting the whole file. + * + * If this ZLP OUT packet is NAK'ed, the HOST libusb + * function fails after timeout (by default it is set to + * 5 seconds). In such situation the dfu-util program + * exits with error message. + */ + usb_gadget_handle_interrupts(usbctrl_index); + ret = dfu_flush(dfu_get_defer_flush(), NULL, 0, 0); + dfu_set_defer_flush(NULL); + if (ret) { + error("Deferred dfu_flush() failed!"); + goto exit; + } + } + + WATCHDOG_RESET(); + usb_gadget_handle_interrupts(usbctrl_index); + } +exit: + g_dnl_unregister(); + board_usb_cleanup(usbctrl_index, USB_INIT_DEVICE); + + if (dfu_reset) + run_command("reset", 0); + + g_dnl_clear_detach(); + + return ret; +} diff --git a/include/g_dnl.h b/include/g_dnl.h index ba49f1f5cb..bd29a9f83a 100644 --- a/include/g_dnl.h +++ b/include/g_dnl.h @@ -43,5 +43,6 @@ void g_dnl_set_serialnumber(char *); bool g_dnl_detach(void); void g_dnl_trigger_detach(void); void g_dnl_clear_detach(void); +int run_usb_dnl_gadget(int usbctrl_index, char *usb_dnl_gadget); #endif /* __G_DOWNLOAD_H_ */ From 52f2acc5e065b52499ee4a8e6baf886b8f5fa6da Mon Sep 17 00:00:00 2001 From: "B, Ravi" Date: Thu, 28 Jul 2016 17:39:16 +0530 Subject: [PATCH 06/17] spl: dfu: adding dfu support functions for SPL-DFU Adding support functions to run dfu spl commands. Signed-off-by: Ravi Babu Reviewed-by: Tom Rini --- common/spl/Makefile | 1 + common/spl/spl_dfu.c | 57 ++++++++++++++++++++++++++++++++++++++++++++ include/spl.h | 8 +++++++ 3 files changed, 66 insertions(+) create mode 100644 common/spl/spl_dfu.c diff --git a/common/spl/Makefile b/common/spl/Makefile index b15f0f6dcd..5bd0b1841e 100644 --- a/common/spl/Makefile +++ b/common/spl/Makefile @@ -24,4 +24,5 @@ obj-$(CONFIG_SPL_USB_SUPPORT) += spl_usb.o obj-$(CONFIG_SPL_FAT_SUPPORT) += spl_fat.o obj-$(CONFIG_SPL_EXT_SUPPORT) += spl_ext.o obj-$(CONFIG_SPL_SATA_SUPPORT) += spl_sata.o +obj-$(CONFIG_SPL_DFU_SUPPORT) += spl_dfu.o endif diff --git a/common/spl/spl_dfu.c b/common/spl/spl_dfu.c new file mode 100644 index 0000000000..e8d0ba18e6 --- /dev/null +++ b/common/spl/spl_dfu.c @@ -0,0 +1,57 @@ +/* + * (C) Copyright 2016 + * Texas Instruments, + * + * Ravi B + * + * SPDX-License-Identifier: GPL-2.0+ + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static int run_dfu(int usb_index, char *interface, char *devstring) +{ + int ret; + + ret = dfu_init_env_entities(interface, devstring); + if (ret) { + dfu_free_entities(); + goto exit; + } + + run_usb_dnl_gadget(usb_index, "usb_dnl_dfu"); +exit: + dfu_free_entities(); + return ret; +} + +int spl_dfu_cmd(int usbctrl, char *dfu_alt_info, char *interface, char *devstr) +{ + char *str_env; + int ret; + + /* set default environment */ + set_default_env(0); + str_env = getenv(dfu_alt_info); + if (!str_env) { + error("\"dfu_alt_info\" env variable not defined!\n"); + return -EINVAL; + } + + ret = setenv("dfu_alt_info", str_env); + if (ret) { + error("unable to set env variable \"dfu_alt_info\"!\n"); + return -EINVAL; + } + + /* invoke dfu command */ + return run_dfu(usbctrl, interface, devstr); +} diff --git a/include/spl.h b/include/spl.h index 8afa0856c5..30eda36fef 100644 --- a/include/spl.h +++ b/include/spl.h @@ -144,4 +144,12 @@ void spl_board_init(void); */ bool spl_was_boot_source(void); +/** + * spl_dfu_cmd- run dfu command with chosen mmc device interface + * @param usb_index - usb controller number + * @param mmc_dev - mmc device nubmer + * + * @return 0 on success, otherwise error code + */ +int spl_dfu_cmd(int usbctrl, char *dfu_alt_info, char *interface, char *devstr); #endif From 6f8387f120362bfa62d7b99760881736162b57da Mon Sep 17 00:00:00 2001 From: "B, Ravi" Date: Thu, 28 Jul 2016 17:39:17 +0530 Subject: [PATCH 07/17] dra7x: boot: add dfu bootmode support This patch enables the DFU boot mode support for dra7x platform. Signed-off-by: Ravi Babu Reviewed-by: Tom Rini --- arch/arm/cpu/armv7/omap-common/boot-common.c | 5 +++++ arch/arm/include/asm/arch-omap5/spl.h | 2 +- common/spl/spl.c | 10 +++++++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/arch/arm/cpu/armv7/omap-common/boot-common.c b/arch/arm/cpu/armv7/omap-common/boot-common.c index 60c367a202..385310ba1e 100644 --- a/arch/arm/cpu/armv7/omap-common/boot-common.c +++ b/arch/arm/cpu/armv7/omap-common/boot-common.c @@ -90,6 +90,11 @@ void save_omap_boot_params(void) case BOOT_DEVICE_CPGMAC: sys_boot_device = 1; break; +#endif +#if defined(BOOT_DEVICE_DFU) && !defined(CONFIG_SPL_DFU_SUPPORT) + case BOOT_DEVICE_DFU: + sys_boot_device = 1; + break; #endif } diff --git a/arch/arm/include/asm/arch-omap5/spl.h b/arch/arm/include/asm/arch-omap5/spl.h index 468ff5afd5..3582880424 100644 --- a/arch/arm/include/asm/arch-omap5/spl.h +++ b/arch/arm/include/asm/arch-omap5/spl.h @@ -20,7 +20,7 @@ #define BOOT_DEVICE_QSPI_1 0x0A #define BOOT_DEVICE_QSPI_4 0x0B #define BOOT_DEVICE_UART 0x43 -#define BOOT_DEVICE_USB 0x45 +#define BOOT_DEVICE_DFU 0x45 #define MMC_BOOT_DEVICES_START BOOT_DEVICE_MMC1 #define MMC_BOOT_DEVICES_END BOOT_DEVICE_MMC2_2 diff --git a/common/spl/spl.c b/common/spl/spl.c index e14ec8052e..57b73af4a7 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -174,7 +174,7 @@ __weak void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image) # define CONFIG_SPL_LOAD_FIT_ADDRESS 0 #endif -#ifdef CONFIG_SPL_RAM_DEVICE +#if defined(CONFIG_SPL_RAM_DEVICE) || defined(CONFIG_SPL_DFU_SUPPORT) static ulong spl_ram_load_read(struct spl_load_info *load, ulong sector, ulong count, void *buf) { @@ -312,6 +312,9 @@ struct boot_device_name boot_name_table[] = { #ifdef CONFIG_SPL_USB_SUPPORT { BOOT_DEVICE_USB, "USB" }, #endif +#ifdef CONFIG_SPL_DFU_SUPPORT + { BOOT_DEVICE_DFU, "USB DFU" }, +#endif #ifdef CONFIG_SPL_SATA_SUPPORT { BOOT_DEVICE_SATA, "SATA" }, #endif @@ -398,6 +401,11 @@ static int spl_load_image(u32 boot_device) case BOOT_DEVICE_USB: return spl_usb_load_image(); #endif +#ifdef CONFIG_SPL_DFU_SUPPORT + case BOOT_DEVICE_DFU: + spl_dfu_cmd(0, "dfu_alt_info_ram", "ram", "0"); + return spl_ram_load_image(); +#endif #ifdef CONFIG_SPL_SATA_SUPPORT case BOOT_DEVICE_SATA: return spl_sata_load_image(); From cdb1808aefbc7173d687cb03de15b8ee3a671743 Mon Sep 17 00:00:00 2001 From: "B, Ravi" Date: Thu, 28 Jul 2016 17:39:18 +0530 Subject: [PATCH 08/17] dra7x: configs: enable SPL-DFU support This patch enables the SPL-DFU support for dra7x platform. Signed-off-by: Ravi Babu Reviewed-by: Tom Rini --- include/configs/dra7xx_evm.h | 20 +++++++++++++++++++- include/configs/ti_omap5_common.h | 2 -- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/include/configs/dra7xx_evm.h b/include/configs/dra7xx_evm.h index 194804c293..0726875569 100644 --- a/include/configs/dra7xx_evm.h +++ b/include/configs/dra7xx_evm.h @@ -132,6 +132,23 @@ #define CONFIG_FASTBOOT_FLASH_MMC_DEV 1 #endif +#ifdef CONFIG_SPL_BUILD +#undef CONFIG_CMD_BOOTD +#ifdef CONFIG_SPL_DFU_SUPPORT +#define CONFIG_SPL_LOAD_FIT_ADDRESS 0x80200000 +#define CONFIG_SPL_ENV_SUPPORT +#define CONFIG_SPL_HASH_SUPPORT +#define DFU_ALT_INFO_RAM \ + "dfu_alt_info_ram=" \ + "kernel ram 0x80200000 0x4000000;" \ + "fdt ram 0x80f80000 0x80000;" \ + "ramdisk ram 0x81000000 0x4000000\0" +#define DFUARGS \ + "dfu_bufsiz=0x10000\0" \ + DFU_ALT_INFO_RAM +#endif +#endif + #include /* Enhance our eMMC support / experience. */ @@ -209,9 +226,10 @@ #define CONFIG_USB_FUNCTION_DFU #define CONFIG_DFU_RAM +#ifndef CONFIG_SPL_BUILD #define CONFIG_DFU_MMC -#define CONFIG_DFU_RAM #define CONFIG_DFU_SF +#endif /* SATA */ #define CONFIG_BOARD_LATE_INIT diff --git a/include/configs/ti_omap5_common.h b/include/configs/ti_omap5_common.h index cbdf0bc0db..ea11226620 100644 --- a/include/configs/ti_omap5_common.h +++ b/include/configs/ti_omap5_common.h @@ -64,7 +64,6 @@ #define DFUARGS #endif -#ifndef CONFIG_SPL_BUILD #define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG #define CONFIG_EXTRA_ENV_SETTINGS \ DEFAULT_LINUX_BOOT_ENV \ @@ -128,7 +127,6 @@ "setenv mmcroot /dev/mmcblk0p2 rw; " \ "run mmcboot;" \ "" -#endif /* * SPL related defines. The Public RAM memory map the ROM defines the From 54a708ca06830c3fe3df8c0001ab33df784701f9 Mon Sep 17 00:00:00 2001 From: Sanchayan Maity Date: Mon, 8 Aug 2016 16:56:17 +0530 Subject: [PATCH 09/17] cmd: dfu: Add error handling for failed registration Without this, if g_dnl_register() fails, DFU code continues on blindly and crashes. This fix makes it simply print an error message instead. Signed-off-by: Sanchayan Maity [l.majewski@samsung.com - some manual tweaks needed] --- common/dfu.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/common/dfu.c b/common/dfu.c index 14b60f1fbb..4c529f7c36 100644 --- a/common/dfu.c +++ b/common/dfu.c @@ -26,7 +26,12 @@ int run_usb_dnl_gadget(int usbctrl_index, char *usb_dnl_gadget) board_usb_init(usbctrl_index, USB_INIT_DEVICE); g_dnl_clear_detach(); - g_dnl_register(usb_dnl_gadget); + ret = g_dnl_register(usb_dnl_gadget); + if (ret) { + error("g_dnl_register failed"); + return CMD_RET_FAILURE; + } + while (1) { if (g_dnl_detach()) { /* From 0885cdb9d154ac0f63bb681d4f280a39de354f8c Mon Sep 17 00:00:00 2001 From: Sanchayan Maity Date: Tue, 9 Aug 2016 23:44:59 +0530 Subject: [PATCH 10/17] usb: host: ehci-vf: Migrate Vybrid USB to driver model Add driver model support for Vybrid USB driver. Signed-off-by: Sanchayan Maity --- drivers/usb/host/ehci-vf.c | 208 +++++++++++++++++++++++++++++++++++-- 1 file changed, 201 insertions(+), 7 deletions(-) diff --git a/drivers/usb/host/ehci-vf.c b/drivers/usb/host/ehci-vf.c index 61789dddc3..f6f9efb6cd 100644 --- a/drivers/usb/host/ehci-vf.c +++ b/drivers/usb/host/ehci-vf.c @@ -8,16 +8,20 @@ */ #include +#include #include #include #include #include +#include #include #include #include #include #include #include +#include +#include #include "ehci.h" @@ -32,6 +36,8 @@ #define UCMD_RUN_STOP (1 << 0) /* controller run/stop */ #define UCMD_RESET (1 << 1) /* controller reset */ +DECLARE_GLOBAL_DATA_PTR; + static const unsigned phy_bases[] = { USB_PHY0_BASE_ADDR, USB_PHY1_BASE_ADDR, @@ -131,24 +137,39 @@ int __weak board_ehci_hcd_init(int port) return 0; } +int ehci_vf_common_init(struct usb_ehci *ehci, int index) +{ + int ret; + + /* Do board specific initialisation */ + ret = board_ehci_hcd_init(index); + if (ret) + return ret; + + usb_power_config(index); + usb_oc_config(index); + usb_internal_phy_clock_gate(index); + usb_phy_enable(index, ehci); + + return 0; +} + +#ifndef CONFIG_DM_USB int ehci_hcd_init(int index, enum usb_init_type init, struct ehci_hccr **hccr, struct ehci_hcor **hcor) { struct usb_ehci *ehci; enum usb_init_type type; + int ret; if (index >= ARRAY_SIZE(nc_reg_bases)) return -EINVAL; ehci = (struct usb_ehci *)nc_reg_bases[index]; - /* Do board specific initialisation */ - board_ehci_hcd_init(index); - - usb_power_config(index); - usb_oc_config(index); - usb_internal_phy_clock_gate(index); - usb_phy_enable(index, ehci); + ret = ehci_vf_common_init(index); + if (ret) + return ret; *hccr = (struct ehci_hccr *)((uint32_t)&ehci->caplength); *hcor = (struct ehci_hcor *)((uint32_t)*hccr + @@ -175,3 +196,176 @@ int ehci_hcd_stop(int index) { return 0; } +#else +/* Possible port types (dual role mode) */ +enum dr_mode { + DR_MODE_NONE = 0, + DR_MODE_HOST, /* supports host operation */ + DR_MODE_DEVICE, /* supports device operation */ + DR_MODE_OTG, /* supports both */ +}; + +struct ehci_vf_priv_data { + struct ehci_ctrl ctrl; + struct usb_ehci *ehci; + struct gpio_desc cdet_gpio; + enum usb_init_type init_type; + enum dr_mode dr_mode; + u32 portnr; +}; + +static int vf_usb_ofdata_to_platdata(struct udevice *dev) +{ + struct ehci_vf_priv_data *priv = dev_get_priv(dev); + const void *dt_blob = gd->fdt_blob; + int node = dev->of_offset; + const char *mode; + + priv->portnr = dev->seq; + + priv->ehci = (struct usb_ehci *)dev_get_addr(dev); + mode = fdt_getprop(dt_blob, node, "dr_mode", NULL); + if (mode) { + if (0 == strcmp(mode, "host")) { + priv->dr_mode = DR_MODE_HOST; + priv->init_type = USB_INIT_HOST; + } else if (0 == strcmp(mode, "peripheral")) { + priv->dr_mode = DR_MODE_DEVICE; + priv->init_type = USB_INIT_DEVICE; + } else if (0 == strcmp(mode, "otg")) { + priv->dr_mode = DR_MODE_OTG; + /* + * We set init_type to device by default when OTG + * mode is requested. If a valid gpio is provided + * we will switch the init_type based on the state + * of the gpio pin. + */ + priv->init_type = USB_INIT_DEVICE; + } else { + debug("%s: Cannot decode dr_mode '%s'\n", + __func__, mode); + return -EINVAL; + } + } else { + priv->dr_mode = DR_MODE_HOST; + priv->init_type = USB_INIT_HOST; + } + + if (priv->dr_mode == DR_MODE_OTG) { + gpio_request_by_name_nodev(dt_blob, node, "fsl,cdet-gpio", 0, + &priv->cdet_gpio, GPIOD_IS_IN); + if (dm_gpio_is_valid(&priv->cdet_gpio)) { + if (dm_gpio_get_value(&priv->cdet_gpio)) + priv->init_type = USB_INIT_DEVICE; + else + priv->init_type = USB_INIT_HOST; + } + } + + return 0; +} + +static int vf_init_after_reset(struct ehci_ctrl *dev) +{ + struct ehci_vf_priv_data *priv = dev->priv; + enum usb_init_type type = priv->init_type; + struct usb_ehci *ehci = priv->ehci; + int ret; + + ret = ehci_vf_common_init(priv->ehci, priv->portnr); + if (ret) + return ret; + + if (type == USB_INIT_DEVICE) + return 0; + + setbits_le32(&ehci->usbmode, CM_HOST); + writel((PORT_PTS_UTMI | PORT_PTS_PTW), &ehci->portsc); + setbits_le32(&ehci->portsc, USB_EN); + + mdelay(10); + + return 0; +} + +static const struct ehci_ops vf_ehci_ops = { + .init_after_reset = vf_init_after_reset +}; + +static int vf_usb_bind(struct udevice *dev) +{ + static int num_controllers; + + /* + * Without this hack, if we return ENODEV for USB Controller 0, on + * probe for the next controller, USB Controller 1 will be given a + * sequence number of 0. This conflicts with our requirement of + * sequence numbers while initialising the peripherals. + */ + dev->req_seq = num_controllers; + num_controllers++; + + return 0; +} + +static int ehci_usb_probe(struct udevice *dev) +{ + struct usb_platdata *plat = dev_get_platdata(dev); + struct ehci_vf_priv_data *priv = dev_get_priv(dev); + struct usb_ehci *ehci = priv->ehci; + struct ehci_hccr *hccr; + struct ehci_hcor *hcor; + int ret; + + ret = ehci_vf_common_init(ehci, priv->portnr); + if (ret) + return ret; + + if (priv->init_type != plat->init_type) + return -ENODEV; + + if (priv->init_type == USB_INIT_HOST) { + setbits_le32(&ehci->usbmode, CM_HOST); + writel((PORT_PTS_UTMI | PORT_PTS_PTW), &ehci->portsc); + setbits_le32(&ehci->portsc, USB_EN); + } + + mdelay(10); + + hccr = (struct ehci_hccr *)((uint32_t)&ehci->caplength); + hcor = (struct ehci_hcor *)((uint32_t)hccr + + HC_LENGTH(ehci_readl(&hccr->cr_capbase))); + + return ehci_register(dev, hccr, hcor, &vf_ehci_ops, 0, priv->init_type); +} + +static int ehci_usb_remove(struct udevice *dev) +{ + int ret; + + ret = ehci_deregister(dev); + if (ret) + return ret; + + return 0; +} + +static const struct udevice_id vf_usb_ids[] = { + { .compatible = "fsl,vf610-usb" }, + { } +}; + +U_BOOT_DRIVER(usb_ehci) = { + .name = "ehci_vf", + .id = UCLASS_USB, + .of_match = vf_usb_ids, + .bind = vf_usb_bind, + .probe = ehci_usb_probe, + .remove = ehci_usb_remove, + .ops = &ehci_usb_ops, + .ofdata_to_platdata = vf_usb_ofdata_to_platdata, + .platdata_auto_alloc_size = sizeof(struct usb_platdata), + .priv_auto_alloc_size = sizeof(struct ehci_vf_priv_data), + .flags = DM_FLAG_ALLOC_PRIV_DMA, +}; +#endif From 5aaad0647a582602078be143ca30faefb16498a2 Mon Sep 17 00:00:00 2001 From: Sanchayan Maity Date: Tue, 9 Aug 2016 23:45:00 +0530 Subject: [PATCH 11/17] ARM: dts: vf: Add device tree node for USB on Vybrid Add device tree node for USB peripheral on Vybrid. Signed-off-by: Sanchayan Maity --- arch/arm/dts/vf.dtsi | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/arch/arm/dts/vf.dtsi b/arch/arm/dts/vf.dtsi index 1530d2fc87..d7d21a37ad 100644 --- a/arch/arm/dts/vf.dtsi +++ b/arch/arm/dts/vf.dtsi @@ -4,6 +4,7 @@ * SPDX-License-Identifier: GPL-2.0+ or X11 */ /include/ "skeleton.dtsi" +#include / { aliases { @@ -20,6 +21,8 @@ serial5 = &uart5; spi0 = &dspi0; spi1 = &dspi1; + ehci0 = &ehci0; + ehci1 = &ehci1; }; soc { @@ -113,6 +116,12 @@ reg = <0x400ff100 0x40>; #gpio-cells = <2>; }; + + ehci0: ehci@40034000 { + compatible = "fsl,vf610-usb"; + reg = <0x40034000 0x800>; + status = "disabled"; + }; }; aips1: aips-bus@40080000 { @@ -133,6 +142,11 @@ status = "disabled"; }; + ehci1: ehci@400b4000 { + compatible = "fsl,vf610-usb"; + reg = <0x400b4000 0x800>; + status = "disabled"; + }; }; }; }; From 727f7908292c9cd3b356fde229cfeecad7df248a Mon Sep 17 00:00:00 2001 From: Sanchayan Maity Date: Tue, 9 Aug 2016 23:45:01 +0530 Subject: [PATCH 12/17] ARM: dts: vf-colibri: Enable USB device tree node for Colibri Vybrid Enable USB device tree node for Toradex Colibri Vybrid module. Signed-off-by: Sanchayan Maity --- arch/arm/dts/vf-colibri.dtsi | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/arch/arm/dts/vf-colibri.dtsi b/arch/arm/dts/vf-colibri.dtsi index dc52748c09..c2f104a89b 100644 --- a/arch/arm/dts/vf-colibri.dtsi +++ b/arch/arm/dts/vf-colibri.dtsi @@ -21,6 +21,17 @@ }; }; +&ehci0 { + dr_mode = "otg"; + fsl,cdet-gpio = <&gpio3 6 GPIO_ACTIVE_HIGH>; + status = "okay"; +}; + +&ehci1 { + dr_mode = "host"; + status = "okay"; +}; + &uart0 { status = "okay"; }; From 86e5a04bb8e06eb64619839eeda488e47ca6826a Mon Sep 17 00:00:00 2001 From: Sanchayan Maity Date: Tue, 9 Aug 2016 23:45:02 +0530 Subject: [PATCH 13/17] configs: colibri_vf_defconfig: Enable USB driver model for Colibri Vybrid Enable USB driver model for Toradex Colibri Vybrid modules. Signed-off-by: Sanchayan Maity --- configs/colibri_vf_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/colibri_vf_defconfig b/configs/colibri_vf_defconfig index c7fc7991f7..fc2164c34a 100644 --- a/configs/colibri_vf_defconfig +++ b/configs/colibri_vf_defconfig @@ -37,6 +37,7 @@ CONFIG_DM_SPI=y CONFIG_FSL_DSPI=y CONFIG_USB=y CONFIG_USB_STORAGE=y +CONFIG_DM_USB=y CONFIG_USB_GADGET=y CONFIG_CI_UDC=y CONFIG_USB_GADGET_DOWNLOAD=y From f7c81e287954fd9048d4419006e8314b7b7c46d0 Mon Sep 17 00:00:00 2001 From: Marcel Ziswiler Date: Thu, 15 Sep 2016 00:54:00 +0200 Subject: [PATCH 14/17] apalis_t30: colibri_imx7: colibri_t30: fix ethernet functionality Since commit aa7a648747d8c704a9a81c9e493d386930724e9d ("net: Stop including NFS overhead in defragment max") the following has been reproducibly observed while trying to transfer data over TFTP: Load address: 0x80408000 Loading: EHCI timed out on TD - token=0x8008d80 T EHCI timed out on TD - token=0x88008d80 Rx: failed to receive: -5 This patch fixes this by lowering our TFTP block size to be within the standard maximal de-fragmentation aka IP packet size again. Signed-off-by: Marcel Ziswiler --- include/configs/apalis_t30.h | 2 +- include/configs/colibri_imx7.h | 4 ++-- include/configs/colibri_t30.h | 3 +-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/include/configs/apalis_t30.h b/include/configs/apalis_t30.h index 8c76605f8b..3fc177906b 100644 --- a/include/configs/apalis_t30.h +++ b/include/configs/apalis_t30.h @@ -52,7 +52,7 @@ /* General networking support */ #define CONFIG_IP_DEFRAG -#define CONFIG_TFTP_BLOCKSIZE 16384 +#define CONFIG_TFTP_BLOCKSIZE 16352 #define CONFIG_TFTP_TSIZE /* Miscellaneous commands */ diff --git a/include/configs/colibri_imx7.h b/include/configs/colibri_imx7.h index ba1adea364..b628d11fe9 100644 --- a/include/configs/colibri_imx7.h +++ b/include/configs/colibri_imx7.h @@ -44,9 +44,9 @@ #define CONFIG_PHYLIB #define CONFIG_PHY_MICREL -#define CONFIG_TFTP_TSIZE #define CONFIG_IP_DEFRAG -#define CONFIG_TFTP_BLOCKSIZE 16384 +#define CONFIG_TFTP_BLOCKSIZE 16352 +#define CONFIG_TFTP_TSIZE /* ENET1 */ #define IMX_FEC_BASE ENET_IPS_BASE_ADDR diff --git a/include/configs/colibri_t30.h b/include/configs/colibri_t30.h index 3431cde62f..e2a2549fb6 100644 --- a/include/configs/colibri_t30.h +++ b/include/configs/colibri_t30.h @@ -48,8 +48,7 @@ /* General networking support */ #define CONFIG_IP_DEFRAG -#define CONFIG_NET_MAXDEFRAG (16384 + 4096 + 24) -#define CONFIG_TFTP_BLOCKSIZE 16384 +#define CONFIG_TFTP_BLOCKSIZE 16352 #define CONFIG_TFTP_TSIZE /* Miscellaneous commands */ From a5c289b9bca3805fa35e42f389dc8225c6b916be Mon Sep 17 00:00:00 2001 From: Sriram Dash Date: Fri, 16 Sep 2016 17:12:15 +0530 Subject: [PATCH 15/17] usb: fsl: Rename fdt_fixup_dr_usb The function fdt_fixup_dr_usb is specific to fsl/nxp. So, make the function name explicit and rename fdt_fixup_dr_usb into fsl_fdt_fixup_dr_usb. Signed-off-by: Sriram Dash --- board/Arcturus/ucp1020/ucp1020.c | 2 +- board/freescale/b4860qds/b4860qds.c | 2 +- board/freescale/bsc9131rdb/bsc9131rdb.c | 2 +- board/freescale/bsc9132qds/bsc9132qds.c | 2 +- board/freescale/corenet_ds/corenet_ds.c | 2 +- board/freescale/ls2080aqds/ls2080aqds.c | 2 +- board/freescale/ls2080ardb/ls2080ardb.c | 2 +- board/freescale/mpc8308rdb/mpc8308rdb.c | 2 +- board/freescale/mpc8315erdb/mpc8315erdb.c | 2 +- board/freescale/mpc837xemds/mpc837xemds.c | 2 +- board/freescale/mpc837xerdb/mpc837xerdb.c | 2 +- board/freescale/mpc8536ds/mpc8536ds.c | 2 +- board/freescale/p1010rdb/p1010rdb.c | 2 +- board/freescale/p1022ds/p1022ds.c | 2 +- board/freescale/p1023rdb/p1023rdb.c | 2 +- board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c | 2 +- board/freescale/p1_twr/p1_twr.c | 2 +- board/freescale/p2041rdb/p2041rdb.c | 2 +- board/freescale/t102xqds/t102xqds.c | 2 +- board/freescale/t102xrdb/t102xrdb.c | 2 +- board/freescale/t1040qds/t1040qds.c | 2 +- board/freescale/t104xrdb/t104xrdb.c | 2 +- board/freescale/t208xqds/t208xqds.c | 2 +- board/freescale/t208xrdb/t208xrdb.c | 2 +- board/freescale/t4qds/t4240emu.c | 2 +- board/freescale/t4qds/t4240qds.c | 2 +- board/freescale/t4rdb/t4240rdb.c | 2 +- board/gdsys/mpc8308/hrcon.c | 2 +- board/gdsys/mpc8308/strider.c | 2 +- board/gdsys/p1022/controlcenterd.c | 2 +- board/keymile/kmp204x/kmp204x.c | 2 +- board/mpc8308_p1m/mpc8308_p1m.c | 2 +- board/varisys/cyrus/cyrus.c | 2 +- drivers/usb/common/fsl-dt-fixup.c | 2 +- include/fdt_support.h | 4 ++-- 35 files changed, 36 insertions(+), 36 deletions(-) diff --git a/board/Arcturus/ucp1020/ucp1020.c b/board/Arcturus/ucp1020/ucp1020.c index 0fc2bac55d..0d086e87fa 100644 --- a/board/Arcturus/ucp1020/ucp1020.c +++ b/board/Arcturus/ucp1020/ucp1020.c @@ -315,7 +315,7 @@ int ft_board_setup(void *blob, bd_t *bd) FT_FSL_PCI_SETUP; #if defined(CONFIG_HAS_FSL_DR_USB) - fdt_fixup_dr_usb(blob, bd); + fsl_fdt_fixup_dr_usb(blob, bd); #endif #if defined(CONFIG_SDCARD) || defined(CONFIG_SPIFLASH) diff --git a/board/freescale/b4860qds/b4860qds.c b/board/freescale/b4860qds/b4860qds.c index 1642a7d1ae..c2ceb8014e 100644 --- a/board/freescale/b4860qds/b4860qds.c +++ b/board/freescale/b4860qds/b4860qds.c @@ -1209,7 +1209,7 @@ int ft_board_setup(void *blob, bd_t *bd) fdt_fixup_liodn(blob); #ifdef CONFIG_HAS_FSL_DR_USB - fdt_fixup_dr_usb(blob, bd); + fsl_fdt_fixup_dr_usb(blob, bd); #endif #ifdef CONFIG_SYS_DPAA_FMAN diff --git a/board/freescale/bsc9131rdb/bsc9131rdb.c b/board/freescale/bsc9131rdb/bsc9131rdb.c index 75e114217b..fb8bb39d87 100644 --- a/board/freescale/bsc9131rdb/bsc9131rdb.c +++ b/board/freescale/bsc9131rdb/bsc9131rdb.c @@ -73,7 +73,7 @@ int ft_board_setup(void *blob, bd_t *bd) fdt_fixup_mtdparts(blob, nodes, ARRAY_SIZE(nodes)); #endif - fdt_fixup_dr_usb(blob, bd); + fsl_fdt_fixup_dr_usb(blob, bd); return 0; } diff --git a/board/freescale/bsc9132qds/bsc9132qds.c b/board/freescale/bsc9132qds/bsc9132qds.c index 71a7bb55c4..2c836da63b 100644 --- a/board/freescale/bsc9132qds/bsc9132qds.c +++ b/board/freescale/bsc9132qds/bsc9132qds.c @@ -394,7 +394,7 @@ int ft_board_setup(void *blob, bd_t *bd) /* remove dts usb node */ fdt_del_node_compat(blob, "fsl-usb2-dr"); } else { - fdt_fixup_dr_usb(blob, bd); + fsl_fdt_fixup_dr_usb(blob, bd); fdt_del_node_and_alias(blob, "serial2"); } } diff --git a/board/freescale/corenet_ds/corenet_ds.c b/board/freescale/corenet_ds/corenet_ds.c index f41985d2f6..8a44a9a972 100644 --- a/board/freescale/corenet_ds/corenet_ds.c +++ b/board/freescale/corenet_ds/corenet_ds.c @@ -201,7 +201,7 @@ int ft_board_setup(void *blob, bd_t *bd) #endif fdt_fixup_liodn(blob); - fdt_fixup_dr_usb(blob, bd); + fsl_fdt_fixup_dr_usb(blob, bd); #ifdef CONFIG_SYS_DPAA_FMAN fdt_fixup_fman_ethernet(blob); diff --git a/board/freescale/ls2080aqds/ls2080aqds.c b/board/freescale/ls2080aqds/ls2080aqds.c index ca4a2e5cb7..d07ca18af9 100644 --- a/board/freescale/ls2080aqds/ls2080aqds.c +++ b/board/freescale/ls2080aqds/ls2080aqds.c @@ -313,7 +313,7 @@ int ft_board_setup(void *blob, bd_t *bd) fdt_fixup_memory_banks(blob, base, size, 2); - fdt_fixup_dr_usb(blob, bd); + fsl_fdt_fixup_dr_usb(blob, bd); #ifdef CONFIG_FSL_MC_ENET fdt_fixup_board_enet(blob); diff --git a/board/freescale/ls2080ardb/ls2080ardb.c b/board/freescale/ls2080ardb/ls2080ardb.c index 7d8a7115dc..83d9e7ec12 100644 --- a/board/freescale/ls2080ardb/ls2080ardb.c +++ b/board/freescale/ls2080ardb/ls2080ardb.c @@ -277,7 +277,7 @@ int ft_board_setup(void *blob, bd_t *bd) fdt_fixup_memory_banks(blob, base, size, 2); - fdt_fixup_dr_usb(blob, bd); + fsl_fdt_fixup_dr_usb(blob, bd); #ifdef CONFIG_FSL_MC_ENET fdt_fixup_board_enet(blob); diff --git a/board/freescale/mpc8308rdb/mpc8308rdb.c b/board/freescale/mpc8308rdb/mpc8308rdb.c index 93e1c50f39..b4a0dd5d1a 100644 --- a/board/freescale/mpc8308rdb/mpc8308rdb.c +++ b/board/freescale/mpc8308rdb/mpc8308rdb.c @@ -164,7 +164,7 @@ int misc_init_r(void) int ft_board_setup(void *blob, bd_t *bd) { ft_cpu_setup(blob, bd); - fdt_fixup_dr_usb(blob, bd); + fsl_fdt_fixup_dr_usb(blob, bd); fdt_fixup_esdhc(blob, bd); return 0; diff --git a/board/freescale/mpc8315erdb/mpc8315erdb.c b/board/freescale/mpc8315erdb/mpc8315erdb.c index ed611c56c3..3cec09b586 100644 --- a/board/freescale/mpc8315erdb/mpc8315erdb.c +++ b/board/freescale/mpc8315erdb/mpc8315erdb.c @@ -194,7 +194,7 @@ int ft_board_setup(void *blob, bd_t *bd) #ifdef CONFIG_PCI ft_pci_setup(blob, bd); #endif - fdt_fixup_dr_usb(blob, bd); + fsl_fdt_fixup_dr_usb(blob, bd); fdt_tsec1_fixup(blob, bd); return 0; diff --git a/board/freescale/mpc837xemds/mpc837xemds.c b/board/freescale/mpc837xemds/mpc837xemds.c index 572913c7ac..045841d57b 100644 --- a/board/freescale/mpc837xemds/mpc837xemds.c +++ b/board/freescale/mpc837xemds/mpc837xemds.c @@ -332,7 +332,7 @@ int ft_board_setup(void *blob, bd_t *bd) { ft_cpu_setup(blob, bd); ft_tsec_fixup(blob, bd); - fdt_fixup_dr_usb(blob, bd); + fsl_fdt_fixup_dr_usb(blob, bd); fdt_fixup_esdhc(blob, bd); #ifdef CONFIG_PCI ft_pci_setup(blob, bd); diff --git a/board/freescale/mpc837xerdb/mpc837xerdb.c b/board/freescale/mpc837xerdb/mpc837xerdb.c index 565f815781..07c0599858 100644 --- a/board/freescale/mpc837xerdb/mpc837xerdb.c +++ b/board/freescale/mpc837xerdb/mpc837xerdb.c @@ -210,7 +210,7 @@ int ft_board_setup(void *blob, bd_t *bd) ft_pci_setup(blob, bd); #endif ft_cpu_setup(blob, bd); - fdt_fixup_dr_usb(blob, bd); + fsl_fdt_fixup_dr_usb(blob, bd); fdt_fixup_esdhc(blob, bd); return 0; diff --git a/board/freescale/mpc8536ds/mpc8536ds.c b/board/freescale/mpc8536ds/mpc8536ds.c index 7b0f461971..cede1da634 100644 --- a/board/freescale/mpc8536ds/mpc8536ds.c +++ b/board/freescale/mpc8536ds/mpc8536ds.c @@ -282,7 +282,7 @@ int ft_board_setup(void *blob, bd_t *bd) #endif #ifdef CONFIG_HAS_FSL_MPH_USB - fdt_fixup_dr_usb(blob, bd); + fsl_fdt_fixup_dr_usb(blob, bd); #endif return 0; diff --git a/board/freescale/p1010rdb/p1010rdb.c b/board/freescale/p1010rdb/p1010rdb.c index 1ae15407db..8eecb0647b 100644 --- a/board/freescale/p1010rdb/p1010rdb.c +++ b/board/freescale/p1010rdb/p1010rdb.c @@ -463,7 +463,7 @@ int ft_board_setup(void *blob, bd_t *bd) fdt_fixup_memory(blob, (u64)base, (u64)size); #if defined(CONFIG_HAS_FSL_DR_USB) - fdt_fixup_dr_usb(blob, bd); + fsl_fdt_fixup_dr_usb(blob, bd); #endif /* P1014 and it's derivatives don't support CAN and eTSEC3 */ diff --git a/board/freescale/p1022ds/p1022ds.c b/board/freescale/p1022ds/p1022ds.c index d7dd478dff..345feac0b2 100644 --- a/board/freescale/p1022ds/p1022ds.c +++ b/board/freescale/p1022ds/p1022ds.c @@ -345,7 +345,7 @@ int ft_board_setup(void *blob, bd_t *bd) fdt_fixup_memory(blob, (u64)base, (u64)size); #ifdef CONFIG_HAS_FSL_DR_USB - fdt_fixup_dr_usb(blob, bd); + fsl_fdt_fixup_dr_usb(blob, bd); #endif FT_FSL_PCI_SETUP; diff --git a/board/freescale/p1023rdb/p1023rdb.c b/board/freescale/p1023rdb/p1023rdb.c index 074b71326f..0451722603 100644 --- a/board/freescale/p1023rdb/p1023rdb.c +++ b/board/freescale/p1023rdb/p1023rdb.c @@ -143,7 +143,7 @@ int ft_board_setup(void *blob, bd_t *bd) fdt_fixup_memory(blob, (u64)base, (u64)size); #ifdef CONFIG_HAS_FSL_DR_USB - fdt_fixup_dr_usb(blob, bd); + fsl_fdt_fixup_dr_usb(blob, bd); #endif fdt_fixup_fman_ethernet(blob); diff --git a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c index 61b7a91333..d61c3a5413 100644 --- a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c +++ b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c @@ -454,7 +454,7 @@ int ft_board_setup(void *blob, bd_t *bd) #endif #if defined(CONFIG_HAS_FSL_DR_USB) - fdt_fixup_dr_usb(blob, bd); + fsl_fdt_fixup_dr_usb(blob, bd); #endif #if defined(CONFIG_SDCARD) || defined(CONFIG_SPIFLASH) diff --git a/board/freescale/p1_twr/p1_twr.c b/board/freescale/p1_twr/p1_twr.c index a40bea328b..f54a6ff8dc 100644 --- a/board/freescale/p1_twr/p1_twr.c +++ b/board/freescale/p1_twr/p1_twr.c @@ -282,7 +282,7 @@ int ft_board_setup(void *blob, bd_t *bd) #if defined(CONFIG_TWR_P1025) fdt_board_fixup_qe_pins(blob); #endif - fdt_fixup_dr_usb(blob, bd); + fsl_fdt_fixup_dr_usb(blob, bd); return 0; } diff --git a/board/freescale/p2041rdb/p2041rdb.c b/board/freescale/p2041rdb/p2041rdb.c index c6a724217f..21fb66f184 100644 --- a/board/freescale/p2041rdb/p2041rdb.c +++ b/board/freescale/p2041rdb/p2041rdb.c @@ -225,7 +225,7 @@ int ft_board_setup(void *blob, bd_t *bd) fdt_fixup_memory(blob, (u64)base, (u64)size); #if defined(CONFIG_HAS_FSL_DR_USB) || defined(CONFIG_HAS_FSL_MPH_USB) - fdt_fixup_dr_usb(blob, bd); + fsl_fdt_fixup_dr_usb(blob, bd); #endif #ifdef CONFIG_PCI diff --git a/board/freescale/t102xqds/t102xqds.c b/board/freescale/t102xqds/t102xqds.c index 76793a1186..1affa0b3a8 100644 --- a/board/freescale/t102xqds/t102xqds.c +++ b/board/freescale/t102xqds/t102xqds.c @@ -375,7 +375,7 @@ int ft_board_setup(void *blob, bd_t *bd) fdt_fixup_liodn(blob); #ifdef CONFIG_HAS_FSL_DR_USB - fdt_fixup_dr_usb(blob, bd); + fsl_fdt_fixup_dr_usb(blob, bd); #endif #ifdef CONFIG_SYS_DPAA_FMAN diff --git a/board/freescale/t102xrdb/t102xrdb.c b/board/freescale/t102xrdb/t102xrdb.c index 01dbf381bd..24df4b440f 100644 --- a/board/freescale/t102xrdb/t102xrdb.c +++ b/board/freescale/t102xrdb/t102xrdb.c @@ -189,7 +189,7 @@ int ft_board_setup(void *blob, bd_t *bd) #endif fdt_fixup_liodn(blob); - fdt_fixup_dr_usb(blob, bd); + fsl_fdt_fixup_dr_usb(blob, bd); #ifdef CONFIG_SYS_DPAA_FMAN fdt_fixup_fman_ethernet(blob); diff --git a/board/freescale/t1040qds/t1040qds.c b/board/freescale/t1040qds/t1040qds.c index d7d56b47c8..5466fbf5f6 100644 --- a/board/freescale/t1040qds/t1040qds.c +++ b/board/freescale/t1040qds/t1040qds.c @@ -257,7 +257,7 @@ int ft_board_setup(void *blob, bd_t *bd) fdt_fixup_liodn(blob); #ifdef CONFIG_HAS_FSL_DR_USB - fdt_fixup_dr_usb(blob, bd); + fsl_fdt_fixup_dr_usb(blob, bd); #endif #ifdef CONFIG_SYS_DPAA_FMAN diff --git a/board/freescale/t104xrdb/t104xrdb.c b/board/freescale/t104xrdb/t104xrdb.c index ec97677df8..6bad6a4540 100644 --- a/board/freescale/t104xrdb/t104xrdb.c +++ b/board/freescale/t104xrdb/t104xrdb.c @@ -144,7 +144,7 @@ int ft_board_setup(void *blob, bd_t *bd) fdt_fixup_liodn(blob); #ifdef CONFIG_HAS_FSL_DR_USB - fdt_fixup_dr_usb(blob, bd); + fsl_fdt_fixup_dr_usb(blob, bd); #endif #ifdef CONFIG_SYS_DPAA_FMAN diff --git a/board/freescale/t208xqds/t208xqds.c b/board/freescale/t208xqds/t208xqds.c index bfea3a1556..d016329cd1 100644 --- a/board/freescale/t208xqds/t208xqds.c +++ b/board/freescale/t208xqds/t208xqds.c @@ -461,7 +461,7 @@ int ft_board_setup(void *blob, bd_t *bd) #endif fdt_fixup_liodn(blob); - fdt_fixup_dr_usb(blob, bd); + fsl_fdt_fixup_dr_usb(blob, bd); #ifdef CONFIG_SYS_DPAA_FMAN fdt_fixup_fman_ethernet(blob); diff --git a/board/freescale/t208xrdb/t208xrdb.c b/board/freescale/t208xrdb/t208xrdb.c index 0cb05aa03f..1ab05ec9fd 100644 --- a/board/freescale/t208xrdb/t208xrdb.c +++ b/board/freescale/t208xrdb/t208xrdb.c @@ -128,7 +128,7 @@ int ft_board_setup(void *blob, bd_t *bd) #endif fdt_fixup_liodn(blob); - fdt_fixup_dr_usb(blob, bd); + fsl_fdt_fixup_dr_usb(blob, bd); #ifdef CONFIG_SYS_DPAA_FMAN fdt_fixup_fman_ethernet(blob); diff --git a/board/freescale/t4qds/t4240emu.c b/board/freescale/t4qds/t4240emu.c index f1393f25f9..35ad19e045 100644 --- a/board/freescale/t4qds/t4240emu.c +++ b/board/freescale/t4qds/t4240emu.c @@ -76,7 +76,7 @@ int ft_board_setup(void *blob, bd_t *bd) fdt_fixup_memory(blob, (u64)base, (u64)size); fdt_fixup_liodn(blob); - fdt_fixup_dr_usb(blob, bd); + fsl_fdt_fixup_dr_usb(blob, bd); return 0; } diff --git a/board/freescale/t4qds/t4240qds.c b/board/freescale/t4qds/t4240qds.c index d6df144730..8f9e7e8255 100644 --- a/board/freescale/t4qds/t4240qds.c +++ b/board/freescale/t4qds/t4240qds.c @@ -694,7 +694,7 @@ int ft_board_setup(void *blob, bd_t *bd) #endif fdt_fixup_liodn(blob); - fdt_fixup_dr_usb(blob, bd); + fsl_fdt_fixup_dr_usb(blob, bd); #ifdef CONFIG_SYS_DPAA_FMAN fdt_fixup_fman_ethernet(blob); diff --git a/board/freescale/t4rdb/t4240rdb.c b/board/freescale/t4rdb/t4240rdb.c index 406fb132ae..bdd6f4ef49 100644 --- a/board/freescale/t4rdb/t4240rdb.c +++ b/board/freescale/t4rdb/t4240rdb.c @@ -107,7 +107,7 @@ int ft_board_setup(void *blob, bd_t *bd) #endif fdt_fixup_liodn(blob); - fdt_fixup_dr_usb(blob, bd); + fsl_fdt_fixup_dr_usb(blob, bd); #ifdef CONFIG_SYS_DPAA_FMAN fdt_fixup_fman_ethernet(blob); diff --git a/board/gdsys/mpc8308/hrcon.c b/board/gdsys/mpc8308/hrcon.c index f55893f79c..c6566e9196 100644 --- a/board/gdsys/mpc8308/hrcon.c +++ b/board/gdsys/mpc8308/hrcon.c @@ -358,7 +358,7 @@ ulong board_flash_get_legacy(ulong base, int banknum, flash_info_t *info) int ft_board_setup(void *blob, bd_t *bd) { ft_cpu_setup(blob, bd); - fdt_fixup_dr_usb(blob, bd); + fsl_fdt_fixup_dr_usb(blob, bd); fdt_fixup_esdhc(blob, bd); return 0; diff --git a/board/gdsys/mpc8308/strider.c b/board/gdsys/mpc8308/strider.c index b8dde5f1ba..34e9d1956e 100644 --- a/board/gdsys/mpc8308/strider.c +++ b/board/gdsys/mpc8308/strider.c @@ -413,7 +413,7 @@ ulong board_flash_get_legacy(ulong base, int banknum, flash_info_t *info) int ft_board_setup(void *blob, bd_t *bd) { ft_cpu_setup(blob, bd); - fdt_fixup_dr_usb(blob, bd); + fsl_fdt_fixup_dr_usb(blob, bd); fdt_fixup_esdhc(blob, bd); return 0; diff --git a/board/gdsys/p1022/controlcenterd.c b/board/gdsys/p1022/controlcenterd.c index 2f98e4757f..01064dcfde 100644 --- a/board/gdsys/p1022/controlcenterd.c +++ b/board/gdsys/p1022/controlcenterd.c @@ -341,7 +341,7 @@ int ft_board_setup(void *blob, bd_t *bd) fdt_fixup_memory(blob, (u64)base, (u64)size); #ifdef CONFIG_HAS_FSL_DR_USB - fdt_fixup_dr_usb(blob, bd); + fsl_fdt_fixup_dr_usb(blob, bd); #endif FT_FSL_PCI_SETUP; diff --git a/board/keymile/kmp204x/kmp204x.c b/board/keymile/kmp204x/kmp204x.c index eebb47fc21..abb20196c5 100644 --- a/board/keymile/kmp204x/kmp204x.c +++ b/board/keymile/kmp204x/kmp204x.c @@ -277,7 +277,7 @@ int ft_board_setup(void *blob, bd_t *bd) fdt_fixup_memory(blob, (u64)base, (u64)size); #if defined(CONFIG_HAS_FSL_DR_USB) || defined(CONFIG_HAS_FSL_MPH_USB) - fdt_fixup_dr_usb(blob, bd); + fsl_fdt_fixup_dr_usb(blob, bd); #endif #ifdef CONFIG_PCI diff --git a/board/mpc8308_p1m/mpc8308_p1m.c b/board/mpc8308_p1m/mpc8308_p1m.c index 688cc12a6c..234a387801 100644 --- a/board/mpc8308_p1m/mpc8308_p1m.c +++ b/board/mpc8308_p1m/mpc8308_p1m.c @@ -65,7 +65,7 @@ void pci_init_board(void) int ft_board_setup(void *blob, bd_t *bd) { ft_cpu_setup(blob, bd); - fdt_fixup_dr_usb(blob, bd); + fsl_fdt_fixup_dr_usb(blob, bd); return 0; } diff --git a/board/varisys/cyrus/cyrus.c b/board/varisys/cyrus/cyrus.c index 79c363cf84..74f4473877 100644 --- a/board/varisys/cyrus/cyrus.c +++ b/board/varisys/cyrus/cyrus.c @@ -97,7 +97,7 @@ int ft_board_setup(void *blob, bd_t *bd) #endif fdt_fixup_liodn(blob); - fdt_fixup_dr_usb(blob, bd); + fsl_fdt_fixup_dr_usb(blob, bd); #ifdef CONFIG_SYS_DPAA_FMAN fdt_fixup_fman_ethernet(blob); diff --git a/drivers/usb/common/fsl-dt-fixup.c b/drivers/usb/common/fsl-dt-fixup.c index 9c48852ea0..906f9df5d8 100644 --- a/drivers/usb/common/fsl-dt-fixup.c +++ b/drivers/usb/common/fsl-dt-fixup.c @@ -131,7 +131,7 @@ static int fdt_fixup_erratum(int *usb_erratum_off, void *blob, return 0; } -void fdt_fixup_dr_usb(void *blob, bd_t *bd) +void fsl_fdt_fixup_dr_usb(void *blob, bd_t *bd) { static const char * const modes[] = { "host", "peripheral", "otg" }; static const char * const phys[] = { "ulpi", "utmi", "utmi_dual" }; diff --git a/include/fdt_support.h b/include/fdt_support.h index e9f3497ab6..8f402310f6 100644 --- a/include/fdt_support.h +++ b/include/fdt_support.h @@ -114,9 +114,9 @@ void fdt_fixup_qe_firmware(void *fdt); int fdt_fixup_display(void *blob, const char *path, const char *display); #if defined(CONFIG_USB_EHCI_FSL) || defined(CONFIG_USB_XHCI_FSL) -void fdt_fixup_dr_usb(void *blob, bd_t *bd); +void fsl_fdt_fixup_dr_usb(void *blob, bd_t *bd); #else -static inline void fdt_fixup_dr_usb(void *blob, bd_t *bd) {} +static inline void fsl_fdt_fixup_dr_usb(void *blob, bd_t *bd) {} #endif /* defined(CONFIG_USB_EHCI_FSL) || defined(CONFIG_USB_XHCI_FSL) */ #if defined(CONFIG_SYS_FSL_SEC_COMPAT) From c609775e6fe6ce70d8ad3e244440b42fbf66bc13 Mon Sep 17 00:00:00 2001 From: Sriram Dash Date: Fri, 16 Sep 2016 17:12:16 +0530 Subject: [PATCH 16/17] usb: fsl: Renaming fdt_fixup_erratum and fdt_fixup_usb_erratum The functions fdt_fixup_erratum and fdt_fixup_usb_erratum are fsl/nxp specific. So, make them explicit by renaming them fsl_fdt_fixup_erratum and fsl_fdt_fixup_usb_erratum Signed-off-by: Sriram Dash --- drivers/usb/common/fsl-dt-fixup.c | 45 ++++++++++++++++--------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/drivers/usb/common/fsl-dt-fixup.c b/drivers/usb/common/fsl-dt-fixup.c index 906f9df5d8..63a24f74ad 100644 --- a/drivers/usb/common/fsl-dt-fixup.c +++ b/drivers/usb/common/fsl-dt-fixup.c @@ -86,8 +86,9 @@ static int fdt_fixup_usb_mode_phy_type(void *blob, const char *mode, return node_offset; } -static int fdt_fixup_usb_erratum(void *blob, const char *prop_erratum, - const char *controller_type, int start_offset) +static int fsl_fdt_fixup_usb_erratum(void *blob, const char *prop_erratum, + const char *controller_type, + int start_offset) { int node_offset, err; const char *node_type = NULL; @@ -114,17 +115,17 @@ static int fdt_fixup_usb_erratum(void *blob, const char *prop_erratum, return node_offset; } -static int fdt_fixup_erratum(int *usb_erratum_off, void *blob, - const char *controller_type, char *str, - bool (*has_erratum)(void)) +static int fsl_fdt_fixup_erratum(int *usb_erratum_off, void *blob, + const char *controller_type, char *str, + bool (*has_erratum)(void)) { char buf[32] = {0}; snprintf(buf, sizeof(buf), "fsl,usb-erratum-%s", str); if (!has_erratum()) return -EINVAL; - *usb_erratum_off = fdt_fixup_usb_erratum(blob, buf, controller_type, - *usb_erratum_off); + *usb_erratum_off = fsl_fdt_fixup_usb_erratum(blob, buf, controller_type, + *usb_erratum_off); if (*usb_erratum_off < 0) return -ENOSPC; debug("Adding USB erratum %s\n", str); @@ -198,29 +199,29 @@ void fsl_fdt_fixup_dr_usb(void *blob, bd_t *bd) if (usb_phy_off < 0) return; - ret = fdt_fixup_erratum(&usb_erratum_a006261_off, blob, - CHIPIDEA_USB2, "a006261", - has_erratum_a006261); + ret = fsl_fdt_fixup_erratum(&usb_erratum_a006261_off, blob, + CHIPIDEA_USB2, "a006261", + has_erratum_a006261); if (ret == -ENOSPC) return; - ret = fdt_fixup_erratum(&usb_erratum_a007075_off, blob, - CHIPIDEA_USB2, "a007075", - has_erratum_a007075); + ret = fsl_fdt_fixup_erratum(&usb_erratum_a007075_off, blob, + CHIPIDEA_USB2, "a007075", + has_erratum_a007075); if (ret == -ENOSPC) return; - ret = fdt_fixup_erratum(&usb_erratum_a007792_off, blob, - CHIPIDEA_USB2, "a007792", - has_erratum_a007792); + ret = fsl_fdt_fixup_erratum(&usb_erratum_a007792_off, blob, + CHIPIDEA_USB2, "a007792", + has_erratum_a007792); if (ret == -ENOSPC) return; - ret = fdt_fixup_erratum(&usb_erratum_a005697_off, blob, - CHIPIDEA_USB2, "a005697", - has_erratum_a005697); + ret = fsl_fdt_fixup_erratum(&usb_erratum_a005697_off, blob, + CHIPIDEA_USB2, "a005697", + has_erratum_a005697); if (ret == -ENOSPC) return; - ret = fdt_fixup_erratum(&usb_erratum_a008751_off, blob, - SNPS_DWC3, "a008751", - has_erratum_a008751); + ret = fsl_fdt_fixup_erratum(&usb_erratum_a008751_off, blob, + SNPS_DWC3, "a008751", + has_erratum_a008751); if (ret == -ENOSPC) return; From 4c043712e9910ef1d612aedbd8304a1f7348ef5f Mon Sep 17 00:00:00 2001 From: Sriram Dash Date: Fri, 23 Sep 2016 12:57:52 +0530 Subject: [PATCH 17/17] drivers: usb: xhci-fsl: Implement Erratum A-010151 for FSL USB3 controller Currently the controller by default enables the Receive Detect feature in P3 mode in USB 3.0 PHY. However, USB 3.0 PHY does not reliably support receive detection in P3 mode. Enabling the USB3 controller to configure USB in P2 mode whenever the Receive Detect feature is required. Signed-off-by: Sriram Dash Signed-off-by: Rajesh Bhagat --- drivers/usb/common/fsl-errata.c | 26 ++++++++++++++++++++++++++ drivers/usb/host/xhci-fsl.c | 13 +++++++++++++ include/fsl_usb.h | 1 + include/linux/usb/dwc3.h | 1 + 4 files changed, 41 insertions(+) diff --git a/drivers/usb/common/fsl-errata.c b/drivers/usb/common/fsl-errata.c index 183bf2ba42..f2bffba35e 100644 --- a/drivers/usb/common/fsl-errata.c +++ b/drivers/usb/common/fsl-errata.c @@ -190,4 +190,30 @@ bool has_erratum_a008751(void) return false; } +bool has_erratum_a010151(void) +{ + u32 svr = get_svr(); + u32 soc = SVR_SOC_VER(svr); + + switch (soc) { +#ifdef CONFIG_ARM64 + case SVR_LS2080A: + case SVR_LS2085A: + case SVR_LS1046A: + case SVR_LS1012A: + return IS_SVR_REV(svr, 1, 0); + case SVR_LS1043A: + return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1); +#endif +#ifdef CONFIG_LS102XA + case SOC_VER_LS1020: + case SOC_VER_LS1021: + case SOC_VER_LS1022: + case SOC_VER_SLS1020: + return IS_SVR_REV(svr, 2, 0); +#endif + } + return false; +} + #endif diff --git a/drivers/usb/host/xhci-fsl.c b/drivers/usb/host/xhci-fsl.c index 2529d0eb13..798c358fd9 100644 --- a/drivers/usb/host/xhci-fsl.c +++ b/drivers/usb/host/xhci-fsl.c @@ -84,6 +84,19 @@ static int fsl_xhci_core_init(struct fsl_xhci *fsl_xhci) /* Change beat burst and outstanding pipelined transfers requests */ fsl_xhci_set_beat_burst_length(fsl_xhci->dwc3_reg); + /* + * A-010151: The dwc3 phy TSMC 28-nm HPM 0.9/1.8 V does not + * reliably support Rx Detect in P3 mode(P3 is the default + * setting). Therefore, some USB3.0 devices may not be detected + * reliably in Super Speed mode. So, USB controller to configure + * USB in P2 mode whenever the Receive Detect feature is required. + * whenever the Receive Detect feature is required. + */ + if (has_erratum_a010151()) + clrsetbits_le32(&fsl_xhci->dwc3_reg->g_usb3pipectl[0], + DWC3_GUSB3PIPECTL_DISRXDETP3, + DWC3_GUSB3PIPECTL_DISRXDETP3); + return ret; } diff --git a/include/fsl_usb.h b/include/fsl_usb.h index fc72fb9384..73235b8c73 100644 --- a/include/fsl_usb.h +++ b/include/fsl_usb.h @@ -95,5 +95,6 @@ bool has_erratum_a007792(void); bool has_erratum_a005697(void); bool has_erratum_a004477(void); bool has_erratum_a008751(void); +bool has_erratum_a010151(void); #endif #endif /*_ASM_FSL_USB_H_ */ diff --git a/include/linux/usb/dwc3.h b/include/linux/usb/dwc3.h index a0274461cc..c1b23b2f1b 100644 --- a/include/linux/usb/dwc3.h +++ b/include/linux/usb/dwc3.h @@ -198,6 +198,7 @@ struct dwc3 { /* offset: 0xC100 */ /* Global USB3 PIPE Control Register */ #define DWC3_GUSB3PIPECTL_PHYSOFTRST (1 << 31) +#define DWC3_GUSB3PIPECTL_DISRXDETP3 (1 << 28) #define DWC3_GUSB3PIPECTL_SUSPHY (1 << 17) /* Global TX Fifo Size Register */