Commit db4b1c4a authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

USB OHCI driver: Added SA1111 support

  
Added the patch from Russell King <rmk@arm.linux.org.uk> that splits
the usb-ohci driver into two pieces, enabling the sa1111 hardware to
work with the driver.
  
I also added some changes to get the usb-ohci-pci.o module to build
and run properly.
parent 1138d8a0
......@@ -4,7 +4,13 @@
mainmenu_option next_comment
comment 'USB support'
dep_tristate 'Support for USB' CONFIG_USB $CONFIG_PCI
# ARM SA1111 chips have a non-PCI based "OHCI-compatible" USB host interface.
if [ "$CONFIG_PCI" = "y" -o "$CONFIG_SA1111" = "y" ]; then
tristate 'Support for USB' CONFIG_USB
else
define_bool CONFIG_USB n
fi
if [ "$CONFIG_USB" = "y" -o "$CONFIG_USB" = "m" ]; then
source drivers/usb/core/Config.in
......
......@@ -6,9 +6,11 @@
mod-subdirs := serial
obj-$(CONFIG_USB) += core/
obj-$(CONFIG_USB_EHCI_HCD) += host/
obj-$(CONFIG_USB_OHCI_HCD) += host/
obj-$(CONFIG_USB_OHCI) += host/
obj-$(CONFIG_USB_OHCI_SA1111) += host/
obj-$(CONFIG_USB_SL811HS) += host/
obj-$(CONFIG_USB_UHCI_ALT) += host/
obj-$(CONFIG_USB_UHCI_HCD_ALT) += host/
......
......@@ -20,5 +20,6 @@ fi
#fi
#dep_tristate ' OHCI (Compaq, iMacs, OPTi, SiS, ALi, ...) support' CONFIG_USB_OHCI $CONFIG_USB
if [ "$CONFIG_ARM" = "y" ]; then
dep_tristate ' SA1111 OHCI-compatible host interface support' CONFIG_USB_OHCI_SA1111 $CONFIG_USB
dep_tristate ' SL811HS support' CONFIG_USB_SL811HS $CONFIG_USB
fi
......@@ -3,6 +3,8 @@
# framework and drivers
#
export-objs := usb-ohci.o
obj-$(CONFIG_USB_EHCI_HCD) += ehci-hcd.o
obj-$(CONFIG_USB_OHCI_HCD) += ohci-hcd.o
obj-$(CONFIG_USB_UHCI_HCD) += usb-uhci-hcd.o
......@@ -10,7 +12,8 @@ obj-$(CONFIG_USB_UHCI_HCD_ALT) += uhci-hcd.o
obj-$(CONFIG_USB_UHCI) += usb-uhci.o
obj-$(CONFIG_USB_UHCI_ALT) += uhci.o
obj-$(CONFIG_USB_OHCI) += usb-ohci.o
obj-$(CONFIG_USB_OHCI) += usb-ohci.o usb-ohci-pci.o
obj-$(CONFIG_USB_OHCI_SA1111) += usb-ohci.o usb-ohci-sa1111.o
obj-$(CONFIG_USB_SL811HS) += hc_sl811.o
include $(TOPDIR)/Rules.make
This diff is collapsed.
/*
* linux/drivers/usb/usb-ohci-sa1111.c
*
* The outline of this code was taken from Brad Parkers <brad@heeltoe.com>
* original OHCI driver modifications, and reworked into a cleaner form
* by Russell King <rmk@arm.linux.org.uk>.
*/
#include <linux/module.h>
#include <linux/init.h>
#include <linux/sched.h>
#include <linux/ioport.h>
#include <linux/interrupt.h>
#include <linux/slab.h>
#include <linux/usb.h>
#include <linux/errno.h>
#include <asm/hardware.h>
#include <asm/irq.h>
#include <asm/io.h>
#include <asm/arch/assabet.h>
#include <asm/arch/badge4.h>
#include <asm/hardware/sa1111.h>
#include "usb-ohci.h"
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);
static ohci_t *sa1111_ohci;
static void __init sa1111_ohci_configure(void)
{
unsigned int usb_rst = 0;
if (machine_is_xp860() ||
machine_has_neponset() ||
machine_is_pfs168() ||
machine_is_badge4())
usb_rst = USB_RESET_PWRSENSELOW | USB_RESET_PWRCTRLLOW;
/*
* Configure the power sense and control lines. Place the USB
* host controller in reset.
*/
USB_RESET = usb_rst | USB_RESET_FORCEIFRESET | USB_RESET_FORCEHCRESET;
/*
* Now, carefully enable the USB clock, and take
* the USB host controller out of reset.
*/
SKPCR |= SKPCR_UCLKEN;
udelay(11);
USB_RESET = usb_rst;
}
static int __init sa1111_ohci_init(void)
{
int ret;
if (!sa1111)
return -ENODEV;
/*
* Request memory resources.
*/
// 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,
(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;
}
#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
}
// else
// release_mem_region(_USB_OHCI_OP_BASE, _USB_EXTENT);
return ret;
}
static void __exit sa1111_ohci_exit(void)
{
hc_remove_ohci(sa1111_ohci);
/*
* Put the USB host controller into reset.
*/
USB_RESET |= USB_RESET_FORCEIFRESET | USB_RESET_FORCEHCRESET;
/*
* Stop the USB clock.
*/
SKPCR &= ~SKPCR_UCLKEN;
/*
* Release memory resources.
*/
// 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
}
module_init(sa1111_ohci_init);
module_exit(sa1111_ohci_exit);
This diff is collapsed.
......@@ -403,6 +403,7 @@ typedef struct ohci {
/* PCI device handle, settings, ... */
struct pci_dev *ohci_dev;
const char *slot_name;
u8 pci_latency;
struct pci_pool *td_cache;
struct pci_pool *dev_cache;
......@@ -423,6 +424,10 @@ struct ohci_device {
// #define ohci_to_usb(ohci) ((ohci)->usb)
#define usb_to_ohci(usb) ((struct ohci_device *)(usb)->hcpriv)
/* For initializing controller (mask in an HCFS mode too) */
#define OHCI_CONTROL_INIT \
(OHCI_CTRL_CBSR & 0x3) | OHCI_CTRL_IE | OHCI_CTRL_PLE
/* hcd */
/* endpoint */
static int ep_link(ohci_t * ohci, ed_t * ed);
......@@ -447,11 +452,6 @@ static int rh_init_int_timer(struct urb * urb);
# define OHCI_MEM_FLAGS 0
#endif
#ifndef CONFIG_PCI
# error "usb-ohci currently requires PCI-based controllers"
/* to support non-PCI OHCIs, you need custom bus/mem/... glue */
#endif
/* Recover a TD/ED using its collision chain */
static void *
......@@ -641,3 +641,8 @@ dev_free (struct ohci *hc, struct ohci_device *dev)
pci_pool_free (hc->dev_cache, dev, dev->dma);
}
extern spinlock_t usb_ed_lock;
extern void dl_done_list (ohci_t * ohci, td_t * td_list);
extern td_t * dl_reverse_done_list (ohci_t * ohci);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment