summaryrefslogtreecommitdiff
path: root/wct4xxp/base.c
diff options
context:
space:
mode:
authorkpfleming <kpfleming@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-01-22 18:58:34 +0000
committerkpfleming <kpfleming@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-01-22 18:58:34 +0000
commit9ec284b474eb0fea2d620c79c34beed9e675abce (patch)
tree5487f8919fac1053bc1dec9c2682a0ec955cf5a3 /wct4xxp/base.c
parentf70673c41f6354e6b2ccba48bc43de79d2483010 (diff)
update to PR47 Octasic API kit, and use new GetCapacityPins API call to only attempt downloading the correct firmware for the modules we find
git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.2@1877 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'wct4xxp/base.c')
-rw-r--r--wct4xxp/base.c74
1 files changed, 34 insertions, 40 deletions
diff --git a/wct4xxp/base.c b/wct4xxp/base.c
index 487befb..ccf349b 100644
--- a/wct4xxp/base.c
+++ b/wct4xxp/base.c
@@ -40,10 +40,8 @@
#endif
#ifdef LINUX26
#include <linux/moduleparam.h>
-#ifdef HOTPLUG_FIRMWARE
-#include <linux/firmware.h>
-#endif
#endif
+
#include "wct4xxp.h"
#include "vpm450m.h"
@@ -2677,7 +2675,14 @@ static void t4_vpm450_init(struct t4 *wc)
unsigned int check1, check2;
int laws[4] = { 0, };
int x;
- int passedinit = 0;
+ struct firmware embedded_firmware;
+ const struct firmware *firmware = &embedded_firmware;
+#if !defined(HOTPLUG_FIRMWARE)
+ extern const u32 _binary_OCT6114_64D_size;
+ extern const u32 _binary_OCT6114_128D_size;
+ extern const u8 *_binary_OCT6114_64D_start;
+ extern const u8 *_binary_OCT6114_128D_start;
+#endif
if (!vpmsupport) {
printk("VPM450: Support Disabled\n");
@@ -2703,46 +2708,35 @@ static void t4_vpm450_init(struct t4 *wc)
laws[x] = 1;
}
-#ifndef HOTPLUG_FIRMWARE
- if ((wc->vpm450m = init_vpm450m(wc, laws, wc->numspans)))
- passedinit = 1;
-#else
- {
- const struct firmware *firmware;
-
- /* if this is a 4-span card, just try using the 128-channel firmware;
- otherwise, try both, because a 2-span card could potentially have
- a 128-channel Octasic module
- */
- if (wc->numspans < 3) {
- if ((request_firmware(&firmware, oct064_firmware, &wc->dev->dev) != 0) ||
- !firmware) {
- printk("VPM450: firmware %s not available from userspace\n", oct064_firmware);
- return;
- } else {
- if ((wc->vpm450m = init_vpm450m(wc, laws, wc->numspans, firmware)))
- passedinit=1;
-
- release_firmware(firmware);
- }
+ switch (get_vpm450m_capacity(wc)) {
+ case 64:
+#if defined(HOTPLUG_FIRMWARE)
+ if ((request_firmware(&firmware, oct064_firmware, &wc->dev->dev) != 0) ||
+ !firmware) {
+ printk("VPM450: firmware %s not available from userspace\n", oct064_firmware);
+ return;
}
-
- if (!passedinit) {
- if ((request_firmware(&firmware, oct128_firmware, &wc->dev->dev) != 0) ||
- !firmware) {
- printk("VPM450: firmware %s not available from userspace\n", oct128_firmware);
- return;
- } else {
- if ((wc->vpm450m = init_vpm450m(wc, laws, wc->numspans, firmware)))
- passedinit=1;
-
- release_firmware(firmware);
- }
+#else
+ embedded_firmware.data = _binary_OCT6114D_64D_ima_start;
+ embedded_firmware.size = _binary_OCT6114D_64D_ima_start;
+#endif
+ case 128:
+#if defined(HOTPLUG_FIRMWARE)
+ if ((request_firmware(&firmware, oct128_firmware, &wc->dev->dev) != 0) ||
+ !firmware) {
+ printk("VPM450: firmware %s not available from userspace\n", oct128_firmware);
+ return;
}
- }
+#else
+ embedded_firmware.data = _binary_OCT6114D_128D_ima_start;
+ embedded_firmware.size = _binary_OCT6114D_128D_ima_start;
#endif
+ default:
+ printk("Unsupported channel capacity found on VPM module.\n");
+ return;
+ }
- if (!passedinit) {
+ if (!(wc->vpm450m = init_vpm450m(wc, laws, wc->numspans, firmware))) {
printk("VPM450: Failed to initialize\n");
return;
}