Compare commits

...

35 Commits

Author SHA1 Message Date
Oron Peled
6593097586 xpp: fix PANIC for old dahdi_registration
* dahdi_registration writes multiple times to:
     /sys/bus/astribanks/devices/*/*/span
* In some race cases this resulted in corruption and eventual kernel
  panic.
* Until migration to "assigned-spans" is complete:
  - Accept and ignore multiple "dahdi registrations" from user-space.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2014-03-23 17:25:52 +02:00
Shaun Ruffell
e62f0f1835 wcxb: Disable presence detect reporting on upstream port during PCIe hard reset.
When the card goes through a reset the PCIe link will be brought down. Some
slots will report this change upstream to the root port which will believe that
the card has been hotplugged out of the system.

This fixes cases on some systems where, during a firmware update, the card gets
removed from the system's logical PCI tree with messages like the following in
the kernel log:

  pciehp 0000:00:1c.0:pcie04: Card not present on Slot(259)
  pciehp 0000:00:1c.0:pcie04: Card present on Slot(259)

Internal-Issue-ID: DAHDI-1091
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2014-03-19 15:34:32 -05:00
Shaun Ruffell
e4fce6849a wcte43x: Update firmware for TE435 / TE235 to e0019.
This firmware image is able to handle system conditions that would result in
spans internmittenly going down and recovering.

Internal-Issue-ID: DAHDI-1087
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2014-03-17 12:02:47 -05:00
Shaun Ruffell
bc0c04fb13 wcaxx: Update firmware for A8B/A4B to 1d0019/b0019.
These firmware images can handle system conditions that would previously result
in transmitted audio being intermittently silenced and then unsilenced.

Internal-Issue-ID: DAHDI-1087
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2014-03-17 12:02:47 -05:00
Shaun Ruffell
45b4937a35 wcte13xp: Update firmware for TE133/TE131 to 780019
This firmware image is able to handle system conditions that would result in
spans going down and then coming back intermittently.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2014-03-17 12:02:47 -05:00
Shaun Ruffell
50f2fd15b6 wcxb: Add diagnostic message if DMA retries are increasing when DEBUG is defined.
There are some platforms where the DMA operation to the host does not complete
within the required 50us. When this happens some versions of the firmware will
issue a retry and increment the retry field in the descriptor status word.

Now if this driver is configured in DEBUG mode, the presence of these retries
will be printed to the kernel log as a potential troubleshooting aide.

Internal-Issue-ID: DAHDI-1087
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2014-03-17 10:33:14 -05:00
Shaun Ruffell
665bf9feb6 wcxb: Reset TDM engine on IO errors.
There are error conditions that the firmware can detect but cannot recover from
without help from the driver. When firmware detects these conditions the
DESC_IO_ERROR bit will be set in the descriptor header to signal that the driver
should reset the TDM engine on the card. Since this is not due to failure of the
host to service the interrupt in time, it does not make sense to increase
latency when these conditions are detected.

Internal-Issue-ID: DAHDI-1087
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2014-03-17 09:24:30 -05:00
Shaun Ruffell
b817c7625a wcxb: Print running version when recommending power cycle.
Without this change it's hard to see what is actually running on the card when
the firmware in the flash doesn't match the reported version. This is a
debugging aide.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2014-03-13 01:44:18 -05:00
Shaun Ruffell
6cebc1c1fb build_tools/install_firwmare: Try to extract the .bin file from .tar.gz
This allows a .tar.gz file that is normally downloaded from the server to be
checked directly into a test branch. Now when the firmware is being installed,
it can be extracted from any present .tar.gz.  Again, this is primarily to
simplify testing.

A nice side effect is that when going from a newer version to an older version,
any stale .bin files in the firmware directory will not be installed into
/lib/firmware, but instead the bin file from the *versioned* .tar.gz will always
be installed. This should reduce problems where you have to run "make
dist-clean" when reverting to an older version that has a firmware change.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2014-03-12 23:45:16 -05:00
Shaun Ruffell
7ce8498465 firmware: Refactor by using build_tools/install_firmware.
This is intended to simplify the Makefile and move a large common part into a
subscript. The behavior is the same as it was before.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2014-03-12 23:12:40 -05:00
Oron Peled
d4868092bf xpp: PRI stability fixes
* We didn't handle proper E1/T1 transitions after device registration.

* Fix SPAN_REGISTERED(xpd):
  It now checks for DAHDI_FLAGBIT_REGISTERED as well, as this flag is
  set/clear by assign/unassign.

* From set_pri_proto():
  - Always free/allocate channels
  - Always call dahdi_init_span()

* Improve phonedev_cleanup() safety:
  - NULL pointers after free.
  - Zero number of channels at the end.

* Refactor channel allocation out of phonedev_init():
  - Into phonedev_alloc_channels()
  - Also called from xpd_init_span() to prevent duplicated logic.
  - And called from set_pri_proto() to prevent our bug.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2014-02-05 20:19:08 +02:00
Tzafrir Cohen
06c45b7cd8 dahdi_get_auto_assigned_spans
Commit 74e949c33a exported the module
variable dahdi.auto_assigned_spans. However this is not a good name.

This commit reverts the export and replaces it with a new function to
get the value of the variable.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2014-02-05 19:25:20 +02:00
Tzafrir Cohen
fdca6f36de sysfs: registration_time: use ktime_get_ts
A fix to 03b3ce1a10: use ktime_get_ts
instead of getnstimeofday to better handle system time changes.
(Shaun Ruffell)

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2014-01-28 20:39:21 +02:00
Tzafrir Cohen
02f6b4e7bd README: The sysfs class now includes no channels
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2014-01-28 20:24:40 +02:00
Tzafrir Cohen
701ed41adf README: the new registration_time device attribute
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2014-01-28 20:17:26 +02:00
Oron Peled
03b3ce1a10 sysfs: new device attribute: registration_time
Add a new sysfs attribute to dahdi_device: registration_time

* Records the time of the device's registration with DAHDI.
* Used by dahdi_auto_assign_compat to assign spans by device
  registration order when backward compatibility needed.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Shaun Ruffell <sruffell@digium.com>
2014-01-28 20:04:22 +02:00
Tzafrir Cohen
2c4373972b README: xpp.dahdi_autoreg is deprecated
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2014-01-28 19:27:05 +02:00
Oron Peled
2ecf700dd8 xpp: continue xpp.dahdi_autoreg deprecation
* Set it to 0 by default (as we use dahdi.auto_assign_spans now)
* Make it readonly (no runtime changes)
* Warn during startup if it was forced to 1

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2014-01-28 19:24:27 +02:00
Oron Peled
74e949c33a xpp: deprecate dahdi_autoreg
Instead, use the inverse of dahdi.auto_assign_spans value.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2014-01-28 19:24:15 +02:00
Russ Meyerriecks
3efa9d8cd1 wcte13xp: wcxb: Add delayed reset firmware feature
Allow certain older firmwares to delay the hard reset until a full power cycle.
This way we can "preload" newer firmware images, without requiring the user to
physically power off/on their machine.

Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
Acked-by: Shaun Ruffell <sruffell@digium.com>
2014-01-24 13:14:14 -06:00
Shaun Ruffell
4cd09feb54 wcte43x, wcte13xp, wcaxx: Bump irqmisses counter when there are DMA underruns.
This makes the behavior of IRQ misses for these drivers behave the same as the
wcte12xp, wctdm24xxp, and wct4xxp drivers.

Previously irqmisses would never increase. The presence of underruns would still
show up in dmesg as latency bumps.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2014-01-22 18:04:47 -06:00
Shaun Ruffell
1f024713ed wct4xxp: Trivial drop of unnecessary local variables.
These were left over from when the VPM callbacks depended on the different VPM
installed. On the wcte43x this is unnecessary.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2014-01-22 18:04:47 -06:00
Shaun Ruffell
0b499d9566 wcte43x: Trivial drop of unnecessary local variables.
These were left over from when the VPM callbacks depended on the different VPM
installed. On the wcte43x this is unnecessary.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2014-01-22 18:04:47 -06:00
Russ Meyerriecks
438b2a36b3 wcte13xp: wcaxx: wcte43x: Remove VPM_SUPPORT compile option.
This was a legacy compile time option that is no longer necessary with the new
series of cards.

Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2014-01-22 13:40:27 -06:00
Russ Meyerriecks
be94aa11bb Revert "dahdi: Change auto_assign_spans default from 1 to 0."
This reverts commit c49a56c954.

Delaying this feature until after v2.9 release.
2014-01-21 16:36:44 -06:00
Russ Meyerriecks
1add33efe7 wcte13xp: Add support for te131 and te132 products
These are similar to te133 and te134 but without integrated echo cancel.

Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2014-01-17 15:43:06 -06:00
Russ Meyerriecks
094e30483d wcte13xp: Update firmware to 0x780017
This firmware adds support for the te131 and te132 products.

Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2014-01-17 15:33:25 -06:00
Russ Meyerriecks
e4ea886ee0 wcte13xp: wcaxx: Fix broken devicetype attributes
struct dahdi_device.devicetype was set incorrectly in both drivers. This caused
the vpm module to not show up after the device name when reading this field
from a spanstat.

Reported-by: Charles Moye <cmoye@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2014-01-17 15:30:38 -06:00
Shaun Ruffell
860eb4ab48 dahdi: Do not access invalid memory if invalid local span number is passed to spantype attribute.
This fixes potential kernel panic due to accessing invalid memory if passing
invalid local span number to 'spantype' attribute via sysfs.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2014-01-14 16:03:18 -06:00
Shaun Ruffell
47dcc9377c wcte43x, wcte13xp: Use MSI interrupts if possible.
It was an oversight to prevent the wcte43x and wcte13xp drivers from using
Message Signaled interrupts during the switch to the wcxb library.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2014-01-08 12:21:10 -06:00
Shaun Ruffell
f10eb3f547 wcte13xp: Export max_latency module parameter.
wcte13xp now has a max_latency module parameter like the wcaxx and wcte43x
drivers.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2014-01-08 12:21:10 -06:00
Shaun Ruffell
99de304d84 wcaxx, wcte13xp, wcte43x: Honor max_latency module parameter.
The wcxb library did not do actually use the max_latency member to limit the
maximum latency of the DMA engine.

Now it does.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2014-01-08 12:21:10 -06:00
Shaun Ruffell
c49a56c954 dahdi: Change auto_assign_spans default from 1 to 0.
The infrastructure has been put in place in 2.8.0 for fully dynamic device and
span configuration. This will be the default mode in DAHDI-Linux 2.9.0.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
Acked-by: Oron Peled <oron.peled@xorcom.com>
2014-01-06 13:24:28 -06:00
Shaun Ruffell
e6b16eace1 dahdi: Move clearing of DAHDI_ALARM_NOTOPEN to __dahdi_assign_span().
Previously this was in __dahdi_init_span(). The problem was that
__dahdi_init_span() was only called when a spans' line mode was being changed.
Therefore it was possible to unassign and resassign an analog span and leave it
stuck in the 'NOP' alarm state.

It also make the setting / clearing of DAHDI_ALARM_NOTOPEN symetrical about span
unassignment / assignment in addition to updating the alarm states on all the
channels on the span via the dahdi_alarm_notify() function.

This is a better version of commit 496f817773.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-12-26 17:04:29 -06:00
Shaun Ruffell
3933ffd350 wctdm24xxp: Reset module specific type information on probe.
This fixes an issue that affects TDM410 modules when there is not a module
installed in the first port, but there is an FXO module installed in the third
port.

When scaning for QRV modules in the first port, the 3rd port will have the
'hook' struct.qrv set to 0xff. When a QRV module is  not detected, that value
will be left, which then maps to an invalid state for both fxo.ring_state and
fxo.battery_state.

The result would be that FXO ports would fail to run the ring detector state
machine since it did not know what the current state was.

Now we'll just reset all the values in struct fxo or struct fxs to the expected
init state.

Internal-Issue-ID: DAHLIN-332
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-12-20 14:15:26 -06:00
18 changed files with 453 additions and 392 deletions

26
README
View File

@@ -528,11 +528,12 @@ XPP (Astribank) module parameters
==== dahdi_autoreg
(xpp)
Register spans automatically (1) or not (0). Default: 0.
Setting it simplifies operations with a single Astribank and no other
DAHDI hardware. However if you have such systems, automatic
registration can cause the order of spans to be unpredictable.
The standard startup scripts use 'dahdi_registration on' instead of this.
Deprecated. See dahdi.<<_auto_assign_spans,auto_assign_spans>> above.
Originally had a somewhat similar (but xpp-specific and more limited)
role to auto_assign_spans. For backward compatibility this variable is
still kept, but its value is unused. Astribanks will auto-register
with dahdi if auto_assign_spans is not set.
==== tools_rootdir
(xpp)
@@ -896,11 +897,12 @@ to other nodes.
Class DAHDI
^^^^^^^^^^^
under /sys/class/dadhi there exists a node for each DAHDI device file
under /dev/dahdi. The name is 'dahdi!foo' for the file '/dev/dahdi/foo'
(udev translates exclamation marks to slashes). Those nodes are not, for
the most part, proper SysFS nodes, and don't include any interesting
properties.
Under /sys/class/dadhi there exists a node for the non-channel DAHDI
device file under /dev/dahdi. The name is 'dahdi!foo' for the file
'/dev/dahdi/foo' (udev translates exclamation marks to slashes). Those
nodes are not, for the most part, proper SysFS nodes, and don't include
any interesting properties. The files in this class `ctl`, `timer`,
`channel`, `pseudo` and (if exists) `transcode`.
Devices Bus
@@ -925,6 +927,10 @@ A unique hardware-level identifier (e.g. serial number), if available.
===== /sys/bus/dahdi_devices/devices/DEVICE/manufacturer
The name of the manufacturer. Freeform-string.
===== /sys/bus/dahdi_devices/devices/DEVICE/registration_time
The time at which the device registered with the DAHDI core. Example
value: "0005634136.941901429".
===== /sys/bus/dahdi_devices/devices/DEVICE/spantype
A line for each available span: <num>:<type>. This has to be provided
here as in the case of manual assignment, userspace may need to know

23
build_tools/install_firmware Executable file
View File

@@ -0,0 +1,23 @@
#!/bin/sh
# This is a helper script intended to be called from
# drivers/dahdi/firmware/Makefile to install the different firmware version.
FIRMWARE_PATTERN=$1
FIRMWARE_VERSION=$2
DESTDIR=$3
if ! test -f ${DESTDIR}/usr/lib/hotplug/firmware/.${FIRMWARE_PATTERN}-${FIRMWARE_VERSION} || ! test -f ${DESTDIR}/lib/firmware/.${FIRMWARE_PATTERN}-${FIRMWARE_VERSION}; then
echo "Installing ${FIRMWARE_PATTERN}.bin to hotplug firmware directories"
tar --no-same-owner -xf ${FIRMWARE_PATTERN}-${FIRMWARE_VERSION}.tar.gz || exit 1
install -m 644 ${FIRMWARE_PATTERN}.bin ${DESTDIR}/usr/lib/hotplug/firmware || exit 1
rm -rf ${DESTDIR}/usr/lib/hotplug/firmware/.${FIRMWARE_PATTERN}-*
touch ${DESTDIR}/usr/lib/hotplug/firmware/.${FIRMWARE_PATTERN}-${FIRMWARE_VERSION}
install -m 644 ${FIRMWARE_PATTERN}.bin ${DESTDIR}/lib/firmware || exit 1
rm -rf ${DESTDIR}/lib/firmware/.${FIRMWARE_PATTERN}-*
touch ${DESTDIR}/lib/firmware/.${FIRMWARE_PATTERN}-${FIRMWARE_VERSION}
# Remove the .bin file so that if the version is reverted, it will not
# be installed with a non-matching ${FIRMARE_VERSION} file.
rm ${FIRMWARE_PATTERN}.bin
else
echo "Firmware ${FIRMWARE_PATTERN}.bin is already installed with required version ${FIRMWARE_VERSION}"
fi

View File

@@ -50,6 +50,7 @@
#include <linux/list.h>
#include <linux/delay.h>
#include <linux/mutex.h>
#include <linux/ktime.h>
#if defined(HAVE_UNLOCKED_IOCTL) && defined(CONFIG_BKL)
#include <linux/smp_lock.h>
@@ -7188,13 +7189,6 @@ static void __dahdi_init_span(struct dahdi_span *span)
spin_lock_init(&span->lock);
clear_bit(DAHDI_FLAGBIT_REGISTERED, &span->flags);
/* DAHDI_ALARM_NOTOPEN can be set when a span is disabled, i.e. via
* sysfs, so when the span is being initialized again before
* reassignment we should make sure it's cleared. This eliminates the
* need for board drivers to re-report their alarm states on span
* reassignment. */
span->alarms &= ~DAHDI_ALARM_NOTOPEN;
if (!span->deflaw) {
module_printk(KERN_NOTICE, "Span %s didn't specify default "
"law. Assuming mulaw, please fix driver!\n",
@@ -7255,6 +7249,7 @@ static int _dahdi_assign_span(struct dahdi_span *span, unsigned int spanno,
{
int res = 0;
unsigned int x;
unsigned long flags;
if (!span || !span->ops || !span->ops->owner)
return -EFAULT;
@@ -7266,6 +7261,16 @@ static int _dahdi_assign_span(struct dahdi_span *span, unsigned int spanno,
return -EINVAL;
}
/* DAHDI_ALARM_NOTOPEN can be set when a span is disabled, i.e. via
* sysfs, so when the span is being reassigned we should make sure it's
* cleared. This eliminates the need for board drivers to re-report
* their alarm states on span reassignment. */
spin_lock_irqsave(&span->lock, flags);
span->alarms &= ~DAHDI_ALARM_NOTOPEN;
dahdi_alarm_notify(span);
spin_unlock_irqrestore(&span->lock, flags);
if (span->ops->enable_hw_preechocan ||
span->ops->disable_hw_preechocan) {
if ((NULL == span->ops->enable_hw_preechocan) ||
@@ -7372,6 +7377,15 @@ int dahdi_assign_device_spans(struct dahdi_device *ddev)
static int auto_assign_spans = 1;
static const char *UNKNOWN = "";
/**
* dahdi_auto_assign_spans - is the parameter auto_assign_spans set?
*/
int dahdi_get_auto_assign_spans(void)
{
return auto_assign_spans;
}
EXPORT_SYMBOL(dahdi_get_auto_assign_spans);
/**
* _dahdi_register_device - Registers a DAHDI device and assign its spans.
* @ddev: the DAHDI device
@@ -7399,6 +7413,7 @@ static int _dahdi_register_device(struct dahdi_device *ddev,
__dahdi_init_span(s);
}
ktime_get_ts(&ddev->registration_time);
ret = dahdi_sysfs_add_device(ddev, parent);
if (ret)
return ret;

View File

@@ -629,7 +629,8 @@ dahdi_spantype_store(struct device *dev, struct device_attribute *attr,
{
struct dahdi_device *const ddev = to_ddev(dev);
int ret;
struct dahdi_span *span;
struct dahdi_span *span = NULL;
struct dahdi_span *cur;
unsigned int local_span_number;
char spantype_name[80];
enum spantypes spantype;
@@ -645,9 +646,18 @@ dahdi_spantype_store(struct device *dev, struct device_attribute *attr,
return -EINVAL;
}
list_for_each_entry(span, &ddev->spans, device_node) {
if (local_spanno(span) == local_span_number)
list_for_each_entry(cur, &ddev->spans, device_node) {
if (local_spanno(cur) == local_span_number) {
span = cur;
break;
}
}
if (!span || (local_spanno(span) != local_span_number)) {
module_printk(KERN_WARNING,
"%d is not a valid local span number "
"for this device.\n", local_span_number);
return -EINVAL;
}
if (test_bit(DAHDI_FLAGBIT_REGISTERED, &span->flags)) {
@@ -656,12 +666,6 @@ dahdi_spantype_store(struct device *dev, struct device_attribute *attr,
return -EINVAL;
}
if (local_spanno(span) != local_span_number) {
module_printk(KERN_WARNING,
"%d is not a valid local span number "
"for this device.\n", local_span_number);
return -EINVAL;
}
if (!span->ops->set_spantype) {
module_printk(KERN_WARNING, "Span %s does not support "
@@ -673,6 +677,19 @@ dahdi_spantype_store(struct device *dev, struct device_attribute *attr,
return (ret < 0) ? ret : count;
}
static ssize_t
dahdi_registration_time_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct dahdi_device *ddev = to_ddev(dev);
int count = 0;
count += sprintf(buf, "%010ld.%09ld\n",
ddev->registration_time.tv_sec,
ddev->registration_time.tv_nsec);
return count;
}
static struct device_attribute dahdi_device_attrs[] = {
__ATTR(manufacturer, S_IRUGO, dahdi_device_manufacturer_show, NULL),
__ATTR(type, S_IRUGO, dahdi_device_type_show, NULL),
@@ -684,6 +701,7 @@ static struct device_attribute dahdi_device_attrs[] = {
__ATTR(unassign_span, S_IWUSR, NULL, dahdi_device_unassign_span),
__ATTR(spantype, S_IWUSR | S_IRUGO, dahdi_spantype_show,
dahdi_spantype_store),
__ATTR(registration_time, S_IRUGO, dahdi_registration_time_show, NULL),
__ATTR_NULL,
};

View File

@@ -31,13 +31,13 @@ VPMADT032_VERSION:=1.25.0
HX8_VERSION:=2.06
VPMOCT032_VERSION:=1.12.0
WCT820_VERSION:=1.76
TE133_VERSION:=6f0017
TE134_VERSION:=6f0017
TE435_VERSION:=e0017
TE133_VERSION:=780019
TE134_VERSION:=780017
TE435_VERSION:=e0019
A8A_VERSION:=1d0017
A8B_VERSION:=1d0017
A8B_VERSION:=1d0019
A4A_VERSION:=a0017
A4B_VERSION:=b0017
A4B_VERSION:=b0019
FIRMWARE_URL:=http://downloads.digium.com/pub/telephony/firmware/releases
@@ -82,6 +82,7 @@ OBJECT_FILES:=$(OBJECT_FILES:FIRMWARE-VPMOCT032=dahdi-fw-vpmoct032.o)
# Force usage of wget, for now
DOWNLOAD=wget
WGET=wget
INSTALL_FIRMWARE=../../../build_tools/install_firmware
# If "fetch" is used, --continue is not a valid option.
ifeq ($(WGET),wget)
@@ -107,7 +108,6 @@ dahdi-fw-%.tar.gz:
echo "Attempting to download $@"; \
if test ! -f $@; then $(DOWNLOAD) $(WGET_ARGS) $(FIRMWARE_URL)/$@; fi; \
if test ! -f $@; then exit 1; fi; \
(cat $@ | gzip -d | tar --no-same-owner -xf -) \
fi
firmware-loaders: $(FWLOADERS)
@@ -126,172 +126,21 @@ $(DESTDIR)/usr/lib/hotplug/firmware $(DESTDIR)/lib/firmware:
# Install all downloaded firmware images for hotplug usage
hotplug-install: $(DESTDIR)/usr/lib/hotplug/firmware $(DESTDIR)/lib/firmware $(FIRMWARE)
ifeq ($(shell if ( [ -f $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-oct6114-032-$(OCT6114_032_VERSION) ] ) && ( [ -f $(DESTDIR)/lib/firmware/.dahdi-fw-oct6114-032-$(OCT6114_032_VERSION) ] ); then echo "no"; else echo "yes"; fi),yes)
@echo "Installing dahdi-fw-oct6114-032.bin to hotplug firmware directories"
@install -m 644 dahdi-fw-oct6114-032.bin $(DESTDIR)/usr/lib/hotplug/firmware
@rm -rf $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-oct6114-032-*
@touch $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-oct6114-032-$(OCT6114_032_VERSION)
@install -m 644 dahdi-fw-oct6114-032.bin $(DESTDIR)/lib/firmware
@rm -rf $(DESTDIR)/lib/firmware/.dahdi-fw-oct6114-032-*
@touch $(DESTDIR)/lib/firmware/.dahdi-fw-oct6114-032-$(OCT6114_032_VERSION)
else
@echo "Firmware dahdi-fw-oct6114-032.bin is already installed with required version $(OCT6114_032_VERSION)"
endif
ifeq ($(shell if ( [ -f $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-oct6114-064-$(OCT6114_064_VERSION) ] ) && ( [ -f $(DESTDIR)/lib/firmware/.dahdi-fw-oct6114-064-$(OCT6114_064_VERSION) ] ); then echo "no"; else echo "yes"; fi),yes)
@echo "Installing dahdi-fw-oct6114-064.bin to hotplug firmware directories"
@install -m 644 dahdi-fw-oct6114-064.bin $(DESTDIR)/usr/lib/hotplug/firmware
@rm -rf $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-oct6114-064-*
@touch $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-oct6114-064-$(OCT6114_064_VERSION)
@install -m 644 dahdi-fw-oct6114-064.bin $(DESTDIR)/lib/firmware
@rm -rf $(DESTDIR)/lib/firmware/.dahdi-fw-oct6114-064-*
@touch $(DESTDIR)/lib/firmware/.dahdi-fw-oct6114-064-$(OCT6114_064_VERSION)
else
@echo "Firmware dahdi-fw-oct6114-064.bin is already installed with required version $(OCT6114_064_VERSION)"
endif
ifeq ($(shell if ( [ -f $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-oct6114-128-$(OCT6114_128_VERSION) ] ) && ( [ -f $(DESTDIR)/lib/firmware/.dahdi-fw-oct6114-128-$(OCT6114_128_VERSION) ] ); then echo "no"; else echo "yes"; fi),yes)
@echo "Installing dahdi-fw-oct6114-128.bin to hotplug firmware directories"
@install -m 644 dahdi-fw-oct6114-128.bin $(DESTDIR)/usr/lib/hotplug/firmware
@rm -rf $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-oct6114-128-*
@touch $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-oct6114-128-$(OCT6114_128_VERSION)
@install -m 644 dahdi-fw-oct6114-128.bin $(DESTDIR)/lib/firmware
@rm -rf $(DESTDIR)/lib/firmware/.dahdi-fw-oct6114-128-*
@touch $(DESTDIR)/lib/firmware/.dahdi-fw-oct6114-128-$(OCT6114_128_VERSION)
else
@echo "Firmware dahdi-fw-oct6114-128.bin is already installed with required version $(OCT6114_128_VERSION)"
endif
ifeq ($(shell if ( [ -f $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-oct6114-256-$(OCT6114_256_VERSION) ] ) && ( [ -f $(DESTDIR)/lib/firmware/.dahdi-fw-oct6114-256-$(OCT6114_256_VERSION) ] ); then echo "no"; else echo "yes"; fi),yes)
@echo "Installing dahdi-fw-oct6114-256.bin to hotplug firmware directories"
@install -m 644 dahdi-fw-oct6114-256.bin $(DESTDIR)/usr/lib/hotplug/firmware
@rm -rf $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-oct6114-256-*
@touch $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-oct6114-256-$(OCT6114_256_VERSION)
@install -m 644 dahdi-fw-oct6114-256.bin $(DESTDIR)/lib/firmware
@rm -rf $(DESTDIR)/lib/firmware/.dahdi-fw-oct6114-256-*
@touch $(DESTDIR)/lib/firmware/.dahdi-fw-oct6114-256-$(OCT6114_256_VERSION)
else
@echo "Firmware dahdi-fw-oct6114-256.bin is already installed with required version $(OCT6114_256_VERSION)"
endif
ifeq ($(shell if ( [ -f $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-tc400m-$(TC400M_VERSION) ] ) && ( [ -f $(DESTDIR)/lib/firmware/.dahdi-fw-tc400m-$(TC400M_VERSION) ] ); then echo "no"; else echo "yes"; fi),yes)
@echo "Installing dahdi-fw-tc400m.bin to hotplug firmware directories"
@install -m 644 dahdi-fw-tc400m.bin $(DESTDIR)/usr/lib/hotplug/firmware
@rm -rf $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-tc400m-*
@touch $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-tc400m-$(TC400M_VERSION)
@install -m 644 dahdi-fw-tc400m.bin $(DESTDIR)/lib/firmware
@rm -rf $(DESTDIR)/lib/firmware/.dahdi-fw-tc400m-*
@touch $(DESTDIR)/lib/firmware/.dahdi-fw-tc400m-$(TC400M_VERSION)
else
@echo "Firmware dahdi-fw-tc400m.bin is already installed with required version $(TC400M_VERSION)"
endif
ifeq ($(shell if ( [ -f $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-hx8-$(HX8_VERSION) ] ) && ( [ -f $(DESTDIR)/lib/firmware/.dahdi-fw-hx8-$(HX8_VERSION) ] ); then echo "no"; else echo "yes"; fi),yes)
@echo "Installing dahdi-fw-hx8.bin to hotplug firmware directories"
@install -m 644 dahdi-fw-hx8.bin $(DESTDIR)/usr/lib/hotplug/firmware
@rm -rf $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-hx8-*
@touch $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-hx8-$(HX8_VERSION)
@install -m 644 dahdi-fw-hx8.bin $(DESTDIR)/lib/firmware
@rm -rf $(DESTDIR)/lib/firmware/.dahdi-fw-hx8-*
@touch $(DESTDIR)/lib/firmware/.dahdi-fw-hx8-$(HX8_VERSION)
else
@echo "Firmware dahdi-fw-hx8.bin is already installed with required version $(HX8_VERSION)"
endif
ifeq ($(shell if ( [ -f $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-vpmoct032-$(VPMOCT032_VERSION) ] ) && ( [ -f $(DESTDIR)/lib/firmware/.dahdi-fw-vpmoct032-$(VPMOCT032_VERSION) ] ); then echo "no"; else echo "yes"; fi),yes)
@echo "Installing dahdi-fw-vpmoct032.bin to hotplug firmware directories"
@install -m 644 dahdi-fw-vpmoct032.bin $(DESTDIR)/usr/lib/hotplug/firmware
@rm -rf $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-vpmoct032-*
@touch $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-vpmoct032-$(VPMOCT032_VERSION)
@install -m 644 dahdi-fw-vpmoct032.bin $(DESTDIR)/lib/firmware
@rm -rf $(DESTDIR)/lib/firmware/.dahdi-fw-vpmoct032-*
@touch $(DESTDIR)/lib/firmware/.dahdi-fw-vpmoct032-$(VPMOCT032_VERSION)
else
@echo "Firmware dahdi-fw-vpmoct032.bin is already installed with required version $(VPMOCT032_VERSION)"
endif
ifeq ($(shell if ( [ -f $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-te820-$(WCT820_VERSION) ] ) && ( [ -f $(DESTDIR)/lib/firmware/.dahdi-fw-te820-$(WCT820_VERSION) ] ); then echo "no"; else echo "yes"; fi),yes)
@echo "Installing dahdi-fw-te820.bin to hotplug firmware directories"
@install -m 644 dahdi-fw-te820.bin $(DESTDIR)/usr/lib/hotplug/firmware
@rm -rf $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-te820-*
@touch $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-te820-$(WCT820_VERSION)
@install -m 644 dahdi-fw-te820.bin $(DESTDIR)/lib/firmware
@rm -rf $(DESTDIR)/lib/firmware/.dahdi-fw-te820-*
@touch $(DESTDIR)/lib/firmware/.dahdi-fw-te820-$(WCT820_VERSION)
else
@echo "Firmware dahdi-fw-te820.bin is already installed with required version $(WCT820_VERSION)"
endif
ifeq ($(shell if ( [ -f $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-te133-$(TE133_VERSION) ] ) && ( [ -f $(DESTDIR)/lib/firmware/.dahdi-fw-te133-$(TE133_VERSION) ] ); then echo "no"; else echo "yes"; fi),yes)
@echo "Installing dahdi-fw-te133.bin to hotplug firmware directories"
@install -m 644 dahdi-fw-te133.bin $(DESTDIR)/usr/lib/hotplug/firmware
@rm -rf $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-te133-*
@touch $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-te133-$(TE133_VERSION)
@install -m 644 dahdi-fw-te133.bin $(DESTDIR)/lib/firmware
@rm -rf $(DESTDIR)/lib/firmware/.dahdi-fw-te133-*
@touch $(DESTDIR)/lib/firmware/.dahdi-fw-te133-$(TE133_VERSION)
else
@echo "Firmware dahdi-fw-te133.bin is already installed with required version $(TE133_VERSION)"
endif
ifeq ($(shell if ( [ -f $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-te134-$(TE134_VERSION) ] ) && ( [ -f $(DESTDIR)/lib/firmware/.dahdi-fw-te134-$(TE134_VERSION) ] ); then echo "no"; else echo "yes"; fi),yes)
@echo "Installing dahdi-fw-te134.bin to hotplug firmware directories"
@install -m 644 dahdi-fw-te134.bin $(DESTDIR)/usr/lib/hotplug/firmware
@rm -rf $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-te134-*
@touch $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-te134-$(TE134_VERSION)
@install -m 644 dahdi-fw-te134.bin $(DESTDIR)/lib/firmware
@rm -rf $(DESTDIR)/lib/firmware/.dahdi-fw-te134-*
@touch $(DESTDIR)/lib/firmware/.dahdi-fw-te134-$(TE134_VERSION)
else
@echo "Firmware dahdi-fw-te134.bin is already installed with required version $(TE134_VERSION)"
endif
ifeq ($(shell if ( [ -f $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-te435-$(TE435_VERSION) ] ) && ( [ -f $(DESTDIR)/lib/firmware/.dahdi-fw-te435-$(TE435_VERSION) ] ); then echo "no"; else echo "yes"; fi),yes)
@echo "Installing dahdi-fw-te435.bin to hotplug firmware directories"
@install -m 644 dahdi-fw-te435.bin $(DESTDIR)/usr/lib/hotplug/firmware
@rm -rf $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-te435-*
@touch $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-te435-$(TE435_VERSION)
@install -m 644 dahdi-fw-te435.bin $(DESTDIR)/lib/firmware
@rm -rf $(DESTDIR)/lib/firmware/.dahdi-fw-te435-*
@touch $(DESTDIR)/lib/firmware/.dahdi-fw-te435-$(TE435_VERSION)
else
@echo "Firmware dahdi-fw-te435.bin is already installed with required version $(TE435_VERSION)"
endif
ifeq ($(shell if ( [ -f $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-a8a-$(A8A_VERSION) ] ) && ( [ -f $(DESTDIR)/lib/firmware/.dahdi-fw-a8a-$(A8A_VERSION) ] ); then echo "no"; else echo "yes"; fi),yes)
@echo "Installing dahdi-fw-a8a.bin to hotplug firmware directories"
@install -m 644 dahdi-fw-a8a.bin $(DESTDIR)/usr/lib/hotplug/firmware
@rm -rf $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-a8a-*
@touch $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-a8a-$(A8A_VERSION)
@install -m 644 dahdi-fw-a8a.bin $(DESTDIR)/lib/firmware
@rm -rf $(DESTDIR)/lib/firmware/.dahdi-fw-a8a-*
@touch $(DESTDIR)/lib/firmware/.dahdi-fw-a8a-$(A8A_VERSION)
else
@echo "Firmware dahdi-fw-a8a.bin is already installed with required version $(A8A_VERSION)"
endif
ifeq ($(shell if ( [ -f $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-a8b-$(A8B_VERSION) ] ) && ( [ -f $(DESTDIR)/lib/firmware/.dahdi-fw-a8b-$(A8B_VERSION) ] ); then echo "no"; else echo "yes"; fi),yes)
@echo "Installing dahdi-fw-a8b.bin to hotplug firmware directories"
@install -m 644 dahdi-fw-a8b.bin $(DESTDIR)/usr/lib/hotplug/firmware
@rm -rf $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-a8b-*
@touch $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-a8b-$(A8B_VERSION)
@install -m 644 dahdi-fw-a8b.bin $(DESTDIR)/lib/firmware
@rm -rf $(DESTDIR)/lib/firmware/.dahdi-fw-a8b-*
@touch $(DESTDIR)/lib/firmware/.dahdi-fw-a8b-$(A8B_VERSION)
else
@echo "Firmware dahdi-fw-a8b.bin is already installed with required version $(A8B_VERSION)"
endif
ifeq ($(shell if ( [ -f $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-a4a-$(A4A_VERSION) ] ) && ( [ -f $(DESTDIR)/lib/firmware/.dahdi-fw-a4a-$(A4A_VERSION) ] ); then echo "no"; else echo "yes"; fi),yes)
@echo "Installing dahdi-fw-a4a.bin to hotplug firmware directories"
@install -m 644 dahdi-fw-a4a.bin $(DESTDIR)/usr/lib/hotplug/firmware
@rm -rf $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-a4a-*
@touch $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-a4a-$(A4A_VERSION)
@install -m 644 dahdi-fw-a4a.bin $(DESTDIR)/lib/firmware
@rm -rf $(DESTDIR)/lib/firmware/.dahdi-fw-a4a-*
@touch $(DESTDIR)/lib/firmware/.dahdi-fw-a4a-$(A4A_VERSION)
else
@echo "Firmware dahdi-fw-a4a.bin is already installed with required version $(A4A_VERSION)"
endif
ifeq ($(shell if ( [ -f $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-a4b-$(A4B_VERSION) ] ) && ( [ -f $(DESTDIR)/lib/firmware/.dahdi-fw-a4b-$(A4B_VERSION) ] ); then echo "no"; else echo "yes"; fi),yes)
@echo "Installing dahdi-fw-a4b.bin to hotplug firmware directories"
@install -m 644 dahdi-fw-a4b.bin $(DESTDIR)/usr/lib/hotplug/firmware
@rm -rf $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-a4b-*
@touch $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-a4b-$(A4B_VERSION)
@install -m 645 dahdi-fw-a4b.bin $(DESTDIR)/lib/firmware
@rm -rf $(DESTDIR)/lib/firmware/.dahdi-fw-a4b-*
@touch $(DESTDIR)/lib/firmware/.dahdi-fw-a4b-$(A4B_VERSION)
else
@echo "Firmware dahdi-fw-a4b.bin is already installed with required version $(A4B_VERSION)"
endif
@$(INSTALL_FIRMWARE) dahdi-fw-oct6114-032 $(OCT6114_032_VERSION)
@$(INSTALL_FIRMWARE) dahdi-fw-oct6114-064 $(OCT6114_064_VERSION)
@$(INSTALL_FIRMWARE) dahdi-fw-oct6114-128 $(OCT6114_128_VERSION)
@$(INSTALL_FIRMWARE) dahdi-fw-oct6114-256 $(OCT6114_256_VERSION)
@$(INSTALL_FIRMWARE) dahdi-fw-tc400m $(TC400M_VERSION)
@$(INSTALL_FIRMWARE) dahdi-fw-hx8 $(HX8_VERSION)
@$(INSTALL_FIRMWARE) dahdi-fw-vpmoct032 $(VPMOCT032_VERSION)
@$(INSTALL_FIRMWARE) dahdi-fw-te820 $(WCT820_VERSION)
@$(INSTALL_FIRMWARE) dahdi-fw-te133 $(TE133_VERSION)
@$(INSTALL_FIRMWARE) dahdi-fw-te134 $(TE134_VERSION)
@$(INSTALL_FIRMWARE) dahdi-fw-te435 $(TE435_VERSION)
@$(INSTALL_FIRMWARE) dahdi-fw-a8a $(A8A_VERSION)
@$(INSTALL_FIRMWARE) dahdi-fw-a8b $(A8B_VERSION)
@$(INSTALL_FIRMWARE) dahdi-fw-a4a $(A4A_VERSION)
@$(INSTALL_FIRMWARE) dahdi-fw-a4b $(A4B_VERSION)
# Uninstall any installed dahdi firmware images from hotplug firmware directories
hotplug-uninstall:

View File

@@ -75,8 +75,6 @@
#define NUM_MODULES 8
#define VPM_SUPPORT
#define CMD_WR(addr, val) (((addr<<8)&0xff00) | (val&0xff))
enum battery_state {
@@ -245,7 +243,6 @@ static inline bool is_four_port(const struct wcaxx *wc)
return (4 == wc->desc->ports);
}
#ifdef VPM_SUPPORT
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/string.h>
@@ -728,7 +725,6 @@ static int wcaxx_vpm_init(struct wcaxx *wc)
return 0;
}
#endif /* VPM_SUPPORT */
static inline bool is_initialized(struct wcaxx *wc)
{
@@ -3084,11 +3080,9 @@ wcaxx_ioctl(struct dahdi_chan *chan, unsigned int cmd, unsigned long data)
((hwgain.tx) ? "tx" : "rx"));
}
break;
#ifdef VPM_SUPPORT
case DAHDI_TONEDETECT:
/* Hardware DTMF detection is not supported. */
return -ENOSYS;
#endif
case DAHDI_SETPOLARITY:
if (get_user(x, (__user int *) data))
return -EFAULT;
@@ -3414,10 +3408,8 @@ static const struct dahdi_span_ops wcaxx_span_ops = {
.chanconfig = wcaxx_chanconfig,
.dacs = wcaxx_dacs,
.assigned = wcaxx_assigned,
#ifdef VPM_SUPPORT
.echocan_create = wcaxx_echocan_create,
.echocan_name = wcaxx_echocan_name,
#endif
};
static struct wcaxx_chan *
@@ -3872,9 +3864,16 @@ static void wcaxx_back_out_gracefully(struct wcaxx *wc)
kfree(wc);
}
static void wcaxx_handle_error(struct wcxb *xb)
{
struct wcaxx *wc = container_of(xb, struct wcaxx, xb);
wc->ddev->irqmisses++;
}
static const struct wcxb_operations wcxb_operations = {
.handle_receive = wcaxx_handle_receive,
.handle_transmit = wcaxx_handle_transmit,
.handle_error = wcaxx_handle_error,
};
struct cmd_results {
@@ -3887,9 +3886,9 @@ static int wcaxx_check_firmware(struct wcaxx *wc)
u32 firmware_version;
const bool force_firmware = false;
const unsigned int A4A_VERSION = 0x0a0017;
const unsigned int A4B_VERSION = 0x0b0017;
const unsigned int A4B_VERSION = 0x0b0019;
const unsigned int A8A_VERSION = 0x1d0017;
const unsigned int A8B_VERSION = 0x1d0017;
const unsigned int A8B_VERSION = 0x1d0019;
if (wc->desc == &device_a8a) {
firmware_version = A8A_VERSION;
@@ -3910,7 +3909,7 @@ static int wcaxx_check_firmware(struct wcaxx *wc)
}
return wcxb_check_firmware(&wc->xb, firmware_version,
filename, force_firmware);
filename, force_firmware, WCXB_RESET_NOW);
}
static void wcaxx_check_sethook(struct wcaxx *wc, struct wcaxx_module *mod)
@@ -4299,7 +4298,12 @@ __wcaxx_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
return -ENOMEM;
}
wc->ddev->devicetype = kasprintf(GFP_KERNEL, "%s", wc->desc->name);
if (wc->vpm)
wc->ddev->devicetype = kasprintf(GFP_KERNEL, "%s (%s)",
wc->desc->name, "VPMOCT032");
else
wc->ddev->devicetype = kasprintf(GFP_KERNEL, "%s",
wc->desc->name);
if (!wc->ddev->devicetype) {
wcaxx_back_out_gracefully(wc);
@@ -4379,11 +4383,9 @@ static void __devexit wcaxx_remove_one(struct pci_dev *pdev)
flush_scheduled_work();
wcxb_stop(&wc->xb);
#ifdef VPM_SUPPORT
if (wc->vpm)
release_vpm450m(wc->vpm);
wc->vpm = NULL;
#endif
wcaxx_release(wc);
}
@@ -4522,9 +4524,7 @@ module_param(neonmwi_monitor, int, 0600);
module_param(neonmwi_level, int, 0600);
module_param(neonmwi_envelope, int, 0600);
module_param(neonmwi_offlimit, int, 0600);
#ifdef VPM_SUPPORT
module_param(vpmsupport, int, 0400);
#endif
module_param(forceload, int, 0600);
MODULE_PARM_DESC(forceload,

View File

@@ -1121,16 +1121,11 @@ static int t4_echocan_create(struct dahdi_chan *chan,
struct t4 *wc = chan->pvt;
struct t4_span *tspan = container_of(chan->span, struct t4_span, span);
int channel;
const struct dahdi_echocan_ops *ops;
const struct dahdi_echocan_features *features;
const bool alaw = (chan->span->deflaw == 2);
if (!vpmsupport || !wc->vpm)
return -ENODEV;
ops = &vpm_ec_ops;
features = &vpm_ec_features;
if (ecp->param_count > 0) {
dev_warn(&wc->dev->dev, "%s echo canceller does not support "
"parameters; failing request\n",
@@ -1139,8 +1134,8 @@ static int t4_echocan_create(struct dahdi_chan *chan,
}
*ec = tspan->ec[chan->chanpos - 1];
(*ec)->ops = ops;
(*ec)->features = *features;
(*ec)->ops = &vpm_ec_ops;
(*ec)->features = vpm_ec_features;
channel = has_e1_span(wc) ? chan->chanpos : chan->chanpos + 4;

View File

@@ -3100,6 +3100,8 @@ wctdm_init_voicedaa(struct wctdm *wc, struct wctdm_module *mod,
spin_unlock_irqrestore(&wc->reglock, flags);
msleep(20);
memset(&mod->mod.fxo, 0, sizeof(mod->mod.fxo));
if (!sane && wctdm_voicedaa_insane(wc, mod))
return -2;
@@ -3244,8 +3246,7 @@ wctdm_init_proslic(struct wctdm *wc, struct wctdm_module *const mod,
return -2;
/* Initialize VMWI settings */
memset(&(fxs->vmwisetting), 0, sizeof(fxs->vmwisetting));
fxs->vmwi_linereverse = 0;
memset(fxs, 0, sizeof(*fxs));
/* By default, don't send on hook */
if (!reversepolarity != !fxs->reversepolarity)

View File

@@ -45,9 +45,9 @@
static const char *TE133_FW_FILENAME = "dahdi-fw-te133.bin";
static const char *TE134_FW_FILENAME = "dahdi-fw-te134.bin";
static const u32 TE13X_FW_VERSION = 0x6f0017;
static const u32 TE133_FW_VERSION = 0x780019;
static const u32 TE134_FW_VERSION = 0x780017;
#define VPM_SUPPORT
#define WC_MAX_IFACES 8
enum linemode {
@@ -107,9 +107,7 @@ struct t13x {
struct timer_list timer;
struct work_struct timer_work;
struct workqueue_struct *wq;
#ifdef VPM_SUPPORT
struct vpm450m *vpm;
#endif
struct mutex lock;
struct wcxb xb;
};
@@ -118,10 +116,17 @@ static void te13x_handle_transmit(struct wcxb *xb, void *vfp);
static void te13x_handle_receive(struct wcxb *xb, void *vfp);
static void te13x_handle_interrupt(struct wcxb *xb, u32 pending);
static void te13x_handle_error(struct wcxb *xb)
{
struct t13x *wc = container_of(xb, struct t13x, xb);
wc->ddev->irqmisses++;
}
static struct wcxb_operations xb_ops = {
.handle_receive = te13x_handle_receive,
.handle_transmit = te13x_handle_transmit,
.handle_interrupt = te13x_handle_interrupt,
.handle_error = te13x_handle_error,
};
/* Maintenance Mode Registers */
@@ -178,6 +183,7 @@ static int yelalarmdebounce = 500; /* RAI(yellow) def to 0.5s AT&T devguide */
static char *default_linemode = "t1"; /* 'e1', 't1', or 'j1' */
static int force_firmware;
static int latency = WCXB_DEFAULT_LATENCY;
static unsigned int max_latency = WCXB_DEFAULT_MAXLATENCY;
struct t13x_firm_header {
u8 header[6];
@@ -190,7 +196,6 @@ struct t13x_firm_header {
static void t13x_check_alarms(struct t13x *wc);
static void t13x_check_sigbits(struct t13x *wc);
#ifdef VPM_SUPPORT
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/string.h>
@@ -656,7 +661,7 @@ static struct vpm450m *init_vpm450m(struct t13x *wc, int isalaw,
}
}
if (vpmsupport != 0)
if (vpmsupport)
wcxb_enable_echocan(&wc->xb);
kfree(ChipOpen);
@@ -786,7 +791,6 @@ static void t13x_vpm_init(struct t13x *wc)
"VPM450: Present and operational servicing %d span\n", 1);
}
#endif /* VPM_SUPPORT */
static int t13x_clear_maint(struct dahdi_span *span);
@@ -796,8 +800,8 @@ struct t13x_desc {
const char *name;
};
static const struct t13x_desc te133 = {"Wildcard TE133"}; /* pci express */
static const struct t13x_desc te134 = {"Wildcard TE134"}; /* legacy pci */
static const struct t13x_desc te133 = {"Wildcard TE131/TE133"}; /* pci express*/
static const struct t13x_desc te134 = {"Wildcard TE132/TE134"}; /* legacy pci */
static inline bool is_pcie(const struct t13x *t1)
{
@@ -1251,25 +1255,6 @@ static void t13x_framer_start(struct t13x *wc)
set_bit(DAHDI_FLAGBIT_RUNNING, &wc->span.flags);
}
static void set_span_devicetype(struct t13x *wc)
{
const char *olddevicetype;
olddevicetype = wc->ddev->devicetype;
#ifndef VPM_SUPPORT
wc->ddev->devicetype = kasprintf(GFP_KERNEL,
"%s (VPMOCT032)", wc->devtype->name);
#else
wc->ddev->devicetype = kasprintf(GFP_KERNEL, "%s", wc->devtype->name);
#endif /* VPM_SUPPORT */
/* On the off chance that we were able to allocate it previously. */
if (!wc->ddev->devicetype)
wc->ddev->devicetype = olddevicetype;
else
kfree(olddevicetype);
}
/**
* te13xp_check_for_interrupts - Return 0 if the card is generating interrupts.
* @wc: The card to check.
@@ -1307,8 +1292,6 @@ static int t13x_startup(struct file *file, struct dahdi_span *span)
unsigned long flags;
int ret;
set_span_devicetype(wc);
/* Stop the DMA since the clock source may have changed. */
wcxb_stop_dma(&wc->xb);
ret = wcxb_wait_for_stop(&wc->xb, 50);
@@ -1726,8 +1709,6 @@ static int t13x_software_init(struct t13x *wc, enum linemode type)
goto error_exit;
}
set_span_devicetype(wc);
/* Because the interrupt handler is running, we need to atomically
* swap the channel arrays. */
spin_lock_irqsave(&wc->reglock, flags);
@@ -1779,8 +1760,6 @@ static int t13x_software_init(struct t13x *wc, enum linemode type)
wc->chans[x]->chanpos = x + 1;
}
set_span_devicetype(wc);
return 0;
error_exit:
@@ -2211,7 +2190,7 @@ static void te13x_handle_receive(struct wcxb *xb, void *vfp)
}
}
if (0 == vpmsupport) {
if (!vpmsupport || !wc->vpm) {
for (i = 0; i < wc->span.channels; i++) {
struct dahdi_chan *const c = wc->span.chans[i];
__dahdi_ec_chunk(c, c->readchunk, c->readchunk,
@@ -2379,10 +2358,8 @@ static const struct dahdi_span_ops t13x_span_ops = {
.maint = t13x_maint,
.ioctl = t13x_ioctl,
.set_spantype = t13x_set_linemode,
#ifdef VPM_SUPPORT
.echocan_create = t13x_echocan_create,
.echocan_name = t13x_echocan_name,
#endif /* VPM_SUPPORT */
};
#define SPI_BASE 0x200
@@ -2455,6 +2432,30 @@ error_exit:
return serial;
}
static int te13xp_check_firmware(struct t13x *wc)
{
const char *filename;
u32 expected_version;
enum wcxb_reset_option reset;
if (is_pcie(wc)) {
filename = TE133_FW_FILENAME;
expected_version = TE133_FW_VERSION;
} else {
filename = TE134_FW_FILENAME;
expected_version = TE134_FW_VERSION;
}
/* Specific firmware requires power cycle to properly reset */
if (0x6f0017 == wcxb_get_firmware_version(&wc->xb))
reset = WCXB_RESET_LATER;
else
reset = WCXB_RESET_NOW;
return wcxb_check_firmware(&wc->xb, expected_version, filename,
force_firmware, reset);
}
static int __devinit te13xp_init_one(struct pci_dev *pdev,
const struct pci_device_id *ent)
{
@@ -2464,6 +2465,7 @@ static int __devinit te13xp_init_one(struct pci_dev *pdev,
int res;
unsigned int index = -1;
enum linemode type;
bool vpmcapable = false;
for (x = 0; x < ARRAY_SIZE(ifaces); x++) {
if (!ifaces[x]) {
@@ -2532,24 +2534,26 @@ static int __devinit te13xp_init_one(struct pci_dev *pdev,
wc->xb.pdev = pdev;
wc->xb.ops = &xb_ops;
wc->xb.debug = &debug;
res = wcxb_init(&wc->xb, wc->name, 1);
res = wcxb_init(&wc->xb, wc->name, 0);
if (res)
goto fail_exit;
/* Check for field updatable firmware */
if (is_pcie(wc)) {
res = wcxb_check_firmware(&wc->xb, TE13X_FW_VERSION,
TE133_FW_FILENAME, force_firmware);
if (res)
goto fail_exit;
} else {
res = wcxb_check_firmware(&wc->xb, TE13X_FW_VERSION,
TE134_FW_FILENAME, force_firmware);
if (res)
goto fail_exit;
}
res = te13xp_check_firmware(wc);
if (res)
goto fail_exit;
wc->ddev->hardware_id = t13x_read_serial(wc);
if (!wc->ddev->hardware_id) {
dev_info(&wc->dev->dev, "No serial number found.\n");
res = -EIO;
goto fail_exit;
}
/* Check for hardware echo cancel support */
if (!strncmp("TE133", wc->ddev->hardware_id+1, 5) ||
!strncmp("TE134", wc->ddev->hardware_id+1, 5)) {
vpmcapable = true;
}
wc->wq = create_singlethread_workqueue(wc->name);
if (!wc->wq) {
@@ -2573,6 +2577,9 @@ static int __devinit te13xp_init_one(struct pci_dev *pdev,
goto fail_exit;
}
wcxb_set_minlatency(&wc->xb, latency);
wcxb_set_maxlatency(&wc->xb, max_latency);
create_sysfs_files(wc);
res = t13x_hardware_post_init(wc, &type);
@@ -2585,10 +2592,15 @@ static int __devinit te13xp_init_one(struct pci_dev *pdev,
if (res)
goto fail_exit;
#ifdef VPM_SUPPORT
if (!wc->vpm)
if (!wc->vpm && vpmsupport && vpmcapable)
t13x_vpm_init(wc);
#endif
if (wc->vpm)
wc->ddev->devicetype = kasprintf(GFP_KERNEL,
"%s (VPMOCT032)", wc->devtype->name);
else
wc->ddev->devicetype = kasprintf(GFP_KERNEL, "%s",
wc->devtype->name);
wc->span.ops = &t13x_span_ops;
list_add_tail(&wc->span.device_node, &wc->ddev->spans);
@@ -2646,11 +2658,9 @@ static void __devexit te13xp_remove_one(struct pci_dev *pdev)
/* Turn off status LED */
t13x_setleds(wc, 0);
#ifdef VPM_SUPPORT
if (wc->vpm)
release_vpm450m(wc->vpm);
wc->vpm = NULL;
#endif
dahdi_unregister_device(wc->ddev);
@@ -2725,12 +2735,12 @@ module_param(alarmdebounce, int, S_IRUGO | S_IWUSR);
module_param(losalarmdebounce, int, S_IRUGO | S_IWUSR);
module_param(aisalarmdebounce, int, S_IRUGO | S_IWUSR);
module_param(yelalarmdebounce, int, S_IRUGO | S_IWUSR);
#ifdef VPM_SUPPORT
module_param(vpmsupport, int, 0600);
#endif
module_param(force_firmware, int, S_IRUGO);
module_param(latency, int, S_IRUGO);
MODULE_PARM_DESC(latency, "How many milliseconds of audio to buffer between card and host (3ms default). This number will increase during runtime, dynamically, if dahdi detects that it is too small. This is commonly refered to as a \"latency bump\"");
module_param(max_latency, int, 0600);
MODULE_PARM_DESC(max_latency, "The maximum amount of latency that the driver will permit.");
MODULE_DESCRIPTION("Wildcard Digital Card Driver");
MODULE_AUTHOR("Digium Incorporated <support@digium.com>");

View File

@@ -52,10 +52,9 @@
#include "wcxb_flash.h"
static const char *TE435_FW_FILENAME = "dahdi-fw-te435.bin";
static const u32 TE435_VERSION = 0xe0017;
static const u32 TE435_VERSION = 0xe0019;
/* #define RPC_RCLK */
#define VPM_SUPPORT
enum linemode {
T1 = 1,
@@ -129,10 +128,8 @@ struct t43x {
struct workqueue_struct *wq;
struct t43x_clksrc_work clksrc_work;
unsigned int not_ready; /* 0 when entire card is ready to go */
#ifdef VPM_SUPPORT
struct vpm450m *vpm;
char *vpm_name;
#endif
struct mutex lock;
bool latency_locked;
int syncsrc;
@@ -147,10 +144,17 @@ static void t43x_handle_transmit(struct wcxb *xb, void *vfp);
static void t43x_handle_receive(struct wcxb *xb, void *vfp);
static void t43x_handle_interrupt(struct wcxb *xb, u32 pending);
static void t43x_handle_error(struct wcxb *xb)
{
struct t43x *wc = container_of(xb, struct t43x, xb);
wc->ddev->irqmisses++;
}
static struct wcxb_operations xb_ops = {
.handle_receive = t43x_handle_receive,
.handle_transmit = t43x_handle_transmit,
.handle_interrupt = t43x_handle_interrupt,
.handle_error = t43x_handle_error,
};
/* Maintenance Mode Registers */
@@ -220,9 +224,6 @@ static void t43x_check_sigbits(struct t43x *wc, int span_idx);
static const struct dahdi_span_ops t43x_span_ops;
static void __t43x_set_timing_source_auto(struct t43x *wc);
#ifndef VPM_SUPPORT
static int vpmsupport;
#else
static int vpmsupport = 1;
#include "oct6100api/oct6100_api.h"
@@ -654,16 +655,11 @@ static int t43x_echocan_create(struct dahdi_chan *chan,
struct t43x *wc = chan->pvt;
struct t43x_span *ts = container_of(chan->span, struct t43x_span, span);
int channel = chan->chanpos - 1;
const struct dahdi_echocan_ops *ops;
const struct dahdi_echocan_features *features;
const bool alaw = (chan->span->deflaw == 2);
if (!vpmsupport || !wc->vpm)
return -ENODEV;
ops = &vpm_ec_ops;
features = &vpm_ec_features;
if (ecp->param_count > 0) {
dev_warn(&wc->xb.pdev->dev,
"%s echo canceller does not support parameters; failing request\n",
@@ -672,8 +668,8 @@ static int t43x_echocan_create(struct dahdi_chan *chan,
}
*ec = ts->ec[channel];
(*ec)->ops = ops;
(*ec)->features = *features;
(*ec)->ops = &vpm_ec_ops;
(*ec)->features = vpm_ec_features;
channel += (32*chan->span->offset);
vpm450m_set_alaw_companding(wc->vpm, channel, alaw);
@@ -772,7 +768,6 @@ static void t43x_vpm_init(struct t43x *wc)
wc->numspans);
}
#endif /* VPM_SUPPORT */
static int t43x_clear_maint(struct dahdi_span *span);
@@ -3164,10 +3159,8 @@ static const struct dahdi_span_ops t43x_span_ops = {
.ioctl = t43x_ioctl,
.assigned = t43x_span_assigned,
.set_spantype = t43x_set_linemode,
#ifdef VPM_SUPPORT
.echocan_create = t43x_echocan_create,
.echocan_name = t43x_echocan_name,
#endif /* VPM_SUPPORT */
};
/**
@@ -3327,7 +3320,7 @@ static int __devinit t43x_init_one(struct pci_dev *pdev,
wc->xb.ops = &xb_ops;
wc->xb.debug = &debug;
res = wcxb_init(&wc->xb, KBUILD_MODNAME, 1);
res = wcxb_init(&wc->xb, KBUILD_MODNAME, 0);
if (res)
goto fail_exit;
@@ -3364,7 +3357,7 @@ static int __devinit t43x_init_one(struct pci_dev *pdev,
/* Check for field updatable firmware */
res = wcxb_check_firmware(&wc->xb, TE435_VERSION,
TE435_FW_FILENAME, force_firmware);
TE435_FW_FILENAME, force_firmware, WCXB_RESET_NOW);
if (res)
goto fail_exit;
@@ -3416,7 +3409,6 @@ static int __devinit t43x_init_one(struct pci_dev *pdev,
t43x_init_spans(wc, type);
#ifdef VPM_SUPPORT
if (!wc->vpm)
t43x_vpm_init(wc);
@@ -3428,10 +3420,6 @@ static int __devinit t43x_init_one(struct pci_dev *pdev,
wc->ddev->devicetype = kasprintf(GFP_KERNEL,
"%s", wc->devtype->name);
}
#else
wc->ddev->devicetype = kasprintf(GFP_KERNEL,
"%s", wc->devtype->name);
#endif
res = dahdi_register_device(wc->ddev, &wc->xb.pdev->dev);
if (res) {
@@ -3484,11 +3472,9 @@ static void __devexit t43x_remove_one(struct pci_dev *pdev)
/* Turn off status LEDs */
t43x_setleds(wc, 0);
#ifdef VPM_SUPPORT
if (wc->vpm)
release_vpm450m(wc->vpm);
wc->vpm = NULL;
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
cancel_work_sync(&wc->clksrc_work.work);
@@ -3574,9 +3560,7 @@ module_param(alarmdebounce, int, S_IRUGO | S_IWUSR);
module_param(losalarmdebounce, int, S_IRUGO | S_IWUSR);
module_param(aisalarmdebounce, int, S_IRUGO | S_IWUSR);
module_param(yelalarmdebounce, int, S_IRUGO | S_IWUSR);
#ifdef VPM_SUPPORT
module_param(vpmsupport, int, 0600);
#endif
module_param(force_firmware, int, S_IRUGO);
module_param(latency, int, S_IRUGO);
MODULE_PARM_DESC(latency, "How many milliseconds of audio to buffer between card and host (3ms default). This number will increase during runtime, dynamically, if dahdi detects that it is too small. This is commonly refered to as a \"latency bump\"");

View File

@@ -45,10 +45,13 @@
/* The definition for Surprise Down was added in Linux 3.6 in (a0dee2e PCI: misc
* pci_reg additions). It may be backported though so we won't check for the
* version. */
* version. Same with PCI_EXP_SLTCTL_PDCE. */
#ifndef PCI_ERR_UNC_SURPDN
#define PCI_ERR_UNC_SURPDN 0x20
#endif
#ifndef PCI_EXP_SLTCTL_PDCE
#define PCI_EXP_SLTCTL_PDCE 0x8
#endif
/* FPGA Status definitions */
#define OCT_CPU_RESET (1 << 0)
@@ -62,8 +65,9 @@
#define DRING_SIZE_MASK (DRING_SIZE-1)
#define DESC_EOR (1 << 0)
#define DESC_INT (1 << 1)
#define DESC_IO_ERROR (1 << 30)
#define DESC_OWN (1 << 31)
#define DESC_DEFAULT_STATUS 0xdeadbeef
#define DESC_DEFAULT_STATUS 0xdeadbe00
#define DMA_CHAN_SIZE 128
/* Echocan definitions */
@@ -351,16 +355,49 @@ static void _wcxb_reset_dring(struct wcxb *xb)
BUG_ON(!hdesc);
/* Set end of ring bit in last descriptor to force hw to loop around */
hdesc->control |= cpu_to_be32(DESC_EOR);
#ifdef DEBUG
xb->last_retry_count = 0;
#endif
iowrite32be(xb->hw_dring_phys, xb->membase + TDM_DRING_ADDR);
}
static void wcxb_handle_dma(struct wcxb *xb)
{
#ifdef DEBUG
bool did_retry_dma = false;
u8 retry;
#endif
struct wcxb_meta_desc *mdesc;
struct wcxb_hw_desc *tail = &(xb->hw_dring[xb->dma_tail]);
while (!(xb->hw_dring[xb->dma_tail].control & cpu_to_be32(DESC_OWN))) {
while (!(tail->control & cpu_to_be32(DESC_OWN))) {
u_char *frame;
if (tail->control & cpu_to_be32(DESC_IO_ERROR)) {
u32 ier;
unsigned long flags;
/* The firmware detected an error condition on the bus.
* Force an underrun by disabling the descriptor
* complete interrupt. When the driver processes the
* underrun it will reset the TDM engine. */
xb->flags.io_error = 1;
spin_lock_irqsave(&xb->lock, flags);
ier = ioread32be(xb->membase + IER);
iowrite32be(ier & ~DESC_COMPLETE, xb->membase + IER);
spin_unlock_irqrestore(&xb->lock, flags);
return;
}
#ifdef DEBUG
retry = be32_to_cpu(tail->status) & 0xff;
if (xb->last_retry_count != retry) {
xb->last_retry_count = retry;
did_retry_dma = true;
}
#endif
mdesc = &xb->meta_dring[xb->dma_tail];
frame = mdesc->rx_buf_virt;
@@ -368,6 +405,7 @@ static void wcxb_handle_dma(struct wcxb *xb)
xb->dma_tail =
(xb->dma_tail == xb->latency-1) ? 0 : xb->dma_tail + 1;
tail = &(xb->hw_dring[xb->dma_tail]);
mdesc = &xb->meta_dring[xb->dma_head];
frame = mdesc->tx_buf_virt;
@@ -379,6 +417,13 @@ static void wcxb_handle_dma(struct wcxb *xb)
xb->dma_head =
(xb->dma_head == xb->latency-1) ? 0 : xb->dma_head + 1;
}
#ifdef DEBUG
if (did_retry_dma) {
dev_info(&xb->pdev->dev,
"DMA retries detected: %d\n", xb->last_retry_count);
}
#endif
}
static irqreturn_t _wcxb_isr(int irq, void *dev_id)
@@ -397,20 +442,40 @@ static irqreturn_t _wcxb_isr(int irq, void *dev_id)
if (pending & DESC_UNDERRUN) {
u32 reg;
/* bump latency */
/* Report the error in case drivers have any custom
* methods for indicating potential data corruption. An
* underrun means data loss in the TDM channel. */
if (xb->ops->handle_error)
xb->ops->handle_error(xb);
spin_lock(&xb->lock);
if (!xb->flags.latency_locked) {
xb->latency++;
if (xb->flags.io_error) {
/* Since an IO error is not necessarily because
* the host could not keep up, we do not want to
* bump the latency. */
xb->flags.io_error = 0;
dev_warn(&xb->pdev->dev,
"IO error reported by firmware.\n");
} else if (!xb->flags.latency_locked) {
/* bump latency */
xb->latency = min(xb->latency + 1,
xb->max_latency);
#ifdef HAVE_RATELIMIT
if (__ratelimit(&_underrun_rl)) {
#else
if (printk_ratelimit()) {
#endif
dev_info(&xb->pdev->dev,
"Underrun detected by hardware. Latency bumped to: %dms\n",
xb->latency);
if (xb->latency != xb->max_latency) {
dev_info(&xb->pdev->dev,
"Underrun detected by hardware. Latency bumped to: %dms\n",
xb->latency);
} else {
dev_info(&xb->pdev->dev,
"Underrun detected by hardware. Latency at max of %dms.\n",
xb->latency);
}
}
}
@@ -540,27 +605,41 @@ static void _wcxb_pcie_hard_reset(struct wcxb *xb)
{
struct pci_dev *const parent = xb->pdev->bus->self;
u32 aer_mask;
int pos;
u16 sltctl;
int pos_err;
int pos_exp;
if (!wcxb_is_pcie(xb))
return;
pos = pci_find_ext_capability(parent, PCI_EXT_CAP_ID_ERR);
if (pos) {
pci_read_config_dword(parent, pos + PCI_ERR_UNCOR_MASK,
pos_err = pci_find_ext_capability(parent, PCI_EXT_CAP_ID_ERR);
if (pos_err) {
pci_read_config_dword(parent, pos_err + PCI_ERR_UNCOR_MASK,
&aer_mask);
pci_write_config_dword(parent, pos + PCI_ERR_UNCOR_MASK,
pci_write_config_dword(parent, pos_err + PCI_ERR_UNCOR_MASK,
aer_mask | PCI_ERR_UNC_SURPDN);
}
/* Also disable any presence change reporting. */
pos_exp = pci_find_capability(parent, PCI_CAP_ID_EXP);
if (pos_exp) {
pci_read_config_word(parent, pos_exp + PCI_EXP_SLTCTL,
&sltctl);
pci_write_config_word(parent, pos_exp + PCI_EXP_SLTCTL,
sltctl & ~PCI_EXP_SLTCTL_PDCE);
}
_wcxb_hard_reset(xb);
if (pos) {
pci_write_config_dword(parent, pos + PCI_ERR_UNCOR_MASK,
if (pos_exp)
pci_write_config_word(parent, pos_exp + PCI_EXP_SLTCTL, sltctl);
if (pos_err) {
pci_write_config_dword(parent, pos_err + PCI_ERR_UNCOR_MASK,
aer_mask);
/* Clear the error as well from the status register. */
pci_write_config_dword(parent, pos + PCI_ERR_UNCOR_STATUS,
pci_write_config_dword(parent, pos_err + PCI_ERR_UNCOR_STATUS,
PCI_ERR_UNC_SURPDN);
}
@@ -602,6 +681,8 @@ int wcxb_init(struct wcxb *xb, const char *board_name, u32 int_mode)
return -EINVAL;
xb->latency = WCXB_DEFAULT_LATENCY;
xb->max_latency = WCXB_DEFAULT_MAXLATENCY;
spin_lock_init(&xb->lock);
xb->membase = pci_iomap(pdev, 0, 0);
@@ -778,7 +859,7 @@ struct wcxb_firm_header {
__le32 version;
} __packed;
static u32 wcxb_get_firmware_version(struct wcxb *xb)
u32 wcxb_get_firmware_version(struct wcxb *xb)
{
u32 version = 0;
@@ -793,7 +874,8 @@ static u32 wcxb_get_firmware_version(struct wcxb *xb)
}
static int wcxb_update_firmware(struct wcxb *xb, const struct firmware *fw,
const char *filename)
const char *filename,
enum wcxb_reset_option reset)
{
u32 tdm_control;
static const int APPLICATION_ADDRESS = 0x200000;
@@ -845,14 +927,20 @@ static int wcxb_update_firmware(struct wcxb *xb, const struct firmware *fw,
APPLICATION_ADDRESS + META_BLOCK_OFFSET,
&meta, sizeof(meta));
/* Reset fpga after loading firmware */
dev_info(&xb->pdev->dev, "Firmware load complete. Reseting device.\n");
tdm_control = ioread32be(xb->membase + TDM_CONTROL);
if (WCXB_RESET_NOW == reset) {
/* Reset fpga after loading firmware */
dev_info(&xb->pdev->dev,
"Firmware load complete. Reseting device.\n");
tdm_control = ioread32be(xb->membase + TDM_CONTROL);
wcxb_hard_reset(xb);
wcxb_hard_reset(xb);
iowrite32be(0, xb->membase + 0x04);
iowrite32be(tdm_control, xb->membase + TDM_CONTROL);
iowrite32be(0, xb->membase + 0x04);
iowrite32be(tdm_control, xb->membase + TDM_CONTROL);
} else {
dev_info(&xb->pdev->dev,
"Delaying reset. Firmware load requires a power cycle\n");
}
wcxb_spi_device_destroy(flash_spi_device);
wcxb_spi_master_destroy(flash_spi_master);
@@ -860,10 +948,16 @@ static int wcxb_update_firmware(struct wcxb *xb, const struct firmware *fw,
}
int wcxb_check_firmware(struct wcxb *xb, const u32 expected_version,
const char *firmware_filename, bool force_firmware)
const char *firmware_filename, bool force_firmware,
enum wcxb_reset_option reset)
{
const struct firmware *fw;
const struct wcxb_firm_header *header;
static const int APPLICATION_ADDRESS = 0x200000;
static const int META_BLOCK_OFFSET = 0x170000;
struct wcxb_spi_master *flash_spi_master;
struct wcxb_spi_device *flash_spi_device;
struct wcxb_meta_block meta;
int res = 0;
u32 crc;
u32 version = 0;
@@ -882,6 +976,27 @@ int wcxb_check_firmware(struct wcxb *xb, const u32 expected_version,
return 0;
}
/* Check meta firmware version for a not-booted application image */
flash_spi_master = wcxb_spi_master_create(&xb->pdev->dev,
xb->membase + FLASH_SPI_BASE,
false);
flash_spi_device = wcxb_spi_device_create(flash_spi_master, 0);
res = wcxb_flash_read(flash_spi_device,
APPLICATION_ADDRESS + META_BLOCK_OFFSET,
&meta, sizeof(meta));
if (res) {
dev_info(&xb->pdev->dev, "Unable to read flash\n");
return -EIO;
}
if ((meta.version == cpu_to_le32(expected_version))
&& !force_firmware) {
dev_info(&xb->pdev->dev,
"Detected previous firmware updated to current version %x, but %x is currently running on card. You likely need to power cycle your system.\n",
expected_version, version);
return 0;
}
if (force_firmware) {
dev_info(&xb->pdev->dev,
"force_firmware module parameter is set. Forcing firmware load, regardless of version\n");
@@ -924,12 +1039,22 @@ int wcxb_check_firmware(struct wcxb *xb, const u32 expected_version,
dev_info(&xb->pdev->dev, "Found %s (version: %x) Preparing for flash\n",
firmware_filename, header->version);
res = wcxb_update_firmware(xb, fw, firmware_filename);
res = wcxb_update_firmware(xb, fw, firmware_filename, reset);
version = wcxb_get_firmware_version(xb);
dev_info(&xb->pdev->dev, "Reset into firmware version: %x\n", version);
if (WCXB_RESET_NOW == reset) {
dev_info(&xb->pdev->dev,
"Reset into firmware version: %x\n", version);
} else {
dev_info(&xb->pdev->dev,
"Running firmware version: %x\n", version);
dev_info(&xb->pdev->dev,
"Loaded firmware version: %x (Will load after next power cycle)\n",
header->version);
}
if ((expected_version != version) && !force_firmware) {
if ((WCXB_RESET_NOW == reset) && (expected_version != version)
&& !force_firmware) {
/* On the off chance that the interface is in a state where it
* cannot boot into the updated firmware image, power cycling
* the card can recover. A simple "reset" of the computer is not

View File

@@ -47,6 +47,11 @@ struct wcxb_operations {
struct wcxb_meta_desc;
struct wcxb_hw_desc;
/**
* struct wcxb - Interface to wcxb firmware.
* @last_retry_count: Running count of times firmware had to retry host DMA
* transaction. Debugging aide.
*/
struct wcxb {
struct pci_dev *pdev;
spinlock_t lock;
@@ -61,6 +66,7 @@ struct wcxb {
#ifdef WCXB_PCI_DEV_DOES_NOT_HAVE_IS_PCIE
u32 is_pcie:1;
#endif
u32 io_error:1;
} flags;
void __iomem *membase;
struct wcxb_meta_desc *meta_dring;
@@ -70,6 +76,9 @@ struct wcxb {
dma_addr_t hw_dring_phys;
struct dma_pool *pool;
unsigned long framecount;
#ifdef DEBUG
u8 last_retry_count;
#endif
};
extern int wcxb_init(struct wcxb *xb, const char *board_name, u32 int_mode);
@@ -105,9 +114,17 @@ static inline void wcxb_disable_timing_header_driver(struct wcxb *xb)
xb->flags.drive_timing_cable = 0;
}
enum wcxb_reset_option {
WCXB_RESET_NOW,
WCXB_RESET_LATER
};
extern u32 wcxb_get_firmware_version(struct wcxb *xb);
extern int wcxb_check_firmware(struct wcxb *xb, const u32 expected_version,
const char *firmware_filename,
bool force_firmware);
bool force_firmware,
enum wcxb_reset_option reset);
extern void wcxb_stop_dma(struct wcxb *xb);
extern void wcxb_disable_interrupts(struct wcxb *xb);

View File

@@ -611,7 +611,7 @@ static int set_pri_proto(xpd_t *xpd, enum pri_protocol set_proto)
}
priv->pri_protocol = set_proto;
priv->is_cas = -1;
phonedev->channels = pri_num_channels(set_proto);
phonedev_alloc_channels(xpd, pri_num_channels(set_proto));
phonedev->offhook_state = BITMASK(phonedev->channels);
CALL_PHONE_METHOD(card_pcm_recompute, xpd, 0);
priv->deflaw = deflaw;
@@ -1082,6 +1082,7 @@ static int pri_set_spantype(struct dahdi_span *span, enum spantypes spantype)
struct phonedev *phonedev = container_of(span, struct phonedev, span);
xpd_t *xpd = container_of(phonedev, struct xpd, phonedev);
enum pri_protocol set_proto = PRI_PROTO_0;
int ret;
XPD_INFO(xpd, "%s: %s\n", __func__, dahdi_spantype2str(spantype));
switch (spantype) {
@@ -1099,7 +1100,13 @@ static int pri_set_spantype(struct dahdi_span *span, enum spantypes spantype)
__func__, dahdi_spantype2str(spantype));
return -EINVAL;
}
return set_pri_proto(xpd, set_proto);
ret = set_pri_proto(xpd, set_proto);
if (ret < 0) {
XPD_ERR(xpd, "%s: set_pri_proto failed\n", __func__);
return ret;
}
dahdi_init_span(span);
return 0;
}
static int PRI_card_open(xpd_t *xpd, lineno_t pos)
@@ -1929,7 +1936,8 @@ static void PRI_card_pcm_tospan(xpd_t *xpd, xpacket_t *pack)
dchan_state(xpd, 0);
}
if (IS_SET(physical_mask, i)) {
r = XPD_CHAN(xpd, logical_chan)->readchunk;
struct dahdi_chan *chan = XPD_CHAN(xpd, logical_chan);
r = chan->readchunk;
// memset((u_char *)r, 0x5A, DAHDI_CHUNKSIZE); // DEBUG
memcpy((u_char *)r, pcm, DAHDI_CHUNKSIZE);
pcm += DAHDI_CHUNKSIZE;

View File

@@ -60,8 +60,8 @@ static DEF_PARM(uint, command_queue_length, 1500, 0444,
static DEF_PARM(uint, poll_timeout, 1000, 0644,
"Timeout (in jiffies) waiting for units to reply");
static DEF_PARM_BOOL(rx_tasklet, 0, 0644, "Use receive tasklets");
static DEF_PARM_BOOL(dahdi_autoreg, 1, 0644,
"Register devices automatically (1) or not (0)");
static DEF_PARM_BOOL(dahdi_autoreg, 0, 0444,
"Register devices automatically (1) or not (0). UNUSED.");
#ifdef CONFIG_PROC_FS
static const struct file_operations xbus_read_proc_ops;
@@ -953,10 +953,14 @@ int xbus_register_dahdi_device(xbus_t *xbus)
goto err;
}
if (xbus_is_registered(xbus)) {
XBUS_ERR(xbus, "Already registered to DAHDI\n");
WARN_ON(1);
ret = -EINVAL;
goto err;
/*
* Ignore duplicate registrations (from dahdi_registration)
* Until we completely migrate to dahdi_autoreg=1 and
* hotplug-based span-assignments
*/
XBUS_DBG(DEVICES, xbus, "Already registered to DAHDI\n");
ret = 0;
goto out;
}
xbus->ddev = dahdi_create_device();
if (!xbus->ddev) {
@@ -1118,7 +1122,7 @@ void xbus_populate(void *data)
*/
xbus_request_sync(xbus, SYNC_MODE_PLL);
elect_syncer("xbus_populate(end)"); /* FIXME: try to do it later */
if (dahdi_autoreg)
if (!dahdi_get_auto_assign_spans())
xbus_register_dahdi_device(xbus);
out:
XBUS_DBG(DEVICES, xbus, "Leaving\n");
@@ -1977,6 +1981,10 @@ int __init xbus_core_init(void)
{
int ret = 0;
if (dahdi_autoreg == 1) {
NOTICE("WARNING: The dahdi_autoreg parameter is deprecated " \
"-- just set dahdi.auto_assign_spans=0\n");
}
initialize_xbuses_array();
#ifdef PROTOCOL_DEBUG
INFO("FEATURE: with PROTOCOL_DEBUG\n");

View File

@@ -23,7 +23,6 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/mutex.h>
#include <linux/proc_fs.h>
#ifdef PROTOCOL_DEBUG
#include <linux/ctype.h>
@@ -596,8 +595,6 @@ static DEVICE_ATTR_READER(span_show, dev, buf)
return len;
}
static DEFINE_MUTEX(span_store_mutex);
/*
* For backward compatibility with old dahdi-tools
* Remove after dahdi_registration is upgraded
@@ -619,29 +616,10 @@ static DEVICE_ATTR_WRITER(span_store, dev, buf, count)
return -ENODEV;
XPD_DBG(DEVICES, xpd, "%s -- deprecated (should use assigned-spans)\n",
(dahdi_reg) ? "register" : "unregister");
ret = mutex_lock_interruptible(&span_store_mutex);
if (ret < 0) {
XBUS_ERR(xpd->xbus, "span_store_mutex already taken\n");
return ret;
}
if (xbus_is_registered(xpd->xbus)) {
if (dahdi_reg) {
XPD_DBG(DEVICES, xpd,
"already registered %s. Ignored.\n",
xpd->xbus->busname);
} else {
xbus_unregister_dahdi_device(xpd->xbus);
}
} else {
if (!dahdi_reg) {
XPD_DBG(DEVICES, xpd,
"already unregistered %s. Ignored.\n",
xpd->xbus->busname);
} else {
xbus_register_dahdi_device(xpd->xbus);
}
}
mutex_unlock(&span_store_mutex);
if (dahdi_reg)
xbus_register_dahdi_device(xpd->xbus);
else
xbus_unregister_dahdi_device(xpd->xbus);
return count;
}

View File

@@ -458,29 +458,28 @@ static void phonedev_cleanup(xpd_t *xpd)
unsigned int x;
for (x = 0; x < phonedev->channels; x++) {
if (phonedev->chans[x])
if (phonedev->chans[x]) {
KZFREE(phonedev->chans[x]);
if (phonedev->ec[x])
phonedev->chans[x] = NULL;
}
if (phonedev->ec[x]) {
KZFREE(phonedev->ec[x]);
phonedev->ec[x] = NULL;
}
}
phonedev->channels = 0;
}
__must_check static int phonedev_init(xpd_t *xpd,
const xproto_table_t *proto_table,
int channels, xpp_line_t no_pcm)
int phonedev_alloc_channels(xpd_t *xpd, int channels)
{
struct phonedev *phonedev = &PHONEDEV(xpd);
int old_channels = phonedev->channels;
unsigned int x;
spin_lock_init(&phonedev->lock_recompute_pcm);
XPD_NOTICE(xpd, "Reallocating channels: %d -> %d\n",
old_channels, channels);
phonedev_cleanup(xpd);
phonedev->channels = channels;
phonedev->no_pcm = no_pcm;
phonedev->offhook_state = 0x0; /* ONHOOK */
phonedev->phoneops = proto_table->phoneops;
phonedev->digital_outputs = 0;
phonedev->digital_inputs = 0;
atomic_set(&phonedev->dahdi_registered, 0);
atomic_set(&phonedev->open_counter, 0);
for (x = 0; x < phonedev->channels; x++) {
if (!
(phonedev->chans[x] =
@@ -501,6 +500,29 @@ err:
phonedev_cleanup(xpd);
return -ENOMEM;
}
EXPORT_SYMBOL(phonedev_alloc_channels);
__must_check static int phonedev_init(xpd_t *xpd,
const xproto_table_t *proto_table,
int channels, xpp_line_t no_pcm)
{
struct phonedev *phonedev = &PHONEDEV(xpd);
spin_lock_init(&phonedev->lock_recompute_pcm);
phonedev->no_pcm = no_pcm;
phonedev->offhook_state = 0x0; /* ONHOOK */
phonedev->phoneops = proto_table->phoneops;
phonedev->digital_outputs = 0;
phonedev->digital_inputs = 0;
atomic_set(&phonedev->dahdi_registered, 0);
atomic_set(&phonedev->open_counter, 0);
if (phonedev_alloc_channels(xpd, channels) < 0)
goto err;
return 0;
err:
return -ENOMEM;
}
/*
* xpd_alloc - Allocator for new XPD's
@@ -1025,12 +1047,9 @@ EXPORT_SYMBOL(xpd_set_spanname);
static void xpd_init_span(xpd_t *xpd, unsigned offset, int cn)
{
struct dahdi_span *span;
int i;
memset(&PHONEDEV(xpd).span, 0, sizeof(struct dahdi_span));
for (i = 0; i < cn; i++)
memset(XPD_CHAN(xpd, i), 0, sizeof(struct dahdi_chan));
phonedev_alloc_channels(xpd, cn);
span = &PHONEDEV(xpd).span;
span->deflaw = DAHDI_LAW_MULAW; /* card_* drivers may override */
span->channels = cn;

View File

@@ -38,6 +38,7 @@ xpd_t *xpd_alloc(xbus_t *xbus, int unit, int subunit, int subtype, int subunits,
int channels);
void xpd_free(xpd_t *xpd);
void xpd_remove(xpd_t *xpd);
int phonedev_alloc_channels(xpd_t *xpd, int channels);
void update_xpd_status(xpd_t *xpd, int alarm_flag);
const char *xpp_echocan_name(const struct dahdi_chan *chan);
int xpp_echocan_create(struct dahdi_chan *chan, struct dahdi_echocanparams *ecp,
@@ -64,6 +65,7 @@ void notify_rxsig(xpd_t *xpd, int pos, enum dahdi_rxsig rxsig);
extern struct proc_dir_entry *xpp_proc_toplevel;
#endif
#define SPAN_REGISTERED(xpd) atomic_read(&PHONEDEV(xpd).dahdi_registered)
#define SPAN_REGISTERED(xpd) (atomic_read(&PHONEDEV(xpd).dahdi_registered) && \
test_bit(DAHDI_FLAGBIT_REGISTERED, &PHONEDEV(xpd).span.flags))
#endif /* XPP_DAHDI_H */

View File

@@ -941,6 +941,7 @@ struct dahdi_device {
const char *devicetype;
struct device dev;
unsigned int irqmisses;
struct timespec registration_time;
};
struct dahdi_span {
@@ -1280,6 +1281,8 @@ static inline void dahdi_ec_span(struct dahdi_span *span)
extern struct file_operations *dahdi_transcode_fops;
int dahdi_get_auto_assign_spans(void);
/* Don't use these directly -- they're not guaranteed to
be there. */
extern short __dahdi_mulaw[256];