ieee802154: mrf24j40: Add support for MRF24J40MC

The MRF24J40MC module has an external amplifier which should be
enabled. The TX power has to be lowered to meet FCC regs.

Signed-off-by: Simon Vincent <simon.vincent@xsilon.com>
Acked-by: Alan Ott <alan@signal11.us>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
at86rf230: fix errno on tx timeout handling

The rc variable is zero if we get a timeout. Instead of pass the rc
variable to the async error handling function which try to recover the
phy, we use a static -ETIMEDOUT errno.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
at86rf230: add missing error handling

This patch adds an async error handling function if sync state change
runs into a timeout. The async error handling function tries to recover
the phy state machine into a valid state.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
at86rf230: correct aret lifs and sifs handling

This patch adds lifs/sifs handling only if max_frame_retries is above
zero. The at86rf2xx datasheets says nothing about phy lifs/sifs
handling. I asked the atmel support and they said lifs/sifs is done
by phy when max_frame_retries is above zero.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
at86rf230: correct at86rf2xx lifs timings

Symbol rate is 16 us. Lifs is 40 symbols. 16 * 40 = 640 us.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
at86rf230: squash unnecessary dereferencing

This patch removes dereferencing irq number over spi struct. Instead we
doing it directly over isr paramater.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
at86rf230: add missing enable_irq

This patch adds a missing enable_irq when spi_async in isr failed.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
at86rf230: fix race condition

When the driver waits for a tx completion currently the driver direct
enables the irq. When we switching to RX_AACK_ON some steps afterwards
the driver could receive a new frame and request resources which are
already in use, for example irq state change resource.

To be sure there are no new interrupts when we switching to RX_AACK_ON,
we enable the irq when state change to RX_AACK_ON was completed.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
at86rf230: fix enable_irq handling on async spi

Sometimes the async state function is call in an context where the spi
irq is diabled. This patch fix the handling to enable the irq when
spi_async failed in the async state change calling chain. We do this by
a context parameter irq_enable and evaluate this parameter when
spi_async failed instead of returning spi_async errno.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
at86rf230: remove unnecessary print of async error

The async error function will already printout the errno over dev_err.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Bluetooth: Refactor arguments of mgmt_device_connected

The values of a lot of the mgmt_device_connected() parameters come
straight from a hci_conn object. We can simplify the function by passing
the full hci_conn pointer to it.

Signed-off-by: Alfonso Acosta <fons@spotify.com>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Bluetooth: Include ADV_IND report in Device Connected event

There are scenarios when autoconnecting to a device after the
reception of an ADV_IND report (action 0x02), in which userland
might want to examine the report's contents.

For instance, the Service Data might have changed and it would be
useful to know ahead of time before starting any GATT procedures.
Also, the ADV_IND may contain Manufacturer Specific data which would
be lost if not propagated to userland. In fact, this patch results
from the need to rebond with a device lacking persistent storage which
notifies about losing its LTK in ADV_IND reports.

This patch appends the ADV_IND report which triggered the
autoconnection to the EIR Data in the Device Connected event.

Signed-off-by: Alfonso Acosta <fons@spotify.com>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Bluetooth: Remove redundant check on hci_conn's device class

NULL-checking conn->dev_class is pointless since the variable is
defined as an array, i.e. it will always be non-NULL.

Signed-off-by: Alfonso Acosta <fons@spotify.com>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>