* fxload patch to set bRequest byte
@ 2005-10-19 1:42 pix
2005-10-20 22:33 ` Greg KH
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: pix @ 2005-10-19 1:42 UTC (permalink / raw)
To: linux-hotplug
[-- Attachment #1: Type: text/plain, Size: 821 bytes --]
hi,
i've just made this patch to fxload which lets you set the bRequest byte
that is used when uploading data via a loader (-r). i needed this to get
the emi26 driver out of the kernel (since it's being removed in some
distributions already for being non-free).
according to the driver code, the emi seems to have an fpga which gets
programmed via the ezusb, but it needs to be accessed with a bRequest of
0xa5.
http://lxr.linux.no/source/drivers/usb/misc/emi26.c
perhaps this patch isn't the most elegant way to achieve this, in which
case, please consider this a feature request for someone to come up with
a better solution ;)
but for what it's worth, the fxload derived loader works for me in at
least one case where the kernel-based version doesn't (when loading the
firmware via a usb2.0 hub).
thanks,
pix.
[-- Attachment #2: fxload.patch --]
[-- Type: text/plain, Size: 5269 bytes --]
Index: fxload/ezusb.c
===================================================================
RCS file: /cvsroot/linux-hotplug/fxload/ezusb.c,v
retrieving revision 1.9
diff -u -r1.9 ezusb.c
--- fxload/ezusb.c 11 Jan 2005 03:58:02 -0000 1.9
+++ fxload/ezusb.c 19 Oct 2005 01:25:09 -0000
@@ -428,6 +428,7 @@
int device;
ram_mode mode;
unsigned total, count;
+ int request;
};
# define RETRY_LIMIT 5
@@ -482,7 +483,7 @@
*/
while ((rc = ezusb_write (ctx->device,
external ? "write external" : "write on-chip",
- external ? RW_MEMORY : RW_INTERNAL,
+ external ? (ctx->request>=0?ctx->request:RW_MEMORY) : RW_INTERNAL,
addr, data, len)) < 0
&& retry < RETRY_LIMIT) {
if (errno != ETIMEDOUT)
@@ -506,7 +507,7 @@
* memory is written, expecting a second stage loader to have already
* been loaded. Then file is re-parsed and on-chip memory is written.
*/
-int ezusb_load_ram (int fd, const char *path, int fx2, int stage)
+int ezusb_load_ram (int fd, const char *path, int fx2, int stage, int request)
{
FILE *image;
unsigned short cpucs_addr;
@@ -550,6 +551,7 @@
/* scan the image, first (maybe only) time */
ctx.device = fd;
ctx.total = ctx.count = 0;
+ ctx.request = request;
status = parse_ihex (image, &ctx, is_external, ram_poke);
if (status < 0) {
logerror("unable to download %s\n", path);
Index: fxload/ezusb.h
===================================================================
RCS file: /cvsroot/linux-hotplug/fxload/ezusb.h,v
retrieving revision 1.3
diff -u -r1.3 ezusb.h
--- fxload/ezusb.h 12 Apr 2002 00:28:21 -0000 1.3
+++ fxload/ezusb.h 19 Oct 2005 01:25:09 -0000
@@ -31,7 +31,7 @@
*
* The target processor is reset at the end of this download.
*/
-extern int ezusb_load_ram (int dev, const char *path, int fx2, int stage);
+extern int ezusb_load_ram (int dev, const char *path, int fx2, int stage, int request);
/*
Index: fxload/main.c
===================================================================
RCS file: /cvsroot/linux-hotplug/fxload/main.c,v
retrieving revision 1.8
diff -u -r1.8 main.c
--- fxload/main.c 11 Jan 2005 03:58:02 -0000 1.8
+++ fxload/main.c 19 Oct 2005 01:25:10 -0000
@@ -30,6 +30,7 @@
* -t <type> -- uController type: an21, fx, fx2
* -s <path> -- use this second stage loader
* -c <byte> -- Download to EEPROM, with this config byte
+ * -r <byte> -- use this request byte for uploading external data
*
* -L <path> -- Create a symbolic link to the device.
* -m <mode> -- Set the permissions on the device after download.
@@ -96,8 +97,9 @@
mode_t mode = 0;
int opt;
int config = -1;
+ int request = -1;
- while ((opt = getopt (argc, argv, "2vV?D:I:L:c:lm:s:t:")) != EOF)
+ while ((opt = getopt (argc, argv, "2vV?D:I:L:c:lm:s:t:r:")) != EOF)
switch (opt) {
case '2': // original version of "-t fx2"
@@ -156,6 +158,14 @@
case 'v':
verbose++;
break;
+
+ case 'r':
+ request = strtoul (optarg, 0, 0);
+ if (request < 0 || request > 255) {
+ logerror("illegal request byte: %s\n", optarg);
+ goto usage;
+ }
+ break;
case '?':
default:
@@ -164,6 +174,11 @@
}
if (config >= 0) {
+ if (request >= 0) {
+ logerror("can't set both a config and a request byte\n");
+ goto usage;
+ }
+
if (type == 0) {
logerror("must specify microcontroller type %s",
"to write EEPROM!\n");
@@ -179,6 +194,14 @@
goto usage;
}
}
+
+ if (request >= 0) {
+ if (!stage1 || !ihex_path) {
+ logerror("need 2nd stage loader and firmware %s",
+ "to use request byte\n");
+ goto usage;
+ }
+ }
if (!device_path) {
logerror("no device specified!\n");
@@ -188,7 +211,7 @@
fputs (" [-vV] [-l] [-t type] [-D devpath]\n", stderr);
fputs ("\t\t[-I firmware_hexfile] ", stderr);
fputs ("[-s loader] [-c config_byte]\n", stderr);
- fputs ("\t\t[-L link] [-m mode]\n", stderr);
+ fputs ("\t\t[-r request_byte] [-L link] [-m mode]\n", stderr);
fputs ("... [-D devpath] overrides DEVICE= in env\n", stderr);
fputs ("... device types: one of an21, fx, fx2\n", stderr);
fputs ("... at least one of -I, -L, -m is required\n", stderr);
@@ -218,7 +241,7 @@
/* first stage: put loader into internal memory */
if (verbose)
logerror("1st stage: load 2nd stage loader\n");
- status = ezusb_load_ram (fd, stage1, fx2, 0);
+ status = ezusb_load_ram (fd, stage1, fx2, 0, request);
if (status != 0)
return status;
@@ -226,14 +249,14 @@
if (config >= 0)
status = ezusb_load_eeprom (fd, ihex_path, type, config);
else
- status = ezusb_load_ram (fd, ihex_path, fx2, 1);
+ status = ezusb_load_ram (fd, ihex_path, fx2, 1, request);
if (status != 0)
return status;
} else {
/* single stage, put into internal memory */
if (verbose)
logerror("single stage: load on-chip memory\n");
- status = ezusb_load_ram (fd, ihex_path, fx2, 0);
+ status = ezusb_load_ram (fd, ihex_path, fx2, 0, request);
if (status != 0)
return status;
}
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: fxload patch to set bRequest byte
2005-10-19 1:42 fxload patch to set bRequest byte pix
@ 2005-10-20 22:33 ` Greg KH
2005-10-22 7:09 ` pix
2005-10-26 22:49 ` Greg KH
2 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2005-10-20 22:33 UTC (permalink / raw)
To: linux-hotplug
On Wed, Oct 19, 2005 at 03:42:59AM +0200, pix wrote:
>
> i needed this to get the emi26 driver out of the kernel (since it's
> being removed in some distributions already for being non-free).
That's just Debian being anal for no good reason. Don't give in to
them, they are just being foolish :)
thanks,
greg k-h
-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: fxload patch to set bRequest byte
2005-10-19 1:42 fxload patch to set bRequest byte pix
2005-10-20 22:33 ` Greg KH
@ 2005-10-22 7:09 ` pix
2005-10-26 22:49 ` Greg KH
2 siblings, 0 replies; 4+ messages in thread
From: pix @ 2005-10-22 7:09 UTC (permalink / raw)
To: linux-hotplug
On Thu, Oct 20, 2005 at 03:33:09PM -0700, Greg KH wrote:
> On Wed, Oct 19, 2005 at 03:42:59AM +0200, pix wrote:
> >
> > i needed this to get the emi26 driver out of the kernel (since it's
> > being removed in some distributions already for being non-free).
>
> That's just Debian being anal for no good reason. Don't give in to
> them, they are just being foolish :)
well i think they are just preparing for the inevitable. you can't have
a kernel claiming to be gpl if it contains code covered by a license
that is not, by any stretch of the imagination, gpl-compatible. so i'm
all for taking it out. but i'm also all for having it still work
somehow and in the emi case it's so trivial i had to do it.
also like i said, this non-kernel method works with my current setup
where the in-kernel method doesn't. i think it's something about the way
tapio was combining sequential bits of the firmware into big writes to
speed things up (producing the not so uncommon -110 error). fxload also
does this, but i guess in a different, more friendly way, that gets
through without errors.
i'll document the full method and put up the necessary files on my
website <http://pix.test.at> soonish, if anyone is interested.
pix.
-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: fxload patch to set bRequest byte
2005-10-19 1:42 fxload patch to set bRequest byte pix
2005-10-20 22:33 ` Greg KH
2005-10-22 7:09 ` pix
@ 2005-10-26 22:49 ` Greg KH
2 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2005-10-26 22:49 UTC (permalink / raw)
To: linux-hotplug
On Sat, Oct 22, 2005 at 09:09:05AM +0200, pix wrote:
> On Thu, Oct 20, 2005 at 03:33:09PM -0700, Greg KH wrote:
> > On Wed, Oct 19, 2005 at 03:42:59AM +0200, pix wrote:
> > >
> > > i needed this to get the emi26 driver out of the kernel (since it's
> > > being removed in some distributions already for being non-free).
> >
> > That's just Debian being anal for no good reason. Don't give in to
> > them, they are just being foolish :)
>
> well i think they are just preparing for the inevitable. you can't have
> a kernel claiming to be gpl if it contains code covered by a license
> that is not, by any stretch of the imagination, gpl-compatible.
Um, but that code is not run on the same processor... Anyway, I don't
want to bring up this age-old argument again.
thanks,
greg k-h
-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-10-26 22:49 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-19 1:42 fxload patch to set bRequest byte pix
2005-10-20 22:33 ` Greg KH
2005-10-22 7:09 ` pix
2005-10-26 22:49 ` Greg KH
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).