Skip to contentSkip to conversation

OMAP4/5: Add USB EHCI support

PATCH New Lubomir Popov 1 participant 1 message Apr 1, 2013

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

PATCH 1/1 OMAP4/5: Add USB EHCI support

Prerequisites (apart from proper config):

1. The HSUSBTLL clock has to be enabled along with the other HW_AUTO essentials, that is, cm_l3init_hsusbtll_clkctrl has to reside in the clk_modules_hw_auto_essential[] array and not in clk_modules_explicit_en_essential[]. Please see related patch to hw_data.c.

2. Other functional clocks have to be enabled prior to starting USB (and, possibly, disabled upon stopping). The proper place for this would be the board file, in the ehci_hcd_init() and ehci_hcd_stop() functions. Please see som5_evb.c as example.

3. If we have HSIC devices on some OMAP5 ports, they shall work only if the design employs reset capability via GPIO. This is performed by the ehci-hcd driver upon applying port power, and requires that we have defined CONFIG_OMAP_HSIC_PORTx_RESET_GPIO in the board config header as appropriate. Please see omap5_som5_evb.h as an example.
Note that this additional reset is not needed for OMAP4 HSIC (tested on OMAP4460 and 4470).

4. Can somebody explain why arch/arm/include/asm/arch-omap5/ehci.h has disappeared? It is in fact needed for EHCI USB. Adding it.

---
 arch/arm/include/asm/arch-omap5/ehci.h |   44 +++++++++++++++++
 drivers/usb/host/ehci-hcd.c            |    6 +++
 drivers/usb/host/ehci-omap.c           |   83 +++++++++++++++++++++++++++++---
 drivers/usb/host/ehci.h                |    9 ++++
 4 files changed, 135 insertions(+), 7 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-omap5/ehci.h
arch/arm/include/asm/arch-omap5/ehci.h new file +44 -0
new file mode 100644
index 0000000..49197f2
@@ -0,0 +1,44 @@
+/*
+ * OMAP EHCI port support
+ * Based on LINUX KERNEL
+ * drivers/usb/host/ehci-omap.c and drivers/mfd/omap-usb-host.c
+ *
+ * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com*
+ * Author: Govindraj R <[email protected]>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2  of
+ * the License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _EHCI_H
+#define _EHCI_H
+
+#define OMAP_EHCI_BASE				(OMAP54XX_L4_CORE_BASE + 0x64C00)
+#define OMAP_UHH_BASE				(OMAP54XX_L4_CORE_BASE + 0x64000)
+#define OMAP_USBTLL_BASE			(OMAP54XX_L4_CORE_BASE + 0x62000)
+
+/* TLL Register Set */
+#define OMAP_USBTLL_SYSCONFIG_SIDLEMODE		(1 << 3)
+#define OMAP_USBTLL_SYSCONFIG_ENAWAKEUP		(1 << 2)
+#define OMAP_USBTLL_SYSCONFIG_SOFTRESET		(1 << 1)
+#define OMAP_USBTLL_SYSCONFIG_CACTIVITY		(1 << 8)
+#define OMAP_USBTLL_SYSSTATUS_RESETDONE		1
+
+#define OMAP_UHH_SYSCONFIG_SOFTRESET		1
+#define OMAP_UHH_SYSSTATUS_EHCI_RESETDONE	(1 << 2)
+#define OMAP_UHH_SYSCONFIG_NOIDLE		(1 << 2)
+#define OMAP_UHH_SYSCONFIG_NOSTDBY		(1 << 4)
+
+#define OMAP_UHH_SYSCONFIG_VAL	(OMAP_UHH_SYSCONFIG_NOIDLE | \
+					OMAP_UHH_SYSCONFIG_NOSTDBY)
+
+#endif /* _EHCI_H */
drivers/usb/host/ehci-hcd.c +6 -0
index c816878..33d954d 100644
@@ -750,6 +750,12 @@ ehci_submit_root(struct usb_device *dev, unsigned long pipe, void *buffer,
 			if (HCS_PPC(ehci_readl(&ctrl->hccr->cr_hcsparams))) {
 				reg |= EHCI_PS_PP;
 				ehci_writel(status_reg, reg);
+    				/*
+				 * OMAP5: Reset device for 'fail to connect'
+				 * workaround. Compiled only for OMAP5, and
+				 * only if we have ports in HSIC mode.
+				 */
+				omap5_ehci_hsic_reset_device(le16_to_cpu(req->index));
 			}
 			break;
 		case USB_PORT_FEAT_RESET:
drivers/usb/host/ehci-omap.c +76 -7

133 lines not on this page · raw message

drivers/usb/host/ehci.h +9 -0
index d090f0a..9e0230b 100644
@@ -256,4 +256,13 @@ struct QH {
 int ehci_hcd_init(int index, struct ehci_hccr **hccr, struct ehci_hcor **hcor);
 int ehci_hcd_stop(int index);
 
+/* OMAP5: Reset HSIC devices upon applying port power for
+ *        'fail to connect' workaround (ehci-omap.c)
+ */
+#ifndef CONFIG_USB_EHCI_OMAP
+static inline void omap5_ehci_hsic_reset_device(int port_index) {}
+#else
+inline void omap5_ehci_hsic_reset_device(int port_index);
+#endif
+
 #endif /* USB_EHCI_H */
Signature · 1 line
1.7.9.5