mwifiex: get_channel from firmware
[muen/linux.git] / drivers / net / wireless / marvell / mwifiex / sta_cmd.c
index 211e47d8b3181ddab78d90f293953eaf714b3d2b..4ed10cf82f9a4c7459e6429087eca637470afd40 100644 (file)
@@ -1898,6 +1898,25 @@ static int mwifiex_cmd_get_wakeup_reason(struct mwifiex_private *priv,
        return 0;
 }
 
+static int mwifiex_cmd_get_chan_info(struct host_cmd_ds_command *cmd,
+                                    u16 cmd_action)
+{
+       struct host_cmd_ds_sta_configure *sta_cfg_cmd = &cmd->params.sta_cfg;
+       struct host_cmd_tlv_channel_band *tlv_band_channel =
+       (struct host_cmd_tlv_channel_band *)sta_cfg_cmd->tlv_buffer;
+
+       cmd->command = cpu_to_le16(HostCmd_CMD_STA_CONFIGURE);
+       cmd->size = cpu_to_le16(sizeof(*sta_cfg_cmd) +
+                               sizeof(*tlv_band_channel) + S_DS_GEN);
+       sta_cfg_cmd->action = cpu_to_le16(cmd_action);
+       memset(tlv_band_channel, 0, sizeof(*tlv_band_channel));
+       tlv_band_channel->header.type = cpu_to_le16(TLV_TYPE_CHANNELBANDLIST);
+       tlv_band_channel->header.len  = cpu_to_le16(sizeof(*tlv_band_channel) -
+                                       sizeof(struct mwifiex_ie_types_header));
+
+       return 0;
+}
+
 /* This function check if the command is supported by firmware */
 static int mwifiex_is_cmd_supported(struct mwifiex_private *priv, u16 cmd_no)
 {
@@ -2210,6 +2229,9 @@ int mwifiex_sta_prepare_cmd(struct mwifiex_private *priv, uint16_t cmd_no,
                cmd_ptr->command = cpu_to_le16(cmd_no);
                cmd_ptr->size = cpu_to_le16(S_DS_GEN);
                break;
+       case HostCmd_CMD_STA_CONFIGURE:
+               ret = mwifiex_cmd_get_chan_info(cmd_ptr, cmd_action);
+               break;
        default:
                mwifiex_dbg(priv->adapter, ERROR,
                            "PREP_CMD: unknown cmd- %#x\n", cmd_no);