|
From: Steve L. <slo...@us...> - 2002-05-29 00:23:19
|
Update of /cvsroot/linux-mips/linux/arch/mips/au1000/common
In directory usw-pr-cvs1:/tmp/cvs-serv21710/arch/mips/au1000/common
Modified Files:
Makefile dma.c irq.c usbdev.c
Log Message:
Updates to Au1x00 USB slave support. Split into device layer and two
function-layer drivers, a TTY driver and a raw bidirectional block
driver. Only one IN/OUT block endpoint pair is working correctly
now, so both function-layer drivers have only one bidirectional port.
Index: Makefile
===================================================================
RCS file: /cvsroot/linux-mips/linux/arch/mips/au1000/common/Makefile,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- Makefile 22 Apr 2002 17:45:00 -0000 1.9
+++ Makefile 29 May 2002 00:23:16 -0000 1.10
@@ -19,12 +19,12 @@
O_TARGET := au1000.o
-export-objs = prom.o serial.o clocks.o power.o
+export-objs = prom.o serial.o clocks.o power.o usbdev.o
-obj-y := prom.o int-handler.o dma.o irq.o puts.o time.o reset.o clocks.o power.o
+obj-y := prom.o int-handler.o dma.o irq.o puts.o time.o reset.o \
+ clocks.o power.o usbdev.o
obj-$(CONFIG_AU1000_UART) += serial.o
-obj-$(CONFIG_AU1000_USB_DEVICE) += usbdev.o
obj-$(CONFIG_REMOTE_DEBUG) += dbg_io.o
obj-$(CONFIG_RTC) += rtc.o
Index: dma.c
===================================================================
RCS file: /cvsroot/linux-mips/linux/arch/mips/au1000/common/dma.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- dma.c 1 May 2002 18:00:29 -0000 1.9
+++ dma.c 29 May 2002 00:23:16 -0000 1.10
@@ -104,9 +104,8 @@
for (i = 0; i < NUM_AU1000_DMA_CHANNELS; i++) {
if ((chan = get_dma_chan(i)) != NULL) {
- len +=
- sprintf(buf + len, "%2d: %s\n", i,
- chan->dev_str);
+ len += sprintf(buf + len, "%2d: %s\n",
+ i, chan->dev_str);
}
}
@@ -150,11 +149,15 @@
/*
* Finds a free channel, and binds the requested device to it.
* Returns the allocated channel number, or negative on error.
+ * Requests the DMA done IRQ if irqhandler != NULL.
*/
-int request_au1000_dma(int dev_id, const char *dev_str)
+int request_au1000_dma(int dev_id, const char *dev_str,
+ void (*irqhandler)(int, void *, struct pt_regs *),
+ unsigned long irqflags,
+ void *irq_dev_id)
{
struct dma_chan *chan;
- int i;
+ int i, ret;
if (dev_id < 0 || dev_id >= DMA_NUM_DEV)
return -EINVAL;
@@ -168,14 +171,30 @@
chan = &au1000_dma_table[i];
+ if (irqhandler) {
+ chan->irq = AU1000_DMA_INT_BASE + i;
+ chan->irq_dev = irq_dev_id;
+ if ((ret = request_irq(chan->irq, irqhandler, irqflags,
+ dev_str, chan->irq_dev))) {
+ chan->irq = 0;
+ chan->irq_dev = NULL;
+ return ret;
+ }
+ } else {
+ chan->irq = 0;
+ chan->irq_dev = NULL;
+ }
+
// fill it in
chan->io = DMA_CHANNEL_BASE + i * DMA_CHANNEL_LEN;
- chan->irq = AU1000_DMA_INT_BASE + i;
chan->dev_id = dev_id;
chan->dev_str = dev_str;
chan->fifo_addr = dma_dev_table[dev_id].fifo_addr;
chan->mode = dma_dev_table[dev_id].dma_mode;
+ /* initialize the channel before returning */
+ init_dma(i);
+
return i;
}
@@ -189,6 +208,10 @@
}
disable_dma(dmanr);
-
+ if (chan->irq)
+ free_irq(chan->irq, chan->irq_dev);
+
+ chan->irq = 0;
+ chan->irq_dev = NULL;
chan->dev_id = -1;
-} /* free_dma */
+}
Index: irq.c
===================================================================
RCS file: /cvsroot/linux-mips/linux/arch/mips/au1000/common/irq.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- irq.c 1 May 2002 18:00:29 -0000 1.18
+++ irq.c 29 May 2002 00:23:16 -0000 1.19
@@ -463,19 +463,18 @@
break;
case AU1000_ACSYNC_INT:
case AU1000_AC97C_INT:
- case AU1000_USB_DEV_REQ_INT:
- case AU1000_USB_DEV_SUS_INT:
case AU1000_TOY_INT:
case AU1000_TOY_MATCH0_INT:
case AU1000_TOY_MATCH1_INT:
+ case AU1000_USB_DEV_SUS_INT:
+ case AU1000_USB_DEV_REQ_INT:
case AU1000_RTC_INT:
case AU1000_RTC_MATCH0_INT:
case AU1000_RTC_MATCH1_INT:
case AU1000_RTC_MATCH2_INT:
setup_local_irq(i, INTC_INT_RISE_EDGE, 0);
- irq_desc[i].handler = &rise_edge_irq_type;
- break;
-
+ irq_desc[i].handler = &rise_edge_irq_type;
+ break;
// Careful if you change match 2 request!
// The interrupt handler is called directly
// from the low level dispatch code.
@@ -515,6 +514,17 @@
if (!intc0_req0) return;
+ /*
+ * Because of the tight timing of SETUP token to reply
+ * transactions, the USB devices-side packet complete
+ * interrupt needs the highest priority.
+ */
+ if ((intc0_req0 & (1<<AU1000_USB_DEV_REQ_INT))) {
+ intc0_req0 &= ~(1<<AU1000_USB_DEV_REQ_INT);
+ do_IRQ(AU1000_USB_DEV_REQ_INT, regs);
+ return;
+ }
+
for (i=0; i<32; i++) {
if ((intc0_req0 & (1<<i))) {
intc0_req0 &= ~(1<<i);
Index: usbdev.c
===================================================================
RCS file: /cvsroot/linux-mips/linux/arch/mips/au1000/common/usbdev.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- usbdev.c 1 May 2002 18:00:29 -0000 1.10
+++ usbdev.c 29 May 2002 00:23:16 -0000 1.11
@@ -1,8 +1,8 @@
/*
* BRIEF MODULE DESCRIPTION
- * Au1000 USB Device-Side Serial TTY Driver
+ * Au1000 USB Device-Side (device layer)
*
- * Copyright 2001 MontaVista Software Inc.
+ * Copyright 2001-2002 MontaVista Software Inc.
* Author: MontaVista Software, Inc.
* st...@mv... or so...@mv...
*
@@ -37,9 +37,6 @@
[...2770 lines suppressed...]
- return 0;
-
- err_out:
- usbdev_serial_exit();
- return -1;
+ out:
+ if (ret)
+ usbdev_exit();
+ return ret;
}
-
-module_init(usbdev_serial_init);
-module_exit(usbdev_serial_exit);
+EXPORT_SYMBOL(usbdev_init);
+EXPORT_SYMBOL(usbdev_exit);
+EXPORT_SYMBOL(usbdev_alloc_packet);
+EXPORT_SYMBOL(usbdev_receive_packet);
+EXPORT_SYMBOL(usbdev_send_packet);
+EXPORT_SYMBOL(usbdev_get_byte_count);
|