]> git.sur5r.net Git - u-boot/commitdiff
Merge branch 'master' of git://git.denx.de/u-boot-usb
authorTom Rini <trini@konsulko.com>
Sat, 1 Oct 2016 01:58:44 +0000 (21:58 -0400)
committerTom Rini <trini@konsulko.com>
Sat, 1 Oct 2016 01:58:44 +0000 (21:58 -0400)
Signed-off-by: Tom Rini <trini@konsulko.com>
Conflicts:
include/configs/dra7xx_evm.h

62 files changed:
Kconfig
arch/arm/cpu/armv7/omap-common/boot-common.c
arch/arm/dts/vf-colibri.dtsi
arch/arm/dts/vf.dtsi
arch/arm/include/asm/arch-omap5/spl.h
board/Arcturus/ucp1020/ucp1020.c
board/freescale/b4860qds/b4860qds.c
board/freescale/bsc9131rdb/bsc9131rdb.c
board/freescale/bsc9132qds/bsc9132qds.c
board/freescale/corenet_ds/corenet_ds.c
board/freescale/ls2080aqds/ls2080aqds.c
board/freescale/ls2080ardb/ls2080ardb.c
board/freescale/mpc8308rdb/mpc8308rdb.c
board/freescale/mpc8315erdb/mpc8315erdb.c
board/freescale/mpc837xemds/mpc837xemds.c
board/freescale/mpc837xerdb/mpc837xerdb.c
board/freescale/mpc8536ds/mpc8536ds.c
board/freescale/p1010rdb/p1010rdb.c
board/freescale/p1022ds/p1022ds.c
board/freescale/p1023rdb/p1023rdb.c
board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
board/freescale/p1_twr/p1_twr.c
board/freescale/p2041rdb/p2041rdb.c
board/freescale/t102xqds/t102xqds.c
board/freescale/t102xrdb/t102xrdb.c
board/freescale/t1040qds/t1040qds.c
board/freescale/t104xrdb/t104xrdb.c
board/freescale/t208xqds/t208xqds.c
board/freescale/t208xrdb/t208xrdb.c
board/freescale/t4qds/t4240emu.c
board/freescale/t4qds/t4240qds.c
board/freescale/t4rdb/t4240rdb.c
board/gdsys/mpc8308/hrcon.c
board/gdsys/mpc8308/strider.c
board/gdsys/p1022/controlcenterd.c
board/keymile/kmp204x/kmp204x.c
board/mpc8308_p1m/mpc8308_p1m.c
board/varisys/cyrus/cyrus.c
cmd/dfu.c
common/Makefile
common/dfu.c [new file with mode: 0644]
common/spl/Makefile
common/spl/spl.c
common/spl/spl_dfu.c [new file with mode: 0644]
configs/colibri_vf_defconfig
drivers/usb/common/fsl-dt-fixup.c
drivers/usb/common/fsl-errata.c
drivers/usb/eth/asix.c
drivers/usb/host/ehci-vf.c
drivers/usb/host/xhci-fsl.c
include/configs/apalis_t30.h
include/configs/colibri_imx7.h
include/configs/colibri_t30.h
include/configs/dra7xx_evm.h
include/configs/ti_omap5_common.h
include/fdt_support.h
include/fsl_usb.h
include/g_dnl.h
include/linux/usb/dwc3.h
include/linux/usb/xhci-fsl.h
include/spl.h
scripts/Makefile.spl

diff --git a/Kconfig b/Kconfig
index a759e4da2729e689cc7a0185cb22b257cb9c34fa..1263d0b612dd0668e0264d08b6cdef70bcb97853 100644 (file)
--- 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"
index 60c367a2020110b0a44d584f5482887d3a9bd307..385310ba1ec95825292f55824710a8e18c087275 100644 (file)
@@ -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
        }
 
index dc52748c096b9d35f37f5677f76371895f16e7f7..c2f104a89b4e52de7f4c2f0fd9846f0395977f71 100644 (file)
        };
 };
 
+&ehci0 {
+       dr_mode = "otg";
+       fsl,cdet-gpio = <&gpio3 6 GPIO_ACTIVE_HIGH>;
+       status = "okay";
+};
+
+&ehci1 {
+       dr_mode = "host";
+       status = "okay";
+};
+
 &uart0 {
        status = "okay";
 };
index 1530d2fc87e7fc5ee37a5dabfb832b0b5f4782f4..d7d21a37adeb077ee4c4f9776d475d75589602f6 100644 (file)
@@ -4,6 +4,7 @@
  * SPDX-License-Identifier:     GPL-2.0+ or X11
  */
 /include/ "skeleton.dtsi"
+#include <dt-bindings/gpio/gpio.h>
 
 / {
        aliases {
@@ -20,6 +21,8 @@
                serial5 = &uart5;
                spi0 = &dspi0;
                spi1 = &dspi1;
+               ehci0 = &ehci0;
+               ehci1 = &ehci1;
        };
 
        soc {
                                reg = <0x400ff100 0x40>;
                                #gpio-cells = <2>;
                        };
+
+                       ehci0: ehci@40034000 {
+                               compatible = "fsl,vf610-usb";
+                               reg = <0x40034000 0x800>;
+                               status = "disabled";
+                       };
                };
 
                aips1: aips-bus@40080000 {
                                status = "disabled";
                        };
 
+                       ehci1: ehci@400b4000 {
+                               compatible = "fsl,vf610-usb";
+                               reg = <0x400b4000 0x800>;
+                               status = "disabled";
+                       };
                };
        };
 };
index 468ff5afd54738f7cd89466bfe0e8e916d598e15..35828804242a844758e5684050d5808741e293d4 100644 (file)
@@ -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
index 0fc2bac55d6a340fd472d225e18d80d1140027b2..0d086e87fa30db1f8864efdcaa4c1b0b8ffb01c7 100644 (file)
@@ -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)
index 1642a7d1ae01c5e70afc7c8676099fd86b56b3d6..c2ceb8014eff18addaa60a67e86199e6c1b44528 100644 (file)
@@ -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
index 75e114217b6a6d94ccd0a7ed7dc4483bb0e8aeca..fb8bb39d87e303ceb041046db54002c3ed35fe09 100644 (file)
@@ -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;
 }
index 71a7bb55c48a6e0d8e0c368810de65b9dceb15d6..2c836da63b2db5b883305cc1d941d08d2dda0e0f 100644 (file)
@@ -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");
                }
        }
index f41985d2f66de5b887c3f0a561ca11695e99d7c2..8a44a9a972d4f05582217c52933e1924124bd1cf 100644 (file)
@@ -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);
index ca4a2e5cb7e3cc46727eee32af4bea666b56409c..d07ca18af9a6ae029a7b90b5a351aaff8a76fb1c 100644 (file)
@@ -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);
index 7d8a7115dce29f85e455f5606d85b8cd451a3e21..83d9e7ec12c0330c785e53f3acb86d659ceff063 100644 (file)
@@ -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);
index 93e1c50f393a0cccbd5a429607eb3b8859382ee5..b4a0dd5d1a8f935a4c31e87a4f67127ccef5a39b 100644 (file)
@@ -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;
index ed611c56c3f11dc700351c14b38c52746ece3b19..3cec09b586861bda87babde3a2905a348232129f 100644 (file)
@@ -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;
index 572913c7ac521ce1f55758079bf49ea6a2ec031f..045841d57ba1c6206658aa1d045d79b27d884227 100644 (file)
@@ -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);
index 565f8157812bd814b51da1048946d28c73000740..07c0599858444fcc68e53a942c5e874eb311f17a 100644 (file)
@@ -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;
index 7b0f46197147b36db16cd790aad7a253663da687..cede1da634e720996cecf1123bfda62aa87ab1b3 100644 (file)
@@ -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;
index 1ae15407db4e9d4529a77c6fcbf7dc1af9204b8d..8eecb0647b9f4d123d1a583f31531a8d7d4ad050 100644 (file)
@@ -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 */
index d7dd478dff903f6d0495ae1939b2f1a6aed78b84..345feac0b2941ece20fe5f491cff95b2034a8d85 100644 (file)
@@ -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;
index 074b71326f00e59cee4a24d345565f4a1c47a79d..04517226033d4d254583ee6a90e01620dfc8b457 100644 (file)
@@ -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);
index 61b7a91333faf1beb07f981822c8fd76325bf6a2..d61c3a5413ffea7ddf4a5988b0519a3a507f2e33 100644 (file)
@@ -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)
index a40bea328b02154a0ffa925c32c86f72cc538d80..f54a6ff8dc7260a9b7847c715d81155aa1db1a80 100644 (file)
@@ -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;
 }
index c6a724217fdb8195e71190bf6ad1153f0bb78b25..21fb66f184a4c0e65eac2c577fbd9d1211dc9f8d 100644 (file)
@@ -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
index 76793a1186ec3aba7db3d9a3d83e491fb90e67fc..1affa0b3a82896c88fcaa98929d333c928b67649 100644 (file)
@@ -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
index 01dbf381bdc96441e4e801a0809fce88e77e3032..24df4b440f02ec7e58505ed93cc4091124f4c6c8 100644 (file)
@@ -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);
index d7d56b47c816115b2a21c9ac859dc2ed2776816c..5466fbf5f661bd136bf7b1a925fd9cf3a17493ab 100644 (file)
@@ -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
index ec97677df84a541de575aeb4c621156bdd0a5be4..6bad6a45401a7e17a3069bf4369712ac913b7ac9 100644 (file)
@@ -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
index bfea3a15562b47a8140f3d874f2f45cae3eb00ae..d016329cd13166066801d22df117bceb14d23ef2 100644 (file)
@@ -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);
index 0cb05aa03f0788cac40011c16ed761bac18fd8da..1ab05ec9fd4300c2dabf87ad8b1452fa26d59fe9 100644 (file)
@@ -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);
index f1393f25f92506b16d853f79b99dfa9657db19b9..35ad19e045b163130ed37363d97dc9a7d78fb76e 100644 (file)
@@ -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;
 }
index d6df144730ba27120cb2b693b7f0910d0ba9823d..8f9e7e82550dfd340803a8fe9faa8f41e37751d1 100644 (file)
@@ -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);
index 406fb132aea131188b6ed919340e35ad14b9271a..bdd6f4ef49a74dd6d47d0ef26c11a84809377a37 100644 (file)
@@ -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);
index f55893f79c9ae3bb175b7d5c5fc86c91941b7109..c6566e9196ca17d3d6700161ca8ece90c1f2ac08 100644 (file)
@@ -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;
index b8dde5f1bad6f6e74a6cb1cdea0bf1cd11795317..34e9d1956e2e5462c3f563f015631cc2c0a0cabf 100644 (file)
@@ -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;
index 2f98e4757f9af73a737a9f73988ee61bbc2f98f3..01064dcfde10a8e131726ebb145155e2c8c1e2fc 100644 (file)
@@ -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;
index eebb47fc21f1cfbcf6aff58e72154c9cc9f5388c..abb20196c55c1bef68088ba70fe7a9cf7ef1a933 100644 (file)
@@ -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
index 688cc12a6c9a7f816f0f75a863d7835b64f775ea..234a38780184e904f313218fff8a0e463185f4f1 100644 (file)
@@ -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;
 }
index 79c363cf841abe8a91767f76fbd0a21c7c52e4c4..74f4473877e27855974c8f77449ce5b36917d59c 100644 (file)
@@ -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);
index d8aae262232e82a066ae83ea0e82057e41f26c26..04291f6c0805fc5de2dea644bbceb19ba39b84a5 100644 (file)
--- 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;
 }
 
index 9a9a065ad21d34224674ce7d30094433c619dd0c..ecc23e6fd322b9fb03e2ab481ec776f1afe1a22c 100644 (file)
@@ -89,6 +89,8 @@ 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
 obj-$(CONFIG_SPL_YMODEM_SUPPORT) += xyzModem.o
@@ -171,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 (file)
index 0000000..4c529f7
--- /dev/null
@@ -0,0 +1,92 @@
+/*
+ * dfu.c -- dfu command
+ *
+ * Copyright (C) 2015
+ * Lukasz Majewski <l.majewski@majess.pl>
+ *
+ * Copyright (C) 2012 Samsung Electronics
+ * authors: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
+ *         Lukasz Majewski <l.majewski@samsung.com>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include <common.h>
+#include <watchdog.h>
+#include <dfu.h>
+#include <console.h>
+#include <g_dnl.h>
+#include <usb.h>
+#include <net.h>
+
+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();
+       ret = g_dnl_register(usb_dnl_gadget);
+       if (ret) {
+               error("g_dnl_register failed");
+               return CMD_RET_FAILURE;
+       }
+
+       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;
+}
index b15f0f6dcdea51cc4ea456ec3a3fa983a9e6fd6d..5bd0b1841ee447cc78d2ca12f24e97a85dbb6c16 100644 (file)
@@ -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
index e14ec8052e9a075b9dfde8642f9c5c04c53e03d4..57b73af4a740b5011264a5b928a53fd58122994a 100644 (file)
@@ -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();
diff --git a/common/spl/spl_dfu.c b/common/spl/spl_dfu.c
new file mode 100644 (file)
index 0000000..e8d0ba1
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * (C) Copyright 2016
+ * Texas Instruments, <www.ti.com>
+ *
+ * Ravi B <ravibabu@ti.com>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+#include <common.h>
+#include <spl.h>
+#include <linux/compiler.h>
+#include <errno.h>
+#include <watchdog.h>
+#include <console.h>
+#include <g_dnl.h>
+#include <usb.h>
+#include <dfu.h>
+#include <environment.h>
+
+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);
+}
index 235f0042b486f50e5ac52b064620068a3f40b29c..fce6bac5c9b20b6d742e4e9cfabeb4242e23a0a1 100644 (file)
@@ -39,6 +39,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
index 9c48852ea08bf8a5d51e0c2aac740ff42dadb802..63a24f74ad04522feea995733ce6f85f02fbfdad 100644 (file)
@@ -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,24 +115,24 @@ 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);
        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" };
@@ -198,29 +199,29 @@ void 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;
 
index 972016ceb33916be5e6a8038a7efdd082bf8beba..0dc3dd8117058b8c0c016ca0ad23d55c98d141b7 100644 (file)
@@ -185,4 +185,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
index a610ae447bf7a576f09fa1c0657b8651761b81ac..1c6e967db1a0a0c1569b229df3a10eb2b6346069 100644 (file)
         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:
index 61789dddc36635f59469ece6fbc34b1518cfe294..f6f9efb6cdaf890a00a8a04574547f4a7223bb66 100644 (file)
@@ -8,16 +8,20 @@
  */
 
 #include <common.h>
+#include <dm.h>
 #include <usb.h>
 #include <errno.h>
 #include <linux/compiler.h>
 #include <asm/io.h>
+#include <asm-generic/gpio.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/crm_regs.h>
 #include <asm/imx-common/iomux-v3.h>
 #include <asm/imx-common/regs-usbphy.h>
 #include <usb/ehci-ci.h>
+#include <libfdt.h>
+#include <fdtdec.h>
 
 #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
index bda5b5f9134ac3421126519c1257bc5c7ff179b6..798c358fd91aba38c617930bf6b4bccc4275b2ee 100644 (file)
@@ -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,22 @@ 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);
+
+       /*
+        * 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;
 }
 
index 8c76605f8bc0deb863456fd6a0a4a014be8614d6..3fc177906bcfacb6b9d733dcd37e02312e7dc48f 100644 (file)
@@ -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 */
index e91130378824859532c555244fac062113bf8413..16ae952f37ccc711b80072c25f1ad68c2a31d79a 100644 (file)
@@ -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
index fbb235d82ce6cbb8e09dbf2fde3a34a2d9cdd827..e2a2549fb65cad8cda812805a8b4c585123d25b9 100644 (file)
@@ -48,7 +48,7 @@
 
 /* General networking support */
 #define CONFIG_IP_DEFRAG
-#define CONFIG_TFTP_BLOCKSIZE          16384
+#define CONFIG_TFTP_BLOCKSIZE          16352
 #define CONFIG_TFTP_TSIZE
 
 /* Miscellaneous commands */
index cecb00f252ec57f42d9bca9059ad97c860353898..66ce82cabbbbbb4b0c90aab9e04c012111deac8a 100644 (file)
 #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 <configs/ti_omap5_common.h>
 
 /* Enhance our eMMC support / experience. */
index cbdf0bc0dbbe94ac56c9f754237c0c7e9dbf4367..ea11226620d482cc903b8e7e17d4bf541266e921 100644 (file)
@@ -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 \
        "setenv mmcroot /dev/mmcblk0p2 rw; " \
        "run mmcboot;" \
        ""
-#endif
 
 /*
  * SPL related defines.  The Public RAM memory map the ROM defines the
index e9f3497ab64216a0aaf396e7e64e42535de2ccc9..8f402310f6ba8321de518607eb737bc9d950f8fd 100644 (file)
@@ -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)
index fc72fb9384579fc19b6001320c735c6f4f002087..73235b8c7374154069d05d3ea6f19b75c871eb06 100644 (file)
@@ -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_ */
index ba49f1f5cb6c3c6e381652a1d1d2daf4964e34ed..bd29a9f83a0db08b621158802beb9232f7d06119 100644 (file)
@@ -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_ */
index a0274461cc1e236183b4642681ea20b702f872f4..c1b23b2f1bd8f59a16fd5b1320a05b8a8fea1c8c 100644 (file)
@@ -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 */
index d04e3cc95a57b00d5d4efd3d29afad63310e695f..15cac40e9d14e585381329943059623264f828be 100644 (file)
@@ -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)
index 8afa0856c5889ec9dab554a89f75f47e2b34032e..30eda36feffd6c5d57315b8497106960c5b1bd7d 100644 (file)
@@ -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
index 5a7f79c25a76cbd12b1b193276b282c242f88d85..4febc6b401aaa657df730a8e6627c6eb733697da 100644 (file)
@@ -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/