linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] UEAGLE : add iso support and commestic stuff
@ 2006-01-13 17:51 matthieu castet
  2006-01-13 18:44 ` Alexey Dobriyan
  0 siblings, 1 reply; 3+ messages in thread
From: matthieu castet @ 2006-01-13 17:51 UTC (permalink / raw)
  To: greg; +Cc: linux-kernel, usbatm, linux-usb-devel, ueagle

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

Hi Greg,

this patch mainly adds the support for isochronous pipe.
There are also some cosmetic stuff (please tell me if you want them in a 
extra patch).

This patch should apply cleanly on top of Duncan patches.


Signed-off-by: Matthieu CASTET <castet.matthieu@free.fr>

[-- Attachment #2: ueagle.diff --]
[-- Type: text/plain, Size: 5271 bytes --]

Index: ueagle-atm.c
===================================================================
--- Linux.orig/drivers/usb/atm/ueagle-atm.c	(.../tags/ueagle-atm-kernel-2.6.15-git1+usbatmpatch)	(révision 240)
+++ Linux/drivers/usb/atm/ueagle-atm.c	(.../branches/ueagle-atm-kernel-patch)	(révision 240)
@@ -67,7 +67,7 @@
 
 #include "usbatm.h"
 
-#define EAGLEUSBVERSION "ueagle 1.1"
+#define EAGLEUSBVERSION "ueagle 1.2"
 
 
 /*
@@ -363,11 +363,14 @@
 
 static int modem_index;
 static unsigned int debug;
+static int use_iso[NB_MODEM] = {[0 ... (NB_MODEM - 1)] = 1};
 static int sync_wait[NB_MODEM];
 static char *cmv_file[NB_MODEM];
 
 module_param(debug, uint, 0644);
 MODULE_PARM_DESC(debug, "module debug level (0=off,1=on,2=verbose)");
+module_param_array(use_iso, bool, NULL, 0644);
+MODULE_PARM_DESC(use_iso, "use isochronous usb pipe for incoming traffic");
 module_param_array(sync_wait, bool, NULL, 0644);
 MODULE_PARM_DESC(sync_wait, "wait the synchronisation before starting ATM");
 module_param_array(cmv_file, charp, NULL, 0644);
@@ -628,8 +631,7 @@
 			dsp_name = FW_DIR "DSPep.bin";
 	}
 
-	ret = request_firmware(&sc->dsp_firm,
-				dsp_name, &sc->usb_dev->dev);
+	ret = request_firmware(&sc->dsp_firm, dsp_name, &sc->usb_dev->dev);
 	if (ret < 0) {
 		uea_err(INS_TO_USBDEV(sc),
 		       "requesting firmware %s failed with error %d\n",
@@ -744,7 +746,6 @@
 		return ret;
 
 	return (ret == 0) ? -ETIMEDOUT : 0;
-
 }
 
 #define UCDC_SEND_ENCAPSULATED_COMMAND 0x00
@@ -935,6 +936,7 @@
 	 * ADI930 don't support it (-EPIPE error).
 	 */
 	if (UEA_CHIP_VERSION(sc) != ADI930
+		    && !use_iso[sc->modem_index]
 		    && sc->stats.phy.dsrate != (data >> 16) * 32) {
 		/* Original timming from ADI(used in windows driver)
 		 * 0x20ffff>>16 * 32 = 32 * 32 = 1Mbits
@@ -1010,7 +1012,7 @@
 	int ret, size;
 	u8 *data;
 	char *file;
-	static char cmv_name[256] = FW_DIR;
+	char cmv_name[FIRMWARE_NAME_MAX]; /* 30 bytes stack variable */
 
 	if (cmv_file[sc->modem_index] == NULL) {
 		if (UEA_CHIP_VERSION(sc) == ADI930)
@@ -1184,8 +1186,7 @@
 		}
 	}
 
-	/* finish to send the fpga
-	 */
+	/* finish to send the fpga */
 	ret = uea_request(sc, 0xe, 1, 0, NULL);
 	if (ret < 0) {
 		uea_err(INS_TO_USBDEV(sc),
@@ -1193,9 +1194,7 @@
 		goto err1;
 	}
 
-	/*
-	 * Tell the modem we finish : de-assert reset
-	 */
+	/* Tell the modem we finish : de-assert reset */
 	value = 0;
 	ret = uea_send_modem_cmd(sc->usb_dev, 0xe, 1, &value);
 	if (ret < 0)
@@ -1209,6 +1208,7 @@
 	return ret;
 }
 
+/* The modem send us an ack. First with check if it right */
 static void uea_dispatch_cmv(struct uea_softc *sc, struct cmv* cmv)
 {
 	uea_enters(INS_TO_USBDEV(sc));
@@ -1268,23 +1268,19 @@
  */
 static void uea_intr(struct urb *urb, struct pt_regs *regs)
 {
-	struct uea_softc *sc = (struct uea_softc *)urb->context;
-	struct intr_pkt *intr;
+	struct uea_softc *sc = urb->context;
+	struct intr_pkt *intr = urb->transfer_buffer;
 	uea_enters(INS_TO_USBDEV(sc));
 
-	if (urb->status < 0) {
+	if (unlikely(urb->status < 0)) {
 		uea_err(INS_TO_USBDEV(sc), "uea_intr() failed with %d\n",
 		       urb->status);
 		return;
 	}
 
-	intr = (struct intr_pkt *) urb->transfer_buffer;
-
 	/* device-to-host interrupt */
 	if (intr->bType != 0x08 || sc->booting) {
-		uea_err(INS_TO_USBDEV(sc), "wrong intr\n");
-		// rebooting ?
-		// sc->reset = 1;
+		uea_err(INS_TO_USBDEV(sc), "wrong interrupt\n");
 		goto resubmit;
 	}
 
@@ -1300,7 +1296,7 @@
 		break;
 
 	default:
-		uea_err(INS_TO_USBDEV(sc), "unknown intr %u\n",
+		uea_err(INS_TO_USBDEV(sc), "unknown interrupt %u\n",
 		       le16_to_cpu(intr->wInterrupt));
 	}
 
@@ -1379,7 +1375,7 @@
 	int ret;
 	uea_enters(INS_TO_USBDEV(sc));
 	ret = kthread_stop(sc->kthread);
-	uea_info(INS_TO_USBDEV(sc), "kthread finish with status %d\n", ret);
+	uea_dbg(INS_TO_USBDEV(sc), "kthread finish with status %d\n", ret);
 
 	/* stop any pending boot process */
 	flush_scheduled_work();
@@ -1636,9 +1632,7 @@
 	if (ret < 0)
 		return ret;
 
-	/* ADI930 has only 2 interfaces and inbound traffic
-	 * is on interface 1
-	 */
+	/* ADI930 has only 2 interfaces and inbound traffic is on interface 1 */
 	if (UEA_CHIP_VERSION(id) != ADI930) {
 		/* interface 2 is for inbound traffic */
 		ret = claim_interface(usb, usbatm, UEA_DS_IFACE_NO);
@@ -1658,6 +1652,25 @@
 	sc->modem_index = (modem_index < NB_MODEM) ? modem_index++ : 0;
 	sc->driver_info = id->driver_info;
 
+	/* ADI930 don't support iso */
+	if (UEA_CHIP_VERSION(id) != ADI930 && use_iso[sc->modem_index]) {
+		int i;
+
+		/* try set fastest alternate for inbound traffic interface */
+		for (i = FASTEST_ISO_INTF; i > 0; i--)
+			if (usb_set_interface(usb, UEA_DS_IFACE_NO, i) == 0)
+				break;
+
+		if (i > 0) {
+			uea_dbg(usb, "set alternate %d for 2 interface\n", i);
+			uea_info(usb, "using iso mode\n");
+			usbatm->flags |= UDSL_USE_ISOC | UDSL_IGNORE_EILSEQ;
+		} else {
+			uea_err(usb, "setting any alternate failed for "
+					"2 interface, using bulk mode\n");
+		}
+	}
+
 	ret = uea_boot(sc);
 	if (ret < 0) {
 		kfree(sc);
@@ -1707,6 +1720,7 @@
 	.heavy_init = uea_heavy,
 	.bulk_in = UEA_BULK_DATA_PIPE,
 	.bulk_out = UEA_BULK_DATA_PIPE,
+	.isoc_in = UEA_ISO_DATA_PIPE,
 };
 
 static int uea_probe(struct usb_interface *intf, const struct usb_device_id *id)

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

* Re: [PATCH] UEAGLE : add iso support and commestic stuff
  2006-01-13 17:51 [PATCH] UEAGLE : add iso support and commestic stuff matthieu castet
@ 2006-01-13 18:44 ` Alexey Dobriyan
  2006-01-14 11:11   ` matthieu castet
  0 siblings, 1 reply; 3+ messages in thread
From: Alexey Dobriyan @ 2006-01-13 18:44 UTC (permalink / raw)
  To: matthieu castet; +Cc: greg, linux-kernel, usbatm, linux-usb-devel, ueagle

On Fri, Jan 13, 2006 at 06:51:30PM +0100, matthieu castet wrote:
> this patch mainly adds the support for isochronous pipe.
> There are also some cosmetic stuff (please tell me if you want them in a
> extra patch).

This patch should be shrinked by >50% by dropping unrelated changes.
It'd make it much easier to read.

> --- Linux.orig/drivers/usb/atm/ueagle-atm.c
> +++ Linux/drivers/usb/atm/ueagle-atm.c
> @@ -628,8 +631,7 @@
>  			dsp_name = FW_DIR "DSPep.bin";
>  	}
>  
> -	ret = request_firmware(&sc->dsp_firm,
> -				dsp_name, &sc->usb_dev->dev);
> +	ret = request_firmware(&sc->dsp_firm, dsp_name, &sc->usb_dev->dev);
>  	if (ret < 0) {
>  		uea_err(INS_TO_USBDEV(sc),
>  		       "requesting firmware %s failed with error %d\n",
> @@ -744,7 +746,6 @@
>  		return ret;
>  
>  	return (ret == 0) ? -ETIMEDOUT : 0;
> -
>  }
>  
>  #define UCDC_SEND_ENCAPSULATED_COMMAND 0x00
> @@ -1184,8 +1186,7 @@
>  		}
>  	}
>  
> -	/* finish to send the fpga
> -	 */
> +	/* finish to send the fpga */
>  	ret = uea_request(sc, 0xe, 1, 0, NULL);
>  	if (ret < 0) {
>  		uea_err(INS_TO_USBDEV(sc),
> @@ -1193,9 +1194,7 @@
>  		goto err1;
>  	}
>  
> -	/*
> -	 * Tell the modem we finish : de-assert reset
> -	 */
> +	/* Tell the modem we finish : de-assert reset */
>  	value = 0;
>  	ret = uea_send_modem_cmd(sc->usb_dev, 0xe, 1, &value);
>  	if (ret < 0)
> @@ -1268,23 +1268,19 @@
>   */
>  static void uea_intr(struct urb *urb, struct pt_regs *regs)
>  {
> -	struct uea_softc *sc = (struct uea_softc *)urb->context;
> -	struct intr_pkt *intr;
> +	struct uea_softc *sc = urb->context;
> +	struct intr_pkt *intr = urb->transfer_buffer;
>  	uea_enters(INS_TO_USBDEV(sc));
>  
> -	if (urb->status < 0) {
> +	if (unlikely(urb->status < 0)) {
>  		uea_err(INS_TO_USBDEV(sc), "uea_intr() failed with %d\n",
>  		       urb->status);
>  		return;
>  	}
>  
> -	intr = (struct intr_pkt *) urb->transfer_buffer;
> -
>  	/* device-to-host interrupt */
>  	if (intr->bType != 0x08 || sc->booting) {
> -		uea_err(INS_TO_USBDEV(sc), "wrong intr\n");
> -		// rebooting ?
> -		// sc->reset = 1;
> +		uea_err(INS_TO_USBDEV(sc), "wrong interrupt\n");
>  		goto resubmit;
>  	}
>  
> @@ -1300,7 +1296,7 @@
>  		break;
>  
>  	default:
> -		uea_err(INS_TO_USBDEV(sc), "unknown intr %u\n",
> +		uea_err(INS_TO_USBDEV(sc), "unknown interrupt %u\n",
>  		       le16_to_cpu(intr->wInterrupt));
>  	}
>  
> @@ -1379,7 +1375,7 @@
>  	int ret;
>  	uea_enters(INS_TO_USBDEV(sc));
>  	ret = kthread_stop(sc->kthread);
> -	uea_info(INS_TO_USBDEV(sc), "kthread finish with status %d\n", ret);
> +	uea_dbg(INS_TO_USBDEV(sc), "kthread finish with status %d\n", ret);
>  
>  	/* stop any pending boot process */
>  	flush_scheduled_work();
> @@ -1636,9 +1632,7 @@
>  	if (ret < 0)
>  		return ret;
>  
> -	/* ADI930 has only 2 interfaces and inbound traffic
> -	 * is on interface 1
> -	 */
> +	/* ADI930 has only 2 interfaces and inbound traffic is on interface 1 */
>  	if (UEA_CHIP_VERSION(id) != ADI930) {
>  		/* interface 2 is for inbound traffic */
>  		ret = claim_interface(usb, usbatm, UEA_DS_IFACE_NO);


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

* Re: [PATCH] UEAGLE : add iso support and commestic stuff
  2006-01-13 18:44 ` Alexey Dobriyan
@ 2006-01-14 11:11   ` matthieu castet
  0 siblings, 0 replies; 3+ messages in thread
From: matthieu castet @ 2006-01-14 11:11 UTC (permalink / raw)
  To: Alexey Dobriyan; +Cc: greg, linux-kernel, usbatm, linux-usb-devel, ueagle

Alexey Dobriyan wrote:
> On Fri, Jan 13, 2006 at 06:51:30PM +0100, matthieu castet wrote:
> 
>>this patch mainly adds the support for isochronous pipe.
>>There are also some cosmetic stuff (please tell me if you want them in a
>>extra patch).
> 
> 
> This patch should be shrinked by >50% by dropping unrelated changes.
> It'd make it much easier to read.
Ok, let's split the patch in iso and comestic stuff.

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

end of thread, other threads:[~2006-01-14 11:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-13 17:51 [PATCH] UEAGLE : add iso support and commestic stuff matthieu castet
2006-01-13 18:44 ` Alexey Dobriyan
2006-01-14 11:11   ` matthieu castet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).