[svn-commits] sruffell: branch linux/2.6 r10620 - in /linux/branches/2.6/drivers/dahdi: fir...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Apr 2 09:05:20 CDT 2012


Author: sruffell
Date: Mon Apr  2 09:05:17 2012
New Revision: 10620

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=10620
Log:
wctdm24xxp, wcte12xp: Allow VPMOCT032 firmware to be compiled into driver.

Enables the driver to update firmware on systems that do not have the firmware
loader configured / enabled (Linux config option CONFIG_FW_LOADER). Compiling
the firmware into the driver increase the memory footprint by around ~440K.

Internal-Issue-ID: DAHDI-963
Reported-and-Tested-by: Guenther Kelleter
Signed-off-by: Shaun Ruffell <sruffell at digium.com>

Origin: http://svnview.digium.com/svn/dahdi?view=rev&rev=10618

Modified:
    linux/branches/2.6/drivers/dahdi/firmware/Makefile
    linux/branches/2.6/drivers/dahdi/voicebus/Kbuild
    linux/branches/2.6/drivers/dahdi/voicebus/vpmoct.c

Modified: linux/branches/2.6/drivers/dahdi/firmware/Makefile
URL: http://svnview.digium.com/svn/dahdi/linux/branches/2.6/drivers/dahdi/firmware/Makefile?view=diff&rev=10620&r1=10619&r2=10620
==============================================================================
--- linux/branches/2.6/drivers/dahdi/firmware/Makefile (original)
+++ linux/branches/2.6/drivers/dahdi/firmware/Makefile Mon Apr  2 09:05:17 2012
@@ -58,6 +58,7 @@
 OBJECT_FILES:=$(OBJECT_FILES:FIRMWARE-OCT6114-256=dahdi-fw-oct6114-256.o)
 OBJECT_FILES:=$(OBJECT_FILES:FIRMWARE-TC400M=dahdi-fw-tc400m.o)
 OBJECT_FILES:=$(OBJECT_FILES:FIRMWARE-HX8=dahdi-fw-hx8.o)
+OBJECT_FILES:=$(OBJECT_FILES:FIRMWARE-VPMOCT032=dahdi-fw-vpmoct032.o)
 
 # Force usage of wget, for now
 DOWNLOAD=wget
@@ -220,3 +221,8 @@
 dahdi-fw-tc400m.o: dahdi-fw-tc400m-$(TC400M_VERSION).tar.gz dahdi-fw-tc400m.bin make_firmware_object
 	@echo Making firmware object file for dahdi-fw-tc400m.bin
 	./make_firmware_object dahdi-fw-tc400m.bin $@
+
+# Build object file of a VPMOCT032 firmware image for linking
+dahdi-fw-vpmoct032.o: dahdi-fw-vpmoct032-$(VPMOCT032_VERSION).tar.gz dahdi-fw-vpmoct032.bin make_firmware_object
+	@echo Making firmware object file for dahdi-fw-vpmoct032.bin
+	./make_firmware_object dahdi-fw-vpmoct032.bin $@

Modified: linux/branches/2.6/drivers/dahdi/voicebus/Kbuild
URL: http://svnview.digium.com/svn/dahdi/linux/branches/2.6/drivers/dahdi/voicebus/Kbuild?view=diff&rev=10620&r1=10619&r2=10620
==============================================================================
--- linux/branches/2.6/drivers/dahdi/voicebus/Kbuild (original)
+++ linux/branches/2.6/drivers/dahdi/voicebus/Kbuild Mon Apr  2 09:05:17 2012
@@ -2,4 +2,16 @@
 
 dahdi_voicebus-objs := voicebus.o GpakCust.o GpakApi.o voicebus_net.o vpmoct.o
 
-EXTRA_CFLAGS := -I$(src)/.. -Wno-undef
+FIRM_DIR	:= ../firmware
+
+ifneq ($(HOTPLUG_FIRMWARE),yes)
+dahdi_voicebus-objs += $(FIRM_DIR)/dahdi-fw-vpmoct032.o
+else
+  EXTRA_CFLAGS+=-DHOTPLUG_FIRMWARE
+endif
+
+EXTRA_CFLAGS += -I$(src)/.. -Wno-undef
+
+$(obj)/$(FIRM_DIR)/dahdi-fw-vpmoct032.o: $(obj)/voicebus.o
+	$(MAKE) -C $(obj)/$(FIRM_DIR) dahdi-fw-vpmoct032.o
+

Modified: linux/branches/2.6/drivers/dahdi/voicebus/vpmoct.c
URL: http://svnview.digium.com/svn/dahdi/linux/branches/2.6/drivers/dahdi/voicebus/vpmoct.c?view=diff&rev=10620&r1=10619&r2=10620
==============================================================================
--- linux/branches/2.6/drivers/dahdi/voicebus/vpmoct.c (original)
+++ linux/branches/2.6/drivers/dahdi/voicebus/vpmoct.c Mon Apr  2 09:05:17 2012
@@ -443,6 +443,47 @@
 	vpmoct_write_dword(vpm, 0x30, 0);
 }
 
+static const char *const FIRMWARE_NAME = "dahdi-fw-vpmoct032.bin";
+#if defined(HOTPLUG_FIRMWARE)
+static int
+vpmoct_request_firmware(const struct firmware **fw, struct device *dev)
+{
+	return request_firmware(fw, FIRMWARE_NAME, dev);
+}
+
+static void vpmoct_release_firmware(const struct firmware *fw)
+{
+	release_firmware(fw);
+}
+#else
+static int
+vpmoct_request_firmware(const struct firmware **fw_p, struct device *dev)
+{
+	struct firmware *fw;
+	extern void _binary_dahdi_fw_vpmoct032_bin_size;
+	extern u8 _binary_dahdi_fw_vpmoct032_bin_start[];
+
+	*fw_p = fw = kzalloc(sizeof(*fw), GFP_KERNEL);
+	if (!fw)
+		return -ENOMEM;
+
+	fw->data = _binary_dahdi_fw_vpmoct032_bin_start;
+	/* Yes... this is weird. objcopy gives us a symbol containing
+	   the size of the firmware, not a pointer a variable containing the
+	   size. The only way we can get the value of the symbol is to take
+	   its address, so we define it as a pointer and then cast that value
+	   to the proper type.  */
+	fw->size = (size_t) &_binary_dahdi_fw_vpmoct032_bin_size;
+
+	return 0;
+}
+
+static void vpmoct_release_firmware(const struct firmware *fw)
+{
+	kfree(fw);
+}
+#endif
+
 /**
  * vpmoct_load_flash - Check the current flash version and possibly load.
  * @vpm:  The VPMOCT032 module to check / load.
@@ -463,10 +504,9 @@
 	const struct firmware *fw;
 	const struct vpmoct_header *header;
 	char serial[VPMOCT_SERIAL_SIZE+1];
-	const char *const FIRMWARE_NAME = "dahdi-fw-vpmoct032.bin";
 	int i;
 
-	res = request_firmware(&fw, FIRMWARE_NAME, vpm->dev);
+	res = vpmoct_request_firmware(&fw, vpm->dev);
 	if (res) {
 		dev_warn(vpm->dev,
 			 "vpmoct: Failed to load firmware from userspace! %d\n",
@@ -505,7 +545,7 @@
 				 FIRMWARE_NAME);
 
 			/* Just use the old version of the fimware. */
-			release_firmware(fw);
+			vpmoct_release_firmware(fw);
 			vpmoct_set_defaults(vpm);
 			vpmoct_load_complete(work, true);
 			return;
@@ -514,7 +554,7 @@
 		if (vpm->minor == header->minor &&
 		    vpm->major == header->major) {
 			/* Proper version is running */
-			release_firmware(fw);
+			vpmoct_release_firmware(fw);
 			vpmoct_set_defaults(vpm);
 			vpmoct_load_complete(work, true);
 			return;
@@ -548,14 +588,14 @@
 	if (vpmoct_check_firmware_crc(vpm, fw->size-VPMOCT_FIRM_HEADER_LEN*2,
 					header->major, header->minor))
 		goto error;
-	release_firmware(fw);
+	vpmoct_release_firmware(fw);
 	vpmoct_set_defaults(vpm);
 	vpmoct_load_complete(work, true);
 	return;
 
 error:
 	dev_info(vpm->dev, "Unable to load firmware\n");
-	release_firmware(fw);
+	vpmoct_release_firmware(fw);
 	/* TODO: Should we disable module if the firmware doesn't load? */
 	vpmoct_load_complete(work, false);
 	return;




More information about the svn-commits mailing list