2 * Copyright (c) 2012 Qualcomm Atheros, Inc.
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 #include <linux/etherdevice.h>
21 static int wil_open(struct net_device *ndev)
23 struct wil6210_priv *wil = ndev_to_wil(ndev);
28 static int wil_stop(struct net_device *ndev)
30 struct wil6210_priv *wil = ndev_to_wil(ndev);
35 static const struct net_device_ops wil_netdev_ops = {
38 .ndo_start_xmit = wil_start_xmit,
39 .ndo_set_mac_address = eth_mac_addr,
40 .ndo_validate_addr = eth_validate_addr,
43 void *wil_if_alloc(struct device *dev, void __iomem *csr)
45 struct net_device *ndev;
46 struct wireless_dev *wdev;
47 struct wil6210_priv *wil;
48 struct ieee80211_channel *ch;
51 wdev = wil_cfg80211_init(dev);
53 dev_err(dev, "wil_cfg80211_init failed\n");
57 wil = wdev_to_wil(wdev);
61 rc = wil_priv_init(wil);
63 dev_err(dev, "wil_priv_init failed\n");
67 wdev->iftype = NL80211_IFTYPE_STATION; /* TODO */
68 /* default monitor channel */
69 ch = wdev->wiphy->bands[IEEE80211_BAND_60GHZ]->channels;
70 cfg80211_chandef_create(&wdev->preset_chandef, ch, NL80211_CHAN_NO_HT);
72 ndev = alloc_netdev(0, "wlan%d", ether_setup);
74 dev_err(dev, "alloc_netdev_mqs failed\n");
79 ndev->netdev_ops = &wil_netdev_ops;
80 ndev->ieee80211_ptr = wdev;
81 SET_NETDEV_DEV(ndev, wiphy_dev(wdev->wiphy));
97 void wil_if_free(struct wil6210_priv *wil)
99 struct net_device *ndev = wil_to_ndev(wil);
104 wil_priv_deinit(wil);
108 int wil_if_add(struct wil6210_priv *wil)
110 struct net_device *ndev = wil_to_ndev(wil);
113 rc = register_netdev(ndev);
115 dev_err(&ndev->dev, "Failed to register netdev: %d\n", rc);
124 void wil_if_remove(struct wil6210_priv *wil)
126 struct net_device *ndev = wil_to_ndev(wil);
128 unregister_netdev(ndev);