1 // SPDX-License-Identifier: GPL-2.0-only
3 * AT86RF230/RF231 driver
5 * Copyright (C) 2009-2012 Siemens AG
12 #include <linux/kernel.h>
13 #include <linux/module.h>
14 #include <linux/hrtimer.h>
15 #include <linux/jiffies.h>
16 #include <linux/interrupt.h>
17 #include <linux/irq.h>
18 #include <linux/gpio.h>
19 #include <linux/delay.h>
20 #include <linux/spi/spi.h>
21 #include <linux/spi/at86rf230.h>
22 #include <linux/regmap.h>
23 #include <linux/skbuff.h>
24 #include <linux/of_gpio.h>
25 #include <linux/ieee802154.h>
26 #include <linux/debugfs.h>
28 #include <net/mac802154.h>
29 #include <net/cfg802154.h>
31 #include "at86rf230.h"
33 struct at86rf230_local;
34 /* at86rf2xx chip depend data.
35 * All timings are in us.
37 struct at86rf2xx_chip_data {
49 int (*set_channel)(struct at86rf230_local *, u8, u8);
50 int (*set_txpower)(struct at86rf230_local *, s32);
53 #define AT86RF2XX_MAX_BUF (127 + 3)
54 /* tx retries to access the TX_ON state
55 * if it's above then force change will be started.
57 * We assume the max_frame_retries (7) value of 802.15.4 here.
59 #define AT86RF2XX_MAX_TX_RETRIES 7
60 /* We use the recommended 5 minutes timeout to recalibrate */
61 #define AT86RF2XX_CAL_LOOP_TIMEOUT (5 * 60 * HZ)
63 struct at86rf230_state_change {
64 struct at86rf230_local *lp;
68 struct spi_message msg;
69 struct spi_transfer trx;
70 u8 buf[AT86RF2XX_MAX_BUF];
72 void (*complete)(void *context);
79 struct at86rf230_trac {
81 u64 success_data_pending;
82 u64 success_wait_for_ack;
83 u64 channel_access_failure;
88 struct at86rf230_local {
89 struct spi_device *spi;
91 struct ieee802154_hw *hw;
92 struct at86rf2xx_chip_data *data;
93 struct regmap *regmap;
97 struct completion state_complete;
98 struct at86rf230_state_change state;
100 unsigned long cal_timeout;
104 struct sk_buff *tx_skb;
105 struct at86rf230_state_change tx;
107 struct at86rf230_trac trac;
110 #define AT86RF2XX_NUMREGS 0x3F
113 at86rf230_async_state_change(struct at86rf230_local *lp,
114 struct at86rf230_state_change *ctx,
115 const u8 state, void (*complete)(void *context));
118 at86rf230_sleep(struct at86rf230_local *lp)
120 if (gpio_is_valid(lp->slp_tr)) {
121 gpio_set_value(lp->slp_tr, 1);
122 usleep_range(lp->data->t_off_to_sleep,
123 lp->data->t_off_to_sleep + 10);
129 at86rf230_awake(struct at86rf230_local *lp)
131 if (gpio_is_valid(lp->slp_tr)) {
132 gpio_set_value(lp->slp_tr, 0);
133 usleep_range(lp->data->t_sleep_to_off,
134 lp->data->t_sleep_to_off + 100);
140 __at86rf230_write(struct at86rf230_local *lp,
141 unsigned int addr, unsigned int data)
143 bool sleep = lp->sleep;
146 /* awake for register setting if sleep */
150 ret = regmap_write(lp->regmap, addr, data);
152 /* sleep again if was sleeping */
160 __at86rf230_read(struct at86rf230_local *lp,
161 unsigned int addr, unsigned int *data)
163 bool sleep = lp->sleep;
166 /* awake for register setting if sleep */
170 ret = regmap_read(lp->regmap, addr, data);
172 /* sleep again if was sleeping */
180 at86rf230_read_subreg(struct at86rf230_local *lp,
181 unsigned int addr, unsigned int mask,
182 unsigned int shift, unsigned int *data)
186 rc = __at86rf230_read(lp, addr, data);
188 *data = (*data & mask) >> shift;
194 at86rf230_write_subreg(struct at86rf230_local *lp,
195 unsigned int addr, unsigned int mask,
196 unsigned int shift, unsigned int data)
198 bool sleep = lp->sleep;
201 /* awake for register setting if sleep */
205 ret = regmap_update_bits(lp->regmap, addr, mask, data << shift);
207 /* sleep again if was sleeping */
215 at86rf230_slp_tr_rising_edge(struct at86rf230_local *lp)
217 gpio_set_value(lp->slp_tr, 1);
219 gpio_set_value(lp->slp_tr, 0);
223 at86rf230_reg_writeable(struct device *dev, unsigned int reg)
230 case RG_PHY_ED_LEVEL:
246 case RG_SHORT_ADDR_0:
247 case RG_SHORT_ADDR_1:
269 at86rf230_reg_readable(struct device *dev, unsigned int reg)
273 /* all writeable are also readable */
274 rc = at86rf230_reg_writeable(dev, reg);
294 at86rf230_reg_volatile(struct device *dev, unsigned int reg)
296 /* can be changed during runtime */
301 case RG_PHY_ED_LEVEL:
313 at86rf230_reg_precious(struct device *dev, unsigned int reg)
315 /* don't clear irq line on read */
324 static const struct regmap_config at86rf230_regmap_spi_config = {
327 .write_flag_mask = CMD_REG | CMD_WRITE,
328 .read_flag_mask = CMD_REG,
329 .cache_type = REGCACHE_RBTREE,
330 .max_register = AT86RF2XX_NUMREGS,
331 .writeable_reg = at86rf230_reg_writeable,
332 .readable_reg = at86rf230_reg_readable,
333 .volatile_reg = at86rf230_reg_volatile,
334 .precious_reg = at86rf230_reg_precious,
338 at86rf230_async_error_recover_complete(void *context)
340 struct at86rf230_state_change *ctx = context;
341 struct at86rf230_local *lp = ctx->lp;
346 ieee802154_wake_queue(lp->hw);
350 at86rf230_async_error_recover(void *context)
352 struct at86rf230_state_change *ctx = context;
353 struct at86rf230_local *lp = ctx->lp;
356 at86rf230_async_state_change(lp, ctx, STATE_RX_AACK_ON,
357 at86rf230_async_error_recover_complete);
361 at86rf230_async_error(struct at86rf230_local *lp,
362 struct at86rf230_state_change *ctx, int rc)
364 dev_err(&lp->spi->dev, "spi_async error %d\n", rc);
366 at86rf230_async_state_change(lp, ctx, STATE_FORCE_TRX_OFF,
367 at86rf230_async_error_recover);
370 /* Generic function to get some register value in async mode */
372 at86rf230_async_read_reg(struct at86rf230_local *lp, u8 reg,
373 struct at86rf230_state_change *ctx,
374 void (*complete)(void *context))
378 u8 *tx_buf = ctx->buf;
380 tx_buf[0] = (reg & CMD_REG_MASK) | CMD_REG;
381 ctx->msg.complete = complete;
382 rc = spi_async(lp->spi, &ctx->msg);
384 at86rf230_async_error(lp, ctx, rc);
388 at86rf230_async_write_reg(struct at86rf230_local *lp, u8 reg, u8 val,
389 struct at86rf230_state_change *ctx,
390 void (*complete)(void *context))
394 ctx->buf[0] = (reg & CMD_REG_MASK) | CMD_REG | CMD_WRITE;
396 ctx->msg.complete = complete;
397 rc = spi_async(lp->spi, &ctx->msg);
399 at86rf230_async_error(lp, ctx, rc);
403 at86rf230_async_state_assert(void *context)
405 struct at86rf230_state_change *ctx = context;
406 struct at86rf230_local *lp = ctx->lp;
407 const u8 *buf = ctx->buf;
408 const u8 trx_state = buf[1] & TRX_STATE_MASK;
410 /* Assert state change */
411 if (trx_state != ctx->to_state) {
412 /* Special handling if transceiver state is in
413 * STATE_BUSY_RX_AACK and a SHR was detected.
415 if (trx_state == STATE_BUSY_RX_AACK) {
416 /* Undocumented race condition. If we send a state
417 * change to STATE_RX_AACK_ON the transceiver could
418 * change his state automatically to STATE_BUSY_RX_AACK
419 * if a SHR was detected. This is not an error, but we
422 if (ctx->to_state == STATE_RX_AACK_ON)
425 /* If we change to STATE_TX_ON without forcing and
426 * transceiver state is STATE_BUSY_RX_AACK, we wait
427 * 'tFrame + tPAck' receiving time. In this time the
428 * PDU should be received. If the transceiver is still
429 * in STATE_BUSY_RX_AACK, we run a force state change
430 * to STATE_TX_ON. This is a timeout handling, if the
431 * transceiver stucks in STATE_BUSY_RX_AACK.
433 * Additional we do several retries to try to get into
434 * TX_ON state without forcing. If the retries are
435 * higher or equal than AT86RF2XX_MAX_TX_RETRIES we
436 * will do a force change.
438 if (ctx->to_state == STATE_TX_ON ||
439 ctx->to_state == STATE_TRX_OFF) {
440 u8 state = ctx->to_state;
442 if (lp->tx_retry >= AT86RF2XX_MAX_TX_RETRIES)
443 state = STATE_FORCE_TRX_OFF;
446 at86rf230_async_state_change(lp, ctx, state,
452 dev_warn(&lp->spi->dev, "unexcept state change from 0x%02x to 0x%02x. Actual state: 0x%02x\n",
453 ctx->from_state, ctx->to_state, trx_state);
458 ctx->complete(context);
461 static enum hrtimer_restart at86rf230_async_state_timer(struct hrtimer *timer)
463 struct at86rf230_state_change *ctx =
464 container_of(timer, struct at86rf230_state_change, timer);
465 struct at86rf230_local *lp = ctx->lp;
467 at86rf230_async_read_reg(lp, RG_TRX_STATUS, ctx,
468 at86rf230_async_state_assert);
470 return HRTIMER_NORESTART;
473 /* Do state change timing delay. */
475 at86rf230_async_state_delay(void *context)
477 struct at86rf230_state_change *ctx = context;
478 struct at86rf230_local *lp = ctx->lp;
479 struct at86rf2xx_chip_data *c = lp->data;
483 /* The force state changes are will show as normal states in the
484 * state status subregister. We change the to_state to the
485 * corresponding one and remember if it was a force change, this
486 * differs if we do a state change from STATE_BUSY_RX_AACK.
488 switch (ctx->to_state) {
489 case STATE_FORCE_TX_ON:
490 ctx->to_state = STATE_TX_ON;
493 case STATE_FORCE_TRX_OFF:
494 ctx->to_state = STATE_TRX_OFF;
501 switch (ctx->from_state) {
503 switch (ctx->to_state) {
504 case STATE_RX_AACK_ON:
505 tim = c->t_off_to_aack * NSEC_PER_USEC;
506 /* state change from TRX_OFF to RX_AACK_ON to do a
507 * calibration, we need to reset the timeout for the
510 lp->cal_timeout = jiffies + AT86RF2XX_CAL_LOOP_TIMEOUT;
512 case STATE_TX_ARET_ON:
514 tim = c->t_off_to_tx_on * NSEC_PER_USEC;
515 /* state change from TRX_OFF to TX_ON or ARET_ON to do
516 * a calibration, we need to reset the timeout for the
519 lp->cal_timeout = jiffies + AT86RF2XX_CAL_LOOP_TIMEOUT;
525 case STATE_BUSY_RX_AACK:
526 switch (ctx->to_state) {
529 /* Wait for worst case receiving time if we
530 * didn't make a force change from BUSY_RX_AACK
531 * to TX_ON or TRX_OFF.
534 tim = (c->t_frame + c->t_p_ack) * NSEC_PER_USEC;
542 /* Default value, means RESET state */
544 switch (ctx->to_state) {
546 tim = c->t_reset_to_off * NSEC_PER_USEC;
556 /* Default delay is 1us in the most cases */
558 at86rf230_async_state_timer(&ctx->timer);
562 hrtimer_start(&ctx->timer, tim, HRTIMER_MODE_REL);
566 at86rf230_async_state_change_start(void *context)
568 struct at86rf230_state_change *ctx = context;
569 struct at86rf230_local *lp = ctx->lp;
571 const u8 trx_state = buf[1] & TRX_STATE_MASK;
573 /* Check for "possible" STATE_TRANSITION_IN_PROGRESS */
574 if (trx_state == STATE_TRANSITION_IN_PROGRESS) {
576 at86rf230_async_read_reg(lp, RG_TRX_STATUS, ctx,
577 at86rf230_async_state_change_start);
581 /* Check if we already are in the state which we change in */
582 if (trx_state == ctx->to_state) {
584 ctx->complete(context);
588 /* Set current state to the context of state change */
589 ctx->from_state = trx_state;
591 /* Going into the next step for a state change which do a timing
594 at86rf230_async_write_reg(lp, RG_TRX_STATE, ctx->to_state, ctx,
595 at86rf230_async_state_delay);
599 at86rf230_async_state_change(struct at86rf230_local *lp,
600 struct at86rf230_state_change *ctx,
601 const u8 state, void (*complete)(void *context))
603 /* Initialization for the state change context */
604 ctx->to_state = state;
605 ctx->complete = complete;
606 at86rf230_async_read_reg(lp, RG_TRX_STATUS, ctx,
607 at86rf230_async_state_change_start);
611 at86rf230_sync_state_change_complete(void *context)
613 struct at86rf230_state_change *ctx = context;
614 struct at86rf230_local *lp = ctx->lp;
616 complete(&lp->state_complete);
619 /* This function do a sync framework above the async state change.
620 * Some callbacks of the IEEE 802.15.4 driver interface need to be
621 * handled synchronously.
624 at86rf230_sync_state_change(struct at86rf230_local *lp, unsigned int state)
628 at86rf230_async_state_change(lp, &lp->state, state,
629 at86rf230_sync_state_change_complete);
631 rc = wait_for_completion_timeout(&lp->state_complete,
632 msecs_to_jiffies(100));
634 at86rf230_async_error(lp, &lp->state, -ETIMEDOUT);
642 at86rf230_tx_complete(void *context)
644 struct at86rf230_state_change *ctx = context;
645 struct at86rf230_local *lp = ctx->lp;
647 ieee802154_xmit_complete(lp->hw, lp->tx_skb, false);
652 at86rf230_tx_on(void *context)
654 struct at86rf230_state_change *ctx = context;
655 struct at86rf230_local *lp = ctx->lp;
657 at86rf230_async_state_change(lp, ctx, STATE_RX_AACK_ON,
658 at86rf230_tx_complete);
662 at86rf230_tx_trac_check(void *context)
664 struct at86rf230_state_change *ctx = context;
665 struct at86rf230_local *lp = ctx->lp;
667 if (IS_ENABLED(CONFIG_IEEE802154_AT86RF230_DEBUGFS)) {
668 u8 trac = TRAC_MASK(ctx->buf[1]);
674 case TRAC_SUCCESS_DATA_PENDING:
675 lp->trac.success_data_pending++;
677 case TRAC_CHANNEL_ACCESS_FAILURE:
678 lp->trac.channel_access_failure++;
687 WARN_ONCE(1, "received tx trac status %d\n", trac);
692 at86rf230_async_state_change(lp, ctx, STATE_TX_ON, at86rf230_tx_on);
696 at86rf230_rx_read_frame_complete(void *context)
698 struct at86rf230_state_change *ctx = context;
699 struct at86rf230_local *lp = ctx->lp;
700 const u8 *buf = ctx->buf;
705 if (!ieee802154_is_valid_psdu_len(len)) {
706 dev_vdbg(&lp->spi->dev, "corrupted frame received\n");
707 len = IEEE802154_MTU;
711 skb = dev_alloc_skb(IEEE802154_MTU);
713 dev_vdbg(&lp->spi->dev, "failed to allocate sk_buff\n");
718 skb_put_data(skb, buf + 2, len);
719 ieee802154_rx_irqsafe(lp->hw, skb, lqi);
724 at86rf230_rx_trac_check(void *context)
726 struct at86rf230_state_change *ctx = context;
727 struct at86rf230_local *lp = ctx->lp;
731 if (IS_ENABLED(CONFIG_IEEE802154_AT86RF230_DEBUGFS)) {
732 u8 trac = TRAC_MASK(buf[1]);
738 case TRAC_SUCCESS_WAIT_FOR_ACK:
739 lp->trac.success_wait_for_ack++;
745 WARN_ONCE(1, "received rx trac status %d\n", trac);
751 ctx->trx.len = AT86RF2XX_MAX_BUF;
752 ctx->msg.complete = at86rf230_rx_read_frame_complete;
753 rc = spi_async(lp->spi, &ctx->msg);
756 at86rf230_async_error(lp, ctx, rc);
761 at86rf230_irq_trx_end(void *context)
763 struct at86rf230_state_change *ctx = context;
764 struct at86rf230_local *lp = ctx->lp;
768 at86rf230_async_read_reg(lp, RG_TRX_STATE, ctx,
769 at86rf230_tx_trac_check);
771 at86rf230_async_read_reg(lp, RG_TRX_STATE, ctx,
772 at86rf230_rx_trac_check);
777 at86rf230_irq_status(void *context)
779 struct at86rf230_state_change *ctx = context;
780 struct at86rf230_local *lp = ctx->lp;
781 const u8 *buf = ctx->buf;
784 enable_irq(lp->spi->irq);
786 if (irq & IRQ_TRX_END) {
787 at86rf230_irq_trx_end(ctx);
789 dev_err(&lp->spi->dev, "not supported irq %02x received\n",
796 at86rf230_setup_spi_messages(struct at86rf230_local *lp,
797 struct at86rf230_state_change *state)
800 state->irq = lp->spi->irq;
801 spi_message_init(&state->msg);
802 state->msg.context = state;
804 state->trx.tx_buf = state->buf;
805 state->trx.rx_buf = state->buf;
806 spi_message_add_tail(&state->trx, &state->msg);
807 hrtimer_init(&state->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
808 state->timer.function = at86rf230_async_state_timer;
811 static irqreturn_t at86rf230_isr(int irq, void *data)
813 struct at86rf230_local *lp = data;
814 struct at86rf230_state_change *ctx;
817 disable_irq_nosync(irq);
819 ctx = kzalloc(sizeof(*ctx), GFP_ATOMIC);
825 at86rf230_setup_spi_messages(lp, ctx);
826 /* tell on error handling to free ctx */
829 ctx->buf[0] = (RG_IRQ_STATUS & CMD_REG_MASK) | CMD_REG;
830 ctx->msg.complete = at86rf230_irq_status;
831 rc = spi_async(lp->spi, &ctx->msg);
833 at86rf230_async_error(lp, ctx, rc);
842 at86rf230_write_frame_complete(void *context)
844 struct at86rf230_state_change *ctx = context;
845 struct at86rf230_local *lp = ctx->lp;
849 if (gpio_is_valid(lp->slp_tr))
850 at86rf230_slp_tr_rising_edge(lp);
852 at86rf230_async_write_reg(lp, RG_TRX_STATE, STATE_BUSY_TX, ctx,
857 at86rf230_write_frame(void *context)
859 struct at86rf230_state_change *ctx = context;
860 struct at86rf230_local *lp = ctx->lp;
861 struct sk_buff *skb = lp->tx_skb;
867 buf[0] = CMD_FB | CMD_WRITE;
868 buf[1] = skb->len + 2;
869 memcpy(buf + 2, skb->data, skb->len);
870 ctx->trx.len = skb->len + 2;
871 ctx->msg.complete = at86rf230_write_frame_complete;
872 rc = spi_async(lp->spi, &ctx->msg);
875 at86rf230_async_error(lp, ctx, rc);
880 at86rf230_xmit_tx_on(void *context)
882 struct at86rf230_state_change *ctx = context;
883 struct at86rf230_local *lp = ctx->lp;
885 at86rf230_async_state_change(lp, ctx, STATE_TX_ARET_ON,
886 at86rf230_write_frame);
890 at86rf230_xmit_start(void *context)
892 struct at86rf230_state_change *ctx = context;
893 struct at86rf230_local *lp = ctx->lp;
895 /* check if we change from off state */
896 if (lp->is_tx_from_off)
897 at86rf230_async_state_change(lp, ctx, STATE_TX_ARET_ON,
898 at86rf230_write_frame);
900 at86rf230_async_state_change(lp, ctx, STATE_TX_ON,
901 at86rf230_xmit_tx_on);
905 at86rf230_xmit(struct ieee802154_hw *hw, struct sk_buff *skb)
907 struct at86rf230_local *lp = hw->priv;
908 struct at86rf230_state_change *ctx = &lp->tx;
913 /* After 5 minutes in PLL and the same frequency we run again the
914 * calibration loops which is recommended by at86rf2xx datasheets.
916 * The calibration is initiate by a state change from TRX_OFF
917 * to TX_ON, the lp->cal_timeout should be reinit by state_delay
918 * function then to start in the next 5 minutes.
920 if (time_is_before_jiffies(lp->cal_timeout)) {
921 lp->is_tx_from_off = true;
922 at86rf230_async_state_change(lp, ctx, STATE_TRX_OFF,
923 at86rf230_xmit_start);
925 lp->is_tx_from_off = false;
926 at86rf230_xmit_start(ctx);
933 at86rf230_ed(struct ieee802154_hw *hw, u8 *level)
941 at86rf230_start(struct ieee802154_hw *hw)
943 struct at86rf230_local *lp = hw->priv;
945 /* reset trac stats on start */
946 if (IS_ENABLED(CONFIG_IEEE802154_AT86RF230_DEBUGFS))
947 memset(&lp->trac, 0, sizeof(struct at86rf230_trac));
950 enable_irq(lp->spi->irq);
952 return at86rf230_sync_state_change(lp, STATE_RX_AACK_ON);
956 at86rf230_stop(struct ieee802154_hw *hw)
958 struct at86rf230_local *lp = hw->priv;
961 at86rf230_sync_state_change(lp, STATE_FORCE_TRX_OFF);
963 disable_irq(lp->spi->irq);
965 /* It's recommended to set random new csma_seeds before sleep state.
966 * Makes only sense in the stop callback, not doing this inside of
967 * at86rf230_sleep, this is also used when we don't transmit afterwards
968 * when calling start callback again.
970 get_random_bytes(csma_seed, ARRAY_SIZE(csma_seed));
971 at86rf230_write_subreg(lp, SR_CSMA_SEED_0, csma_seed[0]);
972 at86rf230_write_subreg(lp, SR_CSMA_SEED_1, csma_seed[1]);
978 at86rf23x_set_channel(struct at86rf230_local *lp, u8 page, u8 channel)
980 return at86rf230_write_subreg(lp, SR_CHANNEL, channel);
983 #define AT86RF2XX_MAX_ED_LEVELS 0xF
984 static const s32 at86rf233_ed_levels[AT86RF2XX_MAX_ED_LEVELS + 1] = {
985 -9400, -9200, -9000, -8800, -8600, -8400, -8200, -8000, -7800, -7600,
986 -7400, -7200, -7000, -6800, -6600, -6400,
989 static const s32 at86rf231_ed_levels[AT86RF2XX_MAX_ED_LEVELS + 1] = {
990 -9100, -8900, -8700, -8500, -8300, -8100, -7900, -7700, -7500, -7300,
991 -7100, -6900, -6700, -6500, -6300, -6100,
994 static const s32 at86rf212_ed_levels_100[AT86RF2XX_MAX_ED_LEVELS + 1] = {
995 -10000, -9800, -9600, -9400, -9200, -9000, -8800, -8600, -8400, -8200,
996 -8000, -7800, -7600, -7400, -7200, -7000,
999 static const s32 at86rf212_ed_levels_98[AT86RF2XX_MAX_ED_LEVELS + 1] = {
1000 -9800, -9600, -9400, -9200, -9000, -8800, -8600, -8400, -8200, -8000,
1001 -7800, -7600, -7400, -7200, -7000, -6800,
1005 at86rf212_update_cca_ed_level(struct at86rf230_local *lp, int rssi_base_val)
1007 unsigned int cca_ed_thres;
1010 rc = at86rf230_read_subreg(lp, SR_CCA_ED_THRES, &cca_ed_thres);
1014 switch (rssi_base_val) {
1016 lp->hw->phy->supported.cca_ed_levels = at86rf212_ed_levels_98;
1017 lp->hw->phy->supported.cca_ed_levels_size = ARRAY_SIZE(at86rf212_ed_levels_98);
1018 lp->hw->phy->cca_ed_level = at86rf212_ed_levels_98[cca_ed_thres];
1021 lp->hw->phy->supported.cca_ed_levels = at86rf212_ed_levels_100;
1022 lp->hw->phy->supported.cca_ed_levels_size = ARRAY_SIZE(at86rf212_ed_levels_100);
1023 lp->hw->phy->cca_ed_level = at86rf212_ed_levels_100[cca_ed_thres];
1033 at86rf212_set_channel(struct at86rf230_local *lp, u8 page, u8 channel)
1038 rc = at86rf230_write_subreg(lp, SR_SUB_MODE, 0);
1040 rc = at86rf230_write_subreg(lp, SR_SUB_MODE, 1);
1045 rc = at86rf230_write_subreg(lp, SR_BPSK_QPSK, 0);
1046 lp->data->rssi_base_val = -100;
1048 rc = at86rf230_write_subreg(lp, SR_BPSK_QPSK, 1);
1049 lp->data->rssi_base_val = -98;
1054 rc = at86rf212_update_cca_ed_level(lp, lp->data->rssi_base_val);
1058 /* This sets the symbol_duration according frequency on the 212.
1059 * TODO move this handling while set channel and page in cfg802154.
1060 * We can do that, this timings are according 802.15.4 standard.
1061 * If we do that in cfg802154, this is a more generic calculation.
1063 * This should also protected from ifs_timer. Means cancel timer and
1064 * init with a new value. For now, this is okay.
1068 /* SUB:0 and BPSK:0 -> BPSK-20 */
1069 lp->hw->phy->symbol_duration = 50;
1071 /* SUB:1 and BPSK:0 -> BPSK-40 */
1072 lp->hw->phy->symbol_duration = 25;
1076 /* SUB:0 and BPSK:1 -> OQPSK-100/200/400 */
1077 lp->hw->phy->symbol_duration = 40;
1079 /* SUB:1 and BPSK:1 -> OQPSK-250/500/1000 */
1080 lp->hw->phy->symbol_duration = 16;
1083 lp->hw->phy->lifs_period = IEEE802154_LIFS_PERIOD *
1084 lp->hw->phy->symbol_duration;
1085 lp->hw->phy->sifs_period = IEEE802154_SIFS_PERIOD *
1086 lp->hw->phy->symbol_duration;
1088 return at86rf230_write_subreg(lp, SR_CHANNEL, channel);
1092 at86rf230_channel(struct ieee802154_hw *hw, u8 page, u8 channel)
1094 struct at86rf230_local *lp = hw->priv;
1097 rc = lp->data->set_channel(lp, page, channel);
1099 usleep_range(lp->data->t_channel_switch,
1100 lp->data->t_channel_switch + 10);
1102 lp->cal_timeout = jiffies + AT86RF2XX_CAL_LOOP_TIMEOUT;
1107 at86rf230_set_hw_addr_filt(struct ieee802154_hw *hw,
1108 struct ieee802154_hw_addr_filt *filt,
1109 unsigned long changed)
1111 struct at86rf230_local *lp = hw->priv;
1113 if (changed & IEEE802154_AFILT_SADDR_CHANGED) {
1114 u16 addr = le16_to_cpu(filt->short_addr);
1116 dev_vdbg(&lp->spi->dev, "%s called for saddr\n", __func__);
1117 __at86rf230_write(lp, RG_SHORT_ADDR_0, addr);
1118 __at86rf230_write(lp, RG_SHORT_ADDR_1, addr >> 8);
1121 if (changed & IEEE802154_AFILT_PANID_CHANGED) {
1122 u16 pan = le16_to_cpu(filt->pan_id);
1124 dev_vdbg(&lp->spi->dev, "%s called for pan id\n", __func__);
1125 __at86rf230_write(lp, RG_PAN_ID_0, pan);
1126 __at86rf230_write(lp, RG_PAN_ID_1, pan >> 8);
1129 if (changed & IEEE802154_AFILT_IEEEADDR_CHANGED) {
1132 memcpy(addr, &filt->ieee_addr, 8);
1133 dev_vdbg(&lp->spi->dev, "%s called for IEEE addr\n", __func__);
1134 for (i = 0; i < 8; i++)
1135 __at86rf230_write(lp, RG_IEEE_ADDR_0 + i, addr[i]);
1138 if (changed & IEEE802154_AFILT_PANC_CHANGED) {
1139 dev_vdbg(&lp->spi->dev, "%s called for panc change\n", __func__);
1140 if (filt->pan_coord)
1141 at86rf230_write_subreg(lp, SR_AACK_I_AM_COORD, 1);
1143 at86rf230_write_subreg(lp, SR_AACK_I_AM_COORD, 0);
1149 #define AT86RF23X_MAX_TX_POWERS 0xF
1150 static const s32 at86rf233_powers[AT86RF23X_MAX_TX_POWERS + 1] = {
1151 400, 370, 340, 300, 250, 200, 100, 0, -100, -200, -300, -400, -600,
1155 static const s32 at86rf231_powers[AT86RF23X_MAX_TX_POWERS + 1] = {
1156 300, 280, 230, 180, 130, 70, 0, -100, -200, -300, -400, -500, -700,
1160 #define AT86RF212_MAX_TX_POWERS 0x1F
1161 static const s32 at86rf212_powers[AT86RF212_MAX_TX_POWERS + 1] = {
1162 500, 400, 300, 200, 100, 0, -100, -200, -300, -400, -500, -600, -700,
1163 -800, -900, -1000, -1100, -1200, -1300, -1400, -1500, -1600, -1700,
1164 -1800, -1900, -2000, -2100, -2200, -2300, -2400, -2500, -2600,
1168 at86rf23x_set_txpower(struct at86rf230_local *lp, s32 mbm)
1172 for (i = 0; i < lp->hw->phy->supported.tx_powers_size; i++) {
1173 if (lp->hw->phy->supported.tx_powers[i] == mbm)
1174 return at86rf230_write_subreg(lp, SR_TX_PWR_23X, i);
1181 at86rf212_set_txpower(struct at86rf230_local *lp, s32 mbm)
1185 for (i = 0; i < lp->hw->phy->supported.tx_powers_size; i++) {
1186 if (lp->hw->phy->supported.tx_powers[i] == mbm)
1187 return at86rf230_write_subreg(lp, SR_TX_PWR_212, i);
1194 at86rf230_set_txpower(struct ieee802154_hw *hw, s32 mbm)
1196 struct at86rf230_local *lp = hw->priv;
1198 return lp->data->set_txpower(lp, mbm);
1202 at86rf230_set_lbt(struct ieee802154_hw *hw, bool on)
1204 struct at86rf230_local *lp = hw->priv;
1206 return at86rf230_write_subreg(lp, SR_CSMA_LBT_MODE, on);
1210 at86rf230_set_cca_mode(struct ieee802154_hw *hw,
1211 const struct wpan_phy_cca *cca)
1213 struct at86rf230_local *lp = hw->priv;
1216 /* mapping 802.15.4 to driver spec */
1217 switch (cca->mode) {
1218 case NL802154_CCA_ENERGY:
1221 case NL802154_CCA_CARRIER:
1224 case NL802154_CCA_ENERGY_CARRIER:
1226 case NL802154_CCA_OPT_ENERGY_CARRIER_AND:
1229 case NL802154_CCA_OPT_ENERGY_CARRIER_OR:
1240 return at86rf230_write_subreg(lp, SR_CCA_MODE, val);
1244 at86rf230_set_cca_ed_level(struct ieee802154_hw *hw, s32 mbm)
1246 struct at86rf230_local *lp = hw->priv;
1249 for (i = 0; i < hw->phy->supported.cca_ed_levels_size; i++) {
1250 if (hw->phy->supported.cca_ed_levels[i] == mbm)
1251 return at86rf230_write_subreg(lp, SR_CCA_ED_THRES, i);
1258 at86rf230_set_csma_params(struct ieee802154_hw *hw, u8 min_be, u8 max_be,
1261 struct at86rf230_local *lp = hw->priv;
1264 rc = at86rf230_write_subreg(lp, SR_MIN_BE, min_be);
1268 rc = at86rf230_write_subreg(lp, SR_MAX_BE, max_be);
1272 return at86rf230_write_subreg(lp, SR_MAX_CSMA_RETRIES, retries);
1276 at86rf230_set_frame_retries(struct ieee802154_hw *hw, s8 retries)
1278 struct at86rf230_local *lp = hw->priv;
1280 return at86rf230_write_subreg(lp, SR_MAX_FRAME_RETRIES, retries);
1284 at86rf230_set_promiscuous_mode(struct ieee802154_hw *hw, const bool on)
1286 struct at86rf230_local *lp = hw->priv;
1290 rc = at86rf230_write_subreg(lp, SR_AACK_DIS_ACK, 1);
1294 rc = at86rf230_write_subreg(lp, SR_AACK_PROM_MODE, 1);
1298 rc = at86rf230_write_subreg(lp, SR_AACK_PROM_MODE, 0);
1302 rc = at86rf230_write_subreg(lp, SR_AACK_DIS_ACK, 0);
1310 static const struct ieee802154_ops at86rf230_ops = {
1311 .owner = THIS_MODULE,
1312 .xmit_async = at86rf230_xmit,
1314 .set_channel = at86rf230_channel,
1315 .start = at86rf230_start,
1316 .stop = at86rf230_stop,
1317 .set_hw_addr_filt = at86rf230_set_hw_addr_filt,
1318 .set_txpower = at86rf230_set_txpower,
1319 .set_lbt = at86rf230_set_lbt,
1320 .set_cca_mode = at86rf230_set_cca_mode,
1321 .set_cca_ed_level = at86rf230_set_cca_ed_level,
1322 .set_csma_params = at86rf230_set_csma_params,
1323 .set_frame_retries = at86rf230_set_frame_retries,
1324 .set_promiscuous_mode = at86rf230_set_promiscuous_mode,
1327 static struct at86rf2xx_chip_data at86rf233_data = {
1328 .t_sleep_cycle = 330,
1329 .t_channel_switch = 11,
1330 .t_reset_to_off = 26,
1331 .t_off_to_aack = 80,
1332 .t_off_to_tx_on = 80,
1333 .t_off_to_sleep = 35,
1334 .t_sleep_to_off = 1000,
1337 .rssi_base_val = -94,
1338 .set_channel = at86rf23x_set_channel,
1339 .set_txpower = at86rf23x_set_txpower,
1342 static struct at86rf2xx_chip_data at86rf231_data = {
1343 .t_sleep_cycle = 330,
1344 .t_channel_switch = 24,
1345 .t_reset_to_off = 37,
1346 .t_off_to_aack = 110,
1347 .t_off_to_tx_on = 110,
1348 .t_off_to_sleep = 35,
1349 .t_sleep_to_off = 1000,
1352 .rssi_base_val = -91,
1353 .set_channel = at86rf23x_set_channel,
1354 .set_txpower = at86rf23x_set_txpower,
1357 static struct at86rf2xx_chip_data at86rf212_data = {
1358 .t_sleep_cycle = 330,
1359 .t_channel_switch = 11,
1360 .t_reset_to_off = 26,
1361 .t_off_to_aack = 200,
1362 .t_off_to_tx_on = 200,
1363 .t_off_to_sleep = 35,
1364 .t_sleep_to_off = 1000,
1367 .rssi_base_val = -100,
1368 .set_channel = at86rf212_set_channel,
1369 .set_txpower = at86rf212_set_txpower,
1372 static int at86rf230_hw_init(struct at86rf230_local *lp, u8 xtal_trim)
1374 int rc, irq_type, irq_pol = IRQ_ACTIVE_HIGH;
1378 rc = at86rf230_sync_state_change(lp, STATE_FORCE_TRX_OFF);
1382 irq_type = irq_get_trigger_type(lp->spi->irq);
1383 if (irq_type == IRQ_TYPE_EDGE_FALLING ||
1384 irq_type == IRQ_TYPE_LEVEL_LOW)
1385 irq_pol = IRQ_ACTIVE_LOW;
1387 rc = at86rf230_write_subreg(lp, SR_IRQ_POLARITY, irq_pol);
1391 rc = at86rf230_write_subreg(lp, SR_RX_SAFE_MODE, 1);
1395 rc = at86rf230_write_subreg(lp, SR_IRQ_MASK, IRQ_TRX_END);
1399 /* reset values differs in at86rf231 and at86rf233 */
1400 rc = at86rf230_write_subreg(lp, SR_IRQ_MASK_MODE, 0);
1404 get_random_bytes(csma_seed, ARRAY_SIZE(csma_seed));
1405 rc = at86rf230_write_subreg(lp, SR_CSMA_SEED_0, csma_seed[0]);
1408 rc = at86rf230_write_subreg(lp, SR_CSMA_SEED_1, csma_seed[1]);
1412 /* CLKM changes are applied immediately */
1413 rc = at86rf230_write_subreg(lp, SR_CLKM_SHA_SEL, 0x00);
1418 rc = at86rf230_write_subreg(lp, SR_CLKM_CTRL, 0x00);
1421 /* Wait the next SLEEP cycle */
1422 usleep_range(lp->data->t_sleep_cycle,
1423 lp->data->t_sleep_cycle + 100);
1425 /* xtal_trim value is calculated by:
1426 * CL = 0.5 * (CX + CTRIM + CPAR)
1429 * CL = capacitor of used crystal
1430 * CX = connected capacitors at xtal pins
1431 * CPAR = in all at86rf2xx datasheets this is a constant value 3 pF,
1432 * but this is different on each board setup. You need to fine
1433 * tuning this value via CTRIM.
1434 * CTRIM = variable capacitor setting. Resolution is 0.3 pF range is
1438 * atben transceiver:
1442 * CPAR = 3 pF (We assume the magic constant from datasheet)
1445 * (12+0.9+3)/2 = 7.95 which is nearly at 8 pF
1449 * openlabs transceiver:
1453 * CPAR = 3 pF (We assume the magic constant from datasheet)
1456 * (22+4.5+3)/2 = 14.75 which is the nearest value to 16 pF
1460 rc = at86rf230_write_subreg(lp, SR_XTAL_TRIM, xtal_trim);
1464 rc = at86rf230_read_subreg(lp, SR_DVDD_OK, &dvdd);
1468 dev_err(&lp->spi->dev, "DVDD error\n");
1472 /* Force setting slotted operation bit to 0. Sometimes the atben
1473 * sets this bit and I don't know why. We set this always force
1474 * to zero while probing.
1476 return at86rf230_write_subreg(lp, SR_SLOTTED_OPERATION, 0);
1480 at86rf230_get_pdata(struct spi_device *spi, int *rstn, int *slp_tr,
1483 struct at86rf230_platform_data *pdata = spi->dev.platform_data;
1486 if (!IS_ENABLED(CONFIG_OF) || !spi->dev.of_node) {
1490 *rstn = pdata->rstn;
1491 *slp_tr = pdata->slp_tr;
1492 *xtal_trim = pdata->xtal_trim;
1496 *rstn = of_get_named_gpio(spi->dev.of_node, "reset-gpio", 0);
1497 *slp_tr = of_get_named_gpio(spi->dev.of_node, "sleep-gpio", 0);
1498 ret = of_property_read_u8(spi->dev.of_node, "xtal-trim", xtal_trim);
1499 if (ret < 0 && ret != -EINVAL)
1506 at86rf230_detect_device(struct at86rf230_local *lp)
1508 unsigned int part, version, val;
1513 rc = __at86rf230_read(lp, RG_MAN_ID_0, &val);
1518 rc = __at86rf230_read(lp, RG_MAN_ID_1, &val);
1521 man_id |= (val << 8);
1523 rc = __at86rf230_read(lp, RG_PART_NUM, &part);
1527 rc = __at86rf230_read(lp, RG_VERSION_NUM, &version);
1531 if (man_id != 0x001f) {
1532 dev_err(&lp->spi->dev, "Non-Atmel dev found (MAN_ID %02x %02x)\n",
1533 man_id >> 8, man_id & 0xFF);
1537 lp->hw->flags = IEEE802154_HW_TX_OMIT_CKSUM |
1538 IEEE802154_HW_CSMA_PARAMS |
1539 IEEE802154_HW_FRAME_RETRIES | IEEE802154_HW_AFILT |
1540 IEEE802154_HW_PROMISCUOUS;
1542 lp->hw->phy->flags = WPAN_PHY_FLAG_TXPOWER |
1543 WPAN_PHY_FLAG_CCA_ED_LEVEL |
1544 WPAN_PHY_FLAG_CCA_MODE;
1546 lp->hw->phy->supported.cca_modes = BIT(NL802154_CCA_ENERGY) |
1547 BIT(NL802154_CCA_CARRIER) | BIT(NL802154_CCA_ENERGY_CARRIER);
1548 lp->hw->phy->supported.cca_opts = BIT(NL802154_CCA_OPT_ENERGY_CARRIER_AND) |
1549 BIT(NL802154_CCA_OPT_ENERGY_CARRIER_OR);
1551 lp->hw->phy->cca.mode = NL802154_CCA_ENERGY;
1560 lp->data = &at86rf231_data;
1561 lp->hw->phy->supported.channels[0] = 0x7FFF800;
1562 lp->hw->phy->current_channel = 11;
1563 lp->hw->phy->symbol_duration = 16;
1564 lp->hw->phy->supported.tx_powers = at86rf231_powers;
1565 lp->hw->phy->supported.tx_powers_size = ARRAY_SIZE(at86rf231_powers);
1566 lp->hw->phy->supported.cca_ed_levels = at86rf231_ed_levels;
1567 lp->hw->phy->supported.cca_ed_levels_size = ARRAY_SIZE(at86rf231_ed_levels);
1571 lp->data = &at86rf212_data;
1572 lp->hw->flags |= IEEE802154_HW_LBT;
1573 lp->hw->phy->supported.channels[0] = 0x00007FF;
1574 lp->hw->phy->supported.channels[2] = 0x00007FF;
1575 lp->hw->phy->current_channel = 5;
1576 lp->hw->phy->symbol_duration = 25;
1577 lp->hw->phy->supported.lbt = NL802154_SUPPORTED_BOOL_BOTH;
1578 lp->hw->phy->supported.tx_powers = at86rf212_powers;
1579 lp->hw->phy->supported.tx_powers_size = ARRAY_SIZE(at86rf212_powers);
1580 lp->hw->phy->supported.cca_ed_levels = at86rf212_ed_levels_100;
1581 lp->hw->phy->supported.cca_ed_levels_size = ARRAY_SIZE(at86rf212_ed_levels_100);
1585 lp->data = &at86rf233_data;
1586 lp->hw->phy->supported.channels[0] = 0x7FFF800;
1587 lp->hw->phy->current_channel = 13;
1588 lp->hw->phy->symbol_duration = 16;
1589 lp->hw->phy->supported.tx_powers = at86rf233_powers;
1590 lp->hw->phy->supported.tx_powers_size = ARRAY_SIZE(at86rf233_powers);
1591 lp->hw->phy->supported.cca_ed_levels = at86rf233_ed_levels;
1592 lp->hw->phy->supported.cca_ed_levels_size = ARRAY_SIZE(at86rf233_ed_levels);
1600 lp->hw->phy->cca_ed_level = lp->hw->phy->supported.cca_ed_levels[7];
1601 lp->hw->phy->transmit_power = lp->hw->phy->supported.tx_powers[0];
1604 dev_info(&lp->spi->dev, "Detected %s chip version %d\n", chip, version);
1609 #ifdef CONFIG_IEEE802154_AT86RF230_DEBUGFS
1610 static struct dentry *at86rf230_debugfs_root;
1612 static int at86rf230_stats_show(struct seq_file *file, void *offset)
1614 struct at86rf230_local *lp = file->private;
1616 seq_printf(file, "SUCCESS:\t\t%8llu\n", lp->trac.success);
1617 seq_printf(file, "SUCCESS_DATA_PENDING:\t%8llu\n",
1618 lp->trac.success_data_pending);
1619 seq_printf(file, "SUCCESS_WAIT_FOR_ACK:\t%8llu\n",
1620 lp->trac.success_wait_for_ack);
1621 seq_printf(file, "CHANNEL_ACCESS_FAILURE:\t%8llu\n",
1622 lp->trac.channel_access_failure);
1623 seq_printf(file, "NO_ACK:\t\t\t%8llu\n", lp->trac.no_ack);
1624 seq_printf(file, "INVALID:\t\t%8llu\n", lp->trac.invalid);
1627 DEFINE_SHOW_ATTRIBUTE(at86rf230_stats);
1629 static void at86rf230_debugfs_init(struct at86rf230_local *lp)
1631 char debugfs_dir_name[DNAME_INLINE_LEN + 1] = "at86rf230-";
1633 strncat(debugfs_dir_name, dev_name(&lp->spi->dev), DNAME_INLINE_LEN);
1635 at86rf230_debugfs_root = debugfs_create_dir(debugfs_dir_name, NULL);
1637 debugfs_create_file("trac_stats", 0444, at86rf230_debugfs_root, lp,
1638 &at86rf230_stats_fops);
1641 static void at86rf230_debugfs_remove(void)
1643 debugfs_remove_recursive(at86rf230_debugfs_root);
1646 static void at86rf230_debugfs_init(struct at86rf230_local *lp) { }
1647 static void at86rf230_debugfs_remove(void) { }
1650 static int at86rf230_probe(struct spi_device *spi)
1652 struct ieee802154_hw *hw;
1653 struct at86rf230_local *lp;
1654 unsigned int status;
1655 int rc, irq_type, rstn, slp_tr;
1659 dev_err(&spi->dev, "no IRQ specified\n");
1663 rc = at86rf230_get_pdata(spi, &rstn, &slp_tr, &xtal_trim);
1665 dev_err(&spi->dev, "failed to parse platform_data: %d\n", rc);
1669 if (gpio_is_valid(rstn)) {
1670 rc = devm_gpio_request_one(&spi->dev, rstn,
1671 GPIOF_OUT_INIT_HIGH, "rstn");
1676 if (gpio_is_valid(slp_tr)) {
1677 rc = devm_gpio_request_one(&spi->dev, slp_tr,
1678 GPIOF_OUT_INIT_LOW, "slp_tr");
1684 if (gpio_is_valid(rstn)) {
1686 gpio_set_value_cansleep(rstn, 0);
1688 gpio_set_value_cansleep(rstn, 1);
1689 usleep_range(120, 240);
1692 hw = ieee802154_alloc_hw(sizeof(*lp), &at86rf230_ops);
1699 lp->slp_tr = slp_tr;
1700 hw->parent = &spi->dev;
1701 ieee802154_random_extended_addr(&hw->phy->perm_extended_addr);
1703 lp->regmap = devm_regmap_init_spi(spi, &at86rf230_regmap_spi_config);
1704 if (IS_ERR(lp->regmap)) {
1705 rc = PTR_ERR(lp->regmap);
1706 dev_err(&spi->dev, "Failed to allocate register map: %d\n",
1711 at86rf230_setup_spi_messages(lp, &lp->state);
1712 at86rf230_setup_spi_messages(lp, &lp->tx);
1714 rc = at86rf230_detect_device(lp);
1718 init_completion(&lp->state_complete);
1720 spi_set_drvdata(spi, lp);
1722 rc = at86rf230_hw_init(lp, xtal_trim);
1726 /* Read irq status register to reset irq line */
1727 rc = at86rf230_read_subreg(lp, RG_IRQ_STATUS, 0xff, 0, &status);
1731 irq_type = irq_get_trigger_type(spi->irq);
1733 irq_type = IRQF_TRIGGER_HIGH;
1735 rc = devm_request_irq(&spi->dev, spi->irq, at86rf230_isr,
1736 IRQF_SHARED | irq_type, dev_name(&spi->dev), lp);
1740 /* disable_irq by default and wait for starting hardware */
1741 disable_irq(spi->irq);
1743 /* going into sleep by default */
1744 at86rf230_sleep(lp);
1746 at86rf230_debugfs_init(lp);
1748 rc = ieee802154_register_hw(lp->hw);
1755 at86rf230_debugfs_remove();
1757 ieee802154_free_hw(lp->hw);
1762 static int at86rf230_remove(struct spi_device *spi)
1764 struct at86rf230_local *lp = spi_get_drvdata(spi);
1766 /* mask all at86rf230 irq's */
1767 at86rf230_write_subreg(lp, SR_IRQ_MASK, 0);
1768 ieee802154_unregister_hw(lp->hw);
1769 ieee802154_free_hw(lp->hw);
1770 at86rf230_debugfs_remove();
1771 dev_dbg(&spi->dev, "unregistered at86rf230\n");
1776 static const struct of_device_id at86rf230_of_match[] = {
1777 { .compatible = "atmel,at86rf230", },
1778 { .compatible = "atmel,at86rf231", },
1779 { .compatible = "atmel,at86rf233", },
1780 { .compatible = "atmel,at86rf212", },
1783 MODULE_DEVICE_TABLE(of, at86rf230_of_match);
1785 static const struct spi_device_id at86rf230_device_id[] = {
1786 { .name = "at86rf230", },
1787 { .name = "at86rf231", },
1788 { .name = "at86rf233", },
1789 { .name = "at86rf212", },
1792 MODULE_DEVICE_TABLE(spi, at86rf230_device_id);
1794 static struct spi_driver at86rf230_driver = {
1795 .id_table = at86rf230_device_id,
1797 .of_match_table = of_match_ptr(at86rf230_of_match),
1798 .name = "at86rf230",
1800 .probe = at86rf230_probe,
1801 .remove = at86rf230_remove,
1804 module_spi_driver(at86rf230_driver);
1806 MODULE_DESCRIPTION("AT86RF230 Transceiver Driver");
1807 MODULE_LICENSE("GPL v2");