summaryrefslogtreecommitdiff
path: root/wctc4xxp
diff options
context:
space:
mode:
authorkpfleming <kpfleming@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-12-08 17:04:11 +0000
committerkpfleming <kpfleming@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-12-08 17:04:11 +0000
commitdb2602ee74c907582858c1225bb0fffffe604a00 (patch)
treef08c566c96008fdca60d6231c653f4804ad5e263 /wctc4xxp
parentb6c017d1b25f9621fd6738419b6cd1377ca6eb3e (diff)
clean up firmware handling across wct4xxp, wctc4xxp, wctdm24xxp and wcte12xp drivers to use consistent methods
add non-hotplug firmware loading support to wctdm24xxp and wcte12xp add license and copyright headers to various files that did not have them clean up header inclusion in some files git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.2@3365 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'wctc4xxp')
-rw-r--r--wctc4xxp/base.c45
1 files changed, 21 insertions, 24 deletions
diff --git a/wctc4xxp/base.c b/wctc4xxp/base.c
index 1302f76..9bba935 100644
--- a/wctc4xxp/base.c
+++ b/wctc4xxp/base.c
@@ -52,13 +52,6 @@
#include <linux/zaptel.h>
#endif
-#ifdef HOTPLUG_FIRMWARE
-static const char *dte_firmware = "tc400m-firmware.bin";
-#else
-extern u8 _binary_tc400m_firmware_bin_start[];
-extern void _binary_tc400m_firmware_bin_size;
-#endif
-
/* #define USE_TEST_HW */
#define USE_TDM_CONFIG
@@ -1669,19 +1662,15 @@ static int __devinit wcdte_init_one(struct pci_dev *pdev, const struct pci_devic
static int initd_ifaces=0;
unsigned char g729_numchannels, g723_numchannels, min_numchannels, dte_firmware_ver, dte_firmware_ver_minor;
unsigned int complexfmts;
- struct firmware embedded_firmware = {
+
+ struct firmware embedded_firmware;
+ const struct firmware *firmware = &embedded_firmware;
#if !defined(HOTPLUG_FIRMWARE)
- /* Yes... this is weird. objcopy gives us a symbol containing
- the size of the firmware, not a pointer to 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.
- */
- .size = (size_t) &_binary_tc400m_firmware_bin_size,
- .data = _binary_tc400m_firmware_bin_start,
+ extern void _binary_tc400m_firmware_bin_size;
+ extern u8 _binary_tc400m_firmware_bin_start[];
+#else
+ static const char tc400m_firmware[] = "tc400m-firmware.bin";
#endif
- };
- const struct firmware *firmware = &embedded_firmware;
if (!initd_ifaces) {
memset((void *)ifaces,0,(sizeof(struct wcdte *))*WC_MAX_IFACES);
@@ -1760,12 +1749,17 @@ static int __devinit wcdte_init_one(struct pci_dev *pdev, const struct pci_devic
INIT_WORK(&wc->dte_work, dte_wque_run, wc);
#endif
-#ifdef HOTPLUG_FIRMWARE
- if ((request_firmware(&firmware, dte_firmware, &wc->dev->dev) != 0) || !firmware) {
- printk("TC400B: firmware %s not available from userspace\n", dte_firmware);
- return -1;
+#if defined(HOTPLUG_FIRMWARE)
+ if ((request_firmware(&firmware, tc400m_firmware, &wc->dev->dev) != 0) ||
+ !firmware) {
+ printk("TC400M: firmware %s not available from userspace\n", tc400m_firmware);
+ return -EIO;
}
+#else
+ embedded_firmware.data = _binary_tc400m_firmware_bin_start;
+ embedded_firmware.size = (size_t) &_binary_tc400m_firmware_bin_size;
#endif
+
dte_firmware_ver = firmware->data[0];
dte_firmware_ver_minor = firmware->data[16];
g729_numchannels = firmware->data[1];
@@ -1882,6 +1876,7 @@ static int __devinit wcdte_init_one(struct pci_dev *pdev, const struct pci_devic
/* Start DMA */
wcdte_start_dma(wc);
+
if (wcdte_boot_processor(wc,firmware,1)) {
if (firmware != &embedded_firmware)
release_firmware(firmware);
@@ -1897,8 +1892,10 @@ static int __devinit wcdte_init_one(struct pci_dev *pdev, const struct pci_devic
vfree(wc);
return -EIO;
}
- if (wcdte_setup_channels(wc))
- {
+ if (firmware != &embedded_firmware)
+ release_firmware(firmware);
+
+ if (wcdte_setup_channels(wc)) {
/* Set Reset Low */
wcdte_stop_dma(wc);
/* Free Resources */