All of lore.kernel.org
 help / color / mirror / Atom feed
From: Monty <xiphmont@xiph.org>
To: linux-kernel@vger.kernel.org
Cc: xiphmont@gmail.com
Subject: patch to emi62.c and emi26.c (firmware loaders for Emagic USB audio boxes)
Date: Wed, 3 May 2006 13:24:32 -0400	[thread overview]
Message-ID: <20060503172431.GA6948@localhost.localdomain> (raw)


Hello folks,

(It's been a few years since I've submitted any kernel patches, my
etiquette may be rusty.  Feel free to flame me.  This was not sent to
the listed maintainer as I don't think Tapio's been heard from in some

time.  Correct me if I'm wrong :-)

It's become apparent as machines get faster that the emagic kernel
firmware loaders (based on the ezusb loader) have a reset race.  a
400MHz TiBook never tripped it, but a 2GHz Pentium M seems to hit it

about 30% of the time.  The bug is seen as a hung USB box and the
kernel error:

drivers/usb/misc/emi62.c: emi62_load_firmware - error loading firmware:
error = -110

The patch below inserts a delay after deasserting reset to allow the

box to settle before a new command is issued.  This affects only device
startup.  It's against 2.6.27-rc3, but should apply to any 2.6 kernel;
I don't think the loader has changed for a long time.

(A side note; I notice the firmware loader is using a rather old

firmware version for both devices.  Several relatively harmless but
annoying bugs have since been fixed... how was the firmware from this
device originally extracted?  Was it taken from a device driver
belonging to another OS, or was it provided as a hexdump from emagic?)


Monty

diff -brwu linux-2.6.17-rc3/drivers/usb/misc/emi26.c
linux-2.6.17-rc3-monty/drivers/usb/misc/emi26.c
--- linux-2.6.17-rc3/drivers/usb/misc/emi26.c	2006-04-26
22:19:25.000000000 -0400
+++ linux-2.6.17-rc3-monty
/drivers/usb/misc/emi26.c	2006-05-02
22:22:50.000000000 -0400
@@ -15,6 +15,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/usb.h>
+#include <linux/delay.h>


 #define MAX_INTEL_HEX_RECORD_LENGTH 16
 typedef struct _INTEL_HEX_RECORD
@@ -114,6 +115,7 @@

 	/* De-assert reset (let the CPU run) */
 	err = emi26_set_reset(dev,0);
+	msleep(250); /* let device settle */


 	/* 2. We upload the FPGA firmware into the EMI
 	 * Note: collect up to 1023 (yes!) bytes and send them with
@@ -157,6 +159,7 @@
 		err("%s - error loading firmware: error = %d", __FUNCTION__, err);

 		goto wraperr;
 	}
+	msleep(250); /* let device settle */

 	/* 4. We put the part of the firmware that lies in the external RAM into the EZ-USB */
 	for (i=0; g_Firmware[i].type == 0; i++) {
@@ -192,6 +195,7 @@

 		err("%s - error loading firmware: error = %d", __FUNCTION__, err);
 		goto wraperr;
 	}
+	msleep(250); /* let device settle */

 	/* return 1 to fail the driver inialization
 	 * and give real driver change to load */

diff -brwu linux-2.6.17-rc3/drivers/usb/misc/emi62.c
linux-2.6.17-rc3-monty/drivers/usb/misc/emi62.c
--- linux-2.6.17-rc3/drivers/usb/misc/emi62.c	2006-04-26
22:19:25.000000000 -0400
+++ linux-2.6.17-rc3-monty
/drivers/usb/misc/emi62.c	2006-05-02
22:54:40.000000000 -0400
@@ -15,6 +15,7 @@
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/usb.h>
+#include <linux/delay.h>


 #define MAX_INTEL_HEX_RECORD_LENGTH 16
 typedef struct _INTEL_HEX_RECORD
@@ -123,6 +124,7 @@

 	/* De-assert reset (let the CPU run) */
 	err = emi62_set_reset(dev,0);
+	msleep(250); /* let device settle */


 	/* 2. We upload the FPGA firmware into the EMI
 	 * Note: collect up to 1023 (yes!) bytes and send them with
@@ -166,6 +168,7 @@
 		err("%s - error loading firmware: error = %d", __FUNCTION__, err);

 		goto wraperr;
 	}
+	msleep(250); /* let device settle */

 	/* 4. We put the part of the firmware that lies in the external RAM into the EZ-USB */

@@ -228,6 +231,7 @@
 		err("%s - error loading firmware: error = %d", __FUNCTION__, err);

 		goto wraperr;
 	}
+	msleep(250); /* let device settle */
 
 	kfree(buf);


                 reply	other threads:[~2006-05-03 17:24 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060503172431.GA6948@localhost.localdomain \
    --to=xiphmont@xiph.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xiphmont@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.