summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAlexander Aring <alex.aring@gmail.com>2015-09-21 11:24:41 +0200
committerMarcel Holtmann <marcel@holtmann.org>2015-09-22 11:51:23 +0200
commit8ba40417401ce771769d847900f08c978bb61632 (patch)
tree6d6b70e15e9e713192cb3e7453aada62508c2e18 /drivers
parent00250f78896bc52fd4606c4de7e3fb174e702123 (diff)
downloadlinux-8ba40417401ce771769d847900f08c978bb61632.tar.bz2
mrf24j40: add promiscuous mode support
This patch adds support for promiscuous mode by setting promiscuous (no frame filtering), disable automatic ack handling and not filtering frames where the crc is invalid. Reviewed-by: Stefan Schmidt <stefan@osg.samsung.com> Signed-off-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ieee802154/mrf24j40.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/drivers/net/ieee802154/mrf24j40.c b/drivers/net/ieee802154/mrf24j40.c
index 91687c1a56ce..146ad57165ea 100644
--- a/drivers/net/ieee802154/mrf24j40.c
+++ b/drivers/net/ieee802154/mrf24j40.c
@@ -923,6 +923,24 @@ static int mrf24j40_set_txpower(struct ieee802154_hw *hw, s32 mbm)
return regmap_update_bits(devrec->regmap_long, REG_RFCON3, 0xf8, val);
}
+static int mrf24j40_set_promiscuous_mode(struct ieee802154_hw *hw, bool on)
+{
+ struct mrf24j40 *devrec = hw->priv;
+ int ret;
+
+ if (on) {
+ /* set PROMI, ERRPKT and NOACKRSP */
+ ret = regmap_update_bits(devrec->regmap_short, REG_RXMCR, 0x23,
+ 0x23);
+ } else {
+ /* clear PROMI, ERRPKT and NOACKRSP */
+ ret = regmap_update_bits(devrec->regmap_short, REG_RXMCR, 0x23,
+ 0x00);
+ }
+
+ return ret;
+}
+
static const struct ieee802154_ops mrf24j40_ops = {
.owner = THIS_MODULE,
.xmit_async = mrf24j40_tx,
@@ -935,6 +953,7 @@ static const struct ieee802154_ops mrf24j40_ops = {
.set_cca_mode = mrf24j40_set_cca_mode,
.set_cca_ed_level = mrf24j40_set_cca_ed_level,
.set_txpower = mrf24j40_set_txpower,
+ .set_promiscuous_mode = mrf24j40_set_promiscuous_mode,
};
static void mrf24j40_intstat_complete(void *context)
@@ -1182,7 +1201,8 @@ static int mrf24j40_probe(struct spi_device *spi)
devrec->hw->parent = &spi->dev;
devrec->hw->phy->supported.channels[0] = CHANNEL_MASK;
devrec->hw->flags = IEEE802154_HW_TX_OMIT_CKSUM | IEEE802154_HW_AFILT |
- IEEE802154_HW_CSMA_PARAMS;
+ IEEE802154_HW_CSMA_PARAMS |
+ IEEE802154_HW_PROMISCUOUS;
devrec->hw->phy->flags = WPAN_PHY_FLAG_CCA_MODE |
WPAN_PHY_FLAG_CCA_ED_LEVEL;