Linux MIPS Architecture development
 help / color / mirror / Atom feed
* [PATCH] au1200 USB - EHCI and OHCI fixes
@ 2006-06-23 16:52 Daniel Mack
  2006-06-23 20:07 ` Ralf Baechle
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Mack @ 2006-06-23 16:52 UTC (permalink / raw)
  To: linux-mips

Dear mips list,

I received an DBAU1200 eval kit from AMD a few days ago and tried to
enable the USB2 port, but the current linux-2.6 GIT did not even
compile with CONFIG_SOC_1200, CONFIG_SOC_AU1X00, CONFIG_USB_EHCI and
CONFIG_USB_OHCI set.
Furthermore, in ehci-hcd.c, platform_driver_register() was called with
an improper argument of type 'struct device_driver *' which of course
ended up in a kernel oops. How could that ever have worked on your
machines?

Anyway, here's a trivial patch that makes the USB subsystem working
on my board for both OHCI and EHCI.
It also removes the /* FIXME use "struct platform_driver" */.

Cheers,
Daniel


Signed-off-by: Daniel Mack <daniel@caiaq.de>

diff --git a/drivers/usb/host/ehci-au1xxx.c b/drivers/usb/host/ehci- 
au1xxx.c
index 9b4697a..aed6ada 100644
--- a/drivers/usb/host/ehci-au1xxx.c
+++ b/drivers/usb/host/ehci-au1xxx.c
@@ -41,8 +41,6 @@
#endif
#define USBH_DISABLE      (USB_MCFG_EBMEN | USB_MCFG_EMEMEN)
-#endif				/* Au1200 */
-
extern int usb_disabled(void);
/ 
*----------------------------------------------------------------------- 
--*/
@@ -107,9 +105,9 @@ int usb_ehci_au1xxx_probe(const struct h
	/* Au1200 AB USB does not support coherent memory */
	if (!(read_c0_prid() & 0xff)) {
-		pr_info("%s: this is chip revision AB!\n", dev->dev.name);
+		pr_info("%s: this is chip revision AB!\n", dev->name);
		pr_info("%s: update your board or re-configure the kernel\n",
-			dev->dev.name);
+			dev->name);
		return -ENODEV;
	}
#endif
@@ -228,9 +226,8 @@ static const struct hc_driver ehci_au1xx
/ 
*----------------------------------------------------------------------- 
--*/
-static int ehci_hcd_au1xxx_drv_probe(struct device *dev)
+static int ehci_hcd_au1xxx_drv_probe(struct platform_device *pdev)
{
-	struct platform_device *pdev = to_platform_device(dev);
	struct usb_hcd *hcd = NULL;
	int ret;
@@ -243,10 +240,9 @@ static int ehci_hcd_au1xxx_drv_probe(str
	return ret;
}
-static int ehci_hcd_au1xxx_drv_remove(struct device *dev)
+static int ehci_hcd_au1xxx_drv_remove(struct platform_device *pdev)
{
-	struct platform_device *pdev = to_platform_device(dev);
-	struct usb_hcd *hcd = dev_get_drvdata(dev);
+	struct usb_hcd *hcd = platform_get_drvdata(pdev);
	usb_ehci_au1xxx_remove(hcd, pdev);
	return 0;
@@ -269,12 +265,13 @@ static int ehci_hcd_au1xxx_drv_resume(st
}
*/
MODULE_ALIAS("au1xxx-ehci");
-/* FIXME use "struct platform_driver" */
-static struct device_driver ehci_hcd_au1xxx_driver = {
-	.name = "au1xxx-ehci",
-	.bus = &platform_bus_type,
+static struct platform_driver ehci_hcd_au1xxx_driver = {
	.probe = ehci_hcd_au1xxx_drv_probe,
	.remove = ehci_hcd_au1xxx_drv_remove,
	/*.suspend      = ehci_hcd_au1xxx_drv_suspend, */
	/*.resume       = ehci_hcd_au1xxx_drv_resume, */
+	.driver = {
+		.name = "au1xxx-ehci",
+		.bus = &platform_bus_type
+	}
};
diff --git a/drivers/usb/host/ohci-au1xxx.c b/drivers/usb/host/ohci- 
au1xxx.c
index a1c8b3b..64c2fb2 100644
--- a/drivers/usb/host/ohci-au1xxx.c
+++ b/drivers/usb/host/ohci-au1xxx.c
@@ -101,6 +101,7 @@ static void au1xxx_start_ohc(struct plat
#endif  /* Au1200 */
+#ifndef CONFIG_SOC_AU1200
	/* wait for reset complete (read register twice; see au1500 errata) */
	while (au_readl(USB_HOST_CONFIG),
		!(au_readl(USB_HOST_CONFIG) & USBH_ENABLE_RD))
@@ -108,6 +109,7 @@ static void au1xxx_start_ohc(struct plat
	printk(KERN_DEBUG __FILE__
	": Clock to USB host has been enabled \n");
+#endif
}
static void au1xxx_stop_ohc(struct platform_device *dev)
@@ -157,9 +159,9 @@ static int usb_ohci_au1xxx_probe(const s
	/* Au1200 AB USB does not support coherent memory */
	if (!(read_c0_prid() & 0xff)) {
		pr_info("%s: this is chip revision AB !!\n",
-			dev->dev.name);
+			dev->name);
		pr_info("%s: update your board or re-configure the kernel\n",
-			dev->dev.name);
+			dev->name);
		return -ENODEV;
	}
#endif

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

* Re: [PATCH] au1200 USB - EHCI and OHCI fixes
  2006-06-23 16:52 [PATCH] au1200 USB - EHCI and OHCI fixes Daniel Mack
@ 2006-06-23 20:07 ` Ralf Baechle
  2006-06-23 20:09   ` Daniel Mack
  0 siblings, 1 reply; 4+ messages in thread
From: Ralf Baechle @ 2006-06-23 20:07 UTC (permalink / raw)
  To: Daniel Mack; +Cc: linux-mips

On Fri, Jun 23, 2006 at 06:52:09PM +0200, Daniel Mack wrote:

> I received an DBAU1200 eval kit from AMD a few days ago and tried to
> enable the USB2 port, but the current linux-2.6 GIT did not even
> compile with CONFIG_SOC_1200, CONFIG_SOC_AU1X00, CONFIG_USB_EHCI and
> CONFIG_USB_OHCI set.
> Furthermore, in ehci-hcd.c, platform_driver_register() was called with
> an improper argument of type 'struct device_driver *' which of course
> ended up in a kernel oops. How could that ever have worked on your
> machines?
> 
> Anyway, here's a trivial patch that makes the USB subsystem working
> on my board for both OHCI and EHCI.
> It also removes the /* FIXME use "struct platform_driver" */.

Patch is looking good but has been linewrapped, can you resend?

  Ralf

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

* Re: [PATCH] au1200 USB - EHCI and OHCI fixes
  2006-06-23 20:07 ` Ralf Baechle
@ 2006-06-23 20:09   ` Daniel Mack
  2006-06-23 20:38     ` Ralf Baechle
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Mack @ 2006-06-23 20:09 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: linux-mips

[-- Attachment #1: Type: text/plain, Size: 319 bytes --]

Hi,

On Jun 23, 2006, at 10:07 PM, Ralf Baechle wrote:

>> Anyway, here's a trivial patch that makes the USB subsystem working
>> on my board for both OHCI and EHCI.
>> It also removes the /* FIXME use "struct platform_driver" */.
>
> Patch is looking good but has been linewrapped, can you resend?

attached.

Daniel


[-- Attachment #2: au1200-usb.patch --]
[-- Type: application/octet-stream, Size: 3204 bytes --]

diff --git a/drivers/usb/host/ehci-au1xxx.c b/drivers/usb/host/ehci-au1xxx.c
index 9b4697a..aed6ada 100644
--- a/drivers/usb/host/ehci-au1xxx.c
+++ b/drivers/usb/host/ehci-au1xxx.c
@@ -41,8 +41,6 @@
 #endif
 #define USBH_DISABLE      (USB_MCFG_EBMEN | USB_MCFG_EMEMEN)
 
-#endif				/* Au1200 */
-
 extern int usb_disabled(void);
 
 /*-------------------------------------------------------------------------*/
@@ -107,9 +105,9 @@ int usb_ehci_au1xxx_probe(const struct h
 
 	/* Au1200 AB USB does not support coherent memory */
 	if (!(read_c0_prid() & 0xff)) {
-		pr_info("%s: this is chip revision AB!\n", dev->dev.name);
+		pr_info("%s: this is chip revision AB!\n", dev->name);
 		pr_info("%s: update your board or re-configure the kernel\n",
-			dev->dev.name);
+			dev->name);
 		return -ENODEV;
 	}
 #endif
@@ -228,9 +226,8 @@ static const struct hc_driver ehci_au1xx
 
 /*-------------------------------------------------------------------------*/
 
-static int ehci_hcd_au1xxx_drv_probe(struct device *dev)
+static int ehci_hcd_au1xxx_drv_probe(struct platform_device *pdev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
 	struct usb_hcd *hcd = NULL;
 	int ret;
 
@@ -243,10 +240,9 @@ static int ehci_hcd_au1xxx_drv_probe(str
 	return ret;
 }
 
-static int ehci_hcd_au1xxx_drv_remove(struct device *dev)
+static int ehci_hcd_au1xxx_drv_remove(struct platform_device *pdev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct usb_hcd *hcd = dev_get_drvdata(dev);
+	struct usb_hcd *hcd = platform_get_drvdata(pdev);
 
 	usb_ehci_au1xxx_remove(hcd, pdev);
 	return 0;
@@ -269,12 +265,13 @@ static int ehci_hcd_au1xxx_drv_resume(st
 }
 */
 MODULE_ALIAS("au1xxx-ehci");
-/* FIXME use "struct platform_driver" */
-static struct device_driver ehci_hcd_au1xxx_driver = {
-	.name = "au1xxx-ehci",
-	.bus = &platform_bus_type,
+static struct platform_driver ehci_hcd_au1xxx_driver = {
 	.probe = ehci_hcd_au1xxx_drv_probe,
 	.remove = ehci_hcd_au1xxx_drv_remove,
 	/*.suspend      = ehci_hcd_au1xxx_drv_suspend, */
 	/*.resume       = ehci_hcd_au1xxx_drv_resume, */
+	.driver = {
+		.name = "au1xxx-ehci",
+		.bus = &platform_bus_type
+	}
 };
diff --git a/drivers/usb/host/ohci-au1xxx.c b/drivers/usb/host/ohci-au1xxx.c
index a1c8b3b..64c2fb2 100644
--- a/drivers/usb/host/ohci-au1xxx.c
+++ b/drivers/usb/host/ohci-au1xxx.c
@@ -101,6 +101,7 @@ static void au1xxx_start_ohc(struct plat
 
 #endif  /* Au1200 */
 
+#ifndef CONFIG_SOC_AU1200
 	/* wait for reset complete (read register twice; see au1500 errata) */
 	while (au_readl(USB_HOST_CONFIG),
 		!(au_readl(USB_HOST_CONFIG) & USBH_ENABLE_RD))
@@ -108,6 +109,7 @@ static void au1xxx_start_ohc(struct plat
 
 	printk(KERN_DEBUG __FILE__
 	": Clock to USB host has been enabled \n");
+#endif
 }
 
 static void au1xxx_stop_ohc(struct platform_device *dev)
@@ -157,9 +159,9 @@ static int usb_ohci_au1xxx_probe(const s
 	/* Au1200 AB USB does not support coherent memory */
 	if (!(read_c0_prid() & 0xff)) {
 		pr_info("%s: this is chip revision AB !!\n",
-			dev->dev.name);
+			dev->name);
 		pr_info("%s: update your board or re-configure the kernel\n",
-			dev->dev.name);
+			dev->name);
 		return -ENODEV;
 	}
 #endif

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

* Re: [PATCH] au1200 USB - EHCI and OHCI fixes
  2006-06-23 20:09   ` Daniel Mack
@ 2006-06-23 20:38     ` Ralf Baechle
  0 siblings, 0 replies; 4+ messages in thread
From: Ralf Baechle @ 2006-06-23 20:38 UTC (permalink / raw)
  To: Daniel Mack; +Cc: linux-mips

On Fri, Jun 23, 2006 at 10:09:45PM +0200, Daniel Mack wrote:

> >Patch is looking good but has been linewrapped, can you resend?
> 
> attached.

Thanks, converted to a useful non-MIME format and forwarded to the
USB maintainers.

  Ralf

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

end of thread, other threads:[~2006-06-23 20:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-23 16:52 [PATCH] au1200 USB - EHCI and OHCI fixes Daniel Mack
2006-06-23 20:07 ` Ralf Baechle
2006-06-23 20:09   ` Daniel Mack
2006-06-23 20:38     ` Ralf Baechle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox