All of lore.kernel.org
 help / color / mirror / Atom feed
* ohci-au1xxx.c cleanups and fix for 2.6.10-rc1
@ 2004-11-05  8:19 Herbert Valerio Riedel
  2004-11-05  8:23 ` Pete Popov
  2004-11-05 14:18 ` Matt Porter
  0 siblings, 2 replies; 4+ messages in thread
From: Herbert Valerio Riedel @ 2004-11-05  8:19 UTC (permalink / raw)
  To: Pete Popov; +Cc: linux-mips


below just a patch to have usb working again for 2.6.10-rc1 and some minor cleanups...
(alas usb still doesn't work on big endian...)

Index: ohci-au1xxx.c
===================================================================
RCS file: /home/cvs/linux/drivers/usb/host/ohci-au1xxx.c,v
retrieving revision 1.1
diff -u -r1.1 ohci-au1xxx.c
--- ohci-au1xxx.c	10 Oct 2004 17:56:25 -0000	1.1
+++ ohci-au1xxx.c	5 Nov 2004 08:15:05 -0000
@@ -20,6 +20,21 @@
 
 #include <asm/mach-au1x00/au1000.h>
 
+#define USBH_ENABLE_BE (1<<0)
+#define USBH_ENABLE_C  (1<<1)
+#define USBH_ENABLE_E  (1<<2)
+#define USBH_ENABLE_CE (1<<3)
+#define USBH_ENABLE_RD (1<<4)
+
+// shall we set USBH_ENABLE_C depending on !CONFIG_NONCOHERENT?
+#ifdef __LITTLE_ENDIAN
+# define USBH_ENABLE_INIT (USBH_ENABLE_CE | USBH_ENABLE_E | USBH_ENABLE_C)
+#elif __BIG_ENDIAN
+# define USBH_ENABLE_INIT (USBH_ENABLE_CE | USBH_ENABLE_E | USBH_ENABLE_C | USBH_ENABLE_BE)
+#else
+# error not byte order defined
+#endif
+
 extern int usb_disabled(void);
 
 /*-------------------------------------------------------------------------*/
@@ -30,18 +45,17 @@
 	       ": starting Au1xxx OHCI USB Controller\n");
 
 	/* enable host controller */
-	au_writel(0x00000008, USB_HOST_CONFIG);
+	au_writel(USBH_ENABLE_CE, USB_HOST_CONFIG);
 	udelay(1000);
-	au_writel(0x0000000e, USB_HOST_CONFIG);
+	au_writel(USBH_ENABLE_INIT, USB_HOST_CONFIG);
 	udelay(1000);
 
-	/* wait for reset complete */
-	au_readl(USB_HOST_CONFIG); /* throw away first read */
-	while (!(au_readl(USB_HOST_CONFIG) & 0x10))
-		au_readl(USB_HOST_CONFIG);
+	/* wait for reset complete (read register twice; see to au1500 errata) */
+	while (au_readl(USB_HOST_CONFIG), !(au_readl(USB_HOST_CONFIG) & USBH_ENABLE_RD)) 
+	  udelay(1000);
 
 	printk(KERN_DEBUG __FILE__
-		   ": Clock to USB host has been enabled \n");
+	       ": Clock to USB host has been enabled \n");
 }
 
 static void au1xxx_stop_hc(struct platform_device *dev)
@@ -49,9 +63,8 @@
 	printk(KERN_DEBUG __FILE__
 	       ": stopping Au1xxx OHCI USB Controller\n");
 
-
 	/* Disable clock */
-	au_writel(readl(USB_HOST_CONFIG) & 0xffffff7, USB_HOST_CONFIG);
+	au_writel(readl(USB_HOST_CONFIG) & ~(USBH_ENABLE_RD | USBH_ENABLE_CE), USB_HOST_CONFIG);
 }
 
 
@@ -234,37 +247,15 @@
 
 	ohci_dbg (ohci, "ohci_au1xxx_start, ohci:%p", ohci);
 			
-	ohci->hcca = dma_alloc_noncoherent (hcd->self.controller,
-			sizeof *ohci->hcca, &ohci->hcca_dma, 0);
-	if (!ohci->hcca)
-		return -ENOMEM;
-
-	ohci_dbg (ohci, "ohci_au1xxx_start, ohci->hcca:%p",
-			ohci->hcca);
-
-	memset (ohci->hcca, 0, sizeof (struct ohci_hcca));
-
-	if ((ret = ohci_mem_init (ohci)) < 0) {
-		ohci_stop (hcd);
+	if ((ret = ohci_init (ohci)) < 0)
 		return ret;
-	}
-	ohci->regs = hcd->regs;
 
-	if (hc_reset (ohci) < 0) {
-		ohci_stop (hcd);
-		return -ENODEV;
-	}
-
-	if (hc_start (ohci) < 0) {
+	if ((ret = ohci_run (ohci)) < 0) {
 		err ("can't start %s", ohci->hcd.self.bus_name);
 		ohci_stop (hcd);
-		return -EBUSY;
+		return ret;
 	}
-	create_debug_files (ohci);
 
-#ifdef	DEBUG
-	ohci_dump (ohci, 1);
-#endif /*DEBUG*/
 	return 0;
 }
 



-- 
Herbert Valerio Riedel <hvr@inso.tuwien.ac.at>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: ohci-au1xxx.c cleanups and fix for 2.6.10-rc1
  2004-11-05  8:19 ohci-au1xxx.c cleanups and fix for 2.6.10-rc1 Herbert Valerio Riedel
@ 2004-11-05  8:23 ` Pete Popov
  2004-11-05 14:18 ` Matt Porter
  1 sibling, 0 replies; 4+ messages in thread
From: Pete Popov @ 2004-11-05  8:23 UTC (permalink / raw)
  To: Herbert Valerio Riedel, Pete Popov; +Cc: linux-mips


Thanks. We were just working on that too.

Pete

--- Herbert Valerio Riedel <hvr@inso.tuwien.ac.at>
wrote:

> 
> below just a patch to have usb working again for
> 2.6.10-rc1 and some minor cleanups...
> (alas usb still doesn't work on big endian...)
> 
> Index: ohci-au1xxx.c
>
===================================================================
> RCS file:
> /home/cvs/linux/drivers/usb/host/ohci-au1xxx.c,v
> retrieving revision 1.1
> diff -u -r1.1 ohci-au1xxx.c
> --- ohci-au1xxx.c	10 Oct 2004 17:56:25 -0000	1.1
> +++ ohci-au1xxx.c	5 Nov 2004 08:15:05 -0000
> @@ -20,6 +20,21 @@
>  
>  #include <asm/mach-au1x00/au1000.h>
>  
> +#define USBH_ENABLE_BE (1<<0)
> +#define USBH_ENABLE_C  (1<<1)
> +#define USBH_ENABLE_E  (1<<2)
> +#define USBH_ENABLE_CE (1<<3)
> +#define USBH_ENABLE_RD (1<<4)
> +
> +// shall we set USBH_ENABLE_C depending on
> !CONFIG_NONCOHERENT?
> +#ifdef __LITTLE_ENDIAN
> +# define USBH_ENABLE_INIT (USBH_ENABLE_CE |
> USBH_ENABLE_E | USBH_ENABLE_C)
> +#elif __BIG_ENDIAN
> +# define USBH_ENABLE_INIT (USBH_ENABLE_CE |
> USBH_ENABLE_E | USBH_ENABLE_C | USBH_ENABLE_BE)
> +#else
> +# error not byte order defined
> +#endif
> +
>  extern int usb_disabled(void);
>  
> 
>
/*-------------------------------------------------------------------------*/
> @@ -30,18 +45,17 @@
>  	       ": starting Au1xxx OHCI USB Controller\n");
>  
>  	/* enable host controller */
> -	au_writel(0x00000008, USB_HOST_CONFIG);
> +	au_writel(USBH_ENABLE_CE, USB_HOST_CONFIG);
>  	udelay(1000);
> -	au_writel(0x0000000e, USB_HOST_CONFIG);
> +	au_writel(USBH_ENABLE_INIT, USB_HOST_CONFIG);
>  	udelay(1000);
>  
> -	/* wait for reset complete */
> -	au_readl(USB_HOST_CONFIG); /* throw away first
> read */
> -	while (!(au_readl(USB_HOST_CONFIG) & 0x10))
> -		au_readl(USB_HOST_CONFIG);
> +	/* wait for reset complete (read register twice;
> see to au1500 errata) */
> +	while (au_readl(USB_HOST_CONFIG),
> !(au_readl(USB_HOST_CONFIG) & USBH_ENABLE_RD)) 
> +	  udelay(1000);
>  
>  	printk(KERN_DEBUG __FILE__
> -		   ": Clock to USB host has been enabled \n");
> +	       ": Clock to USB host has been enabled \n");
>  }
>  
>  static void au1xxx_stop_hc(struct platform_device
> *dev)
> @@ -49,9 +63,8 @@
>  	printk(KERN_DEBUG __FILE__
>  	       ": stopping Au1xxx OHCI USB Controller\n");
>  
> -
>  	/* Disable clock */
> -	au_writel(readl(USB_HOST_CONFIG) & 0xffffff7,
> USB_HOST_CONFIG);
> +	au_writel(readl(USB_HOST_CONFIG) &
> ~(USBH_ENABLE_RD | USBH_ENABLE_CE),
> USB_HOST_CONFIG);
>  }
>  
>  
> @@ -234,37 +247,15 @@
>  
>  	ohci_dbg (ohci, "ohci_au1xxx_start, ohci:%p",
> ohci);
>  			
> -	ohci->hcca = dma_alloc_noncoherent
> (hcd->self.controller,
> -			sizeof *ohci->hcca, &ohci->hcca_dma, 0);
> -	if (!ohci->hcca)
> -		return -ENOMEM;
> -
> -	ohci_dbg (ohci, "ohci_au1xxx_start,
> ohci->hcca:%p",
> -			ohci->hcca);
> -
> -	memset (ohci->hcca, 0, sizeof (struct ohci_hcca));
> -
> -	if ((ret = ohci_mem_init (ohci)) < 0) {
> -		ohci_stop (hcd);
> +	if ((ret = ohci_init (ohci)) < 0)
>  		return ret;
> -	}
> -	ohci->regs = hcd->regs;
>  
> -	if (hc_reset (ohci) < 0) {
> -		ohci_stop (hcd);
> -		return -ENODEV;
> -	}
> -
> -	if (hc_start (ohci) < 0) {
> +	if ((ret = ohci_run (ohci)) < 0) {
>  		err ("can't start %s", ohci->hcd.self.bus_name);
>  		ohci_stop (hcd);
> -		return -EBUSY;
> +		return ret;
>  	}
> -	create_debug_files (ohci);
>  
> -#ifdef	DEBUG
> -	ohci_dump (ohci, 1);
> -#endif /*DEBUG*/
>  	return 0;
>  }
>  
> 
> 
> 
> -- 
> Herbert Valerio Riedel <hvr@inso.tuwien.ac.at>
> 
> 
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: ohci-au1xxx.c cleanups and fix for 2.6.10-rc1
  2004-11-05  8:19 ohci-au1xxx.c cleanups and fix for 2.6.10-rc1 Herbert Valerio Riedel
  2004-11-05  8:23 ` Pete Popov
@ 2004-11-05 14:18 ` Matt Porter
  2004-11-11 12:58   ` Herbert Valerio Riedel
  1 sibling, 1 reply; 4+ messages in thread
From: Matt Porter @ 2004-11-05 14:18 UTC (permalink / raw)
  To: Herbert Valerio Riedel; +Cc: Pete Popov, linux-mips

On Fri, Nov 05, 2004 at 09:19:34AM +0100, Herbert Valerio Riedel wrote:
> 
> below just a patch to have usb working again for 2.6.10-rc1 and
> some minor cleanups...
> (alas usb still doesn't work on big endian...)

The patches to support BE OHCI operation were posted months ago on
the USB list.  GregKH recently picked them up and I just saw the
first of them merged to the mainline tree. You should have better
luck with BE OHCI soon. :)

-Matt

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: ohci-au1xxx.c cleanups and fix for 2.6.10-rc1
  2004-11-05 14:18 ` Matt Porter
@ 2004-11-11 12:58   ` Herbert Valerio Riedel
  0 siblings, 0 replies; 4+ messages in thread
From: Herbert Valerio Riedel @ 2004-11-11 12:58 UTC (permalink / raw)
  To: Matt Porter; +Cc: Pete Popov, linux-mips

On Fri, 2004-11-05 at 07:18 -0700, Matt Porter wrote:
> On Fri, Nov 05, 2004 at 09:19:34AM +0100, Herbert Valerio Riedel wrote:
> > 
> > below just a patch to have usb working again for 2.6.10-rc1 and
> > some minor cleanups...
> > (alas usb still doesn't work on big endian...)
> 
> The patches to support BE OHCI operation were posted months ago on
> the USB list.  GregKH recently picked them up and I just saw the
> first of them merged to the mainline tree. You should have better
> luck with BE OHCI soon. :)

I've played w/ the upcoming patches for 2.6.10-rc2 contained in the bk
snapshots, and was able to confirm that better luck is really in sight
for me (wrt to USB/BE)  :-) 

USB worked fine w/ mouse and some usb-storage ram module, I'd be glad to
provide you w/ the required modifications (if necessary) as soon as
2.6.10-rc2 comes out and get merged into linux-mips cvs...

now I just need to find how to fix that subtle pci w/ BE issue I'm
having w/ pci-device subfunctions disappearing in BE mode...

greetings,
-- 
Herbert Valerio Riedel <hvr@inso.tuwien.ac.at>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-11-11 12:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-05  8:19 ohci-au1xxx.c cleanups and fix for 2.6.10-rc1 Herbert Valerio Riedel
2004-11-05  8:23 ` Pete Popov
2004-11-05 14:18 ` Matt Porter
2004-11-11 12:58   ` Herbert Valerio Riedel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.