Skip to contentSkip to conversation

usb: host: mips: sead3: USB Host controller support for SEAD-3 platform.

PATCH Superseded Steven J. Hill 2 participants 2 messages Apr 11, 2012 – Apr 12, 2012

Subsystems (3)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 10/10 usb: host: mips: sead3: USB Host controller support for SEAD-3 platform.

From: "Steven J. Hill" <[email protected]>

Add EHCI driver for MIPS SEAD-3 development platform.

---
 drivers/usb/host/Kconfig      |    5 +-
 drivers/usb/host/ehci-hcd.c   |    5 +
 drivers/usb/host/ehci-sead3.c |  259 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 267 insertions(+), 2 deletions(-)
 create mode 100644 drivers/usb/host/ehci-sead3.c
drivers/usb/host/Kconfig +3 -2
index f788eb8..dde5a05 100644
@@ -110,13 +110,14 @@ config USB_EHCI_BIG_ENDIAN_MMIO
 	depends on USB_EHCI_HCD && (PPC_CELLEB || PPC_PS3 || 440EPX || \
 				    ARCH_IXP4XX || XPS_USB_HCD_XILINX || \
 				    PPC_MPC512x || CPU_CAVIUM_OCTEON || \
-				    PMC_MSP || SPARC_LEON)
+				    PMC_MSP || SPARC_LEON || MIPS_SEAD3)
 	default y
 
 config USB_EHCI_BIG_ENDIAN_DESC
 	bool
 	depends on USB_EHCI_HCD && (440EPX || ARCH_IXP4XX || XPS_USB_HCD_XILINX || \
-				    PPC_MPC512x || PMC_MSP || SPARC_LEON)
+				    PPC_MPC512x || PMC_MSP || SPARC_LEON || \
+				    MIPS_SEAD3)
 	default y
 
 config XPS_USB_HCD_XILINX
drivers/usb/host/ehci-hcd.c +5 -0
index aede637..d082d9b 100644
@@ -1371,6 +1371,11 @@ MODULE_LICENSE ("GPL");
 #define PLATFORM_DRIVER		ehci_ls1x_driver
 #endif
 
+#ifdef CONFIG_MIPS_SEAD3
+#include "ehci-sead3.c"
+#define	PLATFORM_DRIVER		ehci_hcd_sead3_driver
+#endif
+
 #ifdef CONFIG_USB_EHCI_HCD_PLATFORM
 #include "ehci-platform.c"
 #define PLATFORM_DRIVER		ehci_platform_driver
drivers/usb/host/ehci-sead3.c new file +259 -0

259 lines not on this page · raw message

Signature · 1 line
1.7.9.6
maintainer
#1 lore raw
Quoted 6 lines · Steven J. Hill

From: "Steven J. Hill" <[email protected]>

Add EHCI driver for MIPS SEAD-3 development platform.

Even better than before. But...

Quoted 6 lines
drivers/usb/host/ehci-sead3.c new file +6 -0
+const struct hc_driver ehci_sead3_hc_driver = {
+	.description		= hcd_name,
+	.product_desc		= "SEAD-3 EHCI",
+	.hcd_priv_size		= sizeof(struct ehci_hcd),
+
+	/*

drivers/usb/host/ehci-sead3.c line 39

Quoted 10 lines
drivers/usb/host/ehci-sead3.c new file +10 -0
+	 * generic hardware linkage
+	 */
+	.irq			= ehci_irq,
+	.flags			= HCD_MEMORY | HCD_USB2,
+
+	/*
+	 * basic lifecycle operations
+	 *
+	 */
+	.reset			= ehci_setup,

You no longer care about the ehci->need_io_watchdog setting?

Quoted 31 lines
drivers/usb/host/ehci-sead3.c new file +31 -0
+static int ehci_hcd_sead3_drv_probe(struct platform_device *pdev)
+{
+	struct usb_hcd *hcd;
+	struct ehci_hcd *ehci;
+	struct resource *res;
+	int ret;
+
+	if (usb_disabled())
+		return -ENODEV;
+
+	if (pdev->resource[1].flags != IORESOURCE_IRQ) {
+		pr_debug("resource[1] is not IORESOURCE_IRQ");
+		return -ENOMEM;
+	}
+	hcd = usb_create_hcd(&ehci_sead3_hc_driver, &pdev->dev, "SEAD-3");
+	if (!hcd)
+		return -ENOMEM;
+
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	hcd->rsrc_start = res->start;
+	hcd->rsrc_len = resource_size(res);
+
+	if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {
+		pr_debug("request_mem_region failed");
+		ret = -EBUSY;
+		goto err1;
+	}
+
+	hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);
+	if (!hcd->regs) {
+		pr_debug("ioremap failed");

drivers/usb/host/ehci-sead3.c line 110

Quoted 10 lines
drivers/usb/host/ehci-sead3.c new file +10 -0
+		ret = -ENOMEM;
+		goto err2;
+	}
+
+	ehci = hcd_to_ehci(hcd);
+	ehci->caps = hcd->regs + 0x100;
+	ehci->regs = hcd->regs + 0x100 +
+		HC_LENGTH(ehci, readl(&ehci->caps->hc_capbase));
+	/* cache this readonly data; minimize chip reads */
+	ehci->hcs_params = readl(&ehci->caps->hcs_params);

The last four lines above are duplicates of code that is already present in ehci_setup.

Alan Stern