Merge branch 'address-masking'
[linux-2.6-microblaze.git] / drivers / staging / vt6656 / channel.c
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
4  * All rights reserved.
5  *
6  * Purpose: Channel number mapping
7  *
8  * Author: Lucas Lin
9  *
10  * Date: Dec 24, 2004
11  *
12  *
13  *
14  * Revision History:
15  *      01-18-2005      RobertYu:       remove the for loop searching in
16  *                                      ChannelValid, change ChannelRuleTab
17  *                                      to lookup-type, reorder table items.
18  *
19  *
20  */
21
22 #include "device.h"
23 #include "channel.h"
24 #include "rf.h"
25
26 static struct ieee80211_rate vnt_rates_bg[] = {
27         { .bitrate = 10,  .hw_value = RATE_1M },
28         { .bitrate = 20,  .hw_value = RATE_2M },
29         { .bitrate = 55,  .hw_value = RATE_5M },
30         { .bitrate = 110, .hw_value = RATE_11M },
31         { .bitrate = 60,  .hw_value = RATE_6M },
32         { .bitrate = 90,  .hw_value = RATE_9M },
33         { .bitrate = 120, .hw_value = RATE_12M },
34         { .bitrate = 180, .hw_value = RATE_18M },
35         { .bitrate = 240, .hw_value = RATE_24M },
36         { .bitrate = 360, .hw_value = RATE_36M },
37         { .bitrate = 480, .hw_value = RATE_48M },
38         { .bitrate = 540, .hw_value = RATE_54M },
39 };
40
41 static struct ieee80211_channel vnt_channels_2ghz[] = {
42         { .center_freq = 2412, .hw_value = 1 },
43         { .center_freq = 2417, .hw_value = 2 },
44         { .center_freq = 2422, .hw_value = 3 },
45         { .center_freq = 2427, .hw_value = 4 },
46         { .center_freq = 2432, .hw_value = 5 },
47         { .center_freq = 2437, .hw_value = 6 },
48         { .center_freq = 2442, .hw_value = 7 },
49         { .center_freq = 2447, .hw_value = 8 },
50         { .center_freq = 2452, .hw_value = 9 },
51         { .center_freq = 2457, .hw_value = 10 },
52         { .center_freq = 2462, .hw_value = 11 },
53         { .center_freq = 2467, .hw_value = 12 },
54         { .center_freq = 2472, .hw_value = 13 },
55         { .center_freq = 2484, .hw_value = 14 }
56 };
57
58 static struct ieee80211_supported_band vnt_supported_2ghz_band = {
59         .channels = vnt_channels_2ghz,
60         .n_channels = ARRAY_SIZE(vnt_channels_2ghz),
61         .bitrates = vnt_rates_bg,
62         .n_bitrates = ARRAY_SIZE(vnt_rates_bg),
63 };
64
65 void vnt_init_bands(struct vnt_private *priv)
66 {
67         struct ieee80211_channel *ch;
68         int i;
69
70         ch = vnt_channels_2ghz;
71         for (i = 0; i < ARRAY_SIZE(vnt_channels_2ghz); i++) {
72                 ch[i].max_power = VNT_RF_MAX_POWER;
73                 ch[i].flags = IEEE80211_CHAN_NO_HT40;
74         }
75         priv->hw->wiphy->bands[NL80211_BAND_2GHZ] =
76                                         &vnt_supported_2ghz_band;
77 }