aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/mwl8k.c
diff options
context:
space:
mode:
authorLennert Buytenhek <buytenh@wantstofly.org>2009-10-22 14:20:47 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-11-06 16:54:36 -0500
commit45a390ddd70d8bec0b17dd37bc8f77372c9c3d33 (patch)
treee7ac395f6c874e5ab43498944a83344ffd8d47aa /drivers/net/wireless/mwl8k.c
parentaf81858172cc0f3da81946aab919c26e4b364efc (diff)
mwl8k: change pci id table driver data to a structure pointer
To prepare for adding support for more device types, introduce a new structure, mwl8k_device_info, where per-device information can be stored, and change the pci id table driver data from an integer indicating only the part number to a pointer to a mwl8k_device_info structure. Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/mwl8k.c')
-rw-r--r--drivers/net/wireless/mwl8k.c47
1 files changed, 30 insertions, 17 deletions
diff --git a/drivers/net/wireless/mwl8k.c b/drivers/net/wireless/mwl8k.c
index c0317e298c11..a582794495e5 100644
--- a/drivers/net/wireless/mwl8k.c
+++ b/drivers/net/wireless/mwl8k.c
@@ -28,13 +28,6 @@
28#define MWL8K_NAME KBUILD_MODNAME 28#define MWL8K_NAME KBUILD_MODNAME
29#define MWL8K_VERSION "0.10" 29#define MWL8K_VERSION "0.10"
30 30
31static DEFINE_PCI_DEVICE_TABLE(mwl8k_table) = {
32 { PCI_VDEVICE(MARVELL, 0x2a2b), .driver_data = 8687, },
33 { PCI_VDEVICE(MARVELL, 0x2a30), .driver_data = 8687, },
34 { }
35};
36MODULE_DEVICE_TABLE(pci, mwl8k_table);
37
38/* Register definitions */ 31/* Register definitions */
39#define MWL8K_HIU_GEN_PTR 0x00000c10 32#define MWL8K_HIU_GEN_PTR 0x00000c10
40#define MWL8K_MODE_STA 0x0000005a 33#define MWL8K_MODE_STA 0x0000005a
@@ -87,6 +80,10 @@ MODULE_DEVICE_TABLE(pci, mwl8k_table);
87#define MWL8K_RX_QUEUES 1 80#define MWL8K_RX_QUEUES 1
88#define MWL8K_TX_QUEUES 4 81#define MWL8K_TX_QUEUES 4
89 82
83struct mwl8k_device_info {
84 int part_num;
85};
86
90struct mwl8k_rx_queue { 87struct mwl8k_rx_queue {
91 int rxd_count; 88 int rxd_count;
92 89
@@ -130,9 +127,10 @@ struct mwl8k_priv {
130 127
131 struct pci_dev *pdev; 128 struct pci_dev *pdev;
132 129
130 struct mwl8k_device_info *device_info;
131
133 /* firmware files and meta data */ 132 /* firmware files and meta data */
134 struct mwl8k_firmware fw; 133 struct mwl8k_firmware fw;
135 u32 part_num;
136 134
137 /* firmware access */ 135 /* firmware access */
138 struct mutex fw_mutex; 136 struct mutex fw_mutex;
@@ -356,15 +354,13 @@ static int mwl8k_request_fw(struct mwl8k_priv *priv,
356 fname, &priv->pdev->dev); 354 fname, &priv->pdev->dev);
357} 355}
358 356
359static int mwl8k_request_firmware(struct mwl8k_priv *priv, u32 part_num) 357static int mwl8k_request_firmware(struct mwl8k_priv *priv)
360{ 358{
361 u8 filename[64]; 359 u8 filename[64];
362 int rc; 360 int rc;
363 361
364 priv->part_num = part_num;
365
366 snprintf(filename, sizeof(filename), 362 snprintf(filename, sizeof(filename),
367 "mwl8k/helper_%u.fw", priv->part_num); 363 "mwl8k/helper_%u.fw", priv->device_info->part_num);
368 364
369 rc = mwl8k_request_fw(priv, filename, &priv->fw.helper); 365 rc = mwl8k_request_fw(priv, filename, &priv->fw.helper);
370 if (rc) { 366 if (rc) {
@@ -374,7 +370,7 @@ static int mwl8k_request_firmware(struct mwl8k_priv *priv, u32 part_num)
374 } 370 }
375 371
376 snprintf(filename, sizeof(filename), 372 snprintf(filename, sizeof(filename),
377 "mwl8k/fmimage_%u.fw", priv->part_num); 373 "mwl8k/fmimage_%u.fw", priv->device_info->part_num);
378 374
379 rc = mwl8k_request_fw(priv, filename, &priv->fw.ucode); 375 rc = mwl8k_request_fw(priv, filename, &priv->fw.ucode);
380 if (rc) { 376 if (rc) {
@@ -2941,6 +2937,22 @@ static void mwl8k_finalize_join_worker(struct work_struct *work)
2941 priv->beacon_skb = NULL; 2937 priv->beacon_skb = NULL;
2942} 2938}
2943 2939
2940static struct mwl8k_device_info di_8687 = {
2941 .part_num = 8687,
2942};
2943
2944static DEFINE_PCI_DEVICE_TABLE(mwl8k_pci_id_table) = {
2945 {
2946 PCI_VDEVICE(MARVELL, 0x2a2b),
2947 .driver_data = (unsigned long)&di_8687,
2948 }, {
2949 PCI_VDEVICE(MARVELL, 0x2a30),
2950 .driver_data = (unsigned long)&di_8687,
2951 }, {
2952 },
2953};
2954MODULE_DEVICE_TABLE(pci, mwl8k_pci_id_table);
2955
2944static int __devinit mwl8k_probe(struct pci_dev *pdev, 2956static int __devinit mwl8k_probe(struct pci_dev *pdev,
2945 const struct pci_device_id *id) 2957 const struct pci_device_id *id)
2946{ 2958{
@@ -2981,6 +2993,7 @@ static int __devinit mwl8k_probe(struct pci_dev *pdev,
2981 priv = hw->priv; 2993 priv = hw->priv;
2982 priv->hw = hw; 2994 priv->hw = hw;
2983 priv->pdev = pdev; 2995 priv->pdev = pdev;
2996 priv->device_info = (void *)id->driver_data;
2984 priv->sniffer_enabled = false; 2997 priv->sniffer_enabled = false;
2985 priv->wmm_enabled = false; 2998 priv->wmm_enabled = false;
2986 priv->pending_tx_pkts = 0; 2999 priv->pending_tx_pkts = 0;
@@ -3092,7 +3105,7 @@ static int __devinit mwl8k_probe(struct pci_dev *pdev,
3092 mwl8k_hw_reset(priv); 3105 mwl8k_hw_reset(priv);
3093 3106
3094 /* Ask userland hotplug daemon for the device firmware */ 3107 /* Ask userland hotplug daemon for the device firmware */
3095 rc = mwl8k_request_firmware(priv, (u32)id->driver_data); 3108 rc = mwl8k_request_firmware(priv);
3096 if (rc) { 3109 if (rc) {
3097 printk(KERN_ERR "%s: Firmware files not found\n", 3110 printk(KERN_ERR "%s: Firmware files not found\n",
3098 wiphy_name(hw->wiphy)); 3111 wiphy_name(hw->wiphy));
@@ -3152,8 +3165,8 @@ static int __devinit mwl8k_probe(struct pci_dev *pdev,
3152 } 3165 }
3153 3166
3154 printk(KERN_INFO "%s: 88w%u v%d, %pM, firmware version %u.%u.%u.%u\n", 3167 printk(KERN_INFO "%s: 88w%u v%d, %pM, firmware version %u.%u.%u.%u\n",
3155 wiphy_name(hw->wiphy), priv->part_num, priv->hw_rev, 3168 wiphy_name(hw->wiphy), priv->device_info->part_num,
3156 hw->wiphy->perm_addr, 3169 priv->hw_rev, hw->wiphy->perm_addr,
3157 (priv->fw_rev >> 24) & 0xff, (priv->fw_rev >> 16) & 0xff, 3170 (priv->fw_rev >> 24) & 0xff, (priv->fw_rev >> 16) & 0xff,
3158 (priv->fw_rev >> 8) & 0xff, priv->fw_rev & 0xff); 3171 (priv->fw_rev >> 8) & 0xff, priv->fw_rev & 0xff);
3159 3172
@@ -3239,7 +3252,7 @@ static void __devexit mwl8k_remove(struct pci_dev *pdev)
3239 3252
3240static struct pci_driver mwl8k_driver = { 3253static struct pci_driver mwl8k_driver = {
3241 .name = MWL8K_NAME, 3254 .name = MWL8K_NAME,
3242 .id_table = mwl8k_table, 3255 .id_table = mwl8k_pci_id_table,
3243 .probe = mwl8k_probe, 3256 .probe = mwl8k_probe,
3244 .remove = __devexit_p(mwl8k_remove), 3257 .remove = __devexit_p(mwl8k_remove),
3245 .shutdown = __devexit_p(mwl8k_shutdown), 3258 .shutdown = __devexit_p(mwl8k_shutdown),