]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
zynqmp: usb: Add usb dwc3 driver support for zynqmp
authorSiva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Wed, 5 Aug 2015 09:24:34 +0000 (14:54 +0530)
committerMichal Simek <michal.simek@xilinx.com>
Mon, 10 Aug 2015 05:31:57 +0000 (07:31 +0200)
Added usb dwc3 driver support for zynqmp
this also supports the DFU and LTHOR to download
the linux images on to RAM and cen be booted from
those linux images.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
arch/arm/cpu/armv8/zynqmp/Kconfig
arch/arm/include/asm/arch-zynqmp/hardware.h
board/xilinx/zynqmp/zynqmp.c
configs/xilinx_zynqmp_ep_defconfig
include/configs/xilinx_zynqmp.h

index 1ec5ebc50939f309ce89933c7dad88dbc0eeabbf..ff3b5b0e7947870e6faa533c9fdc5521b8b0386f 100644 (file)
@@ -34,4 +34,7 @@ config ZYNQMP_QSPI
 config NAND_ARASAN
        bool "Configure Arasan Nand"
 
+config ZYNQMP_USB
+       bool "Configure ZynqMP USB"
+
 endif
index 5df45875a3c5b178a07d43745e95b8eb3fe6ae43..3220a786ec45d48a2d42330117b7b1aaa3656c48 100644 (file)
@@ -31,6 +31,9 @@
 
 #define ZYNQMP_SATA_BASEADDR   0xFD0C0000
 
+#define ZYNQMP_USB0_XHCI_BASEADDR      0xFE200000
+#define ZYNQMP_USB1_XHCI_BASEADDR      0xFE300000
+
 #define ZYNQMP_CRL_APB_BASEADDR        0xFF5E0000
 #define ZYNQMP_CRL_APB_TIMESTAMP_REF_CTRL_CLKACT       0x1000000
 
index 8042fd64f9dfcaca3e8517107098bb138f392ab1..989612c5a9f5c36b8f5446802c992ad9d25c08a0 100644 (file)
@@ -6,9 +6,11 @@
  */
 
 #include <common.h>
+#include <dwc3-uboot.h>
 #include <netdev.h>
 #include <ahci.h>
 #include <scsi.h>
+#include <usb.h>
 #include <asm/arch/hardware.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/io.h>
@@ -157,3 +159,29 @@ int checkboard(void)
        puts("Board:\tXilinx ZynqMP\n");
        return 0;
 }
+
+#ifdef CONFIG_USB_DWC3
+static struct dwc3_device dwc3_device_data = {
+       .maximum_speed = USB_SPEED_HIGH,
+       .base = ZYNQMP_USB0_XHCI_BASEADDR,
+       .dr_mode = USB_DR_MODE_PERIPHERAL,
+       .index = 0,
+};
+
+int usb_gadget_handle_interrupts(void)
+{
+       dwc3_uboot_handle_interrupt(0);
+       return 0;
+}
+
+int board_usb_init(int index, enum usb_init_type init)
+{
+       return dwc3_uboot_init(&dwc3_device_data);
+}
+
+int board_usb_cleanup(int index, enum usb_init_type init)
+{
+       dwc3_uboot_exit(index);
+       return 0;
+}
+#endif
index 8fab64f9b281a625b5ec2868e84cdae3e90a36d5..dbfdf34be6a38375405435eac5afa9bae8040a78 100644 (file)
@@ -2,6 +2,7 @@ CONFIG_ARM=y
 CONFIG_ARCH_ZYNQMP=y
 CONFIG_ZYNQMP_QSPI=y
 CONFIG_NAND_ARASAN=y
+CONFIG_ZYNQMP_USB=y
 CONFIG_SYS_TEXT_BASE=0x8000000
 CONFIG_DEFAULT_DEVICE_TREE="zynqmp-ep"
 CONFIG_FIT=y
index 53c5d1d5217dcb98958a1a55a3a74a03ed50d98c..d2ed23e1902b620b7addcf6f177d344f197a00b3 100644 (file)
@@ -51,7 +51,7 @@
 #define COUNTER_FREQUENCY              4000000
 
 /* Size of malloc() pool */
-#define CONFIG_SYS_MALLOC_LEN          (CONFIG_ENV_SIZE + 0x800000)
+#define CONFIG_SYS_MALLOC_LEN          (CONFIG_ENV_SIZE + 0x2000000)
 
 /* Serial setup */
 #if defined(CONFIG_ZYNQ_DCC)
 /* Miscellaneous configurable options */
 #define CONFIG_SYS_LOAD_ADDR           0x8000000
 
+#if defined(CONFIG_ZYNQMP_USB)
+# define CONFIG_USB_DWC3
+# define CONFIG_USB_DWC3_GADGET
+
+# define CONFIG_USB_GADGET
+# define CONFIG_USB_GADGET_DUALSPEED
+# define CONFIG_USB_GADGET_VBUS_DRAW   2
+# define CONFIG_USBDOWNLOAD_GADGET
+# define CONFIG_SYS_DFU_DATA_BUF_SIZE  0x1800000
+# define DFU_DEFAULT_POLL_TIMEOUT      300
+# define CONFIG_DFU_FUNCTION
+# define CONFIG_DFU_RAM
+# define CONFIG_G_DNL_VENDOR_NUM       0x03FD
+# define CONFIG_G_DNL_PRODUCT_NUM      0x0300
+# define CONFIG_G_DNL_MANUFACTURER     "Xilinx"
+# define CONFIG_USB_CABLE_CHECK
+# define CONFIG_CMD_DFU
+# define CONFIG_CMD_THOR_DOWNLOAD
+# define CONFIG_THOR_FUNCTION
+# define CONFIG_THOR_RESET_OFF
+# define DFU_ALT_INFO_RAM \
+       "dfu_ram_info=" \
+       "set dfu_alt_info " \
+       "Image ram 0x200000 0x1800000\\\\;" \
+       "system.dtb ram 0x7000000 0x40000\0" \
+       "dfu_ram=run dfu_ram_info && dfu 0 ram 0\0" \
+       "thor_ram=run dfu_ram_info && thordown 0 ram 0\0"
+
+# define DFU_ALT_INFO  \
+               DFU_ALT_INFO_RAM
+#endif
+
+#if !defined(DFU_ALT_INFO)
+# define DFU_ALT_INFO
+#endif
+
 /* Initial environment variables */
 #define CONFIG_EXTRA_ENV_SETTINGS \
        "ethaddr=00:0a:35:00:01:22\0" \
                "tftpb 0x80000 Image && " \
                "fdt set /chosen/dom0 reg <0x80000 0x$filesize> && "\
                "tftpb 6000000 xen.ub && bootm 6000000 - $fdt_addr\0" \
-       "jtagboot=tftpboot 10000000 image.ub && bootm\0"
+       "jtagboot=tftpboot 10000000 image.ub && bootm\0" \
+               "load mmc 0:0 $kernel_addr Image && booti $kernel_addr - $fdt_addr\0" \
+       DFU_ALT_INFO
+
 
 #define CONFIG_BOOTARGS                "setenv bootargs console=ttyPS0,${baudrate} " \
                                "earlycon=cdns,mmio,0xff000000,${baudrate}n8"