public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: "Benoît Thébaudeau" <benoit.thebaudeau@advansee.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 09/13] ehci-mxc: Make i.MX25 EHCI configurable
Date: Mon, 5 Nov 2012 21:12:39 +0100 (CET)	[thread overview]
Message-ID: <2082152522.587372.1352146359242.JavaMail.root@advansee.com> (raw)
In-Reply-To: <412111025.587245.1352146184216.JavaMail.root@advansee.com>

Use EHCI MXC configuration options for i.MX25.

Signed-off-by: Beno?t Th?baudeau <benoit.thebaudeau@advansee.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Matthias Weisser <weisserm@arcor.de>
---
 .../drivers/usb/host/ehci-mxc.c                    |   71 +++++++++++++++++---
 .../include/configs/zmx25.h                        |    6 +-
 2 files changed, 66 insertions(+), 11 deletions(-)

diff --git u-boot-usb-76454b2.orig/drivers/usb/host/ehci-mxc.c u-boot-usb-76454b2/drivers/usb/host/ehci-mxc.c
index e21f2c5..711c4a7 100644
--- u-boot-usb-76454b2.orig/drivers/usb/host/ehci-mxc.c
+++ u-boot-usb-76454b2/drivers/usb/host/ehci-mxc.c
@@ -28,10 +28,21 @@
 
 #define USBCTRL_OTGBASE_OFFSET	0x600
 
-#define MX25_USB_CTRL_IP_PUE_DOWN_BIT	(1<<6)
-#define MX25_USB_CTRL_HSTD_BIT		(1<<5)
-#define MX25_USB_CTRL_USBTE_BIT		(1<<4)
-#define MX25_USB_CTRL_OCPOL_OTG_BIT	(1<<3)
+#define MX25_OTG_SIC_SHIFT	29
+#define MX25_OTG_SIC_MASK	(0x3 << MX25_OTG_SIC_SHIFT)
+#define MX25_OTG_PM_BIT		(1 << 24)
+#define MX25_OTG_PP_BIT		(1 << 11)
+#define MX25_OTG_OCPOL_BIT	(1 << 3)
+
+#define MX25_H1_SIC_SHIFT	21
+#define MX25_H1_SIC_MASK	(0x3 << MX25_H1_SIC_SHIFT)
+#define MX25_H1_PP_BIT		(1 << 18)
+#define MX25_H1_PM_BIT		(1 << 8)
+#define MX25_H1_IPPUE_UP_BIT	(1 << 7)
+#define MX25_H1_IPPUE_DOWN_BIT	(1 << 6)
+#define MX25_H1_TLL_BIT		(1 << 5)
+#define MX25_H1_USBTE_BIT	(1 << 4)
+#define MX25_H1_OCPOL_BIT	(1 << 2)
 
 #define MX31_OTG_SIC_SHIFT	29
 #define MX31_OTG_SIC_MASK	(0x3 << MX31_OTG_SIC_SHIFT)
@@ -51,12 +62,56 @@ static int mxc_set_usbcontrol(int port, unsigned int flags)
 {
 	unsigned int v;
 
-#if defined(CONFIG_MX25)
-	v = MX25_USB_CTRL_IP_PUE_DOWN_BIT | MX25_USB_CTRL_HSTD_BIT |
-		MX25_USB_CTRL_USBTE_BIT | MX25_USB_CTRL_OCPOL_OTG_BIT;
-#elif defined(CONFIG_MX31)
 	v = readl(IMX_USB_BASE + USBCTRL_OTGBASE_OFFSET);
+#if defined(CONFIG_MX25)
+	switch (port) {
+	case 0:	/* OTG port */
+		v &= ~(MX25_OTG_SIC_MASK | MX25_OTG_PM_BIT | MX25_OTG_PP_BIT |
+			MX25_OTG_OCPOL_BIT);
+		v |= (flags & MXC_EHCI_INTERFACE_MASK) << MX25_OTG_SIC_SHIFT;
+
+		if (!(flags & MXC_EHCI_POWER_PINS_ENABLED))
+			v |= MX25_OTG_PM_BIT;
+
+		if (flags & MXC_EHCI_PWR_PIN_ACTIVE_HIGH)
+			v |= MX25_OTG_PP_BIT;
+
+		if (!(flags & MXC_EHCI_OC_PIN_ACTIVE_LOW))
+			v |= MX25_OTG_OCPOL_BIT;
+
+		break;
+	case 1: /* H1 port */
+		v &= ~(MX25_H1_SIC_MASK | MX25_H1_PM_BIT | MX25_H1_PP_BIT |
+			MX25_H1_OCPOL_BIT | MX25_H1_TLL_BIT | MX25_H1_USBTE_BIT |
+			MX25_H1_IPPUE_DOWN_BIT | MX25_H1_IPPUE_UP_BIT);
+		v |= (flags & MXC_EHCI_INTERFACE_MASK) << MX25_H1_SIC_SHIFT;
+
+		if (!(flags & MXC_EHCI_POWER_PINS_ENABLED))
+			v |= MX25_H1_PM_BIT;
+
+		if (flags & MXC_EHCI_PWR_PIN_ACTIVE_HIGH)
+			v |= MX25_H1_PP_BIT;
+
+		if (!(flags & MXC_EHCI_OC_PIN_ACTIVE_LOW))
+			v |= MX25_H1_OCPOL_BIT;
+
+		if (!(flags & MXC_EHCI_TTL_ENABLED))
+			v |= MX25_H1_TLL_BIT;
+
+		if (flags & MXC_EHCI_INTERNAL_PHY)
+			v |= MX25_H1_USBTE_BIT;
+
+		if (flags & MXC_EHCI_IPPUE_DOWN)
+			v |= MX25_H1_IPPUE_DOWN_BIT;
 
+		if (flags & MXC_EHCI_IPPUE_UP)
+			v |= MX25_H1_IPPUE_UP_BIT;
+
+		break;
+	default:
+		return -EINVAL;
+	}
+#elif defined(CONFIG_MX31)
 	switch (port) {
 	case 0:	/* OTG port */
 		v &= ~(MX31_OTG_SIC_MASK | MX31_OTG_PM_BIT);
diff --git u-boot-usb-76454b2.orig/include/configs/zmx25.h u-boot-usb-76454b2/include/configs/zmx25.h
index 447683a..e9216d9 100644
--- u-boot-usb-76454b2.orig/include/configs/zmx25.h
+++ u-boot-usb-76454b2/include/configs/zmx25.h
@@ -109,9 +109,9 @@
 #define CONFIG_USB_EHCI			/* Enable EHCI USB support */
 #define CONFIG_USB_EHCI_MXC
 #define CONFIG_EHCI_HCD_INIT_AFTER_RESET
-#define CONFIG_MXC_USB_PORT	2
-#define CONFIG_MXC_USB_PORTSC	0xC0000000
-#define CONFIG_MXC_USB_FLAGS	0
+#define CONFIG_MXC_USB_PORT	1
+#define CONFIG_MXC_USB_PORTSC	MXC_EHCI_MODE_SERIAL
+#define CONFIG_MXC_USB_FLAGS	(MXC_EHCI_INTERNAL_PHY | MXC_EHCI_IPPUE_DOWN)
 #define CONFIG_EHCI_IS_TDI
 #define CONFIG_USB_STORAGE
 #define CONFIG_DOS_PARTITION

  parent reply	other threads:[~2012-11-05 20:12 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-05 20:09 [U-Boot] [PATCH 01/13] mx31: Move EHCI definitions to ehci-fsl.h Benoît Thébaudeau
2012-11-05 20:10 ` [U-Boot] [PATCH 02/13] ehci-mxc: Clean up Benoît Thébaudeau
2012-11-05 20:10 ` [U-Boot] [PATCH 03/13] ehci-mx5: " Benoît Thébaudeau
2012-11-05 20:10 ` [U-Boot] [PATCH 04/13] ehci-mx5: Fix OC_DIS usage Benoît Thébaudeau
2012-11-05 20:11 ` [U-Boot] [PATCH 05/13] ehci-mx5: Fix OPM usage Benoît Thébaudeau
2012-11-05 20:11 ` [U-Boot] [PATCH 06/13] ehci-mx5: Fix *PM usage for i.MX53 Benoît Thébaudeau
2012-11-05 20:11 ` [U-Boot] [PATCH 07/13] ehci-mx5: Add missing OC_DIS " Benoît Thébaudeau
2012-11-05 20:12 ` [U-Boot] [PATCH 08/13] ehci-mxc: Make EHCI power/oc polarities configurable Benoît Thébaudeau
2012-11-05 20:12 ` Benoît Thébaudeau [this message]
2012-11-05 20:12 ` [U-Boot] [PATCH 10/13] ehci-mxc: Define host offsets Benoît Thébaudeau
2012-11-05 20:13 ` [U-Boot] [PATCH 11/13] ehci-mxc: Add support for i.MX35 Benoît Thébaudeau
2012-11-05 20:13 ` [U-Boot] [PATCH 12/13] mx35pdk: Add support for OTG Benoît Thébaudeau
2012-11-07 14:30   ` Stefano Babic
2012-11-07 16:16   ` Stefano Babic
2012-11-07 16:27     ` Benoît Thébaudeau
2012-11-07 16:33       ` Stefano Babic
2012-11-05 20:13 ` [U-Boot] [PATCH 13/13] ehci-mx5: Make board_ehci_hcd_init() optional Benoît Thébaudeau
2012-11-05 22:57   ` Marek Vasut
2012-11-05 23:34     ` Benoît Thébaudeau
2012-11-05 22:55 ` [U-Boot] [PATCH 01/13] mx31: Move EHCI definitions to ehci-fsl.h Marek Vasut
2012-11-07 16:31   ` Stefano Babic
2012-11-08 20:27 ` [U-Boot] [PATCH v2 " Benoît Thébaudeau
2012-11-08 20:28   ` [U-Boot] [PATCH v2 02/13] ehci-mxc: Clean up Benoît Thébaudeau
2012-11-08 20:28   ` [U-Boot] [PATCH v2 03/13] ehci-mx5: " Benoît Thébaudeau
2012-11-08 20:28   ` [U-Boot] [PATCH v2 04/13] ehci-mx5: Fix OC_DIS usage Benoît Thébaudeau
2012-11-08 20:29   ` [U-Boot] [PATCH v2 05/13] ehci-mx5: Fix OPM usage Benoît Thébaudeau
2012-11-08 20:29   ` [U-Boot] [PATCH v2 06/13] ehci-mx5: Fix *PM usage for i.MX53 Benoît Thébaudeau
2012-11-08 20:29   ` [U-Boot] [PATCH v2 07/13] ehci-mx5: Add missing OC_DIS " Benoît Thébaudeau
2012-11-08 20:29   ` [U-Boot] [PATCH v2 08/13] ehci-mxc: Make EHCI power/oc polarities configurable Benoît Thébaudeau
2012-11-08 20:30   ` [U-Boot] [PATCH v2 09/13] ehci-mxc: Make i.MX25 EHCI configurable Benoît Thébaudeau
2012-11-08 20:30   ` [U-Boot] [PATCH v2 10/13] ehci-mxc: Define host offsets Benoît Thébaudeau
2012-11-08 20:30   ` [U-Boot] [PATCH v2 11/13] ehci-mxc: Add support for i.MX35 Benoît Thébaudeau
2012-11-08 20:31   ` [U-Boot] [PATCH v2 12/13] mx35pdk: Add support for OTG Benoît Thébaudeau
2012-11-08 20:31   ` [U-Boot] [PATCH v2 13/13] ehci-mx5/6: Make board_ehci_hcd_init() optional Benoît Thébaudeau
2012-11-10  7:42   ` [U-Boot] [PATCH v2 01/13] mx31: Move EHCI definitions to ehci-fsl.h Stefano Babic
2012-11-10 12:37     ` Benoît Thébaudeau
2012-11-10 12:46       ` Albert ARIBAUD
2012-11-10 12:47         ` Albert ARIBAUD
2012-11-10 13:51           ` Benoît Thébaudeau
2012-11-10 16:45       ` stefano babic
2012-11-13 19:55   ` [U-Boot] [PATCH v3 " Benoît Thébaudeau
2012-11-13 19:55     ` [U-Boot] [PATCH v3 02/13] ehci-mxc: Clean up Benoît Thébaudeau
2012-11-16  8:29       ` Stefano Babic
2012-11-13 19:56     ` [U-Boot] [PATCH v3 03/13] ehci-mx5: " Benoît Thébaudeau
2012-11-13 19:56     ` [U-Boot] [PATCH v3 04/13] ehci-mx5: Fix OC_DIS usage Benoît Thébaudeau
2012-11-13 19:56     ` [U-Boot] [PATCH v3 05/13] ehci-mx5: Fix OPM usage Benoît Thébaudeau
2012-11-13 19:56     ` [U-Boot] [PATCH v3 06/13] ehci-mx5: Fix *PM usage for i.MX53 Benoît Thébaudeau
2012-11-13 19:57     ` [U-Boot] [PATCH v3 07/13] ehci-mx5: Add missing OC_DIS " Benoît Thébaudeau
2012-11-13 19:57     ` [U-Boot] [PATCH v3 08/13] ehci-mxc: Make EHCI power/oc polarities configurable Benoît Thébaudeau
2012-11-13 19:57     ` [U-Boot] [PATCH v3 09/13] ehci-mxc: Make i.MX25 EHCI configurable Benoît Thébaudeau
2012-11-13 19:57     ` [U-Boot] [PATCH v3 10/13] ehci-mxc: Define host offsets Benoît Thébaudeau
2012-11-13 19:58     ` [U-Boot] [PATCH v3 11/13] ehci-mxc: Add support for i.MX35 Benoît Thébaudeau
2012-11-13 19:58     ` [U-Boot] [PATCH v3 12/13] mx35pdk: Add support for OTG Benoît Thébaudeau
2012-11-13 19:58     ` [U-Boot] [PATCH v3 13/13] ehci-mx5/6: Make board_ehci_hcd_init() optional Benoît Thébaudeau

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=2082152522.587372.1352146359242.JavaMail.root@advansee.com \
    --to=benoit.thebaudeau@advansee.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