Commit graph

286 commits

Author SHA1 Message Date
Alexander Aring
30811fa663 at86rf230: cleanup start and stop callbacks
This code cleanups the start and stop callbacks by removing hw->priv and
using the already dereferenced variable lp which is the same.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-06-16 18:55:11 +02:00
Alexander Aring
74ed9d9845 at86rf230: add recommended csma backoffs settings
This patch adds support for a new random csma backoffs settings when
going into sleep state. This is recommended according at86rf2xx
datasheets.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-06-16 18:55:11 +02:00
Alexander Aring
cbe6234689 at86rf230: fix phy settings while sleeping
While in sleep state then we can't access the at86rf2xx registers. This
patch checks if the transceiver is in sleep state before sending spi
messages via regmap. Regmap is used on every driver ops callback except
for receive and xmit handling, but while receive and xmit handling the
phy should not be inside the sleep state.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-06-16 18:55:11 +02:00
Alexander Aring
789a99ecb9 fakelb: add xmit_async after stop testcase
This patch adds a suspended testcase into the xmit_async functionality.
In the hope that we can found race conditions when xmit_async is called
after an ieee802154_ops stop. This should never happen.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-06-15 01:25:06 +02:00
Alexander Aring
e6f7ed9dc1 at86rf230: add support for sleep state
This patch adds support for sleep state when between stop and start
period. In this period the transceiver isn't used by the subsystem, in
this time we disable the irq and going into the sleep state.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-06-15 01:22:19 +02:00
Alexander Aring
9ff19e6f44 at86rf230: use level high as fallback default
This patch use high level interrupt type as fallback handling when no
irq type is given.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-06-15 01:22:19 +02:00
Stefan Schmidt
c9d442038e ieee802154: cc2520: check for return values in cc2520_filter()
neither ram nor register write return values have been checked here.
Checking both now. Assign ret with 0 as all other assignments are inside
if blocks and might not happen before we return ret.

CID: 1230469
Signed-off-by: Stefan Schmidt <stefan@osg.samsung.com>
Acked-by: Varka Bhadram <varkabhadram@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-06-09 14:05:22 +02:00
Stefan Schmidt
e5719b661a ieee802154/mrf24j40: make sure we do not override return values
If we run into an error during rx we set the the error code in ret, but override
it afterwards. Using a different variable for the extra case avoids this
situation.

CID: 1226982, 1226983
Signed-off-by: Stefan Schmidt <stefan@osg.samsung.com>
Cc: Alan Ott <alan@signal11.us>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-06-09 10:55:36 +02:00
Alexander Aring
f265be3d12 mac802154: remove aack hw flag
This patch removes the hardware auto acknowdledge flag which indicates
that the transceiver supports this handling. This flag is never
evaluated inside mac802154 and all transceivers should support this
handling by default per hardware.

Suggested-by: Lennert Buytenhek <buytenh@wantstofly.org>
Cc: Alan Ott <alan@signal11.us>
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Reviewed-by: Varka Bhadram <varkabhadram@gmail.com>
Acked-by: Stefan Schmidt <stefan@osg.samsung.com>
Acked-by: Varka Bhadram <varkabhadram@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-06-07 09:13:32 +02:00
Alexander Aring
ed65963ba0 mac802154: remove unneeded vif struct
This patch removes the virtual interface structure from sub if data
struct, because it isn't used anywhere. This structure could be useful
for give per interface information at softmac driver layer. Nevertheless
there exist no use case currently and it contains the interface type
information currently. This information is also stored inside wpan dev
which is now used to check on the wpan dev interface type.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Reviewed-by: Varka Bhadram <varkabhadram@gmail.com>
Acked-by: Varka Bhadram <varkabhadram@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-06-07 09:13:32 +02:00
Varka Bhadram
d6d244d4df cc2520: update current channel
This patch updates the current channel to 11. This is the default
value on reset.

Signed-off-by: Varka Bhadram <varkab@cdac.in>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-05-31 13:40:54 +02:00
Varka Bhadram
322fe2d1be cc2520: update initial transmit power value
CC2520 has the default 0dBm transmit power level  on reset.
This patch update initial value of transmit power with 0dBm value.

Signed-off-by: Varka Bhadram <varkab@cdac.in>
Cc: Brad Campbell <bradjc5@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-05-31 13:40:54 +02:00
Varka Bhadram
e10c1674e3 cc2520: add set transmit power setting support
This patch adds support for seeting tx power values for cc2520
and also for the combination of CC2520-CC2591.

Signed-off-by: Varka Bhadram <varkab@cdac.in>
Cc: Brad Campbell <bradjc5@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-05-31 13:40:53 +02:00
Varka Bhadram
1a1bc59c5f cc2520: fix CC2591 handling
This patch changes tha way of handling of cc2591-cc2520 combination
by moving amplified variable from platform data to private data.
This will be useful in other sections like tx power support.

Signed-off-by: Varka Bhadram <varkab@cdac.in>
Cc: Brad Campbell <bradjc5@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-05-31 13:40:53 +02:00
Varka Bhadram
aad1b0b5d3 cc2520: fix in default tx power setting
Initially we dont have the tx power settings from the user-space.
Now we have the support for seeting the tx power level.

So lets use the default tx power setting for the radio.

Signed-off-by: Varka Bhadram <varkab@cdac.in>
Cc: Brad Campbell <bradjc5@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-05-31 13:40:53 +02:00
Stefan Schmidt
c61c9bd81b ieee802154/atusb: Add .set_promiscuous_mode driver operation
Allow monitor mode operation with disabled AACK in hardware.

Signed-off-by: Stefan Schmidt <stefan@osg.samsung.com>
Reviewed-by: Varka Bhadram <varkabhadram@gmail.com>
Acked-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-05-31 13:40:53 +02:00
Stefan Schmidt
8702cb0f21 ieee802154/atusb: Add .set_txpower operation to the driver
Atusb uses the at86rf231 transceiver so we can use the same calculation
for txpower settings for it.

Signed-off-by: Stefan Schmidt <stefan@osg.samsung.com>
Reviewed-by: Varka Bhadram <varkabhadram@gmail.com>
Acked-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-05-31 13:40:53 +02:00
Stefan Schmidt
bdc7873727 ieee802154/atusb: Add function for partial register writes
With this function we can set individual bits in the registers if needed.
With the old SR_VALUE macro we could only set one bit in the register
which was ok for some scenarios but not for all. With this subreg write
function we can now set more bits defined by the mask while not touching
the rest.

We start using it for the current SR_VALUE use case and will use it more
in upcoming patches.

Signed-off-by: Stefan Schmidt <stefan@osg.samsung.com>
Reviewed-by: Varka Bhadram <varkabhadram@gmail.com>
Acked-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-05-31 13:40:53 +02:00
Alexander Aring
b5a61c306b atusb: add support for at86rf230
This patch adds support for the at86rf230 version check which is used
by the rzusb stick.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Reviewed-by: Stefan Schmidt <stefan@osg.samsung.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-05-27 19:29:54 +02:00
Stefan Schmidt
2d8cbd31dd ieee802154/atusb: Set default ed level to 0xbe like the rest of these drivers
Signed-off-by: Stefan Schmidt <stefan@osg.samsung.com>
Acked-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-05-21 17:52:23 +02:00
Stefan Schmidt
f1a71886c5 ieee802154/atusb: Mark driver as AACK enabled in hardware.
Since firmware version 0.2 we use AACK handling directly in the firmware.
Inform the stack that the hardware supports and uses it.

Signed-off-by: Stefan Schmidt <stefan@osg.samsung.com>
Acked-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-05-21 17:52:23 +02:00
Stefan Schmidt
33a238ae65 ieee802154/atusb: Warn about outdated device firmware.
Together with mainlining the driver we released a first public binary version
of the device firmware. This is version 0.2. With this change we warn users
who run outdated versions of the firmware. While we have not seen problems
with it yet (thus no error, but a warning only) it would be better to run the
released and tested firmware. You can find released versions here:

http://downloads.qi-hardware.com/people/werner/wpan/web/

Signed-off-by: Stefan Schmidt <stefan@osg.samsung.com>
Acked-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-05-21 17:52:23 +02:00
Alexander Aring
179655fcd2 at86rf230: add missing cca ed level values
This patch add missing values for at86rf212 ed level values. Currently
there are 15 values and the register setting supports 16 different ed
level values.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Reported-by: Craig Younkins <craig@freshtemp.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-05-20 11:51:54 +02:00
Alexander Aring
39572ab30f fakelb: cleanup code
This patch just cleanups the code at several places.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-05-19 11:44:46 +02:00
Alexander Aring
a09c07a8c8 fakelb: add support for async xmit handling
This patch will add async xmit support for the fakelb driver.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-05-19 11:44:46 +02:00
Alexander Aring
98be165b43 fakelb: remove fakelb_hw_deliver
This patch cleanups the fakelb_hw_deliver function by removing them.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-05-19 11:44:46 +02:00
Alexander Aring
e214a9040a fakelb: add virtual phy reset defaults
This patch adds reset defaults for the fakelb phy. I used the channel 13
and page 0 which is the same default like at86rf233.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-05-19 11:44:46 +02:00
Alexander Aring
12da8d97ab fakelb: use own channel and page attributes
This patch adds an own phy attribute for page and channel into
fakelb_phy. The current way is to use the internal mac802154 stored phy
pib values which can occur in locking issues while using it inside the
driver layer.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-05-19 11:44:46 +02:00
Alexander Aring
e369dc8f1a fakelb: introduce fakelb ifup phys list
This patch introduce a fakelb ifup phys list, which stores all
registered phys which are in an operated mode. This will reduce the
iterations of non-operated phys while transmit frames. There exists two
locks now, one rwlock for the operated interfaces and the spinlock for
protecting the list for all registered virtual phys.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-05-19 11:44:46 +02:00
Alexander Aring
6fa2cffe8c fakelb: move lock out of iteration
The list need to be protected while iteration which is need when other
list iterates at the same time over this list.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-05-19 11:44:46 +02:00
Alexander Aring
b82b99f16b fakelb: declare fakelb list static
This patch moves the fakelb list of all registered phy's in a static
declaration in the fakelb driver.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-05-19 11:44:45 +02:00
Alexander Aring
3335d98c69 fakelb: declare rwlock static
This patch moves the rwlock declarition into a static variable.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-05-19 11:44:45 +02:00
Alexander Aring
9f8b97f888 fakelb: don't deliver when one phy
A real phy don't transmit the transmitted frame back to the phy. This
behaviour will confuse the 6LoWPAN and the upper IPv6 neighbour
discovery cache. We need now at least two virtual phy's to creating a
virtual wpan network.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-05-19 11:44:45 +02:00
Alexander Aring
db3f5d0df9 fakelb: rename fakelb_dev_priv to fakelb_phy
This patch renames fakelb_dev_priv to fakelb_phy. We don't faking
devices here, we fake wpan phys. This avoids also confusing with the
variable priv, which is used several times in this driver to represent
this structure.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-05-19 11:44:45 +02:00
Alexander Aring
3186d3d7ae fakelb: use list_for_each_entry_safe
Iterate and removing items from a list, we should use
list_for_each_entry_safe instead list_for_each_entry to avoid accidents
by removing.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-05-19 11:44:45 +02:00
Alexander Aring
7e57905ba6 fakelb: creating two virtual phys per default
This patch change the default virtual wpan phys of fakelb driver from
one to two. To have one virtual phy makes no sense, because it need at
least two virtual phy's to speak to each other.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-05-19 11:44:45 +02:00
Alexander Aring
7490b008d1 ieee802154: add support for atusb transceiver
This patch adds support for the atusb transceiver.

The current driver supports basic functionality only. Possible further
tasks would be to sync functionality with the at86rf230 driver, because
the atusb use internally an at86rf231 transceiver. Some of these
features need a firmware update like AACK and ARET handling.

I did small changes to this driver to work with xmit_async callback and
setting of a random extended perm address.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Cc: Werner Almesberger <werner@almesberger.net>
Cc: Stefan Schmidt <s.schmidt@samsung.com>
Cc: Richard Sharpe <realrichardsharpe@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-05-19 11:44:45 +02:00
Alexander Aring
a2c390aa3d at86rf230: fix callback for aret handling
This patch fix the complete callback for going into aret on. Currently
we starting after a state change into aret on again a state change into
aret on which is not necessary.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-05-19 11:44:45 +02:00
Martin Townsend
cb97d9a3eb mac802154: fakelb: Fix potential NULL pointer dereference.
fakelb_hw_deliver creates a copy of the skb's header which can
potentially return NULL so we now check for this before actually
delivering to the 802.15.4 MAC layer.

Signed-off-by: Martin Townsend <martin.townsend@xsilon.com>
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-05-19 11:44:44 +02:00
Alexander Aring
392f4e67ad at86rf230: add reset states of tx power level
This patch adds the reset states for tx power levels after running reset
procedure.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-05-19 11:44:44 +02:00
Alexander Aring
cc643496c0 at86rf230: add cca ed level reset value
This patch adds reset values for cca ed level values after running reset
procedure.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-05-19 11:44:44 +02:00
Alexander Aring
2d9fe7ab37 at86rf230: rework tx cca energy detection level
This patch reworks the cca energy detection level handling. This
contains a calculation which works on all transceiver types and
add support for dump cca energy detection levels.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-05-19 11:44:44 +02:00
Alexander Aring
6f4da3f897 at86rf230: rework tx power support
This patch adds support for get transmit power levels and reworks the
set of transmit power levels which was broken before.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-05-19 11:44:44 +02:00
Alexander Aring
8377d22c03 at86rf230: set cca_modes supported flags
This patch sets the at86rf230 supported cca modes. In case of at86rf212
it also can support listen before transmit.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-05-19 11:44:42 +02:00
Alexander Aring
edea8f7c75 cfg802154: introduce wpan phy flags
This patch introduce a flag property for the wpan phy structure.
The current flag settings in ieee802154_hw are accessable in mac802154
layer only which is okay for flags which indicates MAC handling which
are done by phy. For real PHY layer settings like cca mode, transmit
power, cca energy detection level.

The difference between these flags are that the MAC handling flags are
only handled in mac802154/HardMac layer e.g. on an interface up. The phy
settings are direct netlink calls from nl802154 into the driver layer
and the nl802154 need to have a chance to check if the driver supports
this handling before sending to the next layer.

We also check now on PHY flags while dumping and setting pib attributes.
In comparing with MIB attributes the 802.15.4 gives us an default value
which we assume when a transceiver implement less functionality. In case
of MIB settings the nl802154 layer doesn't need to check on the
ieee802154_hw flags then.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-05-19 11:44:42 +02:00
Alexander Aring
72f655e44d ieee802154: introduce wpan_phy_supported
This patch introduce the wpan_phy_supported struct for wpan_phy. There
is currently no way to check if a transceiver can handle IEEE 802.15.4
complaint values. With this struct we can check before if the
transceiver supports these values before sending to driver layer.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Suggested-by: Phoebe Buckheister <phoebe.buckheister@itwm.fraunhofer.de>
Acked-by: Varka Bhadram <varkabhadram@gmail.com>
Cc: Alan Ott <alan@signal11.us>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-05-19 11:44:42 +02:00
Alexander Aring
32b23550ad ieee802154: change cca ed level to mbm
This patch change the handling of cca energy detection level from dbm to
mbm. This prepares to handle floating point cca energy detection levels
values. The old netlink 802.15.4 will convert the dbm value to mbm for
handling backward compatibility.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-05-19 11:44:42 +02:00
Alexander Aring
e2eb173aaa ieee802154: change transmit power to mbm
This patch change the handling of transmit power level from dbm to mbm.
This prepares to handle floating point transmit power levels values. The
old netlink 802.15.4 will convert the dbm value to mbm for handling
backward compatibility.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-05-19 11:44:41 +02:00
Alexander Aring
1a19cb680b ieee802154: change transmit power to s32
This patch change the transmit power from s8 to s32. This prepares to store a
mbm value instead dbm inside the transmit power variable. The old
interface keep the a s8 dbm value, which should be backward compatibility
when assign s8 to s32.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-05-19 11:44:41 +02:00
Alexander Aring
d2c8bf51d0 at86rf230: add slp_tr support to start tx
This patch adds support for one of the slp_tr gpio use cases which
indicates the TX_START command without doing some spi bus traffic.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Reviewed-by: Varka Bhadram <varkabhadram@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-04-30 18:48:11 +02:00
Alexander Aring
8500920317 at86rf230: change state change if from trx_off
If a transmit ends in a calibration which means the transceiver do a
TRX_OFF state change, we can directly change into TX_ARET state instead
doing a TX_ON to TX_ARET statechange.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Reviewed-by: Varka Bhadram <varkabhadram@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-04-30 18:48:11 +02:00
Alexander Aring
2f8cdd9509 at86rf230: remove unnecessary tx state change
All supported transceivers can do a valid state change from TRX_OFF to
AACK_ON. This patch removes the state change chain from TRX_OFF ->
TX_ON -> AACK_ON instead we doing a directly state change from TRX_OFF
to AACK_ON.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-04-30 18:48:10 +02:00
Alexander Aring
3b951ca7d2 at86rf230: add TX_ARET_ON for calibration timeout
This patch adds a calibration timeout reset when change from TRX_OFF to
TX_ARET_ON which also occurs a calibration.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Reviewed-by: Varka Bhadram <varkabhadram@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-04-30 18:48:10 +02:00
Alexander Aring
2ad33244db at86rf230: move cal_timeout to state change
This patch moves the calculation timeout of TRX_OFF to RX_AACK_ON
handling to the async state change functionality. With this patch we can
do a reset of calculation timeout when others TRX_OFF to RX_AACK_ON
happens instead of doing this on interface up only.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Reviewed-by: Varka Bhadram <varkabhadram@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-04-30 18:48:10 +02:00
Alexander Aring
5e8e01e262 at86rf230: remove tabs after define
This patch cleanups the at86rf230 driver to use a space instead a tab
after define.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Reviewed-by: Varka Bhadram <varkabhadram@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-04-30 18:48:10 +02:00
Christoffer Holmstedt
4748e86ecf at86rf230: Add macro for TRX STATE MASK
Instead of using the 'magic' number of 0x1f the TRX_STATE_MASK macro is
introduced.

Signed-off-by: Christoffer Holmstedt <christoffer.holmstedt@gmail.com>
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-04-30 18:48:09 +02:00
Varka Bhadram
23310f6f3a mac802154: fix transmission power datatype
Netlink attribute for the power is s8. But for the driver level
operations we are collection power level value into integer.
It has to be change to s8 from int.

Signed-off-by: Varka Bhadram <varkab@cdac.in>
Acked-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-04-09 19:56:15 +02:00
Alexander Aring
a7a484bfca at86rf230: fix is_tx while error handling
This patch fix the error handling when is_tx is true. The error handling
tries to get the transceiver into RX_AACK_ON mode then we need to be
sure that is_tx is false.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-03-27 19:18:51 +01:00
Alexander Aring
3ff7092bc8 at86rf230: remove unnecessary spinlock
This spinlock isn't necessary because if we are in TX_ON/TX_ARET_ON
state the transceiver can't be interrupted e.g. by receiving a frame
when a SHR was detected. In this time the transceiver doesn't leave
the TX_ON/TX_ARET_ON state until the tx complete irq change the state
into RX_AACK_ON again. This means a receiving interrupt in state
TX_ON/TX_ARET_ON can't happen and is_tx is protected by transceiver.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-03-27 19:18:50 +01:00
Brad Campbell
f0b7d43c8a cc2520: Add support for CC2591 amplifier.
The TI CC2521 is an RF power amplifier that is designed to interface
with the CC2520. Conveniently, it directly interfaces with the CC2520
and does not require any pins to be connected to a
microcontroller/processor. Adding a CC2591 increases the CC2520's range,
which is useful for border router and other wall-powered applications.

Using the CC2591 with the CC2520 requires configuring the CC2520 GPIOs
that are connected to the CC2591 to correctly set the CC2591 into TX and
RX modes. Further, TI recommends that the CC2520_TXPOWER and
CC2520_AGCCTRL1 registers are set differently to maximize the CC2591's
performance. These settings are covered in TI Application Note AN065.

This patch adds an optional `amplified` field to the cc2520 entry in the
device tree. If present, the CC2520 will be configured to operate with a
CC2591.

The expected pin mapping is:
CC2520 GPIO0 --> CC2591 EN
CC2520 GPIO5 --> CC2591 PAEN

Signed-off-by: Brad Campbell <bradjc5@gmail.com>
Acked-by: Varka Bhadram <varkabhadram@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-03-18 17:50:25 +01:00
Brad Campbell
0db055c934 cc2520: Do not store platform_data in spi_device
Storing the `platform_data` struct inside of the SPI struct when using
the device tree allows for a later function to edit the content of that
struct. This patch refactors the `cc2520_get_platformat_data` function
to accept a pointer to a `cc2520_platform_data` struct and populates
the fields inside of it.

This change mirrors commit aaa1c4d226
("at86rf230: copy pdata to driver allocated space").

Signed-off-by: Brad Campbell <bradjc5@gmail.com>
Acked-by: Varka Bhadram <varkabhadram@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-03-18 17:50:25 +01:00
Alexander Aring
d907c4f05c at86rf230: fix at86rf230_read_subreg succeed handling
This patch fix an issue when at86rf230_read_subreg was successful. The
function at86rf230_read_subreg will directly call regmap_read which
returns zero on successful. Nobody figured out issues yet because it was
only necessary to evaluate dvdd state while probing. This could make
trouble because the stack variable could have an random value.

The function is also used by reset the irq line before requesting irq, but
the value isn't evaluated afterwards.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-03-17 16:30:57 +01:00
Alexander Aring
51b3b2cfc6 at86rf230: fix volatile regmap registers
These registers are also changed by transceiver and should be volatile
for right accessing via regmap debugfs.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-03-14 17:11:31 +01:00
Alexander Aring
dce481e63d at86rf230: add support for calibration timeout
This patch adds a handling for calibration if we are 5 minutes in PLL
state. I first tried to implement the calibration functionality in
TX_ON state via register values CF_START and DCU_START, but this occurs
a one second delay at each calibration time.

An another solution to start a calibration is to switch from TRX_OFF
state into TX_ON, then a calibration is done automatically by
transceiver. This method will be used in this patch, after each transmit
of a frame we check with jiffies if the PLL is set 5 minutes without
doing a TRX_OFF->(TX_ON || RX_AACK_ON) or channel switch. The worst case
would be a transceiver in receiving mode only, but this is under normal
operation very unlikely.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Cc: Phoebe Buckheister <phoebe.buckheister@itwm.fraunhofer.de>
Cc: Werner Almesberger <werner@almesberger.net>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-03-14 17:11:31 +01:00
Alexander Aring
eb3b435ecd at86rf230: replace state change sleeps with hrtimer
This patch replace the state change timing relevant sleeps with
hrtimers. Currently the sleeps are done in the complete handler of
spi_async. The relation of doing the state change timing sleep with a
timer will get the sleep functionality out of spi_async complete handler
context.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-03-14 17:11:31 +01:00
Alexander Aring
e372174900 at86rf230: init xtal_trim with zero
This patch initialize xtal_trim value to zero. The xtal_trim property is
an optional device tree value. Currently if no xtal_trim property is
given the xtal_trim value can be contain random data, because it's a
stack variable. This patch init the xtal_trim value to zero which is
also the default value after reset for at86rf230 transceivers.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-03-14 17:11:31 +01:00
Alexander Aring
263be3326b at86rf230: restore trx len when needed
In the most cases the spi messages has a length of two. Currently we
always set the the len field to two before transmit a spi message. In
cases for read out/write in the frame buffer we need another len. This
patch use trx len two as default. For the frame buffer cases we restore
the trx len to two on success and failure. This will reduce the len
setting of two when it's already two.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-03-03 02:15:25 +01:00
Alexander Aring
31fa74344c at86rf230: remove multiple dereferencing for ctx
This patch cleanups the referencing for the state change context
variable. The state change context should only set once and this is by
initial a state change. This patch will use the initial state change
variable in the complete handler of the state change by using the ctx
context which should be always the same like the initial state change
context.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-03-03 02:15:25 +01:00
Alexander Aring
cca990c85d at86rf230: remove multiple dereferencing for irq
By holding the irq variable inside at86rf230_state_change we can squash
some multiple dereferencing for getting irq num.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-03-03 02:15:25 +01:00
Alexander Aring
74de4c804c at86rf230: refactor receive handling
This patch refactor the receive handling into one function.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-03-03 02:15:25 +01:00
Alexander Aring
ef5428a138 at86rf230: cleanup and squash stack variable
I had this variable because I thought it would be protected by
disable/enable irq but this is not true. It's protected by stop/wake
netdev queue which is called by ieee802154_xmit_complete.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-03-03 02:15:25 +01:00
Alexander Aring
ba6d223932 at86rf230: add transmit retry support
This patch introduce a transmit retry handling into at86rf230 transmit
path. Current behaviour is to wait the normal receive time if we want
to go into STATE_TX_ON when the transceiver is in STATE_BUSY_RX_AACK
which indicates that a frame is currently receiving. A non force state
change will not interrupt the the receiving state.

The current behaviour is that after the normal receive time we will
start a force change into STATE_TX_ON. With this patch we do seven
retries to go into STATE_TX_ON without forcing. After we hit the
AT86RF2XX_MAX_TX_RETRIES we will start the force state change.
This is a polling like method to go into STATE_TX_ON in times of maximum
receiving time.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-03-03 02:15:24 +01:00
Alexander Aring
c91799c50a at86rf230: add warning if edge-triggered irq
While testing I experience a deadlock while using the at86rf233 on a
raspberry pi. The reason was an edge triggered gpio irq because the irq
triggered while irq was disabled. This issue doesn't happend on a level
triggered irq because the irq will hit after calling enable_irq.

This patch adds a warning that it's not recommended to use a edge-triggered
irq type. Also change the examples to high-level irqtype.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-02-27 18:42:44 +01:00
Alexander Aring
702d211c45 at86rf230: add irq low-level for polarity
The at86rf2xx chips supports the setting of irq polarity if active low
or active high. This patch adds a handling for IRQ_ACTIVE_LOW if the
irq_type is IRQ_TYPE_LEVEL_LOW.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-02-27 18:42:44 +01:00
Alexander Aring
be64f07646 at86rf230: add irqmask mode setting
Since we support at86rf233 we need to ensure that basic operation
default values are the same. This patch always sets IRQ_MASK_MODE to 0
which is after reset 1 at the at86rf233 and 0 at the at86rf231.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-02-27 18:42:44 +01:00
Alexander Aring
2c2f7ec142 at86rf230: remove tx_timeout
This patch removes tx_timeout handling. We used it in sync xmit
handling. Since we support async xmit handling a xmit timeout handling
isn't easy to implement and should be implemented by netdev watchdog
mechanism.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-02-27 18:42:44 +01:00
Alexander Aring
ccdaeb2b17 at86rf230: add support for external xtal trim
This patch adds support for setting the xtal trim register. Some at86rf2xx
transceiver boards needs fine tuning the xtal capacitor.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-02-27 18:42:44 +01:00
Alexander Aring
aaa1c4d226 at86rf230: copy pdata to driver allocated space
This patch copies the platform data in driver allocated space at first.
With this change we ensure that we access the allocated platform data as
readonly space.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Reported-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-02-27 18:42:43 +01:00
Nicholas Mc Guire
3e544ef935 at86rf230: assign wait_for_completion_timeout to appropriately typed var
return type of wait_for_completion_timeout is unsigned long not int.
As rc is used here only for wait_for_completion_timeout the type is simply
changed to unsigned long.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-02-15 00:08:39 +01:00
Mohammad Jamal
3251ca334b ieee802154: cc2520: Fix space before , coding style issue
This patch removes the warnings (space before , ) shown by
checkpatch.pl

Signed-off-by: Mohammad Jamal <md.jamalmohiuddin@gmail.com>
Acked-by: Varka Bhadram <varkabhadram@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-02-02 06:09:35 +01:00
Mohammad Jamal
908edc5461 ieee802154: cc2520: Replace shift operations by BIT macro
This patch replaces the shifting operations by BIT macro

Signed-off-by: Mohammad Jamal <md.jamalmohiuddin@gmail.com>
Acked-by: Varka Bhadram <varkabhadram@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2015-02-02 06:07:47 +01:00
Krzysztof Kozlowski
889ee2c7d7 at86rf230: Constify struct regmap_config
The regmap_config struct may be const because it is not modified by the
driver and regmap_init() accepts pointer to const.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2015-01-05 16:30:50 -05:00
Varka Bhadram
7fc1b2d56f cc2520: fix zero perm_extended_addr address
It will remove the bug of havine zero perm_extended_addr address.

Signed-off-by: Varka Bhadram <varkab@cdac.in>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2014-12-30 07:15:55 +01:00
Varka Bhadram
f50f1c37a6 cc2520: remove 'ret' goto label
If allocation of memory fails instead of going to ret goto label
and returning from there, we can directly return -ENOMEM on failure.

Signed-off-by: Varka Bhadram <varkab@cdac.in>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2014-12-30 07:15:55 +01:00
Varka Bhadram
5eb9f8caac cc2520: use devm_kzalloc(.., sizeof(*pointer), ..) pattern
Signed-off-by: Varka Bhadram <varkab@cdac.in>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2014-12-30 07:15:55 +01:00
Wolfram Sang
589a55b07d net: ieee802154: don't use devm_pinctrl_get_select_default() in probe
Since commit ab78029ecc (drivers/pinctrl: grab default handles from device
core), we can rely on device core for setting the default pins.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Acked-by: Varka Bhadram <varkabhadram@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2014-12-30 07:12:01 +01:00
Alexander Aring
c8c7e3db81 at86rf230: cleanup check on trac status
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Reviewed-by: Stefan Schmidt <s.schmidt@samsung.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2014-12-19 11:54:05 +01:00
Andrey Yurovsky
4ecc8a559b at86rf230: remove version check for AT86RF212
This version check allows the driver to only work with v=1 hardware
however there is no driver-facing difference with newer versions
(confirmed by Atmel FAEs) so this check needlessly prevents the driver
from being used with radios now in production.

Tested on AT86RF212B radio (which came up as v=3).

Signed-off-by: Andrey Yurovsky <yurovsky@gmail.com>
Reviewed-by: Stefan Schmidt <s.schmidt@samsung.com>
Acked-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2014-12-19 01:49:01 +01:00
Andrey Yurovsky
7598968d6f at86rf230: fix register read for part version
The driver was reading the PART_NUM register for both the part number
(type of device) and the part version, the version is actually in
register 0x1D, VERSION_NUM.  I believe that this was a copy-paste error.

Tested on AT86RF212B where the part is detected to be the expected part
number (0x07) and version (0x03 on mine).

Signed-off-by: Andrey Yurovsky <andrey@snupi.com>
Acked-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2014-12-19 00:19:25 +01:00
Alexander Aring
2a10050160 at86rf230: remove unnecessary assign
The attribute extra_tx_headroom should already be zero.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Reviewed-by: Stefan Schmidt <s.schmidt@samsung.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2014-12-19 00:19:25 +01:00
Alexander Aring
4fef7d3b01 at86rf230: fix context pointer handling
This patch changes the context pointer to the parameter given one inside
function at86rf230_async_state_change_start. This could occur problem if
context isn't pointed to lp->state.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Reviewed-by: Stefan Schmidt <s.schmidt@samsung.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2014-12-19 00:19:25 +01:00
Alexander Aring
fc50c6e36d at86rf230: make at86rf230_async_error inline
This patch makes the at86rf230_async_error inline. This function is
small enough to handle inline.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Reviewed-by: Stefan Schmidt <s.schmidt@samsung.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2014-12-19 00:19:25 +01:00
Alexander Aring
5f5c5c23e3 at86rf230: remove if branch
This patch removes an unnecessary if branch inside the tx complete
handler.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Reviewed-by: Stefan Schmidt <s.schmidt@samsung.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2014-12-19 00:19:25 +01:00
Stefan Schmidt
ce261bc3ff ieee802154/mrf24j40: Fix alignment of parenthesis
CC: Alan Ott <alan@signal11.us>
Signed-off-by: Stefan Schmidt <s.schmidt@samsung.com>
Acked-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2014-12-19 00:19:25 +01:00
Stefan Schmidt
5c1be06a3d ieee802154/mrf24j40: Fix typo begining -> beginning
CC: Alan Ott <alan@signal11.us>
Signed-off-by: Stefan Schmidt <s.schmidt@samsung.com>
Acked-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2014-12-19 00:19:24 +01:00
Stefan Schmidt
cda8c203b3 ieee802154/cc2520: Remove extra blank lines
CC: Varka Bhadram <varkabhadram@gmail.com>
Signed-off-by: Stefan Schmidt <s.schmidt@samsung.com>
Acked-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2014-12-19 00:19:24 +01:00
Stefan Schmidt
2b8b7e29c4 ieee802154/at86rf230: Fix typo unkown -> unknown
Signed-off-by: Stefan Schmidt <s.schmidt@samsung.com>
Acked-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2014-12-19 00:19:24 +01:00
Stefan Schmidt
e80fb5eea3 ieee802154/at86rf230: Align to opening parenthesis
Signed-off-by: Stefan Schmidt <s.schmidt@samsung.com>
Acked-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2014-12-19 00:19:24 +01:00
Stefan Schmidt
ca28849d01 ieee802154/at86rf230: Remove unneeded blank lines
Signed-off-by: Stefan Schmidt <s.schmidt@samsung.com>
Acked-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2014-12-19 00:19:24 +01:00
Alexander Aring
b48a7c1880 at86rf230: add reset state cca handling
This patch adds the default cca setting after device reset for at86rf230
driver.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2014-12-19 00:19:24 +01:00