diff -X dontdiff.txt -Naur linux-2.5.20/drivers/usb/host/usb-ohci.c
linux-2.5.20-usbwork/drivers/usb/host/usb-ohci.c
--- linux-2.5.20/drivers/usb/host/usb-ohci.c Sun Jun 2 18:44:44 2002
+++ linux-2.5.20-usbwork/drivers/usb/host/usb-ohci.c Wed Jun 5 17:41:37 2002
@@ -66,7 +66,12 @@
#include <linux/timer.h>
#include <linux/list.h>
#include <linux/interrupt.h> /* for in_interrupt() */
-#undef DEBUG
+
+#ifdef CONFIG_USB_DEBUG
+# define DEBUG
+#else
+# undef DEBUG
+#endif
#include <linux/usb.h>
#include <asm/io.h>
@@ -2391,7 +2396,11 @@
return NULL;
}
ohci->bus->hcpriv = (void *) ohci;
+#ifdef CONFIG_PCI
ohci->bus->bus_name = dev->slot_name;
+#else
+ ohci->bus->bus_name = "ohci-hc";
+#endif
return ohci;
}
@@ -2430,9 +2439,6 @@
ohci_mem_cleanup (ohci);
- /* unmap the IO address space */
- iounmap (ohci->regs);
-
pci_free_consistent (ohci->ohci_dev, sizeof *ohci->hcca,
ohci->hcca, ohci->hcca_dma);
kfree (ohci);
diff -X dontdiff.txt -Naur linux-2.5.20/drivers/usb/host/usb-ohci-pci.c
linux-2.5.20-usbwork/drivers/usb/host/usb-ohci-pci.c
--- linux-2.5.20/drivers/usb/host/usb-ohci-pci.c Sun Jun 2 18:44:51 2002
+++ linux-2.5.20-usbwork/drivers/usb/host/usb-ohci-pci.c Wed Jun 5 18:48:47
+2002
@@ -21,6 +21,12 @@
#endif
#endif
+int __devinit
+hc_add_ohci(struct pci_dev *dev, int irq, void *membase, unsigned long flags,
+ ohci_t **ohci, const char *name, const char *slot_name);
+extern void hc_remove_ohci(ohci_t *ohci);
+extern int hc_start (ohci_t * ohci, struct device *parent_dev);
+extern int hc_reset (ohci_t * ohci);
/*-------------------------------------------------------------------------*/
@@ -103,7 +109,8 @@
ohci->ed_controltail = NULL;
ohci->ed_bulktail = NULL;
- if ((temp = hc_reset (ohci)) < 0 || (temp = hc_start (ohci)) < 0) {
+ if ((temp = hc_reset (ohci)) < 0 ||
+ (temp = hc_start (ohci, &ohci->ohci_dev->dev)) < 0) {
err ("can't restart usb-%s, %d", ohci->ohci_dev->slot_name, temp);
} else
dbg ("restart usb-%s completed", ohci->ohci_dev->slot_name);
@@ -171,6 +178,7 @@
ohci_pci_remove (struct pci_dev *dev)
{
ohci_t *ohci = (ohci_t *) pci_get_drvdata(dev);
+ void *membase = ohci->regs;
dbg ("remove %s controller usb-%s%s%s",
hcfs2string (ohci->hc_control & OHCI_CTRL_HCFS),
@@ -181,6 +189,9 @@
hc_remove_ohci(ohci);
+ /* unmap the IO address space */
+ iounmap (membase);
+
release_mem_region (pci_resource_start (dev, 0), pci_resource_len (dev, 0));
}
diff -X dontdiff.txt -Naur linux-2.5.20/drivers/usb/host/usb-ohci-sa1111.c
linux-2.5.20-usbwork/drivers/usb/host/usb-ohci-sa1111.c
--- linux-2.5.20/drivers/usb/host/usb-ohci-sa1111.c Sun Jun 2 18:44:40 2002
+++ linux-2.5.20-usbwork/drivers/usb/host/usb-ohci-sa1111.c Wed Jun 5 18:44:46
+2002
@@ -12,6 +12,7 @@
#include <linux/interrupt.h>
#include <linux/slab.h>
#include <linux/usb.h>
+#include <linux/pci.h>
#include <linux/errno.h>
#include <asm/hardware.h>
@@ -27,6 +28,9 @@
hc_add_ohci(struct pci_dev *dev, int irq, void *membase, unsigned long flags,
ohci_t **ohci, const char *name, const char *slot_name);
extern void hc_remove_ohci(ohci_t *ohci);
+extern int hc_start (ohci_t * ohci, struct device *parent_dev);
+extern int hc_reset (ohci_t * ohci);
+
static ohci_t *sa1111_ohci;
@@ -34,6 +38,15 @@
{
unsigned int usb_rst = 0;
+ printk(KERN_DEBUG __FILE__
+ ": starting SA-1111 OHCI USB Controller\n");
+
+#ifdef CONFIG_SA1100_BADGE4
+ if (machine_is_badge4())
+ /* power the bus */
+ badge4_set_5V(BADGE4_5V_USB, 1);
+#endif
+
if (machine_is_xp860() ||
machine_has_neponset() ||
machine_is_pfs168() ||
@@ -55,6 +68,28 @@
USB_RESET = usb_rst;
}
+static void __exit sa1111_ohci_unconfigure(void)
+{
+ printk(KERN_DEBUG __FILE__
+ ": stopping SA-1111 OHCI USB Controller\n");
+
+ /*
+ * Put the USB host controller into reset.
+ */
+ USB_RESET |= USB_RESET_FORCEIFRESET | USB_RESET_FORCEHCRESET;
+
+ /*
+ * Stop the USB clock.
+ */
+ SKPCR &= ~SKPCR_UCLKEN;
+
+#ifdef CONFIG_SA1100_BADGE4
+ if (machine_is_badge4())
+ badge4_set_5V(BADGE4_5V_USB, 0);
+#endif
+}
+
+
static int __init sa1111_ohci_init(void)
{
int ret;
@@ -65,66 +100,54 @@
/*
* Request memory resources.
*/
-// if (!request_mem_region(_USB_OHCI_OP_BASE, _USB_EXTENT, "usb-ohci"))
-// return -EBUSY;
+ if (!request_mem_region(_USB_OHCI_OP_BASE, _USB_EXTENT, "usb-ohci"))
+ return -EBUSY;
sa1111_ohci_configure();
/*
* Initialise the generic OHCI driver.
*/
- ret = hc_add_ohci((struct pci_dev *)1, NIRQHCIM,
+ sa1111_ohci = 0;
+ ret = hc_add_ohci(SA1111_FAKE_PCIDEV, NIRQHCIM,
(void *)&USB_OHCI_OP_BASE, 0, &sa1111_ohci,
"usb-ohci", "sa1111");
- if (ret == 0) {
- if (hc_start (sa1111_ohci, &sa1111->dev) < 0) {
- err ("can't start usb-%s", sa1111_ohci->slot_name);
- hc_remove_ohci (sa1111_ohci);
- return -EBUSY;
- }
+ if (ret || !sa1111_ohci) {
+ sa1111_ohci = 0;
+ sa1111_ohci_unconfigure();
+ release_mem_region(_USB_OHCI_OP_BASE, _USB_EXTENT);
+ return -EBUSY;
+ }
-#ifdef DEBUG
- ohci_dump (ohci, 1);
-#endif
-#ifdef CONFIG_SA1100_BADGE4
- if (machine_is_badge4()) {
- /* found the controller, so now power the bus */
- badge4_set_5V(BADGE4_5V_USB, 1);
- }
-#endif
+ if (hc_start (sa1111_ohci, &sa1111->dev) < 0) {
+ err ("can't start usb-%s", sa1111_ohci->slot_name);
+ hc_remove_ohci (sa1111_ohci);
+ sa1111_ohci = 0;
+ sa1111_ohci_unconfigure();
+ release_mem_region(_USB_OHCI_OP_BASE, _USB_EXTENT);
+ return -EBUSY;
}
-// else
-// release_mem_region(_USB_OHCI_OP_BASE, _USB_EXTENT);
- return ret;
+ return 0;
}
static void __exit sa1111_ohci_exit(void)
{
- hc_remove_ohci(sa1111_ohci);
+ printk(KERN_DEBUG __FUNCTION__ ": cleaning up\n");
- /*
- * Put the USB host controller into reset.
- */
- USB_RESET |= USB_RESET_FORCEIFRESET | USB_RESET_FORCEHCRESET;
-
- /*
- * Stop the USB clock.
- */
- SKPCR &= ~SKPCR_UCLKEN;
+ if (sa1111_ohci) {
+ hc_remove_ohci(sa1111_ohci);
+ sa1111_ohci = 0;
+ }
- /*
- * Release memory resources.
- */
-// release_mem_region(_USB_OHCI_OP_BASE, _USB_EXTENT);
+ sa1111_ohci_unconfigure();
+ release_mem_region(_USB_OHCI_OP_BASE, _USB_EXTENT);
-#ifdef CONFIG_SA1100_BADGE4
- if (machine_is_badge4()) {
- badge4_set_5V(BADGE4_5V_USB, 0);
- }
-#endif
+ printk(KERN_DEBUG __FUNCTION__ ": exiting\n");
}
module_init(sa1111_ohci_init);
module_exit(sa1111_ohci_exit);
+
+MODULE_LICENSE("GPL");
_______________________________________________________________
Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel