[PATCH 1/1] add OCPOL and Power Polarity flags to ehci-mxc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi

This patch adds power polarity and OCPOL flags for the ehci-imx
tested on imx35 pcm043 to use the internal otg phy with
the initialisation look like this:
static struct mxc_usbh_platform_data otg_pdata = {
       .portsc = MXC_EHCI_MODE_UTMI,
       .flags  = MXC_EHCI_INTERFACE_DIFF_UNI | MXC_EHCI_INTERNAL_PHY | MXC_EHCI_POWER_PINS_ENABLED | 
                 MXC_EHCI_POWER_OCPOL_LOW | MXC_EHCI_PP_HIGH,
 };

If this mail gets scrambled by the mailingsystem of our company please tell. I will
then resend this patch from another account.

It would be nice to have this stuff in mainline.

Best regards
Tim

Signed-off-by: Tim Sander <tim.sander@xxxxxxx>
---
 arch/arm/plat-mxc/ehci.c                  |   13 +++++++++++++
 arch/arm/plat-mxc/include/mach/mxc_ehci.h |    2 ++
 2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/arch/arm/plat-mxc/ehci.c b/arch/arm/plat-mxc/ehci.c
index 82808c6..0862933 100644
--- a/arch/arm/plat-mxc/ehci.c
+++ b/arch/arm/plat-mxc/ehci.c
@@ -38,6 +38,8 @@
 #define MX35_OTG_SIC_SHIFT     29
 #define MX35_OTG_SIC_MASK      (0x3 << MX35_OTG_SIC_SHIFT)
 #define MX35_OTG_PM_BIT                (1 << 24)
+#define MX35_OTG_PP_HIGH       (1 << 11)
+#define MX35_OTG_OCPOL         (1 << 3)
 
 #define MX35_H1_SIC_SHIFT      21
 #define MX35_H1_SIC_MASK       (0x3 << MX35_H1_SIC_SHIFT)
@@ -47,6 +49,7 @@
 #define MX35_H1_IPPUE_DOWN_BIT (1 << 6)
 #define MX35_H1_TLL_BIT                (1 << 5)
 #define MX35_H1_USBTE_BIT      (1 << 4)
+#define MX35_H1_OCPOL          (1 << 3)
 
 #define MXC_OTG_OFFSET         0
 #define MXC_H1_OFFSET          0x200
@@ -168,9 +171,16 @@ int mxc_initialize_usb_hw(int port, unsigned int flags)
                        v &= ~(MX35_OTG_SIC_MASK | MX35_OTG_PM_BIT);
                        v |= (flags & MXC_EHCI_INTERFACE_MASK)
                                        << MX35_OTG_SIC_SHIFT;
+                       v |= MX35_OTG_OCPOL;
+
                        if (!(flags & MXC_EHCI_POWER_PINS_ENABLED))
                                v |= MX35_OTG_PM_BIT;
 
+                       if (flags & MXC_EHCI_POWER_OCPOL_LOW)
+                               v &= ~MX35_OTG_OCPOL;
+
+                       if (flags & MXC_EHCI_PP_HIGH)
+                               v |= MX35_OTG_PP_HIGH;
                        break;
                case 1: /* H1 port */
                        v &= ~(MX35_H1_SIC_MASK | MX35_H1_PM_BIT | MX35_H1_TLL_BIT |
@@ -178,6 +188,7 @@ int mxc_initialize_usb_hw(int port, unsigned int flags)
                                MX35_H1_IPPUE_UP_BIT | MX35_H1_PP_BIT);
                        v |= (flags & MXC_EHCI_INTERFACE_MASK)
                                                << MX35_H1_SIC_SHIFT;
+                       v |= MX35_H1_OCPOL;
 
                        if (!(flags & MXC_EHCI_POWER_PINS_ENABLED))
                                v |= MX35_H1_PM_BIT;
@@ -197,6 +208,8 @@ int mxc_initialize_usb_hw(int port, unsigned int flags)
                        if (flags & MXC_EHCI_POLARITY_HIGH)
                                v |= MX35_H1_PP_BIT;
 
+                       if (flags & MXC_EHCI_POWER_OCPOL_LOW)
+                               v |= MX35_H1_OCPOL;
                        break;
                default:
                        return -EINVAL;
diff --git a/arch/arm/plat-mxc/include/mach/mxc_ehci.h b/arch/arm/plat-mxc/include/mach/mxc_ehci.h
index e829031..2de1fe7 100644
--- a/arch/arm/plat-mxc/include/mach/mxc_ehci.h
+++ b/arch/arm/plat-mxc/include/mach/mxc_ehci.h
@@ -19,6 +19,7 @@
 #define MXC_EHCI_INTERFACE_SINGLE_BI   (3 << 0)
 #define MXC_EHCI_INTERFACE_MASK                (0xf)
 
+#define MXC_EHCI_POWER_OCPOL_LOW       (1 << 3)
 #define MXC_EHCI_POWER_PINS_ENABLED    (1 << 5)
 #define MXC_EHCI_TTL_ENABLED           (1 << 6)
 
@@ -27,6 +28,7 @@
 #define MXC_EHCI_IPPUE_UP              (1 << 9)
 #define MXC_EHCI_WAKEUP_ENABLED        (1 << 10)
 #define MXC_EHCI_ITC_NO_THRESHOLD      (1 << 11)
+#define MXC_EHCI_PP_HIGH               (1 << 12)
 #define MXC_EHCI_POLARITY_HIGH (1 << 18)
 
 #define MXC_USBCTRL_OFFSET             0
-- 
1.7.0.4

Hottinger Baldwin Messtechnik GmbH, Im Tiefen See 45, 64293 Darmstadt, Germany | www.hbm.com 

Registered as GmbH (German limited liability corporation) in the commercial register at the local court of Darmstadt, HRB 1147  
Company domiciled in Darmstadt | CEO: Andreas Huellhorst | Chairman of the board: James Charles Webster

Als Gesellschaft mit beschraenkter Haftung eingetragen im Handelsregister des Amtsgerichts Darmstadt unter HRB 1147 
Sitz der Gesellschaft: Darmstadt | Geschaeftsfuehrung: Andreas Huellhorst | Aufsichtsratsvorsitzender: James Charles Webster

The information in this email is confidential. It is intended solely for the addressee. If you are not the intended recipient, please let me know and delete this email.

Die in dieser E-Mail enthaltene Information ist vertraulich und lediglich fur den Empfaenger bestimmt. Sollten Sie nicht der eigentliche Empfaenger sein, informieren Sie mich bitte kurz und loeschen diese E-Mail.

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux