public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Dan Murphy <dmurphy@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 5/6] usb: am437x: Add support for am437x xhci USB host
Date: Fri, 11 Oct 2013 12:28:18 -0500	[thread overview]
Message-ID: <1381512499-11504-6-git-send-email-dmurphy@ti.com> (raw)
In-Reply-To: <1381512499-11504-1-git-send-email-dmurphy@ti.com>

Add the support for the am437x xhci usb host.

The xHCI host on AM437 is connected to a usb2 phy so need to
add support to enable those clocks.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
---

v2 - Changed int->const u32 for usb_otg_ss_clk_val - http://patchwork.ozlabs.org/patch/281932/

 arch/arm/include/asm/arch-am33xx/hardware_am43xx.h |   10 +++++++++
 drivers/usb/phy/omap_usb_phy.c                     |   23 ++++++++++++++++++++
 include/configs/am43xx_evm.h                       |   11 ++++++++++
 include/linux/usb/xhci-omap.h                      |    4 ++++
 4 files changed, 48 insertions(+)

diff --git a/arch/arm/include/asm/arch-am33xx/hardware_am43xx.h b/arch/arm/include/asm/arch-am33xx/hardware_am43xx.h
index 303c594..3b665e6 100644
--- a/arch/arm/include/asm/arch-am33xx/hardware_am43xx.h
+++ b/arch/arm/include/asm/arch-am33xx/hardware_am43xx.h
@@ -51,4 +51,14 @@
 /* RTC base address */
 #define RTC_BASE			0x44E3E000
 
+/* USB Clock Control */
+#define PRM_PER_USB_OTG_SS0_CLKCTRL (CM_PER + 0x260)
+#define PRM_PER_USB_OTG_SS1_CLKCTRL (CM_PER + 0x268)
+#define USBOTGSSX_CLKCTRL_MODULE_EN	(1 << 2)
+#define USBOTGSSX_CLKCTRL_OPTFCLKEN_REFCLK960 (1 << 8)
+
+#define PRM_PER_USBPHYOCP2SCP0_CLKCTRL (CM_PER + 0x5b8)
+#define PRM_PER_USBPHYOCP2SCP1_CLKCTRL (CM_PER + 0x5c0)
+#define USBPHYOCPSCP_MODULE_EN	(1 << 2)
+
 #endif /* __AM43XX_HARDWARE_AM43XX_H */
diff --git a/drivers/usb/phy/omap_usb_phy.c b/drivers/usb/phy/omap_usb_phy.c
index f074a88..af46db2 100644
--- a/drivers/usb/phy/omap_usb_phy.c
+++ b/drivers/usb/phy/omap_usb_phy.c
@@ -207,6 +207,25 @@ void usb_phy_power(int on)
 }
 #endif /* CONFIG_OMAP_USB2PHY2_HOST */
 
+#ifdef CONFIG_AM437X_USB2PHY2_HOST
+static void am437x_enable_usb2_phy2(struct omap_xhci *omap)
+{
+	const u32 usb_otg_ss_clk_val = (USBOTGSSX_CLKCTRL_MODULE_EN |
+				USBOTGSSX_CLKCTRL_OPTFCLKEN_REFCLK960);
+
+	writel(usb_otg_ss_clk_val, PRM_PER_USB_OTG_SS0_CLKCTRL);
+	writel(usb_otg_ss_clk_val, PRM_PER_USB_OTG_SS1_CLKCTRL);
+
+	writel(USBPHYOCPSCP_MODULE_EN, PRM_PER_USBPHYOCP2SCP0_CLKCTRL);
+	writel(USBPHYOCPSCP_MODULE_EN, PRM_PER_USBPHYOCP2SCP1_CLKCTRL);
+}
+
+void usb_phy_power(int on)
+{
+	return;
+}
+#endif /* CONFIG_AM437X_USB2PHY2_HOST */
+
 void omap_reset_usb_phy(struct dwc3 *dwc3_reg)
 {
 	/* Assert USB3 PHY reset */
@@ -231,6 +250,10 @@ void omap_enable_phy(struct omap_xhci *omap)
 	omap_enable_usb2_phy2(omap);
 #endif
 
+#ifdef CONFIG_AM437X_USB2PHY2_HOST
+	am437x_enable_usb2_phy2(omap);
+#endif
+
 #ifdef CONFIG_OMAP_USB3PHY1_HOST
 	omap_enable_usb3_phy(omap);
 	omap_usb3_phy_init(omap->usb3_phy);
diff --git a/include/configs/am43xx_evm.h b/include/configs/am43xx_evm.h
index 5c802a1..64c4811 100644
--- a/include/configs/am43xx_evm.h
+++ b/include/configs/am43xx_evm.h
@@ -24,6 +24,7 @@
 #define CONFIG_SYS_HUSH_PARSER		/* use "hush" command parser */
 #define CONFIG_SYS_PROMPT		"U-Boot# "
 #define CONFIG_SYS_NO_FLASH
+#define CONFIG_SYS_CACHELINE_SIZE 32
 
 #define CONFIG_OF_LIBFDT
 #define CONFIG_CMD_BOOTZ
@@ -132,4 +133,14 @@
 /* Unsupported features */
 #undef CONFIG_USE_IRQ
 
+#define CONFIG_CMD_USB
+#define CONFIG_USB_HOST
+#define CONFIG_USB_XHCI
+#define CONFIG_USB_XHCI_OMAP
+#define CONFIG_USB_STORAGE
+#define CONFIG_SYS_USB_XHCI_MAX_ROOT_PORTS 2
+
+#define CONFIG_OMAP_USB_PHY
+#define CONFIG_AM437X_USB2PHY2_HOST
+
 #endif	/* __CONFIG_AM43XX_EVM_H */
diff --git a/include/linux/usb/xhci-omap.h b/include/linux/usb/xhci-omap.h
index c3fcc03..82630ad 100644
--- a/include/linux/usb/xhci-omap.h
+++ b/include/linux/usb/xhci-omap.h
@@ -14,6 +14,10 @@
 #define OMAP_XHCI_BASE 0x488d0000
 #define OMAP_OCP1_SCP_BASE 0x4A081000
 #define OMAP_OTG_WRAPPER_BASE 0x488c0000
+#elif defined CONFIG_AM43XX
+#define OMAP_XHCI_BASE 0x483d0000
+#define OMAP_OCP1_SCP_BASE 0x483E8000
+#define OMAP_OTG_WRAPPER_BASE 0x483dc100
 #else
 /* Default to the OMAP5 XHCI defines */
 #define OMAP_XHCI_BASE 0x4a030000
-- 
1.7.9.5

  parent reply	other threads:[~2013-10-11 17:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-11 17:28 [U-Boot] [PATCH v2 0/6] TI xHCI Updated patchset Dan Murphy
2013-10-11 17:28 ` [U-Boot] [PATCH v2 1/6] usb: omap: Move the xhci-omap header file to common location Dan Murphy
2013-10-11 17:28 ` [U-Boot] [PATCH v2 2/6] usb: omap5: Update the board_usb_init api Dan Murphy
2013-10-11 17:28 ` [U-Boot] [PATCH v2 3/6] usb: omap: Move the usb phy code to the usb/phy directory Dan Murphy
2013-10-11 17:28 ` [U-Boot] [PATCH v2 4/6] usb: dra7xx: Add support for dra7xx xhci USB host Dan Murphy
2013-10-12  1:13   ` Marek Vasut
2013-10-11 17:28 ` Dan Murphy [this message]
2013-10-11 17:28 ` [U-Boot] [PATCH v2 6/6] ARM: omap5-evm: Move MAC creation to misc_init Dan Murphy
2013-10-12  1:15 ` [U-Boot] [PATCH v2 0/6] TI xHCI Updated patchset Marek Vasut

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1381512499-11504-6-git-send-email-dmurphy@ti.com \
    --to=dmurphy@ti.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox