Skip to contentSkip to conversation

ip2: use request_firmware()

PATCH In review David Woodhouse 3 participants 16 messages Jun 16, 2008 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ip2: use request_firmware()

Converted with help from Jaswinder Singh

---
 drivers/char/Kconfig           |    7 +
 drivers/char/ip2/fip_firm.h    | 2149 ----------------------------------------
 drivers/char/ip2/ip2base.c     |    5 +-
 drivers/char/ip2/ip2main.c     |   45 +-
 firmware/Makefile              |    1 +
 firmware/WHENCE                |   10 +
 firmware/intelliport2.bin.ihex | 2147 +++++++++++++++++++++++++++++++++++++++
 7 files changed, 2201 insertions(+), 2163 deletions(-)
 delete mode 100644 drivers/char/ip2/fip_firm.h
 create mode 100644 firmware/intelliport2.bin.ihex
drivers/char/Kconfig +7 -0
index 595a925..b15d33d 100644
@@ -121,6 +121,13 @@ config COMPUTONE
 	  To compile this driver as modules, choose M here: the
 	  modules will be called ip2 and ip2main.
 
+config COMPUTONE_FIRMWARE
+	bool "Firmware for Computone IntelliPort Plus serial devices"
+	depends on COMPUTONE
+	---help---
+	  This builds the firmware for the Intelliport Plus devices into the
+	  kernel image. Say 'N' and let it get loaded by udev.
+
 config ROCKETPORT
 	tristate "Comtrol RocketPort support"
 	depends on SERIAL_NONSTANDARD && (ISA || EISA || PCI)
drivers/char/ip2/ip2base.c +2 -3
index 435ccfc..8155e24 100644
@@ -21,10 +21,9 @@
 #endif
 
 #include "ip2types.h"		
-#include "fip_firm.h"		// the meat
 
 int
-ip2_loadmain(int *, int  *, unsigned char *, int ); // ref into ip2main.c
+ip2_loadmain(int *, int *); // ref into ip2main.c
 
 /* Note: Add compiled in defaults to these arrays, not to the structure
 	in ip2.h any longer.  That structure WILL get overridden
@@ -52,7 +51,7 @@ static int __init ip2_init(void)
 		irq[0] = irq[1] = irq[2] = irq[3] = 0;
 	}
 
-	return ip2_loadmain(io,irq,(unsigned char *)fip_firm,sizeof(fip_firm));
+	return ip2_loadmain(io, irq);
 }
 module_init(ip2_init);
 
drivers/char/ip2/ip2main.c +34 -11

103 lines not on this page · raw message

firmware/Makefile +1 -0
index b60c1d3..0266044 100644
@@ -41,6 +41,7 @@ fw-shipped-$(CONFIG_USB_TI_5052_FIRMWARE) += ti_5052.fw
 fw-shipped-$(CONFIG_USB_SERIAL_WHITEHEAT_FIRMWARE) += whiteheat_loader.fw \
 		whiteheat.fw # whiteheat_loader_debug.fw
 fw-shipped-$(CONFIG_ATM_AMBASSADOR_FIRMWARE) += atmsar11.fw
+fw-shipped-$(CONFIG_COMPUTONE_FIRMWARE) += intelliport2.bin
 
 firmware-y    := $(fw-external-y) $(fw-shipped-y)
 firmware-dirs := $(sort $(patsubst %,$(objtree)/$(obj)/%/,$(dir $(firmware-y))))
firmware/WHENCE +10 -0
index f460541..3072854 100644
@@ -226,3 +226,13 @@ Debug loader claims the following behaviour:
 Converted from Intel HEX files, used in our binary representation of ihex.
 
 --------------------------------------------------------------------------
+
+Driver: ip2 -- Computone IntelliPort Plus serial device
+
+File: intelliport2.bin
+
+Licence: Unknown
+
+Found in hex form in kernel source.
+
+--------------------------------------------------------------------------
drivers/char/ip2/fip_firm.h deleted +0 -2149

2,149 lines not on this page · raw message

firmware/intelliport2.bin.ihex new file +2147 -0

696 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 6 lines
1.5.5.1



-- 
dwmw2

Part of the diff is not shown here. View the raw message.

Acked-by on v1 1/1
#1 lore raw
Quoted 14 lines · On Mon, 16 Jun 2008 10:49:11 +0100 David Woodhouse <[email protected]> wrote:

Converted with help from Jaswinder Singh

---
 drivers/char/Kconfig           |    7 +
 drivers/char/ip2/fip_firm.h    | 2149 ----------------------------------------
 drivers/char/ip2/ip2base.c     |    5 +-
 drivers/char/ip2/ip2main.c     |   45 +-
 firmware/Makefile              |    1 +
 firmware/WHENCE                |   10 +
 firmware/intelliport2.bin.ihex | 2147 +++++++++++++++++++++++++++++++++++++++
 7 files changed, 2201 insertions(+), 2163 deletions(-)
 delete mode 100644 drivers/char/ip2/fip_firm.h
 create mode 100644 firmware/intelliport2.bin.ihex

Fine by me. I've not checked all the digits are correct but the rest of the logic seems clean enough

#2 lore raw
Quoted 18 lines · Alan Cox
Quoted 14 lines · On Mon, 16 Jun 2008 10:49:11 +0100 David Woodhouse <[email protected]> wrote:

Converted with help from Jaswinder Singh

---
 drivers/char/Kconfig           |    7 +
 drivers/char/ip2/fip_firm.h    | 2149 ----------------------------------------
 drivers/char/ip2/ip2base.c     |    5 +-
 drivers/char/ip2/ip2main.c     |   45 +-
 firmware/Makefile              |    1 +
 firmware/WHENCE                |   10 +
 firmware/intelliport2.bin.ihex | 2147 +++++++++++++++++++++++++++++++++++++++
 7 files changed, 2201 insertions(+), 2163 deletions(-)
 delete mode 100644 drivers/char/ip2/fip_firm.h
 create mode 100644 firmware/intelliport2.bin.ihex
Quoted 2 lines

Fine by me. I've not checked all the digits are correct but the rest of the logic seems clean enough

Yeah, we're trying to be quite careful with the digits, but I'd be a lot happier when some of this actually gets tested.

It's good that Jaswinder is now helping -- we can each convert the firmware and verify that we come up with the same thing. And while I'm giving a lot of guidance on the _code_ changes, I'm deliberately leaving him to his own devices for that part, as a kind of 'control' :)

Signature · 1 line
dwmw2
#3 lore raw
In reply to Alan Cox
Quoted 18 lines · Alan Cox
Quoted 14 lines · On Mon, 16 Jun 2008 10:49:11 +0100 David Woodhouse <[email protected]> wrote:

Converted with help from Jaswinder Singh

---
 drivers/char/Kconfig           |    7 +
 drivers/char/ip2/fip_firm.h    | 2149 ----------------------------------------
 drivers/char/ip2/ip2base.c     |    5 +-
 drivers/char/ip2/ip2main.c     |   45 +-
 firmware/Makefile              |    1 +
 firmware/WHENCE                |   10 +
 firmware/intelliport2.bin.ihex | 2147 +++++++++++++++++++++++++++++++++++++++
 7 files changed, 2201 insertions(+), 2163 deletions(-)
 delete mode 100644 drivers/char/ip2/fip_firm.h
 create mode 100644 firmware/intelliport2.bin.ihex
Quoted 4 lines

Fine by me. I've not checked all the digits are correct but the rest of the logic seems clean enough

Except for the part where the firmware is pointlessly separated from the driver.

We do not need two parallel driver hierarchies, one for firmware, one for C source.

Jeff

#4 lore raw
Quoted 1 line · Jeff Garzik

Except for the part where the firmware is pointlessly separated from the driver.

...in the kernel source tree, I mean.

No objection to extracting the firmware from the driver.

Driver maintenance will be more of a pain if we have most of a driver <here> in the tree, except for that one crucial piece hiding over <there>.

There is no reason why firmware must be artificially separated into firmware/

Jeff

#5 lore raw
Quoted 2 lines

There is no reason why firmware must be artificially separated into firmware/

It seems a good step towards kicking it all out of the kernel tree into user space where it belongs.

Alan

#6 lore raw
Quoted 4 lines · Alan Cox
Quoted 1 line

There is no reason why firmware must be artificially separated into firmware/

It seems a good step towards kicking it all out of the kernel tree into user space where it belongs.

Why does that goal need a toplevel directory in the kernel source tree, one that ultimately must mirror the other hierarchies already in the tree?

It's better to have drivers/char/ip2.ihex and keep everything related to a single driver in one place.

Extracting the firmware: good

Scattering a /single/ driver across multiple directories in the kernel tree: bad

Jeff

#7 lore raw
Quoted 4 lines

Extracting the firmware: good

Scattering a /single/ driver across multiple directories in the kernel
tree: bad

I'd equally argue that putting all the firmware in one place is more logical than smearing it around the tree.

Whatever - someone can have the 'where do we put it debate' and git does renames.

#8 lore raw
Quoted 6 lines · Alan Cox
Quoted 3 lines

Extracting the firmware: good

Scattering a /single/ driver across multiple directories in the kernel tree: bad

I'd equally argue that putting all the firmware in one place is more logical than smearing it around the tree.

Logical for whom? Drivers have always been self-contained... until now.

This separation certainly does not make things _easier_ for users, our reason for existence. This separation certainly does not make it easier to drop in a driver with a firmware, i.e. not easier on driver developers. It is one more PITA detail when copying a driver from one kernel to another, or shipping the driver out of tree.

There are good reasons why the Makefile rules, Kconfig rules, C source code and headers for a driver all live together... moving the firmware elsewhere is strangely, given that a driver simply /does not work/ without the firmware.

I like the goal, but see little effort in the area of "make this transition painless for users."

Jeff

#9 lore raw

O> This separation certainly does not make things _easier_ for users, our

Quoted 4 lines

reason for existence. This separation certainly does not make it easier to drop in a driver with a firmware, i.e. not easier on driver developers. It is one more PITA detail when copying a driver from one kernel to another, or shipping the driver out of tree.

Users run distributions. The user picture is "I installed it, it worked".

Quoted 2 lines

There are good reasons why the Makefile rules, Kconfig rules, C source code and headers for a driver all live together... moving the firmware

But they don't. Half the headers are in include/, random bits of glue are scattered around the scripts dir.

Quoted 2 lines

I like the goal, but see little effort in the area of "make this transition painless for users."

I think we need to think about "for the technically competent and distro builders". I don't see any connection between the choice of firmware source directory and users at all. They typed make, magic occurred.

Alan

#10 lore raw
In reply to Jeff Garzik
Quoted 9 lines · Jeff Garzik
Quoted 7 lines · Alan Cox
Quoted 4 lines

Extracting the firmware: good

Scattering a /single/ driver across multiple directories in the kernel
tree: bad

I'd equally argue that putting all the firmware in one place is more logical than smearing it around the tree.

Quoted 7 lines

Logical for whom? Drivers have always been self-contained... until now.

This separation certainly does not make things _easier_ for users, our reason for existence. This separation certainly does not make it easier to drop in a driver with a firmware, i.e. not easier on driver developers. It is one more PITA detail when copying a driver from one kernel to another, or shipping the driver out of tree.

When you're doing either of those things, you should be letting request_firmware() do its job. You shouldn't _need_ to build that firmware into your static kernel image.

And if you _do_ want to build arbitrary firmware into your kernel image, you can do that with ease -- with the CONFIG_BUILTIN_FIRMWARE option you can include _whatever_ files you like.

Quoted 4 lines

There are good reasons why the Makefile rules, Kconfig rules, C source code and headers for a driver all live together... moving the firmware elsewhere is strangely, given that a driver simply /does not work/ without the firmware.

We already cope with having separate directories for include/, and with having some stuff split between arch/ and generic locations. In fact, not only do we 'cope', but we _prefer_ it that way. It's logical. And that's for kernel code which really does get modified in lock-step.

We almost _never_ change firmware and driver in lock-step as we do other code. Maybe we'd like to -- but since the firmware is usually an opaque blob, we don't have that luxury. So it really isn't that much of an issue to have the firmware in the firmware/ directory where we've been putting it.

When you have a new firmware blob and you want to update it, it really is no harder this way than it was before. In fact, in most cases I've converted so far, it should be easier. That's certainly the intention.

Quoted 2 lines

I like the goal, but see little effort in the area of "make this transition painless for users."

Actually this choice was made with that as the primary motivation. It makes it easy for 'make firmware_install' to do the right thing, and that should be the primary interface for the user. It also makes it simple to build a 'shadow' git tree, like the kernel-headers tree, which contains _only_ the firmware -- and also to build a GPL-only kernel source tarball which _omits_ it, for whose who want such a thing (like Fedora does).

If you look at my original patches, you'll see that I did _start_ by putting firmware blobs in the source tree next to the drivers, using hex arrays in C code with DECLARE_BUILTIN_FIRMWARE(). I revised that approach when I saw it was better to put them in firmware/ and implement 'make firmware_install' instead. And I stand by that decision.

Signature · 1 line
dwmw2
#11 lore raw
In reply to Jeff Garzik
Quoted 7 lines
Quoted 1 line

Except for the part where the firmware is pointlessly separated from the driver.

We do not need two parallel driver hierarchies, one for firmware, one for C source.

It makes enormous sense to me that we split them up. I don't care about or believe the gnewspeak about licensing some people spew on the issue but as a simple practical consideration:

- I don't want to wade through a ton of hex when looking at the driver
- I don't gain anything but having a ton of hex in the driver files
- I'd rather the ip2 firmware was ultimately loaded and unloaded when needed as it saves us a load of non-pageable RAM.
- The firmware is a separate piece of software run on a separate CPU on a seperate box on a separate card.

So from purely technical perspectives I think the patch is a very good one, and as the nearest thing we have to a serial maintainer it gets my ack. The only thing they share is an agreed API over the ISA/PCI bus - and that isn't defined by peering at the firmware image.

Alan

#12 lore raw
In reply to David Woodhouse
Quoted 5 lines · David Woodhouse
drivers/char/Kconfig +0 -0
index 595a925..b15d33d 100644

drivers/char/Kconfig config COMPUTONE · line 130

Quoted 10 lines
drivers/char/Kconfig +7 -0
@@ -121,6 +121,13 @@ config COMPUTONE
 	  To compile this driver as modules, choose M here: the
 	  modules will be called ip2 and ip2main.
 
+config COMPUTONE_FIRMWARE
+	bool "Firmware for Computone IntelliPort Plus serial devices"
+	depends on COMPUTONE
+	---help---
+	  This builds the firmware for the Intelliport Plus devices into the
+	  kernel image. Say 'N' and let it get loaded by udev.
+

Anyone running 'make oldconfig' could easily skip over this and get a non-usable device, too. Seems like a default 'y' is appropriate for the initial patch...

Jeff

#13 lore raw
Quoted 3 lines

Anyone running 'make oldconfig' could easily skip over this and get a non-usable device, too. Seems like a default 'y' is appropriate for the initial patch...

If you blindly type N N N N to make oldconfig then you have an operator error, and that should be fixed by fixing the operator.

Alan

#14 lore raw
Quoted 4 lines · Alan Cox
Quoted 1 line

Anyone running 'make oldconfig' could easily skip over this and get a non-usable device, too. Seems like a default 'y' is appropriate for the initial patch...

If you blindly type N N N N to make oldconfig then you have an operator error, and that should be fixed by fixing the operator.

Tell that to Linus and Ingo in the E1000 thread.

Jeff

#15 lore raw
Quoted 9 lines · On Mon, 16 Jun 2008 16:22:17 -0400 Jeff Garzik <[email protected]> wrote:
Quoted 6 lines · Alan Cox
Quoted 3 lines

Anyone running 'make oldconfig' could easily skip over this and get a non-usable device, too. Seems like a default 'y' is appropriate for the initial patch...

If you blindly type N N N N to make oldconfig then you have an operator error, and that should be fixed by fixing the operator.

Tell that to Linus and Ingo in the E1000 thread.

Happily - although Ingo is also the one who got ATA breakage by typing Y Y Y Y ;)