Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc. |
| 3 | * All rights reserved. |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 2 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License along |
| 16 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 18 | * |
| 19 | * File: main_usb.c |
| 20 | * |
| 21 | * Purpose: driver entry for initial, open, close, tx and rx. |
| 22 | * |
| 23 | * Author: Lyndon Chen |
| 24 | * |
| 25 | * Date: Dec 8, 2005 |
| 26 | * |
| 27 | * Functions: |
| 28 | * |
Andres More | 26e5b65 | 2010-04-13 19:43:07 -0300 | [diff] [blame] | 29 | * vt6656_probe - module initial (insmod) driver entry |
Malcolm Priestley | afc7ef6 | 2014-07-25 20:51:47 +0100 | [diff] [blame] | 30 | * vnt_free_tx_bufs - free tx buffer function |
Malcolm Priestley | 500e1fb | 2014-07-25 20:51:46 +0100 | [diff] [blame] | 31 | * vnt_init_registers- initial MAC & BBP & RF internal registers. |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 32 | * |
| 33 | * Revision History: |
| 34 | */ |
| 35 | #undef __NO_VERSION__ |
| 36 | |
Krzysztof Adamski | e238223 | 2014-12-09 12:01:38 +0100 | [diff] [blame] | 37 | #include <linux/etherdevice.h> |
Al Viro | 7c51d17 | 2013-04-06 18:00:07 -0400 | [diff] [blame] | 38 | #include <linux/file.h> |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 39 | #include "device.h" |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 40 | #include "card.h" |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 41 | #include "baseband.h" |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 42 | #include "mac.h" |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 43 | #include "power.h" |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 44 | #include "wcmd.h" |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 45 | #include "rxtx.h" |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 46 | #include "dpc.h" |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 47 | #include "rf.h" |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 48 | #include "firmware.h" |
Malcolm Priestley | 62c8526 | 2014-05-26 13:59:07 +0100 | [diff] [blame] | 49 | #include "usbpipe.h" |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 50 | #include "channel.h" |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 51 | #include "int.h" |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 52 | |
Andres More | ec6e0f6 | 2013-01-31 18:23:07 -0500 | [diff] [blame] | 53 | /* |
| 54 | * define module options |
| 55 | */ |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 56 | |
Andres More | ec6e0f6 | 2013-01-31 18:23:07 -0500 | [diff] [blame] | 57 | /* version information */ |
| 58 | #define DRIVER_AUTHOR \ |
| 59 | "VIA Networking Technologies, Inc., <lyndonchen@vntek.com.tw>" |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 60 | MODULE_AUTHOR(DRIVER_AUTHOR); |
| 61 | MODULE_LICENSE("GPL"); |
| 62 | MODULE_DESCRIPTION(DEVICE_FULL_DRV_NAM); |
| 63 | |
Peter Senna Tschudin | dbf0a03 | 2014-07-15 23:23:24 +0200 | [diff] [blame] | 64 | #define RX_DESC_DEF0 64 |
Malcolm Priestley | 2f020eb | 2014-07-16 22:22:06 +0100 | [diff] [blame] | 65 | static int vnt_rx_buffers = RX_DESC_DEF0; |
| 66 | module_param_named(rx_buffers, vnt_rx_buffers, int, 0644); |
| 67 | MODULE_PARM_DESC(rx_buffers, "Number of receive usb rx buffers"); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 68 | |
Peter Senna Tschudin | dbf0a03 | 2014-07-15 23:23:24 +0200 | [diff] [blame] | 69 | #define TX_DESC_DEF0 64 |
Malcolm Priestley | 3220e3a | 2014-07-16 22:22:07 +0100 | [diff] [blame] | 70 | static int vnt_tx_buffers = TX_DESC_DEF0; |
Malcolm Priestley | 1b6953d | 2014-07-18 06:36:09 +0100 | [diff] [blame] | 71 | module_param_named(tx_buffers, vnt_tx_buffers, int, 0644); |
Malcolm Priestley | 3220e3a | 2014-07-16 22:22:07 +0100 | [diff] [blame] | 72 | MODULE_PARM_DESC(tx_buffers, "Number of receive usb tx buffers"); |
| 73 | |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 74 | #define RTS_THRESH_DEF 2347 |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 75 | #define FRAG_THRESH_DEF 2346 |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 76 | #define SHORT_RETRY_DEF 8 |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 77 | #define LONG_RETRY_DEF 4 |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 78 | |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 79 | /* BasebandType[] baseband type selected |
| 80 | 0: indicate 802.11a type |
| 81 | 1: indicate 802.11b type |
| 82 | 2: indicate 802.11g type |
| 83 | */ |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 84 | |
Marcos Paulo de Souza | 24b46f9 | 2012-07-02 23:59:30 -0300 | [diff] [blame] | 85 | #define BBP_TYPE_DEF 2 |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 86 | |
Andres More | ec6e0f6 | 2013-01-31 18:23:07 -0500 | [diff] [blame] | 87 | /* |
| 88 | * Static vars definitions |
| 89 | */ |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 90 | |
Greg Kroah-Hartman | 4d08887 | 2012-08-17 17:48:33 -0700 | [diff] [blame] | 91 | static struct usb_device_id vt6656_table[] = { |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 92 | {USB_DEVICE(VNT_USB_VENDOR_ID, VNT_USB_PRODUCT_ID)}, |
| 93 | {} |
| 94 | }; |
| 95 | |
Malcolm Priestley | 7665cf2 | 2014-07-25 20:51:45 +0100 | [diff] [blame] | 96 | static void vnt_set_options(struct vnt_private *priv) |
Malcolm Priestley | 28e067f | 2014-07-16 22:21:59 +0100 | [diff] [blame] | 97 | { |
Malcolm Priestley | 3220e3a | 2014-07-16 22:22:07 +0100 | [diff] [blame] | 98 | /* Set number of TX buffers */ |
| 99 | if (vnt_tx_buffers < CB_MIN_TX_DESC || vnt_tx_buffers > CB_MAX_TX_DESC) |
Malcolm Priestley | 03b7e35 | 2014-07-19 12:30:04 +0100 | [diff] [blame] | 100 | priv->num_tx_context = TX_DESC_DEF0; |
Malcolm Priestley | 3220e3a | 2014-07-16 22:22:07 +0100 | [diff] [blame] | 101 | else |
Malcolm Priestley | 03b7e35 | 2014-07-19 12:30:04 +0100 | [diff] [blame] | 102 | priv->num_tx_context = vnt_tx_buffers; |
Malcolm Priestley | 2f020eb | 2014-07-16 22:22:06 +0100 | [diff] [blame] | 103 | |
| 104 | /* Set number of RX buffers */ |
| 105 | if (vnt_rx_buffers < CB_MIN_RX_DESC || vnt_rx_buffers > CB_MAX_RX_DESC) |
Malcolm Priestley | 6da4738 | 2014-07-19 12:30:03 +0100 | [diff] [blame] | 106 | priv->num_rcb = RX_DESC_DEF0; |
Malcolm Priestley | 2f020eb | 2014-07-16 22:22:06 +0100 | [diff] [blame] | 107 | else |
Malcolm Priestley | 6da4738 | 2014-07-19 12:30:03 +0100 | [diff] [blame] | 108 | priv->num_rcb = vnt_rx_buffers; |
Malcolm Priestley | 2f020eb | 2014-07-16 22:22:06 +0100 | [diff] [blame] | 109 | |
Malcolm Priestley | 388e5cb | 2014-07-20 15:33:20 +0100 | [diff] [blame] | 110 | priv->short_retry_limit = SHORT_RETRY_DEF; |
| 111 | priv->long_retry_limit = LONG_RETRY_DEF; |
Malcolm Priestley | da3b67b | 2014-07-16 22:22:00 +0100 | [diff] [blame] | 112 | priv->op_mode = NL80211_IFTYPE_UNSPECIFIED; |
Malcolm Priestley | 65df77e | 2014-07-20 15:33:11 +0100 | [diff] [blame] | 113 | priv->bb_type = BBP_TYPE_DEF; |
Malcolm Priestley | e12471d | 2014-07-20 15:33:12 +0100 | [diff] [blame] | 114 | priv->packet_type = priv->bb_type; |
Malcolm Priestley | a6177ae | 2014-07-20 15:33:24 +0100 | [diff] [blame] | 115 | priv->auto_fb_ctrl = AUTO_FB_0; |
Malcolm Priestley | 98e93fe | 2014-07-20 15:33:17 +0100 | [diff] [blame] | 116 | priv->preamble_type = 0; |
Malcolm Priestley | 35cc8f9 | 2014-07-19 12:30:12 +0100 | [diff] [blame] | 117 | priv->exist_sw_net_addr = false; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 118 | } |
| 119 | |
Andres More | ec6e0f6 | 2013-01-31 18:23:07 -0500 | [diff] [blame] | 120 | /* |
| 121 | * initialization of MAC & BBP registers |
| 122 | */ |
Malcolm Priestley | 500e1fb | 2014-07-25 20:51:46 +0100 | [diff] [blame] | 123 | static int vnt_init_registers(struct vnt_private *priv) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 124 | { |
Malcolm Priestley | 3ce5493 | 2014-07-16 22:22:01 +0100 | [diff] [blame] | 125 | struct vnt_cmd_card_init *init_cmd = &priv->init_command; |
| 126 | struct vnt_rsp_card_init *init_rsp = &priv->init_response; |
| 127 | u8 antenna; |
Malcolm Priestley | dd0a774 | 2012-12-10 21:59:10 +0000 | [diff] [blame] | 128 | int ii; |
Malcolm Priestley | 3ce5493 | 2014-07-16 22:22:01 +0100 | [diff] [blame] | 129 | int status = STATUS_SUCCESS; |
| 130 | u8 tmp; |
| 131 | u8 calib_tx_iq = 0, calib_tx_dc = 0, calib_rx_iq = 0; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 132 | |
Malcolm Priestley | 4e62dcc9 | 2014-07-16 22:22:02 +0100 | [diff] [blame] | 133 | dev_dbg(&priv->usb->dev, "---->INIbInitAdapter. [%d][%d]\n", |
Malcolm Priestley | e12471d | 2014-07-20 15:33:12 +0100 | [diff] [blame] | 134 | DEVICE_INIT_COLD, priv->packet_type); |
Malcolm Priestley | 302433d | 2013-11-03 17:40:51 +0000 | [diff] [blame] | 135 | |
Malcolm Priestley | 3ce5493 | 2014-07-16 22:22:01 +0100 | [diff] [blame] | 136 | if (!vnt_check_firmware_version(priv)) { |
| 137 | if (vnt_download_firmware(priv) == true) { |
| 138 | if (vnt_firmware_branch_to_sram(priv) == false) { |
Malcolm Priestley | 4e62dcc9 | 2014-07-16 22:22:02 +0100 | [diff] [blame] | 139 | dev_dbg(&priv->usb->dev, |
Malcolm Priestley | 1432146 | 2014-06-04 18:25:32 +0100 | [diff] [blame] | 140 | " vnt_firmware_branch_to_sram fail\n"); |
Malcolm Priestley | cbc06fb | 2013-11-03 17:52:15 +0000 | [diff] [blame] | 141 | return false; |
| 142 | } |
| 143 | } else { |
Malcolm Priestley | 4e62dcc9 | 2014-07-16 22:22:02 +0100 | [diff] [blame] | 144 | dev_dbg(&priv->usb->dev, "FIRMWAREbDownload fail\n"); |
Malcolm Priestley | cbc06fb | 2013-11-03 17:52:15 +0000 | [diff] [blame] | 145 | return false; |
| 146 | } |
| 147 | } |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 148 | |
Malcolm Priestley | 3ce5493 | 2014-07-16 22:22:01 +0100 | [diff] [blame] | 149 | if (!vnt_vt3184_init(priv)) { |
Malcolm Priestley | 4e62dcc9 | 2014-07-16 22:22:02 +0100 | [diff] [blame] | 150 | dev_dbg(&priv->usb->dev, "vnt_vt3184_init fail\n"); |
Malcolm Priestley | cbc06fb | 2013-11-03 17:52:15 +0000 | [diff] [blame] | 151 | return false; |
| 152 | } |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 153 | |
Malcolm Priestley | 748bf69 | 2013-11-03 17:49:32 +0000 | [diff] [blame] | 154 | init_cmd->init_class = DEVICE_INIT_COLD; |
Malcolm Priestley | 35cc8f9 | 2014-07-19 12:30:12 +0100 | [diff] [blame] | 155 | init_cmd->exist_sw_net_addr = priv->exist_sw_net_addr; |
Malcolm Priestley | 3d47a6f | 2013-11-03 17:43:23 +0000 | [diff] [blame] | 156 | for (ii = 0; ii < 6; ii++) |
Malcolm Priestley | ebf9b31 | 2014-07-19 12:30:10 +0100 | [diff] [blame] | 157 | init_cmd->sw_net_addr[ii] = priv->current_net_addr[ii]; |
Malcolm Priestley | 388e5cb | 2014-07-20 15:33:20 +0100 | [diff] [blame] | 158 | init_cmd->short_retry_limit = priv->short_retry_limit; |
| 159 | init_cmd->long_retry_limit = priv->long_retry_limit; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 160 | |
Malcolm Priestley | 3d47a6f | 2013-11-03 17:43:23 +0000 | [diff] [blame] | 161 | /* issue card_init command to device */ |
Malcolm Priestley | 3ce5493 | 2014-07-16 22:22:01 +0100 | [diff] [blame] | 162 | status = vnt_control_out(priv, |
Malcolm Priestley | 3d47a6f | 2013-11-03 17:43:23 +0000 | [diff] [blame] | 163 | MESSAGE_TYPE_CARDINIT, 0, 0, |
Malcolm Priestley | 748bf69 | 2013-11-03 17:49:32 +0000 | [diff] [blame] | 164 | sizeof(struct vnt_cmd_card_init), (u8 *)init_cmd); |
Malcolm Priestley | 3ce5493 | 2014-07-16 22:22:01 +0100 | [diff] [blame] | 165 | if (status != STATUS_SUCCESS) { |
Malcolm Priestley | 4e62dcc9 | 2014-07-16 22:22:02 +0100 | [diff] [blame] | 166 | dev_dbg(&priv->usb->dev, "Issue Card init fail\n"); |
Malcolm Priestley | cbc06fb | 2013-11-03 17:52:15 +0000 | [diff] [blame] | 167 | return false; |
| 168 | } |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 169 | |
Malcolm Priestley | 3ce5493 | 2014-07-16 22:22:01 +0100 | [diff] [blame] | 170 | status = vnt_control_in(priv, MESSAGE_TYPE_INIT_RSP, 0, 0, |
Malcolm Priestley | 748bf69 | 2013-11-03 17:49:32 +0000 | [diff] [blame] | 171 | sizeof(struct vnt_rsp_card_init), (u8 *)init_rsp); |
Malcolm Priestley | 3ce5493 | 2014-07-16 22:22:01 +0100 | [diff] [blame] | 172 | if (status != STATUS_SUCCESS) { |
Malcolm Priestley | 4e62dcc9 | 2014-07-16 22:22:02 +0100 | [diff] [blame] | 173 | dev_dbg(&priv->usb->dev, |
Malcolm Priestley | 302433d | 2013-11-03 17:40:51 +0000 | [diff] [blame] | 174 | "Cardinit request in status fail!\n"); |
Malcolm Priestley | 302433d | 2013-11-03 17:40:51 +0000 | [diff] [blame] | 175 | return false; |
| 176 | } |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 177 | |
Andres More | ec6e0f6 | 2013-01-31 18:23:07 -0500 | [diff] [blame] | 178 | /* local ID for AES functions */ |
Malcolm Priestley | 3ce5493 | 2014-07-16 22:22:01 +0100 | [diff] [blame] | 179 | status = vnt_control_in(priv, MESSAGE_TYPE_READ, |
Malcolm Priestley | 302433d | 2013-11-03 17:40:51 +0000 | [diff] [blame] | 180 | MAC_REG_LOCALID, MESSAGE_REQUEST_MACREG, 1, |
Malcolm Priestley | f1945a1 | 2014-07-19 12:30:06 +0100 | [diff] [blame] | 181 | &priv->local_id); |
Malcolm Priestley | 3ce5493 | 2014-07-16 22:22:01 +0100 | [diff] [blame] | 182 | if (status != STATUS_SUCCESS) |
Malcolm Priestley | 302433d | 2013-11-03 17:40:51 +0000 | [diff] [blame] | 183 | return false; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 184 | |
Andres More | ec6e0f6 | 2013-01-31 18:23:07 -0500 | [diff] [blame] | 185 | /* do MACbSoftwareReset in MACvInitialize */ |
| 186 | |
Malcolm Priestley | 3c8a5b2 | 2014-07-20 15:33:14 +0100 | [diff] [blame] | 187 | priv->top_ofdm_basic_rate = RATE_24M; |
Malcolm Priestley | d80bf43 | 2014-07-20 15:33:15 +0100 | [diff] [blame] | 188 | priv->top_cck_basic_rate = RATE_1M; |
Malcolm Priestley | 2486890 | 2014-05-17 09:50:31 +0100 | [diff] [blame] | 189 | |
Andres More | ec6e0f6 | 2013-01-31 18:23:07 -0500 | [diff] [blame] | 190 | /* target to IF pin while programming to RF chip */ |
Malcolm Priestley | 5a97491 | 2014-07-20 15:33:18 +0100 | [diff] [blame] | 191 | priv->power = 0xFF; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 192 | |
Malcolm Priestley | 5a97491 | 2014-07-20 15:33:18 +0100 | [diff] [blame] | 193 | priv->cck_pwr = priv->eeprom[EEP_OFS_PWR_CCK]; |
| 194 | priv->ofdm_pwr_g = priv->eeprom[EEP_OFS_PWR_OFDMG]; |
Andres More | ec6e0f6 | 2013-01-31 18:23:07 -0500 | [diff] [blame] | 195 | /* load power table */ |
| 196 | for (ii = 0; ii < 14; ii++) { |
Malcolm Priestley | 5a97491 | 2014-07-20 15:33:18 +0100 | [diff] [blame] | 197 | priv->cck_pwr_tbl[ii] = |
Malcolm Priestley | bbb1126 | 2014-07-20 15:33:16 +0100 | [diff] [blame] | 198 | priv->eeprom[ii + EEP_OFS_CCK_PWR_TBL]; |
Malcolm Priestley | 5a97491 | 2014-07-20 15:33:18 +0100 | [diff] [blame] | 199 | if (priv->cck_pwr_tbl[ii] == 0) |
| 200 | priv->cck_pwr_tbl[ii] = priv->cck_pwr; |
Malcolm Priestley | 302433d | 2013-11-03 17:40:51 +0000 | [diff] [blame] | 201 | |
Malcolm Priestley | 5a97491 | 2014-07-20 15:33:18 +0100 | [diff] [blame] | 202 | priv->ofdm_pwr_tbl[ii] = |
Malcolm Priestley | bbb1126 | 2014-07-20 15:33:16 +0100 | [diff] [blame] | 203 | priv->eeprom[ii + EEP_OFS_OFDM_PWR_TBL]; |
Malcolm Priestley | 5a97491 | 2014-07-20 15:33:18 +0100 | [diff] [blame] | 204 | if (priv->ofdm_pwr_tbl[ii] == 0) |
| 205 | priv->ofdm_pwr_tbl[ii] = priv->ofdm_pwr_g; |
Malcolm Priestley | 302433d | 2013-11-03 17:40:51 +0000 | [diff] [blame] | 206 | } |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 207 | |
Andres More | ec6e0f6 | 2013-01-31 18:23:07 -0500 | [diff] [blame] | 208 | /* |
| 209 | * original zonetype is USA, but custom zonetype is Europe, |
| 210 | * then need to recover 12, 13, 14 channels with 11 channel |
| 211 | */ |
Malcolm Priestley | 9ef2184 | 2014-06-25 21:19:38 +0100 | [diff] [blame] | 212 | for (ii = 11; ii < 14; ii++) { |
Malcolm Priestley | 5a97491 | 2014-07-20 15:33:18 +0100 | [diff] [blame] | 213 | priv->cck_pwr_tbl[ii] = priv->cck_pwr_tbl[10]; |
| 214 | priv->ofdm_pwr_tbl[ii] = priv->ofdm_pwr_tbl[10]; |
Malcolm Priestley | 302433d | 2013-11-03 17:40:51 +0000 | [diff] [blame] | 215 | } |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 216 | |
Malcolm Priestley | 5a97491 | 2014-07-20 15:33:18 +0100 | [diff] [blame] | 217 | priv->ofdm_pwr_a = 0x34; /* same as RFbMA2829SelectChannel */ |
Andres More | ec6e0f6 | 2013-01-31 18:23:07 -0500 | [diff] [blame] | 218 | |
Malcolm Priestley | 302433d | 2013-11-03 17:40:51 +0000 | [diff] [blame] | 219 | /* load OFDM A power table */ |
| 220 | for (ii = 0; ii < CB_MAX_CHANNEL_5G; ii++) { |
Malcolm Priestley | 5a97491 | 2014-07-20 15:33:18 +0100 | [diff] [blame] | 221 | priv->ofdm_a_pwr_tbl[ii] = |
Malcolm Priestley | bbb1126 | 2014-07-20 15:33:16 +0100 | [diff] [blame] | 222 | priv->eeprom[ii + EEP_OFS_OFDMA_PWR_TBL]; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 223 | |
Malcolm Priestley | 5a97491 | 2014-07-20 15:33:18 +0100 | [diff] [blame] | 224 | if (priv->ofdm_a_pwr_tbl[ii] == 0) |
| 225 | priv->ofdm_a_pwr_tbl[ii] = priv->ofdm_pwr_a; |
Malcolm Priestley | 302433d | 2013-11-03 17:40:51 +0000 | [diff] [blame] | 226 | } |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 227 | |
Malcolm Priestley | bbb1126 | 2014-07-20 15:33:16 +0100 | [diff] [blame] | 228 | antenna = priv->eeprom[EEP_OFS_ANTENNA]; |
Malcolm Priestley | 302433d | 2013-11-03 17:40:51 +0000 | [diff] [blame] | 229 | |
Malcolm Priestley | 3ce5493 | 2014-07-16 22:22:01 +0100 | [diff] [blame] | 230 | if (antenna & EEP_ANTINV) |
Malcolm Priestley | 2044dbd | 2014-07-19 12:30:16 +0100 | [diff] [blame] | 231 | priv->tx_rx_ant_inv = true; |
Malcolm Priestley | 302433d | 2013-11-03 17:40:51 +0000 | [diff] [blame] | 232 | else |
Malcolm Priestley | 2044dbd | 2014-07-19 12:30:16 +0100 | [diff] [blame] | 233 | priv->tx_rx_ant_inv = false; |
Malcolm Priestley | 302433d | 2013-11-03 17:40:51 +0000 | [diff] [blame] | 234 | |
Malcolm Priestley | 3ce5493 | 2014-07-16 22:22:01 +0100 | [diff] [blame] | 235 | antenna &= (EEP_ANTENNA_AUX | EEP_ANTENNA_MAIN); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 236 | |
Malcolm Priestley | 3ce5493 | 2014-07-16 22:22:01 +0100 | [diff] [blame] | 237 | if (antenna == 0) /* if not set default is both */ |
| 238 | antenna = (EEP_ANTENNA_AUX | EEP_ANTENNA_MAIN); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 239 | |
Malcolm Priestley | 3ce5493 | 2014-07-16 22:22:01 +0100 | [diff] [blame] | 240 | if (antenna == (EEP_ANTENNA_AUX | EEP_ANTENNA_MAIN)) { |
Malcolm Priestley | 2044dbd | 2014-07-19 12:30:16 +0100 | [diff] [blame] | 241 | priv->tx_antenna_mode = ANT_B; |
| 242 | priv->rx_antenna_sel = 1; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 243 | |
Malcolm Priestley | 2044dbd | 2014-07-19 12:30:16 +0100 | [diff] [blame] | 244 | if (priv->tx_rx_ant_inv == true) |
| 245 | priv->rx_antenna_mode = ANT_A; |
Malcolm Priestley | 302433d | 2013-11-03 17:40:51 +0000 | [diff] [blame] | 246 | else |
Malcolm Priestley | 2044dbd | 2014-07-19 12:30:16 +0100 | [diff] [blame] | 247 | priv->rx_antenna_mode = ANT_B; |
Malcolm Priestley | 302433d | 2013-11-03 17:40:51 +0000 | [diff] [blame] | 248 | } else { |
Malcolm Priestley | 2044dbd | 2014-07-19 12:30:16 +0100 | [diff] [blame] | 249 | priv->rx_antenna_sel = 0; |
Malcolm Priestley | 302433d | 2013-11-03 17:40:51 +0000 | [diff] [blame] | 250 | |
Malcolm Priestley | 3ce5493 | 2014-07-16 22:22:01 +0100 | [diff] [blame] | 251 | if (antenna & EEP_ANTENNA_AUX) { |
Malcolm Priestley | 2044dbd | 2014-07-19 12:30:16 +0100 | [diff] [blame] | 252 | priv->tx_antenna_mode = ANT_A; |
Malcolm Priestley | 302433d | 2013-11-03 17:40:51 +0000 | [diff] [blame] | 253 | |
Malcolm Priestley | 2044dbd | 2014-07-19 12:30:16 +0100 | [diff] [blame] | 254 | if (priv->tx_rx_ant_inv == true) |
| 255 | priv->rx_antenna_mode = ANT_B; |
Malcolm Priestley | 302433d | 2013-11-03 17:40:51 +0000 | [diff] [blame] | 256 | else |
Malcolm Priestley | 2044dbd | 2014-07-19 12:30:16 +0100 | [diff] [blame] | 257 | priv->rx_antenna_mode = ANT_A; |
Malcolm Priestley | 302433d | 2013-11-03 17:40:51 +0000 | [diff] [blame] | 258 | } else { |
Malcolm Priestley | 2044dbd | 2014-07-19 12:30:16 +0100 | [diff] [blame] | 259 | priv->tx_antenna_mode = ANT_B; |
Malcolm Priestley | 302433d | 2013-11-03 17:40:51 +0000 | [diff] [blame] | 260 | |
Malcolm Priestley | 2044dbd | 2014-07-19 12:30:16 +0100 | [diff] [blame] | 261 | if (priv->tx_rx_ant_inv == true) |
| 262 | priv->rx_antenna_mode = ANT_A; |
Malcolm Priestley | 302433d | 2013-11-03 17:40:51 +0000 | [diff] [blame] | 263 | else |
Malcolm Priestley | 2044dbd | 2014-07-19 12:30:16 +0100 | [diff] [blame] | 264 | priv->rx_antenna_mode = ANT_B; |
Malcolm Priestley | 302433d | 2013-11-03 17:40:51 +0000 | [diff] [blame] | 265 | } |
| 266 | } |
| 267 | |
Malcolm Priestley | ed0db51 | 2014-07-14 19:43:06 +0100 | [diff] [blame] | 268 | /* Set initial antenna mode */ |
Malcolm Priestley | 2044dbd | 2014-07-19 12:30:16 +0100 | [diff] [blame] | 269 | vnt_set_antenna_mode(priv, priv->rx_antenna_mode); |
Malcolm Priestley | ed0db51 | 2014-07-14 19:43:06 +0100 | [diff] [blame] | 270 | |
Andres More | ec6e0f6 | 2013-01-31 18:23:07 -0500 | [diff] [blame] | 271 | /* get Auto Fall Back type */ |
Malcolm Priestley | a6177ae | 2014-07-20 15:33:24 +0100 | [diff] [blame] | 272 | priv->auto_fb_ctrl = AUTO_FB_0; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 273 | |
Andres More | ec6e0f6 | 2013-01-31 18:23:07 -0500 | [diff] [blame] | 274 | /* default Auto Mode */ |
Malcolm Priestley | 65df77e | 2014-07-20 15:33:11 +0100 | [diff] [blame] | 275 | priv->bb_type = BB_TYPE_11G; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 276 | |
Andres More | ec6e0f6 | 2013-01-31 18:23:07 -0500 | [diff] [blame] | 277 | /* get RFType */ |
Malcolm Priestley | 6242eca | 2014-07-19 12:30:07 +0100 | [diff] [blame] | 278 | priv->rf_type = init_rsp->rf_type; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 279 | |
Andres More | ec6e0f6 | 2013-01-31 18:23:07 -0500 | [diff] [blame] | 280 | /* load vt3266 calibration parameters in EEPROM */ |
Malcolm Priestley | 6242eca | 2014-07-19 12:30:07 +0100 | [diff] [blame] | 281 | if (priv->rf_type == RF_VT3226D0) { |
Malcolm Priestley | bbb1126 | 2014-07-20 15:33:16 +0100 | [diff] [blame] | 282 | if ((priv->eeprom[EEP_OFS_MAJOR_VER] == 0x1) && |
| 283 | (priv->eeprom[EEP_OFS_MINOR_VER] >= 0x4)) { |
Malcolm Priestley | 302433d | 2013-11-03 17:40:51 +0000 | [diff] [blame] | 284 | |
Malcolm Priestley | bbb1126 | 2014-07-20 15:33:16 +0100 | [diff] [blame] | 285 | calib_tx_iq = priv->eeprom[EEP_OFS_CALIB_TX_IQ]; |
| 286 | calib_tx_dc = priv->eeprom[EEP_OFS_CALIB_TX_DC]; |
| 287 | calib_rx_iq = priv->eeprom[EEP_OFS_CALIB_RX_IQ]; |
Malcolm Priestley | 3ce5493 | 2014-07-16 22:22:01 +0100 | [diff] [blame] | 288 | if (calib_tx_iq || calib_tx_dc || calib_rx_iq) { |
Peter Senna Tschudin | 33e9ab3 | 2014-07-15 22:46:48 +0200 | [diff] [blame] | 289 | /* CR255, enable TX/RX IQ and |
| 290 | DC compensation mode */ |
Malcolm Priestley | 3ce5493 | 2014-07-16 22:22:01 +0100 | [diff] [blame] | 291 | vnt_control_out_u8(priv, |
Peter Senna Tschudin | 33e9ab3 | 2014-07-15 22:46:48 +0200 | [diff] [blame] | 292 | MESSAGE_REQUEST_BBREG, |
| 293 | 0xff, |
| 294 | 0x03); |
| 295 | /* CR251, TX I/Q Imbalance Calibration */ |
Malcolm Priestley | 3ce5493 | 2014-07-16 22:22:01 +0100 | [diff] [blame] | 296 | vnt_control_out_u8(priv, |
Peter Senna Tschudin | 33e9ab3 | 2014-07-15 22:46:48 +0200 | [diff] [blame] | 297 | MESSAGE_REQUEST_BBREG, |
| 298 | 0xfb, |
Malcolm Priestley | 3ce5493 | 2014-07-16 22:22:01 +0100 | [diff] [blame] | 299 | calib_tx_iq); |
Peter Senna Tschudin | 33e9ab3 | 2014-07-15 22:46:48 +0200 | [diff] [blame] | 300 | /* CR252, TX DC-Offset Calibration */ |
Malcolm Priestley | 3ce5493 | 2014-07-16 22:22:01 +0100 | [diff] [blame] | 301 | vnt_control_out_u8(priv, |
Peter Senna Tschudin | 33e9ab3 | 2014-07-15 22:46:48 +0200 | [diff] [blame] | 302 | MESSAGE_REQUEST_BBREG, |
| 303 | 0xfC, |
Malcolm Priestley | 3ce5493 | 2014-07-16 22:22:01 +0100 | [diff] [blame] | 304 | calib_tx_dc); |
Peter Senna Tschudin | 33e9ab3 | 2014-07-15 22:46:48 +0200 | [diff] [blame] | 305 | /* CR253, RX I/Q Imbalance Calibration */ |
Malcolm Priestley | 3ce5493 | 2014-07-16 22:22:01 +0100 | [diff] [blame] | 306 | vnt_control_out_u8(priv, |
Peter Senna Tschudin | 33e9ab3 | 2014-07-15 22:46:48 +0200 | [diff] [blame] | 307 | MESSAGE_REQUEST_BBREG, |
| 308 | 0xfd, |
Malcolm Priestley | 3ce5493 | 2014-07-16 22:22:01 +0100 | [diff] [blame] | 309 | calib_rx_iq); |
Malcolm Priestley | 302433d | 2013-11-03 17:40:51 +0000 | [diff] [blame] | 310 | } else { |
Peter Senna Tschudin | 33e9ab3 | 2014-07-15 22:46:48 +0200 | [diff] [blame] | 311 | /* CR255, turn off |
| 312 | BB Calibration compensation */ |
Malcolm Priestley | 3ce5493 | 2014-07-16 22:22:01 +0100 | [diff] [blame] | 313 | vnt_control_out_u8(priv, |
Peter Senna Tschudin | 33e9ab3 | 2014-07-15 22:46:48 +0200 | [diff] [blame] | 314 | MESSAGE_REQUEST_BBREG, |
| 315 | 0xff, |
| 316 | 0x0); |
Malcolm Priestley | 302433d | 2013-11-03 17:40:51 +0000 | [diff] [blame] | 317 | } |
| 318 | } |
| 319 | } |
Malcolm Priestley | cbc06fb | 2013-11-03 17:52:15 +0000 | [diff] [blame] | 320 | |
Andres More | ec6e0f6 | 2013-01-31 18:23:07 -0500 | [diff] [blame] | 321 | /* get permanent network address */ |
Malcolm Priestley | 41e8321 | 2014-07-19 12:30:11 +0100 | [diff] [blame] | 322 | memcpy(priv->permanent_net_addr, init_rsp->net_addr, 6); |
Krzysztof Adamski | e238223 | 2014-12-09 12:01:38 +0100 | [diff] [blame] | 323 | ether_addr_copy(priv->current_net_addr, priv->permanent_net_addr); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 324 | |
Andres More | ec6e0f6 | 2013-01-31 18:23:07 -0500 | [diff] [blame] | 325 | /* if exist SW network address, use it */ |
Malcolm Priestley | 4e62dcc9 | 2014-07-16 22:22:02 +0100 | [diff] [blame] | 326 | dev_dbg(&priv->usb->dev, "Network address = %pM\n", |
Malcolm Priestley | ebf9b31 | 2014-07-19 12:30:10 +0100 | [diff] [blame] | 327 | priv->current_net_addr); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 328 | |
Malcolm Priestley | cbc06fb | 2013-11-03 17:52:15 +0000 | [diff] [blame] | 329 | /* |
| 330 | * set BB and packet type at the same time |
| 331 | * set Short Slot Time, xIFS, and RSPINF |
| 332 | */ |
Malcolm Priestley | 65df77e | 2014-07-20 15:33:11 +0100 | [diff] [blame] | 333 | if (priv->bb_type == BB_TYPE_11A) |
Malcolm Priestley | a641c9e | 2014-07-20 15:33:21 +0100 | [diff] [blame] | 334 | priv->short_slot_time = true; |
Malcolm Priestley | d35d5fb | 2014-06-28 23:55:44 +0100 | [diff] [blame] | 335 | else |
Malcolm Priestley | a641c9e | 2014-07-20 15:33:21 +0100 | [diff] [blame] | 336 | priv->short_slot_time = false; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 337 | |
Malcolm Priestley | 3ce5493 | 2014-07-16 22:22:01 +0100 | [diff] [blame] | 338 | vnt_set_short_slot_time(priv); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 339 | |
Malcolm Priestley | bbb1126 | 2014-07-20 15:33:16 +0100 | [diff] [blame] | 340 | priv->radio_ctl = priv->eeprom[EEP_OFS_RADIOCTL]; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 341 | |
Malcolm Priestley | 2044dbd | 2014-07-19 12:30:16 +0100 | [diff] [blame] | 342 | if ((priv->radio_ctl & EEP_RADIOCTL_ENABLE) != 0) { |
Malcolm Priestley | 3ce5493 | 2014-07-16 22:22:01 +0100 | [diff] [blame] | 343 | status = vnt_control_in(priv, MESSAGE_TYPE_READ, |
| 344 | MAC_REG_GPIOCTL1, MESSAGE_REQUEST_MACREG, 1, &tmp); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 345 | |
Malcolm Priestley | 3ce5493 | 2014-07-16 22:22:01 +0100 | [diff] [blame] | 346 | if (status != STATUS_SUCCESS) |
Malcolm Priestley | cbc06fb | 2013-11-03 17:52:15 +0000 | [diff] [blame] | 347 | return false; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 348 | |
Malcolm Priestley | d7f2d8f | 2014-07-18 23:00:54 +0100 | [diff] [blame] | 349 | if ((tmp & GPIO3_DATA) == 0) |
Malcolm Priestley | 3ce5493 | 2014-07-16 22:22:01 +0100 | [diff] [blame] | 350 | vnt_mac_reg_bits_on(priv, MAC_REG_GPIOCTL1, |
Malcolm Priestley | 3695753 | 2014-05-31 11:50:42 +0100 | [diff] [blame] | 351 | GPIO3_INTMD); |
Malcolm Priestley | d7f2d8f | 2014-07-18 23:00:54 +0100 | [diff] [blame] | 352 | else |
Malcolm Priestley | 3ce5493 | 2014-07-16 22:22:01 +0100 | [diff] [blame] | 353 | vnt_mac_reg_bits_off(priv, MAC_REG_GPIOCTL1, |
Malcolm Priestley | a9bed1d | 2014-05-31 11:50:41 +0100 | [diff] [blame] | 354 | GPIO3_INTMD); |
Malcolm Priestley | cbc06fb | 2013-11-03 17:52:15 +0000 | [diff] [blame] | 355 | } |
| 356 | |
Malcolm Priestley | 3ce5493 | 2014-07-16 22:22:01 +0100 | [diff] [blame] | 357 | vnt_mac_set_led(priv, LEDSTS_TMLEN, 0x38); |
Malcolm Priestley | cbc06fb | 2013-11-03 17:52:15 +0000 | [diff] [blame] | 358 | |
Malcolm Priestley | 3ce5493 | 2014-07-16 22:22:01 +0100 | [diff] [blame] | 359 | vnt_mac_set_led(priv, LEDSTS_STS, LEDSTS_SLOW); |
Malcolm Priestley | cbc06fb | 2013-11-03 17:52:15 +0000 | [diff] [blame] | 360 | |
Malcolm Priestley | 3ce5493 | 2014-07-16 22:22:01 +0100 | [diff] [blame] | 361 | vnt_mac_reg_bits_on(priv, MAC_REG_GPIOCTL0, 0x01); |
Malcolm Priestley | cbc06fb | 2013-11-03 17:52:15 +0000 | [diff] [blame] | 362 | |
Malcolm Priestley | d7f2d8f | 2014-07-18 23:00:54 +0100 | [diff] [blame] | 363 | vnt_radio_power_on(priv); |
Malcolm Priestley | cbc06fb | 2013-11-03 17:52:15 +0000 | [diff] [blame] | 364 | |
Malcolm Priestley | 4e62dcc9 | 2014-07-16 22:22:02 +0100 | [diff] [blame] | 365 | dev_dbg(&priv->usb->dev, "<----INIbInitAdapter Exit\n"); |
Malcolm Priestley | cbc06fb | 2013-11-03 17:52:15 +0000 | [diff] [blame] | 366 | |
| 367 | return true; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 368 | } |
| 369 | |
Malcolm Priestley | afc7ef6 | 2014-07-25 20:51:47 +0100 | [diff] [blame] | 370 | static void vnt_free_tx_bufs(struct vnt_private *priv) |
Andres More | 8611a29 | 2010-05-01 14:25:00 -0300 | [diff] [blame] | 371 | { |
Malcolm Priestley | f2625c2 | 2014-02-28 23:58:36 +0000 | [diff] [blame] | 372 | struct vnt_usb_send_context *tx_context; |
| 373 | int ii; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 374 | |
Malcolm Priestley | 03b7e35 | 2014-07-19 12:30:04 +0100 | [diff] [blame] | 375 | for (ii = 0; ii < priv->num_tx_context; ii++) { |
Malcolm Priestley | f7e4a8f | 2014-07-18 06:36:16 +0100 | [diff] [blame] | 376 | tx_context = priv->tx_context[ii]; |
Malcolm Priestley | f2625c2 | 2014-02-28 23:58:36 +0000 | [diff] [blame] | 377 | /* deallocate URBs */ |
Malcolm Priestley | 30a05b3 | 2014-05-15 22:49:11 +0100 | [diff] [blame] | 378 | if (tx_context->urb) { |
| 379 | usb_kill_urb(tx_context->urb); |
| 380 | usb_free_urb(tx_context->urb); |
Malcolm Priestley | f2625c2 | 2014-02-28 23:58:36 +0000 | [diff] [blame] | 381 | } |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 382 | |
Malcolm Priestley | f2625c2 | 2014-02-28 23:58:36 +0000 | [diff] [blame] | 383 | kfree(tx_context); |
| 384 | } |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 385 | } |
| 386 | |
Malcolm Priestley | 0dd6e68 | 2014-07-25 20:51:48 +0100 | [diff] [blame] | 387 | static void vnt_free_rx_bufs(struct vnt_private *priv) |
Andres More | 8611a29 | 2010-05-01 14:25:00 -0300 | [diff] [blame] | 388 | { |
Malcolm Priestley | afc5eeb | 2014-02-28 23:58:35 +0000 | [diff] [blame] | 389 | struct vnt_rcb *rcb; |
Malcolm Priestley | 115cac2 | 2013-08-28 21:12:35 +0100 | [diff] [blame] | 390 | int ii; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 391 | |
Malcolm Priestley | 6da4738 | 2014-07-19 12:30:03 +0100 | [diff] [blame] | 392 | for (ii = 0; ii < priv->num_rcb; ii++) { |
Malcolm Priestley | 8577011 | 2014-07-18 06:36:15 +0100 | [diff] [blame] | 393 | rcb = priv->rcb[ii]; |
Malcolm Priestley | 8cffb3c | 2014-06-28 23:55:42 +0100 | [diff] [blame] | 394 | if (!rcb) |
| 395 | continue; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 396 | |
Malcolm Priestley | afc5eeb | 2014-02-28 23:58:35 +0000 | [diff] [blame] | 397 | /* deallocate URBs */ |
Malcolm Priestley | 325de98 | 2014-07-18 06:36:11 +0100 | [diff] [blame] | 398 | if (rcb->urb) { |
| 399 | usb_kill_urb(rcb->urb); |
| 400 | usb_free_urb(rcb->urb); |
Malcolm Priestley | afc5eeb | 2014-02-28 23:58:35 +0000 | [diff] [blame] | 401 | } |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 402 | |
Malcolm Priestley | afc5eeb | 2014-02-28 23:58:35 +0000 | [diff] [blame] | 403 | /* deallocate skb */ |
| 404 | if (rcb->skb) |
| 405 | dev_kfree_skb(rcb->skb); |
Malcolm Priestley | afc5eeb | 2014-02-28 23:58:35 +0000 | [diff] [blame] | 406 | |
Malcolm Priestley | 8cffb3c | 2014-06-28 23:55:42 +0100 | [diff] [blame] | 407 | kfree(rcb); |
| 408 | } |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 409 | } |
| 410 | |
Malcolm Priestley | 76d382f | 2014-07-18 06:36:08 +0100 | [diff] [blame] | 411 | static void usb_device_reset(struct vnt_private *priv) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 412 | { |
Peter Senna Tschudin | 42b138d | 2014-07-15 23:23:26 +0200 | [diff] [blame] | 413 | int status; |
| 414 | |
Malcolm Priestley | 76d382f | 2014-07-18 06:36:08 +0100 | [diff] [blame] | 415 | status = usb_reset_device(priv->usb); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 416 | if (status) |
Malcolm Priestley | 76d382f | 2014-07-18 06:36:08 +0100 | [diff] [blame] | 417 | dev_warn(&priv->usb->dev, |
Peter Senna Tschudin | d9cf2f9 | 2014-07-16 18:08:02 +0200 | [diff] [blame] | 418 | "usb_device_reset fail status=%d\n", status); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 419 | } |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 420 | |
Malcolm Priestley | 1c2fd56 | 2014-07-25 20:51:49 +0100 | [diff] [blame] | 421 | static void vnt_free_int_bufs(struct vnt_private *priv) |
Andres More | 8611a29 | 2010-05-01 14:25:00 -0300 | [diff] [blame] | 422 | { |
Malcolm Priestley | 1506bf3 | 2014-02-28 23:58:37 +0000 | [diff] [blame] | 423 | kfree(priv->int_buf.data_buf); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 424 | } |
| 425 | |
Malcolm Priestley | ef48442 | 2014-07-25 20:51:50 +0100 | [diff] [blame] | 426 | static bool vnt_alloc_bufs(struct vnt_private *priv) |
Malcolm Priestley | dd0a774 | 2012-12-10 21:59:10 +0000 | [diff] [blame] | 427 | { |
Malcolm Priestley | 35491de | 2014-02-28 23:58:34 +0000 | [diff] [blame] | 428 | struct vnt_usb_send_context *tx_context; |
| 429 | struct vnt_rcb *rcb; |
Malcolm Priestley | 115cac2 | 2013-08-28 21:12:35 +0100 | [diff] [blame] | 430 | int ii; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 431 | |
Malcolm Priestley | 03b7e35 | 2014-07-19 12:30:04 +0100 | [diff] [blame] | 432 | for (ii = 0; ii < priv->num_tx_context; ii++) { |
Malcolm Priestley | 35491de | 2014-02-28 23:58:34 +0000 | [diff] [blame] | 433 | tx_context = kmalloc(sizeof(struct vnt_usb_send_context), |
Malcolm Priestley | 115cac2 | 2013-08-28 21:12:35 +0100 | [diff] [blame] | 434 | GFP_KERNEL); |
Melike Yurtoglu | 2ff6179 | 2014-10-05 01:05:57 +0300 | [diff] [blame] | 435 | if (tx_context == NULL) |
Malcolm Priestley | 35491de | 2014-02-28 23:58:34 +0000 | [diff] [blame] | 436 | goto free_tx; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 437 | |
Malcolm Priestley | f7e4a8f | 2014-07-18 06:36:16 +0100 | [diff] [blame] | 438 | priv->tx_context[ii] = tx_context; |
Malcolm Priestley | 30a05b3 | 2014-05-15 22:49:11 +0100 | [diff] [blame] | 439 | tx_context->priv = priv; |
Malcolm Priestley | 71d764a | 2014-07-05 19:24:27 +0100 | [diff] [blame] | 440 | tx_context->pkt_no = ii; |
Malcolm Priestley | 115cac2 | 2013-08-28 21:12:35 +0100 | [diff] [blame] | 441 | |
Malcolm Priestley | 35491de | 2014-02-28 23:58:34 +0000 | [diff] [blame] | 442 | /* allocate URBs */ |
Malcolm Priestley | 30a05b3 | 2014-05-15 22:49:11 +0100 | [diff] [blame] | 443 | tx_context->urb = usb_alloc_urb(0, GFP_ATOMIC); |
| 444 | if (!tx_context->urb) { |
Malcolm Priestley | b4ae135 | 2014-07-16 22:22:03 +0100 | [diff] [blame] | 445 | dev_err(&priv->usb->dev, "alloc tx urb failed\n"); |
Malcolm Priestley | 35491de | 2014-02-28 23:58:34 +0000 | [diff] [blame] | 446 | goto free_tx; |
| 447 | } |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 448 | |
Malcolm Priestley | 30a05b3 | 2014-05-15 22:49:11 +0100 | [diff] [blame] | 449 | tx_context->in_use = false; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 450 | } |
| 451 | |
Malcolm Priestley | 6da4738 | 2014-07-19 12:30:03 +0100 | [diff] [blame] | 452 | for (ii = 0; ii < priv->num_rcb; ii++) { |
Malcolm Priestley | 8577011 | 2014-07-18 06:36:15 +0100 | [diff] [blame] | 453 | priv->rcb[ii] = kzalloc(sizeof(struct vnt_rcb), GFP_KERNEL); |
| 454 | if (!priv->rcb[ii]) { |
Malcolm Priestley | 8cffb3c | 2014-06-28 23:55:42 +0100 | [diff] [blame] | 455 | dev_err(&priv->usb->dev, |
| 456 | "failed to allocate rcb no %d\n", ii); |
| 457 | goto free_rx_tx; |
| 458 | } |
| 459 | |
Malcolm Priestley | 8577011 | 2014-07-18 06:36:15 +0100 | [diff] [blame] | 460 | rcb = priv->rcb[ii]; |
Malcolm Priestley | 8cffb3c | 2014-06-28 23:55:42 +0100 | [diff] [blame] | 461 | |
Malcolm Priestley | 325de98 | 2014-07-18 06:36:11 +0100 | [diff] [blame] | 462 | rcb->priv = priv; |
Malcolm Priestley | 35491de | 2014-02-28 23:58:34 +0000 | [diff] [blame] | 463 | |
| 464 | /* allocate URBs */ |
Malcolm Priestley | 325de98 | 2014-07-18 06:36:11 +0100 | [diff] [blame] | 465 | rcb->urb = usb_alloc_urb(0, GFP_ATOMIC); |
| 466 | if (rcb->urb == NULL) { |
Malcolm Priestley | b4ae135 | 2014-07-16 22:22:03 +0100 | [diff] [blame] | 467 | dev_err(&priv->usb->dev, "Failed to alloc rx urb\n"); |
Malcolm Priestley | 35491de | 2014-02-28 23:58:34 +0000 | [diff] [blame] | 468 | goto free_rx_tx; |
| 469 | } |
| 470 | |
Malcolm Priestley | 63b9907 | 2014-06-25 21:14:22 +0100 | [diff] [blame] | 471 | rcb->skb = dev_alloc_skb(priv->rx_buf_sz); |
Melike Yurtoglu | 2ff6179 | 2014-10-05 01:05:57 +0300 | [diff] [blame] | 472 | if (rcb->skb == NULL) |
Malcolm Priestley | 35491de | 2014-02-28 23:58:34 +0000 | [diff] [blame] | 473 | goto free_rx_tx; |
Malcolm Priestley | 35491de | 2014-02-28 23:58:34 +0000 | [diff] [blame] | 474 | |
Malcolm Priestley | 325de98 | 2014-07-18 06:36:11 +0100 | [diff] [blame] | 475 | rcb->in_use = false; |
Malcolm Priestley | 35491de | 2014-02-28 23:58:34 +0000 | [diff] [blame] | 476 | |
Malcolm Priestley | 8cffb3c | 2014-06-28 23:55:42 +0100 | [diff] [blame] | 477 | /* submit rx urb */ |
Malcolm Priestley | 2dc37af | 2014-07-15 19:54:41 +0100 | [diff] [blame] | 478 | if (vnt_submit_rx_urb(priv, rcb)) |
Malcolm Priestley | 8cffb3c | 2014-06-28 23:55:42 +0100 | [diff] [blame] | 479 | goto free_rx_tx; |
Malcolm Priestley | 35491de | 2014-02-28 23:58:34 +0000 | [diff] [blame] | 480 | } |
| 481 | |
Malcolm Priestley | 3d58248 | 2014-07-18 06:36:14 +0100 | [diff] [blame] | 482 | priv->interrupt_urb = usb_alloc_urb(0, GFP_ATOMIC); |
| 483 | if (priv->interrupt_urb == NULL) { |
Malcolm Priestley | b4ae135 | 2014-07-16 22:22:03 +0100 | [diff] [blame] | 484 | dev_err(&priv->usb->dev, "Failed to alloc int urb\n"); |
Malcolm Priestley | 35491de | 2014-02-28 23:58:34 +0000 | [diff] [blame] | 485 | goto free_rx_tx; |
| 486 | } |
| 487 | |
| 488 | priv->int_buf.data_buf = kmalloc(MAX_INTERRUPT_SIZE, GFP_KERNEL); |
| 489 | if (priv->int_buf.data_buf == NULL) { |
Malcolm Priestley | 3d58248 | 2014-07-18 06:36:14 +0100 | [diff] [blame] | 490 | usb_free_urb(priv->interrupt_urb); |
Malcolm Priestley | 35491de | 2014-02-28 23:58:34 +0000 | [diff] [blame] | 491 | goto free_rx_tx; |
| 492 | } |
| 493 | |
| 494 | return true; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 495 | |
| 496 | free_rx_tx: |
Malcolm Priestley | 0dd6e68 | 2014-07-25 20:51:48 +0100 | [diff] [blame] | 497 | vnt_free_rx_bufs(priv); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 498 | |
| 499 | free_tx: |
Malcolm Priestley | afc7ef6 | 2014-07-25 20:51:47 +0100 | [diff] [blame] | 500 | vnt_free_tx_bufs(priv); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 501 | |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 502 | return false; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 503 | } |
| 504 | |
Malcolm Priestley | db8f37f | 2014-06-25 21:14:25 +0100 | [diff] [blame] | 505 | static void vnt_tx_80211(struct ieee80211_hw *hw, |
| 506 | struct ieee80211_tx_control *control, struct sk_buff *skb) |
| 507 | { |
| 508 | struct vnt_private *priv = hw->priv; |
| 509 | |
| 510 | ieee80211_stop_queues(hw); |
| 511 | |
| 512 | if (vnt_tx_packet(priv, skb)) { |
| 513 | ieee80211_free_txskb(hw, skb); |
| 514 | |
| 515 | ieee80211_wake_queues(hw); |
| 516 | } |
| 517 | } |
| 518 | |
| 519 | static int vnt_start(struct ieee80211_hw *hw) |
| 520 | { |
| 521 | struct vnt_private *priv = hw->priv; |
| 522 | |
| 523 | priv->rx_buf_sz = MAX_TOTAL_SIZE_WITH_ALL_HEADERS; |
| 524 | |
Malcolm Priestley | ef48442 | 2014-07-25 20:51:50 +0100 | [diff] [blame] | 525 | if (vnt_alloc_bufs(priv) == false) { |
| 526 | dev_dbg(&priv->usb->dev, "vnt_alloc_bufs fail...\n"); |
Malcolm Priestley | db8f37f | 2014-06-25 21:14:25 +0100 | [diff] [blame] | 527 | return -ENOMEM; |
| 528 | } |
| 529 | |
Malcolm Priestley | 2ab3d46 | 2014-07-24 21:13:18 +0100 | [diff] [blame] | 530 | clear_bit(DEVICE_FLAGS_DISCONNECTED, &priv->flags); |
Malcolm Priestley | db8f37f | 2014-06-25 21:14:25 +0100 | [diff] [blame] | 531 | |
Malcolm Priestley | 500e1fb | 2014-07-25 20:51:46 +0100 | [diff] [blame] | 532 | if (vnt_init_registers(priv) == false) { |
Malcolm Priestley | db8f37f | 2014-06-25 21:14:25 +0100 | [diff] [blame] | 533 | dev_dbg(&priv->usb->dev, " init register fail\n"); |
| 534 | goto free_all; |
| 535 | } |
| 536 | |
| 537 | priv->int_interval = 1; /* bInterval is set to 1 */ |
| 538 | |
Malcolm Priestley | 6200193 | 2014-07-15 19:54:35 +0100 | [diff] [blame] | 539 | vnt_int_start_interrupt(priv); |
Malcolm Priestley | db8f37f | 2014-06-25 21:14:25 +0100 | [diff] [blame] | 540 | |
Malcolm Priestley | db8f37f | 2014-06-25 21:14:25 +0100 | [diff] [blame] | 541 | ieee80211_wake_queues(hw); |
| 542 | |
| 543 | return 0; |
| 544 | |
| 545 | free_all: |
Malcolm Priestley | 0dd6e68 | 2014-07-25 20:51:48 +0100 | [diff] [blame] | 546 | vnt_free_rx_bufs(priv); |
Malcolm Priestley | afc7ef6 | 2014-07-25 20:51:47 +0100 | [diff] [blame] | 547 | vnt_free_tx_bufs(priv); |
Malcolm Priestley | 1c2fd56 | 2014-07-25 20:51:49 +0100 | [diff] [blame] | 548 | vnt_free_int_bufs(priv); |
Malcolm Priestley | db8f37f | 2014-06-25 21:14:25 +0100 | [diff] [blame] | 549 | |
Malcolm Priestley | 3d58248 | 2014-07-18 06:36:14 +0100 | [diff] [blame] | 550 | usb_kill_urb(priv->interrupt_urb); |
| 551 | usb_free_urb(priv->interrupt_urb); |
Malcolm Priestley | db8f37f | 2014-06-25 21:14:25 +0100 | [diff] [blame] | 552 | |
| 553 | return -ENOMEM; |
| 554 | } |
| 555 | |
| 556 | static void vnt_stop(struct ieee80211_hw *hw) |
| 557 | { |
| 558 | struct vnt_private *priv = hw->priv; |
| 559 | int i; |
| 560 | |
| 561 | if (!priv) |
| 562 | return; |
| 563 | |
| 564 | for (i = 0; i < MAX_KEY_TABLE; i++) |
| 565 | vnt_mac_disable_keyentry(priv, i); |
| 566 | |
| 567 | /* clear all keys */ |
| 568 | priv->key_entry_inuse = 0; |
| 569 | |
Malcolm Priestley | cbcc9a3 | 2014-07-24 21:13:20 +0100 | [diff] [blame] | 570 | if (!test_bit(DEVICE_FLAGS_UNPLUG, &priv->flags)) |
Malcolm Priestley | db8f37f | 2014-06-25 21:14:25 +0100 | [diff] [blame] | 571 | vnt_mac_shutdown(priv); |
| 572 | |
| 573 | ieee80211_stop_queues(hw); |
| 574 | |
Malcolm Priestley | 4c3b0d4 | 2014-07-24 21:13:17 +0100 | [diff] [blame] | 575 | set_bit(DEVICE_FLAGS_DISCONNECTED, &priv->flags); |
Malcolm Priestley | db8f37f | 2014-06-25 21:14:25 +0100 | [diff] [blame] | 576 | |
| 577 | cancel_delayed_work_sync(&priv->run_command_work); |
Malcolm Priestley | db8f37f | 2014-06-25 21:14:25 +0100 | [diff] [blame] | 578 | |
Malcolm Priestley | 33a60b8 | 2014-07-13 10:42:45 +0100 | [diff] [blame] | 579 | priv->cmd_running = false; |
Malcolm Priestley | db8f37f | 2014-06-25 21:14:25 +0100 | [diff] [blame] | 580 | |
Malcolm Priestley | afc7ef6 | 2014-07-25 20:51:47 +0100 | [diff] [blame] | 581 | vnt_free_tx_bufs(priv); |
Malcolm Priestley | 0dd6e68 | 2014-07-25 20:51:48 +0100 | [diff] [blame] | 582 | vnt_free_rx_bufs(priv); |
Malcolm Priestley | 1c2fd56 | 2014-07-25 20:51:49 +0100 | [diff] [blame] | 583 | vnt_free_int_bufs(priv); |
Malcolm Priestley | db8f37f | 2014-06-25 21:14:25 +0100 | [diff] [blame] | 584 | |
Malcolm Priestley | 3d58248 | 2014-07-18 06:36:14 +0100 | [diff] [blame] | 585 | usb_kill_urb(priv->interrupt_urb); |
| 586 | usb_free_urb(priv->interrupt_urb); |
Malcolm Priestley | db8f37f | 2014-06-25 21:14:25 +0100 | [diff] [blame] | 587 | } |
| 588 | |
| 589 | static int vnt_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) |
| 590 | { |
| 591 | struct vnt_private *priv = hw->priv; |
| 592 | |
| 593 | priv->vif = vif; |
| 594 | |
| 595 | switch (vif->type) { |
| 596 | case NL80211_IFTYPE_STATION: |
| 597 | break; |
| 598 | case NL80211_IFTYPE_ADHOC: |
| 599 | vnt_mac_reg_bits_off(priv, MAC_REG_RCR, RCR_UNICAST); |
| 600 | |
| 601 | vnt_mac_reg_bits_on(priv, MAC_REG_HOSTCR, HOSTCR_ADHOC); |
| 602 | |
| 603 | break; |
| 604 | case NL80211_IFTYPE_AP: |
| 605 | vnt_mac_reg_bits_off(priv, MAC_REG_RCR, RCR_UNICAST); |
| 606 | |
| 607 | vnt_mac_reg_bits_on(priv, MAC_REG_HOSTCR, HOSTCR_AP); |
| 608 | |
| 609 | break; |
| 610 | default: |
| 611 | return -EOPNOTSUPP; |
| 612 | } |
| 613 | |
| 614 | priv->op_mode = vif->type; |
| 615 | |
Malcolm Priestley | 1ecd083 | 2014-06-28 23:55:46 +0100 | [diff] [blame] | 616 | vnt_set_bss_mode(priv); |
| 617 | |
Malcolm Priestley | db8f37f | 2014-06-25 21:14:25 +0100 | [diff] [blame] | 618 | /* LED blink on TX */ |
| 619 | vnt_mac_set_led(priv, LEDSTS_STS, LEDSTS_INTER); |
| 620 | |
| 621 | return 0; |
| 622 | } |
| 623 | |
| 624 | static void vnt_remove_interface(struct ieee80211_hw *hw, |
| 625 | struct ieee80211_vif *vif) |
| 626 | { |
| 627 | struct vnt_private *priv = hw->priv; |
| 628 | |
| 629 | switch (vif->type) { |
| 630 | case NL80211_IFTYPE_STATION: |
| 631 | break; |
| 632 | case NL80211_IFTYPE_ADHOC: |
| 633 | vnt_mac_reg_bits_off(priv, MAC_REG_TCR, TCR_AUTOBCNTX); |
| 634 | vnt_mac_reg_bits_off(priv, MAC_REG_TFTCTL, TFTCTL_TSFCNTREN); |
| 635 | vnt_mac_reg_bits_off(priv, MAC_REG_HOSTCR, HOSTCR_ADHOC); |
| 636 | break; |
| 637 | case NL80211_IFTYPE_AP: |
| 638 | vnt_mac_reg_bits_off(priv, MAC_REG_TCR, TCR_AUTOBCNTX); |
| 639 | vnt_mac_reg_bits_off(priv, MAC_REG_TFTCTL, TFTCTL_TSFCNTREN); |
| 640 | vnt_mac_reg_bits_off(priv, MAC_REG_HOSTCR, HOSTCR_AP); |
| 641 | break; |
| 642 | default: |
| 643 | break; |
| 644 | } |
| 645 | |
| 646 | vnt_radio_power_off(priv); |
| 647 | |
| 648 | priv->op_mode = NL80211_IFTYPE_UNSPECIFIED; |
| 649 | |
| 650 | /* LED slow blink */ |
| 651 | vnt_mac_set_led(priv, LEDSTS_STS, LEDSTS_SLOW); |
Malcolm Priestley | db8f37f | 2014-06-25 21:14:25 +0100 | [diff] [blame] | 652 | } |
| 653 | |
| 654 | static int vnt_config(struct ieee80211_hw *hw, u32 changed) |
| 655 | { |
| 656 | struct vnt_private *priv = hw->priv; |
| 657 | struct ieee80211_conf *conf = &hw->conf; |
| 658 | u8 bb_type; |
| 659 | |
| 660 | if (changed & IEEE80211_CONF_CHANGE_PS) { |
| 661 | if (conf->flags & IEEE80211_CONF_PS) |
| 662 | vnt_enable_power_saving(priv, conf->listen_interval); |
| 663 | else |
| 664 | vnt_disable_power_saving(priv); |
| 665 | } |
| 666 | |
| 667 | if ((changed & IEEE80211_CONF_CHANGE_CHANNEL) || |
| 668 | (conf->flags & IEEE80211_CONF_OFFCHANNEL)) { |
| 669 | vnt_set_channel(priv, conf->chandef.chan->hw_value); |
| 670 | |
| 671 | if (conf->chandef.chan->band == IEEE80211_BAND_5GHZ) |
| 672 | bb_type = BB_TYPE_11A; |
| 673 | else |
| 674 | bb_type = BB_TYPE_11G; |
| 675 | |
Malcolm Priestley | 65df77e | 2014-07-20 15:33:11 +0100 | [diff] [blame] | 676 | if (priv->bb_type != bb_type) { |
| 677 | priv->bb_type = bb_type; |
Malcolm Priestley | db8f37f | 2014-06-25 21:14:25 +0100 | [diff] [blame] | 678 | |
| 679 | vnt_set_bss_mode(priv); |
| 680 | } |
| 681 | } |
| 682 | |
| 683 | if (changed & IEEE80211_CONF_CHANGE_POWER) { |
Malcolm Priestley | 65df77e | 2014-07-20 15:33:11 +0100 | [diff] [blame] | 684 | if (priv->bb_type == BB_TYPE_11B) |
Malcolm Priestley | 8b84c1d | 2014-07-20 15:33:19 +0100 | [diff] [blame] | 685 | priv->current_rate = RATE_1M; |
Malcolm Priestley | db8f37f | 2014-06-25 21:14:25 +0100 | [diff] [blame] | 686 | else |
Malcolm Priestley | 8b84c1d | 2014-07-20 15:33:19 +0100 | [diff] [blame] | 687 | priv->current_rate = RATE_54M; |
Malcolm Priestley | db8f37f | 2014-06-25 21:14:25 +0100 | [diff] [blame] | 688 | |
Malcolm Priestley | 8b84c1d | 2014-07-20 15:33:19 +0100 | [diff] [blame] | 689 | vnt_rf_setpower(priv, priv->current_rate, |
Malcolm Priestley | db8f37f | 2014-06-25 21:14:25 +0100 | [diff] [blame] | 690 | conf->chandef.chan->hw_value); |
| 691 | } |
| 692 | |
| 693 | return 0; |
| 694 | } |
| 695 | |
| 696 | static void vnt_bss_info_changed(struct ieee80211_hw *hw, |
| 697 | struct ieee80211_vif *vif, struct ieee80211_bss_conf *conf, |
| 698 | u32 changed) |
| 699 | { |
| 700 | struct vnt_private *priv = hw->priv; |
Peter Senna Tschudin | 14c5e41 | 2014-07-15 23:23:27 +0200 | [diff] [blame] | 701 | |
Malcolm Priestley | db8f37f | 2014-06-25 21:14:25 +0100 | [diff] [blame] | 702 | priv->current_aid = conf->aid; |
| 703 | |
| 704 | if (changed & BSS_CHANGED_BSSID) |
| 705 | vnt_mac_set_bssid_addr(priv, (u8 *)conf->bssid); |
| 706 | |
| 707 | |
| 708 | if (changed & BSS_CHANGED_BASIC_RATES) { |
Malcolm Priestley | 93a7355 | 2014-07-20 15:33:13 +0100 | [diff] [blame] | 709 | priv->basic_rates = conf->basic_rates; |
Malcolm Priestley | db8f37f | 2014-06-25 21:14:25 +0100 | [diff] [blame] | 710 | |
| 711 | vnt_update_top_rates(priv); |
| 712 | |
| 713 | dev_dbg(&priv->usb->dev, "basic rates %x\n", conf->basic_rates); |
| 714 | } |
| 715 | |
| 716 | if (changed & BSS_CHANGED_ERP_PREAMBLE) { |
| 717 | if (conf->use_short_preamble) { |
| 718 | vnt_mac_enable_barker_preamble_mode(priv); |
Malcolm Priestley | 98e93fe | 2014-07-20 15:33:17 +0100 | [diff] [blame] | 719 | priv->preamble_type = true; |
Malcolm Priestley | db8f37f | 2014-06-25 21:14:25 +0100 | [diff] [blame] | 720 | } else { |
| 721 | vnt_mac_disable_barker_preamble_mode(priv); |
Malcolm Priestley | 98e93fe | 2014-07-20 15:33:17 +0100 | [diff] [blame] | 722 | priv->preamble_type = false; |
Malcolm Priestley | db8f37f | 2014-06-25 21:14:25 +0100 | [diff] [blame] | 723 | } |
| 724 | } |
| 725 | |
| 726 | if (changed & BSS_CHANGED_ERP_CTS_PROT) { |
| 727 | if (conf->use_cts_prot) |
| 728 | vnt_mac_enable_protect_mode(priv); |
| 729 | else |
| 730 | vnt_mac_disable_protect_mode(priv); |
| 731 | } |
| 732 | |
| 733 | if (changed & BSS_CHANGED_ERP_SLOT) { |
| 734 | if (conf->use_short_slot) |
Malcolm Priestley | a641c9e | 2014-07-20 15:33:21 +0100 | [diff] [blame] | 735 | priv->short_slot_time = true; |
Malcolm Priestley | db8f37f | 2014-06-25 21:14:25 +0100 | [diff] [blame] | 736 | else |
Malcolm Priestley | a641c9e | 2014-07-20 15:33:21 +0100 | [diff] [blame] | 737 | priv->short_slot_time = false; |
Malcolm Priestley | db8f37f | 2014-06-25 21:14:25 +0100 | [diff] [blame] | 738 | |
Malcolm Priestley | 3c956cc | 2014-07-16 22:21:54 +0100 | [diff] [blame] | 739 | vnt_set_short_slot_time(priv); |
Malcolm Priestley | c37cbd3 | 2014-07-20 15:33:25 +0100 | [diff] [blame] | 740 | vnt_set_vga_gain_offset(priv, priv->bb_vga[0]); |
Malcolm Priestley | 80dcc0a | 2014-07-16 22:21:58 +0100 | [diff] [blame] | 741 | vnt_update_pre_ed_threshold(priv, false); |
Malcolm Priestley | db8f37f | 2014-06-25 21:14:25 +0100 | [diff] [blame] | 742 | } |
| 743 | |
| 744 | if (changed & BSS_CHANGED_TXPOWER) |
Malcolm Priestley | 8b84c1d | 2014-07-20 15:33:19 +0100 | [diff] [blame] | 745 | vnt_rf_setpower(priv, priv->current_rate, |
Malcolm Priestley | db8f37f | 2014-06-25 21:14:25 +0100 | [diff] [blame] | 746 | conf->chandef.chan->hw_value); |
| 747 | |
| 748 | if (changed & BSS_CHANGED_BEACON_ENABLED) { |
| 749 | dev_dbg(&priv->usb->dev, |
| 750 | "Beacon enable %d\n", conf->enable_beacon); |
| 751 | |
| 752 | if (conf->enable_beacon) { |
| 753 | vnt_beacon_enable(priv, vif, conf); |
| 754 | |
| 755 | vnt_mac_reg_bits_on(priv, MAC_REG_TCR, TCR_AUTOBCNTX); |
| 756 | } else { |
| 757 | vnt_mac_reg_bits_off(priv, MAC_REG_TCR, TCR_AUTOBCNTX); |
| 758 | } |
| 759 | } |
| 760 | } |
| 761 | |
| 762 | static u64 vnt_prepare_multicast(struct ieee80211_hw *hw, |
| 763 | struct netdev_hw_addr_list *mc_list) |
| 764 | { |
| 765 | struct vnt_private *priv = hw->priv; |
| 766 | struct netdev_hw_addr *ha; |
| 767 | u64 mc_filter = 0; |
| 768 | u32 bit_nr = 0; |
| 769 | |
| 770 | netdev_hw_addr_list_for_each(ha, mc_list) { |
| 771 | bit_nr = ether_crc(ETH_ALEN, ha->addr) >> 26; |
| 772 | |
| 773 | mc_filter |= 1ULL << (bit_nr & 0x3f); |
| 774 | } |
| 775 | |
| 776 | priv->mc_list_count = mc_list->count; |
| 777 | |
| 778 | return mc_filter; |
| 779 | } |
| 780 | |
| 781 | static void vnt_configure(struct ieee80211_hw *hw, |
| 782 | unsigned int changed_flags, unsigned int *total_flags, u64 multicast) |
| 783 | { |
| 784 | struct vnt_private *priv = hw->priv; |
| 785 | u8 rx_mode = 0; |
| 786 | int rc; |
| 787 | |
| 788 | *total_flags &= FIF_ALLMULTI | FIF_OTHER_BSS | FIF_PROMISC_IN_BSS | |
| 789 | FIF_BCN_PRBRESP_PROMISC; |
| 790 | |
| 791 | rc = vnt_control_in(priv, MESSAGE_TYPE_READ, MAC_REG_RCR, |
| 792 | MESSAGE_REQUEST_MACREG, sizeof(u8), &rx_mode); |
| 793 | |
| 794 | if (!rc) |
| 795 | rx_mode = RCR_MULTICAST | RCR_BROADCAST; |
| 796 | |
| 797 | dev_dbg(&priv->usb->dev, "rx mode in = %x\n", rx_mode); |
| 798 | |
| 799 | if (changed_flags & FIF_PROMISC_IN_BSS) { |
| 800 | /* unconditionally log net taps */ |
| 801 | if (*total_flags & FIF_PROMISC_IN_BSS) |
| 802 | rx_mode |= RCR_UNICAST; |
| 803 | else |
| 804 | rx_mode &= ~RCR_UNICAST; |
| 805 | } |
| 806 | |
| 807 | if (changed_flags & FIF_ALLMULTI) { |
| 808 | if (*total_flags & FIF_ALLMULTI) { |
| 809 | if (priv->mc_list_count > 2) |
| 810 | vnt_mac_set_filter(priv, ~0); |
| 811 | else |
| 812 | vnt_mac_set_filter(priv, multicast); |
| 813 | |
| 814 | rx_mode |= RCR_MULTICAST | RCR_BROADCAST; |
| 815 | } else { |
| 816 | rx_mode &= ~(RCR_MULTICAST | RCR_BROADCAST); |
| 817 | } |
| 818 | |
| 819 | } |
| 820 | |
| 821 | if (changed_flags & (FIF_OTHER_BSS | FIF_BCN_PRBRESP_PROMISC)) { |
| 822 | if (*total_flags & (FIF_OTHER_BSS | FIF_BCN_PRBRESP_PROMISC)) |
| 823 | rx_mode &= ~RCR_BSSID; |
| 824 | else |
| 825 | rx_mode |= RCR_BSSID; |
| 826 | } |
| 827 | |
| 828 | vnt_control_out_u8(priv, MESSAGE_REQUEST_MACREG, MAC_REG_RCR, rx_mode); |
| 829 | |
| 830 | dev_dbg(&priv->usb->dev, "rx mode out= %x\n", rx_mode); |
Malcolm Priestley | db8f37f | 2014-06-25 21:14:25 +0100 | [diff] [blame] | 831 | } |
| 832 | |
| 833 | static int vnt_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, |
| 834 | struct ieee80211_vif *vif, struct ieee80211_sta *sta, |
| 835 | struct ieee80211_key_conf *key) |
| 836 | { |
| 837 | struct vnt_private *priv = hw->priv; |
| 838 | |
| 839 | switch (cmd) { |
| 840 | case SET_KEY: |
| 841 | if (vnt_set_keys(hw, sta, vif, key)) |
| 842 | return -EOPNOTSUPP; |
| 843 | break; |
| 844 | case DISABLE_KEY: |
| 845 | if (test_bit(key->hw_key_idx, &priv->key_entry_inuse)) |
| 846 | clear_bit(key->hw_key_idx, &priv->key_entry_inuse); |
| 847 | default: |
| 848 | break; |
| 849 | } |
| 850 | |
| 851 | return 0; |
| 852 | } |
| 853 | |
Johannes Berg | a344d67 | 2014-06-12 22:24:31 +0200 | [diff] [blame] | 854 | static void vnt_sw_scan_start(struct ieee80211_hw *hw, |
| 855 | struct ieee80211_vif *vif, |
| 856 | const u8 *addr) |
Malcolm Priestley | db8f37f | 2014-06-25 21:14:25 +0100 | [diff] [blame] | 857 | { |
| 858 | struct vnt_private *priv = hw->priv; |
| 859 | |
Malcolm Priestley | 1ecd083 | 2014-06-28 23:55:46 +0100 | [diff] [blame] | 860 | vnt_set_bss_mode(priv); |
Malcolm Priestley | db8f37f | 2014-06-25 21:14:25 +0100 | [diff] [blame] | 861 | /* Set max sensitivity*/ |
Malcolm Priestley | 80dcc0a | 2014-07-16 22:21:58 +0100 | [diff] [blame] | 862 | vnt_update_pre_ed_threshold(priv, true); |
Malcolm Priestley | db8f37f | 2014-06-25 21:14:25 +0100 | [diff] [blame] | 863 | } |
| 864 | |
Johannes Berg | a344d67 | 2014-06-12 22:24:31 +0200 | [diff] [blame] | 865 | static void vnt_sw_scan_complete(struct ieee80211_hw *hw, |
| 866 | struct ieee80211_vif *vif) |
Malcolm Priestley | db8f37f | 2014-06-25 21:14:25 +0100 | [diff] [blame] | 867 | { |
| 868 | struct vnt_private *priv = hw->priv; |
| 869 | |
| 870 | /* Return sensitivity to channel level*/ |
Malcolm Priestley | 80dcc0a | 2014-07-16 22:21:58 +0100 | [diff] [blame] | 871 | vnt_update_pre_ed_threshold(priv, false); |
Malcolm Priestley | db8f37f | 2014-06-25 21:14:25 +0100 | [diff] [blame] | 872 | } |
| 873 | |
Malcolm Priestley | 1786384 | 2014-06-29 20:39:54 +0100 | [diff] [blame] | 874 | static int vnt_get_stats(struct ieee80211_hw *hw, |
| 875 | struct ieee80211_low_level_stats *stats) |
| 876 | { |
| 877 | struct vnt_private *priv = hw->priv; |
| 878 | |
| 879 | memcpy(stats, &priv->low_stats, sizeof(*stats)); |
| 880 | |
| 881 | return 0; |
| 882 | } |
| 883 | |
Malcolm Priestley | db8f37f | 2014-06-25 21:14:25 +0100 | [diff] [blame] | 884 | static u64 vnt_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif) |
| 885 | { |
| 886 | struct vnt_private *priv = hw->priv; |
| 887 | |
Malcolm Priestley | 113f0b9 | 2014-07-19 12:30:13 +0100 | [diff] [blame] | 888 | return priv->current_tsf; |
Malcolm Priestley | db8f37f | 2014-06-25 21:14:25 +0100 | [diff] [blame] | 889 | } |
| 890 | |
| 891 | static void vnt_set_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
| 892 | u64 tsf) |
| 893 | { |
| 894 | struct vnt_private *priv = hw->priv; |
| 895 | |
| 896 | vnt_update_next_tbtt(priv, tsf, vif->bss_conf.beacon_int); |
| 897 | } |
| 898 | |
| 899 | static void vnt_reset_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif) |
| 900 | { |
| 901 | struct vnt_private *priv = hw->priv; |
| 902 | |
| 903 | vnt_mac_reg_bits_off(priv, MAC_REG_TFTCTL, TFTCTL_TSFCNTREN); |
| 904 | |
| 905 | vnt_clear_current_tsf(priv); |
| 906 | } |
| 907 | |
| 908 | static const struct ieee80211_ops vnt_mac_ops = { |
| 909 | .tx = vnt_tx_80211, |
| 910 | .start = vnt_start, |
| 911 | .stop = vnt_stop, |
| 912 | .add_interface = vnt_add_interface, |
| 913 | .remove_interface = vnt_remove_interface, |
| 914 | .config = vnt_config, |
| 915 | .bss_info_changed = vnt_bss_info_changed, |
| 916 | .prepare_multicast = vnt_prepare_multicast, |
| 917 | .configure_filter = vnt_configure, |
| 918 | .set_key = vnt_set_key, |
| 919 | .sw_scan_start = vnt_sw_scan_start, |
| 920 | .sw_scan_complete = vnt_sw_scan_complete, |
Malcolm Priestley | 1786384 | 2014-06-29 20:39:54 +0100 | [diff] [blame] | 921 | .get_stats = vnt_get_stats, |
Malcolm Priestley | db8f37f | 2014-06-25 21:14:25 +0100 | [diff] [blame] | 922 | .get_tsf = vnt_get_tsf, |
| 923 | .set_tsf = vnt_set_tsf, |
| 924 | .reset_tsf = vnt_reset_tsf, |
| 925 | }; |
| 926 | |
| 927 | int vnt_init(struct vnt_private *priv) |
| 928 | { |
| 929 | |
Malcolm Priestley | 500e1fb | 2014-07-25 20:51:46 +0100 | [diff] [blame] | 930 | if (!(vnt_init_registers(priv))) |
Malcolm Priestley | db8f37f | 2014-06-25 21:14:25 +0100 | [diff] [blame] | 931 | return -EAGAIN; |
| 932 | |
Malcolm Priestley | 41e8321 | 2014-07-19 12:30:11 +0100 | [diff] [blame] | 933 | SET_IEEE80211_PERM_ADDR(priv->hw, priv->permanent_net_addr); |
Malcolm Priestley | db8f37f | 2014-06-25 21:14:25 +0100 | [diff] [blame] | 934 | |
Malcolm Priestley | 110f97e | 2014-06-25 21:14:26 +0100 | [diff] [blame] | 935 | vnt_init_bands(priv); |
| 936 | |
Malcolm Priestley | db8f37f | 2014-06-25 21:14:25 +0100 | [diff] [blame] | 937 | if (ieee80211_register_hw(priv->hw)) |
| 938 | return -ENODEV; |
| 939 | |
Malcolm Priestley | 30816f8 | 2014-06-25 21:14:27 +0100 | [diff] [blame] | 940 | priv->mac_hw = true; |
| 941 | |
Malcolm Priestley | ba911c9 | 2014-07-05 19:24:20 +0100 | [diff] [blame] | 942 | vnt_radio_power_off(priv); |
| 943 | |
Malcolm Priestley | db8f37f | 2014-06-25 21:14:25 +0100 | [diff] [blame] | 944 | return 0; |
| 945 | } |
| 946 | |
| 947 | static int |
| 948 | vt6656_probe(struct usb_interface *intf, const struct usb_device_id *id) |
| 949 | { |
| 950 | struct usb_device *udev; |
| 951 | struct vnt_private *priv; |
| 952 | struct ieee80211_hw *hw; |
| 953 | struct wiphy *wiphy; |
| 954 | int rc = 0; |
| 955 | |
| 956 | udev = usb_get_dev(interface_to_usbdev(intf)); |
| 957 | |
| 958 | dev_notice(&udev->dev, "%s Ver. %s\n", |
| 959 | DEVICE_FULL_DRV_NAM, DEVICE_VERSION); |
| 960 | dev_notice(&udev->dev, |
| 961 | "Copyright (c) 2004 VIA Networking Technologies, Inc.\n"); |
| 962 | |
| 963 | hw = ieee80211_alloc_hw(sizeof(struct vnt_private), &vnt_mac_ops); |
| 964 | if (!hw) { |
| 965 | dev_err(&udev->dev, "could not register ieee80211_hw\n"); |
| 966 | goto err_nomem; |
| 967 | } |
| 968 | |
| 969 | priv = hw->priv; |
| 970 | priv->hw = hw; |
| 971 | priv->usb = udev; |
| 972 | |
Malcolm Priestley | 7665cf2 | 2014-07-25 20:51:45 +0100 | [diff] [blame] | 973 | vnt_set_options(priv); |
Malcolm Priestley | db8f37f | 2014-06-25 21:14:25 +0100 | [diff] [blame] | 974 | |
| 975 | spin_lock_init(&priv->lock); |
| 976 | mutex_init(&priv->usb_lock); |
| 977 | |
Malcolm Priestley | 592365ae4a | 2014-07-13 10:42:49 +0100 | [diff] [blame] | 978 | INIT_DELAYED_WORK(&priv->run_command_work, vnt_run_command); |
Malcolm Priestley | db8f37f | 2014-06-25 21:14:25 +0100 | [diff] [blame] | 979 | |
Malcolm Priestley | db8f37f | 2014-06-25 21:14:25 +0100 | [diff] [blame] | 980 | usb_set_intfdata(intf, priv); |
| 981 | |
| 982 | wiphy = priv->hw->wiphy; |
| 983 | |
| 984 | wiphy->frag_threshold = FRAG_THRESH_DEF; |
| 985 | wiphy->rts_threshold = RTS_THRESH_DEF; |
| 986 | wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | |
| 987 | BIT(NL80211_IFTYPE_ADHOC) | BIT(NL80211_IFTYPE_AP); |
| 988 | |
| 989 | priv->hw->flags = IEEE80211_HW_RX_INCLUDES_FCS | |
| 990 | IEEE80211_HW_REPORTS_TX_ACK_STATUS | |
| 991 | IEEE80211_HW_SIGNAL_DBM | |
| 992 | IEEE80211_HW_TIMING_BEACON_ONLY; |
| 993 | |
Malcolm Priestley | db8f37f | 2014-06-25 21:14:25 +0100 | [diff] [blame] | 994 | priv->hw->max_signal = 100; |
| 995 | |
| 996 | SET_IEEE80211_DEV(priv->hw, &intf->dev); |
| 997 | |
| 998 | usb_device_reset(priv); |
| 999 | |
Malcolm Priestley | 2ab3d46 | 2014-07-24 21:13:18 +0100 | [diff] [blame] | 1000 | clear_bit(DEVICE_FLAGS_DISCONNECTED, &priv->flags); |
Malcolm Priestley | 68cc161 | 2014-07-13 10:42:51 +0100 | [diff] [blame] | 1001 | vnt_reset_command_timer(priv); |
Malcolm Priestley | 30816f8 | 2014-06-25 21:14:27 +0100 | [diff] [blame] | 1002 | |
Malcolm Priestley | 57981a6 | 2014-07-13 10:42:50 +0100 | [diff] [blame] | 1003 | vnt_schedule_command(priv, WLAN_CMD_INIT_MAC80211); |
Malcolm Priestley | 30816f8 | 2014-06-25 21:14:27 +0100 | [diff] [blame] | 1004 | |
Malcolm Priestley | db8f37f | 2014-06-25 21:14:25 +0100 | [diff] [blame] | 1005 | return 0; |
| 1006 | |
| 1007 | err_nomem: |
| 1008 | usb_put_dev(udev); |
| 1009 | |
| 1010 | return rc; |
| 1011 | } |
| 1012 | |
Bill Pemberton | 0d7fe14 | 2012-11-19 13:26:58 -0500 | [diff] [blame] | 1013 | static void vt6656_disconnect(struct usb_interface *intf) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1014 | { |
Malcolm Priestley | db8f37f | 2014-06-25 21:14:25 +0100 | [diff] [blame] | 1015 | struct vnt_private *priv = usb_get_intfdata(intf); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1016 | |
Malcolm Priestley | db8f37f | 2014-06-25 21:14:25 +0100 | [diff] [blame] | 1017 | if (!priv) |
Andres More | 6cda24f | 2010-06-22 20:43:39 -0300 | [diff] [blame] | 1018 | return; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1019 | |
Malcolm Priestley | 30816f8 | 2014-06-25 21:14:27 +0100 | [diff] [blame] | 1020 | if (priv->mac_hw) |
| 1021 | ieee80211_unregister_hw(priv->hw); |
Malcolm Priestley | db8f37f | 2014-06-25 21:14:25 +0100 | [diff] [blame] | 1022 | |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1023 | usb_set_intfdata(intf, NULL); |
Andres More | 6cda24f | 2010-06-22 20:43:39 -0300 | [diff] [blame] | 1024 | usb_put_dev(interface_to_usbdev(intf)); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1025 | |
Malcolm Priestley | 4c3b0d4 | 2014-07-24 21:13:17 +0100 | [diff] [blame] | 1026 | set_bit(DEVICE_FLAGS_UNPLUG, &priv->flags); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1027 | |
Malcolm Priestley | db8f37f | 2014-06-25 21:14:25 +0100 | [diff] [blame] | 1028 | ieee80211_free_hw(priv->hw); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1029 | } |
| 1030 | |
Malcolm Priestley | db8f37f | 2014-06-25 21:14:25 +0100 | [diff] [blame] | 1031 | #ifdef CONFIG_PM |
| 1032 | |
| 1033 | static int vt6656_suspend(struct usb_interface *intf, pm_message_t message) |
| 1034 | { |
| 1035 | return 0; |
| 1036 | } |
| 1037 | |
| 1038 | static int vt6656_resume(struct usb_interface *intf) |
| 1039 | { |
| 1040 | return 0; |
| 1041 | } |
| 1042 | |
| 1043 | #endif /* CONFIG_PM */ |
| 1044 | |
Andres More | 26e5b65 | 2010-04-13 19:43:07 -0300 | [diff] [blame] | 1045 | MODULE_DEVICE_TABLE(usb, vt6656_table); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1046 | |
Andres More | 26e5b65 | 2010-04-13 19:43:07 -0300 | [diff] [blame] | 1047 | static struct usb_driver vt6656_driver = { |
| 1048 | .name = DEVICE_NAME, |
| 1049 | .probe = vt6656_probe, |
| 1050 | .disconnect = vt6656_disconnect, |
| 1051 | .id_table = vt6656_table, |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1052 | #ifdef CONFIG_PM |
Andres More | 26e5b65 | 2010-04-13 19:43:07 -0300 | [diff] [blame] | 1053 | .suspend = vt6656_suspend, |
| 1054 | .resume = vt6656_resume, |
| 1055 | #endif /* CONFIG_PM */ |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1056 | }; |
| 1057 | |
Greg Kroah-Hartman | bac2c12 | 2011-11-18 09:42:11 -0800 | [diff] [blame] | 1058 | module_usb_driver(vt6656_driver); |