Skip to content

Commit

Permalink
zynqmp: usb: Add usb dwc3 driver support for zynqmp
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Michal Simek <[email protected]>
  • Loading branch information
Siva Durga Prasad Paladugu authored and Michal Simek committed Aug 10, 2015
1 parent 39fc03c commit 2d5bc21
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 2 deletions.
3 changes: 3 additions & 0 deletions arch/arm/cpu/armv8/zynqmp/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,7 @@ config ZYNQMP_QSPI
config NAND_ARASAN
bool "Configure Arasan Nand"

config ZYNQMP_USB
bool "Configure ZynqMP USB"

endif
3 changes: 3 additions & 0 deletions arch/arm/include/asm/arch-zynqmp/hardware.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
28 changes: 28 additions & 0 deletions board/xilinx/zynqmp/zynqmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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
1 change: 1 addition & 0 deletions configs/xilinx_zynqmp_ep_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
43 changes: 41 additions & 2 deletions include/configs/xilinx_zynqmp.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -137,6 +137,42 @@
/* 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" \
Expand Down Expand Up @@ -166,7 +202,10 @@
"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"
Expand Down

0 comments on commit 2d5bc21

Please sign in to comment.