aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorEliad Peller <eliad@wizery.com>2014-07-10 20:01:31 -0400
committerJohn W. Linville <linville@tuxdriver.com>2014-07-15 15:59:56 -0400
commitccb1df948085abcac0a91154e9cabeb563b65833 (patch)
treea4543e11d27f7166429f45f753832b315a5abc34 /drivers
parent936c50dd0605d7d81772f53700ef42f45525ffad (diff)
wlcore/wl18xx: add smart config commands
These commands configures the fw to set key, enter smart config mode, and exit it. Add relevant hw ops as well. Signed-off-by: Eliad Peller <eliad@wizery.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/ti/wl18xx/cmd.c89
-rw-r--r--drivers/net/wireless/ti/wl18xx/cmd.h5
-rw-r--r--drivers/net/wireless/ti/wl18xx/main.c3
-rw-r--r--drivers/net/wireless/ti/wlcore/hw_ops.h27
-rw-r--r--drivers/net/wireless/ti/wlcore/wlcore.h4
5 files changed, 127 insertions, 1 deletions
diff --git a/drivers/net/wireless/ti/wl18xx/cmd.c b/drivers/net/wireless/ti/wl18xx/cmd.c
index 7649c75cd68d..44f0b205b065 100644
--- a/drivers/net/wireless/ti/wl18xx/cmd.c
+++ b/drivers/net/wireless/ti/wl18xx/cmd.c
@@ -78,3 +78,92 @@ out_free:
78out: 78out:
79 return ret; 79 return ret;
80} 80}
81
82int wl18xx_cmd_smart_config_start(struct wl1271 *wl, u32 group_bitmap)
83{
84 struct wl18xx_cmd_smart_config_start *cmd;
85 int ret = 0;
86
87 wl1271_debug(DEBUG_CMD, "cmd smart config start group_bitmap=0x%x",
88 group_bitmap);
89
90 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
91 if (!cmd) {
92 ret = -ENOMEM;
93 goto out;
94 }
95
96 cmd->group_id_bitmask = cpu_to_le32(group_bitmap);
97
98 ret = wl1271_cmd_send(wl, CMD_SMART_CONFIG_START, cmd, sizeof(*cmd), 0);
99 if (ret < 0) {
100 wl1271_error("failed to send smart config start command");
101 goto out_free;
102 }
103
104out_free:
105 kfree(cmd);
106out:
107 return ret;
108}
109
110int wl18xx_cmd_smart_config_stop(struct wl1271 *wl)
111{
112 struct wl1271_cmd_header *cmd;
113 int ret = 0;
114
115 wl1271_debug(DEBUG_CMD, "cmd smart config stop");
116
117 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
118 if (!cmd) {
119 ret = -ENOMEM;
120 goto out;
121 }
122
123 ret = wl1271_cmd_send(wl, CMD_SMART_CONFIG_STOP, cmd, sizeof(*cmd), 0);
124 if (ret < 0) {
125 wl1271_error("failed to send smart config stop command");
126 goto out_free;
127 }
128
129out_free:
130 kfree(cmd);
131out:
132 return ret;
133}
134
135int wl18xx_cmd_smart_config_set_group_key(struct wl1271 *wl, u16 group_id,
136 u8 key_len, u8 *key)
137{
138 struct wl18xx_cmd_smart_config_set_group_key *cmd;
139 int ret = 0;
140
141 wl1271_debug(DEBUG_CMD, "cmd smart config set group key id=0x%x",
142 group_id);
143
144 if (key_len != sizeof(cmd->key)) {
145 wl1271_error("invalid group key size: %d", key_len);
146 return -E2BIG;
147 }
148
149 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
150 if (!cmd) {
151 ret = -ENOMEM;
152 goto out;
153 }
154
155 cmd->group_id = cpu_to_le32(group_id);
156 memcpy(cmd->key, key, key_len);
157
158 ret = wl1271_cmd_send(wl, CMD_SMART_CONFIG_SET_GROUP_KEY, cmd,
159 sizeof(*cmd), 0);
160 if (ret < 0) {
161 wl1271_error("failed to send smart config set group key cmd");
162 goto out_free;
163 }
164
165out_free:
166 kfree(cmd);
167out:
168 return ret;
169}
diff --git a/drivers/net/wireless/ti/wl18xx/cmd.h b/drivers/net/wireless/ti/wl18xx/cmd.h
index 03b746bf84f7..92499e2dfa83 100644
--- a/drivers/net/wireless/ti/wl18xx/cmd.h
+++ b/drivers/net/wireless/ti/wl18xx/cmd.h
@@ -62,5 +62,8 @@ struct wl18xx_cmd_smart_config_set_group_key {
62int wl18xx_cmd_channel_switch(struct wl1271 *wl, 62int wl18xx_cmd_channel_switch(struct wl1271 *wl,
63 struct wl12xx_vif *wlvif, 63 struct wl12xx_vif *wlvif,
64 struct ieee80211_channel_switch *ch_switch); 64 struct ieee80211_channel_switch *ch_switch);
65 65int wl18xx_cmd_smart_config_start(struct wl1271 *wl, u32 group_bitmap);
66int wl18xx_cmd_smart_config_stop(struct wl1271 *wl);
67int wl18xx_cmd_smart_config_set_group_key(struct wl1271 *wl, u16 group_id,
68 u8 key_len, u8 *key);
66#endif 69#endif
diff --git a/drivers/net/wireless/ti/wl18xx/main.c b/drivers/net/wireless/ti/wl18xx/main.c
index de5b4fa5d166..2727ca38807c 100644
--- a/drivers/net/wireless/ti/wl18xx/main.c
+++ b/drivers/net/wireless/ti/wl18xx/main.c
@@ -1687,6 +1687,9 @@ static struct wlcore_ops wl18xx_ops = {
1687 .convert_hwaddr = wl18xx_convert_hwaddr, 1687 .convert_hwaddr = wl18xx_convert_hwaddr,
1688 .lnk_high_prio = wl18xx_lnk_high_prio, 1688 .lnk_high_prio = wl18xx_lnk_high_prio,
1689 .lnk_low_prio = wl18xx_lnk_low_prio, 1689 .lnk_low_prio = wl18xx_lnk_low_prio,
1690 .smart_config_start = wl18xx_cmd_smart_config_start,
1691 .smart_config_stop = wl18xx_cmd_smart_config_stop,
1692 .smart_config_set_group_key = wl18xx_cmd_smart_config_set_group_key,
1690}; 1693};
1691 1694
1692/* HT cap appropriate for wide channels in 2Ghz */ 1695/* HT cap appropriate for wide channels in 2Ghz */
diff --git a/drivers/net/wireless/ti/wlcore/hw_ops.h b/drivers/net/wireless/ti/wlcore/hw_ops.h
index 1555ff970050..aa9f82c72296 100644
--- a/drivers/net/wireless/ti/wlcore/hw_ops.h
+++ b/drivers/net/wireless/ti/wlcore/hw_ops.h
@@ -260,4 +260,31 @@ wlcore_hw_lnk_low_prio(struct wl1271 *wl, u8 hlid,
260 return wl->ops->lnk_low_prio(wl, hlid, lnk); 260 return wl->ops->lnk_low_prio(wl, hlid, lnk);
261} 261}
262 262
263static inline int
264wlcore_smart_config_start(struct wl1271 *wl, u32 group_bitmap)
265{
266 if (!wl->ops->smart_config_start)
267 return -EINVAL;
268
269 return wl->ops->smart_config_start(wl, group_bitmap);
270}
271
272static inline int
273wlcore_smart_config_stop(struct wl1271 *wl)
274{
275 if (!wl->ops->smart_config_stop)
276 return -EINVAL;
277
278 return wl->ops->smart_config_stop(wl);
279}
280
281static inline int
282wlcore_smart_config_set_group_key(struct wl1271 *wl, u16 group_id,
283 u8 key_len, u8 *key)
284{
285 if (!wl->ops->smart_config_set_group_key)
286 return -EINVAL;
287
288 return wl->ops->smart_config_set_group_key(wl, group_id, key_len, key);
289}
263#endif 290#endif
diff --git a/drivers/net/wireless/ti/wlcore/wlcore.h b/drivers/net/wireless/ti/wlcore/wlcore.h
index 71320509b56d..13459c4f74d0 100644
--- a/drivers/net/wireless/ti/wlcore/wlcore.h
+++ b/drivers/net/wireless/ti/wlcore/wlcore.h
@@ -117,6 +117,10 @@ struct wlcore_ops {
117 struct wl1271_link *lnk); 117 struct wl1271_link *lnk);
118 bool (*lnk_low_prio)(struct wl1271 *wl, u8 hlid, 118 bool (*lnk_low_prio)(struct wl1271 *wl, u8 hlid,
119 struct wl1271_link *lnk); 119 struct wl1271_link *lnk);
120 int (*smart_config_start)(struct wl1271 *wl, u32 group_bitmap);
121 int (*smart_config_stop)(struct wl1271 *wl);
122 int (*smart_config_set_group_key)(struct wl1271 *wl, u16 group_id,
123 u8 key_len, u8 *key);
120}; 124};
121 125
122enum wlcore_partitions { 126enum wlcore_partitions {