Skip to contentSkip to conversation

usb: zynqmp: Add XHCI driver support

PATCH Superseded Siva Durga Prasad Paladugu 2 participants 5 messages Sep 3, 2015

Subsystems (3)

v3 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/2 usb: zynqmp: Add XHCI driver support

Added USB XHCI driver support for zynqmp.

---
Changes for v3:
- Decreased the phy reset delay to 10 micro secs
- Defined base addresses in board config file as
per review comment.
Changes for v2:
- Moved all from xhci-zynqmp.h to .c file as
per review comment
- Removed ad-hoc function zynqmp_xhci_core_exit()
as per review comment

---
 drivers/usb/host/Makefile          |    1 +
 drivers/usb/host/xhci-zynqmp.c     |  145 ++++++++++++++++++++++++++++++++++++
 include/configs/xilinx_zynqmp_ep.h |    2 +
 3 files changed, 148 insertions(+), 0 deletions(-)
 create mode 100644 drivers/usb/host/xhci-zynqmp.c
drivers/usb/host/Makefile +1 -0
index f70f38c..645b990 100644
@@ -54,6 +54,7 @@ obj-$(CONFIG_USB_EHCI_ZYNQ) += ehci-zynq.o
 # xhci
 obj-$(CONFIG_USB_XHCI) += xhci.o xhci-mem.o xhci-ring.o
 obj-$(CONFIG_USB_XHCI_DWC3) += xhci-dwc3.o
+obj-$(CONFIG_USB_XHCI_ZYNQMP) += xhci-zynqmp.o
 obj-$(CONFIG_USB_XHCI_KEYSTONE) += xhci-keystone.o
 obj-$(CONFIG_USB_XHCI_EXYNOS) += xhci-exynos5.o
 obj-$(CONFIG_USB_XHCI_FSL) += xhci-fsl.o
drivers/usb/host/xhci-zynqmp.c new file +145 -0

145 lines not on this page · raw message

include/configs/xilinx_zynqmp_ep.h +2 -0
index e476eb1..abb3c40 100644
@@ -24,6 +24,8 @@
 #define CONFIG_SYS_I2C_ZYNQ
 #define CONFIG_ZYNQ_EEPROM
 #define CONFIG_AHCI
+#define CONFIG_ZYNQMP_XHCI_LIST {ZYNQMP_USB0_XHCI_BASEADDR, \
+				 ZYNQMP_USB1_XHCI_BASEADDR}
 
 #include <configs/xilinx_zynqmp.h>
 
Signature · 1 line
1.7.1
#1 lore raw

PATCH v3 2/2 usb: zynqmp: Enable USB XHCI support

Enable USB XHCI support for ZynqMP

---
Changes for v3:
- Removed extra space between # and define
as per review comment
Changes for v2:
- None

---
 include/configs/xilinx_zynqmp.h |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
include/configs/xilinx_zynqmp.h +8 -0
index da87188..46b951a 100644
@@ -109,6 +109,14 @@
 #define CONFIG_SYS_LOAD_ADDR		0x8000000
 
 #if defined(CONFIG_ZYNQMP_USB)
+#define CONFIG_USB_XHCI_DWC3
+#define CONFIG_USB_XHCI
+#define CONFIG_USB_MAX_CONTROLLER_COUNT         1
+#define CONFIG_SYS_USB_XHCI_MAX_ROOT_PORTS      2
+#define CONFIG_CMD_USB
+#define CONFIG_USB_STORAGE
+#define CONFIG_USB_XHCI_ZYNQMP
+
 #define CONFIG_USB_DWC3
 #define CONFIG_USB_DWC3_GADGET
 
Signature · 1 line
1.7.1
#2 lore raw

PATCH v3 1/2 usb: zynqmp: Add XHCI driver support

In reply to Siva Durga Prasad Paladugu
Quoted 3 lines · Siva Durga Prasad Paladugu

Added USB XHCI driver support for zynqmp.

Hi,

is this V3 in any way different from the previous V3 ?

[...]

drivers/usb/host/xhci-zynqmp.c line 109

Quoted 4 lines

+int xhci_hcd_init(int index, struct xhci_hccr **hccr, struct xhci_hcor **hcor) +{

drivers/usb/host/xhci-zynqmp.c new file +2 -0
+	struct zynqmp_xhci *ctx = &zynqmp_xhci;
+	int ret = 0;

You should sanitize the index here:

if (index < 0 || index > ARRAY_SIZE(ctr_addr))

	return -EINVAL;
Quoted 15 lines
drivers/usb/host/xhci-zynqmp.c new file +15 -0
+	ctx->hcd = (struct xhci_hccr *)ctr_addr[index];
+	ctx->dwc3_reg = (struct dwc3 *)((char *)(ctx->hcd) + DWC3_REG_OFFSET);
+
+	ret = board_usb_init(index, USB_INIT_HOST);
+	if (ret != 0) {
+		puts("Failed to initialize board for USB\n");
+		return ret;
+	}
+
+	ret = zynqmp_xhci_core_init(ctx);
+	if (ret < 0) {
+		puts("Failed to initialize xhci\n");
+		return ret;
+	}
+

drivers/usb/host/xhci-zynqmp.c line 135

Quoted 10 lines
drivers/usb/host/xhci-zynqmp.c new file +10 -0
+	*hccr = (struct xhci_hccr *)ctx->hcd;
+	*hcor = (struct xhci_hcor *)((uint32_t) *hccr
+				+ HC_LENGTH(xhci_readl(&(*hccr)->cr_capbase)));
+
+	debug("zynqmp-xhci: init hccr %x and hcor %x hc_length %d\n",
+	      (uint32_t)*hccr, (uint32_t)*hcor,
+	      (uint32_t)HC_LENGTH(xhci_readl(&(*hccr)->cr_capbase)));
+
+	return ret;
+}

Otherwise,

Best regards,
Marek Vasut

#3 lore raw

PATCH v3 1/2 usb: zynqmp: Add XHCI driver support

Hi Marek,

Quoted 10 lines

-----Original Message-----
From: Marek Vasut [mailto:marex at denx.de]
Sent: Thursday, September 03, 2015 3:04 PM
To: Siva Durga Prasad Paladugu
Cc: u-boot at lists.denx.de; Siva Durga Prasad Paladugu
Subject: Re: [PATCH v3 1/2] usb: zynqmp: Add XHCI driver support

On Thursday, September 03, 2015 at 11:19:01 AM, Siva Durga Prasad Paladugu
wrote:

Quoted 7 lines
Quoted 3 lines

Added USB XHCI driver support for zynqmp.

Hi,

is this V3 in any way different from the previous V3 ?

Its just same. I didn't get it in u-boot mailing list and hence sent it again.

Regards,
Siva

Quoted 42 lines

[...]

drivers/usb/host/xhci-zynqmp.c line 109

Quoted 4 lines

+int xhci_hcd_init(int index, struct xhci_hccr **hccr, struct xhci_hcor **hcor) +{

drivers/usb/host/xhci-zynqmp.c new file +2 -0
+   struct zynqmp_xhci *ctx = &zynqmp_xhci;
+   int ret = 0;

You should sanitize the index here:

if (index < 0 || index > ARRAY_SIZE(ctr_addr))

      return -EINVAL;

Review

Quoted 2 lines
(quoted diff) +2 -0
+   ctx->hcd = (struct xhci_hccr *)ctr_addr[index];
+   ctx->dwc3_reg = (struct dwc3 *)((char *)(ctx->hcd) +

DWC3_REG_OFFSET);

Quoted 17 lines
drivers/usb/host/xhci-zynqmp.c new file +16 -0
+
+   ret = board_usb_init(index, USB_INIT_HOST);
+   if (ret != 0) {
+           puts("Failed to initialize board for USB\n");
+           return ret;
+   }
+
+   ret = zynqmp_xhci_core_init(ctx);
+   if (ret < 0) {
+           puts("Failed to initialize xhci\n");
+           return ret;
+   }
+
+   *hccr = (struct xhci_hccr *)ctx->hcd;
+   *hcor = (struct xhci_hcor *)((uint32_t) *hccr
+                           + HC_LENGTH(xhci_readl(&(*hccr)-

cr_capbase)));

drivers/usb/host/xhci-zynqmp.c line 135

Quoted 7 lines
drivers/usb/host/xhci-zynqmp.c new file +7 -0
+
+   debug("zynqmp-xhci: init hccr %x and hcor %x hc_length %d\n",
+         (uint32_t)*hccr, (uint32_t)*hcor,
+         (uint32_t)HC_LENGTH(xhci_readl(&(*hccr)->cr_capbase)));
+
+   return ret;
+}

Otherwise,

Quoted 4 lines

Best regards,
Marek Vasut

This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

#4 lore raw

PATCH v3 1/2 usb: zynqmp: Add XHCI driver support

Quoted 1 line · Siva Durga Prasad Paladugu

Hi Marek,

Hi,

Quoted 13 lines
Quoted 13 lines

-----Original Message-----
From: Marek Vasut [mailto:marex at denx.de]
Sent: Thursday, September 03, 2015 3:04 PM
To: Siva Durga Prasad Paladugu
Cc: u-boot at lists.denx.de; Siva Durga Prasad Paladugu
Subject: Re: [PATCH v3 1/2] usb: zynqmp: Add XHCI driver support

On Thursday, September 03, 2015 at 11:19:01 AM, Siva Durga Prasad Paladugu

Quoted 2 lines · wrote:

Added USB XHCI driver support for zynqmp.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Hi,

is this V3 in any way different from the previous V3 ?

Its just same. I didn't get it in u-boot mailing list and hence sent it again.

Please add RESEND tag into the subject next time then.

Best regards,
Marek Vasut