Lines Matching +full:tuning +full:- +full:capacitor +full:- +full:pf
1 // SPDX-License-Identifier: GPL-2.0-only
5 * Copyright (C) 2009-2012 Siemens AG
8 * Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
110 if (gpio_is_valid(lp->slp_tr)) { in at86rf230_sleep()
111 gpio_set_value(lp->slp_tr, 1); in at86rf230_sleep()
112 usleep_range(lp->data->t_off_to_sleep, in at86rf230_sleep()
113 lp->data->t_off_to_sleep + 10); in at86rf230_sleep()
114 lp->sleep = true; in at86rf230_sleep()
121 if (gpio_is_valid(lp->slp_tr)) { in at86rf230_awake()
122 gpio_set_value(lp->slp_tr, 0); in at86rf230_awake()
123 usleep_range(lp->data->t_sleep_to_off, in at86rf230_awake()
124 lp->data->t_sleep_to_off + 100); in at86rf230_awake()
125 lp->sleep = false; in at86rf230_awake()
133 bool sleep = lp->sleep; in __at86rf230_write()
140 ret = regmap_write(lp->regmap, addr, data); in __at86rf230_write()
153 bool sleep = lp->sleep; in __at86rf230_read()
160 ret = regmap_read(lp->regmap, addr, data); in __at86rf230_read()
188 bool sleep = lp->sleep; in at86rf230_write_subreg()
195 ret = regmap_update_bits(lp->regmap, addr, mask, data << shift); in at86rf230_write_subreg()
207 gpio_set_value(lp->slp_tr, 1); in at86rf230_slp_tr_rising_edge()
209 gpio_set_value(lp->slp_tr, 0); in at86rf230_slp_tr_rising_edge()
331 struct at86rf230_local *lp = ctx->lp; in at86rf230_async_error_recover_complete()
333 if (ctx->free) in at86rf230_async_error_recover_complete()
336 if (lp->was_tx) { in at86rf230_async_error_recover_complete()
337 lp->was_tx = 0; in at86rf230_async_error_recover_complete()
338 ieee802154_xmit_hw_error(lp->hw, lp->tx_skb); in at86rf230_async_error_recover_complete()
346 struct at86rf230_local *lp = ctx->lp; in at86rf230_async_error_recover()
348 if (lp->is_tx) { in at86rf230_async_error_recover()
349 lp->was_tx = 1; in at86rf230_async_error_recover()
350 lp->is_tx = 0; in at86rf230_async_error_recover()
361 dev_err(&lp->spi->dev, "spi_async error %d\n", rc); in at86rf230_async_error()
375 u8 *tx_buf = ctx->buf; in at86rf230_async_read_reg()
378 ctx->msg.complete = complete; in at86rf230_async_read_reg()
379 rc = spi_async(lp->spi, &ctx->msg); in at86rf230_async_read_reg()
391 ctx->buf[0] = (reg & CMD_REG_MASK) | CMD_REG | CMD_WRITE; in at86rf230_async_write_reg()
392 ctx->buf[1] = val; in at86rf230_async_write_reg()
393 ctx->msg.complete = complete; in at86rf230_async_write_reg()
394 rc = spi_async(lp->spi, &ctx->msg); in at86rf230_async_write_reg()
403 struct at86rf230_local *lp = ctx->lp; in at86rf230_async_state_assert()
404 const u8 *buf = ctx->buf; in at86rf230_async_state_assert()
408 if (trx_state != ctx->to_state) { in at86rf230_async_state_assert()
419 if (ctx->to_state == STATE_RX_AACK_ON) in at86rf230_async_state_assert()
435 if (ctx->to_state == STATE_TX_ON || in at86rf230_async_state_assert()
436 ctx->to_state == STATE_TRX_OFF) { in at86rf230_async_state_assert()
437 u8 state = ctx->to_state; in at86rf230_async_state_assert()
439 if (lp->tx_retry >= AT86RF2XX_MAX_TX_RETRIES) in at86rf230_async_state_assert()
441 lp->tx_retry++; in at86rf230_async_state_assert()
444 ctx->complete); in at86rf230_async_state_assert()
449 dev_warn(&lp->spi->dev, "unexcept state change from 0x%02x to 0x%02x. Actual state: 0x%02x\n", in at86rf230_async_state_assert()
450 ctx->from_state, ctx->to_state, trx_state); in at86rf230_async_state_assert()
454 if (ctx->complete) in at86rf230_async_state_assert()
455 ctx->complete(context); in at86rf230_async_state_assert()
462 struct at86rf230_local *lp = ctx->lp; in at86rf230_async_state_timer()
475 struct at86rf230_local *lp = ctx->lp; in at86rf230_async_state_delay()
476 struct at86rf2xx_chip_data *c = lp->data; in at86rf230_async_state_delay()
485 switch (ctx->to_state) { in at86rf230_async_state_delay()
487 ctx->to_state = STATE_TX_ON; in at86rf230_async_state_delay()
491 ctx->to_state = STATE_TRX_OFF; in at86rf230_async_state_delay()
498 switch (ctx->from_state) { in at86rf230_async_state_delay()
500 switch (ctx->to_state) { in at86rf230_async_state_delay()
502 tim = c->t_off_to_aack * NSEC_PER_USEC; in at86rf230_async_state_delay()
507 lp->cal_timeout = jiffies + AT86RF2XX_CAL_LOOP_TIMEOUT; in at86rf230_async_state_delay()
511 tim = c->t_off_to_tx_on * NSEC_PER_USEC; in at86rf230_async_state_delay()
516 lp->cal_timeout = jiffies + AT86RF2XX_CAL_LOOP_TIMEOUT; in at86rf230_async_state_delay()
523 switch (ctx->to_state) { in at86rf230_async_state_delay()
531 tim = (c->t_frame + c->t_p_ack) * NSEC_PER_USEC; in at86rf230_async_state_delay()
541 switch (ctx->to_state) { in at86rf230_async_state_delay()
543 tim = c->t_reset_to_off * NSEC_PER_USEC; in at86rf230_async_state_delay()
555 at86rf230_async_state_timer(&ctx->timer); in at86rf230_async_state_delay()
559 hrtimer_start(&ctx->timer, tim, HRTIMER_MODE_REL); in at86rf230_async_state_delay()
566 struct at86rf230_local *lp = ctx->lp; in at86rf230_async_state_change_start()
567 u8 *buf = ctx->buf; in at86rf230_async_state_change_start()
579 if (trx_state == ctx->to_state) { in at86rf230_async_state_change_start()
580 if (ctx->complete) in at86rf230_async_state_change_start()
581 ctx->complete(context); in at86rf230_async_state_change_start()
586 ctx->from_state = trx_state; in at86rf230_async_state_change_start()
591 at86rf230_async_write_reg(lp, RG_TRX_STATE, ctx->to_state, ctx, in at86rf230_async_state_change_start()
601 ctx->to_state = state; in at86rf230_async_state_change()
602 ctx->complete = complete; in at86rf230_async_state_change()
611 struct at86rf230_local *lp = ctx->lp; in at86rf230_sync_state_change_complete()
613 complete(&lp->state_complete); in at86rf230_sync_state_change_complete()
625 at86rf230_async_state_change(lp, &lp->state, state, in at86rf230_sync_state_change()
628 rc = wait_for_completion_timeout(&lp->state_complete, in at86rf230_sync_state_change()
631 at86rf230_async_error(lp, &lp->state, -ETIMEDOUT); in at86rf230_sync_state_change()
632 return -ETIMEDOUT; in at86rf230_sync_state_change()
642 struct at86rf230_local *lp = ctx->lp; in at86rf230_tx_complete()
644 if (ctx->trac == IEEE802154_SUCCESS) in at86rf230_tx_complete()
645 ieee802154_xmit_complete(lp->hw, lp->tx_skb, false); in at86rf230_tx_complete()
647 ieee802154_xmit_error(lp->hw, lp->tx_skb, ctx->trac); in at86rf230_tx_complete()
656 struct at86rf230_local *lp = ctx->lp; in at86rf230_tx_on()
666 struct at86rf230_local *lp = ctx->lp; in at86rf230_tx_trac_check()
667 u8 trac = TRAC_MASK(ctx->buf[1]); in at86rf230_tx_trac_check()
672 ctx->trac = IEEE802154_SUCCESS; in at86rf230_tx_trac_check()
675 ctx->trac = IEEE802154_CHANNEL_ACCESS_FAILURE; in at86rf230_tx_trac_check()
678 ctx->trac = IEEE802154_NO_ACK; in at86rf230_tx_trac_check()
681 ctx->trac = IEEE802154_SYSTEM_ERROR; in at86rf230_tx_trac_check()
691 struct at86rf230_local *lp = ctx->lp; in at86rf230_rx_read_frame_complete()
692 const u8 *buf = ctx->buf; in at86rf230_rx_read_frame_complete()
698 dev_vdbg(&lp->spi->dev, "corrupted frame received\n"); in at86rf230_rx_read_frame_complete()
705 dev_vdbg(&lp->spi->dev, "failed to allocate sk_buff\n"); in at86rf230_rx_read_frame_complete()
711 ieee802154_rx_irqsafe(lp->hw, skb, lqi); in at86rf230_rx_read_frame_complete()
719 struct at86rf230_local *lp = ctx->lp; in at86rf230_rx_trac_check()
720 u8 *buf = ctx->buf; in at86rf230_rx_trac_check()
724 ctx->trx.len = AT86RF2XX_MAX_BUF; in at86rf230_rx_trac_check()
725 ctx->msg.complete = at86rf230_rx_read_frame_complete; in at86rf230_rx_trac_check()
726 rc = spi_async(lp->spi, &ctx->msg); in at86rf230_rx_trac_check()
728 ctx->trx.len = 2; in at86rf230_rx_trac_check()
737 struct at86rf230_local *lp = ctx->lp; in at86rf230_irq_trx_end()
739 if (lp->is_tx) { in at86rf230_irq_trx_end()
740 lp->is_tx = 0; in at86rf230_irq_trx_end()
753 struct at86rf230_local *lp = ctx->lp; in at86rf230_irq_status()
754 const u8 *buf = ctx->buf; in at86rf230_irq_status()
757 enable_irq(lp->spi->irq); in at86rf230_irq_status()
762 dev_err(&lp->spi->dev, "not supported irq %02x received\n", in at86rf230_irq_status()
772 state->lp = lp; in at86rf230_setup_spi_messages()
773 state->irq = lp->spi->irq; in at86rf230_setup_spi_messages()
774 spi_message_init(&state->msg); in at86rf230_setup_spi_messages()
775 state->msg.context = state; in at86rf230_setup_spi_messages()
776 state->trx.len = 2; in at86rf230_setup_spi_messages()
777 state->trx.tx_buf = state->buf; in at86rf230_setup_spi_messages()
778 state->trx.rx_buf = state->buf; in at86rf230_setup_spi_messages()
779 spi_message_add_tail(&state->trx, &state->msg); in at86rf230_setup_spi_messages()
780 hrtimer_init(&state->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); in at86rf230_setup_spi_messages()
781 state->timer.function = at86rf230_async_state_timer; in at86rf230_setup_spi_messages()
800 ctx->free = true; in at86rf230_isr()
802 ctx->buf[0] = (RG_IRQ_STATUS & CMD_REG_MASK) | CMD_REG; in at86rf230_isr()
803 ctx->msg.complete = at86rf230_irq_status; in at86rf230_isr()
804 rc = spi_async(lp->spi, &ctx->msg); in at86rf230_isr()
818 struct at86rf230_local *lp = ctx->lp; in at86rf230_write_frame_complete()
820 ctx->trx.len = 2; in at86rf230_write_frame_complete()
822 if (gpio_is_valid(lp->slp_tr)) in at86rf230_write_frame_complete()
833 struct at86rf230_local *lp = ctx->lp; in at86rf230_write_frame()
834 struct sk_buff *skb = lp->tx_skb; in at86rf230_write_frame()
835 u8 *buf = ctx->buf; in at86rf230_write_frame()
838 lp->is_tx = 1; in at86rf230_write_frame()
841 buf[1] = skb->len + 2; in at86rf230_write_frame()
842 memcpy(buf + 2, skb->data, skb->len); in at86rf230_write_frame()
843 ctx->trx.len = skb->len + 2; in at86rf230_write_frame()
844 ctx->msg.complete = at86rf230_write_frame_complete; in at86rf230_write_frame()
845 rc = spi_async(lp->spi, &ctx->msg); in at86rf230_write_frame()
847 ctx->trx.len = 2; in at86rf230_write_frame()
856 struct at86rf230_local *lp = ctx->lp; in at86rf230_xmit_tx_on()
866 struct at86rf230_local *lp = ctx->lp; in at86rf230_xmit_start()
869 if (lp->is_tx_from_off) in at86rf230_xmit_start()
880 struct at86rf230_local *lp = hw->priv; in at86rf230_xmit()
881 struct at86rf230_state_change *ctx = &lp->tx; in at86rf230_xmit()
883 lp->tx_skb = skb; in at86rf230_xmit()
884 lp->tx_retry = 0; in at86rf230_xmit()
890 * to TX_ON, the lp->cal_timeout should be reinit by state_delay in at86rf230_xmit()
893 if (time_is_before_jiffies(lp->cal_timeout)) { in at86rf230_xmit()
894 lp->is_tx_from_off = true; in at86rf230_xmit()
898 lp->is_tx_from_off = false; in at86rf230_xmit()
916 struct at86rf230_local *lp = hw->priv; in at86rf230_start()
919 enable_irq(lp->spi->irq); in at86rf230_start()
927 struct at86rf230_local *lp = hw->priv; in at86rf230_stop()
932 disable_irq(lp->spi->irq); in at86rf230_stop()
954 -9400, -9200, -9000, -8800, -8600, -8400, -8200, -8000, -7800, -7600,
955 -7400, -7200, -7000, -6800, -6600, -6400,
959 -9100, -8900, -8700, -8500, -8300, -8100, -7900, -7700, -7500, -7300,
960 -7100, -6900, -6700, -6500, -6300, -6100,
964 -10000, -9800, -9600, -9400, -9200, -9000, -8800, -8600, -8400, -8200,
965 -8000, -7800, -7600, -7400, -7200, -7000,
969 -9800, -9600, -9400, -9200, -9000, -8800, -8600, -8400, -8200, -8000,
970 -7800, -7600, -7400, -7200, -7000, -6800,
984 case -98: in at86rf212_update_cca_ed_level()
985 lp->hw->phy->supported.cca_ed_levels = at86rf212_ed_levels_98; in at86rf212_update_cca_ed_level()
986 lp->hw->phy->supported.cca_ed_levels_size = ARRAY_SIZE(at86rf212_ed_levels_98); in at86rf212_update_cca_ed_level()
987 lp->hw->phy->cca_ed_level = at86rf212_ed_levels_98[cca_ed_thres]; in at86rf212_update_cca_ed_level()
989 case -100: in at86rf212_update_cca_ed_level()
990 lp->hw->phy->supported.cca_ed_levels = at86rf212_ed_levels_100; in at86rf212_update_cca_ed_level()
991 lp->hw->phy->supported.cca_ed_levels_size = ARRAY_SIZE(at86rf212_ed_levels_100); in at86rf212_update_cca_ed_level()
992 lp->hw->phy->cca_ed_level = at86rf212_ed_levels_100[cca_ed_thres]; in at86rf212_update_cca_ed_level()
1015 lp->data->rssi_base_val = -100; in at86rf212_set_channel()
1018 lp->data->rssi_base_val = -98; in at86rf212_set_channel()
1023 rc = at86rf212_update_cca_ed_level(lp, lp->data->rssi_base_val); in at86rf212_set_channel()
1033 struct at86rf230_local *lp = hw->priv; in at86rf230_channel()
1036 rc = lp->data->set_channel(lp, page, channel); in at86rf230_channel()
1038 usleep_range(lp->data->t_channel_switch, in at86rf230_channel()
1039 lp->data->t_channel_switch + 10); in at86rf230_channel()
1041 lp->cal_timeout = jiffies + AT86RF2XX_CAL_LOOP_TIMEOUT; in at86rf230_channel()
1050 struct at86rf230_local *lp = hw->priv; in at86rf230_set_hw_addr_filt()
1053 u16 addr = le16_to_cpu(filt->short_addr); in at86rf230_set_hw_addr_filt()
1055 dev_vdbg(&lp->spi->dev, "%s called for saddr\n", __func__); in at86rf230_set_hw_addr_filt()
1061 u16 pan = le16_to_cpu(filt->pan_id); in at86rf230_set_hw_addr_filt()
1063 dev_vdbg(&lp->spi->dev, "%s called for pan id\n", __func__); in at86rf230_set_hw_addr_filt()
1071 memcpy(addr, &filt->ieee_addr, 8); in at86rf230_set_hw_addr_filt()
1072 dev_vdbg(&lp->spi->dev, "%s called for IEEE addr\n", __func__); in at86rf230_set_hw_addr_filt()
1078 dev_vdbg(&lp->spi->dev, "%s called for panc change\n", __func__); in at86rf230_set_hw_addr_filt()
1079 if (filt->pan_coord) in at86rf230_set_hw_addr_filt()
1090 400, 370, 340, 300, 250, 200, 100, 0, -100, -200, -300, -400, -600,
1091 -800, -1200, -1700,
1095 300, 280, 230, 180, 130, 70, 0, -100, -200, -300, -400, -500, -700,
1096 -900, -1200, -1700,
1101 500, 400, 300, 200, 100, 0, -100, -200, -300, -400, -500, -600, -700,
1102 -800, -900, -1000, -1100, -1200, -1300, -1400, -1500, -1600, -1700,
1103 -1800, -1900, -2000, -2100, -2200, -2300, -2400, -2500, -2600,
1111 for (i = 0; i < lp->hw->phy->supported.tx_powers_size; i++) { in at86rf23x_set_txpower()
1112 if (lp->hw->phy->supported.tx_powers[i] == mbm) in at86rf23x_set_txpower()
1116 return -EINVAL; in at86rf23x_set_txpower()
1124 for (i = 0; i < lp->hw->phy->supported.tx_powers_size; i++) { in at86rf212_set_txpower()
1125 if (lp->hw->phy->supported.tx_powers[i] == mbm) in at86rf212_set_txpower()
1129 return -EINVAL; in at86rf212_set_txpower()
1135 struct at86rf230_local *lp = hw->priv; in at86rf230_set_txpower()
1137 return lp->data->set_txpower(lp, mbm); in at86rf230_set_txpower()
1143 struct at86rf230_local *lp = hw->priv; in at86rf230_set_lbt()
1152 struct at86rf230_local *lp = hw->priv; in at86rf230_set_cca_mode()
1156 switch (cca->mode) { in at86rf230_set_cca_mode()
1164 switch (cca->opt) { in at86rf230_set_cca_mode()
1172 return -EINVAL; in at86rf230_set_cca_mode()
1176 return -EINVAL; in at86rf230_set_cca_mode()
1185 struct at86rf230_local *lp = hw->priv; in at86rf230_set_cca_ed_level()
1188 for (i = 0; i < hw->phy->supported.cca_ed_levels_size; i++) { in at86rf230_set_cca_ed_level()
1189 if (hw->phy->supported.cca_ed_levels[i] == mbm) in at86rf230_set_cca_ed_level()
1193 return -EINVAL; in at86rf230_set_cca_ed_level()
1200 struct at86rf230_local *lp = hw->priv; in at86rf230_set_csma_params()
1217 struct at86rf230_local *lp = hw->priv; in at86rf230_set_frame_retries()
1225 struct at86rf230_local *lp = hw->priv; in at86rf230_set_promiscuous_mode()
1276 .rssi_base_val = -94,
1291 .rssi_base_val = -91,
1306 .rssi_base_val = -100,
1321 irq_type = irq_get_trigger_type(lp->spi->irq); in at86rf230_hw_init()
1361 usleep_range(lp->data->t_sleep_cycle, in at86rf230_hw_init()
1362 lp->data->t_sleep_cycle + 100); in at86rf230_hw_init()
1368 * CL = capacitor of used crystal in at86rf230_hw_init()
1370 * CPAR = in all at86rf2xx datasheets this is a constant value 3 pF, in at86rf230_hw_init()
1372 * tuning this value via CTRIM. in at86rf230_hw_init()
1373 * CTRIM = variable capacitor setting. Resolution is 0.3 pF range is in at86rf230_hw_init()
1374 * 0 pF upto 4.5 pF. in at86rf230_hw_init()
1379 * CL = 8 pF in at86rf230_hw_init()
1380 * CX = 12 pF in at86rf230_hw_init()
1381 * CPAR = 3 pF (We assume the magic constant from datasheet) in at86rf230_hw_init()
1382 * CTRIM = 0.9 pF in at86rf230_hw_init()
1384 * (12+0.9+3)/2 = 7.95 which is nearly at 8 pF in at86rf230_hw_init()
1390 * CL = 16 pF in at86rf230_hw_init()
1391 * CX = 22 pF in at86rf230_hw_init()
1392 * CPAR = 3 pF (We assume the magic constant from datasheet) in at86rf230_hw_init()
1393 * CTRIM = 4.5 pF in at86rf230_hw_init()
1395 * (22+4.5+3)/2 = 14.75 which is the nearest value to 16 pF in at86rf230_hw_init()
1407 dev_err(&lp->spi->dev, "DVDD error\n"); in at86rf230_hw_init()
1408 return -EINVAL; in at86rf230_hw_init()
1422 struct at86rf230_platform_data *pdata = spi->dev.platform_data; in at86rf230_get_pdata()
1425 if (!IS_ENABLED(CONFIG_OF) || !spi->dev.of_node) { in at86rf230_get_pdata()
1427 return -ENOENT; in at86rf230_get_pdata()
1429 *rstn = pdata->rstn; in at86rf230_get_pdata()
1430 *slp_tr = pdata->slp_tr; in at86rf230_get_pdata()
1431 *xtal_trim = pdata->xtal_trim; in at86rf230_get_pdata()
1435 *rstn = of_get_named_gpio(spi->dev.of_node, "reset-gpio", 0); in at86rf230_get_pdata()
1436 *slp_tr = of_get_named_gpio(spi->dev.of_node, "sleep-gpio", 0); in at86rf230_get_pdata()
1437 ret = of_property_read_u8(spi->dev.of_node, "xtal-trim", xtal_trim); in at86rf230_get_pdata()
1438 if (ret < 0 && ret != -EINVAL) in at86rf230_get_pdata()
1471 dev_err(&lp->spi->dev, "Non-Atmel dev found (MAN_ID %02x %02x)\n", in at86rf230_detect_device()
1473 return -EINVAL; in at86rf230_detect_device()
1476 lp->hw->flags = IEEE802154_HW_TX_OMIT_CKSUM | in at86rf230_detect_device()
1481 lp->hw->phy->flags = WPAN_PHY_FLAG_TXPOWER | in at86rf230_detect_device()
1485 lp->hw->phy->supported.cca_modes = BIT(NL802154_CCA_ENERGY) | in at86rf230_detect_device()
1487 lp->hw->phy->supported.cca_opts = BIT(NL802154_CCA_OPT_ENERGY_CARRIER_AND) | in at86rf230_detect_device()
1490 lp->hw->phy->cca.mode = NL802154_CCA_ENERGY; in at86rf230_detect_device()
1495 rc = -ENOTSUPP; in at86rf230_detect_device()
1499 lp->data = &at86rf231_data; in at86rf230_detect_device()
1500 lp->hw->phy->supported.channels[0] = 0x7FFF800; in at86rf230_detect_device()
1501 lp->hw->phy->current_channel = 11; in at86rf230_detect_device()
1502 lp->hw->phy->supported.tx_powers = at86rf231_powers; in at86rf230_detect_device()
1503 lp->hw->phy->supported.tx_powers_size = ARRAY_SIZE(at86rf231_powers); in at86rf230_detect_device()
1504 lp->hw->phy->supported.cca_ed_levels = at86rf231_ed_levels; in at86rf230_detect_device()
1505 lp->hw->phy->supported.cca_ed_levels_size = ARRAY_SIZE(at86rf231_ed_levels); in at86rf230_detect_device()
1509 lp->data = &at86rf212_data; in at86rf230_detect_device()
1510 lp->hw->flags |= IEEE802154_HW_LBT; in at86rf230_detect_device()
1511 lp->hw->phy->supported.channels[0] = 0x00007FF; in at86rf230_detect_device()
1512 lp->hw->phy->supported.channels[2] = 0x00007FF; in at86rf230_detect_device()
1513 lp->hw->phy->current_channel = 5; in at86rf230_detect_device()
1514 lp->hw->phy->supported.lbt = NL802154_SUPPORTED_BOOL_BOTH; in at86rf230_detect_device()
1515 lp->hw->phy->supported.tx_powers = at86rf212_powers; in at86rf230_detect_device()
1516 lp->hw->phy->supported.tx_powers_size = ARRAY_SIZE(at86rf212_powers); in at86rf230_detect_device()
1517 lp->hw->phy->supported.cca_ed_levels = at86rf212_ed_levels_100; in at86rf230_detect_device()
1518 lp->hw->phy->supported.cca_ed_levels_size = ARRAY_SIZE(at86rf212_ed_levels_100); in at86rf230_detect_device()
1522 lp->data = &at86rf233_data; in at86rf230_detect_device()
1523 lp->hw->phy->supported.channels[0] = 0x7FFF800; in at86rf230_detect_device()
1524 lp->hw->phy->current_channel = 13; in at86rf230_detect_device()
1525 lp->hw->phy->supported.tx_powers = at86rf233_powers; in at86rf230_detect_device()
1526 lp->hw->phy->supported.tx_powers_size = ARRAY_SIZE(at86rf233_powers); in at86rf230_detect_device()
1527 lp->hw->phy->supported.cca_ed_levels = at86rf233_ed_levels; in at86rf230_detect_device()
1528 lp->hw->phy->supported.cca_ed_levels_size = ARRAY_SIZE(at86rf233_ed_levels); in at86rf230_detect_device()
1532 rc = -ENOTSUPP; in at86rf230_detect_device()
1536 lp->hw->phy->cca_ed_level = lp->hw->phy->supported.cca_ed_levels[7]; in at86rf230_detect_device()
1537 lp->hw->phy->transmit_power = lp->hw->phy->supported.tx_powers[0]; in at86rf230_detect_device()
1540 dev_info(&lp->spi->dev, "Detected %s chip version %d\n", chip, version); in at86rf230_detect_device()
1553 if (!spi->irq) { in at86rf230_probe()
1554 dev_err(&spi->dev, "no IRQ specified\n"); in at86rf230_probe()
1555 return -EINVAL; in at86rf230_probe()
1560 dev_err(&spi->dev, "failed to parse platform_data: %d\n", rc); in at86rf230_probe()
1565 rc = devm_gpio_request_one(&spi->dev, rstn, in at86rf230_probe()
1572 rc = devm_gpio_request_one(&spi->dev, slp_tr, in at86rf230_probe()
1589 return -ENOMEM; in at86rf230_probe()
1591 lp = hw->priv; in at86rf230_probe()
1592 lp->hw = hw; in at86rf230_probe()
1593 lp->spi = spi; in at86rf230_probe()
1594 lp->slp_tr = slp_tr; in at86rf230_probe()
1595 hw->parent = &spi->dev; in at86rf230_probe()
1596 ieee802154_random_extended_addr(&hw->phy->perm_extended_addr); in at86rf230_probe()
1598 lp->regmap = devm_regmap_init_spi(spi, &at86rf230_regmap_spi_config); in at86rf230_probe()
1599 if (IS_ERR(lp->regmap)) { in at86rf230_probe()
1600 rc = PTR_ERR(lp->regmap); in at86rf230_probe()
1601 dev_err(&spi->dev, "Failed to allocate register map: %d\n", in at86rf230_probe()
1606 at86rf230_setup_spi_messages(lp, &lp->state); in at86rf230_probe()
1607 at86rf230_setup_spi_messages(lp, &lp->tx); in at86rf230_probe()
1613 init_completion(&lp->state_complete); in at86rf230_probe()
1626 irq_type = irq_get_trigger_type(spi->irq); in at86rf230_probe()
1630 rc = devm_request_irq(&spi->dev, spi->irq, at86rf230_isr, in at86rf230_probe()
1631 IRQF_SHARED | irq_type, dev_name(&spi->dev), lp); in at86rf230_probe()
1636 disable_irq(spi->irq); in at86rf230_probe()
1641 rc = ieee802154_register_hw(lp->hw); in at86rf230_probe()
1648 ieee802154_free_hw(lp->hw); in at86rf230_probe()
1659 ieee802154_unregister_hw(lp->hw); in at86rf230_remove()
1660 ieee802154_free_hw(lp->hw); in at86rf230_remove()
1661 dev_dbg(&spi->dev, "unregistered at86rf230\n"); in at86rf230_remove()