Lines Matching +full:supported +full:- +full:hw
1 // SPDX-License-Identifier: GPL-2.0-only
3 * atusb.c - Driver for the ATUSB IEEE 802.15.4 dongle
7 * Copyright (c) 2015 - 2016 Stefan Schmidt <stefan@datenfreihafen.org>
12 * Written by: Dmitry Eremin-Solenikov <dmitry.baryshkov@siemens.com>
46 struct ieee802154_hw *hw; member
49 int shutdown; /* non-zero if shutting down */
80 struct usb_device *usb_dev = atusb->usb_dev; in atusb_write_subreg()
84 dev_dbg(&usb_dev->dev, "%s: 0x%02x <- 0x%02x\n", __func__, reg, value); in atusb_write_subreg()
110 ret = usb_control_msg_recv(lp->usb_dev, 0, ATUSB_REG_READ, ATUSB_REQ_FROM_DEV, in atusb_read_subreg()
122 int err = atusb->err; in atusb_get_and_clear_error()
124 atusb->err = 0; in atusb_get_and_clear_error()
128 /* ----- skb allocation ---------------------------------------------------- */
133 #define SKB_ATUSB(skb) (*(struct atusb **)(skb)->cb)
139 struct usb_device *usb_dev = atusb->usb_dev; in atusb_submit_rx_urb()
140 struct sk_buff *skb = urb->context; in atusb_submit_rx_urb()
146 dev_warn_ratelimited(&usb_dev->dev, in atusb_submit_rx_urb()
148 return -ENOMEM; in atusb_submit_rx_urb()
155 skb->data, MAX_RX_XFER, atusb_in, skb); in atusb_submit_rx_urb()
156 usb_anchor_urb(urb, &atusb->rx_urbs); in atusb_submit_rx_urb()
162 urb->context = NULL; in atusb_submit_rx_urb()
171 struct usb_device *usb_dev = atusb->usb_dev; in atusb_work_urbs()
175 if (atusb->shutdown) in atusb_work_urbs()
179 urb = usb_get_from_anchor(&atusb->idle_urbs); in atusb_work_urbs()
185 usb_anchor_urb(urb, &atusb->idle_urbs); in atusb_work_urbs()
186 dev_warn_ratelimited(&usb_dev->dev, in atusb_work_urbs()
188 schedule_delayed_work(&atusb->work, in atusb_work_urbs()
192 /* ----- Asynchronous USB -------------------------------------------------- */
196 struct usb_device *usb_dev = atusb->usb_dev; in atusb_tx_done()
197 u8 expect = atusb->tx_ack_seq; in atusb_tx_done()
199 dev_dbg(&usb_dev->dev, "%s (0x%02x/0x%02x)\n", __func__, seq, expect); in atusb_tx_done()
203 ieee802154_xmit_complete(atusb->hw, atusb->tx_skb, false); in atusb_tx_done()
205 ieee802154_xmit_error(atusb->hw, atusb->tx_skb, reason); in atusb_tx_done()
212 ieee802154_xmit_hw_error(atusb->hw, atusb->tx_skb); in atusb_tx_done()
218 struct usb_device *usb_dev = urb->dev; in atusb_in_good()
219 struct sk_buff *skb = urb->context; in atusb_in_good()
224 if (!urb->actual_length) { in atusb_in_good()
225 dev_dbg(&usb_dev->dev, "atusb_in: zero-sized URB ?\n"); in atusb_in_good()
229 len = *skb->data; in atusb_in_good()
231 switch (urb->actual_length) { in atusb_in_good()
233 trac = TRAC_MASK(*(skb->data + 1)); in atusb_in_good()
255 if (len + 1 > urb->actual_length - 1) { in atusb_in_good()
256 dev_dbg(&usb_dev->dev, "atusb_in: frame len %d+1 > URB %u-1\n", in atusb_in_good()
257 len, urb->actual_length); in atusb_in_good()
262 dev_dbg(&usb_dev->dev, "atusb_in: frame corrupted\n"); in atusb_in_good()
266 lqi = skb->data[len + 1]; in atusb_in_good()
267 dev_dbg(&usb_dev->dev, "atusb_in: rx len %d lqi 0x%02x\n", len, lqi); in atusb_in_good()
270 ieee802154_rx_irqsafe(atusb->hw, skb, lqi); in atusb_in_good()
271 urb->context = NULL; /* skb is gone */ in atusb_in_good()
276 struct usb_device *usb_dev = urb->dev; in atusb_in()
277 struct sk_buff *skb = urb->context; in atusb_in()
280 dev_dbg(&usb_dev->dev, "%s: status %d len %d\n", __func__, in atusb_in()
281 urb->status, urb->actual_length); in atusb_in()
282 if (urb->status) { in atusb_in()
283 if (urb->status == -ENOENT) { /* being killed */ in atusb_in()
285 urb->context = NULL; in atusb_in()
288 dev_dbg(&usb_dev->dev, "%s: URB error %d\n", __func__, urb->status); in atusb_in()
293 usb_anchor_urb(urb, &atusb->idle_urbs); in atusb_in()
294 if (!atusb->shutdown) in atusb_in()
295 schedule_delayed_work(&atusb->work, 0); in atusb_in()
298 /* ----- URB allocation/deallocation --------------------------------------- */
305 urb = usb_get_from_anchor(&atusb->idle_urbs); in atusb_free_urbs()
308 kfree_skb(urb->context); in atusb_free_urbs()
321 return -ENOMEM; in atusb_alloc_urbs()
323 usb_anchor_urb(urb, &atusb->idle_urbs); in atusb_alloc_urbs()
325 n--; in atusb_alloc_urbs()
330 /* ----- IEEE 802.15.4 interface operations -------------------------------- */
334 dev_dbg(&urb->dev->dev, "atusb_xmit urb completed"); in atusb_xmit_complete()
337 static int atusb_xmit(struct ieee802154_hw *hw, struct sk_buff *skb) in atusb_xmit() argument
339 struct atusb *atusb = hw->priv; in atusb_xmit()
340 struct usb_device *usb_dev = atusb->usb_dev; in atusb_xmit()
343 dev_dbg(&usb_dev->dev, "%s (%d)\n", __func__, skb->len); in atusb_xmit()
344 atusb->tx_skb = skb; in atusb_xmit()
345 atusb->tx_ack_seq++; in atusb_xmit()
346 atusb->tx_dr.wIndex = cpu_to_le16(atusb->tx_ack_seq); in atusb_xmit()
347 atusb->tx_dr.wLength = cpu_to_le16(skb->len); in atusb_xmit()
349 usb_fill_control_urb(atusb->tx_urb, usb_dev, in atusb_xmit()
351 (unsigned char *)&atusb->tx_dr, skb->data, in atusb_xmit()
352 skb->len, atusb_xmit_complete, NULL); in atusb_xmit()
353 ret = usb_submit_urb(atusb->tx_urb, GFP_ATOMIC); in atusb_xmit()
354 dev_dbg(&usb_dev->dev, "%s done (%d)\n", __func__, ret); in atusb_xmit()
358 static int atusb_ed(struct ieee802154_hw *hw, u8 *level) in atusb_ed() argument
365 static int atusb_set_hw_addr_filt(struct ieee802154_hw *hw, in atusb_set_hw_addr_filt() argument
369 struct atusb *atusb = hw->priv; in atusb_set_hw_addr_filt()
370 struct device *dev = &atusb->usb_dev->dev; in atusb_set_hw_addr_filt()
373 u16 addr = le16_to_cpu(filt->short_addr); in atusb_set_hw_addr_filt()
376 usb_control_msg_send(atusb->usb_dev, 0, ATUSB_REG_WRITE, ATUSB_REQ_TO_DEV, in atusb_set_hw_addr_filt()
379 usb_control_msg_send(atusb->usb_dev, 0, ATUSB_REG_WRITE, ATUSB_REQ_TO_DEV, in atusb_set_hw_addr_filt()
384 u16 pan = le16_to_cpu(filt->pan_id); in atusb_set_hw_addr_filt()
387 usb_control_msg_send(atusb->usb_dev, 0, ATUSB_REG_WRITE, ATUSB_REQ_TO_DEV, in atusb_set_hw_addr_filt()
390 usb_control_msg_send(atusb->usb_dev, 0, ATUSB_REG_WRITE, ATUSB_REQ_TO_DEV, in atusb_set_hw_addr_filt()
397 memcpy(addr, &filt->ieee_addr, IEEE802154_EXTENDED_ADDR_LEN); in atusb_set_hw_addr_filt()
400 usb_control_msg_send(atusb->usb_dev, 0, ATUSB_REG_WRITE, ATUSB_REQ_TO_DEV, in atusb_set_hw_addr_filt()
407 if (filt->pan_coord) in atusb_set_hw_addr_filt()
416 static int atusb_start(struct ieee802154_hw *hw) in atusb_start() argument
418 struct atusb *atusb = hw->priv; in atusb_start()
419 struct usb_device *usb_dev = atusb->usb_dev; in atusb_start()
422 dev_dbg(&usb_dev->dev, "%s\n", __func__); in atusb_start()
423 schedule_delayed_work(&atusb->work, 0); in atusb_start()
424 usb_control_msg_send(atusb->usb_dev, 0, ATUSB_RX_MODE, ATUSB_REQ_TO_DEV, 1, 0, in atusb_start()
428 usb_kill_anchored_urbs(&atusb->idle_urbs); in atusb_start()
432 static void atusb_stop(struct ieee802154_hw *hw) in atusb_stop() argument
434 struct atusb *atusb = hw->priv; in atusb_stop()
435 struct usb_device *usb_dev = atusb->usb_dev; in atusb_stop()
437 dev_dbg(&usb_dev->dev, "%s\n", __func__); in atusb_stop()
438 usb_kill_anchored_urbs(&atusb->idle_urbs); in atusb_stop()
439 usb_control_msg_send(atusb->usb_dev, 0, ATUSB_RX_MODE, ATUSB_REQ_TO_DEV, 0, 0, in atusb_stop()
446 300, 280, 230, 180, 130, 70, 0, -100, -200, -300, -400, -500, -700,
447 -900, -1200, -1700,
451 atusb_txpower(struct ieee802154_hw *hw, s32 mbm) in atusb_txpower() argument
453 struct atusb *atusb = hw->priv; in atusb_txpower()
455 if (atusb->data) in atusb_txpower()
456 return atusb->data->set_txpower(hw, mbm); in atusb_txpower()
458 return -ENOTSUPP; in atusb_txpower()
462 atusb_set_txpower(struct ieee802154_hw *hw, s32 mbm) in atusb_set_txpower() argument
464 struct atusb *atusb = hw->priv; in atusb_set_txpower()
467 for (i = 0; i < hw->phy->supported.tx_powers_size; i++) { in atusb_set_txpower()
468 if (hw->phy->supported.tx_powers[i] == mbm) in atusb_set_txpower()
472 return -EINVAL; in atusb_set_txpower()
476 hulusb_set_txpower(struct ieee802154_hw *hw, s32 mbm) in hulusb_set_txpower() argument
480 for (i = 0; i < hw->phy->supported.tx_powers_size; i++) { in hulusb_set_txpower()
481 if (hw->phy->supported.tx_powers[i] == mbm) in hulusb_set_txpower()
482 return atusb_write_subreg(hw->priv, SR_TX_PWR_212, i); in hulusb_set_txpower()
485 return -EINVAL; in hulusb_set_txpower()
490 -9100, -8900, -8700, -8500, -8300, -8100, -7900, -7700, -7500, -7300,
491 -7100, -6900, -6700, -6500, -6300, -6100,
496 500, 400, 300, 200, 100, 0, -100, -200, -300, -400, -500, -600, -700,
497 -800, -900, -1000, -1100, -1200, -1300, -1400, -1500, -1600, -1700,
498 -1800, -1900, -2000, -2100, -2200, -2300, -2400, -2500, -2600,
503 -10000, -9800, -9600, -9400, -9200, -9000, -8800, -8600, -8400, -8200,
504 -8000, -7800, -7600, -7400, -7200, -7000,
508 -9800, -9600, -9400, -9200, -9000, -8800, -8600, -8400, -8200, -8000,
509 -7800, -7600, -7400, -7200, -7000, -6800,
513 atusb_set_cca_mode(struct ieee802154_hw *hw, const struct wpan_phy_cca *cca) in atusb_set_cca_mode() argument
515 struct atusb *atusb = hw->priv; in atusb_set_cca_mode()
519 switch (cca->mode) { in atusb_set_cca_mode()
527 switch (cca->opt) { in atusb_set_cca_mode()
535 return -EINVAL; in atusb_set_cca_mode()
539 return -EINVAL; in atusb_set_cca_mode()
554 case -98: in hulusb_set_cca_ed_level()
555 lp->hw->phy->supported.cca_ed_levels = at86rf212_ed_levels_98; in hulusb_set_cca_ed_level()
556 lp->hw->phy->supported.cca_ed_levels_size = ARRAY_SIZE(at86rf212_ed_levels_98); in hulusb_set_cca_ed_level()
557 lp->hw->phy->cca_ed_level = at86rf212_ed_levels_98[cca_ed_thres]; in hulusb_set_cca_ed_level()
559 case -100: in hulusb_set_cca_ed_level()
560 lp->hw->phy->supported.cca_ed_levels = at86rf212_ed_levels_100; in hulusb_set_cca_ed_level()
561 lp->hw->phy->supported.cca_ed_levels_size = ARRAY_SIZE(at86rf212_ed_levels_100); in hulusb_set_cca_ed_level()
562 lp->hw->phy->cca_ed_level = at86rf212_ed_levels_100[cca_ed_thres]; in hulusb_set_cca_ed_level()
572 atusb_set_cca_ed_level(struct ieee802154_hw *hw, s32 mbm) in atusb_set_cca_ed_level() argument
574 struct atusb *atusb = hw->priv; in atusb_set_cca_ed_level()
577 for (i = 0; i < hw->phy->supported.cca_ed_levels_size; i++) { in atusb_set_cca_ed_level()
578 if (hw->phy->supported.cca_ed_levels[i] == mbm) in atusb_set_cca_ed_level()
582 return -EINVAL; in atusb_set_cca_ed_level()
585 static int atusb_channel(struct ieee802154_hw *hw, u8 page, u8 channel) in atusb_channel() argument
587 struct atusb *atusb = hw->priv; in atusb_channel()
588 int ret = -ENOTSUPP; in atusb_channel()
590 if (atusb->data) { in atusb_channel()
591 ret = atusb->data->set_channel(hw, page, channel); in atusb_channel()
593 msleep(atusb->data->t_channel_switch); in atusb_channel()
599 static int atusb_set_channel(struct ieee802154_hw *hw, u8 page, u8 channel) in atusb_set_channel() argument
601 struct atusb *atusb = hw->priv; in atusb_set_channel()
610 static int hulusb_set_channel(struct ieee802154_hw *hw, u8 page, u8 channel) in hulusb_set_channel() argument
615 struct atusb *lp = hw->priv; in hulusb_set_channel()
626 rssi_base_val = -100; in hulusb_set_channel()
629 rssi_base_val = -98; in hulusb_set_channel()
642 atusb_set_csma_params(struct ieee802154_hw *hw, u8 min_be, u8 max_be, u8 retries) in atusb_set_csma_params() argument
644 struct atusb *atusb = hw->priv; in atusb_set_csma_params()
659 hulusb_set_lbt(struct ieee802154_hw *hw, bool on) in hulusb_set_lbt() argument
661 struct atusb *atusb = hw->priv; in hulusb_set_lbt()
667 atusb_set_frame_retries(struct ieee802154_hw *hw, s8 retries) in atusb_set_frame_retries() argument
669 struct atusb *atusb = hw->priv; in atusb_set_frame_retries()
675 atusb_set_promiscuous_mode(struct ieee802154_hw *hw, const bool on) in atusb_set_promiscuous_mode() argument
677 struct atusb *atusb = hw->priv; in atusb_set_promiscuous_mode()
703 .rssi_base_val = -91,
710 .rssi_base_val = -100,
732 /* ----- Firmware and chip version information ----------------------------- */
736 struct usb_device *usb_dev = atusb->usb_dev; in atusb_get_and_show_revision()
742 ret = usb_control_msg_recv(atusb->usb_dev, 0, ATUSB_ID, ATUSB_REQ_FROM_DEV, 0, 0, in atusb_get_and_show_revision()
745 atusb->fw_ver_maj = buffer[0]; in atusb_get_and_show_revision()
746 atusb->fw_ver_min = buffer[1]; in atusb_get_and_show_revision()
747 atusb->fw_hw_type = buffer[2]; in atusb_get_and_show_revision()
749 switch (atusb->fw_hw_type) { in atusb_get_and_show_revision()
754 atusb->data = &atusb_chip_data; in atusb_get_and_show_revision()
758 atusb->data = &atusb_chip_data; in atusb_get_and_show_revision()
762 atusb->data = &hulusb_chip_data; in atusb_get_and_show_revision()
766 atusb->err = -ENOTSUPP; in atusb_get_and_show_revision()
767 ret = -ENOTSUPP; in atusb_get_and_show_revision()
771 dev_info(&usb_dev->dev, in atusb_get_and_show_revision()
773 atusb->fw_ver_maj, atusb->fw_ver_min, hw_name, in atusb_get_and_show_revision()
774 atusb->fw_hw_type); in atusb_get_and_show_revision()
776 if (atusb->fw_ver_maj == 0 && atusb->fw_ver_min < 2) { in atusb_get_and_show_revision()
777 dev_info(&usb_dev->dev, in atusb_get_and_show_revision()
779 atusb->fw_ver_maj, atusb->fw_ver_min); in atusb_get_and_show_revision()
780 dev_info(&usb_dev->dev, "Please update to version 0.2 or newer"); in atusb_get_and_show_revision()
788 struct usb_device *usb_dev = atusb->usb_dev; in atusb_get_and_show_build()
794 return -ENOMEM; in atusb_get_and_show_build()
796 ret = usb_control_msg(atusb->usb_dev, usb_rcvctrlpipe(usb_dev, 0), ATUSB_BUILD, in atusb_get_and_show_build()
800 dev_info(&usb_dev->dev, "Firmware: build %s\n", build); in atusb_get_and_show_build()
809 struct usb_device *usb_dev = atusb->usb_dev; in atusb_get_and_conf_chip()
812 struct ieee802154_hw *hw = atusb->hw; in atusb_get_and_conf_chip() local
835 hw->flags = IEEE802154_HW_TX_OMIT_CKSUM | IEEE802154_HW_AFILT | in atusb_get_and_conf_chip()
838 hw->phy->flags = WPAN_PHY_FLAG_TXPOWER | WPAN_PHY_FLAG_CCA_ED_LEVEL | in atusb_get_and_conf_chip()
841 hw->phy->supported.cca_modes = BIT(NL802154_CCA_ENERGY) | in atusb_get_and_conf_chip()
844 hw->phy->supported.cca_opts = BIT(NL802154_CCA_OPT_ENERGY_CARRIER_AND) | in atusb_get_and_conf_chip()
847 hw->phy->cca.mode = NL802154_CCA_ENERGY; in atusb_get_and_conf_chip()
849 hw->phy->current_page = 0; in atusb_get_and_conf_chip()
852 dev_err(&usb_dev->dev, in atusb_get_and_conf_chip()
853 "non-Atmel transceiver xxxx%02x%02x\n", in atusb_get_and_conf_chip()
861 atusb->hw->phy->supported.channels[0] = 0x7FFF800; in atusb_get_and_conf_chip()
862 atusb->hw->phy->current_channel = 11; /* reset default */ in atusb_get_and_conf_chip()
863 atusb->hw->phy->supported.tx_powers = atusb_powers; in atusb_get_and_conf_chip()
864 atusb->hw->phy->supported.tx_powers_size = ARRAY_SIZE(atusb_powers); in atusb_get_and_conf_chip()
865 hw->phy->supported.cca_ed_levels = atusb_ed_levels; in atusb_get_and_conf_chip()
866 hw->phy->supported.cca_ed_levels_size = ARRAY_SIZE(atusb_ed_levels); in atusb_get_and_conf_chip()
870 atusb->hw->phy->supported.channels[0] = 0x7FFF800; in atusb_get_and_conf_chip()
871 atusb->hw->phy->current_channel = 11; /* reset default */ in atusb_get_and_conf_chip()
872 atusb->hw->phy->supported.tx_powers = atusb_powers; in atusb_get_and_conf_chip()
873 atusb->hw->phy->supported.tx_powers_size = ARRAY_SIZE(atusb_powers); in atusb_get_and_conf_chip()
874 hw->phy->supported.cca_ed_levels = atusb_ed_levels; in atusb_get_and_conf_chip()
875 hw->phy->supported.cca_ed_levels_size = ARRAY_SIZE(atusb_ed_levels); in atusb_get_and_conf_chip()
879 atusb->hw->flags |= IEEE802154_HW_LBT; in atusb_get_and_conf_chip()
880 atusb->hw->phy->supported.channels[0] = 0x00007FF; in atusb_get_and_conf_chip()
881 atusb->hw->phy->supported.channels[2] = 0x00007FF; in atusb_get_and_conf_chip()
882 atusb->hw->phy->current_channel = 5; in atusb_get_and_conf_chip()
883 atusb->hw->phy->supported.lbt = NL802154_SUPPORTED_BOOL_BOTH; in atusb_get_and_conf_chip()
884 atusb->hw->phy->supported.tx_powers = at86rf212_powers; in atusb_get_and_conf_chip()
885 atusb->hw->phy->supported.tx_powers_size = ARRAY_SIZE(at86rf212_powers); in atusb_get_and_conf_chip()
886 atusb->hw->phy->supported.cca_ed_levels = at86rf212_ed_levels_100; in atusb_get_and_conf_chip()
887 atusb->hw->phy->supported.cca_ed_levels_size = ARRAY_SIZE(at86rf212_ed_levels_100); in atusb_get_and_conf_chip()
890 dev_err(&usb_dev->dev, in atusb_get_and_conf_chip()
896 hw->phy->transmit_power = hw->phy->supported.tx_powers[0]; in atusb_get_and_conf_chip()
897 hw->phy->cca_ed_level = hw->phy->supported.cca_ed_levels[7]; in atusb_get_and_conf_chip()
899 dev_info(&usb_dev->dev, "ATUSB: %s version %d\n", chip, version_num); in atusb_get_and_conf_chip()
904 atusb->err = -ENODEV; in atusb_get_and_conf_chip()
905 return -ENODEV; in atusb_get_and_conf_chip()
910 struct usb_device *usb_dev = atusb->usb_dev; in atusb_set_extended_addr()
919 if (atusb->fw_ver_maj == 0 && atusb->fw_ver_min < 3) { in atusb_set_extended_addr()
920 ieee802154_random_extended_addr(&atusb->hw->phy->perm_extended_addr); in atusb_set_extended_addr()
925 ret = usb_control_msg_recv(atusb->usb_dev, 0, ATUSB_EUI64_READ, ATUSB_REQ_FROM_DEV, 0, 0, in atusb_set_extended_addr()
928 dev_err(&usb_dev->dev, "failed to fetch extended address, random address set\n"); in atusb_set_extended_addr()
929 ieee802154_random_extended_addr(&atusb->hw->phy->perm_extended_addr); in atusb_set_extended_addr()
936 dev_info(&usb_dev->dev, "no permanent extended address found, random address set\n"); in atusb_set_extended_addr()
937 ieee802154_random_extended_addr(&atusb->hw->phy->perm_extended_addr); in atusb_set_extended_addr()
939 atusb->hw->phy->perm_extended_addr = extended_addr; in atusb_set_extended_addr()
940 addr = swab64((__force u64)atusb->hw->phy->perm_extended_addr); in atusb_set_extended_addr()
941 dev_info(&usb_dev->dev, "Read permanent extended address %8phC from device\n", in atusb_set_extended_addr()
948 /* ----- Setup ------------------------------------------------------------- */
954 struct ieee802154_hw *hw; in atusb_probe() local
956 int ret = -ENOMEM; in atusb_probe()
958 hw = ieee802154_alloc_hw(sizeof(struct atusb), &atusb_ops); in atusb_probe()
959 if (!hw) in atusb_probe()
960 return -ENOMEM; in atusb_probe()
962 atusb = hw->priv; in atusb_probe()
963 atusb->hw = hw; in atusb_probe()
964 atusb->usb_dev = usb_get_dev(usb_dev); in atusb_probe()
967 atusb->shutdown = 0; in atusb_probe()
968 atusb->err = 0; in atusb_probe()
969 INIT_DELAYED_WORK(&atusb->work, atusb_work_urbs); in atusb_probe()
970 init_usb_anchor(&atusb->idle_urbs); in atusb_probe()
971 init_usb_anchor(&atusb->rx_urbs); in atusb_probe()
976 atusb->tx_dr.bRequestType = ATUSB_REQ_TO_DEV; in atusb_probe()
977 atusb->tx_dr.bRequest = ATUSB_TX; in atusb_probe()
978 atusb->tx_dr.wValue = cpu_to_le16(0); in atusb_probe()
980 atusb->tx_urb = usb_alloc_urb(0, GFP_KERNEL); in atusb_probe()
981 if (!atusb->tx_urb) in atusb_probe()
984 hw->parent = &usb_dev->dev; in atusb_probe()
986 usb_control_msg_send(atusb->usb_dev, 0, ATUSB_RF_RESET, ATUSB_REQ_TO_DEV, 0, 0, in atusb_probe()
993 if ((atusb->fw_ver_maj == 0 && atusb->fw_ver_min >= 3) || atusb->fw_ver_maj > 0) in atusb_probe()
994 hw->flags |= IEEE802154_HW_FRAME_RETRIES; in atusb_probe()
998 dev_err(&atusb->usb_dev->dev, in atusb_probe()
1004 ret = ieee802154_register_hw(hw); in atusb_probe()
1012 usb_control_msg_send(atusb->usb_dev, 0, ATUSB_REG_WRITE, ATUSB_REQ_TO_DEV, in atusb_probe()
1021 * According to [1], the inter-frame gap is in atusb_probe()
1031 * atusb currently needs about 500 us to retrieve a maximum-sized in atusb_probe()
1035 * [1] "JN-AN-1035 Calculating data rates in an IEEE 802.15.4-based in atusb_probe()
1037 …tp://www.jennic.com/download_file.php?supportFile=JN-AN-1035%20Calculating%20802-15-4%20Data%20Rat… in atusb_probe()
1042 usb_control_msg_send(atusb->usb_dev, 0, ATUSB_REG_WRITE, ATUSB_REQ_TO_DEV, in atusb_probe()
1049 dev_err(&atusb->usb_dev->dev, in atusb_probe()
1053 ieee802154_unregister_hw(hw); in atusb_probe()
1056 usb_kill_urb(atusb->tx_urb); in atusb_probe()
1057 usb_free_urb(atusb->tx_urb); in atusb_probe()
1059 ieee802154_free_hw(hw); in atusb_probe()
1067 dev_dbg(&atusb->usb_dev->dev, "%s\n", __func__); in atusb_disconnect()
1069 atusb->shutdown = 1; in atusb_disconnect()
1070 cancel_delayed_work_sync(&atusb->work); in atusb_disconnect()
1072 usb_kill_anchored_urbs(&atusb->rx_urbs); in atusb_disconnect()
1074 usb_kill_urb(atusb->tx_urb); in atusb_disconnect()
1075 usb_free_urb(atusb->tx_urb); in atusb_disconnect()
1077 ieee802154_unregister_hw(atusb->hw); in atusb_disconnect()
1079 usb_put_dev(atusb->usb_dev); in atusb_disconnect()
1081 ieee802154_free_hw(atusb->hw); in atusb_disconnect()