| .. | .. |
|---|
| 22 | 22 | #include "mac.h" |
|---|
| 23 | 23 | #include "usbpipe.h" |
|---|
| 24 | 24 | |
|---|
| 25 | | -/* |
|---|
| 26 | | - * Description: |
|---|
| 27 | | - * Write MAC Multicast Address Mask |
|---|
| 28 | | - * |
|---|
| 29 | | - * Parameters: |
|---|
| 30 | | - * In: |
|---|
| 31 | | - * mc_filter (mac filter) |
|---|
| 32 | | - * Out: |
|---|
| 33 | | - * none |
|---|
| 34 | | - * |
|---|
| 35 | | - * Return Value: none |
|---|
| 36 | | - * |
|---|
| 37 | | - */ |
|---|
| 38 | | -void vnt_mac_set_filter(struct vnt_private *priv, u64 mc_filter) |
|---|
| 25 | +int vnt_mac_set_filter(struct vnt_private *priv, u64 mc_filter) |
|---|
| 39 | 26 | { |
|---|
| 40 | 27 | __le64 le_mc = cpu_to_le64(mc_filter); |
|---|
| 41 | 28 | |
|---|
| 42 | | - vnt_control_out(priv, MESSAGE_TYPE_WRITE, MAC_REG_MAR0, |
|---|
| 43 | | - MESSAGE_REQUEST_MACREG, sizeof(le_mc), (u8 *)&le_mc); |
|---|
| 29 | + return vnt_control_out(priv, MESSAGE_TYPE_WRITE, MAC_REG_MAR0, |
|---|
| 30 | + MESSAGE_REQUEST_MACREG, sizeof(le_mc), |
|---|
| 31 | + (u8 *)&le_mc); |
|---|
| 44 | 32 | } |
|---|
| 45 | 33 | |
|---|
| 46 | | -/* |
|---|
| 47 | | - * Description: |
|---|
| 48 | | - * Shut Down MAC |
|---|
| 49 | | - * |
|---|
| 50 | | - * Parameters: |
|---|
| 51 | | - * In: |
|---|
| 52 | | - * Out: |
|---|
| 53 | | - * none |
|---|
| 54 | | - * |
|---|
| 55 | | - * |
|---|
| 56 | | - */ |
|---|
| 57 | | -void vnt_mac_shutdown(struct vnt_private *priv) |
|---|
| 34 | +int vnt_mac_shutdown(struct vnt_private *priv) |
|---|
| 58 | 35 | { |
|---|
| 59 | | - vnt_control_out(priv, MESSAGE_TYPE_MACSHUTDOWN, 0, 0, 0, NULL); |
|---|
| 36 | + return vnt_control_out(priv, MESSAGE_TYPE_MACSHUTDOWN, 0, 0, 0, NULL); |
|---|
| 60 | 37 | } |
|---|
| 61 | 38 | |
|---|
| 62 | | -void vnt_mac_set_bb_type(struct vnt_private *priv, u8 type) |
|---|
| 39 | +int vnt_mac_set_bb_type(struct vnt_private *priv, u8 type) |
|---|
| 63 | 40 | { |
|---|
| 64 | 41 | u8 data[2]; |
|---|
| 65 | 42 | |
|---|
| 66 | 43 | data[0] = type; |
|---|
| 67 | 44 | data[1] = EnCFG_BBType_MASK; |
|---|
| 68 | 45 | |
|---|
| 69 | | - vnt_control_out(priv, MESSAGE_TYPE_WRITE_MASK, MAC_REG_ENCFG0, |
|---|
| 70 | | - MESSAGE_REQUEST_MACREG, ARRAY_SIZE(data), data); |
|---|
| 46 | + return vnt_control_out(priv, MESSAGE_TYPE_WRITE_MASK, MAC_REG_ENCFG0, |
|---|
| 47 | + MESSAGE_REQUEST_MACREG, ARRAY_SIZE(data), |
|---|
| 48 | + data); |
|---|
| 71 | 49 | } |
|---|
| 72 | 50 | |
|---|
| 73 | | -/* |
|---|
| 74 | | - * Description: |
|---|
| 75 | | - * Disable the Key Entry by MISCFIFO |
|---|
| 76 | | - * |
|---|
| 77 | | - * Parameters: |
|---|
| 78 | | - * In: |
|---|
| 79 | | - * dwIoBase - Base Address for MAC |
|---|
| 80 | | - * |
|---|
| 81 | | - * Out: |
|---|
| 82 | | - * none |
|---|
| 83 | | - * |
|---|
| 84 | | - * Return Value: none |
|---|
| 85 | | - * |
|---|
| 86 | | - */ |
|---|
| 87 | | -void vnt_mac_disable_keyentry(struct vnt_private *priv, u8 entry_idx) |
|---|
| 51 | +int vnt_mac_disable_keyentry(struct vnt_private *priv, u8 entry_idx) |
|---|
| 88 | 52 | { |
|---|
| 89 | | - vnt_control_out(priv, MESSAGE_TYPE_CLRKEYENTRY, 0, 0, |
|---|
| 90 | | - sizeof(entry_idx), &entry_idx); |
|---|
| 53 | + return vnt_control_out(priv, MESSAGE_TYPE_CLRKEYENTRY, 0, 0, |
|---|
| 54 | + sizeof(entry_idx), &entry_idx); |
|---|
| 91 | 55 | } |
|---|
| 92 | 56 | |
|---|
| 93 | | -/* |
|---|
| 94 | | - * Description: |
|---|
| 95 | | - * Set the Key by MISCFIFO |
|---|
| 96 | | - * |
|---|
| 97 | | - * Parameters: |
|---|
| 98 | | - * In: |
|---|
| 99 | | - * dwIoBase - Base Address for MAC |
|---|
| 100 | | - * |
|---|
| 101 | | - * Out: |
|---|
| 102 | | - * none |
|---|
| 103 | | - * |
|---|
| 104 | | - * Return Value: none |
|---|
| 105 | | - * |
|---|
| 106 | | - */ |
|---|
| 107 | | -void vnt_mac_set_keyentry(struct vnt_private *priv, u16 key_ctl, u32 entry_idx, |
|---|
| 108 | | - u32 key_idx, u8 *addr, u8 *key) |
|---|
| 57 | +int vnt_mac_set_keyentry(struct vnt_private *priv, u16 key_ctl, u32 entry_idx, |
|---|
| 58 | + u32 key_idx, u8 *addr, u8 *key) |
|---|
| 109 | 59 | { |
|---|
| 110 | 60 | struct vnt_mac_set_key set_key; |
|---|
| 111 | 61 | u16 offset; |
|---|
| .. | .. |
|---|
| 124 | 74 | dev_dbg(&priv->usb->dev, "offset %d key ctl %d set key %24ph\n", |
|---|
| 125 | 75 | offset, key_ctl, (u8 *)&set_key); |
|---|
| 126 | 76 | |
|---|
| 127 | | - vnt_control_out(priv, MESSAGE_TYPE_SETKEY, offset, |
|---|
| 128 | | - (u16)key_idx, sizeof(struct vnt_mac_set_key), |
|---|
| 129 | | - (u8 *)&set_key); |
|---|
| 77 | + return vnt_control_out(priv, MESSAGE_TYPE_SETKEY, offset, |
|---|
| 78 | + (u16)key_idx, sizeof(struct vnt_mac_set_key), |
|---|
| 79 | + (u8 *)&set_key); |
|---|
| 130 | 80 | } |
|---|
| 131 | 81 | |
|---|
| 132 | | -void vnt_mac_reg_bits_off(struct vnt_private *priv, u8 reg_ofs, u8 bits) |
|---|
| 82 | +int vnt_mac_reg_bits_off(struct vnt_private *priv, u8 reg_ofs, u8 bits) |
|---|
| 133 | 83 | { |
|---|
| 134 | 84 | u8 data[2]; |
|---|
| 135 | 85 | |
|---|
| 136 | 86 | data[0] = 0; |
|---|
| 137 | 87 | data[1] = bits; |
|---|
| 138 | 88 | |
|---|
| 139 | | - vnt_control_out(priv, MESSAGE_TYPE_WRITE_MASK, |
|---|
| 140 | | - reg_ofs, MESSAGE_REQUEST_MACREG, ARRAY_SIZE(data), |
|---|
| 141 | | - data); |
|---|
| 89 | + return vnt_control_out(priv, MESSAGE_TYPE_WRITE_MASK, reg_ofs, |
|---|
| 90 | + MESSAGE_REQUEST_MACREG, ARRAY_SIZE(data), data); |
|---|
| 142 | 91 | } |
|---|
| 143 | 92 | |
|---|
| 144 | | -void vnt_mac_reg_bits_on(struct vnt_private *priv, u8 reg_ofs, u8 bits) |
|---|
| 93 | +int vnt_mac_reg_bits_on(struct vnt_private *priv, u8 reg_ofs, u8 bits) |
|---|
| 145 | 94 | { |
|---|
| 146 | 95 | u8 data[2]; |
|---|
| 147 | 96 | |
|---|
| 148 | 97 | data[0] = bits; |
|---|
| 149 | 98 | data[1] = bits; |
|---|
| 150 | 99 | |
|---|
| 151 | | - vnt_control_out(priv, MESSAGE_TYPE_WRITE_MASK, reg_ofs, |
|---|
| 152 | | - MESSAGE_REQUEST_MACREG, ARRAY_SIZE(data), data); |
|---|
| 100 | + return vnt_control_out(priv, MESSAGE_TYPE_WRITE_MASK, reg_ofs, |
|---|
| 101 | + MESSAGE_REQUEST_MACREG, ARRAY_SIZE(data), data); |
|---|
| 153 | 102 | } |
|---|
| 154 | 103 | |
|---|
| 155 | | -void vnt_mac_write_word(struct vnt_private *priv, u8 reg_ofs, u16 word) |
|---|
| 104 | +int vnt_mac_write_word(struct vnt_private *priv, u8 reg_ofs, u16 word) |
|---|
| 156 | 105 | { |
|---|
| 157 | 106 | u8 data[2]; |
|---|
| 158 | 107 | |
|---|
| 159 | 108 | data[0] = (u8)(word & 0xff); |
|---|
| 160 | 109 | data[1] = (u8)(word >> 8); |
|---|
| 161 | 110 | |
|---|
| 162 | | - vnt_control_out(priv, MESSAGE_TYPE_WRITE, reg_ofs, |
|---|
| 163 | | - MESSAGE_REQUEST_MACREG, ARRAY_SIZE(data), data); |
|---|
| 111 | + return vnt_control_out(priv, MESSAGE_TYPE_WRITE, reg_ofs, |
|---|
| 112 | + MESSAGE_REQUEST_MACREG, ARRAY_SIZE(data), data); |
|---|
| 164 | 113 | } |
|---|
| 165 | 114 | |
|---|
| 166 | | -void vnt_mac_set_bssid_addr(struct vnt_private *priv, u8 *addr) |
|---|
| 115 | +int vnt_mac_set_bssid_addr(struct vnt_private *priv, u8 *addr) |
|---|
| 167 | 116 | { |
|---|
| 168 | | - vnt_control_out(priv, MESSAGE_TYPE_WRITE, MAC_REG_BSSID0, |
|---|
| 169 | | - MESSAGE_REQUEST_MACREG, ETH_ALEN, addr); |
|---|
| 117 | + return vnt_control_out(priv, MESSAGE_TYPE_WRITE, MAC_REG_BSSID0, |
|---|
| 118 | + MESSAGE_REQUEST_MACREG, ETH_ALEN, addr); |
|---|
| 170 | 119 | } |
|---|
| 171 | 120 | |
|---|
| 172 | | -void vnt_mac_enable_protect_mode(struct vnt_private *priv) |
|---|
| 121 | +int vnt_mac_enable_protect_mode(struct vnt_private *priv) |
|---|
| 173 | 122 | { |
|---|
| 174 | 123 | u8 data[2]; |
|---|
| 175 | 124 | |
|---|
| 176 | 125 | data[0] = EnCFG_ProtectMd; |
|---|
| 177 | 126 | data[1] = EnCFG_ProtectMd; |
|---|
| 178 | 127 | |
|---|
| 179 | | - vnt_control_out(priv, MESSAGE_TYPE_WRITE_MASK, MAC_REG_ENCFG0, |
|---|
| 180 | | - MESSAGE_REQUEST_MACREG, ARRAY_SIZE(data), data); |
|---|
| 128 | + return vnt_control_out(priv, MESSAGE_TYPE_WRITE_MASK, MAC_REG_ENCFG0, |
|---|
| 129 | + MESSAGE_REQUEST_MACREG, ARRAY_SIZE(data), data); |
|---|
| 181 | 130 | } |
|---|
| 182 | 131 | |
|---|
| 183 | | -void vnt_mac_disable_protect_mode(struct vnt_private *priv) |
|---|
| 132 | +int vnt_mac_disable_protect_mode(struct vnt_private *priv) |
|---|
| 184 | 133 | { |
|---|
| 185 | 134 | u8 data[2]; |
|---|
| 186 | 135 | |
|---|
| 187 | 136 | data[0] = 0; |
|---|
| 188 | 137 | data[1] = EnCFG_ProtectMd; |
|---|
| 189 | 138 | |
|---|
| 190 | | - vnt_control_out(priv, MESSAGE_TYPE_WRITE_MASK, MAC_REG_ENCFG0, |
|---|
| 191 | | - MESSAGE_REQUEST_MACREG, ARRAY_SIZE(data), data); |
|---|
| 139 | + return vnt_control_out(priv, MESSAGE_TYPE_WRITE_MASK, MAC_REG_ENCFG0, |
|---|
| 140 | + MESSAGE_REQUEST_MACREG, ARRAY_SIZE(data), data); |
|---|
| 192 | 141 | } |
|---|
| 193 | 142 | |
|---|
| 194 | | -void vnt_mac_enable_barker_preamble_mode(struct vnt_private *priv) |
|---|
| 143 | +int vnt_mac_enable_barker_preamble_mode(struct vnt_private *priv) |
|---|
| 195 | 144 | { |
|---|
| 196 | 145 | u8 data[2]; |
|---|
| 197 | 146 | |
|---|
| 198 | 147 | data[0] = EnCFG_BarkerPream; |
|---|
| 199 | 148 | data[1] = EnCFG_BarkerPream; |
|---|
| 200 | 149 | |
|---|
| 201 | | - vnt_control_out(priv, MESSAGE_TYPE_WRITE_MASK, MAC_REG_ENCFG2, |
|---|
| 202 | | - MESSAGE_REQUEST_MACREG, ARRAY_SIZE(data), data); |
|---|
| 150 | + return vnt_control_out(priv, MESSAGE_TYPE_WRITE_MASK, MAC_REG_ENCFG2, |
|---|
| 151 | + MESSAGE_REQUEST_MACREG, ARRAY_SIZE(data), data); |
|---|
| 203 | 152 | } |
|---|
| 204 | 153 | |
|---|
| 205 | | -void vnt_mac_disable_barker_preamble_mode(struct vnt_private *priv) |
|---|
| 154 | +int vnt_mac_disable_barker_preamble_mode(struct vnt_private *priv) |
|---|
| 206 | 155 | { |
|---|
| 207 | 156 | u8 data[2]; |
|---|
| 208 | 157 | |
|---|
| 209 | 158 | data[0] = 0; |
|---|
| 210 | 159 | data[1] = EnCFG_BarkerPream; |
|---|
| 211 | 160 | |
|---|
| 212 | | - vnt_control_out(priv, MESSAGE_TYPE_WRITE_MASK, MAC_REG_ENCFG2, |
|---|
| 213 | | - MESSAGE_REQUEST_MACREG, ARRAY_SIZE(data), data); |
|---|
| 161 | + return vnt_control_out(priv, MESSAGE_TYPE_WRITE_MASK, MAC_REG_ENCFG2, |
|---|
| 162 | + MESSAGE_REQUEST_MACREG, ARRAY_SIZE(data), data); |
|---|
| 214 | 163 | } |
|---|
| 215 | 164 | |
|---|
| 216 | | -void vnt_mac_set_beacon_interval(struct vnt_private *priv, u16 interval) |
|---|
| 165 | +int vnt_mac_set_beacon_interval(struct vnt_private *priv, u16 interval) |
|---|
| 217 | 166 | { |
|---|
| 218 | 167 | u8 data[2]; |
|---|
| 219 | 168 | |
|---|
| 220 | 169 | data[0] = (u8)(interval & 0xff); |
|---|
| 221 | 170 | data[1] = (u8)(interval >> 8); |
|---|
| 222 | 171 | |
|---|
| 223 | | - vnt_control_out(priv, MESSAGE_TYPE_WRITE, MAC_REG_BI, |
|---|
| 224 | | - MESSAGE_REQUEST_MACREG, ARRAY_SIZE(data), data); |
|---|
| 172 | + return vnt_control_out(priv, MESSAGE_TYPE_WRITE, MAC_REG_BI, |
|---|
| 173 | + MESSAGE_REQUEST_MACREG, ARRAY_SIZE(data), data); |
|---|
| 225 | 174 | } |
|---|
| 226 | 175 | |
|---|
| 227 | | -void vnt_mac_set_led(struct vnt_private *priv, u8 state, u8 led) |
|---|
| 176 | +int vnt_mac_set_led(struct vnt_private *priv, u8 state, u8 led) |
|---|
| 228 | 177 | { |
|---|
| 229 | 178 | u8 data[2]; |
|---|
| 230 | 179 | |
|---|
| 231 | 180 | data[0] = led; |
|---|
| 232 | 181 | data[1] = state; |
|---|
| 233 | 182 | |
|---|
| 234 | | - vnt_control_out(priv, MESSAGE_TYPE_WRITE_MASK, MAC_REG_PAPEDELAY, |
|---|
| 235 | | - MESSAGE_REQUEST_MACREG, ARRAY_SIZE(data), data); |
|---|
| 183 | + return vnt_control_out(priv, MESSAGE_TYPE_WRITE_MASK, MAC_REG_PAPEDELAY, |
|---|
| 184 | + MESSAGE_REQUEST_MACREG, ARRAY_SIZE(data), data); |
|---|
| 236 | 185 | } |
|---|