Re: Issue with Oxford OXU210HP HCD driver

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

 



Hi,
This email is actually an update over the problem. But as previous
posting didn't have any reply and I have largely changed the driver in
question, I am top-posting. Sorry! You can read my previous email at
the end of this email.

OXU210 documentation mentions that is EHCI compatible. So I have
changed the driver to use only the initialisation routines from the
original drivers/usb/host/oxu210hp-hcd.c and rest is done by the stock
EHCI driver. (oxu-ehci.patch attached alongwith)

With this driver I am getting following errors : 

root:~# insmod ehci-hcd.ko
ehci_hcd: block sizes: qh 128 qtd 96 itd 160 sitd 96
oxu210hp-ehci oxu210hp-ehci: IRQ resource 115
oxu210hp-ehci oxu210hp-ehci: MEM resource 12000000-3fffff
dma_declare_coherent_memory() : memstart = 0x1200e000,memlen = 0x10000
oxu210hp-ehci oxu210hp-ehci: device ID 21000200
oxu210hp-ehci oxu210hp-ehci: found device 2100 84-pin TFBGA (0000:0000)
oxu210hp-ehci oxu210hp-ehci: OXU210HP EHCI Host Controller
/home/awalambe/devel/boards/cubic-mm6/linux-2.6.25.7/drivers/usb/core/inode.c:
creating file
'devices' /home/awalambe/devel/boards/cubic-mm6/linux-2.6.25.7/drivers/usb/core/inode.c:
creating file '001' oxu210hp-ehci oxu210hp-ehci: new USB bus
registered, assigned bus number 1 oxu210hp-ehci oxu210hp-ehci: park 0
oxu210hp-ehci oxu210hp-ehci: reset command 080b02 park=3 ithresh=8
period=1024 Reset HALT oxu210hp-ehci oxu210hp-ehci: irq 115, io mem
0x12000000 oxu210hp-ehci oxu210hp-ehci: reset command 080b02 park=3
ithresh=8 period=1024 Reset HALT oxu210hp-ehci oxu210hp-ehci: init
command 010009 (park)=0 ithresh=1 period=256 RUN oxu210hp-ehci
oxu210hp-ehci: USB 2.0 started, EHCI 1.00, driver 10 Dec 2004 usb usb1:
default language 0x0409 usb usb1: uevent usb usb1: usb_probe_device
usb usb1: configuration #1 chosen from 1 choice
usb usb1: adding 1-0:1.0 (config #1, interface 0)
usb 1-0:1.0: uevent
hub 1-0:1.0: usb_probe_interface
hub 1-0:1.0: usb_probe_interface - got id
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
hub 1-0:1.0: standalone hub
hub 1-0:1.0: individual port power switching
hub 1-0:1.0: individual port over-current protection
hub 1-0:1.0: Single TT
hub 1-0:1.0: TT requires at most 8 FS bit times (666 ns)
hub 1-0:1.0: power on to power good time: 20ms
hub 1-0:1.0: local power source is good
hub 1-0:1.0: enabling power on all ports
/home/awalambe/devel/boards/cubic-mm6/linux-2.6.25.7/drivers/usb/core/inode.c:
creating file '001' usb usb1: New USB device found, idVendor=1d6b,
idProduct=0002 usb usb1: New USB device strings: Mfr=3, Product=2,
SerialNumber=1 usb usb1: Product: OXU210HP EHCI Host Controller
usb usb1: Manufacturer: Linux 2.6.25.7 ehci_hcd
usb usb1: SerialNumber: oxu210hp_otg
oxu210hp-ehci oxu210hp-ehci: devices enabled and running
hub 1-0:1.0: state 7 ports 1 chg 0000 evt 0002
oxu210hp-ehci oxu210hp-ehci: GetStatus port 1 status 001803 POWER sig=j
CSC CONNECT hub 1-0:1.0: port 1, status 0101, change 0001, 12 Mb/s
root:~# hub 1-0:1.0: debounce: port 1: total 100ms stable 100ms status
0x101 oxu210hp-ehci oxu210hp-ehci: port 1 high speed
oxu210hp-ehci oxu210hp-ehci: GetStatus port 1 status 8001205 POWER
sig=se0 PE CONNECT usb 1-1: new high speed USB device using
oxu210hp-ehci and address 2 oxu210hp-ehci oxu210hp-ehci: port 1 high
speed oxu210hp-ehci oxu210hp-ehci: GetStatus port 1 status 8001205
POWER sig=se0 PE CONNECT usb 1-1: default language 0x0409
usb 1-1: uevent
usb 1-1: usb_probe_device
usb 1-1: configuration #1 chosen from 1 choice
usb 1-1: adding 1-1:1.0 (config #1, interface 0)
usb 1-1:1.0: uevent
usb-storage 1-1:1.0: usb_probe_interface
usb-storage 1-1:1.0: usb_probe_interface - got id
scsi0 : SCSI emulation for USB Mass Storage devices
/home/awalambe/devel/boards/cubic-mm6/linux-2.6.25.7/drivers/usb/core/inode.c:
creating file '002' usb 1-1: New USB device found, idVendor=0951,
idProduct=1607 usb 1-1: New USB device strings: Mfr=1, Product=2,
SerialNumber=3 usb 1-1: Product: DataTraveler 2.0
usb 1-1: Manufacturer: Kingston
usb 1-1: SerialNumber: 0019E0028E0EA940159C04CC
usb-storage: device found at 2
usb-storage: waiting for device to settle before scanning
oxu210hp-ehci oxu210hp-ehci: fatal command 010028 (park)=0 ithresh=1
Async period=256 HALT oxu210hp-ehci oxu210hp-ehci: fatal status 48088
Async FLR usb 1-1: device reset changed speed!
hub 1-0:1.0: logical disconnect on port 1
scsi 0:0:0:0: Device offlined - not ready after error recovery
usb-storage: device scan complete
hub 1-0:1.0: state 7 ports 1 chg 0002 evt 0000
hub 1-0:1.0: port 1, status 0101, change 0000, 12 Mb/s
usb 1-1: USB disconnect, address 2
usb 1-1: unregistering device
usb 1-1: usb_disable_device nuking all URBs
usb 1-1: unregistering interface 1-1:1.0
usb 1-1:1.0: uevent
usb 1-1: uevent
usb 1-1: new high speed USB device using oxu210hp-ehci and address 3
oxu210hp-ehci oxu210hp-ehci: devpath 1 ep0in 3strikes
oxu210hp-ehci oxu210hp-ehci: devpath 1 ep0in 3strikes
oxu210hp-ehci oxu210hp-ehci: devpath 1 ep0in 3strikes
oxu210hp-ehci oxu210hp-ehci: devpath 1 ep0in 3strikes
oxu210hp-ehci oxu210hp-ehci: devpath 1 ep0in 3strikes
oxu210hp-ehci oxu210hp-ehci: devpath 1 ep0in 3strikes
oxu210hp-ehci oxu210hp-ehci: GetStatus port 1 status 800120f POWER
sig=se0 PEC PE CSC CONNECT hub 1-0:1.0: unable to enumerate USB device
on port 1 hub 1-0:1.0: state 7 ports 1 chg 0000 evt 0002

I would really appreciate any help/pointers about why this might be
happening, or towards debugging this problem further.

Thanks and regards,
- Amit

On Thu, 18 Jun 2009 23:38:37 +0530
Amit Walambe <amit.walambe@xxxxxxxxxxxx> wrote:
> Hi,
> I am working on a PXA320 board running 2.6.25.7. I am having some
> issues in getting OXU210 driver working. 
> Basically the device can't work with storage devices. It fails to
> perform a simple 1 MB 'dd' or fsck on to the attached USB memory
> sticks. 
> 
> Following are the patches that I have applied on top of the vanilla
> driver : 
> oxu_memlock_critical_section_reduction.patch
> oxu_schedule_while_atomic.patch
> oxu_hardirqsafe_mem_lock.patch
> (all attached alongwith)
> 
> With this driver, the device is getting reset with following errors :
> 
> oxu210hp-hcd oxu210hp-hcd: devpath <NULL> ep1in 3strikes
> usb 2-1: reset high speed USB device using oxu210hp-hcd and address 2
> oxu210hp-hcd oxu210hp-hcd: port 1 high speed
> oxu210hp-hcd oxu210hp-hcd: GetStatus port 1 status 8001205 POWER
> sig=se0 PE CONNECT
> usb 2-1: reset high speed USB device using oxu210hp-hcd and address 2
> oxu210hp-hcd oxu210hp-hcd: port 1 high speed
> oxu210hp-hcd oxu210hp-hcd: GetStatus port 1 status 8001205 POWER
> sig=se0 PE CONNECT
> 
> If I act patient enough, the device eventually gives Buffer I/O
> errors, resets and detects the USB memory stick again.
> 
> I tried 2.6.30 too. There, the problem persists, but the resets are
> prolonged.
> 
> In a discussion with Rodolfo Giometti (author of the driver); we
> thought using Oxu210's internal 72KB SRAM for storing data structures
> and packets (HCD_LOCAL_MEM) should be tried. I backported the DMA
> coherent support for ARM to 2.6.25.7 and adapted the driver to those
> changes (dma-coherent.patch and oxu_hcd_local_mem.patch attached).
> There I am getting a 'System error' IRQ. Here is a snippet from the
> error log : 
> 
> oxu210hp-hcd oxu210hp-hcd: port 1 reset
> oxu210hp-hcd oxu210hp-hcd: port 1 high speed
> oxu210hp-hcd oxu210hp-hcd: GetStatus port 1 status 8001205 POWER
> sig=se0 PE CONNECT 
> oxu210hp-hcd oxu210hp-hcd: irq status 0004 PCD
> usb 3-1: new high speed USB device using oxu210hp-hcd and address 2
> oxu210hp-hcd oxu210hp-hcd: submit_async 1 urb cfde0300 ep0out len 64,
> qtd d0886860 [qh 00000000] 
> oxu210hp-hcd oxu210hp-hcd: irq status 0010 FATAL 
> oxu210hp-hcd oxu210hp-hcd: fatal command 010028 (park)=0 ithresh=1
> Async period=256 HALT 
> oxu210hp-hcd oxu210hp-hcd: fatal status
> 9088 Async Halt FLR oxu210hp-hcd oxu210hp-hcd: fatal error
> oxu210hp-hcd oxu210hp-hcd: reset command 01002a (park)=0 ithresh=1
> Async period=256 Reset HALT 
> oxu210hp-hcd oxu210hp-hcd: ehci_urb_done 1 urb cfde0300 ep0in status
> -108 len 0/64 
> oxu210hp-hcd oxu210hp-hcd: HC died; cleaning up
> oxu210hp-hcd oxu210hp-hcd: submit_async 1 urb cfde0300 ep0out len 64,
> qtd d08868c0 [qh d0886080] 
> oxu210hp-hcd oxu210hp-hcd: irq status 0004 PCD oxu210hp-hcd
> oxu210hp-hcd: lost IAA
> 
> I tried many other things that didn't work (like disabling OTG/SPH,
> trying to find the last successful urb etc.). OxSemi's documentation
> doesn't help much either. 
Index: linux-2.6.25.7/arch/arm/mach-pxa/mm6.c
===================================================================
--- linux-2.6.25.7.orig/arch/arm/mach-pxa/mm6.c	2009-06-24 15:19:21.062069268 +0530
+++ linux-2.6.25.7/arch/arm/mach-pxa/mm6.c	2009-06-24 15:19:53.686021213 +0530
@@ -462,7 +462,7 @@
 };
 
 static struct platform_device mm6_oxu210hp = {
-		.name           = "oxu210hp-hcd",
+		.name           = "oxu210hp-ehci",
 		.id             = -1,
 		.num_resources  = ARRAY_SIZE(mm6_oxu210hp_resources),
 		.resource       = mm6_oxu210hp_resources,
Index: linux-2.6.25.7/drivers/usb/host/ehci-hcd.c
===================================================================
--- linux-2.6.25.7.orig/drivers/usb/host/ehci-hcd.c	2009-06-24 15:19:21.126024681 +0530
+++ linux-2.6.25.7/drivers/usb/host/ehci-hcd.c	2009-06-26 11:14:06.739251669 +0530
@@ -1008,6 +1008,11 @@
 #define	PCI_DRIVER		ehci_pci_driver
 #endif
 
+//#ifdef CONFIG_USB_EHCI_OXU210HP
+#include "ehci-oxu210hp.c"
+#define	PLATFORM_DRIVER		oxu210hp_ehci_driver
+//#endif
+
 #ifdef CONFIG_USB_EHCI_FSL
 #include "ehci-fsl.c"
 #define	PLATFORM_DRIVER		ehci_fsl_driver
Index: linux-2.6.25.7/drivers/usb/host/ehci-oxu210hp.c
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.25.7/drivers/usb/host/ehci-oxu210hp.c	2009-06-26 12:51:19.115299487 +0530
@@ -0,0 +1,354 @@
+/*
+ * OXU210HP Host Controller Driver
+ *
+ * Author: Amit Walambe <amit.walambe@xxxxxxxxxxxx>
+ *
+ * Based on drivers/usb/host/oxu210hp-hcd.c and 
+ * drivers/usb/host/ehci-*.c
+ * 
+ * Copyright (c) 2009 Eurotech Ltd.
+ *
+ * This file is licensed under the terms of the GNU General Public 
+ * License version 2. This program is licensed "as is" without any 
+ * warranty of any kind, whether express or implied.
+ */
+
+#include <linux/platform_device.h>
+#include <asm/irq.h>
+#include <linux/irq.h>
+#include <asm-generic/dma-coherent.h>
+
+#include "ehci-oxu210hp.h"
+
+static int oxu210hp_reset(struct usb_hcd *hcd)
+{
+	struct ehci_hcd *ehci = hcd_to_ehci(hcd);
+	int retval;
+
+	/* FIMXE */
+	hcd->self.controller->dma_mask = 0UL;
+
+	ehci->caps = hcd->regs + OXU_OTG_CAP_OFFSET;
+	ehci->regs = hcd->regs + OXU_OTG_CAP_OFFSET + \
+			HC_LENGTH(readl(&ehci->caps->hc_capbase));
+
+	ehci->hcs_params = readl(&ehci->caps->hcs_params);
+	ehci->sbrn = 0x20;
+	ehci->is_tdi_rh_tt = 1;
+
+	retval = ehci_init(hcd);
+	if (retval)
+		return retval;
+
+	ehci_reset(ehci);
+
+	return retval;
+}
+
+static const struct hc_driver oxu210hp_ehci_hc_driver = {
+	.description		= hcd_name,
+	.product_desc		= "OXU210HP EHCI Host Controller",
+	.hcd_priv_size		= sizeof(struct ehci_hcd),
+	.irq			= ehci_irq,
+	.flags			= HCD_MEMORY | HCD_USB2 | HCD_LOCAL_MEM,
+	.reset			= oxu210hp_reset,
+	.start			= ehci_run,
+	.stop			= ehci_stop,
+	.shutdown		= ehci_shutdown,
+	.urb_enqueue		= ehci_urb_enqueue,
+	.urb_dequeue		= ehci_urb_dequeue,
+	.endpoint_disable	= ehci_endpoint_disable,
+	.get_frame_number	= ehci_get_frame,
+	.hub_status_data	= ehci_hub_status_data,
+	.hub_control		= ehci_hub_control,
+#if defined(CONFIG_PM)
+	.bus_suspend		= ehci_bus_suspend,
+	.bus_resume		= ehci_bus_resume,
+#endif
+};
+
+static struct usb_hcd *oxu210hp_create(struct platform_device *pdev,
+				unsigned long memstart, unsigned long memlen,
+				void *base, int irq, int otg)
+{
+	struct device *dev = &pdev->dev;
+
+	struct usb_hcd *hcd;
+	struct echi_hcd *ehci;
+	int ret;
+
+	/* Set endian mode and host mode */
+	writel(OXU_CM_HOST_ONLY | OXU_ES_LITTLE | OXU_VBPS,
+					base + (otg ? OXU_OTG_CORE_OFFSET : OXU_SPH_CORE_OFFSET) + OXU_USBMODE);
+
+	hcd = usb_create_hcd(&oxu210hp_ehci_hc_driver, dev,
+				otg ? "oxu210hp_otg" : "oxu210hp_sph");
+	if (!hcd)
+		return ERR_PTR(-ENOMEM);
+
+	hcd->rsrc_start = memstart;
+	hcd->rsrc_len = memlen;
+	hcd->regs = base;
+	hcd->irq = irq;
+	hcd->state = HC_STATE_HALT;
+
+	ehci = hcd_to_ehci(hcd);
+
+	ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
+	if (ret < 0)
+		return ERR_PTR(ret);
+
+	return hcd;
+}
+
+static void oxu210hp_configuration(struct platform_device *pdev, void *base)
+{
+	u32 tmp;
+
+	/* Initialize top level registers.
+	 * - Expected HostIfConfig bits : BE 0, bit DT 0, bit IP 1, bit BM 1
+	 */
+	writel(0x00000375, base + OXU_HOSTIFCONFIG);
+	writel(OXU_SRESET, base + OXU_SOFTRESET);
+	writel(0x00000375, base + OXU_HOSTIFCONFIG);
+
+	tmp = readl(base + OXU_PIOBURSTREADCTRL);
+	writel(tmp | 0x0040, base + OXU_PIOBURSTREADCTRL);
+
+	writel(OXU_SPHPOEN | OXU_OVRCCURPUPDEN |	OXU_COMPARATOR | OXU_ASO_OP,
+					base + OXU_ASO);
+
+	tmp = readl(base + OXU_CLKCTRL_SET);
+	writel(tmp | OXU_SYSCLKEN | OXU_USBOTGCLKEN, base + OXU_CLKCTRL_SET);
+
+	/* Clear all top interrupt enable */
+	writel(0xff, base + OXU_CHIPIRQEN_CLR);
+
+	/* Clear all top interrupt status */
+	writel(0xff, base + OXU_CHIPIRQSTATUS);
+
+	/* Enable all needed top interrupt except OTG SPH core */
+	writel(OXU_USBSPHLPWUI | OXU_USBOTGLPWUI, base + OXU_CHIPIRQEN_SET);
+}
+
+static int oxu210hp_verify_id(struct platform_device *pdev, void *base)
+{
+	u32 id;
+	char *bo[] = {
+		"reserved",
+		"128-pin LQFP",
+		"84-pin TFBGA",
+		"reserved",
+	};
+
+	/* Read controller signature register to find a match */
+	id = readl(base + OXU_DEVICEID);
+	dev_info(&pdev->dev, "device ID %x\n", id);
+	if ((id & OXU_REV_MASK) != (OXU_REV_2100 << OXU_REV_SHIFT))
+		return -1;
+
+	dev_info(&pdev->dev, "found device %x %s (%04x:%04x)\n",
+		id >> OXU_REV_SHIFT,
+		bo[(id & OXU_BO_MASK) >> OXU_BO_SHIFT],
+		(id & OXU_MAJ_REV_MASK) >> OXU_MAJ_REV_SHIFT,
+		(id & OXU_MIN_REV_MASK) >> OXU_MIN_REV_SHIFT);
+
+	return 0;
+}
+
+static int oxu210hp_init(struct platform_device *pdev,
+				unsigned long memstart, unsigned long memlen,
+				void *base, int irq)
+{
+	struct oxu_info *info = platform_get_drvdata(pdev);
+	struct usb_hcd *hcd;
+	int ret;
+
+	/* First time configuration at start up */
+	oxu210hp_configuration(pdev, base);
+
+	ret = oxu210hp_verify_id(pdev, base);
+	if (ret) {
+		dev_err(&pdev->dev, "no devices found!\n");
+		return -ENODEV;
+	}
+
+	/* Create the OTG controller */
+	hcd = oxu210hp_create(pdev, memstart, memlen, base, irq, 1);
+	if (IS_ERR(hcd)) {
+		dev_err(&pdev->dev, "cannot create OTG controller!\n");
+		ret = PTR_ERR(hcd);
+		goto error_create_otg;
+	}
+	info->hcd[0] = hcd;
+
+	/* Create the SPH host controller
+	hcd = oxu210hp_create(pdev, memstart, memlen, base, irq, 0);
+	if (IS_ERR(hcd)) {
+		dev_err(&pdev->dev, "cannot create SPH controller!\n");
+		ret = PTR_ERR(hcd);
+		goto error_create_sph;
+	}
+	info->hcd[1] = hcd;
+	*/
+
+	writel(readl(base + OXU_CHIPIRQEN_SET) | 3,
+					base + OXU_CHIPIRQEN_SET);
+
+	return 0;
+
+error_create_sph:
+	usb_remove_hcd(info->hcd[0]);
+	usb_put_hcd(info->hcd[0]);
+
+error_create_otg:
+	return ret;
+}
+
+static int oxu210hp_ehci_probe(struct platform_device *pdev)
+{
+	struct resource *res;
+	void *base;
+	unsigned long memstart, memlen;
+	int irq, ret;
+	struct oxu_info *info;
+
+	if (usb_disabled())
+		return -ENODEV;
+
+	/*
+	 * Get the platform resources
+	 */
+	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
+	if (!res) {
+		dev_err(&pdev->dev,
+			"no IRQ! Check %s setup!\n", pdev->dev.bus_id);
+		return -ENODEV;
+	}
+	irq = res->start;
+	dev_dbg(&pdev->dev, "IRQ resource %d\n", irq);
+
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!res) {
+		dev_err(&pdev->dev, "no registers address! Check %s setup!\n",
+			pdev->dev.bus_id);
+		return -ENODEV;
+	}
+	memstart = res->start;
+	memlen = res->end - res->start + 1;
+	dev_dbg(&pdev->dev, "MEM resource %lx-%lx\n", memstart, memlen);
+	if (!request_mem_region(memstart, memlen,
+				oxu210hp_ehci_hc_driver.description)) {
+		dev_dbg(&pdev->dev, "memory area already in use\n");
+		return -EBUSY;
+	}
+
+	ret = set_irq_type(irq, IRQF_TRIGGER_FALLING);
+	if (ret) {
+		dev_err(&pdev->dev, "error setting irq type\n");
+		ret = -EFAULT;
+		goto error_set_irq_type;
+	}
+
+	base = ioremap(memstart, 0x1000);
+	if (!base) {
+		dev_dbg(&pdev->dev, "error mapping memory\n");
+		ret = -EFAULT;
+		goto error_ioremap;
+	}
+
+	/* Here we try to use dma_declare_coherent_memory() to make sure
+	 * usb allocations with dma_alloc_coherent() allocate from
+	 * OXU210's local memory. The dma_handle returned by
+	 * dma_alloc_coherent() will be an offset starting from 0 for the 
+	 * first local memory byte.
+	 *
+	 * Using the corresponding HCD_LOCAL_MEM flag in HCD creation.
+	 */
+	printk("dma_declare_coherent_memory() : memstart = 0x%x, \
+					memlen = 0x%x\n", memstart + 0xE000, 0x10000);
+	if (!dma_declare_coherent_memory(&pdev->dev, memstart + 0xE000,
+							memstart + 0xE000,
+							0x10000,
+							DMA_MEMORY_MAP |
+							DMA_MEMORY_EXCLUSIVE)) {
+			dev_err(&pdev->dev, "cannot declare DMA coherent memory\n");
+			ret = -ENXIO;
+			goto error_alloc;
+	}
+
+	/* Allocate a driver data struct to hold useful info for both
+	 * SPH & OTG devices
+	 */
+	info = kzalloc(sizeof(struct oxu_info), GFP_KERNEL);
+	if (!info) {
+		dev_dbg(&pdev->dev, "error allocating memory\n");
+		ret = -EFAULT;
+		goto error_dma_declare_memory;
+	}
+	platform_set_drvdata(pdev, info);
+
+	ret = oxu210hp_init(pdev, memstart, memlen, base, irq);
+	if (ret < 0) {
+		dev_dbg(&pdev->dev, "cannot init USB devices\n");
+		goto error_init;
+	}
+
+	dev_info(&pdev->dev, "devices enabled and running\n");
+	platform_set_drvdata(pdev, info);
+
+	return 0;
+
+error_init:
+	kfree(info);
+	platform_set_drvdata(pdev, NULL);
+
+error_dma_declare_memory:
+	dma_release_declared_memory(&pdev->dev);
+
+error_alloc:
+	iounmap(base);
+
+error_set_irq_type:
+error_ioremap:
+	release_mem_region(memstart, memlen);
+
+	dev_err(&pdev->dev, "init %s fail, %d\n", pdev->dev.bus_id, ret);
+	return ret;
+}
+
+static void oxu210hp_remove(struct platform_device *pdev, struct usb_hcd *hcd)
+{
+	usb_remove_hcd(hcd);
+	usb_put_hcd(hcd);
+}
+
+static int oxu210hp_ehci_remove(struct platform_device *pdev)
+{
+	struct oxu_info *info = platform_get_drvdata(pdev);
+	unsigned long memstart = info->hcd[0]->rsrc_start,
+			memlen = info->hcd[0]->rsrc_len;
+	void *base = info->hcd[0]->regs;
+
+	oxu210hp_remove(pdev, info->hcd[0]);
+	oxu210hp_remove(pdev, info->hcd[1]);
+
+	iounmap(base);
+	release_mem_region(memstart, memlen);
+
+	kfree(info);
+	platform_set_drvdata(pdev, NULL);
+
+	return 0;
+}
+
+MODULE_ALIAS("oxu210hp-ehci");
+
+static struct platform_driver oxu210hp_ehci_driver = {
+	.probe = oxu210hp_ehci_probe,
+	.remove = oxu210hp_ehci_remove,
+	.driver = {
+		.name = "oxu210hp-ehci",
+		.bus = &platform_bus_type
+	},
+};
Index: linux-2.6.25.7/drivers/usb/host/ehci-oxu210hp.h
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.25.7/drivers/usb/host/ehci-oxu210hp.h	2009-06-24 15:19:53.694025024 +0530
@@ -0,0 +1,61 @@
+/*
+ * Host interface registers
+ */
+
+#define OXU_DEVICEID			0x00
+	#define OXU_REV_MASK		0xffff0000
+	#define OXU_REV_SHIFT		16
+	#define OXU_REV_2100		0x2100
+	#define OXU_BO_SHIFT		8
+	#define OXU_BO_MASK		(0x3 << OXU_BO_SHIFT)
+	#define OXU_MAJ_REV_SHIFT	4
+	#define OXU_MAJ_REV_MASK	(0xf << OXU_MAJ_REV_SHIFT)
+	#define OXU_MIN_REV_SHIFT	0
+	#define OXU_MIN_REV_MASK	(0xf << OXU_MIN_REV_SHIFT)
+#define OXU_HOSTIFCONFIG		0x04
+#define OXU_SOFTRESET			0x08
+	#define OXU_SRESET		(1 << 0)
+
+#define OXU_PIOBURSTREADCTRL		0x0C
+
+#define OXU_CHIPIRQSTATUS		0x10
+#define OXU_CHIPIRQEN_SET		0x14
+#define OXU_CHIPIRQEN_CLR		0x18
+	#define OXU_USBSPHLPWUI		0x00000080
+	#define OXU_USBOTGLPWUI		0x00000040
+	#define OXU_USBSPHI		0x00000002
+	#define OXU_USBOTGI		0x00000001
+
+#define OXU_CLKCTRL_SET			0x1C
+	#define OXU_SYSCLKEN		0x00000008
+	#define OXU_USBSPHCLKEN		0x00000002
+	#define OXU_USBOTGCLKEN		0x00000001
+
+#define OXU_ASO				0x68
+	#define OXU_SPHPOEN		0x00000100
+	#define OXU_OVRCCURPUPDEN	0x00000800
+	#define OXU_ASO_OP		(1 << 10)
+	#define OXU_COMPARATOR		0x000004000
+
+#define OXU_USBMODE			0x1A8
+	#define OXU_VBPS		0x00000020
+	#define OXU_ES_LITTLE		0x00000000
+	#define OXU_CM_HOST_ONLY	0x00000003
+
+/*
+ * Proper OXU210HP structs
+ */
+
+#define OXU_OTG_CORE_OFFSET	0x00400
+#define OXU_OTG_CAP_OFFSET	(OXU_OTG_CORE_OFFSET + 0x100)
+#define OXU_SPH_CORE_OFFSET	0x00800
+#define OXU_SPH_CAP_OFFSET	(OXU_SPH_CORE_OFFSET + 0x100)
+
+#define OXU_OTG_MEM		0xE000
+#define OXU_SPH_MEM		(OXU_OTG_MEM + sizeof(struct oxu_onchip_mem))
+
+struct oxu_info {
+	struct usb_hcd *hcd[2];
+};
+
+#include <linux/oxu210hp.h>
Index: linux-2.6.25.7/drivers/usb/host/Kconfig
===================================================================
--- linux-2.6.25.7.orig/drivers/usb/host/Kconfig	2009-06-24 15:19:21.102068631 +0530
+++ linux-2.6.25.7/drivers/usb/host/Kconfig	2009-06-26 11:14:06.767248450 +0530
@@ -83,6 +83,17 @@
 	  Enables support for the USB controller present on the PowerPC
 	  OpenFirmware platform bus.
 
+config USB_EHCI_OXU210HP
+	tristate "EHCI based OXU210HP HCD support"
+	select USB_EHCI_HCD
+	depends on USB
+	---help---
+	  The OXU210HP is an USB host/OTG/device controller. Enable this
+	  option if your board has this chip. If unsure, say N.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called oxu210hp-hcd.
+
 config USB_OXU210HP_HCD
 	tristate "OXU210HP HCD support"
 	depends on USB
Index: linux-2.6.25.7/drivers/usb/Kconfig
===================================================================
--- linux-2.6.25.7.orig/drivers/usb/Kconfig	2009-06-26 11:14:00.339248167 +0530
+++ linux-2.6.25.7/drivers/usb/Kconfig	2009-06-26 11:14:06.767248450 +0530
@@ -55,6 +55,7 @@
 	default y if PPC_83xx
 	default y if SOC_AU1200
 	default y if ARCH_IXP4XX
+	default y if MACH_MM6
 	default PCI
 
 # ARM SA1111 chips have a non-PCI based "OHCI-compatible" USB host interface.

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

  Powered by Linux