From: Jochen Friedrich <jochen@scram.de>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>
Subject: tms380tr patch 3/3 (get firmware out of kernel)
Date: Sun, 8 Feb 2004 23:52:55 +0100 (CET) [thread overview]
Message-ID: <Pine.LNX.4.58.0402082349470.1327@localhost> (raw)
Hi Jeff,
the last one makes tms380tr use the kernel firmware loader instead of
linking some propriatary code into the kernel, probably violating the
GPL.
drivers/net/tokenring/tms380tr_microcode.h can go after this patch has
been applied.
--jochen
tms380tr.c | 34 ++++++++++++++++++++++++++++++----
1 files changed, 30 insertions(+), 4 deletions(-)
diff -u -p -r1.17 tms380tr.c
--- drivers/net/tokenring/tms380tr.c 2004-02-08 23:29:18.000000000 +0100
+++ drivers/net/tokenring/tms380tr.c 2004-02-08 11:09:38.000000000 +0100
@@ -95,6 +95,7 @@ static const char version[] = "tms380tr.
#include <linux/etherdevice.h>
#include <linux/skbuff.h>
#include <linux/trdevice.h>
+#include <linux/firmware.h>
#include <asm/system.h>
#include <asm/bitops.h>
@@ -104,7 +105,6 @@ static const char version[] = "tms380tr.
#include <asm/uaccess.h>
#include "tms380tr.h" /* Our Stuff */
-#include "tms380tr_microcode.h" /* TI microcode for COMMprocessor */
/* Use 0 for production, 1 for verification, 2 for debug, and
* 3 for very verbose debug.
@@ -114,6 +114,8 @@ static const char version[] = "tms380tr.
#endif
static unsigned int tms380tr_debug = TMS380TR_DEBUG;
+static struct device tms_device;
+
/* Index to functions, as function prototypes.
* Alphabetical by function name.
*/
@@ -1301,8 +1279,20 @@ static void tms380tr_exec_sifcmd(struct
static int tms380tr_reset_adapter(struct net_device *dev)
{
struct net_local *tp = (struct net_local *)dev->priv;
- unsigned short *fw_ptr = (unsigned short *)&tms380tr_code;
- unsigned short count, c;
+ unsigned short *fw_ptr;
+ unsigned short count, c, count2;
+ const struct firmware *fw_entry = NULL;
+
+ strncpy(tms_device.bus_id,dev->name, BUS_ID_SIZE);
+
+ if (request_firmware(&fw_entry, "tms380tr.bin", &tms_device) != 0) {
+ printk(KERN_ALERT "%s: firmware %s is missing, cannot start.\n",
+ dev->name, "tms380tr.bin");
+ return (-1);
+ }
+
+ fw_ptr = (unsigned short *)fw_entry->data;
+ count2 = fw_entry->size / 2;
/* Hardware adapter reset */
SIFWRITEW(ACL_ARESET, SIFACL);
@@ -1329,23 +1319,31 @@ static int tms380tr_reset_adapter(struct
SIFWRITEW(c, SIFACL);
tms380tr_wait(40);
+ count = 0;
/* Download firmware via DIO interface: */
do {
+ if (count2 < 3) continue;
+
/* Download first address part */
SIFWRITEW(*fw_ptr, SIFADX);
fw_ptr++;
-
+ count2--;
/* Download second address part */
SIFWRITEW(*fw_ptr, SIFADD);
fw_ptr++;
+ count2--;
if((count = *fw_ptr) != 0) /* Load loop counter */
{
fw_ptr++; /* Download block data */
+ count2--;
+ if (count > count2) continue;
+
for(; count > 0; count--)
{
SIFWRITEW(*fw_ptr, SIFINC);
fw_ptr++;
+ count2--;
}
}
else /* Stop, if last block downloaded */
@@ -1355,10 +1353,14 @@ static int tms380tr_reset_adapter(struct
/* Clear CPHALT and start BUD */
SIFWRITEW(c, SIFACL);
+ if (fw_entry)
+ release_firmware(fw_entry);
return (1);
}
} while(count == 0);
+ if (fw_entry)
+ release_firmware(fw_entry);
printk(KERN_INFO "%s: Adapter Download Failed\n", dev->name);
return (-1);
}
reply other threads:[~2004-02-08 22:53 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=Pine.LNX.4.58.0402082349470.1327@localhost \
--to=jochen@scram.de \
--cc=jgarzik@pobox.com \
--cc=linux-kernel@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®