Commit Graph

236 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