Skip to contentSkip to conversation

keystone: usb: add support of usb xhci

PATCH New Ivan Khoronzhuk 2 participants 2 messages Sep 5, 2014 – Oct 23, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 keystone: usb: add support of usb xhci

From: WingMan Kwok <[email protected]>

Add support of usb xhci. xHCI controls all USB speeds of the Host mode, that is, the SS through the SS PHY, as well as the HS, FS, and LS through the USB2 PHY. xHCI replaces and supersedes all previous host HCIs (HS-only EHCI, FS/LS OHCI and UHCI), and is therefore not backwards compatible with any of them. The USB3SS?s USB Controller is fully compliant with xHC.

---

Based on
"[U-boot] [Patch v2 0/4] keystone2: generalize navigator driver usage"
https://www.mail-archive.com/u-boot at lists.denx.de/msg146701.html

v1..v2:
Just rebase. No functional changes.

 arch/arm/include/asm/arch-keystone/hardware.h      |   6 +
 arch/arm/include/asm/arch-keystone/xhci-keystone.h |  21 ++
 drivers/usb/host/Makefile                          |   1 +
 drivers/usb/host/xhci-keystone.c                   | 329 +++++++++++++++++++++
 include/configs/ks2_evm.h                          |  15 +
 include/linux/usb/dwc3.h                           |   8 +-
 6 files changed, 379 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/include/asm/arch-keystone/xhci-keystone.h
 create mode 100644 drivers/usb/host/xhci-keystone.c
arch/arm/include/asm/arch-keystone/hardware.h +6 -0
index c3f0f46..fdffb87 100644
@@ -161,6 +161,12 @@ typedef volatile unsigned int   *dv_reg_p;
 /* MSMC control */
 #define KS2_MSMC_CTRL_BASE		0x0bc00000
 
+/* USB */
+#define KS2_USB_SS_BASE			0x02680000
+#define KS2_USB_HOST_XHCI_BASE		(KS2_USB_SS_BASE + 0x10000)
+#define KS2_DEV_USB_PHY_BASE		0x02620738
+#define KS2_USB_PHY_CFG_BASE		0x02630000
+
 #ifdef CONFIG_SOC_K2HK
 #include <asm/arch/hardware-k2hk.h>
 #endif
arch/arm/include/asm/arch-keystone/xhci-keystone.h new file +21 -0
new file mode 100644
index 0000000..3aab4e0
@@ -0,0 +1,21 @@
+/*
+ * USB 3.0 DRD Controller
+ *
+ * (C) Copyright 2012-2014
+ *     Texas Instruments Incorporated, <www.ti.com>
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#define USB3_PHY_REF_SSP_EN		BIT(29)
+#define USB3_PHY_OTG_VBUSVLDECTSEL	BIT(16)
+
+/* KEYSTONE2 XHCI PHY register structure */
+struct keystone_xhci_phy {
+	unsigned int phy_utmi;		/* ctl0 */
+	unsigned int phy_pipe;		/* ctl1 */
+	unsigned int phy_param_ctrl_1;	/* ctl2 */
+	unsigned int phy_param_ctrl_2;	/* ctl3 */
+	unsigned int phy_clock;		/* ctl4 */
+	unsigned int phy_pll;		/* ctl5 */
+};
drivers/usb/host/Makefile +1 -0
index c4f5157..3d3a0c4 100644
@@ -43,5 +43,6 @@ 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_KEYSTONE) += xhci-keystone.o
 obj-$(CONFIG_USB_XHCI_EXYNOS) += xhci-exynos5.o
 obj-$(CONFIG_USB_XHCI_OMAP) += xhci-omap.o
drivers/usb/host/xhci-keystone.c new file +329 -0

329 lines not on this page · raw message

include/configs/ks2_evm.h +15 -0
index ef513d4..639f119 100644
@@ -185,6 +185,20 @@
 					"1024k(bootloader)ro,512k(params)ro," \
 					"-(ubifs)"
 
+/* USB Configuration */
+#define CONFIG_USB_XHCI
+#define CONFIG_USB_XHCI_KEYSTONE
+#define CONFIG_SYS_USB_XHCI_MAX_ROOT_PORTS	2
+#define CONFIG_USB_STORAGE
+#define CONFIG_DOS_PARTITION
+#define CONFIG_EFI_PARTITION
+#define CONFIG_FS_FAT
+#define CONFIG_SYS_CACHELINE_SIZE		64
+#define CONFIG_USB_SS_BASE			KS2_USB_SS_BASE
+#define CONFIG_USB_HOST_XHCI_BASE		KS2_USB_HOST_XHCI_BASE
+#define CONFIG_DEV_USB_PHY_BASE			KS2_DEV_USB_PHY_BASE
+#define CONFIG_USB_PHY_CFG_BASE			KS2_USB_PHY_CFG_BASE
+
 /* U-Boot command configuration */
 #include <config_cmd_default.h>
 #define CONFIG_CMD_ASKENV
@@ -198,6 +212,7 @@
 #define CONFIG_CMD_UBIFS
 #define CONFIG_CMD_SF
 #define CONFIG_CMD_EEPROM
+#define CONFIG_CMD_USB
 
 /* U-Boot general configuration */
 #define CONFIG_SYS_GENERIC_BOARD
include/linux/usb/dwc3.h +7 -1
index 97d179a..7edc760 100644
@@ -41,7 +41,8 @@
 #define DWC3_REG_OFFSET				0xC100
 
 struct g_event_buffer {
-	u64 g_evntadr;
+	u32 g_evntadrlo;
+	u32 g_evntadrhi;
 	u32 g_evntsiz;
 	u32 g_evntcount;
 };
@@ -185,4 +186,9 @@ struct dwc3 {					/* offset: 0xC100 */
 #define DWC3_GTXFIFOSIZ_TXFDEF(n)		((n) & 0xffff)
 #define DWC3_GTXFIFOSIZ_TXFSTADDR(n)		((n) & 0xffff0000)
 
+/* Device Control Register */
+#define DWC3_DCTL_RUN_STOP			(1 << 31)
+#define DWC3_DCTL_CSFTRST			(1 << 30)
+#define DWC3_DCTL_LSFTRST			(1 << 29)
+
 #endif /* __DWC3_H_ */
Signature · 1 line
1.8.3.2
#1 lore raw

PATCH v2 1/1 keystone: usb: add support of usb xhci

Quoted 9 lines · Ivan

From: WingMan Kwok <[email protected]>

Add support of usb xhci. xHCI controls all USB speeds of the Host mode, that is, the SS through the SS PHY, as well as the HS, FS, and LS through the USB2 PHY. xHCI replaces and supersedes all previous host HCIs (HS-only EHCI, FS/LS OHCI and UHCI), and is therefore not backwards compatible with any of them. The USB3SS?s USB Controller is fully compliant with xHC.

Quoted 3 lines

Applied to u-boot-ti/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141023/7e96a627/attachment.pgp>