diff options
author | Alexander Aring <alex.aring@gmail.com> | 2014-10-29 16:34:33 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2014-10-29 18:07:45 -0400 |
commit | 92f45f5466ce75944071ae5d23732648048fa12a (patch) | |
tree | c41e560e626a0cb1919e221376654773c6e28709 /drivers | |
parent | 94b792220ca9c080f4d1da8060f4c892c1b3b025 (diff) |
at86rf230: add support for promiscuous mode
This patch adds support for promiscuous mode setting for the at86rf230
driver.
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/at86rf230.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/drivers/net/ieee802154/at86rf230.c b/drivers/net/ieee802154/at86rf230.c index 622c1b6f7fec..98c94374aa35 100644 --- a/drivers/net/ieee802154/at86rf230.c +++ b/drivers/net/ieee802154/at86rf230.c | |||
@@ -1211,6 +1211,33 @@ at86rf230_set_frame_retries(struct ieee802154_hw *hw, s8 retries) | |||
1211 | return rc; | 1211 | return rc; |
1212 | } | 1212 | } |
1213 | 1213 | ||
1214 | static int | ||
1215 | at86rf230_set_promiscuous_mode(struct ieee802154_hw *hw, const bool on) | ||
1216 | { | ||
1217 | struct at86rf230_local *lp = hw->priv; | ||
1218 | int rc; | ||
1219 | |||
1220 | if (on) { | ||
1221 | rc = at86rf230_write_subreg(lp, SR_AACK_DIS_ACK, 1); | ||
1222 | if (rc < 0) | ||
1223 | return rc; | ||
1224 | |||
1225 | rc = at86rf230_write_subreg(lp, SR_AACK_PROM_MODE, 1); | ||
1226 | if (rc < 0) | ||
1227 | return rc; | ||
1228 | } else { | ||
1229 | rc = at86rf230_write_subreg(lp, SR_AACK_PROM_MODE, 0); | ||
1230 | if (rc < 0) | ||
1231 | return rc; | ||
1232 | |||
1233 | rc = at86rf230_write_subreg(lp, SR_AACK_DIS_ACK, 0); | ||
1234 | if (rc < 0) | ||
1235 | return rc; | ||
1236 | } | ||
1237 | |||
1238 | return 0; | ||
1239 | } | ||
1240 | |||
1214 | static const struct ieee802154_ops at86rf230_ops = { | 1241 | static const struct ieee802154_ops at86rf230_ops = { |
1215 | .owner = THIS_MODULE, | 1242 | .owner = THIS_MODULE, |
1216 | .xmit_async = at86rf230_xmit, | 1243 | .xmit_async = at86rf230_xmit, |
@@ -1225,6 +1252,7 @@ static const struct ieee802154_ops at86rf230_ops = { | |||
1225 | .set_cca_ed_level = at86rf230_set_cca_ed_level, | 1252 | .set_cca_ed_level = at86rf230_set_cca_ed_level, |
1226 | .set_csma_params = at86rf230_set_csma_params, | 1253 | .set_csma_params = at86rf230_set_csma_params, |
1227 | .set_frame_retries = at86rf230_set_frame_retries, | 1254 | .set_frame_retries = at86rf230_set_frame_retries, |
1255 | .set_promiscuous_mode = at86rf230_set_promiscuous_mode, | ||
1228 | }; | 1256 | }; |
1229 | 1257 | ||
1230 | static struct at86rf2xx_chip_data at86rf233_data = { | 1258 | static struct at86rf2xx_chip_data at86rf233_data = { |
@@ -1388,7 +1416,7 @@ at86rf230_detect_device(struct at86rf230_local *lp) | |||
1388 | lp->hw->extra_tx_headroom = 0; | 1416 | lp->hw->extra_tx_headroom = 0; |
1389 | lp->hw->flags = IEEE802154_HW_OMIT_CKSUM | IEEE802154_HW_AACK | | 1417 | lp->hw->flags = IEEE802154_HW_OMIT_CKSUM | IEEE802154_HW_AACK | |
1390 | IEEE802154_HW_TXPOWER | IEEE802154_HW_ARET | | 1418 | IEEE802154_HW_TXPOWER | IEEE802154_HW_ARET | |
1391 | IEEE802154_HW_AFILT; | 1419 | IEEE802154_HW_AFILT | IEEE802154_HW_PROMISCUOUS; |
1392 | 1420 | ||
1393 | switch (part) { | 1421 | switch (part) { |
1394 | case 2: | 1422 | case 2: |