summaryrefslogtreecommitdiff
path: root/wct4xxp
diff options
context:
space:
mode:
authorkpfleming <kpfleming@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2006-11-08 23:09:33 +0000
committerkpfleming <kpfleming@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2006-11-08 23:09:33 +0000
commit8b53cf2033fff09f8e3ac49eb3c919502109c43e (patch)
tree1320929c4d7d53c8ab2842ecae0daf1eafe5e75a /wct4xxp
parent911b390063c9c99a3c79a7e60d1dbc43acb06902 (diff)
Merged revisions 1574 via svnmerge from
https://origsvn.digium.com/svn/zaptel/branches/1.4 ................ r1574 | kpfleming | 2006-11-08 17:06:17 -0600 (Wed, 08 Nov 2006) | 11 lines Merged revisions 1573 via svnmerge from https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r1573 | kpfleming | 2006-11-08 17:04:33 -0600 (Wed, 08 Nov 2006) | 3 lines clean up recent VPMOCT changes add support for Infineon FALC rev 2.2 ........ ................ git-svn-id: http://svn.digium.com/svn/zaptel/trunk@1575 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'wct4xxp')
-rw-r--r--wct4xxp/base.c85
-rw-r--r--wct4xxp/vpm450m.c2
-rw-r--r--wct4xxp/vpm450m.h42
3 files changed, 79 insertions, 50 deletions
diff --git a/wct4xxp/base.c b/wct4xxp/base.c
index 5d59b04..df575ac 100644
--- a/wct4xxp/base.c
+++ b/wct4xxp/base.c
@@ -3102,64 +3102,71 @@ static void t4_vpm450_init(struct t4 *wc)
unsigned int check1, check2;
int laws[4] = { 0, };
int x;
- int try;
int passedinit = 0;
-#ifdef HOTPLUG_FIRMWARE
- const struct firmware *firmware;
-#endif
if (!vpmsupport) {
- printk("VPM450M: Support Disabled\n");
+ printk("VPM450: Support Disabled\n");
return;
}
+
/* Turn on GPIO/DATA mux if supported */
t4_gpio_setdir(wc, (1 << 24), (1 << 24));
__t4_raw_oct_out(wc, 0x000a, 0x5678);
__t4_raw_oct_out(wc, 0x0004, 0x1234);
check1 = __t4_raw_oct_in(wc, 0x0004);
check2 = __t4_raw_oct_in(wc, 0x000a);
- if (1 || debug)
+ if (debug)
printk("OCT Result: %04x/%04x\n", __t4_raw_oct_in(wc, 0x0004), __t4_raw_oct_in(wc, 0x000a));
if (__t4_raw_oct_in(wc, 0x0004) != 0x1234) {
printk("VPM450: Not Present\n");
return;
}
- /* First try to load the VPMOCT128 then fallback to VPMOCT064 */
- for (try=0; try<2; try++) {
-#ifdef HOTPLUG_FIRMWARE
- if (!try) { /* vpmoct128 */
- if (request_firmware(&firmware, "OCT6114-128D.ima", &wc->dev->dev) != 0 || !firmware) {
- printk("VPM450M: firmware OCT6114-128D.ima not found to be loaded\n");
- continue;
- }
- } else { /* vpmoct064 */
- if (request_firmware(&firmware, "OCT6114-64D.ima", &wc->dev->dev) != 0 || !firmware) {
- printk("VPM450M: firmware OCT6114-64D not found to be loaded\n");
+
+ /* Setup alaw vs ulaw rules */
+ for (x = 0;x < wc->numspans; x++) {
+ if (wc->tspans[x]->span.channels > 24)
+ 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);
}
}
- printk("VPM450: Firmware of size %zd found try=%d\n", firmware->size, try+1);
-#else
- printk("VPM450: Using classic method of loading firmware try=%d\n", try+1);
-#endif
- /* Setup alaw vs ulaw rules */
- for (x=0;x<wc->numspans;x++) {
- if (wc->tspans[x]->span.channels > 24)
- laws[x] = 1;
- }
-#ifdef HOTPLUG_FIRMWARE
- if ((wc->vpm450m = init_vpm450m(wc, laws, wc->numspans, firmware))) {
- passedinit=1;
- break;
- }
- release_firmware(firmware);
-#else
- if ((wc->vpm450m = init_vpm450m(wc, laws, wc->numspans))) {
- passedinit=1;
- break;
+
+ 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);
+ }
}
-#endif
}
+#endif
+
if (!passedinit) {
printk("VPM450: Failed to initialize\n");
return;
@@ -3181,7 +3188,7 @@ static void t4_vpm400_init(struct t4 *wc)
unsigned int i, x, y, gen2vpm=0;
if (!vpmsupport) {
- printk("VPM400M: Support Disabled\n");
+ printk("VPM400: Support Disabled\n");
return;
}
@@ -3191,7 +3198,7 @@ static void t4_vpm400_init(struct t4 *wc)
case 1:
break;
default:
- printk("VPM: %d is not a valid vpmspans value, using 4\n", vpmspans);
+ printk("VPM400: %d is not a valid vpmspans value, using 4\n", vpmspans);
vpmspans = 4;
}
diff --git a/wct4xxp/vpm450m.c b/wct4xxp/vpm450m.c
index 2771837..8c3ac83 100644
--- a/wct4xxp/vpm450m.c
+++ b/wct4xxp/vpm450m.c
@@ -403,6 +403,7 @@ struct vpm450m *init_vpm450m(void *wc, int *isalaw, int numspans)
Oct6100GetInstanceSizeDef(&InstanceSize);
ChipOpen.pProcessContext = wc;
+
#ifdef HOTPLUG_FIRMWARE
ChipOpen.pbyImageFile = firmware->data;
ChipOpen.ulImageSize = firmware->size;
@@ -415,6 +416,7 @@ struct vpm450m *init_vpm450m(void *wc, int *isalaw, int numspans)
ChipOpen.ulImageSize = sizeof(vpmoct064_fw);
}
#endif
+
ChipOpen.fEnableMemClkOut = TRUE;
ChipOpen.ulMemClkFreq = cOCT6100_MCLK_FREQ_133_MHZ;
ChipOpen.ulMaxChannels = vpm450m->numchans;
diff --git a/wct4xxp/vpm450m.h b/wct4xxp/vpm450m.h
index 6e7454b..50205db 100644
--- a/wct4xxp/vpm450m.h
+++ b/wct4xxp/vpm450m.h
@@ -4,30 +4,50 @@
* Mark Spencer <markster@digium.com>
*
* All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
*/
#ifndef _VPM450M_H
#define _VPM450M_H
-
struct vpm450m;
+
#ifdef HOTPLUG_FIRMWARE
struct firmware;
#endif
+static const char *oct064_firmware = "OCT6114-64D.ima";
+static const char *oct128_firmware = "OCT6114-128D.ima";
+
/* From driver */
-extern unsigned int oct_get_reg(void *data, unsigned int reg);
-extern void oct_set_reg(void *data, unsigned int reg, unsigned int val);
+unsigned int oct_get_reg(void *data, unsigned int reg);
+void oct_set_reg(void *data, unsigned int reg, unsigned int val);
-/* From vpm450m2 */
+/* From vpm450m */
#ifdef HOTPLUG_FIRMWARE
-extern struct vpm450m *init_vpm450m(void *wc, int *isalaw, int numspans, const struct firmware *firmware);
+struct vpm450m *init_vpm450m(void *wc, int *isalaw, int numspans, const struct firmware *firmware);
#else
-extern struct vpm450m *init_vpm450m(void *wc, int *isalaw, int numspans);
+struct vpm450m *init_vpm450m(void *wc, int *isalaw, int numspans);
#endif
-extern void vpm450m_setec(struct vpm450m *instance, int channel, int eclen);
-extern void vpm450m_setdtmf(struct vpm450m *instance, int channel, int dtmfdetect, int dtmfmute);
-extern int vpm450m_checkirq(struct vpm450m *vpm450m);
-extern int vpm450m_getdtmf(struct vpm450m *vpm450m, int *channel, int *tone, int *start);
-extern void release_vpm450m(struct vpm450m *instance);
+
+void vpm450m_setec(struct vpm450m *instance, int channel, int eclen);
+void vpm450m_setdtmf(struct vpm450m *instance, int channel, int dtmfdetect, int dtmfmute);
+int vpm450m_checkirq(struct vpm450m *vpm450m);
+int vpm450m_getdtmf(struct vpm450m *vpm450m, int *channel, int *tone, int *start);
+void release_vpm450m(struct vpm450m *instance);
+
#endif