wl12xx/wlcore: move wl1271 struct to wlcore and add ops
authorLuciano Coelho <coelho@ti.com>
Mon, 21 Nov 2011 17:25:24 +0000 (19:25 +0200)
committerLuciano Coelho <coelho@ti.com>
Thu, 12 Apr 2012 05:43:56 +0000 (08:43 +0300)
In order to add chip-specific operations and prepare for future
elements that need to be set by the lower driver, move the wl1271
structure to the wlcore.h file and add an empty placeholder for the
operations structure.

Signed-off-by: Luciano Coelho <coelho@ti.com>
22 files changed:
drivers/net/wireless/ti/wl12xx/main.c
drivers/net/wireless/ti/wlcore/acx.c
drivers/net/wireless/ti/wlcore/acx.h
drivers/net/wireless/ti/wlcore/boot.h
drivers/net/wireless/ti/wlcore/cmd.c
drivers/net/wireless/ti/wlcore/cmd.h
drivers/net/wireless/ti/wlcore/debugfs.c
drivers/net/wireless/ti/wlcore/debugfs.h
drivers/net/wireless/ti/wlcore/event.c
drivers/net/wireless/ti/wlcore/init.h
drivers/net/wireless/ti/wlcore/io.c
drivers/net/wireless/ti/wlcore/main.c
drivers/net/wireless/ti/wlcore/ps.h
drivers/net/wireless/ti/wlcore/rx.c
drivers/net/wireless/ti/wlcore/scan.c
drivers/net/wireless/ti/wlcore/scan.h
drivers/net/wireless/ti/wlcore/sdio.c
drivers/net/wireless/ti/wlcore/spi.c
drivers/net/wireless/ti/wlcore/testmode.c
drivers/net/wireless/ti/wlcore/tx.c
drivers/net/wireless/ti/wlcore/wl12xx.h
drivers/net/wireless/ti/wlcore/wlcore.h

index c4fc93f5718114f2afb3e63d1ec970e7574b7da5..0d30150a3de2fa1e5b85ef628c6ec0aa2e9eaf12 100644 (file)
@@ -27,6 +27,9 @@
 #include "../wlcore/wlcore.h"
 #include "../wlcore/debug.h"
 
+static struct wlcore_ops wl12xx_ops = {
+};
+
 static int __devinit wl12xx_probe(struct platform_device *pdev)
 {
        struct wl1271 *wl;
@@ -39,6 +42,7 @@ static int __devinit wl12xx_probe(struct platform_device *pdev)
        }
 
        wl = hw->priv;
+       wl->ops = &wl12xx_ops;
 
        return wlcore_probe(wl, pdev);
 }
index bc96db0683a5ce99d9fe58d3480813a529675e1a..43cc6a2dae1fea9812261252f41c6335bdbda8b1 100644 (file)
@@ -28,7 +28,7 @@
 #include <linux/spi/spi.h>
 #include <linux/slab.h>
 
-#include "wl12xx.h"
+#include "wlcore.h"
 #include "debug.h"
 #include "wl12xx_80211.h"
 #include "reg.h"
index a28fc044034c8e194a4e8bf82649a88a6231d4d0..e24511a0461010b7ee12b4d615a4a6d530288cfb 100644 (file)
@@ -25,7 +25,7 @@
 #ifndef __ACX_H__
 #define __ACX_H__
 
-#include "wl12xx.h"
+#include "wlcore.h"
 #include "cmd.h"
 
 /*************************************************************************
index c3adc09f403dd1319fe99303d1a75357d21a9127..a39e0e2a0c2aa7155b26a323615c336fe0bb2bf6 100644 (file)
@@ -24,7 +24,7 @@
 #ifndef __BOOT_H__
 #define __BOOT_H__
 
-#include "wl12xx.h"
+#include "wlcore.h"
 
 int wl1271_boot(struct wl1271 *wl);
 int wl1271_load_firmware(struct wl1271 *wl);
index 82cb90a4a99cf94a1d40167f387eb59a16dae365..68e686f25afb50ce706b6cd05b8114d9c14f727c 100644 (file)
@@ -28,7 +28,7 @@
 #include <linux/ieee80211.h>
 #include <linux/slab.h>
 
-#include "wl12xx.h"
+#include "wlcore.h"
 #include "debug.h"
 #include "reg.h"
 #include "io.h"
index de217d92516b4efede360f4c1f187b156b76a294..58d2a8b5c8df42c13db1dd69a33e3685da14c706 100644 (file)
@@ -25,7 +25,7 @@
 #ifndef __CMD_H__
 #define __CMD_H__
 
-#include "wl12xx.h"
+#include "wlcore.h"
 
 struct acx_header;
 
index e1cf727659650a90f9ae43f8636003409404eb00..02e4255ed7ac4b9e42e5319940f29cd6f94c7ca6 100644 (file)
@@ -26,7 +26,7 @@
 #include <linux/skbuff.h>
 #include <linux/slab.h>
 
-#include "wl12xx.h"
+#include "wlcore.h"
 #include "debug.h"
 #include "acx.h"
 #include "ps.h"
index 254c5b292cf69382cefcea5db30de9b2080cd72e..a8d3aef011ffc6274f97bfe505ea2d6defca1d47 100644 (file)
@@ -24,7 +24,7 @@
 #ifndef __DEBUGFS_H__
 #define __DEBUGFS_H__
 
-#include "wl12xx.h"
+#include "wlcore.h"
 
 int wl1271_debugfs_init(struct wl1271 *wl);
 void wl1271_debugfs_exit(struct wl1271 *wl);
index 96f06a89c2a93cd10544d844d16864f6811e7b6d..8d79af964b8618a7f7198c6ff26db4c8a16869f6 100644 (file)
@@ -21,7 +21,7 @@
  *
  */
 
-#include "wl12xx.h"
+#include "wlcore.h"
 #include "debug.h"
 #include "reg.h"
 #include "io.h"
index 2da0f404ef6e44df9c076b7e98b4d1c5ba53132d..a45fbfddec192e67791be7cb23ac419c2b3a82ba 100644 (file)
@@ -24,7 +24,7 @@
 #ifndef __INIT_H__
 #define __INIT_H__
 
-#include "wl12xx.h"
+#include "wlcore.h"
 
 int wl1271_hw_init_power_auth(struct wl1271 *wl);
 int wl1271_init_templates_config(struct wl1271 *wl);
index c574a3b31e3127e514d74ab7d09a3e8e9664f15f..b0701fb9dbdc7aa6410514cd92898c2d2ff50178 100644 (file)
@@ -26,7 +26,7 @@
 #include <linux/spi/spi.h>
 #include <linux/interrupt.h>
 
-#include "wl12xx.h"
+#include "wlcore.h"
 #include "debug.h"
 #include "wl12xx_80211.h"
 #include "io.h"
index 3cbc774f105767f129d2f3577ba468342a307ef8..194a8b00de1eca4d00bcf309f27e67e6f1b7a4e0 100644 (file)
@@ -35,7 +35,7 @@
 #include <linux/sched.h>
 #include <linux/interrupt.h>
 
-#include "wl12xx.h"
+#include "wlcore.h"
 #include "debug.h"
 #include "wl12xx_80211.h"
 #include "reg.h"
@@ -5485,6 +5485,11 @@ int __devinit wlcore_probe(struct wl1271 *wl, struct platform_device *pdev)
        unsigned long irqflags;
        int ret;
 
+       if (!wl->ops) {
+               ret = -EINVAL;
+               goto out_free_hw;
+       }
+
        wl->irq = platform_get_irq(pdev, 0);
        wl->ref_clock = pdata->board_ref_clock;
        wl->tcxo_clock = pdata->board_tcxo_clock;
index 5f19d4fbbf27e88345dd7d4fb406d1ad37e2bf0b..de4f9da8ed26b77e13c20437b8e16263192af8f1 100644 (file)
@@ -24,7 +24,7 @@
 #ifndef __PS_H__
 #define __PS_H__
 
-#include "wl12xx.h"
+#include "wlcore.h"
 #include "acx.h"
 
 int wl1271_ps_set_mode(struct wl1271 *wl, struct wl12xx_vif *wlvif,
index cfa6071704c591d3be1100b469a140302da95489..4fc37f9f38a6eabbcd0072e69e4048c51a057683 100644 (file)
@@ -24,7 +24,7 @@
 #include <linux/gfp.h>
 #include <linux/sched.h>
 
-#include "wl12xx.h"
+#include "wlcore.h"
 #include "debug.h"
 #include "acx.h"
 #include "reg.h"
index a57f333d07f54f22540284dd4315fe89221f12d9..ade21a011c458dcee0e67fccd8c54756f3e30332 100644 (file)
@@ -23,7 +23,7 @@
 
 #include <linux/ieee80211.h>
 
-#include "wl12xx.h"
+#include "wlcore.h"
 #include "debug.h"
 #include "cmd.h"
 #include "scan.h"
index 2b300f4d0be9beeaa93e3bb445b0d7a3ab651682..81ee36ac20785f23d364e2a3b3ef45674ba537f8 100644 (file)
@@ -24,7 +24,7 @@
 #ifndef __SCAN_H__
 #define __SCAN_H__
 
-#include "wl12xx.h"
+#include "wlcore.h"
 
 int wl1271_scan(struct wl1271 *wl, struct ieee80211_vif *vif,
                const u8 *ssid, size_t ssid_len,
index 4b3c32774baee1978a45bb5ee95d62f0840a041c..e407acf124dc3bb947612998644a2da7d110e760 100644 (file)
@@ -33,7 +33,7 @@
 #include <linux/wl12xx.h>
 #include <linux/pm_runtime.h>
 
-#include "wl12xx.h"
+#include "wlcore.h"
 #include "wl12xx_80211.h"
 #include "io.h"
 
index 2fc18a8dcce8329436805a38d0582578325a8368..9eeb394129745f39dd9ac1dbf4e8c825b68e2ebd 100644 (file)
@@ -30,7 +30,7 @@
 #include <linux/platform_device.h>
 #include <linux/slab.h>
 
-#include "wl12xx.h"
+#include "wlcore.h"
 #include "wl12xx_80211.h"
 #include "io.h"
 
index 1e93bb9c0246cfa02e44f6160851909b422b14ec..2ea40131e64e6f946fe25b6fa4e4cdf6e6fcbebd 100644 (file)
@@ -25,7 +25,7 @@
 #include <linux/slab.h>
 #include <net/genetlink.h>
 
-#include "wl12xx.h"
+#include "wlcore.h"
 #include "debug.h"
 #include "acx.h"
 #include "reg.h"
index 43ae49143d68bf47a4fa98c25f15b5d3b20cd3a9..83cb83cdc1026094052f54b7bc84b177126c5213 100644 (file)
@@ -25,7 +25,7 @@
 #include <linux/module.h>
 #include <linux/etherdevice.h>
 
-#include "wl12xx.h"
+#include "wlcore.h"
 #include "debug.h"
 #include "io.h"
 #include "reg.h"
index 82802d1c0782d594da72a5eb9c3b60058f23f217..37b2d64b5b5b189a3fb15cccb25844322253afe3 100644 (file)
@@ -34,7 +34,6 @@
 
 #include "conf.h"
 #include "ini.h"
-#include "event.h"
 
 #define WL127X_FW_NAME_MULTI "ti-connectivity/wl127x-fw-4-mr.bin"
 #define WL127X_FW_NAME_SINGLE "ti-connectivity/wl127x-fw-4-sr.bin"
@@ -293,216 +292,6 @@ struct wl1271_link {
        u8 ba_bitmap;
 };
 
-struct wl1271 {
-       struct ieee80211_hw *hw;
-       bool mac80211_registered;
-
-       struct device *dev;
-
-       void *if_priv;
-
-       struct wl1271_if_operations *if_ops;
-
-       void (*set_power)(bool enable);
-       int irq;
-       int ref_clock;
-
-       spinlock_t wl_lock;
-
-       enum wl1271_state state;
-       enum wl12xx_fw_type fw_type;
-       bool plt;
-       u8 last_vif_count;
-       struct mutex mutex;
-
-       unsigned long flags;
-
-       struct wl1271_partition_set part;
-
-       struct wl1271_chip chip;
-
-       int cmd_box_addr;
-       int event_box_addr;
-
-       u8 *fw;
-       size_t fw_len;
-       void *nvs;
-       size_t nvs_len;
-
-       s8 hw_pg_ver;
-
-       /* address read from the fuse ROM */
-       u32 fuse_oui_addr;
-       u32 fuse_nic_addr;
-
-       /* we have up to 2 MAC addresses */
-       struct mac_address addresses[2];
-       int channel;
-       u8 system_hlid;
-
-       unsigned long links_map[BITS_TO_LONGS(WL12XX_MAX_LINKS)];
-       unsigned long roles_map[BITS_TO_LONGS(WL12XX_MAX_ROLES)];
-       unsigned long roc_map[BITS_TO_LONGS(WL12XX_MAX_ROLES)];
-       unsigned long rate_policies_map[
-                       BITS_TO_LONGS(WL12XX_MAX_RATE_POLICIES)];
-
-       struct list_head wlvif_list;
-
-       u8 sta_count;
-       u8 ap_count;
-
-       struct wl1271_acx_mem_map *target_mem_map;
-
-       /* Accounting for allocated / available TX blocks on HW */
-       u32 tx_blocks_freed;
-       u32 tx_blocks_available;
-       u32 tx_allocated_blocks;
-       u32 tx_results_count;
-
-       /* amount of spare TX blocks to use */
-       u32 tx_spare_blocks;
-
-       /* Accounting for allocated / available Tx packets in HW */
-       u32 tx_pkts_freed[NUM_TX_QUEUES];
-       u32 tx_allocated_pkts[NUM_TX_QUEUES];
-
-       /* Transmitted TX packets counter for chipset interface */
-       u32 tx_packets_count;
-
-       /* Time-offset between host and chipset clocks */
-       s64 time_offset;
-
-       /* Frames scheduled for transmission, not handled yet */
-       int tx_queue_count[NUM_TX_QUEUES];
-       long stopped_queues_map;
-
-       /* Frames received, not handled yet by mac80211 */
-       struct sk_buff_head deferred_rx_queue;
-
-       /* Frames sent, not returned yet to mac80211 */
-       struct sk_buff_head deferred_tx_queue;
-
-       struct work_struct tx_work;
-       struct workqueue_struct *freezable_wq;
-
-       /* Pending TX frames */
-       unsigned long tx_frames_map[BITS_TO_LONGS(ACX_TX_DESCRIPTORS)];
-       struct sk_buff *tx_frames[ACX_TX_DESCRIPTORS];
-       int tx_frames_cnt;
-
-       /* FW Rx counter */
-       u32 rx_counter;
-
-       /* Rx memory pool address */
-       struct wl1271_rx_mem_pool_addr rx_mem_pool_addr;
-
-       /* Intermediate buffer, used for packet aggregation */
-       u8 *aggr_buf;
-
-       /* Reusable dummy packet template */
-       struct sk_buff *dummy_packet;
-
-       /* Network stack work  */
-       struct work_struct netstack_work;
-
-       /* FW log buffer */
-       u8 *fwlog;
-
-       /* Number of valid bytes in the FW log buffer */
-       ssize_t fwlog_size;
-
-       /* Sysfs FW log entry readers wait queue */
-       wait_queue_head_t fwlog_waitq;
-
-       /* Hardware recovery work */
-       struct work_struct recovery_work;
-
-       struct event_mailbox *mbox;
-
-       /* The mbox event mask */
-       u32 event_mask;
-
-       /* Mailbox pointers */
-       u32 mbox_ptr[2];
-
-       /* Are we currently scanning */
-       struct ieee80211_vif *scan_vif;
-       struct wl1271_scan scan;
-       struct delayed_work scan_complete_work;
-
-       bool sched_scanning;
-
-       /* The current band */
-       enum ieee80211_band band;
-
-       struct completion *elp_compl;
-       struct delayed_work elp_work;
-
-       /* in dBm */
-       int power_level;
-
-       struct wl1271_stats stats;
-
-       __le32 buffer_32;
-       u32 buffer_cmd;
-       u32 buffer_busyword[WL1271_BUSY_WORD_CNT];
-
-       struct wl12xx_fw_status *fw_status;
-       struct wl1271_tx_hw_res_if *tx_res_if;
-
-       /* Current chipset configuration */
-       struct conf_drv_settings conf;
-
-       bool sg_enabled;
-
-       bool enable_11a;
-
-       /* Most recently reported noise in dBm */
-       s8 noise;
-
-       /* bands supported by this instance of wl12xx */
-       struct ieee80211_supported_band bands[IEEE80211_NUM_BANDS];
-
-       int tcxo_clock;
-
-       /*
-        * wowlan trigger was configured during suspend.
-        * (currently, only "ANY" trigger is supported)
-        */
-       bool wow_enabled;
-       bool irq_wake_enabled;
-
-       /*
-        * AP-mode - links indexed by HLID. The global and broadcast links
-        * are always active.
-        */
-       struct wl1271_link links[WL12XX_MAX_LINKS];
-
-       /* AP-mode - a bitmap of links currently in PS mode according to FW */
-       u32 ap_fw_ps_map;
-
-       /* AP-mode - a bitmap of links currently in PS mode in mac80211 */
-       unsigned long ap_ps_map;
-
-       /* Quirks of specific hardware revisions */
-       unsigned int quirks;
-
-       /* Platform limitations */
-       unsigned int platform_quirks;
-
-       /* number of currently active RX BA sessions */
-       int ba_rx_session_count;
-
-       /* AP-mode - number of currently connected stations */
-       int active_sta_count;
-
-       /* last wlvif we transmitted from */
-       struct wl12xx_vif *last_wlvif;
-
-       /* work to fire when Tx is stuck */
-       struct delayed_work tx_watchdog_work;
-};
-
 struct wl1271_station {
        u8 hlid;
 };
index 4cabf971da510ead8b7d3a6f94e31bc5d5e52b90..0bcc6adcbc15c1ded2b17a1a80622f5514326ba0 100644 (file)
 #ifndef __WLCORE_H__
 #define __WLCORE_H__
 
+#include <linux/platform_device.h>
+
 #include "wl12xx.h"
+#include "event.h"
+
+struct wlcore_ops {
+};
+
+struct wl1271 {
+       struct ieee80211_hw *hw;
+       bool mac80211_registered;
+
+       struct device *dev;
+
+       void *if_priv;
+
+       struct wl1271_if_operations *if_ops;
+
+       void (*set_power)(bool enable);
+       int irq;
+       int ref_clock;
+
+       spinlock_t wl_lock;
+
+       enum wl1271_state state;
+       enum wl12xx_fw_type fw_type;
+       bool plt;
+       u8 last_vif_count;
+       struct mutex mutex;
+
+       unsigned long flags;
+
+       struct wl1271_partition_set part;
+
+       struct wl1271_chip chip;
+
+       int cmd_box_addr;
+       int event_box_addr;
+
+       u8 *fw;
+       size_t fw_len;
+       void *nvs;
+       size_t nvs_len;
+
+       s8 hw_pg_ver;
+
+       /* address read from the fuse ROM */
+       u32 fuse_oui_addr;
+       u32 fuse_nic_addr;
+
+       /* we have up to 2 MAC addresses */
+       struct mac_address addresses[2];
+       int channel;
+       u8 system_hlid;
+
+       unsigned long links_map[BITS_TO_LONGS(WL12XX_MAX_LINKS)];
+       unsigned long roles_map[BITS_TO_LONGS(WL12XX_MAX_ROLES)];
+       unsigned long roc_map[BITS_TO_LONGS(WL12XX_MAX_ROLES)];
+       unsigned long rate_policies_map[
+                       BITS_TO_LONGS(WL12XX_MAX_RATE_POLICIES)];
+
+       struct list_head wlvif_list;
+
+       u8 sta_count;
+       u8 ap_count;
+
+       struct wl1271_acx_mem_map *target_mem_map;
+
+       /* Accounting for allocated / available TX blocks on HW */
+       u32 tx_blocks_freed;
+       u32 tx_blocks_available;
+       u32 tx_allocated_blocks;
+       u32 tx_results_count;
+
+       /* amount of spare TX blocks to use */
+       u32 tx_spare_blocks;
+
+       /* Accounting for allocated / available Tx packets in HW */
+       u32 tx_pkts_freed[NUM_TX_QUEUES];
+       u32 tx_allocated_pkts[NUM_TX_QUEUES];
+
+       /* Transmitted TX packets counter for chipset interface */
+       u32 tx_packets_count;
+
+       /* Time-offset between host and chipset clocks */
+       s64 time_offset;
+
+       /* Frames scheduled for transmission, not handled yet */
+       int tx_queue_count[NUM_TX_QUEUES];
+       long stopped_queues_map;
+
+       /* Frames received, not handled yet by mac80211 */
+       struct sk_buff_head deferred_rx_queue;
+
+       /* Frames sent, not returned yet to mac80211 */
+       struct sk_buff_head deferred_tx_queue;
+
+       struct work_struct tx_work;
+       struct workqueue_struct *freezable_wq;
+
+       /* Pending TX frames */
+       unsigned long tx_frames_map[BITS_TO_LONGS(ACX_TX_DESCRIPTORS)];
+       struct sk_buff *tx_frames[ACX_TX_DESCRIPTORS];
+       int tx_frames_cnt;
+
+       /* FW Rx counter */
+       u32 rx_counter;
+
+       /* Rx memory pool address */
+       struct wl1271_rx_mem_pool_addr rx_mem_pool_addr;
+
+       /* Intermediate buffer, used for packet aggregation */
+       u8 *aggr_buf;
+
+       /* Reusable dummy packet template */
+       struct sk_buff *dummy_packet;
+
+       /* Network stack work  */
+       struct work_struct netstack_work;
+
+       /* FW log buffer */
+       u8 *fwlog;
+
+       /* Number of valid bytes in the FW log buffer */
+       ssize_t fwlog_size;
+
+       /* Sysfs FW log entry readers wait queue */
+       wait_queue_head_t fwlog_waitq;
+
+       /* Hardware recovery work */
+       struct work_struct recovery_work;
+
+       /* Pointer that holds DMA-friendly block for the mailbox */
+       struct event_mailbox *mbox;
+
+       /* The mbox event mask */
+       u32 event_mask;
+
+       /* Mailbox pointers */
+       u32 mbox_ptr[2];
+
+       /* Are we currently scanning */
+       struct ieee80211_vif *scan_vif;
+       struct wl1271_scan scan;
+       struct delayed_work scan_complete_work;
+
+       bool sched_scanning;
+
+       /* The current band */
+       enum ieee80211_band band;
+
+       struct completion *elp_compl;
+       struct delayed_work elp_work;
+
+       /* in dBm */
+       int power_level;
+
+       struct wl1271_stats stats;
+
+       __le32 buffer_32;
+       u32 buffer_cmd;
+       u32 buffer_busyword[WL1271_BUSY_WORD_CNT];
+
+       struct wl12xx_fw_status *fw_status;
+       struct wl1271_tx_hw_res_if *tx_res_if;
+
+       /* Current chipset configuration */
+       struct conf_drv_settings conf;
+
+       bool sg_enabled;
+
+       bool enable_11a;
+
+       /* Most recently reported noise in dBm */
+       s8 noise;
+
+       /* bands supported by this instance of wl12xx */
+       struct ieee80211_supported_band bands[IEEE80211_NUM_BANDS];
+
+       int tcxo_clock;
+
+       /*
+        * wowlan trigger was configured during suspend.
+        * (currently, only "ANY" trigger is supported)
+        */
+       bool wow_enabled;
+       bool irq_wake_enabled;
+
+       /*
+        * AP-mode - links indexed by HLID. The global and broadcast links
+        * are always active.
+        */
+       struct wl1271_link links[WL12XX_MAX_LINKS];
+
+       /* AP-mode - a bitmap of links currently in PS mode according to FW */
+       u32 ap_fw_ps_map;
+
+       /* AP-mode - a bitmap of links currently in PS mode in mac80211 */
+       unsigned long ap_ps_map;
+
+       /* Quirks of specific hardware revisions */
+       unsigned int quirks;
+
+       /* Platform limitations */
+       unsigned int platform_quirks;
+
+       /* number of currently active RX BA sessions */
+       int ba_rx_session_count;
+
+       /* AP-mode - number of currently connected stations */
+       int active_sta_count;
+
+       /* last wlvif we transmitted from */
+       struct wl12xx_vif *last_wlvif;
+
+       /* work to fire when Tx is stuck */
+       struct delayed_work tx_watchdog_work;
+
+       struct wlcore_ops *ops;
+};
 
 int __devinit wlcore_probe(struct wl1271 *wl, struct platform_device *pdev);
 int __devexit wlcore_remove(struct platform_device *pdev);