openwrt/staging/blogic.git
10 years agoNFC: st21nfca: Remove useless new line in nfc_err call
Christophe Ricard [Mon, 28 Jul 2014 16:11:38 +0000 (18:11 +0200)]
NFC: st21nfca: Remove useless new line in nfc_err call

Remove a useless new line in nfc_err call.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: st21nfca: Fix logic when setting session_id
Christophe Ricard [Mon, 28 Jul 2014 16:11:37 +0000 (18:11 +0200)]
NFC: st21nfca: Fix logic when setting session_id

If dev_num >= ST21NFCA_NUM_DEVICES, the driver was returning an incorrect
success return code.

Once dev_num is set, it was not stated as busy.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: st21nfcb: Remove inappropriate kfree on a previously devm_kzalloc pointer
Christophe Ricard [Mon, 28 Jul 2014 16:11:36 +0000 (18:11 +0200)]
NFC: st21nfcb: Remove inappropriate kfree on a previously devm_kzalloc pointer

In case of an error during driver probe, info pointer was freed with kfree.
No need to free anything when using devm_kzalloc.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: st21nfcb: Remove useless new line in nfc_err call
Christophe Ricard [Mon, 28 Jul 2014 16:11:35 +0000 (18:11 +0200)]
NFC: st21nfcb: Remove useless new line in nfc_err call

Remove a uselss new line in nfc_err call.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: st21nfcb: Remove double assignment of .owner in struct device_driver
Christophe Ricard [Mon, 28 Jul 2014 16:11:34 +0000 (18:11 +0200)]
NFC: st21nfcb: Remove double assignment of .owner in struct device_driver

The .owner member of struct device_driver is assigned THIS_MODULE twice.

Introduced by:

commit 35630df68d6030daf12dde12ed07bbe26324e6ac
NFC: st21nfcb: Add driver for STMicroelectronics ST21NFCB NFC chip

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: st21nfcb: Convert to use devm_gpio_request_one
Christophe Ricard [Mon, 28 Jul 2014 16:11:33 +0000 (18:11 +0200)]
NFC: st21nfcb: Convert to use devm_gpio_request_one

Simplify the code a bit as mention by Axel Lin in a previous patch for
st21nfca.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: st21nfcb: Fix scripts/checkpatch.pl error "code indent should use tabs where...
Christophe Ricard [Mon, 28 Jul 2014 16:11:32 +0000 (18:11 +0200)]
NFC: st21nfcb: Fix scripts/checkpatch.pl error "code indent should use tabs where possible"

Fixing scripts/checkpatch.pl error "code indent should use tabs where possible" in:
- i2c.c in st21nfcb_nci_irq_thread_fn function.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: st21nfca: Fix scripts/checkpatch.pl warnings "Missing a blank line after declara...
Christophe Ricard [Mon, 28 Jul 2014 16:11:31 +0000 (18:11 +0200)]
NFC: st21nfca: Fix scripts/checkpatch.pl warnings "Missing a blank line after declarations"

Fixing scripts/checkpatch.pl warning "Missing a blank line after declarations" in:
- st21nfca.c:
- check_presence after fwi variable declaration.
- get_frame_size after len variable declaration.
- st21nfca_hci_i2c_repack after "i, j, r, size" variable declaration.

- st21nfca_dep.c st21nfca_tx_work after skb pointer declaration.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: st21nfca: Fix sparse: cast to restricted __be32
Christophe Ricard [Mon, 28 Jul 2014 16:11:30 +0000 (18:11 +0200)]
NFC: st21nfca: Fix sparse: cast to restricted __be32

Fixing "sparse: cast to restricted __be32" message when building with
make C=1 CF=-D__CHECK_ENDIAN__

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: st21nfca: Convert to use devm_gpio_request_one
Axel Lin [Mon, 28 Jul 2014 16:11:29 +0000 (18:11 +0200)]
NFC: st21nfca: Convert to use devm_gpio_request_one

This simplifies the code a bit.

Acked-by: Christophe RICARD <christophe-h.ricard@st.com>
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: st21nfca: Remove double assignment of .owner in struct device_driver
Emil Goode [Mon, 28 Jul 2014 16:11:28 +0000 (18:11 +0200)]
NFC: st21nfca: Remove double assignment of .owner in struct device_driver

The .owner member of struct device_driver is assigned THIS_MODULE twice.

Introduced by:

commit c44cb2edd01ca31471d9385f0895891b006ab904
("NFC: dts: st21nfca: Add device-tree (Open Firmware) support to st21nfca")

Acked-by: Christophe RICARD <christophe-h.ricard@st.com>
Signed-off-by: Emil Goode <emilgoode@gmail.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: trf7970a: Add Target Mode Detection Support
Mark A. Greer [Tue, 2 Sep 2014 22:12:46 +0000 (15:12 -0700)]
NFC: trf7970a: Add Target Mode Detection Support

Add the ability to detect the mode (i.e., RF technology)
used by the initiator.  The RF technology that was
detected can be retrieved by calling the 'tg_get_rf_tech'
driver hook.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: trf7970a: Add Target Mode Support
Mark A. Greer [Tue, 2 Sep 2014 22:12:45 +0000 (15:12 -0700)]
NFC: trf7970a: Add Target Mode Support

Add target mode support to the trf7970a
NFC driver.  This effectively enables full
Peer-to-Peer support.

To handle changing framing between sending
a response frame and receiving the subsequent
request frame, most of the framing changes
take effect in the interrupt handler and not
in trf7970a_tg_config_framing().

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: trf7970a: Handle timeout values of zero
Mark A. Greer [Tue, 2 Sep 2014 22:12:44 +0000 (15:12 -0700)]
NFC: trf7970a: Handle timeout values of zero

The digital layer can try to send a command with a
timeout value of zero (e.g., digital_tg_send_psl_res().
The zero value is used as a flag to indicate that
the driver should not expect a response.  To handle
this, the driver sets an internal timer because it
should still get an interrupt with the TX bit set
in the IRQ Status Register.  When it gets that
interrupt, it returns a return value of '0'.
If it doesn't get the interrupt before timing out,
it returns ETIMEDOUT as usual.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: trf7970a: Cancel timer when error encountered
Mark A. Greer [Tue, 2 Sep 2014 22:12:43 +0000 (15:12 -0700)]
NFC: trf7970a: Cancel timer when error encountered

Some paths leave a timer still running when
trf7970a_send_err_upstream() is called.  This
can cause a timeout to occur in a subsequent
transaction making it fail.  Fix this by ensuring
there is no timer running before sending an error
upstream.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: trf7970a: Don't turn on RF if there is already an RF field
Mark A. Greer [Tue, 2 Sep 2014 22:12:42 +0000 (15:12 -0700)]
NFC: trf7970a: Don't turn on RF if there is already an RF field

Currently, the trf7970a driver blindly turns on its
RF field when configuring its framing.  This isn't
a good idea if there is already a device generating
an RF field.  Instead, check if there is already an
RF field present before turning on this device's RF
field and, if there is, return EBUSY.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: trf7970a: trf7970a_init() turns off the RF transmitter
Mark A. Greer [Tue, 2 Sep 2014 22:12:41 +0000 (15:12 -0700)]
NFC: trf7970a: trf7970a_init() turns off the RF transmitter

When trf7970a_init() initializes the trf7970a it
implicitly turns off the RF transmitter.  Track
this by clearing the TRF7970A_CHIP_STATUS_RF_ON
bit in the cached trf->chip_status_ctrl.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: trf7970a: Don't turn off RF if its already off
Mark A. Greer [Tue, 2 Sep 2014 22:12:40 +0000 (15:12 -0700)]
NFC: trf7970a: Don't turn off RF if its already off

Don't try to turn off of RF transmitter is its
already off.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: trf7970a: Add '_in_' to initiator routines
Mark A. Greer [Tue, 2 Sep 2014 22:12:39 +0000 (15:12 -0700)]
NFC: trf7970a: Add '_in_' to initiator routines

Rename trf7970a_config_rf_tech() and trf7970a_config_framing()
to trf7970a_in_config_rf_tech() and trf7970a_in_config_framing(),
respectively to avoid confusion when target support is added.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: trf7970a: Delay after initialization
Mark A. Greer [Tue, 2 Sep 2014 22:12:38 +0000 (15:12 -0700)]
NFC: trf7970a: Delay after initialization

The trf7970a should be given at least 1 ms to
completely initialize after the 'Software Init'
and 'Idle' commands have been issued.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: trf7970a: Add System Suspend/Resume support
Mark A. Greer [Tue, 2 Sep 2014 22:12:37 +0000 (15:12 -0700)]
NFC: trf7970a: Add System Suspend/Resume support

Add system suspend/resume support by gracefully
shutting things down when suspending and bringing
the device back to full power when resuming.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: trf7970a: Create startup and shutdown routines
Mark A. Greer [Tue, 2 Sep 2014 22:12:36 +0000 (15:12 -0700)]
NFC: trf7970a: Create startup and shutdown routines

Encapsulate the code to start up and gracefully
shutdown the driver and trf7970a device.  Doing
this makes adding system suspend/resume support
easier and the resulting code cleaner.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: trf7970a: Don't assume CONFIG_PM_RUNTIME is enabled
Mark A. Greer [Tue, 2 Sep 2014 22:12:35 +0000 (15:12 -0700)]
NFC: trf7970a: Don't assume CONFIG_PM_RUNTIME is enabled

The current code assumes that CONFIG_PM_RUNTIME
is always defined so it won't power up the trf7970a
when it isn't enabled.  Fix this by moving the power
up/down code from the pm_runtime_resume/suspend
routines into their own routines and calling the
power up function from the probe routine.  This
ensures the device is powered up even when
CONFIG_PM_RUNTIME is not defined.

In order to not power on/off a device that is
already powered on/off, create a new state to
indicate that the power is off (TRF7970A_ST_PWR_OFF).

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: trf7970a: Rename TRF7970A_ST_OFF to TRF7970A_ST_RF_OFF
Mark A. Greer [Tue, 2 Sep 2014 22:12:34 +0000 (15:12 -0700)]
NFC: trf7970a: Rename TRF7970A_ST_OFF to TRF7970A_ST_RF_OFF

Rename the 'TRF7970A_ST_OFF' state to 'TRF7970A_ST_RF_OFF'
to make it clear that this state means that the RF is
off and not the entire device.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: trf7970a: Return error code when turning on RF fails
Mark A. Greer [Tue, 2 Sep 2014 22:12:33 +0000 (15:12 -0700)]
NFC: trf7970a: Return error code when turning on RF fails

trf7970a_switch_rf_on() is currently a void function
but turning on the RF could fail so it should return
a return code.  That return code should also be
propagated back to the entity that initiated the
action.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: trf7970a: Ensure no more RX data before completing receive
Mark A. Greer [Tue, 2 Sep 2014 22:12:32 +0000 (15:12 -0700)]
NFC: trf7970a: Ensure no more RX data before completing receive

Depending on the interrupt status value given by the
trf7970a, the driver may not know when a receive operation
is complete.  To handle this, the driver waits for a period
of time in case the trf7970a interrupts it again indicating
there are more RX data in the FIFO.  It is possible that the
timeout will occur when there are RX data in the FIFO but
before the trf7970a has generated an interrupt to tell the
driver about it.  Handle this by calling trf7970a_drain_fifo()
(instead of trf7970a_send_upstream() which just passes up the
data gathered to far) to check if there are more data in the
FIFO.  If so, gather that data into the receive buffer.  If
not, pass the data collected so far upstream as before.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: trf7970a: Reread FIFO Status Register when draining FIFO
Mark A. Greer [Tue, 2 Sep 2014 22:12:31 +0000 (15:12 -0700)]
NFC: trf7970a: Reread FIFO Status Register when draining FIFO

Receiving an interrupt whose Interrupt Status Register
value has only the SRX bit set is supposed to mean that
all of the data from the tag has been received.  That
turns out to not be true so we need to reread the FIFO
Status Register to tell if there are any new bytes in
the FIFO.  If there are, continue receiving them; if
there aren't, assume that the receive is complete and
pass the data up.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: trf7970a: Handle low-watermark IRQ when transmitting
Mark A. Greer [Tue, 2 Sep 2014 22:12:30 +0000 (15:12 -0700)]
NFC: trf7970a: Handle low-watermark IRQ when transmitting

Commit 4dd836e46c3d ("NFC: trf7970a: Reset FIFO when
'End of TX' Interrupt Occurs") fixes the issue that
it was meant to fix but adds the unfortunate side
effect of causing the driver to report an error
when the TX low-watermark level is passed during
transmits.  This can be fixed by checking whether
the IRQ status indicates that the low-watermark
has been passed when transmitting.  If it has been
passed and the FIFO is empty, then its safe to reset
the FIFO.  Otherwise, silently continue since another
TX interrupt will be generated and the FIFO will be
reset then.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: trf7970a: Only fill FIFO if there is space
Mark A. Greer [Tue, 2 Sep 2014 22:12:29 +0000 (15:12 -0700)]
NFC: trf7970a: Only fill FIFO if there is space

Handle the case where trf7970a_fill_fifo() is
called but there is no room in the FIFO for
more TX data.  When this happens, wait for
another interrupt indicating that there is
now space (and set a timer in case that
interrupt never occurs).

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: trf7970a: Prefix TX data when refilling FIFO
Mark A. Greer [Tue, 2 Sep 2014 22:12:28 +0000 (15:12 -0700)]
NFC: trf7970a: Prefix TX data when refilling FIFO

When refilling the FIFO with more TX data (using a new
SPI transaction), the driver must prefix the TX data with
a write to the FIFO I/O Register.  This tells the trf7970a
that the following data is destined for the FIFO so it can
be transmitted.

To accomplish this, the driver cannot simply push the
prefix data just before the next set of TX data that
is to be transmitted because that will overwrite part
of the TX data provided by the digital layer.  Instead,
separate the prefix data and the TX data when calling
trf7970a_transmit().  trf7970a_transmit() can then send
the prefix and TX data from different memory locations
with one spi_sync() operation.  This also means that
the driver doesn't require any skb "tx_headroom" as
provided by the digital layer (see
nfc_digital_allocate_device() and digital_skb_alloc()).

Also ensure that the prefix is of type 'u8' and not
'char'.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: trf7970a: Remove unnecessary FIFO reset & RSSI read
Mark A. Greer [Tue, 2 Sep 2014 22:12:27 +0000 (15:12 -0700)]
NFC: trf7970a: Remove unnecessary FIFO reset & RSSI read

It is no longer necessary to reset the FIFO and
read the 'RSSI Levels and Oscillator Status Register'
so remove that code.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: trf7970a: Clear possible spurious interrupt before transmitting
Mark A. Greer [Tue, 2 Sep 2014 22:12:26 +0000 (15:12 -0700)]
NFC: trf7970a: Clear possible spurious interrupt before transmitting

The trf7970a occasionally generates spurious interrupts
which can confuse the driver.  To help alleviate this,
clear any interrupts by reading the 'IRQ Status Register'
before starting a new transaction.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: trf7970a: Recalculate driver timeout values
Mark A. Greer [Tue, 2 Sep 2014 22:12:25 +0000 (15:12 -0700)]
NFC: trf7970a: Recalculate driver timeout values

Some of the timeout values used in the driver
are not long enough to handle worst-case scenarios
so they need to be recalculated.

The time to wait for the FIFO to drain past the
low-watermark is now 20 ms because it can take
around 14.35 ms to send 95 bytes (127 bytes in
full FIFO minus 32 bytes where the low-watermark
interrupt will fire).  95 bytes will take around
14.35 ms at 6.62 kbps (the lowest supported bit
rate used by ISO/IEC 15693) so 20 ms should be a
safe value.

The time to wait before issuing an EOF to complete
an ISO/IEC 15693 write or lock command is 40 ms--
20 ms to drain the FIFO and another 20 ms to ensure
the wait is long enough before sending an EOF.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: trf7970a: Add RF technology specific guard times
Mark A. Greer [Tue, 2 Sep 2014 22:12:24 +0000 (15:12 -0700)]
NFC: trf7970a: Add RF technology specific guard times

When turning on the RF field, the driver must wait
an RF-technology-specific amount of time (known as
the guard time) before modulating the field.
Currently, the driver waits 5 ms but that is too
short for NFCF and too long for ISO/IEC 15693.
Fix this by determining the guard time when the
RF technology is set and delaying that amount
of time when turning on the RF field.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: trf7970a: Initialize when enabling RF
Mark A. Greer [Tue, 2 Sep 2014 22:12:23 +0000 (15:12 -0700)]
NFC: trf7970a: Initialize when enabling RF

Currently, the trf7970a is reset & initialized only
when the pm_runtime resume hook is called.  Instead,
initialize it every time the RF is enabled to ensure
that the trf7970a is quiesced and in a known state
before being set up for another RF technology.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: trf7970a: Disable SYS_CLK Output
Mark A. Greer [Tue, 2 Sep 2014 22:12:22 +0000 (15:12 -0700)]
NFC: trf7970a: Disable SYS_CLK Output

Currently, support for providing the external
SYS_CLK signal on pin 27 is not supported so
turn it off by writing to the 'Modulator and
SYS_CLK Control' register immediately after
reset.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: trf7970a: Remove unnecessary sleep
Mark A. Greer [Tue, 2 Sep 2014 22:12:21 +0000 (15:12 -0700)]
NFC: trf7970a: Remove unnecessary sleep

There is no need to sleep for 1-2 ms before
transmitting a new command.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: trf7970a: FIFO Size is really 127 bytes
Mark A. Greer [Tue, 2 Sep 2014 22:12:20 +0000 (15:12 -0700)]
NFC: trf7970a: FIFO Size is really 127 bytes

Despite what the manual says, the FIFO size
on the trf7970a is really 127 bytes so make
the code respect that.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: trf7970a: Ignore Overflow bit in FIFO Status Register
Mark A. Greer [Tue, 2 Sep 2014 22:12:19 +0000 (15:12 -0700)]
NFC: trf7970a: Ignore Overflow bit in FIFO Status Register

The Overflow bit in the 'FIFO Status Register' has
proven to be untrustworthy so ignore it.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: trf7970a: Use spi_sync() instead of spi_write_then_read()
Mark A. Greer [Tue, 2 Sep 2014 22:12:18 +0000 (15:12 -0700)]
NFC: trf7970a: Use spi_sync() instead of spi_write_then_read()

To more efficiently handle long continuous reads,
use spi_sync() instead of spi_write_then_read().

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: trf7970a: Call spi_setup() to configure SPI communication
Mark A. Greer [Tue, 2 Sep 2014 22:12:17 +0000 (15:12 -0700)]
NFC: trf7970a: Call spi_setup() to configure SPI communication

Call spi_setup() to configure SPI communication
with the trf7970a.  This will ensure that the
correct SPI parameters are used.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: trf7970a: Remove trf7970a_tg_listen_mdaa()
Mark A. Greer [Tue, 2 Sep 2014 22:12:16 +0000 (15:12 -0700)]
NFC: trf7970a: Remove trf7970a_tg_listen_mdaa()

Currently, the digital layer 'tg_listen_mdaa'
hook is not used and it isn't necessary to have
a stub routine so remove it.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: trf7970a: Remove incorrect of_node_put() call
Mark A. Greer [Tue, 2 Sep 2014 22:12:15 +0000 (15:12 -0700)]
NFC: trf7970a: Remove incorrect of_node_put() call

of_property_read_u32() does not take a reference
to the specified OF node so don't call of_node_put()
in trf7970a_get_autosuspend_delay().

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: NCI: Fix NCI RF FRAME interface usage
Vincent Cuissard [Tue, 22 Jul 2014 17:48:40 +0000 (19:48 +0200)]
NFC: NCI: Fix NCI RF FRAME interface usage

NCI RF FRAME interface is used for all kind of tags
except ISODEP ones. So for all other kind of tags the
status byte has to be removed.

Signed-off-by: Vincent Cuissard <cuissard@marvell.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: NCI: Fix nci_register_device init sequence
Vincent Cuissard [Tue, 22 Jul 2014 17:48:39 +0000 (19:48 +0200)]
NFC: NCI: Fix nci_register_device init sequence

All contexts have to be initiliazed before calling
nfc_register_device otherwise it is possible to call
nci_dev_up before ending the nci_register_device
function. In such case kernel will crash on non
initialized variables.

Signed-off-by: Vincent Cuissard <cuissard@marvell.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: NCI: Add support of ISO15693
Vincent Cuissard [Tue, 22 Jul 2014 17:48:38 +0000 (19:48 +0200)]
NFC: NCI: Add support of ISO15693

Update nci.h to respect latest NCI specification proposal
(stop using proprietary opcodes). Handle ISO15693 parameters
in NCI_RF_ACTIVATED_NTF handler.

Signed-off-by: Vincent Cuissard <cuissard@marvell.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: trf7970a: Make gpio labels more readable
Mark A. Greer [Fri, 8 Aug 2014 00:41:47 +0000 (17:41 -0700)]
NFC: trf7970a: Make gpio labels more readable

Make the labels for the two gpio enable lines
more user friendly by prefixing them with the
driver name.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: trf7970a: Document the 'en2-rf-quirk' DT property
Mark A. Greer [Fri, 8 Aug 2014 00:41:46 +0000 (17:41 -0700)]
NFC: trf7970a: Document the 'en2-rf-quirk' DT property

Current versions of the trf7970a have an erratum where
the EN2 pin must be kept low.  If it isn't kept low,
it will generate an RF field even when in passive
target mode.  To work around this issue, create the
'en2-rf-quirk' device tree property to indicate that
the trf7970a that the driver is using has this erratum.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: trf7970a: Add quirk to keep EN2 low
Mark A. Greer [Fri, 8 Aug 2014 00:41:45 +0000 (17:41 -0700)]
NFC: trf7970a: Add quirk to keep EN2 low

A bug has been discovered in the trf7970a where it
will generate an RF field even in passive target
mode when EN2 is asserted.  To work around this,
add support for the 'en2-rf-quirk' device tree
property which indicates that EN2 must remain low.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: trf7970a: Document the 'irq-status-read-quirk' DT property
Mark A. Greer [Fri, 8 Aug 2014 00:41:44 +0000 (17:41 -0700)]
NFC: trf7970a: Document the 'irq-status-read-quirk' DT property

The mechanism for specifying that the trf7970a
being used by the driver has the "IRQ Status Read"
erratum has been changed to a device tree property
('irq-status-read-quirk').

Document the new device tree property.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: trf7970a: Move IRQ Status Read quirk to device tree
Mark A. Greer [Fri, 8 Aug 2014 00:41:43 +0000 (17:41 -0700)]
NFC: trf7970a: Move IRQ Status Read quirk to device tree

The quirk indicating whether the trf7970a has
the "IRQ Status Read" erratum or not is currently
implemented using the 'driver_data' member of the
'spi_device_id' structure.  That requires the
driver to be modified to turn the quirk off when
a version of the trf7970a that doesn't have the
erratum is being used.  To fix that, create a
new device tree property called
'irq-status-read-quirk' that indicates that the
trf7970a being used has the erratum.

While at it, rename 'TRF7970A_QUIRK_IRQ_STATUS_READ_ERRATA'
to 'TRF7970A_QUIRK_IRQ_STATUS_READ' to make it
less of an eyesore.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: trf7970a: Document the 'vin-voltage-override' DTS property
Mark A. Greer [Fri, 8 Aug 2014 00:41:42 +0000 (17:41 -0700)]
NFC: trf7970a: Document the 'vin-voltage-override' DTS property

The trf7970a driver recently had support for the
'vin-voltage-override' property added to it.  This
property is used to override the value given by
the regulator subsystem for the VIN pin's voltage.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: trf7970a: Add VIN voltage override support
Mark A. Greer [Fri, 8 Aug 2014 00:41:41 +0000 (17:41 -0700)]
NFC: trf7970a: Add VIN voltage override support

The trf7970a driver uses the voltage from the
power/regulator subsystem to determine what the
voltage on the VIN pin is.  Normally, this is
the right thing to do but sometimes the board
that the trf7970a is on may change the voltage.
This is the case for the trf7970atb board from
Texas Instruments where it boosts the VIN voltage
from 3.3V to 5V (see http://www.ti.com/tool/trf7970atb).

To handle this, add support for the 'vin-voltage-override'
device tree property which overrides the voltage value
given by the regulator subsystem.  When the DT property
is not present, the value from the regulator subsystem
is used.

The value of 'vin-voltage-override' is in uVolts.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: digital: Add Inititor-side PSL support
Mark A. Greer [Wed, 23 Jul 2014 03:18:01 +0000 (20:18 -0700)]
NFC: digital: Add Inititor-side PSL support

In order to operate at the fasted bit rate
possible, add initiator-side support for
PSL REQ while in P2P mode.  The PSL REQ
will switch the RF technology to 424F
whenever possible.

Reviewed-by: Thierry Escande <thierry.escande@linux.intel.com>
Tested-by: Thierry Escande <thierry.escande@linux.intel.com>
Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agocarl9170: tx: Replace rcu_assign_pointer() with RCU_INIT_POINTER()
Andreea-Cristina Bernat [Wed, 27 Aug 2014 13:27:30 +0000 (16:27 +0300)]
carl9170: tx: Replace rcu_assign_pointer() with RCU_INIT_POINTER()

According to RCU_INIT_POINTER()'s block comment 3.a, it can be used if
"3.   The referenced data structure has already been exposed to readers either
at compile time or via rcu_assign_pointer() -and-
 a.   You have not made -any- reader-visible changes to this structure since
then".

This case fulfills the conditions above because between the rcu_dereference()
call (cvif = rcu_dereference(ar->beacon_iter);) and the rcu_assign_pointer()
call there is no update of the "cvif" variable.
Therefore, this patch makes the replacement.

The following Coccinelle semantic patch was used:
@@
identifier v;
@@

v = rcu_dereference(...);
... when != rcu_dereference(...);
    when != v = ...;
    when != (<+...v...+>)++;
    when != \(memcpy\|memset\)(...);
(
- rcu_assign_pointer
+ RCU_INIT_POINTER
  (..., v);
|
 if(...) {
... when != v = ...;
- rcu_assign_pointer
+ RCU_INIT_POINTER
  (..., v);
... when any
 }
)

Because there are cases where between a “rcu_dereference()” call and a
“rcu_assign_pointer()” call might be updates of the value that interests us,
the Coccinelle semantic patch ignores them and replaces with
"RCU_INIT_POINTER()" only when the update is not happening.

Signed-off-by: Andreea-Cristina Bernat <bernat.ada@gmail.com>
Acked-by: Christian Lamparter <chunkeey@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Fix channel context timer
Sujith Manoharan [Wed, 27 Aug 2014 06:37:25 +0000 (12:07 +0530)]
ath9k: Fix channel context timer

Setup the channel context correctly. Not doing this was
causing beacon loss in a P2P-GO/STA concurrent setup.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Add more debug statements for channel context
Sujith Manoharan [Wed, 27 Aug 2014 06:37:24 +0000 (12:07 +0530)]
ath9k: Add more debug statements for channel context

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Disable fastcc for channel context mode
Sujith Manoharan [Wed, 27 Aug 2014 06:37:23 +0000 (12:07 +0530)]
ath9k: Disable fastcc for channel context mode

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agort2x00: support Ralink 5362.
Canek Peláez Valdés [Mon, 25 Aug 2014 00:06:11 +0000 (19:06 -0500)]
rt2x00: support Ralink 5362.

Signed-off-by: Canek Peláez Valdés <canek@ciencias.unam.mx>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Fix channel context creation
Sujith Manoharan [Sun, 24 Aug 2014 15:46:13 +0000 (21:16 +0530)]
ath9k: Fix channel context creation

If a new context is being added in addition to the current one,
then send the ASSIGN event to abort a running scan since
the addition of a context is usually followed by VIF
assignment and further operations.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Fix interface limits
Sujith Manoharan [Sun, 24 Aug 2014 15:46:12 +0000 (21:16 +0530)]
ath9k: Fix interface limits

There is no reason why managed/p2p interfaces have to
be limited to one. IBSS is the only type that needs
a restriction.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Print the event/state in ath_chanctx_event
Sujith Manoharan [Sun, 24 Aug 2014 15:46:11 +0000 (21:16 +0530)]
ath9k: Print the event/state in ath_chanctx_event

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Add new chanctx events
Sujith Manoharan [Sun, 24 Aug 2014 15:46:10 +0000 (21:16 +0530)]
ath9k: Add new chanctx events

This will be useful in handling addition/change of new
channel contexts.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Fix ath_chanctx_get()
Sujith Manoharan [Sat, 23 Aug 2014 13:42:16 +0000 (19:12 +0530)]
ath9k: Fix ath_chanctx_get()

Move it inside a CONFIG_ATH9K_CHANNEL_CONTEXT ifdef
since it is not needed otherwise.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Move ath9k_beacon_add_noa to channel.c
Sujith Manoharan [Sat, 23 Aug 2014 13:42:15 +0000 (19:12 +0530)]
ath9k: Move ath9k_beacon_add_noa to channel.c

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Remove redundant ifdef
Sujith Manoharan [Sat, 23 Aug 2014 13:42:14 +0000 (19:12 +0530)]
ath9k: Remove redundant ifdef

This was introduced in an earlier patch to handle
a compilation warning, but since the channel context
code has been mostly isolated, this is not required now.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Fix channel context variables in ath_softc
Sujith Manoharan [Sat, 23 Aug 2014 13:42:13 +0000 (19:12 +0530)]
ath9k: Fix channel context variables in ath_softc

chanctx_work and next_chan are required only when
CONFIG_ATH9K_CHANNEL_CONTEXT is enabled.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Fix 'offchannel' in ath_softc
Sujith Manoharan [Sat, 23 Aug 2014 07:59:23 +0000 (13:29 +0530)]
ath9k: Fix 'offchannel' in ath_softc

Finally move the 'offchannel' instance in ath_softc
inside a CONFIG_ATH9K_CHANNEL_CONTEXT cage. The offchannel
usage in ath9k_calculate_iter_data() is closed off with
an ifdef for now, since the state/opmode calculation is
common for both the channel context mode and the normal mode.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Fix function argument type
Sujith Manoharan [Sat, 23 Aug 2014 07:59:22 +0000 (13:29 +0530)]
ath9k: Fix function argument type

ath9k_vif_iter() was earlier used as an iterator
routine when calling a mac80211 utility. This is no
longer the case and hence we can mention the argument
type explicitly.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Use ath_chanctx_check_active properly
Sujith Manoharan [Sat, 23 Aug 2014 07:59:21 +0000 (13:29 +0530)]
ath9k: Use ath_chanctx_check_active properly

ath_chanctx_check_active() is required only when channel contexts
are used. Make sure that it is not called in normal usage.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Add ath9k_offchannel_init
Sujith Manoharan [Sat, 23 Aug 2014 07:59:20 +0000 (13:29 +0530)]
ath9k: Add ath9k_offchannel_init

This patch adds a routine to setup the offchannel
instance in ath_softc.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Add ath9k_chanctx_wake_queues
Sujith Manoharan [Sat, 23 Aug 2014 07:59:19 +0000 (13:29 +0530)]
ath9k: Add ath9k_chanctx_wake_queues

Introduce a function that handles queues in channel
context mode.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Add wrappers for beacon events
Sujith Manoharan [Sat, 23 Aug 2014 07:59:18 +0000 (13:29 +0530)]
ath9k: Add wrappers for beacon events

Using these wrappers allows us to move the 'sched'
variable in ath_softc inside CONFIG_ATH9K_CHANNEL_CONTEXT.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Fix function declarations
Sujith Manoharan [Sat, 23 Aug 2014 07:59:17 +0000 (13:29 +0530)]
ath9k: Fix function declarations

These routines are required only when
CONFIG_ATH9K_CHANNEL_CONTEXT is enabled.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Fix channel context events
Sujith Manoharan [Sat, 23 Aug 2014 07:59:16 +0000 (13:29 +0530)]
ath9k: Fix channel context events

Check if channel context usage is enabled before
calling ath_chanctx_event() from various parts of the
driver. Also, make sure that ath_chanctx_event() is
compiled only when CONFIG_ATH9K_CHANNEL_CONTEXT is
enabled.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Make ath_chanctx_switch static
Sujith Manoharan [Sat, 23 Aug 2014 07:59:15 +0000 (13:29 +0530)]
ath9k: Make ath_chanctx_switch static

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Make ath_chanctx_get_oper_chan static
Sujith Manoharan [Sat, 23 Aug 2014 07:59:14 +0000 (13:29 +0530)]
ath9k: Make ath_chanctx_get_oper_chan static

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Make ath_chanctx_offchan_switch static
Sujith Manoharan [Sat, 23 Aug 2014 07:59:13 +0000 (13:29 +0530)]
ath9k: Make ath_chanctx_offchan_switch static

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Conditionally compile more functions
Sujith Manoharan [Sat, 23 Aug 2014 07:59:12 +0000 (13:29 +0530)]
ath9k: Conditionally compile more functions

Use CONFIG_ATH9K_CHANNEL_CONTEXT to exclude:

ath_scan_complete()
ath_roc_complete()
ath_offchannel_next()
ath_scan_next_channel()
ath_scan_channel_duration()

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Exclude more functions
Sujith Manoharan [Sat, 23 Aug 2014 07:59:11 +0000 (13:29 +0530)]
ath9k: Exclude more functions

Use CONFIG_ATH9K_CHANNEL_CONTEXT to exclude more functions:

ath_offchannel_channel_change()
ath_scan_channel_start()
ath_scan_send_probe()

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Conditionally compile a few functions
Sujith Manoharan [Sat, 23 Aug 2014 07:59:10 +0000 (13:29 +0530)]
ath9k: Conditionally compile a few functions

Exclude these functions when CONFIG_ATH9K_CHANNEL_CONTEXT is not
enabled:

ath_chanctx_send_vif_ps_frame()
ath_chanctx_send_ps_frame()
ath_chanctx_defer_switch()
ath_chanctx_set_next()

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Cleanup mgd_prepare_tx callback
Sujith Manoharan [Sat, 23 Aug 2014 07:59:09 +0000 (13:29 +0530)]
ath9k: Cleanup mgd_prepare_tx callback

Rename the callback from ath9k_chanctx_force_active()
to ath9k_mgd_prepare_tx(). Also, move it to main.c and
group it with the other callbacks.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Make ath_chanctx_work static
Sujith Manoharan [Sat, 23 Aug 2014 07:59:08 +0000 (13:29 +0530)]
ath9k: Make ath_chanctx_work static

Also compile it conditionally based on
CONFIG_ATH9K_CHANNEL_CONTEXT.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Add a routine to tear down channel contexts
Sujith Manoharan [Sat, 23 Aug 2014 07:59:07 +0000 (13:29 +0530)]
ath9k: Add a routine to tear down channel contexts

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Add a routine for initializing channel contexts
Sujith Manoharan [Sat, 23 Aug 2014 07:59:06 +0000 (13:29 +0530)]
ath9k: Add a routine for initializing channel contexts

Setup the offchannel/sched timers and the chanctx work
inside the new function.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agocarl9170: Remove redundant protection check
Andreea-Cristina Bernat [Fri, 22 Aug 2014 19:14:31 +0000 (22:14 +0300)]
carl9170: Remove redundant protection check

The carl9170_op_ampdu_action() function is used only by the mac80211
framework.
Since the mac80211 already takes care of checks and properly serializing
calls to the driver's function there is no need for the driver to do the same
thing.

Signed-off-by: Andreea-Cristina Bernat <bernat.ada@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Isolate ath9k_use_chanctx module parameter
Sujith Manoharan [Fri, 22 Aug 2014 15:09:31 +0000 (20:39 +0530)]
ath9k: Isolate ath9k_use_chanctx module parameter

This patch ensures that the module parameter "use_chanctx" is
visible only when CONFIG_ATH9K_CHANNEL_CONTEXT is selected.
Also register the channel context callbacks with mac80211 only
when it is explicitly enabled and compile them out of the driver
when CONFIG_ATH9K_CHANNEL_CONTEXT is not selected.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Isolate P2P powersave routines
Sujith Manoharan [Fri, 22 Aug 2014 15:09:30 +0000 (20:39 +0530)]
ath9k: Isolate P2P powersave routines

Use CONFIG_ATH9K_CHANNEL_CONTEXT to conditionally
compile P2P-PS code.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Move P2P functions to channel.c
Sujith Manoharan [Fri, 22 Aug 2014 15:09:29 +0000 (20:39 +0530)]
ath9k: Move P2P functions to channel.c

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Add a config option for channel context
Sujith Manoharan [Fri, 22 Aug 2014 15:09:28 +0000 (20:39 +0530)]
ath9k: Add a config option for channel context

Channel contexts are supported only for P2P right now,
so make sure that the 'normal' path remains unaffected
by using a config option. This will also reduce the size
of the driver.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Add debug information
Sujith Manoharan [Fri, 22 Aug 2014 15:09:27 +0000 (20:39 +0530)]
ath9k: Add debug information

Add a few statements to debug channel context operation.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Move channel operations to channel.c
Sujith Manoharan [Fri, 22 Aug 2014 15:09:26 +0000 (20:39 +0530)]
ath9k: Move channel operations to channel.c

This reduces clutter in main.c

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Handle failure to allocate HW timer
Sujith Manoharan [Fri, 22 Aug 2014 15:09:25 +0000 (20:39 +0530)]
ath9k: Handle failure to allocate HW timer

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Add a debug level for channel context
Sujith Manoharan [Fri, 22 Aug 2014 15:09:24 +0000 (20:39 +0530)]
ath9k: Add a debug level for channel context

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath5k: remove redundant null check before kfree()
Bob Copeland [Fri, 22 Aug 2014 13:18:02 +0000 (09:18 -0400)]
ath5k: remove redundant null check before kfree()

kfree() null-checks its argument.
Found by smatch.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath5k: ensure led name is null terminated
Bob Copeland [Fri, 22 Aug 2014 13:18:01 +0000 (09:18 -0400)]
ath5k: ensure led name is null terminated

Add the missing null termination after strncpy().

This isn't actually a buffer overflow in this case since we use
snprintf() appropriately to fill the buffer passed by the caller,
but in the interest of not turning this into a bug down the road,
go ahead and force termination here.

Found by Coverity.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath5k: drop useless comparison
Bob Copeland [Fri, 22 Aug 2014 13:18:00 +0000 (09:18 -0400)]
ath5k: drop useless comparison

rxs->rate_idx is unsigned, so it will always be >= 0.
Found by Coverity.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoray_cs: Add include guards
Rasmus Villemoes [Mon, 25 Aug 2014 07:59:29 +0000 (09:59 +0200)]
ray_cs: Add include guards

The files ray_cs.h and rayctl.h both contain two thirds of what
appears to be an include guard using the macro name RAYLINK_H (both
lack the #define). Since RAYLINK_H is not defined anywhere, the
#ifndefs are confusing no-ops. Add proper include guards using
different macro names.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agobcma: only map wrapper if its address is available
Hauke Mehrtens [Fri, 22 Aug 2014 06:44:52 +0000 (08:44 +0200)]
bcma: only map wrapper if its address is available

The Chipcommon B core does not have a wrap address and it would fail here.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agomwifiex: use firmware API revision from GET_HW_SPEC response
Amitkumar Karwar [Tue, 19 Aug 2014 12:24:26 +0000 (08:24 -0400)]
mwifiex: use firmware API revision from GET_HW_SPEC response

Newer firmware returns API revision in GET_HW_SPEC command
response. We will make use of it instead of parsing this
information from FW release number.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: Cathy Luo <cluo@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>