Lines Matching +full:supported +full:- +full:hw

1 // SPDX-License-Identifier: GPL-2.0-only
5 * Copyright (C) 2009-2012 Siemens AG
8 * Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
81 struct ieee802154_hw *hw; member
109 if (lp->slp_tr) { in at86rf230_sleep()
110 gpiod_set_value(lp->slp_tr, 1); in at86rf230_sleep()
111 usleep_range(lp->data->t_off_to_sleep, in at86rf230_sleep()
112 lp->data->t_off_to_sleep + 10); in at86rf230_sleep()
113 lp->sleep = true; in at86rf230_sleep()
120 if (lp->slp_tr) { in at86rf230_awake()
121 gpiod_set_value(lp->slp_tr, 0); in at86rf230_awake()
122 usleep_range(lp->data->t_sleep_to_off, in at86rf230_awake()
123 lp->data->t_sleep_to_off + 100); in at86rf230_awake()
124 lp->sleep = false; in at86rf230_awake()
132 bool sleep = lp->sleep; in __at86rf230_write()
139 ret = regmap_write(lp->regmap, addr, data); in __at86rf230_write()
152 bool sleep = lp->sleep; in __at86rf230_read()
159 ret = regmap_read(lp->regmap, addr, data); in __at86rf230_read()
187 bool sleep = lp->sleep; in at86rf230_write_subreg()
194 ret = regmap_update_bits(lp->regmap, addr, mask, data << shift); in at86rf230_write_subreg()
206 gpiod_set_value(lp->slp_tr, 1); in at86rf230_slp_tr_rising_edge()
208 gpiod_set_value(lp->slp_tr, 0); in at86rf230_slp_tr_rising_edge()
330 struct at86rf230_local *lp = ctx->lp; in at86rf230_async_error_recover_complete()
332 if (ctx->free) in at86rf230_async_error_recover_complete()
335 if (lp->was_tx) { in at86rf230_async_error_recover_complete()
336 lp->was_tx = 0; in at86rf230_async_error_recover_complete()
337 ieee802154_xmit_hw_error(lp->hw, lp->tx_skb); in at86rf230_async_error_recover_complete()
345 struct at86rf230_local *lp = ctx->lp; in at86rf230_async_error_recover()
347 if (lp->is_tx) { in at86rf230_async_error_recover()
348 lp->was_tx = 1; in at86rf230_async_error_recover()
349 lp->is_tx = 0; in at86rf230_async_error_recover()
360 dev_err(&lp->spi->dev, "spi_async error %d\n", rc); in at86rf230_async_error()
374 u8 *tx_buf = ctx->buf; in at86rf230_async_read_reg()
377 ctx->msg.complete = complete; in at86rf230_async_read_reg()
378 rc = spi_async(lp->spi, &ctx->msg); in at86rf230_async_read_reg()
390 ctx->buf[0] = (reg & CMD_REG_MASK) | CMD_REG | CMD_WRITE; in at86rf230_async_write_reg()
391 ctx->buf[1] = val; in at86rf230_async_write_reg()
392 ctx->msg.complete = complete; in at86rf230_async_write_reg()
393 rc = spi_async(lp->spi, &ctx->msg); in at86rf230_async_write_reg()
402 struct at86rf230_local *lp = ctx->lp; in at86rf230_async_state_assert()
403 const u8 *buf = ctx->buf; in at86rf230_async_state_assert()
407 if (trx_state != ctx->to_state) { in at86rf230_async_state_assert()
418 if (ctx->to_state == STATE_RX_AACK_ON) in at86rf230_async_state_assert()
434 if (ctx->to_state == STATE_TX_ON || in at86rf230_async_state_assert()
435 ctx->to_state == STATE_TRX_OFF) { in at86rf230_async_state_assert()
436 u8 state = ctx->to_state; in at86rf230_async_state_assert()
438 if (lp->tx_retry >= AT86RF2XX_MAX_TX_RETRIES) in at86rf230_async_state_assert()
440 lp->tx_retry++; in at86rf230_async_state_assert()
443 ctx->complete); in at86rf230_async_state_assert()
448 dev_warn(&lp->spi->dev, "unexcept state change from 0x%02x to 0x%02x. Actual state: 0x%02x\n", in at86rf230_async_state_assert()
449 ctx->from_state, ctx->to_state, trx_state); in at86rf230_async_state_assert()
453 if (ctx->complete) in at86rf230_async_state_assert()
454 ctx->complete(context); in at86rf230_async_state_assert()
461 struct at86rf230_local *lp = ctx->lp; in at86rf230_async_state_timer()
474 struct at86rf230_local *lp = ctx->lp; in at86rf230_async_state_delay()
475 struct at86rf2xx_chip_data *c = lp->data; in at86rf230_async_state_delay()
484 switch (ctx->to_state) { in at86rf230_async_state_delay()
486 ctx->to_state = STATE_TX_ON; in at86rf230_async_state_delay()
490 ctx->to_state = STATE_TRX_OFF; in at86rf230_async_state_delay()
497 switch (ctx->from_state) { in at86rf230_async_state_delay()
499 switch (ctx->to_state) { in at86rf230_async_state_delay()
501 tim = c->t_off_to_aack * NSEC_PER_USEC; in at86rf230_async_state_delay()
506 lp->cal_timeout = jiffies + AT86RF2XX_CAL_LOOP_TIMEOUT; in at86rf230_async_state_delay()
510 tim = c->t_off_to_tx_on * NSEC_PER_USEC; in at86rf230_async_state_delay()
515 lp->cal_timeout = jiffies + AT86RF2XX_CAL_LOOP_TIMEOUT; in at86rf230_async_state_delay()
522 switch (ctx->to_state) { in at86rf230_async_state_delay()
530 tim = (c->t_frame + c->t_p_ack) * NSEC_PER_USEC; in at86rf230_async_state_delay()
540 switch (ctx->to_state) { in at86rf230_async_state_delay()
542 tim = c->t_reset_to_off * NSEC_PER_USEC; in at86rf230_async_state_delay()
554 at86rf230_async_state_timer(&ctx->timer); in at86rf230_async_state_delay()
558 hrtimer_start(&ctx->timer, tim, HRTIMER_MODE_REL); in at86rf230_async_state_delay()
565 struct at86rf230_local *lp = ctx->lp; in at86rf230_async_state_change_start()
566 u8 *buf = ctx->buf; in at86rf230_async_state_change_start()
578 if (trx_state == ctx->to_state) { in at86rf230_async_state_change_start()
579 if (ctx->complete) in at86rf230_async_state_change_start()
580 ctx->complete(context); in at86rf230_async_state_change_start()
585 ctx->from_state = trx_state; in at86rf230_async_state_change_start()
590 at86rf230_async_write_reg(lp, RG_TRX_STATE, ctx->to_state, ctx, in at86rf230_async_state_change_start()
600 ctx->to_state = state; in at86rf230_async_state_change()
601 ctx->complete = complete; in at86rf230_async_state_change()
610 struct at86rf230_local *lp = ctx->lp; in at86rf230_sync_state_change_complete()
612 complete(&lp->state_complete); in at86rf230_sync_state_change_complete()
624 at86rf230_async_state_change(lp, &lp->state, state, in at86rf230_sync_state_change()
627 rc = wait_for_completion_timeout(&lp->state_complete, in at86rf230_sync_state_change()
630 at86rf230_async_error(lp, &lp->state, -ETIMEDOUT); in at86rf230_sync_state_change()
631 return -ETIMEDOUT; in at86rf230_sync_state_change()
641 struct at86rf230_local *lp = ctx->lp; in at86rf230_tx_complete()
643 if (ctx->trac == IEEE802154_SUCCESS) in at86rf230_tx_complete()
644 ieee802154_xmit_complete(lp->hw, lp->tx_skb, false); in at86rf230_tx_complete()
646 ieee802154_xmit_error(lp->hw, lp->tx_skb, ctx->trac); in at86rf230_tx_complete()
655 struct at86rf230_local *lp = ctx->lp; in at86rf230_tx_on()
665 struct at86rf230_local *lp = ctx->lp; in at86rf230_tx_trac_check()
666 u8 trac = TRAC_MASK(ctx->buf[1]); in at86rf230_tx_trac_check()
671 ctx->trac = IEEE802154_SUCCESS; in at86rf230_tx_trac_check()
674 ctx->trac = IEEE802154_CHANNEL_ACCESS_FAILURE; in at86rf230_tx_trac_check()
677 ctx->trac = IEEE802154_NO_ACK; in at86rf230_tx_trac_check()
680 ctx->trac = IEEE802154_SYSTEM_ERROR; in at86rf230_tx_trac_check()
690 struct at86rf230_local *lp = ctx->lp; in at86rf230_rx_read_frame_complete()
691 const u8 *buf = ctx->buf; in at86rf230_rx_read_frame_complete()
697 dev_vdbg(&lp->spi->dev, "corrupted frame received\n"); in at86rf230_rx_read_frame_complete()
704 dev_vdbg(&lp->spi->dev, "failed to allocate sk_buff\n"); in at86rf230_rx_read_frame_complete()
710 ieee802154_rx_irqsafe(lp->hw, skb, lqi); in at86rf230_rx_read_frame_complete()
718 struct at86rf230_local *lp = ctx->lp; in at86rf230_rx_trac_check()
719 u8 *buf = ctx->buf; in at86rf230_rx_trac_check()
723 ctx->trx.len = AT86RF2XX_MAX_BUF; in at86rf230_rx_trac_check()
724 ctx->msg.complete = at86rf230_rx_read_frame_complete; in at86rf230_rx_trac_check()
725 rc = spi_async(lp->spi, &ctx->msg); in at86rf230_rx_trac_check()
727 ctx->trx.len = 2; in at86rf230_rx_trac_check()
736 struct at86rf230_local *lp = ctx->lp; in at86rf230_irq_trx_end()
738 if (lp->is_tx) { in at86rf230_irq_trx_end()
739 lp->is_tx = 0; in at86rf230_irq_trx_end()
752 struct at86rf230_local *lp = ctx->lp; in at86rf230_irq_status()
753 const u8 *buf = ctx->buf; in at86rf230_irq_status()
756 enable_irq(lp->spi->irq); in at86rf230_irq_status()
761 dev_err(&lp->spi->dev, "not supported irq %02x received\n", in at86rf230_irq_status()
771 state->lp = lp; in at86rf230_setup_spi_messages()
772 state->irq = lp->spi->irq; in at86rf230_setup_spi_messages()
773 spi_message_init(&state->msg); in at86rf230_setup_spi_messages()
774 state->msg.context = state; in at86rf230_setup_spi_messages()
775 state->trx.len = 2; in at86rf230_setup_spi_messages()
776 state->trx.tx_buf = state->buf; in at86rf230_setup_spi_messages()
777 state->trx.rx_buf = state->buf; in at86rf230_setup_spi_messages()
778 spi_message_add_tail(&state->trx, &state->msg); in at86rf230_setup_spi_messages()
779 hrtimer_init(&state->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); in at86rf230_setup_spi_messages()
780 state->timer.function = at86rf230_async_state_timer; in at86rf230_setup_spi_messages()
799 ctx->free = true; in at86rf230_isr()
801 ctx->buf[0] = (RG_IRQ_STATUS & CMD_REG_MASK) | CMD_REG; in at86rf230_isr()
802 ctx->msg.complete = at86rf230_irq_status; in at86rf230_isr()
803 rc = spi_async(lp->spi, &ctx->msg); in at86rf230_isr()
817 struct at86rf230_local *lp = ctx->lp; in at86rf230_write_frame_complete()
819 ctx->trx.len = 2; in at86rf230_write_frame_complete()
821 if (lp->slp_tr) in at86rf230_write_frame_complete()
832 struct at86rf230_local *lp = ctx->lp; in at86rf230_write_frame()
833 struct sk_buff *skb = lp->tx_skb; in at86rf230_write_frame()
834 u8 *buf = ctx->buf; in at86rf230_write_frame()
837 lp->is_tx = 1; in at86rf230_write_frame()
840 buf[1] = skb->len + 2; in at86rf230_write_frame()
841 memcpy(buf + 2, skb->data, skb->len); in at86rf230_write_frame()
842 ctx->trx.len = skb->len + 2; in at86rf230_write_frame()
843 ctx->msg.complete = at86rf230_write_frame_complete; in at86rf230_write_frame()
844 rc = spi_async(lp->spi, &ctx->msg); in at86rf230_write_frame()
846 ctx->trx.len = 2; in at86rf230_write_frame()
855 struct at86rf230_local *lp = ctx->lp; in at86rf230_xmit_tx_on()
865 struct at86rf230_local *lp = ctx->lp; in at86rf230_xmit_start()
868 if (lp->is_tx_from_off) in at86rf230_xmit_start()
877 at86rf230_xmit(struct ieee802154_hw *hw, struct sk_buff *skb) in at86rf230_xmit() argument
879 struct at86rf230_local *lp = hw->priv; in at86rf230_xmit()
880 struct at86rf230_state_change *ctx = &lp->tx; in at86rf230_xmit()
882 lp->tx_skb = skb; in at86rf230_xmit()
883 lp->tx_retry = 0; in at86rf230_xmit()
889 * to TX_ON, the lp->cal_timeout should be reinit by state_delay in at86rf230_xmit()
892 if (time_is_before_jiffies(lp->cal_timeout)) { in at86rf230_xmit()
893 lp->is_tx_from_off = true; in at86rf230_xmit()
897 lp->is_tx_from_off = false; in at86rf230_xmit()
905 at86rf230_ed(struct ieee802154_hw *hw, u8 *level) in at86rf230_ed() argument
913 at86rf230_start(struct ieee802154_hw *hw) in at86rf230_start() argument
915 struct at86rf230_local *lp = hw->priv; in at86rf230_start()
918 enable_irq(lp->spi->irq); in at86rf230_start()
924 at86rf230_stop(struct ieee802154_hw *hw) in at86rf230_stop() argument
926 struct at86rf230_local *lp = hw->priv; in at86rf230_stop()
931 disable_irq(lp->spi->irq); in at86rf230_stop()
953 -9400, -9200, -9000, -8800, -8600, -8400, -8200, -8000, -7800, -7600,
954 -7400, -7200, -7000, -6800, -6600, -6400,
958 -9100, -8900, -8700, -8500, -8300, -8100, -7900, -7700, -7500, -7300,
959 -7100, -6900, -6700, -6500, -6300, -6100,
963 -10000, -9800, -9600, -9400, -9200, -9000, -8800, -8600, -8400, -8200,
964 -8000, -7800, -7600, -7400, -7200, -7000,
968 -9800, -9600, -9400, -9200, -9000, -8800, -8600, -8400, -8200, -8000,
969 -7800, -7600, -7400, -7200, -7000, -6800,
983 case -98: in at86rf212_update_cca_ed_level()
984 lp->hw->phy->supported.cca_ed_levels = at86rf212_ed_levels_98; in at86rf212_update_cca_ed_level()
985 lp->hw->phy->supported.cca_ed_levels_size = ARRAY_SIZE(at86rf212_ed_levels_98); in at86rf212_update_cca_ed_level()
986 lp->hw->phy->cca_ed_level = at86rf212_ed_levels_98[cca_ed_thres]; in at86rf212_update_cca_ed_level()
988 case -100: in at86rf212_update_cca_ed_level()
989 lp->hw->phy->supported.cca_ed_levels = at86rf212_ed_levels_100; in at86rf212_update_cca_ed_level()
990 lp->hw->phy->supported.cca_ed_levels_size = ARRAY_SIZE(at86rf212_ed_levels_100); in at86rf212_update_cca_ed_level()
991 lp->hw->phy->cca_ed_level = at86rf212_ed_levels_100[cca_ed_thres]; in at86rf212_update_cca_ed_level()
1014 lp->data->rssi_base_val = -100; in at86rf212_set_channel()
1017 lp->data->rssi_base_val = -98; in at86rf212_set_channel()
1022 rc = at86rf212_update_cca_ed_level(lp, lp->data->rssi_base_val); in at86rf212_set_channel()
1030 at86rf230_channel(struct ieee802154_hw *hw, u8 page, u8 channel) in at86rf230_channel() argument
1032 struct at86rf230_local *lp = hw->priv; in at86rf230_channel()
1035 rc = lp->data->set_channel(lp, page, channel); in at86rf230_channel()
1037 usleep_range(lp->data->t_channel_switch, in at86rf230_channel()
1038 lp->data->t_channel_switch + 10); in at86rf230_channel()
1040 lp->cal_timeout = jiffies + AT86RF2XX_CAL_LOOP_TIMEOUT; in at86rf230_channel()
1045 at86rf230_set_hw_addr_filt(struct ieee802154_hw *hw, in at86rf230_set_hw_addr_filt() argument
1049 struct at86rf230_local *lp = hw->priv; in at86rf230_set_hw_addr_filt()
1052 u16 addr = le16_to_cpu(filt->short_addr); in at86rf230_set_hw_addr_filt()
1054 dev_vdbg(&lp->spi->dev, "%s called for saddr\n", __func__); in at86rf230_set_hw_addr_filt()
1060 u16 pan = le16_to_cpu(filt->pan_id); in at86rf230_set_hw_addr_filt()
1062 dev_vdbg(&lp->spi->dev, "%s called for pan id\n", __func__); in at86rf230_set_hw_addr_filt()
1070 memcpy(addr, &filt->ieee_addr, 8); in at86rf230_set_hw_addr_filt()
1071 dev_vdbg(&lp->spi->dev, "%s called for IEEE addr\n", __func__); in at86rf230_set_hw_addr_filt()
1077 dev_vdbg(&lp->spi->dev, "%s called for panc change\n", __func__); in at86rf230_set_hw_addr_filt()
1078 if (filt->pan_coord) in at86rf230_set_hw_addr_filt()
1089 400, 370, 340, 300, 250, 200, 100, 0, -100, -200, -300, -400, -600,
1090 -800, -1200, -1700,
1094 300, 280, 230, 180, 130, 70, 0, -100, -200, -300, -400, -500, -700,
1095 -900, -1200, -1700,
1100 500, 400, 300, 200, 100, 0, -100, -200, -300, -400, -500, -600, -700,
1101 -800, -900, -1000, -1100, -1200, -1300, -1400, -1500, -1600, -1700,
1102 -1800, -1900, -2000, -2100, -2200, -2300, -2400, -2500, -2600,
1110 for (i = 0; i < lp->hw->phy->supported.tx_powers_size; i++) { in at86rf23x_set_txpower()
1111 if (lp->hw->phy->supported.tx_powers[i] == mbm) in at86rf23x_set_txpower()
1115 return -EINVAL; in at86rf23x_set_txpower()
1123 for (i = 0; i < lp->hw->phy->supported.tx_powers_size; i++) { in at86rf212_set_txpower()
1124 if (lp->hw->phy->supported.tx_powers[i] == mbm) in at86rf212_set_txpower()
1128 return -EINVAL; in at86rf212_set_txpower()
1132 at86rf230_set_txpower(struct ieee802154_hw *hw, s32 mbm) in at86rf230_set_txpower() argument
1134 struct at86rf230_local *lp = hw->priv; in at86rf230_set_txpower()
1136 return lp->data->set_txpower(lp, mbm); in at86rf230_set_txpower()
1140 at86rf230_set_lbt(struct ieee802154_hw *hw, bool on) in at86rf230_set_lbt() argument
1142 struct at86rf230_local *lp = hw->priv; in at86rf230_set_lbt()
1148 at86rf230_set_cca_mode(struct ieee802154_hw *hw, in at86rf230_set_cca_mode() argument
1151 struct at86rf230_local *lp = hw->priv; in at86rf230_set_cca_mode()
1155 switch (cca->mode) { in at86rf230_set_cca_mode()
1163 switch (cca->opt) { in at86rf230_set_cca_mode()
1171 return -EINVAL; in at86rf230_set_cca_mode()
1175 return -EINVAL; in at86rf230_set_cca_mode()
1182 at86rf230_set_cca_ed_level(struct ieee802154_hw *hw, s32 mbm) in at86rf230_set_cca_ed_level() argument
1184 struct at86rf230_local *lp = hw->priv; in at86rf230_set_cca_ed_level()
1187 for (i = 0; i < hw->phy->supported.cca_ed_levels_size; i++) { in at86rf230_set_cca_ed_level()
1188 if (hw->phy->supported.cca_ed_levels[i] == mbm) in at86rf230_set_cca_ed_level()
1192 return -EINVAL; in at86rf230_set_cca_ed_level()
1196 at86rf230_set_csma_params(struct ieee802154_hw *hw, u8 min_be, u8 max_be, in at86rf230_set_csma_params() argument
1199 struct at86rf230_local *lp = hw->priv; in at86rf230_set_csma_params()
1214 at86rf230_set_frame_retries(struct ieee802154_hw *hw, s8 retries) in at86rf230_set_frame_retries() argument
1216 struct at86rf230_local *lp = hw->priv; in at86rf230_set_frame_retries()
1222 at86rf230_set_promiscuous_mode(struct ieee802154_hw *hw, const bool on) in at86rf230_set_promiscuous_mode() argument
1224 struct at86rf230_local *lp = hw->priv; in at86rf230_set_promiscuous_mode()
1275 .rssi_base_val = -94,
1290 .rssi_base_val = -91,
1305 .rssi_base_val = -100,
1320 irq_type = irq_get_trigger_type(lp->spi->irq); in at86rf230_hw_init()
1360 usleep_range(lp->data->t_sleep_cycle, in at86rf230_hw_init()
1361 lp->data->t_sleep_cycle + 100); in at86rf230_hw_init()
1406 dev_err(&lp->spi->dev, "DVDD error\n"); in at86rf230_hw_init()
1407 return -EINVAL; in at86rf230_hw_init()
1444 dev_err(&lp->spi->dev, "Non-Atmel dev found (MAN_ID %02x %02x)\n", in at86rf230_detect_device()
1446 return -EINVAL; in at86rf230_detect_device()
1449 lp->hw->flags = IEEE802154_HW_TX_OMIT_CKSUM | in at86rf230_detect_device()
1454 lp->hw->phy->flags = WPAN_PHY_FLAG_TXPOWER | in at86rf230_detect_device()
1458 lp->hw->phy->supported.cca_modes = BIT(NL802154_CCA_ENERGY) | in at86rf230_detect_device()
1460 lp->hw->phy->supported.cca_opts = BIT(NL802154_CCA_OPT_ENERGY_CARRIER_AND) | in at86rf230_detect_device()
1463 lp->hw->phy->cca.mode = NL802154_CCA_ENERGY; in at86rf230_detect_device()
1468 rc = -ENOTSUPP; in at86rf230_detect_device()
1472 lp->data = &at86rf231_data; in at86rf230_detect_device()
1473 lp->hw->phy->supported.channels[0] = 0x7FFF800; in at86rf230_detect_device()
1474 lp->hw->phy->current_channel = 11; in at86rf230_detect_device()
1475 lp->hw->phy->supported.tx_powers = at86rf231_powers; in at86rf230_detect_device()
1476 lp->hw->phy->supported.tx_powers_size = ARRAY_SIZE(at86rf231_powers); in at86rf230_detect_device()
1477 lp->hw->phy->supported.cca_ed_levels = at86rf231_ed_levels; in at86rf230_detect_device()
1478 lp->hw->phy->supported.cca_ed_levels_size = ARRAY_SIZE(at86rf231_ed_levels); in at86rf230_detect_device()
1482 lp->data = &at86rf212_data; in at86rf230_detect_device()
1483 lp->hw->flags |= IEEE802154_HW_LBT; in at86rf230_detect_device()
1484 lp->hw->phy->supported.channels[0] = 0x00007FF; in at86rf230_detect_device()
1485 lp->hw->phy->supported.channels[2] = 0x00007FF; in at86rf230_detect_device()
1486 lp->hw->phy->current_channel = 5; in at86rf230_detect_device()
1487 lp->hw->phy->supported.lbt = NL802154_SUPPORTED_BOOL_BOTH; in at86rf230_detect_device()
1488 lp->hw->phy->supported.tx_powers = at86rf212_powers; in at86rf230_detect_device()
1489 lp->hw->phy->supported.tx_powers_size = ARRAY_SIZE(at86rf212_powers); in at86rf230_detect_device()
1490 lp->hw->phy->supported.cca_ed_levels = at86rf212_ed_levels_100; in at86rf230_detect_device()
1491 lp->hw->phy->supported.cca_ed_levels_size = ARRAY_SIZE(at86rf212_ed_levels_100); in at86rf230_detect_device()
1495 lp->data = &at86rf233_data; in at86rf230_detect_device()
1496 lp->hw->phy->supported.channels[0] = 0x7FFF800; in at86rf230_detect_device()
1497 lp->hw->phy->current_channel = 13; in at86rf230_detect_device()
1498 lp->hw->phy->supported.tx_powers = at86rf233_powers; in at86rf230_detect_device()
1499 lp->hw->phy->supported.tx_powers_size = ARRAY_SIZE(at86rf233_powers); in at86rf230_detect_device()
1500 lp->hw->phy->supported.cca_ed_levels = at86rf233_ed_levels; in at86rf230_detect_device()
1501 lp->hw->phy->supported.cca_ed_levels_size = ARRAY_SIZE(at86rf233_ed_levels); in at86rf230_detect_device()
1505 rc = -ENOTSUPP; in at86rf230_detect_device()
1509 lp->hw->phy->cca_ed_level = lp->hw->phy->supported.cca_ed_levels[7]; in at86rf230_detect_device()
1510 lp->hw->phy->transmit_power = lp->hw->phy->supported.tx_powers[0]; in at86rf230_detect_device()
1513 dev_info(&lp->spi->dev, "Detected %s chip version %d\n", chip, version); in at86rf230_detect_device()
1520 struct ieee802154_hw *hw; in at86rf230_probe() local
1528 if (!spi->irq) { in at86rf230_probe()
1529 dev_err(&spi->dev, "no IRQ specified\n"); in at86rf230_probe()
1530 return -EINVAL; in at86rf230_probe()
1533 rc = device_property_read_u8(&spi->dev, "xtal-trim", &xtal_trim); in at86rf230_probe()
1535 if (rc != -EINVAL) { in at86rf230_probe()
1536 dev_err(&spi->dev, in at86rf230_probe()
1537 "failed to parse xtal-trim: %d\n", rc); in at86rf230_probe()
1543 rstn = devm_gpiod_get_optional(&spi->dev, "reset", GPIOD_OUT_LOW); in at86rf230_probe()
1550 slp_tr = devm_gpiod_get_optional(&spi->dev, "sleep", GPIOD_OUT_LOW); in at86rf230_probe()
1566 hw = ieee802154_alloc_hw(sizeof(*lp), &at86rf230_ops); in at86rf230_probe()
1567 if (!hw) in at86rf230_probe()
1568 return -ENOMEM; in at86rf230_probe()
1570 lp = hw->priv; in at86rf230_probe()
1571 lp->hw = hw; in at86rf230_probe()
1572 lp->spi = spi; in at86rf230_probe()
1573 lp->slp_tr = slp_tr; in at86rf230_probe()
1574 hw->parent = &spi->dev; in at86rf230_probe()
1575 ieee802154_random_extended_addr(&hw->phy->perm_extended_addr); in at86rf230_probe()
1577 lp->regmap = devm_regmap_init_spi(spi, &at86rf230_regmap_spi_config); in at86rf230_probe()
1578 if (IS_ERR(lp->regmap)) { in at86rf230_probe()
1579 rc = PTR_ERR(lp->regmap); in at86rf230_probe()
1580 dev_err(&spi->dev, "Failed to allocate register map: %d\n", in at86rf230_probe()
1585 at86rf230_setup_spi_messages(lp, &lp->state); in at86rf230_probe()
1586 at86rf230_setup_spi_messages(lp, &lp->tx); in at86rf230_probe()
1592 init_completion(&lp->state_complete); in at86rf230_probe()
1605 irq_type = irq_get_trigger_type(spi->irq); in at86rf230_probe()
1609 rc = devm_request_irq(&spi->dev, spi->irq, at86rf230_isr, in at86rf230_probe()
1610 IRQF_SHARED | irq_type, dev_name(&spi->dev), lp); in at86rf230_probe()
1615 disable_irq(spi->irq); in at86rf230_probe()
1620 rc = ieee802154_register_hw(lp->hw); in at86rf230_probe()
1627 ieee802154_free_hw(lp->hw); in at86rf230_probe()
1638 ieee802154_unregister_hw(lp->hw); in at86rf230_remove()
1639 ieee802154_free_hw(lp->hw); in at86rf230_remove()
1640 dev_dbg(&spi->dev, "unregistered at86rf230\n"); in at86rf230_remove()