summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkpfleming <kpfleming@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2006-11-08 23:04:33 +0000
committerkpfleming <kpfleming@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2006-11-08 23:04:33 +0000
commitf13764ceb27de41e2f14bbea574c31f28b6b7d63 (patch)
tree43c74bdd21fc176e50a9dc5fe2bde839d35e3b9a
parent201e9dc274ae56d43d68326c9c0f9ae6e03736fa (diff)
clean up recent VPMOCT changes
add support for Infineon FALC rev 2.2 git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.2@1573 5390a7c7-147a-4af0-8ec9-7488f05a26cb
-rw-r--r--wct4xxp/base.c85
-rw-r--r--wct4xxp/vpm450m.c2
-rw-r--r--wct4xxp/vpm450m.h42
-rw-r--r--wcte11xp.c45
4 files changed, 90 insertions, 84 deletions
diff --git a/wct4xxp/base.c b/wct4xxp/base.c
index 6db860f..c980d8c 100644
--- a/wct4xxp/base.c
+++ b/wct4xxp/base.c
@@ -2677,64 +2677,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;
@@ -2755,7 +2762,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;
}
@@ -2765,7 +2772,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
diff --git a/wcte11xp.c b/wcte11xp.c
index bdab85d..f63434a 100644
--- a/wcte11xp.c
+++ b/wcte11xp.c
@@ -616,7 +616,7 @@ static void t4_serial_setup(struct t1 *wc)
{
printk("TE110P: Setting up global serial parameters for %s %s\n",
wc->spantype == TYPE_E1 ? "E1" : "T1",
- wc->spanflags & FLAG_FALC12 ? "FALC V1.2" : "FALC V2.1");
+ wc->spanflags & FLAG_FALC12 ? "FALC V1.2" : "FALC V2.2");
t1_framer_out(wc, 0x85, 0xe0); /* GPC1: Multiplex mode enabled, FSC is output, active low, RCLK from channel 0 */
t1_framer_out(wc, 0x08, 0x05); /* IPC: Interrupt push/pull active low */
if (wc->spanflags & FLAG_FALC12) {
@@ -627,38 +627,15 @@ static void t4_serial_setup(struct t1 *wc)
t1_framer_out(wc, 0x96, 0x03);
t1_framer_out(wc, 0x97, 0x10);
} else {
-#ifdef TRUST_INFINEON_ERRATA
- if (wc->spantype == TYPE_E1) {
- /* Global clocks (8.192 Mhz CLK) */
- t1_framer_out(wc, 0x92, 0x00);
- t1_framer_out(wc, 0x93, 0x00);
- t1_framer_out(wc, 0x94, 0x00);
- t1_framer_out(wc, 0x95, 0x00);
- t1_framer_out(wc, 0x96, 0x00);
- t1_framer_out(wc, 0x97, 0x0F);
- t1_framer_out(wc, 0x98, 0x80);
- t1_framer_out(wc, 0x99, 0x00);
- } else {
- /* Global clocks (8.192 Mhz CLK) */
- t1_framer_out(wc, 0x92, 0x00);
- t1_framer_out(wc, 0x93, 0x10);
- t1_framer_out(wc, 0x94, 0xfb);
- t1_framer_out(wc, 0x95, 0x03);
- t1_framer_out(wc, 0x96, 0x00);
- t1_framer_out(wc, 0x97, 0x0b);
- t1_framer_out(wc, 0x98, 0x8c);
- t1_framer_out(wc, 0x99, 0x80);
- }
-#else
- t1_framer_out(wc, 0x92, 0x66);
- t1_framer_out(wc, 0x93, 0x0e);
- t1_framer_out(wc, 0x94, 0x3f);
- t1_framer_out(wc, 0x95, 0x0f);
- t1_framer_out(wc, 0x96, 0x04);
- t1_framer_out(wc, 0x97, 0x3c);
- t1_framer_out(wc, 0x98, 0x9c);
- t1_framer_out(wc, 0x99, 0x90);
-#endif
+ /* Global clocks (8.192 Mhz CLK) */
+ t1_framer_out(wc, 0x92, 0x00);
+ t1_framer_out(wc, 0x93, 0x18);
+ t1_framer_out(wc, 0x94, 0xfb);
+ t1_framer_out(wc, 0x95, 0x0b);
+ t1_framer_out(wc, 0x96, 0x00);
+ t1_framer_out(wc, 0x97, 0x0b);
+ t1_framer_out(wc, 0x98, 0xdb);
+ t1_framer_out(wc, 0x99, 0xdf);
}
/* Configure interrupts */
t1_framer_out(wc, 0x46, 0x40); /* GCR: Interrupt on Activation/Deactivation of AIX, LOS */
@@ -675,7 +652,7 @@ static void t4_serial_setup(struct t1 *wc)
if (wc->spanflags & FLAG_FALC12)
t1_framer_out(wc, 0x25, 0x04); /* RC1: The rest of RC0 */
else
- t1_framer_out(wc, 0x25, 0x06); /* RC1: The rest of RC0 */
+ t1_framer_out(wc, 0x25, 0x05); /* RC1: The rest of RC0 */
/* Configure ports */
t1_framer_out(wc, 0x80, 0x00); /* PC1: SPYR/SPYX input on RPA/XPA */