atusb 83 drivers/net/ieee802154/atusb.c static int atusb_control_msg(struct atusb *atusb, unsigned int pipe, atusb 88 drivers/net/ieee802154/atusb.c struct usb_device *usb_dev = atusb->usb_dev; atusb 91 drivers/net/ieee802154/atusb.c if (atusb->err) atusb 92 drivers/net/ieee802154/atusb.c return atusb->err; atusb 97 drivers/net/ieee802154/atusb.c atusb->err = ret; atusb 105 drivers/net/ieee802154/atusb.c static int atusb_command(struct atusb *atusb, u8 cmd, u8 arg) atusb 107 drivers/net/ieee802154/atusb.c struct usb_device *usb_dev = atusb->usb_dev; atusb 110 drivers/net/ieee802154/atusb.c return atusb_control_msg(atusb, usb_sndctrlpipe(usb_dev, 0), atusb 114 drivers/net/ieee802154/atusb.c static int atusb_write_reg(struct atusb *atusb, u8 reg, u8 value) atusb 116 drivers/net/ieee802154/atusb.c struct usb_device *usb_dev = atusb->usb_dev; atusb 119 drivers/net/ieee802154/atusb.c return atusb_control_msg(atusb, usb_sndctrlpipe(usb_dev, 0), atusb 124 drivers/net/ieee802154/atusb.c static int atusb_read_reg(struct atusb *atusb, u8 reg) atusb 126 drivers/net/ieee802154/atusb.c struct usb_device *usb_dev = atusb->usb_dev; atusb 136 drivers/net/ieee802154/atusb.c ret = atusb_control_msg(atusb, usb_rcvctrlpipe(usb_dev, 0), atusb 150 drivers/net/ieee802154/atusb.c static int atusb_write_subreg(struct atusb *atusb, u8 reg, u8 mask, atusb 153 drivers/net/ieee802154/atusb.c struct usb_device *usb_dev = atusb->usb_dev; atusb 159 drivers/net/ieee802154/atusb.c orig = atusb_read_reg(atusb, reg); atusb 168 drivers/net/ieee802154/atusb.c ret = atusb_write_reg(atusb, reg, tmp); atusb 173 drivers/net/ieee802154/atusb.c static int atusb_read_subreg(struct atusb *lp, atusb 185 drivers/net/ieee802154/atusb.c static int atusb_get_and_clear_error(struct atusb *atusb) atusb 187 drivers/net/ieee802154/atusb.c int err = atusb->err; atusb 189 drivers/net/ieee802154/atusb.c atusb->err = 0; atusb 198 drivers/net/ieee802154/atusb.c #define SKB_ATUSB(skb) (*(struct atusb **)(skb)->cb) atusb 202 drivers/net/ieee802154/atusb.c static int atusb_submit_rx_urb(struct atusb *atusb, struct urb *urb) atusb 204 drivers/net/ieee802154/atusb.c struct usb_device *usb_dev = atusb->usb_dev; atusb 216 drivers/net/ieee802154/atusb.c SKB_ATUSB(skb) = atusb; atusb 221 drivers/net/ieee802154/atusb.c usb_anchor_urb(urb, &atusb->rx_urbs); atusb 234 drivers/net/ieee802154/atusb.c struct atusb *atusb = atusb 235 drivers/net/ieee802154/atusb.c container_of(to_delayed_work(work), struct atusb, work); atusb 236 drivers/net/ieee802154/atusb.c struct usb_device *usb_dev = atusb->usb_dev; atusb 240 drivers/net/ieee802154/atusb.c if (atusb->shutdown) atusb 244 drivers/net/ieee802154/atusb.c urb = usb_get_from_anchor(&atusb->idle_urbs); atusb 247 drivers/net/ieee802154/atusb.c ret = atusb_submit_rx_urb(atusb, urb); atusb 250 drivers/net/ieee802154/atusb.c usb_anchor_urb(urb, &atusb->idle_urbs); atusb 253 drivers/net/ieee802154/atusb.c schedule_delayed_work(&atusb->work, atusb 259 drivers/net/ieee802154/atusb.c static void atusb_tx_done(struct atusb *atusb, u8 seq) atusb 261 drivers/net/ieee802154/atusb.c struct usb_device *usb_dev = atusb->usb_dev; atusb 262 drivers/net/ieee802154/atusb.c u8 expect = atusb->tx_ack_seq; atusb 267 drivers/net/ieee802154/atusb.c ieee802154_xmit_complete(atusb->hw, atusb->tx_skb, false); atusb 274 drivers/net/ieee802154/atusb.c ieee802154_wake_queue(atusb->hw); atusb 275 drivers/net/ieee802154/atusb.c if (atusb->tx_skb) atusb 276 drivers/net/ieee802154/atusb.c dev_kfree_skb_irq(atusb->tx_skb); atusb 284 drivers/net/ieee802154/atusb.c struct atusb *atusb = SKB_ATUSB(skb); atusb 295 drivers/net/ieee802154/atusb.c atusb_tx_done(atusb, len); atusb 314 drivers/net/ieee802154/atusb.c ieee802154_rx_irqsafe(atusb->hw, skb, lqi); atusb 322 drivers/net/ieee802154/atusb.c struct atusb *atusb = SKB_ATUSB(skb); atusb 337 drivers/net/ieee802154/atusb.c usb_anchor_urb(urb, &atusb->idle_urbs); atusb 338 drivers/net/ieee802154/atusb.c if (!atusb->shutdown) atusb 339 drivers/net/ieee802154/atusb.c schedule_delayed_work(&atusb->work, 0); atusb 344 drivers/net/ieee802154/atusb.c static void atusb_free_urbs(struct atusb *atusb) atusb 349 drivers/net/ieee802154/atusb.c urb = usb_get_from_anchor(&atusb->idle_urbs); atusb 357 drivers/net/ieee802154/atusb.c static int atusb_alloc_urbs(struct atusb *atusb, int n) atusb 364 drivers/net/ieee802154/atusb.c atusb_free_urbs(atusb); atusb 367 drivers/net/ieee802154/atusb.c usb_anchor_urb(urb, &atusb->idle_urbs); atusb 382 drivers/net/ieee802154/atusb.c struct atusb *atusb = hw->priv; atusb 383 drivers/net/ieee802154/atusb.c struct usb_device *usb_dev = atusb->usb_dev; atusb 387 drivers/net/ieee802154/atusb.c atusb->tx_skb = skb; atusb 388 drivers/net/ieee802154/atusb.c atusb->tx_ack_seq++; atusb 389 drivers/net/ieee802154/atusb.c atusb->tx_dr.wIndex = cpu_to_le16(atusb->tx_ack_seq); atusb 390 drivers/net/ieee802154/atusb.c atusb->tx_dr.wLength = cpu_to_le16(skb->len); atusb 392 drivers/net/ieee802154/atusb.c usb_fill_control_urb(atusb->tx_urb, usb_dev, atusb 394 drivers/net/ieee802154/atusb.c (unsigned char *)&atusb->tx_dr, skb->data, atusb 396 drivers/net/ieee802154/atusb.c ret = usb_submit_urb(atusb->tx_urb, GFP_ATOMIC); atusb 412 drivers/net/ieee802154/atusb.c struct atusb *atusb = hw->priv; atusb 413 drivers/net/ieee802154/atusb.c struct device *dev = &atusb->usb_dev->dev; atusb 419 drivers/net/ieee802154/atusb.c atusb_write_reg(atusb, RG_SHORT_ADDR_0, addr); atusb 420 drivers/net/ieee802154/atusb.c atusb_write_reg(atusb, RG_SHORT_ADDR_1, addr >> 8); atusb 427 drivers/net/ieee802154/atusb.c atusb_write_reg(atusb, RG_PAN_ID_0, pan); atusb 428 drivers/net/ieee802154/atusb.c atusb_write_reg(atusb, RG_PAN_ID_1, pan >> 8); atusb 437 drivers/net/ieee802154/atusb.c atusb_write_reg(atusb, RG_IEEE_ADDR_0 + i, addr[i]); atusb 443 drivers/net/ieee802154/atusb.c atusb_write_subreg(atusb, SR_AACK_I_AM_COORD, 1); atusb 445 drivers/net/ieee802154/atusb.c atusb_write_subreg(atusb, SR_AACK_I_AM_COORD, 0); atusb 448 drivers/net/ieee802154/atusb.c return atusb_get_and_clear_error(atusb); atusb 453 drivers/net/ieee802154/atusb.c struct atusb *atusb = hw->priv; atusb 454 drivers/net/ieee802154/atusb.c struct usb_device *usb_dev = atusb->usb_dev; atusb 458 drivers/net/ieee802154/atusb.c schedule_delayed_work(&atusb->work, 0); atusb 459 drivers/net/ieee802154/atusb.c atusb_command(atusb, ATUSB_RX_MODE, 1); atusb 460 drivers/net/ieee802154/atusb.c ret = atusb_get_and_clear_error(atusb); atusb 462 drivers/net/ieee802154/atusb.c usb_kill_anchored_urbs(&atusb->idle_urbs); atusb 468 drivers/net/ieee802154/atusb.c struct atusb *atusb = hw->priv; atusb 469 drivers/net/ieee802154/atusb.c struct usb_device *usb_dev = atusb->usb_dev; atusb 472 drivers/net/ieee802154/atusb.c usb_kill_anchored_urbs(&atusb->idle_urbs); atusb 473 drivers/net/ieee802154/atusb.c atusb_command(atusb, ATUSB_RX_MODE, 0); atusb 474 drivers/net/ieee802154/atusb.c atusb_get_and_clear_error(atusb); atusb 486 drivers/net/ieee802154/atusb.c struct atusb *atusb = hw->priv; atusb 488 drivers/net/ieee802154/atusb.c if (atusb->data) atusb 489 drivers/net/ieee802154/atusb.c return atusb->data->set_txpower(hw, mbm); atusb 497 drivers/net/ieee802154/atusb.c struct atusb *atusb = hw->priv; atusb 502 drivers/net/ieee802154/atusb.c return atusb_write_subreg(atusb, SR_TX_PWR_23X, i); atusb 548 drivers/net/ieee802154/atusb.c struct atusb *atusb = hw->priv; atusb 575 drivers/net/ieee802154/atusb.c return atusb_write_subreg(atusb, SR_CCA_MODE, val); atusb 578 drivers/net/ieee802154/atusb.c static int hulusb_set_cca_ed_level(struct atusb *lp, int rssi_base_val) atusb 605 drivers/net/ieee802154/atusb.c struct atusb *atusb = hw->priv; atusb 610 drivers/net/ieee802154/atusb.c return atusb_write_subreg(atusb, SR_CCA_ED_THRES, i); atusb 618 drivers/net/ieee802154/atusb.c struct atusb *atusb = hw->priv; atusb 621 drivers/net/ieee802154/atusb.c if (atusb->data) { atusb 622 drivers/net/ieee802154/atusb.c ret = atusb->data->set_channel(hw, page, channel); atusb 624 drivers/net/ieee802154/atusb.c msleep(atusb->data->t_channel_switch); atusb 632 drivers/net/ieee802154/atusb.c struct atusb *atusb = hw->priv; atusb 635 drivers/net/ieee802154/atusb.c ret = atusb_write_subreg(atusb, SR_CHANNEL, channel); atusb 646 drivers/net/ieee802154/atusb.c struct atusb *lp = hw->priv; atusb 705 drivers/net/ieee802154/atusb.c struct atusb *atusb = hw->priv; atusb 708 drivers/net/ieee802154/atusb.c ret = atusb_write_subreg(atusb, SR_MIN_BE, min_be); atusb 712 drivers/net/ieee802154/atusb.c ret = atusb_write_subreg(atusb, SR_MAX_BE, max_be); atusb 716 drivers/net/ieee802154/atusb.c return atusb_write_subreg(atusb, SR_MAX_CSMA_RETRIES, retries); atusb 722 drivers/net/ieee802154/atusb.c struct atusb *atusb = hw->priv; atusb 724 drivers/net/ieee802154/atusb.c return atusb_write_subreg(atusb, SR_CSMA_LBT_MODE, on); atusb 730 drivers/net/ieee802154/atusb.c struct atusb *atusb = hw->priv; atusb 732 drivers/net/ieee802154/atusb.c return atusb_write_subreg(atusb, SR_MAX_FRAME_RETRIES, retries); atusb 738 drivers/net/ieee802154/atusb.c struct atusb *atusb = hw->priv; atusb 742 drivers/net/ieee802154/atusb.c ret = atusb_write_subreg(atusb, SR_AACK_DIS_ACK, 1); atusb 746 drivers/net/ieee802154/atusb.c ret = atusb_write_subreg(atusb, SR_AACK_PROM_MODE, 1); atusb 750 drivers/net/ieee802154/atusb.c ret = atusb_write_subreg(atusb, SR_AACK_PROM_MODE, 0); atusb 754 drivers/net/ieee802154/atusb.c ret = atusb_write_subreg(atusb, SR_AACK_DIS_ACK, 0); atusb 795 drivers/net/ieee802154/atusb.c static int atusb_get_and_show_revision(struct atusb *atusb) atusb 797 drivers/net/ieee802154/atusb.c struct usb_device *usb_dev = atusb->usb_dev; atusb 807 drivers/net/ieee802154/atusb.c ret = atusb_control_msg(atusb, usb_rcvctrlpipe(usb_dev, 0), atusb 811 drivers/net/ieee802154/atusb.c atusb->fw_ver_maj = buffer[0]; atusb 812 drivers/net/ieee802154/atusb.c atusb->fw_ver_min = buffer[1]; atusb 813 drivers/net/ieee802154/atusb.c atusb->fw_hw_type = buffer[2]; atusb 815 drivers/net/ieee802154/atusb.c switch (atusb->fw_hw_type) { atusb 820 drivers/net/ieee802154/atusb.c atusb->data = &atusb_chip_data; atusb 824 drivers/net/ieee802154/atusb.c atusb->data = &atusb_chip_data; atusb 828 drivers/net/ieee802154/atusb.c atusb->data = &hulusb_chip_data; atusb 832 drivers/net/ieee802154/atusb.c atusb->err = -ENOTSUPP; atusb 839 drivers/net/ieee802154/atusb.c atusb->fw_ver_maj, atusb->fw_ver_min, hw_name, atusb 840 drivers/net/ieee802154/atusb.c atusb->fw_hw_type); atusb 842 drivers/net/ieee802154/atusb.c if (atusb->fw_ver_maj == 0 && atusb->fw_ver_min < 2) { atusb 845 drivers/net/ieee802154/atusb.c atusb->fw_ver_maj, atusb->fw_ver_min); atusb 853 drivers/net/ieee802154/atusb.c static int atusb_get_and_show_build(struct atusb *atusb) atusb 855 drivers/net/ieee802154/atusb.c struct usb_device *usb_dev = atusb->usb_dev; atusb 863 drivers/net/ieee802154/atusb.c ret = atusb_control_msg(atusb, usb_rcvctrlpipe(usb_dev, 0), atusb 875 drivers/net/ieee802154/atusb.c static int atusb_get_and_conf_chip(struct atusb *atusb) atusb 877 drivers/net/ieee802154/atusb.c struct usb_device *usb_dev = atusb->usb_dev; atusb 880 drivers/net/ieee802154/atusb.c struct ieee802154_hw *hw = atusb->hw; atusb 882 drivers/net/ieee802154/atusb.c man_id_0 = atusb_read_reg(atusb, RG_MAN_ID_0); atusb 883 drivers/net/ieee802154/atusb.c man_id_1 = atusb_read_reg(atusb, RG_MAN_ID_1); atusb 884 drivers/net/ieee802154/atusb.c part_num = atusb_read_reg(atusb, RG_PART_NUM); atusb 885 drivers/net/ieee802154/atusb.c version_num = atusb_read_reg(atusb, RG_VERSION_NUM); atusb 887 drivers/net/ieee802154/atusb.c if (atusb->err) atusb 888 drivers/net/ieee802154/atusb.c return atusb->err; atusb 916 drivers/net/ieee802154/atusb.c atusb->hw->phy->supported.channels[0] = 0x7FFF800; atusb 917 drivers/net/ieee802154/atusb.c atusb->hw->phy->current_channel = 11; /* reset default */ atusb 918 drivers/net/ieee802154/atusb.c atusb->hw->phy->symbol_duration = 16; atusb 919 drivers/net/ieee802154/atusb.c atusb->hw->phy->supported.tx_powers = atusb_powers; atusb 920 drivers/net/ieee802154/atusb.c atusb->hw->phy->supported.tx_powers_size = ARRAY_SIZE(atusb_powers); atusb 926 drivers/net/ieee802154/atusb.c atusb->hw->phy->supported.channels[0] = 0x7FFF800; atusb 927 drivers/net/ieee802154/atusb.c atusb->hw->phy->current_channel = 11; /* reset default */ atusb 928 drivers/net/ieee802154/atusb.c atusb->hw->phy->symbol_duration = 16; atusb 929 drivers/net/ieee802154/atusb.c atusb->hw->phy->supported.tx_powers = atusb_powers; atusb 930 drivers/net/ieee802154/atusb.c atusb->hw->phy->supported.tx_powers_size = ARRAY_SIZE(atusb_powers); atusb 936 drivers/net/ieee802154/atusb.c atusb->hw->flags |= IEEE802154_HW_LBT; atusb 937 drivers/net/ieee802154/atusb.c atusb->hw->phy->supported.channels[0] = 0x00007FF; atusb 938 drivers/net/ieee802154/atusb.c atusb->hw->phy->supported.channels[2] = 0x00007FF; atusb 939 drivers/net/ieee802154/atusb.c atusb->hw->phy->current_channel = 5; atusb 940 drivers/net/ieee802154/atusb.c atusb->hw->phy->symbol_duration = 25; atusb 941 drivers/net/ieee802154/atusb.c atusb->hw->phy->supported.lbt = NL802154_SUPPORTED_BOOL_BOTH; atusb 942 drivers/net/ieee802154/atusb.c atusb->hw->phy->supported.tx_powers = at86rf212_powers; atusb 943 drivers/net/ieee802154/atusb.c atusb->hw->phy->supported.tx_powers_size = ARRAY_SIZE(at86rf212_powers); atusb 944 drivers/net/ieee802154/atusb.c atusb->hw->phy->supported.cca_ed_levels = at86rf212_ed_levels_100; atusb 945 drivers/net/ieee802154/atusb.c atusb->hw->phy->supported.cca_ed_levels_size = ARRAY_SIZE(at86rf212_ed_levels_100); atusb 962 drivers/net/ieee802154/atusb.c atusb->err = -ENODEV; atusb 966 drivers/net/ieee802154/atusb.c static int atusb_set_extended_addr(struct atusb *atusb) atusb 968 drivers/net/ieee802154/atusb.c struct usb_device *usb_dev = atusb->usb_dev; atusb 977 drivers/net/ieee802154/atusb.c if (atusb->fw_ver_maj == 0 && atusb->fw_ver_min < 3) { atusb 978 drivers/net/ieee802154/atusb.c ieee802154_random_extended_addr(&atusb->hw->phy->perm_extended_addr); atusb 987 drivers/net/ieee802154/atusb.c ret = atusb_control_msg(atusb, usb_rcvctrlpipe(usb_dev, 0), atusb 992 drivers/net/ieee802154/atusb.c ieee802154_random_extended_addr(&atusb->hw->phy->perm_extended_addr); atusb 1001 drivers/net/ieee802154/atusb.c ieee802154_random_extended_addr(&atusb->hw->phy->perm_extended_addr); atusb 1003 drivers/net/ieee802154/atusb.c atusb->hw->phy->perm_extended_addr = extended_addr; atusb 1004 drivers/net/ieee802154/atusb.c addr = swab64((__force u64)atusb->hw->phy->perm_extended_addr); atusb 1020 drivers/net/ieee802154/atusb.c struct atusb *atusb = NULL; atusb 1023 drivers/net/ieee802154/atusb.c hw = ieee802154_alloc_hw(sizeof(struct atusb), &atusb_ops); atusb 1027 drivers/net/ieee802154/atusb.c atusb = hw->priv; atusb 1028 drivers/net/ieee802154/atusb.c atusb->hw = hw; atusb 1029 drivers/net/ieee802154/atusb.c atusb->usb_dev = usb_get_dev(usb_dev); atusb 1030 drivers/net/ieee802154/atusb.c usb_set_intfdata(interface, atusb); atusb 1032 drivers/net/ieee802154/atusb.c atusb->shutdown = 0; atusb 1033 drivers/net/ieee802154/atusb.c atusb->err = 0; atusb 1034 drivers/net/ieee802154/atusb.c INIT_DELAYED_WORK(&atusb->work, atusb_work_urbs); atusb 1035 drivers/net/ieee802154/atusb.c init_usb_anchor(&atusb->idle_urbs); atusb 1036 drivers/net/ieee802154/atusb.c init_usb_anchor(&atusb->rx_urbs); atusb 1038 drivers/net/ieee802154/atusb.c if (atusb_alloc_urbs(atusb, ATUSB_NUM_RX_URBS)) atusb 1041 drivers/net/ieee802154/atusb.c atusb->tx_dr.bRequestType = ATUSB_REQ_TO_DEV; atusb 1042 drivers/net/ieee802154/atusb.c atusb->tx_dr.bRequest = ATUSB_TX; atusb 1043 drivers/net/ieee802154/atusb.c atusb->tx_dr.wValue = cpu_to_le16(0); atusb 1045 drivers/net/ieee802154/atusb.c atusb->tx_urb = usb_alloc_urb(0, GFP_KERNEL); atusb 1046 drivers/net/ieee802154/atusb.c if (!atusb->tx_urb) atusb 1051 drivers/net/ieee802154/atusb.c atusb_command(atusb, ATUSB_RF_RESET, 0); atusb 1052 drivers/net/ieee802154/atusb.c atusb_get_and_conf_chip(atusb); atusb 1053 drivers/net/ieee802154/atusb.c atusb_get_and_show_revision(atusb); atusb 1054 drivers/net/ieee802154/atusb.c atusb_get_and_show_build(atusb); atusb 1055 drivers/net/ieee802154/atusb.c atusb_set_extended_addr(atusb); atusb 1057 drivers/net/ieee802154/atusb.c if ((atusb->fw_ver_maj == 0 && atusb->fw_ver_min >= 3) || atusb->fw_ver_maj > 0) atusb 1060 drivers/net/ieee802154/atusb.c ret = atusb_get_and_clear_error(atusb); atusb 1062 drivers/net/ieee802154/atusb.c dev_err(&atusb->usb_dev->dev, atusb 1076 drivers/net/ieee802154/atusb.c atusb_write_reg(atusb, RG_TRX_STATE, STATE_FORCE_TRX_OFF); atusb 1102 drivers/net/ieee802154/atusb.c atusb_write_subreg(atusb, SR_RX_SAFE_MODE, 1); atusb 1104 drivers/net/ieee802154/atusb.c atusb_write_reg(atusb, RG_IRQ_MASK, 0xff); atusb 1106 drivers/net/ieee802154/atusb.c ret = atusb_get_and_clear_error(atusb); atusb 1110 drivers/net/ieee802154/atusb.c dev_err(&atusb->usb_dev->dev, atusb 1116 drivers/net/ieee802154/atusb.c atusb_free_urbs(atusb); atusb 1117 drivers/net/ieee802154/atusb.c usb_kill_urb(atusb->tx_urb); atusb 1118 drivers/net/ieee802154/atusb.c usb_free_urb(atusb->tx_urb); atusb 1126 drivers/net/ieee802154/atusb.c struct atusb *atusb = usb_get_intfdata(interface); atusb 1128 drivers/net/ieee802154/atusb.c dev_dbg(&atusb->usb_dev->dev, "%s\n", __func__); atusb 1130 drivers/net/ieee802154/atusb.c atusb->shutdown = 1; atusb 1131 drivers/net/ieee802154/atusb.c cancel_delayed_work_sync(&atusb->work); atusb 1133 drivers/net/ieee802154/atusb.c usb_kill_anchored_urbs(&atusb->rx_urbs); atusb 1134 drivers/net/ieee802154/atusb.c atusb_free_urbs(atusb); atusb 1135 drivers/net/ieee802154/atusb.c usb_kill_urb(atusb->tx_urb); atusb 1136 drivers/net/ieee802154/atusb.c usb_free_urb(atusb->tx_urb); atusb 1138 drivers/net/ieee802154/atusb.c ieee802154_unregister_hw(atusb->hw); atusb 1140 drivers/net/ieee802154/atusb.c usb_put_dev(atusb->usb_dev); atusb 1142 drivers/net/ieee802154/atusb.c ieee802154_free_hw(atusb->hw);