提交 7cb9e6bf 编写于 作者: D David S. Miller

Merge branch 'at86rf230-next'

Alexander Aring says:

====================
at86rf230: rework driver implementation

this patch series includes a rework of the at86rf230 driver.

There are several changes:

 - Add regmap support.
 - Merge at86rf212 operations with generic at86rf2xx operations, all chips
   supports these operations.
 - Drop of irqworker. This is a workqueue which will scheduled by an irq to
   handle synchronous spi handling. Instead using asynchronous spi handling,
   then no scheduler is involved at irq handling.
 - Also detected some bugs by receiving frame like CRC can be correct and a
   802.15.4 frame length could be above 127 bytes. This would crash the whole
   kernel (but should be handled by the mac layer). Another bug is the handling
   with RX_SAFE_MODE which protect the frame buffer after a readout. This is
   currently not working because we read out the buffer twice and the first one
   to get the frame size. Solution is to readout always the whole frame buffer.
 - Added some timing relevants things from the datasheet for state changes And
   IEEE 802.15.4 standard like interframe spacing. Interframe spacing is needed
   to insert some receiving space time between frame transmitting. This should be
   also handled by MAC layer, but it's currently a workaround to add this inside
   the driver layer.
 - Add some callback setting for chip specific handling, instead of runtime decisions
   if (is_chip_type()). Callbacks are set only once at probe time.
 - We don't using a force state change anymore. A force state change will do a
   abort of receiving frames while we want to transmit a new frame. This should
   decrease the drop rate of packets.
 - And many others changes and bug fixes...

changes since v3:
 - fix irq polarity in patch ("at86rf230: rework irq_pol setting").

changes since v2:
 - add check if necessary functions are implemented when hw flags are set in patch
   ("mac802154: at86rf230: add hw flags and merge ops"). I choosed the second variant.
 - remove unnecessary includes for workqueue and mutex in patch
   ("at86rf230: rework transmit and receive").
 - remove unnecessary cast in patch ("at86rf230: rework transmit and receive").
 - acivate regmap cache with REGCACHE_RBTREE in patch
   ("at86rf230: add regmap support").
====================
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
......@@ -34,6 +34,7 @@ config IEEE802154_AT86RF230
depends on IEEE802154_DRIVERS && MAC802154
tristate "AT86RF230/231/233/212 transceiver driver"
depends on SPI
select REGMAP_SPI
---help---
Say Y here to enable the at86rf230/231/233/212 SPI 802.15.4 wireless
controller.
......
此差异已折叠。
......@@ -80,6 +80,25 @@ struct ieee802154_dev {
#define IEEE802154_HW_OMIT_CKSUM 0x00000001
/* Indicates that receiver will autorespond with ACK frames. */
#define IEEE802154_HW_AACK 0x00000002
/* Indicates that transceiver will support transmit power setting. */
#define IEEE802154_HW_TXPOWER 0x00000004
/* Indicates that transceiver will support listen before transmit. */
#define IEEE802154_HW_LBT 0x00000008
/* Indicates that transceiver will support cca mode setting. */
#define IEEE802154_HW_CCA_MODE 0x00000010
/* Indicates that transceiver will support cca ed level setting. */
#define IEEE802154_HW_CCA_ED_LEVEL 0x00000020
/* Indicates that transceiver will support csma (max_be, min_be, csma retries)
* settings. */
#define IEEE802154_HW_CSMA_PARAMS 0x00000040
/* Indicates that transceiver will support ARET frame retries setting. */
#define IEEE802154_HW_FRAME_RETRIES 0x00000080
/* This groups the most common CSMA support fields into one. */
#define IEEE802154_HW_CSMA (IEEE802154_HW_CCA_MODE | \
IEEE802154_HW_CCA_ED_LEVEL | \
IEEE802154_HW_CSMA_PARAMS | \
IEEE802154_HW_FRAME_RETRIES)
/* struct ieee802154_ops - callbacks from mac802154 to the driver
*
......
......@@ -304,29 +304,61 @@ EXPORT_SYMBOL(ieee802154_free_device);
int ieee802154_register_device(struct ieee802154_dev *dev)
{
struct mac802154_priv *priv = mac802154_to_priv(dev);
int rc = -ENOMEM;
int rc = -ENOSYS;
if (dev->flags & IEEE802154_HW_TXPOWER) {
if (!priv->ops->set_txpower)
goto out;
priv->phy->set_txpower = mac802154_set_txpower;
}
if (dev->flags & IEEE802154_HW_LBT) {
if (!priv->ops->set_lbt)
goto out;
priv->phy->set_lbt = mac802154_set_lbt;
}
if (dev->flags & IEEE802154_HW_CCA_MODE) {
if (!priv->ops->set_cca_mode)
goto out;
priv->phy->set_cca_mode = mac802154_set_cca_mode;
}
if (dev->flags & IEEE802154_HW_CCA_ED_LEVEL) {
if (!priv->ops->set_cca_ed_level)
goto out;
priv->phy->set_cca_ed_level = mac802154_set_cca_ed_level;
}
if (dev->flags & IEEE802154_HW_CSMA_PARAMS) {
if (!priv->ops->set_csma_params)
goto out;
priv->phy->set_csma_params = mac802154_set_csma_params;
}
if (dev->flags & IEEE802154_HW_FRAME_RETRIES) {
if (!priv->ops->set_frame_retries)
goto out;
priv->phy->set_frame_retries = mac802154_set_frame_retries;
}
priv->dev_workqueue =
create_singlethread_workqueue(wpan_phy_name(priv->phy));
if (!priv->dev_workqueue)
if (!priv->dev_workqueue) {
rc = -ENOMEM;
goto out;
}
wpan_phy_set_dev(priv->phy, priv->hw.parent);
priv->phy->add_iface = mac802154_add_iface;
priv->phy->del_iface = mac802154_del_iface;
if (priv->ops->set_txpower)
priv->phy->set_txpower = mac802154_set_txpower;
if (priv->ops->set_lbt)
priv->phy->set_lbt = mac802154_set_lbt;
if (priv->ops->set_cca_mode)
priv->phy->set_cca_mode = mac802154_set_cca_mode;
if (priv->ops->set_cca_ed_level)
priv->phy->set_cca_ed_level = mac802154_set_cca_ed_level;
if (priv->ops->set_csma_params)
priv->phy->set_csma_params = mac802154_set_csma_params;
if (priv->ops->set_frame_retries)
priv->phy->set_frame_retries = mac802154_set_frame_retries;
rc = wpan_phy_register(priv->phy);
if (rc < 0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册