Lines Matching refs:lp
63 struct at86rf230_local *lp; member
103 at86rf230_async_state_change(struct at86rf230_local *lp,
108 at86rf230_sleep(struct at86rf230_local *lp) in at86rf230_sleep() argument
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()
119 at86rf230_awake(struct at86rf230_local *lp) in at86rf230_awake() argument
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()
130 __at86rf230_write(struct at86rf230_local *lp, in __at86rf230_write() argument
133 bool sleep = lp->sleep; in __at86rf230_write()
138 at86rf230_awake(lp); in __at86rf230_write()
140 ret = regmap_write(lp->regmap, addr, data); in __at86rf230_write()
144 at86rf230_sleep(lp); in __at86rf230_write()
150 __at86rf230_read(struct at86rf230_local *lp, in __at86rf230_read() argument
153 bool sleep = lp->sleep; in __at86rf230_read()
158 at86rf230_awake(lp); in __at86rf230_read()
160 ret = regmap_read(lp->regmap, addr, data); in __at86rf230_read()
164 at86rf230_sleep(lp); in __at86rf230_read()
170 at86rf230_read_subreg(struct at86rf230_local *lp, in at86rf230_read_subreg() argument
176 rc = __at86rf230_read(lp, addr, data); in at86rf230_read_subreg()
184 at86rf230_write_subreg(struct at86rf230_local *lp, in at86rf230_write_subreg() argument
188 bool sleep = lp->sleep; in at86rf230_write_subreg()
193 at86rf230_awake(lp); in at86rf230_write_subreg()
195 ret = regmap_update_bits(lp->regmap, addr, mask, data << shift); in at86rf230_write_subreg()
199 at86rf230_sleep(lp); in at86rf230_write_subreg()
205 at86rf230_slp_tr_rising_edge(struct at86rf230_local *lp) in at86rf230_slp_tr_rising_edge() argument
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() local
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() local
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()
353 at86rf230_async_state_change(lp, ctx, STATE_RX_AACK_ON, in at86rf230_async_error_recover()
358 at86rf230_async_error(struct at86rf230_local *lp, in at86rf230_async_error() argument
361 dev_err(&lp->spi->dev, "spi_async error %d\n", rc); in at86rf230_async_error()
363 at86rf230_async_state_change(lp, ctx, STATE_FORCE_TRX_OFF, in at86rf230_async_error()
369 at86rf230_async_read_reg(struct at86rf230_local *lp, u8 reg, in at86rf230_async_read_reg() argument
379 rc = spi_async(lp->spi, &ctx->msg); in at86rf230_async_read_reg()
381 at86rf230_async_error(lp, ctx, rc); in at86rf230_async_read_reg()
385 at86rf230_async_write_reg(struct at86rf230_local *lp, u8 reg, u8 val, in at86rf230_async_write_reg() argument
394 rc = spi_async(lp->spi, &ctx->msg); in at86rf230_async_write_reg()
396 at86rf230_async_error(lp, ctx, rc); in at86rf230_async_write_reg()
403 struct at86rf230_local *lp = ctx->lp; in at86rf230_async_state_assert() local
439 if (lp->tx_retry >= AT86RF2XX_MAX_TX_RETRIES) in at86rf230_async_state_assert()
441 lp->tx_retry++; in at86rf230_async_state_assert()
443 at86rf230_async_state_change(lp, ctx, state, 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()
462 struct at86rf230_local *lp = ctx->lp; in at86rf230_async_state_timer() local
464 at86rf230_async_read_reg(lp, RG_TRX_STATUS, ctx, in at86rf230_async_state_timer()
475 struct at86rf230_local *lp = ctx->lp; in at86rf230_async_state_delay() local
476 struct at86rf2xx_chip_data *c = lp->data; in at86rf230_async_state_delay()
507 lp->cal_timeout = jiffies + AT86RF2XX_CAL_LOOP_TIMEOUT; in at86rf230_async_state_delay()
516 lp->cal_timeout = jiffies + AT86RF2XX_CAL_LOOP_TIMEOUT; in at86rf230_async_state_delay()
566 struct at86rf230_local *lp = ctx->lp; in at86rf230_async_state_change_start() local
573 at86rf230_async_read_reg(lp, RG_TRX_STATUS, ctx, 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()
596 at86rf230_async_state_change(struct at86rf230_local *lp, in at86rf230_async_state_change() argument
603 at86rf230_async_read_reg(lp, RG_TRX_STATUS, ctx, in at86rf230_async_state_change()
611 struct at86rf230_local *lp = ctx->lp; in at86rf230_sync_state_change_complete() local
613 complete(&lp->state_complete); in at86rf230_sync_state_change_complete()
621 at86rf230_sync_state_change(struct at86rf230_local *lp, unsigned int state) in at86rf230_sync_state_change() argument
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()
642 struct at86rf230_local *lp = ctx->lp; in at86rf230_tx_complete() local
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() local
658 at86rf230_async_state_change(lp, ctx, STATE_RX_AACK_ON, in at86rf230_tx_on()
666 struct at86rf230_local *lp = ctx->lp; in at86rf230_tx_trac_check() local
684 at86rf230_async_state_change(lp, ctx, STATE_TX_ON, at86rf230_tx_on); in at86rf230_tx_trac_check()
691 struct at86rf230_local *lp = ctx->lp; in at86rf230_rx_read_frame_complete() local
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() local
726 rc = spi_async(lp->spi, &ctx->msg); in at86rf230_rx_trac_check()
729 at86rf230_async_error(lp, ctx, rc); in at86rf230_rx_trac_check()
737 struct at86rf230_local *lp = ctx->lp; in at86rf230_irq_trx_end() local
739 if (lp->is_tx) { in at86rf230_irq_trx_end()
740 lp->is_tx = 0; in at86rf230_irq_trx_end()
741 at86rf230_async_read_reg(lp, RG_TRX_STATE, ctx, in at86rf230_irq_trx_end()
744 at86rf230_async_read_reg(lp, RG_TRX_STATE, ctx, in at86rf230_irq_trx_end()
753 struct at86rf230_local *lp = ctx->lp; in at86rf230_irq_status() local
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()
769 at86rf230_setup_spi_messages(struct at86rf230_local *lp, in at86rf230_setup_spi_messages() argument
772 state->lp = lp; in at86rf230_setup_spi_messages()
773 state->irq = lp->spi->irq; in at86rf230_setup_spi_messages()
786 struct at86rf230_local *lp = data; in at86rf230_isr() local
798 at86rf230_setup_spi_messages(lp, ctx); in at86rf230_isr()
804 rc = spi_async(lp->spi, &ctx->msg); in at86rf230_isr()
806 at86rf230_async_error(lp, ctx, rc); in at86rf230_isr()
818 struct at86rf230_local *lp = ctx->lp; in at86rf230_write_frame_complete() local
822 if (gpio_is_valid(lp->slp_tr)) in at86rf230_write_frame_complete()
823 at86rf230_slp_tr_rising_edge(lp); in at86rf230_write_frame_complete()
825 at86rf230_async_write_reg(lp, RG_TRX_STATE, STATE_BUSY_TX, ctx, in at86rf230_write_frame_complete()
833 struct at86rf230_local *lp = ctx->lp; in at86rf230_write_frame() local
834 struct sk_buff *skb = lp->tx_skb; in at86rf230_write_frame()
838 lp->is_tx = 1; in at86rf230_write_frame()
845 rc = spi_async(lp->spi, &ctx->msg); in at86rf230_write_frame()
848 at86rf230_async_error(lp, ctx, rc); in at86rf230_write_frame()
856 struct at86rf230_local *lp = ctx->lp; in at86rf230_xmit_tx_on() local
858 at86rf230_async_state_change(lp, ctx, STATE_TX_ARET_ON, in at86rf230_xmit_tx_on()
866 struct at86rf230_local *lp = ctx->lp; in at86rf230_xmit_start() local
869 if (lp->is_tx_from_off) in at86rf230_xmit_start()
870 at86rf230_async_state_change(lp, ctx, STATE_TX_ARET_ON, in at86rf230_xmit_start()
873 at86rf230_async_state_change(lp, ctx, STATE_TX_ON, in at86rf230_xmit_start()
880 struct at86rf230_local *lp = hw->priv; in at86rf230_xmit() local
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()
893 if (time_is_before_jiffies(lp->cal_timeout)) { in at86rf230_xmit()
894 lp->is_tx_from_off = true; in at86rf230_xmit()
895 at86rf230_async_state_change(lp, ctx, STATE_TRX_OFF, in at86rf230_xmit()
898 lp->is_tx_from_off = false; in at86rf230_xmit()
916 struct at86rf230_local *lp = hw->priv; in at86rf230_start() local
918 at86rf230_awake(lp); in at86rf230_start()
919 enable_irq(lp->spi->irq); in at86rf230_start()
921 return at86rf230_sync_state_change(lp, STATE_RX_AACK_ON); in at86rf230_start()
927 struct at86rf230_local *lp = hw->priv; in at86rf230_stop() local
930 at86rf230_sync_state_change(lp, STATE_FORCE_TRX_OFF); in at86rf230_stop()
932 disable_irq(lp->spi->irq); in at86rf230_stop()
940 at86rf230_write_subreg(lp, SR_CSMA_SEED_0, csma_seed[0]); in at86rf230_stop()
941 at86rf230_write_subreg(lp, SR_CSMA_SEED_1, csma_seed[1]); in at86rf230_stop()
943 at86rf230_sleep(lp); in at86rf230_stop()
947 at86rf23x_set_channel(struct at86rf230_local *lp, u8 page, u8 channel) in at86rf23x_set_channel() argument
949 return at86rf230_write_subreg(lp, SR_CHANNEL, channel); in at86rf23x_set_channel()
974 at86rf212_update_cca_ed_level(struct at86rf230_local *lp, int rssi_base_val) in at86rf212_update_cca_ed_level() argument
979 rc = at86rf230_read_subreg(lp, SR_CCA_ED_THRES, &cca_ed_thres); 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()
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()
1002 at86rf212_set_channel(struct at86rf230_local *lp, u8 page, u8 channel) in at86rf212_set_channel() argument
1007 rc = at86rf230_write_subreg(lp, SR_SUB_MODE, 0); in at86rf212_set_channel()
1009 rc = at86rf230_write_subreg(lp, SR_SUB_MODE, 1); in at86rf212_set_channel()
1014 rc = at86rf230_write_subreg(lp, SR_BPSK_QPSK, 0); in at86rf212_set_channel()
1015 lp->data->rssi_base_val = -100; in at86rf212_set_channel()
1017 rc = at86rf230_write_subreg(lp, SR_BPSK_QPSK, 1); 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()
1027 return at86rf230_write_subreg(lp, SR_CHANNEL, channel); in at86rf212_set_channel()
1033 struct at86rf230_local *lp = hw->priv; in at86rf230_channel() local
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() local
1055 dev_vdbg(&lp->spi->dev, "%s called for saddr\n", __func__); in at86rf230_set_hw_addr_filt()
1056 __at86rf230_write(lp, RG_SHORT_ADDR_0, addr); in at86rf230_set_hw_addr_filt()
1057 __at86rf230_write(lp, RG_SHORT_ADDR_1, addr >> 8); 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()
1064 __at86rf230_write(lp, RG_PAN_ID_0, pan); in at86rf230_set_hw_addr_filt()
1065 __at86rf230_write(lp, RG_PAN_ID_1, pan >> 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()
1074 __at86rf230_write(lp, RG_IEEE_ADDR_0 + i, addr[i]); 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()
1080 at86rf230_write_subreg(lp, SR_AACK_I_AM_COORD, 1); in at86rf230_set_hw_addr_filt()
1082 at86rf230_write_subreg(lp, SR_AACK_I_AM_COORD, 0); in at86rf230_set_hw_addr_filt()
1107 at86rf23x_set_txpower(struct at86rf230_local *lp, s32 mbm) in at86rf23x_set_txpower() argument
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()
1113 return at86rf230_write_subreg(lp, SR_TX_PWR_23X, i); in at86rf23x_set_txpower()
1120 at86rf212_set_txpower(struct at86rf230_local *lp, s32 mbm) in at86rf212_set_txpower() argument
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()
1126 return at86rf230_write_subreg(lp, SR_TX_PWR_212, i); in at86rf212_set_txpower()
1135 struct at86rf230_local *lp = hw->priv; in at86rf230_set_txpower() local
1137 return lp->data->set_txpower(lp, mbm); in at86rf230_set_txpower()
1143 struct at86rf230_local *lp = hw->priv; in at86rf230_set_lbt() local
1145 return at86rf230_write_subreg(lp, SR_CSMA_LBT_MODE, on); in at86rf230_set_lbt()
1152 struct at86rf230_local *lp = hw->priv; in at86rf230_set_cca_mode() local
1179 return at86rf230_write_subreg(lp, SR_CCA_MODE, val); in at86rf230_set_cca_mode()
1185 struct at86rf230_local *lp = hw->priv; in at86rf230_set_cca_ed_level() local
1190 return at86rf230_write_subreg(lp, SR_CCA_ED_THRES, i); in at86rf230_set_cca_ed_level()
1200 struct at86rf230_local *lp = hw->priv; in at86rf230_set_csma_params() local
1203 rc = at86rf230_write_subreg(lp, SR_MIN_BE, min_be); in at86rf230_set_csma_params()
1207 rc = at86rf230_write_subreg(lp, SR_MAX_BE, max_be); in at86rf230_set_csma_params()
1211 return at86rf230_write_subreg(lp, SR_MAX_CSMA_RETRIES, retries); in at86rf230_set_csma_params()
1217 struct at86rf230_local *lp = hw->priv; in at86rf230_set_frame_retries() local
1219 return at86rf230_write_subreg(lp, SR_MAX_FRAME_RETRIES, retries); in at86rf230_set_frame_retries()
1225 struct at86rf230_local *lp = hw->priv; in at86rf230_set_promiscuous_mode() local
1229 rc = at86rf230_write_subreg(lp, SR_AACK_DIS_ACK, 1); in at86rf230_set_promiscuous_mode()
1233 rc = at86rf230_write_subreg(lp, SR_AACK_PROM_MODE, 1); in at86rf230_set_promiscuous_mode()
1237 rc = at86rf230_write_subreg(lp, SR_AACK_PROM_MODE, 0); in at86rf230_set_promiscuous_mode()
1241 rc = at86rf230_write_subreg(lp, SR_AACK_DIS_ACK, 0); in at86rf230_set_promiscuous_mode()
1311 static int at86rf230_hw_init(struct at86rf230_local *lp, u8 xtal_trim) in at86rf230_hw_init() argument
1317 rc = at86rf230_sync_state_change(lp, STATE_FORCE_TRX_OFF); in at86rf230_hw_init()
1321 irq_type = irq_get_trigger_type(lp->spi->irq); in at86rf230_hw_init()
1326 rc = at86rf230_write_subreg(lp, SR_IRQ_POLARITY, irq_pol); in at86rf230_hw_init()
1330 rc = at86rf230_write_subreg(lp, SR_RX_SAFE_MODE, 1); in at86rf230_hw_init()
1334 rc = at86rf230_write_subreg(lp, SR_IRQ_MASK, IRQ_TRX_END); in at86rf230_hw_init()
1339 rc = at86rf230_write_subreg(lp, SR_IRQ_MASK_MODE, 0); in at86rf230_hw_init()
1344 rc = at86rf230_write_subreg(lp, SR_CSMA_SEED_0, csma_seed[0]); in at86rf230_hw_init()
1347 rc = at86rf230_write_subreg(lp, SR_CSMA_SEED_1, csma_seed[1]); in at86rf230_hw_init()
1352 rc = at86rf230_write_subreg(lp, SR_CLKM_SHA_SEL, 0x00); in at86rf230_hw_init()
1357 rc = at86rf230_write_subreg(lp, SR_CLKM_CTRL, 0x00); 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()
1399 rc = at86rf230_write_subreg(lp, SR_XTAL_TRIM, xtal_trim); in at86rf230_hw_init()
1403 rc = at86rf230_read_subreg(lp, SR_DVDD_OK, &dvdd); in at86rf230_hw_init()
1407 dev_err(&lp->spi->dev, "DVDD error\n"); in at86rf230_hw_init()
1415 return at86rf230_write_subreg(lp, SR_SLOTTED_OPERATION, 0); in at86rf230_hw_init()
1445 at86rf230_detect_device(struct at86rf230_local *lp) in at86rf230_detect_device() argument
1452 rc = __at86rf230_read(lp, RG_MAN_ID_0, &val); in at86rf230_detect_device()
1457 rc = __at86rf230_read(lp, RG_MAN_ID_1, &val); in at86rf230_detect_device()
1462 rc = __at86rf230_read(lp, RG_PART_NUM, &part); in at86rf230_detect_device()
1466 rc = __at86rf230_read(lp, RG_VERSION_NUM, &version); in at86rf230_detect_device()
1471 dev_err(&lp->spi->dev, "Non-Atmel dev found (MAN_ID %02x %02x)\n", 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()
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()
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()
1548 struct at86rf230_local *lp; in at86rf230_probe() local
1587 hw = ieee802154_alloc_hw(sizeof(*lp), &at86rf230_ops); 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()
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()
1606 at86rf230_setup_spi_messages(lp, &lp->state); in at86rf230_probe()
1607 at86rf230_setup_spi_messages(lp, &lp->tx); in at86rf230_probe()
1609 rc = at86rf230_detect_device(lp); in at86rf230_probe()
1613 init_completion(&lp->state_complete); in at86rf230_probe()
1615 spi_set_drvdata(spi, lp); in at86rf230_probe()
1617 rc = at86rf230_hw_init(lp, xtal_trim); in at86rf230_probe()
1622 rc = at86rf230_read_subreg(lp, RG_IRQ_STATUS, 0xff, 0, &status); in at86rf230_probe()
1631 IRQF_SHARED | irq_type, dev_name(&spi->dev), lp); in at86rf230_probe()
1639 at86rf230_sleep(lp); in at86rf230_probe()
1641 rc = ieee802154_register_hw(lp->hw); in at86rf230_probe()
1648 ieee802154_free_hw(lp->hw); in at86rf230_probe()
1655 struct at86rf230_local *lp = spi_get_drvdata(spi); in at86rf230_remove() local
1658 at86rf230_write_subreg(lp, SR_IRQ_MASK, 0); in at86rf230_remove()
1659 ieee802154_unregister_hw(lp->hw); in at86rf230_remove()
1660 ieee802154_free_hw(lp->hw); in at86rf230_remove()