Commit b8023177 authored by Vladimir Kondratiev's avatar Vladimir Kondratiev Committed by John W. Linville

wil6210: sync with new firmware

Adjust driver for changes in the FW API.
Noticeable changes in the FW are:
- temperature sensing
- infrastructure for multiple connections
- infrastructure for P2P
- signal strength indication

This commit introduces only changes that are required to support same functionality
as previous firmware, no new features.
Signed-off-by: default avatarVladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 55f7acdd
...@@ -427,10 +427,6 @@ static int wil_cfg80211_start_ap(struct wiphy *wiphy, ...@@ -427,10 +427,6 @@ static int wil_cfg80211_start_ap(struct wiphy *wiphy,
if (rc) if (rc)
return rc; return rc;
rc = wmi_set_channel(wil, channel->hw_value);
if (rc)
return rc;
/* MAC address - pre-requisite for other commands */ /* MAC address - pre-requisite for other commands */
wmi_set_mac_address(wil, ndev->dev_addr); wmi_set_mac_address(wil, ndev->dev_addr);
...@@ -450,7 +446,8 @@ static int wil_cfg80211_start_ap(struct wiphy *wiphy, ...@@ -450,7 +446,8 @@ static int wil_cfg80211_start_ap(struct wiphy *wiphy,
wil->secure_pcp = info->privacy; wil->secure_pcp = info->privacy;
rc = wmi_set_bcon(wil, info->beacon_interval, wmi_nettype); rc = wmi_pcp_start(wil, info->beacon_interval, wmi_nettype,
channel->hw_value);
if (rc) if (rc)
return rc; return rc;
...@@ -467,11 +464,8 @@ static int wil_cfg80211_stop_ap(struct wiphy *wiphy, ...@@ -467,11 +464,8 @@ static int wil_cfg80211_stop_ap(struct wiphy *wiphy,
{ {
int rc = 0; int rc = 0;
struct wil6210_priv *wil = wiphy_to_wil(wiphy); struct wil6210_priv *wil = wiphy_to_wil(wiphy);
struct wireless_dev *wdev = ndev->ieee80211_ptr;
u8 wmi_nettype = wil_iftype_nl2wmi(wdev->iftype);
/* To stop beaconing, set BI to 0 */ rc = wmi_pcp_stop(wil);
rc = wmi_set_bcon(wil, 0, wmi_nettype);
return rc; return rc;
} }
......
...@@ -343,9 +343,9 @@ static int __wil_up(struct wil6210_priv *wil) ...@@ -343,9 +343,9 @@ static int __wil_up(struct wil6210_priv *wil)
wil_err(wil, "SSID not set\n"); wil_err(wil, "SSID not set\n");
return -EINVAL; return -EINVAL;
} }
wmi_set_ssid(wil, wdev->ssid_len, wdev->ssid); rc = wmi_set_ssid(wil, wdev->ssid_len, wdev->ssid);
if (channel) if (rc)
wmi_set_channel(wil, channel->hw_value); return rc;
break; break;
default: default:
break; break;
...@@ -355,9 +355,12 @@ static int __wil_up(struct wil6210_priv *wil) ...@@ -355,9 +355,12 @@ static int __wil_up(struct wil6210_priv *wil)
wmi_set_mac_address(wil, ndev->dev_addr); wmi_set_mac_address(wil, ndev->dev_addr);
/* Set up beaconing if required. */ /* Set up beaconing if required. */
rc = wmi_set_bcon(wil, bi, wmi_nettype); if (bi > 0) {
if (rc) rc = wmi_pcp_start(wil, bi, wmi_nettype,
return rc; (channel ? channel->hw_value : 0));
if (rc)
return rc;
}
/* Rx VRING. After MAC and beacon */ /* Rx VRING. After MAC and beacon */
wil_rx_init(wil); wil_rx_init(wil);
......
...@@ -557,7 +557,7 @@ int wil_vring_init_tx(struct wil6210_priv *wil, int id, int size, ...@@ -557,7 +557,7 @@ int wil_vring_init_tx(struct wil6210_priv *wil, int id, int size,
if (rc) if (rc)
goto out_free; goto out_free;
if (reply.cmd.status != WMI_VRING_CFG_SUCCESS) { if (reply.cmd.status != WMI_FW_STATUS_SUCCESS) {
wil_err(wil, "Tx config failed, status 0x%02x\n", wil_err(wil, "Tx config failed, status 0x%02x\n",
reply.cmd.status); reply.cmd.status);
rc = -EINVAL; rc = -EINVAL;
......
...@@ -209,6 +209,8 @@ struct wil6210_priv { ...@@ -209,6 +209,8 @@ struct wil6210_priv {
struct wireless_dev *wdev; struct wireless_dev *wdev;
void __iomem *csr; void __iomem *csr;
ulong status; ulong status;
u32 fw_version;
u8 n_mids; /* number of additional MIDs as reported by FW */
/* profile */ /* profile */
u32 monitor_flags; u32 monitor_flags;
u32 secure_pcp; /* create secure PCP? */ u32 secure_pcp; /* create secure PCP? */
...@@ -326,6 +328,7 @@ int wmi_add_cipher_key(struct wil6210_priv *wil, u8 key_index, ...@@ -326,6 +328,7 @@ int wmi_add_cipher_key(struct wil6210_priv *wil, u8 key_index,
int wmi_echo(struct wil6210_priv *wil); int wmi_echo(struct wil6210_priv *wil);
int wmi_set_ie(struct wil6210_priv *wil, u8 type, u16 ie_len, const void *ie); int wmi_set_ie(struct wil6210_priv *wil, u8 type, u16 ie_len, const void *ie);
int wmi_rx_chain_add(struct wil6210_priv *wil, struct vring *vring); int wmi_rx_chain_add(struct wil6210_priv *wil, struct vring *vring);
int wmi_p2p_cfg(struct wil6210_priv *wil, int channel);
int wil6210_init_irq(struct wil6210_priv *wil, int irq); int wil6210_init_irq(struct wil6210_priv *wil, int irq);
void wil6210_fini_irq(struct wil6210_priv *wil, int irq); void wil6210_fini_irq(struct wil6210_priv *wil, int irq);
...@@ -339,7 +342,8 @@ struct wireless_dev *wil_cfg80211_init(struct device *dev); ...@@ -339,7 +342,8 @@ struct wireless_dev *wil_cfg80211_init(struct device *dev);
void wil_wdev_free(struct wil6210_priv *wil); void wil_wdev_free(struct wil6210_priv *wil);
int wmi_set_mac_address(struct wil6210_priv *wil, void *addr); int wmi_set_mac_address(struct wil6210_priv *wil, void *addr);
int wmi_set_bcon(struct wil6210_priv *wil, int bi, u8 wmi_nettype); int wmi_pcp_start(struct wil6210_priv *wil, int bi, u8 wmi_nettype, u8 chan);
int wmi_pcp_stop(struct wil6210_priv *wil);
void wil6210_disconnect(struct wil6210_priv *wil, void *bssid); void wil6210_disconnect(struct wil6210_priv *wil, void *bssid);
int wil_rx_init(struct wil6210_priv *wil); int wil_rx_init(struct wil6210_priv *wil);
......
...@@ -269,16 +269,18 @@ static void wmi_evt_ready(struct wil6210_priv *wil, int id, void *d, int len) ...@@ -269,16 +269,18 @@ static void wmi_evt_ready(struct wil6210_priv *wil, int id, void *d, int len)
struct net_device *ndev = wil_to_ndev(wil); struct net_device *ndev = wil_to_ndev(wil);
struct wireless_dev *wdev = wil->wdev; struct wireless_dev *wdev = wil->wdev;
struct wmi_ready_event *evt = d; struct wmi_ready_event *evt = d;
u32 ver = le32_to_cpu(evt->sw_version); wil->fw_version = le32_to_cpu(evt->sw_version);
wil->n_mids = evt->numof_additional_mids;
wil_dbg_wmi(wil, "FW ver. %d; MAC %pM\n", ver, evt->mac); wil_dbg_wmi(wil, "FW ver. %d; MAC %pM; %d MID's\n", wil->fw_version,
evt->mac, wil->n_mids);
if (!is_valid_ether_addr(ndev->dev_addr)) { if (!is_valid_ether_addr(ndev->dev_addr)) {
memcpy(ndev->dev_addr, evt->mac, ETH_ALEN); memcpy(ndev->dev_addr, evt->mac, ETH_ALEN);
memcpy(ndev->perm_addr, evt->mac, ETH_ALEN); memcpy(ndev->perm_addr, evt->mac, ETH_ALEN);
} }
snprintf(wdev->wiphy->fw_version, sizeof(wdev->wiphy->fw_version), snprintf(wdev->wiphy->fw_version, sizeof(wdev->wiphy->fw_version),
"%d", ver); "%d", wil->fw_version);
} }
static void wmi_evt_fw_ready(struct wil6210_priv *wil, int id, void *d, static void wmi_evt_fw_ready(struct wil6210_priv *wil, int id, void *d,
...@@ -714,18 +716,39 @@ int wmi_set_mac_address(struct wil6210_priv *wil, void *addr) ...@@ -714,18 +716,39 @@ int wmi_set_mac_address(struct wil6210_priv *wil, void *addr)
return wmi_send(wil, WMI_SET_MAC_ADDRESS_CMDID, &cmd, sizeof(cmd)); return wmi_send(wil, WMI_SET_MAC_ADDRESS_CMDID, &cmd, sizeof(cmd));
} }
int wmi_set_bcon(struct wil6210_priv *wil, int bi, u8 wmi_nettype) int wmi_pcp_start(struct wil6210_priv *wil, int bi, u8 wmi_nettype, u8 chan)
{ {
struct wmi_bcon_ctrl_cmd cmd = { int rc;
struct wmi_pcp_start_cmd cmd = {
.bcon_interval = cpu_to_le16(bi), .bcon_interval = cpu_to_le16(bi),
.network_type = wmi_nettype, .network_type = wmi_nettype,
.disable_sec_offload = 1, .disable_sec_offload = 1,
.channel = chan,
}; };
struct {
struct wil6210_mbox_hdr_wmi wmi;
struct wmi_pcp_started_event evt;
} __packed reply;
if (!wil->secure_pcp) if (!wil->secure_pcp)
cmd.disable_sec = 1; cmd.disable_sec = 1;
return wmi_send(wil, WMI_BCON_CTRL_CMDID, &cmd, sizeof(cmd)); rc = wmi_call(wil, WMI_PCP_START_CMDID, &cmd, sizeof(cmd),
WMI_PCP_STARTED_EVENTID, &reply, sizeof(reply), 100);
if (rc)
return rc;
if (reply.evt.status != WMI_FW_STATUS_SUCCESS)
rc = -EINVAL;
return rc;
}
int wmi_pcp_stop(struct wil6210_priv *wil)
{
return wmi_call(wil, WMI_PCP_STOP_CMDID, NULL, 0,
WMI_PCP_STOPPED_EVENTID, NULL, 0, 20);
} }
int wmi_set_ssid(struct wil6210_priv *wil, u8 ssid_len, const void *ssid) int wmi_set_ssid(struct wil6210_priv *wil, u8 ssid_len, const void *ssid)
...@@ -796,6 +819,16 @@ int wmi_get_channel(struct wil6210_priv *wil, int *channel) ...@@ -796,6 +819,16 @@ int wmi_get_channel(struct wil6210_priv *wil, int *channel)
return 0; return 0;
} }
int wmi_p2p_cfg(struct wil6210_priv *wil, int channel)
{
struct wmi_p2p_cfg_cmd cmd = {
.discovery_mode = WMI_DISCOVERY_MODE_NON_OFFLOAD,
.channel = channel - 1,
};
return wmi_send(wil, WMI_P2P_CFG_CMDID, &cmd, sizeof(cmd));
}
int wmi_tx_eapol(struct wil6210_priv *wil, struct sk_buff *skb) int wmi_tx_eapol(struct wil6210_priv *wil, struct sk_buff *skb)
{ {
struct wmi_eapol_tx_cmd *cmd; struct wmi_eapol_tx_cmd *cmd;
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment