[PATCH 128/133] [Jaunty SRU] ARM.imx51 Freescale:ENGR00113307 stmp3780 usb host support.
Brad Figg
brad.figg at canonical.com
Thu Jul 9 16:49:58 UTC 2009
For stmp3780 usb otg port:
1. Add usb ehci host driver.
2. Use parent resource for host and device driver.
Signed-off-by: Li Jun <r65092 at freescale.com>
Signed-off-by: Brad Figg <brad.figg at canonical.com>
---
drivers/usb/core/hub.c | 29 +++++++++++++++++++++++++++++
drivers/usb/gadget/arcotg_udc.c | 8 ++++++++
drivers/usb/host/Kconfig | 18 +++++++++++++++++-
drivers/usb/host/ehci-arc.c | 34 +++++++++++++++++++++++++---------
drivers/usb/host/ehci-fsl.h | 2 +-
5 files changed, 80 insertions(+), 11 deletions(-)
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index a5cc577..853ba13 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -37,6 +37,14 @@
#endif
#endif
+#ifdef CONFIG_ARCH_STMP3XXX
+#define STMP3XXX_USB_HOST_HACK
+#endif
+
+#ifdef STMP3XXX_USB_HOST_HACK
+#include <linux/fsl_devices.h>
+#endif
+
struct usb_hub {
struct device *intfdev; /* the "interface" device */
struct usb_device *hdev;
@@ -2844,6 +2852,27 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1,
return;
}
+#ifdef STMP3XXX_USB_HOST_HACK
+ {
+ /*
+ * FIXME: the USBPHY of STMP3xxx SoC has bug. The usb port power
+ * is never enabled during standard ehci reset procedure if the
+ * external device once passed plug/unplug procedure. This work-
+ * around resets and reinitiates USBPHY before the ehci port reset
+ * sequence started.
+ */
+ struct device *dev = hcd->self.controller;
+ struct fsl_usb2_platform_data *pdata;
+
+ pdata = (struct fsl_usb2_platform_data *)dev->platform_data;
+ if (dev->parent && dev->type) {
+ if (port1 == 1 && pdata->platform_init)
+ pdata->platform_init(NULL);
+ }
+ }
+
+#endif
+
for (i = 0; i < SET_CONFIG_TRIES; i++) {
/* reallocate for each attempt, since references
diff --git a/drivers/usb/gadget/arcotg_udc.c b/drivers/usb/gadget/arcotg_udc.c
index af7b940..40df0fb 100644
--- a/drivers/usb/gadget/arcotg_udc.c
+++ b/drivers/usb/gadget/arcotg_udc.c
@@ -2592,6 +2592,14 @@ static int __init fsl_udc_probe(struct platform_device *pdev)
return -ENODEV;
}
#else
+ if ((pdev->dev.parent) &&
+ (to_platform_device(pdev->dev.parent)->resource)) {
+ pdev->resource =
+ to_platform_device(pdev->dev.parent)->resource;
+ pdev->num_resources =
+ to_platform_device(pdev->dev.parent)->num_resources;
+ }
+
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
ret = -ENXIO;
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 99f665d..73acb16 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -44,7 +44,7 @@ config USB_EHCI_HCD
config USB_EHCI_ARC
bool "Support for Freescale controller"
- depends on USB_EHCI_HCD && ARCH_MXC
+ depends on USB_EHCI_HCD && (ARCH_MXC || ARCH_STMP3XXX)
---help---
Some Freescale processors have an integrated High Speed
USBOTG controller, which supports EHCI host mode.
@@ -64,6 +64,14 @@ config USB_EHCI_ARC_H2
---help---
Enable support for the USB Host2 port.
+config USB_EHCI_ARC_H2_WAKE_UP
+ bool "Support wake up from Freescale Host2 port"
+ depends on PM && USB_EHCI_ARC_H2
+ default n
+ ---help---
+ Enable support system wake up from Host2 port usb device
+ connection and disconnection.
+
config USB_EHCI_ARC_OTG
bool "Support for DR host port on Freescale controller"
depends on USB_EHCI_ARC
@@ -71,6 +79,14 @@ config USB_EHCI_ARC_OTG
---help---
Enable support for the USB OTG port in HS/FS Host mode.
+config USB_EHCI_ARC_OTG_WAKE_UP
+ bool "Support wake up from Freescale OTG port"
+ depends on PM && ARCH_MXC && USB_EHCI_ARC_OTG
+ default n
+ ---help---
+ Enable support system wake up from Host1 port usb device
+ connection and disconnection.
+
config USB_STATIC_IRAM
bool "Use IRAM for USB"
depends on USB_EHCI_ARC
diff --git a/drivers/usb/host/ehci-arc.c b/drivers/usb/host/ehci-arc.c
index a0c46fb..7fcc4d0 100644
--- a/drivers/usb/host/ehci-arc.c
+++ b/drivers/usb/host/ehci-arc.c
@@ -28,6 +28,7 @@
extern struct resource *otg_get_resources(void);
+static int regs_remapped /* = 0 */;
#undef EHCI_PROC_PTC
#ifdef EHCI_PROC_PTC /* /proc PORTSC:PTC support */
/*
@@ -114,7 +115,7 @@ static int usb_hcd_fsl_probe(const struct hc_driver *driver,
struct resource *res;
int irq;
int retval;
- unsigned int __maybe_unused temp;
+ u32 temp;
pr_debug("initializing FSL-SOC USB Controller\n");
@@ -159,6 +160,14 @@ static int usb_hcd_fsl_probe(const struct hc_driver *driver,
} else
#endif
{
+ if ((pdev->dev.parent) &&
+ (to_platform_device(pdev->dev.parent)->resource)) {
+ pdev->resource =
+ to_platform_device(pdev->dev.parent)->resource;
+ pdev->num_resources =
+ to_platform_device(pdev->dev.parent)->num_resources;
+ }
+
res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (!res) {
dev_err(&pdev->dev,
@@ -180,13 +189,18 @@ static int usb_hcd_fsl_probe(const struct hc_driver *driver,
}
}
- hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);
+ if (!(pdata->port_enables & FSL_USB2_DONT_REMAP)) {
+ hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);
+
+ if (hcd->regs == NULL) {
+ dev_dbg(&pdev->dev, "error mapping memory\n");
+ retval = -EFAULT;
+ goto err3;
+ }
+ regs_remapped = 1;
+ } else
+ hcd->regs = (void __iomem *)(u32)(hcd->rsrc_start);
- if (hcd->regs == NULL) {
- dev_dbg(&pdev->dev, "error mapping memory\n");
- retval = -EFAULT;
- goto err3;
- }
pdata->regs = hcd->regs;
/*
@@ -236,7 +250,8 @@ static int usb_hcd_fsl_probe(const struct hc_driver *driver,
return retval;
err4:
- iounmap(hcd->regs);
+ if (regs_remapped)
+ iounmap(hcd->regs);
err3:
if (pdata->operating_mode != FSL_USB2_DR_OTG)
release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
@@ -286,7 +301,8 @@ static void usb_hcd_fsl_remove(struct usb_hcd *hcd,
if (pdata->platform_uninit)
pdata->platform_uninit(pdata);
- iounmap(hcd->regs);
+ if (regs_remapped)
+ iounmap(hcd->regs);
}
static void fsl_setup_phy(struct ehci_hcd *ehci,
diff --git a/drivers/usb/host/ehci-fsl.h b/drivers/usb/host/ehci-fsl.h
index 6d7d7dc..f3db681 100644
--- a/drivers/usb/host/ehci-fsl.h
+++ b/drivers/usb/host/ehci-fsl.h
@@ -43,7 +43,7 @@
#define FSL_SOC_USB_CTRL 0x500 /* NOTE: big-endian */
#define SNOOP_SIZE_2GB 0x1e
-#ifdef CONFIG_ARCH_MXC
+#if defined(CONFIG_ARCH_MXC) || defined(CONFIG_ARCH_STMP3XXX)
#include <mach/fsl_usb.h>
#elif CONFIG_PPC32
#include <asm/fsl_usb.h>
--
1.6.0.4
More information about the kernel-team
mailing list