Commit Graph

774 Commits

Author SHA1 Message Date
Shaun Ruffell
9fb05e426e 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>
(cherry picked from commit 4cd09feb54)
2014-01-23 09:00:18 -06:00
Shaun Ruffell
d485a6ff21 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>
(cherry picked from commit 860eb4ab48)
2014-01-14 16:03:32 -06:00
Shaun Ruffell
c03330ae9d Revert "wcte13xp: Export max_latency module parameter."
This was my mistake. This module parameter cannot be added on the 2.8 branch.

This reverts commit bb8512f56f.
2014-01-08 13:52:26 -06:00
Shaun Ruffell
ce03e88d77 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>
(cherry picked from commit 47dcc9377c)
2014-01-08 13:49:40 -06:00
Shaun Ruffell
bb8512f56f 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>
(cherry picked from commit f10eb3f547)
2014-01-08 13:49:40 -06:00
Shaun Ruffell
80968230ef 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>
(cherry picked from commit 99de304d84)
2014-01-08 13:49:40 -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
Russ Meyerriecks
05bf6ac601 wcte13xp: Fix bug preventing recover timing from ever being set
A bug introduced in v2.8.0 prevented the recover timing configuration from
being set properly on the hardware. This caused the card to never go into
recovered timing mode.

Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-12-18 18:15:21 -06:00
Shaun Ruffell
d536c3e203 build_tools/dkms-helper: Helper script for DKMS integration.
DKMS (Dynamic Kernel Module Support) [1] provides a mechanism where kernel
modules can be automatically updated when a new kernel is booted.  This is a
simple helper script to automate the process of adding dahdi-linux to the local
DKMS system.

[1] http://linux.dell.com/dkms/

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2013-12-12 16:08:43 -06:00
Shaun Ruffell
2e7acd212e xpp: Replace drv_attrs with drv_groups on kernels > 3.12
drv_attrs was fully removed from the bus structure in upstream commit
e18945b159a1cdbc031f1d3b0b7e515a33bdcbf7 which was merged into 3.13.

This is necessary to compile against linux kernel version 3.13.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2013-12-06 15:42:46 -06:00
Shaun Ruffell
71c003ba49 dahdi: Fix previous CentOS 6.5 commit.
The previous commit from earlier today to fix the backport of PDE_DATA was
wrong in that it would not then process the other defines for older kernels if
it detected it was running on a redhat release.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-12-02 16:51:06 -06:00
Shaun Ruffell
3707ee713e Revert "wcaxx: Use startup/shutdown callbacks to protect access to channel registers."
This reverts commit 1cf7d9b08c.

It turns out this change was not necessary.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-12-02 16:23:58 -06:00
Shaun Ruffell
f5d3b35d7b dahdi: Replace drv_attr with drv_groups on kernels > 3.12.
drv_attrs was fully removed from the bus structure in upstream commit
e18945b159a1cdbc031f1d3b0b7e515a33bdcbf7 which was merged into 3.13.

This is necessary to compile dahdi against linux version 3.13.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-12-02 15:47:56 -06:00
Shaun Ruffell
6bcc70a421 wcte43x: Update firmware to version e0017.
This resolves issues where, when using internal timing, the first channel of
span 3 has occassional corrupted data in transmit stream.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-12-02 15:46:39 -06:00
Shaun Ruffell
d389f9f743 wcaxx: Add extra dummy read when checking for single fxs modules.
This extra read eliminates some problems with detecting certain S100M modules.
It is unclear at this time why it is necessary.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-12-02 15:46:39 -06:00
Shaun Ruffell
0faac26dde wcxb: Do not access cur_transfer/cur_msg outside of lock.
The spi master cur_transfer and cur_msg should only be changed under the
spin_lock for the master. The result is that if running user space tools, like
fxstest, that check registers on the modules, it's possible to have a message
that was not yet complete flagged as completed which would result in a bad read.

This does not affect "normal" operation of the wcaxx driver since interrupts are
not enabled during module detection, and during normal operation all access to
the resgisters is done in the context of the interrupt handler. This would only
be an issue if the interrupt handler was running and register accesses are tried
in user space context on an SMP system.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-12-02 15:46:39 -06:00
Oron Peled
d803fad133 Makefile: new 'make-dist' target
Creates a tar.gz:
* Identical results to the existing distributed tarballs
* Named "dahdi-linux-<version>.tar.gz"
* Only from committed files (uses git-archive)
* Adds a .version file

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2013-12-02 22:59:00 +02:00
Shaun Ruffell
acfec5dfbb wcxb: is_pcie -> pci_is_pcie()
is_pcie attribute was finally dropped from struct pci_dev in
upstream commit 115e3bc5e23e7ec3c85a2014bfa96c0ddd036083.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-12-01 22:44:09 -06:00
Shaun Ruffell
5ec9d756aa dahdi: CentOS 6.5 backported PDE_DATA definition.
This will fix the "error: redefinition of 'PDE_DATA'" error when compiling.

Internal-Issue-ID: DAHLIN-330
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-12-01 19:57:44 -06:00
Shaun Ruffell
4bfdd8bea5 dahdi: Remove "ddev" symlink before unregistering the span device.
This makes the order of operations for device removal symmetrical with those for
device addition. This change also eliminates the following warning when
unloading dahdi after dynamic spans have been created:

  ------------[ cut here ]------------
  WARNING: at /build/buildd/linux-3.2.0/fs/sysfs/inode.c:324 sysfs_hash_and_remove+0x92/0xa0()
  Hardware name: VirtualBox
  sysfs: can not remove 'ddev', no directory
  Modules linked in: dahdi_dynamic_loc(O-) dahdi_dynamic(O) dahdi(O) crc_ccitt
     hdlc_cisco hdlc vboxvideo(O) drm vboxsf(O) vesafb ppdev psmouse parport_pc
     serio_raw mac_hid vboxguest(O) nfsd nfs i2c_piix4 lockd fscache auth_rpcgss
     nfs_acl sunrpc ext2 lp parport e1000 [last unloaded: dahdi]
  Pid: 3533, comm: rmmod Tainted: G        W  O 3.2.0-56-generic-pae #86-Ubuntu
  Call Trace:
   [<c105ab42>] warn_slowpath_common+0x72/0xa0
   [<c11a7992>] ? sysfs_hash_and_remove+0x92/0xa0
   [<c11a7992>] ? sysfs_hash_and_remove+0x92/0xa0
   [<c105ac13>] warn_slowpath_fmt+0x33/0x40
   [<c11a7992>] sysfs_hash_and_remove+0x92/0xa0
   [<c1385427>] ? device_del+0x127/0x150
   [<c11a9bd0>] sysfs_remove_link+0x20/0x30
   [<d8a03fa3>] span_sysfs_remove+0xa3/0x170 [dahdi]
   [<c1036a88>] ? default_spin_lock_flags+0x8/0x10
   [<d89f7e5e>] _dahdi_unassign_span+0xae/0x210 [dahdi]
   [<c1053f6b>] ? __cond_resched+0x1b/0x30
   [<c15a9859>] ? _cond_resched+0x29/0x30
   [<d89f80a3>] dahdi_unregister_device+0xe3/0x190 [dahdi]
   [<d8936464>] dahdi_dynamic_unregister_driver+0x84/0x130 [dahdi_dynamic]
   [<d89284ed>] dahdi_dynamic_local_exit+0xd/0xb20 [dahdi_dynamic_loc]
   [<c1095995>] sys_delete_module+0x135/0x230
   [<c1110063>] ? pagetypeinfo_show.part.8+0x33/0x100
   [<c15b295f>] sysenter_do_call+0x12/0x28
  ---[ end trace b818e326720c8385 ]---

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-11-29 15:42:07 -06:00
Shaun Ruffell
c0d52a04cb wctdm24xxp: Remove assigned callback.
For the spans exported by the wctdm24xxp, the channels are not going to change
after they are already registered.

This eliminates a problem when analog spans are unassigned/reassigned and the
not_ready goes negative, thereby causing many warnings in the kernel.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-11-26 10:49:58 -06:00
Shaun Ruffell
1cf7d9b08c wcaxx: Use startup/shutdown callbacks to protect access to channel registers.
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-11-25 16:19:28 -06:00
Shaun Ruffell
3a0905b1ec dahdi_dynamic: Create a span type for dynamic spans.
Fixes the following warning when loading the driver:

  dahdi: Warning: Span DYN/eth/eth1/00:50:c2:97:92:1d/1 didn't specify a spantype. Please fix driver!

The spantype is intended to be used by the auto configuration tools
(dahdi_genconf, pinned spans, etc..) but dynamic spans, since they are created
directly by dahdi_cfg, never take part in the pre-registration auto
configuration, therefore the span type was never used.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-11-24 10:09:33 -06:00
Shaun Ruffell
4a75f58156 oct612x: Make dependent on dahdi.ko
This change will ensure that the oct612x module is unloaded automatically when
/etc/init.d/dahdi stop is run.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-11-24 10:09:33 -06:00
Tzafrir Cohen
2b20289cb7 Ignore some more firmware files
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2013-11-24 17:22:39 +02:00
Oron Peled
dd944f3362 sysfs: new driver attribute: master_span
* This changeset adds master_span as an attribute of the span's driver:
  /sys/bus/dahdi_spans/drivers/generic_lowlevel/master_span
* This is mainly used for debugging.
* Reading from it the master span number (or 0 if there is no master
  span).
* Writing a number to it, force specified span to be master
* Existing Alternatives:
  - grep "MASTER" from /proc/dahdi/*
  - cat /sys/bus/dahdi_spans/devices/span-*/is_sync_master

(Note: commit d8fe2af23d is also Acked-By
Tzafrir Cohen <tzafrir.cohen@xorcom.com>)

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2013-11-24 17:20:04 +02:00
Oron Peled
d8fe2af23d xpp: automatic dahdi_registration by default
* Now with pinned-spans, we can assure reliable ordering
2013-11-24 15:34:57 +02:00
Oron Peled
35e9924b3c Rename "pinned spans" to "assigned spans"
Rename as terminology has changed. No change in kernel interface.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2013-11-24 15:03:35 +02:00
Oron Peled
a9c85de700 .gitignore: *.ko.unsigned
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2013-11-24 14:55:49 +02:00
Oron Peled
7a822db82c dahdi: Rename span 'master' as 'master_span'
* No functional changes.
* Rename the span 'master' to 'master_span' to avoid ambiguity with the
  'master' channel.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2013-11-24 14:54:27 +02:00
Oron Peled
007ff90025 sysfs: create symlink "ddev" to device of span
Create a "ddev" symlink from span's sysfs node to the one of its dahdi
device.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2013-11-24 14:54:03 +02:00
Oron Peled
be25fdb6fa remove udev rules: moved to dahdi-tools
* Removed xpp.rules
* Removed generation of dahdi.rules

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2013-11-24 14:53:20 +02:00
Oron Peled
06daf6c270 live_dahdi: load "dahdi" with tools_rootdir=$DESTDIR
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2013-11-24 14:52:35 +02:00
Oron Peled
1672e07deb Also send DAHDI_TOOLS_ROOTDIR with device events
Send the new DAHDI_TOOLS_ROOTDIR and existing DAHDI_INIT_DIR with udev
device events as well.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2013-11-24 14:51:24 +02:00
Oron Peled
7b578b83b9 dahdi: add "tools_rootdir" module parameter
* Passed to udev as DAHDI_TOOLS_ROOTDIR environment variable
* Default is "/"
* Deprecates the parameter initdir:
  - Defaults to $DAHDI_TOOLS_ROOTDIR/usr/share/dahdi
  - If specified: taken relative to $DAHDI_TOOLS_ROOTDIR
  - Setting both parameters explicitly is prohibited.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2013-11-24 14:51:14 +02:00
Shaun Ruffell
1ab5723b85 wcte43x: Remove 'dcxo' debug attribute.
Removes another bit of debugging instrumentation that I let slip through.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-11-20 09:39:12 -06:00
Shaun Ruffell
cbad5a7ae1 wcte43x: Do not grab reglock in handle_transmit/handle_receive.
If the driver is loaded with vpmsupport=0, then it was possible to create a
deadlock situation since the call into __dahdi_ec_chunk might then try to grab
the channel lock while already holding the reglock.

The purpose of grabbing reglock in the DMA routines was to protect the channel
array, which can be changed when linemode is changing. So instead, we'll
completely mask off that interrupt line from all CPUs when potentially changing
the channel array.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-11-20 09:33:07 -06:00
Shaun RuffellL
b3c6320374 wcaxx: Remove some left over debugging trace statements.
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-11-17 02:36:29 -06:00
Shaun Ruffell
69a716af1a wcxb: Update the firmware meta block during flash update.
The meta block contains specific version and checksum information and allows the
test tools to validate the image in the flash.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-11-16 16:03:19 -06:00
Shaun Ruffell
eed2e4e00b wcaxx: Update A4B firmware to version 0b0017
Resolves some sporadic issues with invalid underruns.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-11-16 16:02:00 -06:00
Wendell Thompson
466acea7e0 wcte43x: Add driver for TE435/TE235 digital cards.
From: Wendell Thompson <wthompson@digium.com>

These new cards are based on a common architecture with the TE133/TE134 as well
as the new analog cards, A4A/A4B/A8A/A8B.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-11-11 14:39:19 -06:00
Russ Meyerriecks
3134b36d7e wcte13xp: Improve maintenance functions and error counters
From: Rus Meyerriecks <rmeyerriecks@digium.com>

* Removed work queue for maint interface as it is not needed in this driver
* Error counters are now accessible through the maint interface
* Consolidated and revised the big maint switch case
* Added loopup/loopdown code transmit logic to E1
* Now supports error/defect insersion

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-11-11 14:39:19 -06:00
Russ Meyerriecks
4707e19654 wcte13xp: Hold framer in reset to stop xmit on modprobe -r
From: Russ Meyerriecks <rmeyerriecks@digium.com>

The framer appears to continue transmitting a signal after modprobe -r. This
patch will leave the physical framer reset pin asserted to force the chip to
stop transmitting a signal when there is no driver attached.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-11-11 14:39:19 -06:00
Russ Meyerriecks
e42548f2c5 wcte13xp: Migrate to wcxb library
From: Russ Meyerriecks <rmeyerriecks@digium.com>

Removed all the custom logic and replaced with the common platform wcxb stuff.

There are also changes in here to standardize the function prefix in this
driver to t13x_.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-11-11 14:39:19 -06:00
Wendell Thompson
abe35059bc wcte13xp: Use interrupts for Falc alarms and signaling
From: Wendell Thompson <wthompson@digium.com>

Now uses framer interrupt vector polling (in the FPGA interrupt) for
alarm, loopcode, and signaling events eliminating continuous polling.
Now uses timer function for alarm and loopcode debouce, which only
executes during exception conditions.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-11-11 14:39:19 -06:00
Shaun Ruffell
348f6ab030 wcaxx: New driver for A4A/A4B/A8A/A8B analog cards.
This is a driver for the new line of analog cards that shares a common interface
with the TE133/TE134 and the TE435.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-11-11 14:39:19 -06:00
Shaun Ruffell
26efcf6902 wct4xxp, wcte13xp: Move the octasic DSP code into separate module.
The octasic library is relatively large and is currently separately linked into
both the wcte13xp and wct4xxp libraries. This change moves it out into a
separate loadable module.

The bigest change from the drivers perspectives is that they must provide a
table of callbacks instead of using statically linked Oct6100UserXxxxx functions
to allow the library to communicate with actual parts on the cards.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-11-11 14:39:19 -06:00
Shaun Ruffell
a648cef0f6 wct4xxp: If linemode changed via sysfs, reset the complete part.
This works around some issues with older versions of the firmware not
working properly after the linemode is changed via sysfs. Basically the
intent is to simulate redoing a complete driver reload with a new
linemode.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-11-11 14:39:19 -06:00
Shaun Ruffell
a5a52dbe94 wct4xxp: VPM companding switch print is now debug only.
This print happened when the linemode was changed via sysfs, but it didn't
really add much extra information that a user could act on.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-11-11 14:39:19 -06:00