3 * Linux device driver for RTL8180 / RTL8185
5 * Copyright 2007 Michael Wu <flamingice@sourmilk.net>
6 * Copyright 2007 Andrea Merello <andrea.merello@gmail.com>
8 * Based on the r8180 driver, which is:
9 * Copyright 2004-2005 Andrea Merello <andrea.merello@gmail.com>, et al.
11 * Thanks to Realtek for their support!
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License version 2 as
15 * published by the Free Software Foundation.
18 #include <linux/interrupt.h>
19 #include <linux/pci.h>
20 #include <linux/slab.h>
21 #include <linux/delay.h>
22 #include <linux/etherdevice.h>
23 #include <linux/eeprom_93cx6.h>
24 #include <linux/module.h>
25 #include <net/mac80211.h>
33 MODULE_AUTHOR("Michael Wu <flamingice@sourmilk.net>");
34 MODULE_AUTHOR("Andrea Merello <andrea.merello@gmail.com>");
35 MODULE_DESCRIPTION("RTL8180 / RTL8185 PCI wireless driver");
36 MODULE_LICENSE("GPL");
38 static DEFINE_PCI_DEVICE_TABLE(rtl8180_table
) = {
40 { PCI_DEVICE(PCI_VENDOR_ID_REALTEK
, 0x8185) },
41 { PCI_DEVICE(PCI_VENDOR_ID_BELKIN
, 0x700f) },
42 { PCI_DEVICE(PCI_VENDOR_ID_BELKIN
, 0x701f) },
45 { PCI_DEVICE(PCI_VENDOR_ID_REALTEK
, 0x8180) },
46 { PCI_DEVICE(0x1799, 0x6001) },
47 { PCI_DEVICE(0x1799, 0x6020) },
48 { PCI_DEVICE(PCI_VENDOR_ID_DLINK
, 0x3300) },
49 { PCI_DEVICE(0x1186, 0x3301) },
50 { PCI_DEVICE(0x1432, 0x7106) },
54 MODULE_DEVICE_TABLE(pci
, rtl8180_table
);
56 static const struct ieee80211_rate rtl818x_rates
[] = {
57 { .bitrate
= 10, .hw_value
= 0, },
58 { .bitrate
= 20, .hw_value
= 1, },
59 { .bitrate
= 55, .hw_value
= 2, },
60 { .bitrate
= 110, .hw_value
= 3, },
61 { .bitrate
= 60, .hw_value
= 4, },
62 { .bitrate
= 90, .hw_value
= 5, },
63 { .bitrate
= 120, .hw_value
= 6, },
64 { .bitrate
= 180, .hw_value
= 7, },
65 { .bitrate
= 240, .hw_value
= 8, },
66 { .bitrate
= 360, .hw_value
= 9, },
67 { .bitrate
= 480, .hw_value
= 10, },
68 { .bitrate
= 540, .hw_value
= 11, },
71 static const struct ieee80211_channel rtl818x_channels
[] = {
72 { .center_freq
= 2412 },
73 { .center_freq
= 2417 },
74 { .center_freq
= 2422 },
75 { .center_freq
= 2427 },
76 { .center_freq
= 2432 },
77 { .center_freq
= 2437 },
78 { .center_freq
= 2442 },
79 { .center_freq
= 2447 },
80 { .center_freq
= 2452 },
81 { .center_freq
= 2457 },
82 { .center_freq
= 2462 },
83 { .center_freq
= 2467 },
84 { .center_freq
= 2472 },
85 { .center_freq
= 2484 },
89 void rtl8180_write_phy(struct ieee80211_hw
*dev
, u8 addr
, u32 data
)
91 struct rtl8180_priv
*priv
= dev
->priv
;
95 buf
= (data
<< 8) | addr
;
97 rtl818x_iowrite32(priv
, (__le32 __iomem
*)&priv
->map
->PHY
[0], buf
| 0x80);
99 rtl818x_iowrite32(priv
, (__le32 __iomem
*)&priv
->map
->PHY
[0], buf
);
100 if (rtl818x_ioread8(priv
, &priv
->map
->PHY
[2]) == (data
& 0xFF))
105 static void rtl8180_handle_rx(struct ieee80211_hw
*dev
)
107 struct rtl8180_priv
*priv
= dev
->priv
;
108 unsigned int count
= 32;
113 struct rtl8180_rx_desc
*entry
= &priv
->rx_ring
[priv
->rx_idx
];
114 struct sk_buff
*skb
= priv
->rx_buf
[priv
->rx_idx
];
115 u32 flags
= le32_to_cpu(entry
->flags
);
117 if (flags
& RTL818X_RX_DESC_FLAG_OWN
)
120 if (unlikely(flags
& (RTL818X_RX_DESC_FLAG_DMA_FAIL
|
121 RTL818X_RX_DESC_FLAG_FOF
|
122 RTL818X_RX_DESC_FLAG_RX_ERR
)))
125 u32 flags2
= le32_to_cpu(entry
->flags2
);
126 struct ieee80211_rx_status rx_status
= {0};
127 struct sk_buff
*new_skb
= dev_alloc_skb(MAX_RX_SIZE
);
129 if (unlikely(!new_skb
))
132 mapping
= pci_map_single(priv
->pdev
,
133 skb_tail_pointer(new_skb
),
134 MAX_RX_SIZE
, PCI_DMA_FROMDEVICE
);
136 if (pci_dma_mapping_error(priv
->pdev
, mapping
)) {
138 dev_err(&priv
->pdev
->dev
, "RX DMA map error\n");
143 pci_unmap_single(priv
->pdev
,
144 *((dma_addr_t
*)skb
->cb
),
145 MAX_RX_SIZE
, PCI_DMA_FROMDEVICE
);
146 skb_put(skb
, flags
& 0xFFF);
148 rx_status
.antenna
= (flags2
>> 15) & 1;
149 rx_status
.rate_idx
= (flags
>> 20) & 0xF;
150 agc
= (flags2
>> 17) & 0x7F;
152 if (rx_status
.rate_idx
> 3)
153 signal
= 90 - clamp_t(u8
, agc
, 25, 90);
155 signal
= 95 - clamp_t(u8
, agc
, 30, 95);
158 signal
= priv
->rf
->calc_rssi(agc
, sq
);
160 rx_status
.signal
= signal
;
161 rx_status
.freq
= dev
->conf
.chandef
.chan
->center_freq
;
162 rx_status
.band
= dev
->conf
.chandef
.chan
->band
;
163 rx_status
.mactime
= le64_to_cpu(entry
->tsft
);
164 rx_status
.flag
|= RX_FLAG_MACTIME_START
;
165 if (flags
& RTL818X_RX_DESC_FLAG_CRC32_ERR
)
166 rx_status
.flag
|= RX_FLAG_FAILED_FCS_CRC
;
168 memcpy(IEEE80211_SKB_RXCB(skb
), &rx_status
, sizeof(rx_status
));
169 ieee80211_rx_irqsafe(dev
, skb
);
172 priv
->rx_buf
[priv
->rx_idx
] = skb
;
173 *((dma_addr_t
*) skb
->cb
) = mapping
;
177 entry
->rx_buf
= cpu_to_le32(*((dma_addr_t
*)skb
->cb
));
178 entry
->flags
= cpu_to_le32(RTL818X_RX_DESC_FLAG_OWN
|
180 if (priv
->rx_idx
== 31)
181 entry
->flags
|= cpu_to_le32(RTL818X_RX_DESC_FLAG_EOR
);
182 priv
->rx_idx
= (priv
->rx_idx
+ 1) % 32;
186 static void rtl8180_handle_tx(struct ieee80211_hw
*dev
, unsigned int prio
)
188 struct rtl8180_priv
*priv
= dev
->priv
;
189 struct rtl8180_tx_ring
*ring
= &priv
->tx_ring
[prio
];
191 while (skb_queue_len(&ring
->queue
)) {
192 struct rtl8180_tx_desc
*entry
= &ring
->desc
[ring
->idx
];
194 struct ieee80211_tx_info
*info
;
195 u32 flags
= le32_to_cpu(entry
->flags
);
197 if (flags
& RTL818X_TX_DESC_FLAG_OWN
)
200 ring
->idx
= (ring
->idx
+ 1) % ring
->entries
;
201 skb
= __skb_dequeue(&ring
->queue
);
202 pci_unmap_single(priv
->pdev
, le32_to_cpu(entry
->tx_buf
),
203 skb
->len
, PCI_DMA_TODEVICE
);
205 info
= IEEE80211_SKB_CB(skb
);
206 ieee80211_tx_info_clear_status(info
);
208 if (!(info
->flags
& IEEE80211_TX_CTL_NO_ACK
) &&
209 (flags
& RTL818X_TX_DESC_FLAG_TX_OK
))
210 info
->flags
|= IEEE80211_TX_STAT_ACK
;
212 info
->status
.rates
[0].count
= (flags
& 0xFF) + 1;
213 info
->status
.rates
[1].idx
= -1;
215 ieee80211_tx_status_irqsafe(dev
, skb
);
216 if (ring
->entries
- skb_queue_len(&ring
->queue
) == 2)
217 ieee80211_wake_queue(dev
, prio
);
221 static irqreturn_t
rtl8180_interrupt(int irq
, void *dev_id
)
223 struct ieee80211_hw
*dev
= dev_id
;
224 struct rtl8180_priv
*priv
= dev
->priv
;
227 spin_lock(&priv
->lock
);
228 reg
= rtl818x_ioread16(priv
, &priv
->map
->INT_STATUS
);
229 if (unlikely(reg
== 0xFFFF)) {
230 spin_unlock(&priv
->lock
);
234 rtl818x_iowrite16(priv
, &priv
->map
->INT_STATUS
, reg
);
236 if (reg
& (RTL818X_INT_TXB_OK
| RTL818X_INT_TXB_ERR
))
237 rtl8180_handle_tx(dev
, 3);
239 if (reg
& (RTL818X_INT_TXH_OK
| RTL818X_INT_TXH_ERR
))
240 rtl8180_handle_tx(dev
, 2);
242 if (reg
& (RTL818X_INT_TXN_OK
| RTL818X_INT_TXN_ERR
))
243 rtl8180_handle_tx(dev
, 1);
245 if (reg
& (RTL818X_INT_TXL_OK
| RTL818X_INT_TXL_ERR
))
246 rtl8180_handle_tx(dev
, 0);
248 if (reg
& (RTL818X_INT_RX_OK
| RTL818X_INT_RX_ERR
))
249 rtl8180_handle_rx(dev
);
251 spin_unlock(&priv
->lock
);
256 static void rtl8180_tx(struct ieee80211_hw
*dev
,
257 struct ieee80211_tx_control
*control
,
260 struct ieee80211_tx_info
*info
= IEEE80211_SKB_CB(skb
);
261 struct ieee80211_hdr
*hdr
= (struct ieee80211_hdr
*)skb
->data
;
262 struct rtl8180_priv
*priv
= dev
->priv
;
263 struct rtl8180_tx_ring
*ring
;
264 struct rtl8180_tx_desc
*entry
;
266 unsigned int idx
, prio
;
271 __le16 rts_duration
= 0;
273 prio
= skb_get_queue_mapping(skb
);
274 ring
= &priv
->tx_ring
[prio
];
276 mapping
= pci_map_single(priv
->pdev
, skb
->data
,
277 skb
->len
, PCI_DMA_TODEVICE
);
279 if (pci_dma_mapping_error(priv
->pdev
, mapping
)) {
281 dev_err(&priv
->pdev
->dev
, "TX DMA mapping error\n");
286 tx_flags
= RTL818X_TX_DESC_FLAG_OWN
| RTL818X_TX_DESC_FLAG_FS
|
287 RTL818X_TX_DESC_FLAG_LS
|
288 (ieee80211_get_tx_rate(dev
, info
)->hw_value
<< 24) |
292 tx_flags
|= RTL818X_TX_DESC_FLAG_DMA
|
293 RTL818X_TX_DESC_FLAG_NO_ENC
;
295 rc_flags
= info
->control
.rates
[0].flags
;
296 if (rc_flags
& IEEE80211_TX_RC_USE_RTS_CTS
) {
297 tx_flags
|= RTL818X_TX_DESC_FLAG_RTS
;
298 tx_flags
|= ieee80211_get_rts_cts_rate(dev
, info
)->hw_value
<< 19;
299 } else if (rc_flags
& IEEE80211_TX_RC_USE_CTS_PROTECT
) {
300 tx_flags
|= RTL818X_TX_DESC_FLAG_CTS
;
301 tx_flags
|= ieee80211_get_rts_cts_rate(dev
, info
)->hw_value
<< 19;
304 if (rc_flags
& IEEE80211_TX_RC_USE_RTS_CTS
)
305 rts_duration
= ieee80211_rts_duration(dev
, priv
->vif
, skb
->len
,
309 unsigned int remainder
;
311 plcp_len
= DIV_ROUND_UP(16 * (skb
->len
+ 4),
312 (ieee80211_get_tx_rate(dev
, info
)->bitrate
* 2) / 10);
313 remainder
= (16 * (skb
->len
+ 4)) %
314 ((ieee80211_get_tx_rate(dev
, info
)->bitrate
* 2) / 10);
319 spin_lock_irqsave(&priv
->lock
, flags
);
321 if (info
->flags
& IEEE80211_TX_CTL_ASSIGN_SEQ
) {
322 if (info
->flags
& IEEE80211_TX_CTL_FIRST_FRAGMENT
)
324 hdr
->seq_ctrl
&= cpu_to_le16(IEEE80211_SCTL_FRAG
);
325 hdr
->seq_ctrl
|= cpu_to_le16(priv
->seqno
);
328 idx
= (ring
->idx
+ skb_queue_len(&ring
->queue
)) % ring
->entries
;
329 entry
= &ring
->desc
[idx
];
331 entry
->rts_duration
= rts_duration
;
332 entry
->plcp_len
= cpu_to_le16(plcp_len
);
333 entry
->tx_buf
= cpu_to_le32(mapping
);
334 entry
->frame_len
= cpu_to_le32(skb
->len
);
335 entry
->flags2
= info
->control
.rates
[1].idx
>= 0 ?
336 ieee80211_get_alt_retry_rate(dev
, info
, 0)->bitrate
<< 4 : 0;
337 entry
->retry_limit
= info
->control
.rates
[0].count
;
338 entry
->flags
= cpu_to_le32(tx_flags
);
339 __skb_queue_tail(&ring
->queue
, skb
);
340 if (ring
->entries
- skb_queue_len(&ring
->queue
) < 2)
341 ieee80211_stop_queue(dev
, prio
);
343 spin_unlock_irqrestore(&priv
->lock
, flags
);
345 rtl818x_iowrite8(priv
, &priv
->map
->TX_DMA_POLLING
, (1 << (prio
+ 4)));
348 void rtl8180_set_anaparam(struct rtl8180_priv
*priv
, u32 anaparam
)
352 rtl818x_iowrite8(priv
, &priv
->map
->EEPROM_CMD
, RTL818X_EEPROM_CMD_CONFIG
);
353 reg
= rtl818x_ioread8(priv
, &priv
->map
->CONFIG3
);
354 rtl818x_iowrite8(priv
, &priv
->map
->CONFIG3
,
355 reg
| RTL818X_CONFIG3_ANAPARAM_WRITE
);
356 rtl818x_iowrite32(priv
, &priv
->map
->ANAPARAM
, anaparam
);
357 rtl818x_iowrite8(priv
, &priv
->map
->CONFIG3
,
358 reg
& ~RTL818X_CONFIG3_ANAPARAM_WRITE
);
359 rtl818x_iowrite8(priv
, &priv
->map
->EEPROM_CMD
, RTL818X_EEPROM_CMD_NORMAL
);
362 static int rtl8180_init_hw(struct ieee80211_hw
*dev
)
364 struct rtl8180_priv
*priv
= dev
->priv
;
367 rtl818x_iowrite8(priv
, &priv
->map
->CMD
, 0);
368 rtl818x_ioread8(priv
, &priv
->map
->CMD
);
372 rtl818x_iowrite16(priv
, &priv
->map
->INT_MASK
, 0);
373 rtl818x_ioread8(priv
, &priv
->map
->CMD
);
375 reg
= rtl818x_ioread8(priv
, &priv
->map
->CMD
);
377 reg
|= RTL818X_CMD_RESET
;
378 rtl818x_iowrite8(priv
, &priv
->map
->CMD
, RTL818X_CMD_RESET
);
379 rtl818x_ioread8(priv
, &priv
->map
->CMD
);
382 /* check success of reset */
383 if (rtl818x_ioread8(priv
, &priv
->map
->CMD
) & RTL818X_CMD_RESET
) {
384 wiphy_err(dev
->wiphy
, "reset timeout!\n");
388 rtl818x_iowrite8(priv
, &priv
->map
->EEPROM_CMD
, RTL818X_EEPROM_CMD_LOAD
);
389 rtl818x_ioread8(priv
, &priv
->map
->CMD
);
392 if (rtl818x_ioread8(priv
, &priv
->map
->CONFIG3
) & (1 << 3)) {
394 reg
= rtl818x_ioread8(priv
, &priv
->map
->CONFIG3
);
396 rtl818x_iowrite8(priv
, &priv
->map
->CONFIG3
, reg
);
397 reg
= rtl818x_ioread16(priv
, &priv
->map
->FEMR
);
398 reg
|= (1 << 15) | (1 << 14) | (1 << 4);
399 rtl818x_iowrite16(priv
, &priv
->map
->FEMR
, reg
);
402 rtl818x_iowrite8(priv
, &priv
->map
->MSR
, 0);
405 rtl8180_set_anaparam(priv
, priv
->anaparam
);
407 rtl818x_iowrite32(priv
, &priv
->map
->RDSAR
, priv
->rx_ring_dma
);
408 rtl818x_iowrite32(priv
, &priv
->map
->TBDA
, priv
->tx_ring
[3].dma
);
409 rtl818x_iowrite32(priv
, &priv
->map
->THPDA
, priv
->tx_ring
[2].dma
);
410 rtl818x_iowrite32(priv
, &priv
->map
->TNPDA
, priv
->tx_ring
[1].dma
);
411 rtl818x_iowrite32(priv
, &priv
->map
->TLPDA
, priv
->tx_ring
[0].dma
);
413 /* TODO: necessary? specs indicate not */
414 rtl818x_iowrite8(priv
, &priv
->map
->EEPROM_CMD
, RTL818X_EEPROM_CMD_CONFIG
);
415 reg
= rtl818x_ioread8(priv
, &priv
->map
->CONFIG2
);
416 rtl818x_iowrite8(priv
, &priv
->map
->CONFIG2
, reg
& ~(1 << 3));
418 reg
= rtl818x_ioread8(priv
, &priv
->map
->CONFIG2
);
419 rtl818x_iowrite8(priv
, &priv
->map
->CONFIG2
, reg
| (1 << 4));
421 rtl818x_iowrite8(priv
, &priv
->map
->EEPROM_CMD
, RTL818X_EEPROM_CMD_NORMAL
);
423 /* TODO: set CONFIG5 for calibrating AGC on rtl8180 + philips radio? */
425 /* TODO: turn off hw wep on rtl8180 */
427 rtl818x_iowrite32(priv
, &priv
->map
->INT_TIMEOUT
, 0);
430 rtl818x_iowrite8(priv
, &priv
->map
->WPA_CONF
, 0);
431 rtl818x_iowrite8(priv
, &priv
->map
->RATE_FALLBACK
, 0x81);
432 rtl818x_iowrite8(priv
, &priv
->map
->RESP_RATE
, (8 << 4) | 0);
434 rtl818x_iowrite16(priv
, &priv
->map
->BRSR
, 0x01F3);
436 /* TODO: set ClkRun enable? necessary? */
437 reg
= rtl818x_ioread8(priv
, &priv
->map
->GP_ENABLE
);
438 rtl818x_iowrite8(priv
, &priv
->map
->GP_ENABLE
, reg
& ~(1 << 6));
439 rtl818x_iowrite8(priv
, &priv
->map
->EEPROM_CMD
, RTL818X_EEPROM_CMD_CONFIG
);
440 reg
= rtl818x_ioread8(priv
, &priv
->map
->CONFIG3
);
441 rtl818x_iowrite8(priv
, &priv
->map
->CONFIG3
, reg
| (1 << 2));
442 rtl818x_iowrite8(priv
, &priv
->map
->EEPROM_CMD
, RTL818X_EEPROM_CMD_NORMAL
);
444 rtl818x_iowrite16(priv
, &priv
->map
->BRSR
, 0x1);
445 rtl818x_iowrite8(priv
, &priv
->map
->SECURITY
, 0);
447 rtl818x_iowrite8(priv
, &priv
->map
->PHY_DELAY
, 0x6);
448 rtl818x_iowrite8(priv
, &priv
->map
->CARRIER_SENSE_COUNTER
, 0x4C);
453 rtl818x_iowrite16(priv
, &priv
->map
->BRSR
, 0x01F3);
457 static int rtl8180_init_rx_ring(struct ieee80211_hw
*dev
)
459 struct rtl8180_priv
*priv
= dev
->priv
;
460 struct rtl8180_rx_desc
*entry
;
463 priv
->rx_ring
= pci_alloc_consistent(priv
->pdev
,
464 sizeof(*priv
->rx_ring
) * 32,
467 if (!priv
->rx_ring
|| (unsigned long)priv
->rx_ring
& 0xFF) {
468 wiphy_err(dev
->wiphy
, "Cannot allocate RX ring\n");
472 memset(priv
->rx_ring
, 0, sizeof(*priv
->rx_ring
) * 32);
475 for (i
= 0; i
< 32; i
++) {
476 struct sk_buff
*skb
= dev_alloc_skb(MAX_RX_SIZE
);
478 entry
= &priv
->rx_ring
[i
];
482 priv
->rx_buf
[i
] = skb
;
483 mapping
= (dma_addr_t
*)skb
->cb
;
484 *mapping
= pci_map_single(priv
->pdev
, skb_tail_pointer(skb
),
485 MAX_RX_SIZE
, PCI_DMA_FROMDEVICE
);
486 entry
->rx_buf
= cpu_to_le32(*mapping
);
487 entry
->flags
= cpu_to_le32(RTL818X_RX_DESC_FLAG_OWN
|
490 entry
->flags
|= cpu_to_le32(RTL818X_RX_DESC_FLAG_EOR
);
494 static void rtl8180_free_rx_ring(struct ieee80211_hw
*dev
)
496 struct rtl8180_priv
*priv
= dev
->priv
;
499 for (i
= 0; i
< 32; i
++) {
500 struct sk_buff
*skb
= priv
->rx_buf
[i
];
504 pci_unmap_single(priv
->pdev
,
505 *((dma_addr_t
*)skb
->cb
),
506 MAX_RX_SIZE
, PCI_DMA_FROMDEVICE
);
510 pci_free_consistent(priv
->pdev
, sizeof(*priv
->rx_ring
) * 32,
511 priv
->rx_ring
, priv
->rx_ring_dma
);
512 priv
->rx_ring
= NULL
;
515 static int rtl8180_init_tx_ring(struct ieee80211_hw
*dev
,
516 unsigned int prio
, unsigned int entries
)
518 struct rtl8180_priv
*priv
= dev
->priv
;
519 struct rtl8180_tx_desc
*ring
;
523 ring
= pci_alloc_consistent(priv
->pdev
, sizeof(*ring
) * entries
, &dma
);
524 if (!ring
|| (unsigned long)ring
& 0xFF) {
525 wiphy_err(dev
->wiphy
, "Cannot allocate TX ring (prio = %d)\n",
530 memset(ring
, 0, sizeof(*ring
)*entries
);
531 priv
->tx_ring
[prio
].desc
= ring
;
532 priv
->tx_ring
[prio
].dma
= dma
;
533 priv
->tx_ring
[prio
].idx
= 0;
534 priv
->tx_ring
[prio
].entries
= entries
;
535 skb_queue_head_init(&priv
->tx_ring
[prio
].queue
);
537 for (i
= 0; i
< entries
; i
++)
538 ring
[i
].next_tx_desc
=
539 cpu_to_le32((u32
)dma
+ ((i
+ 1) % entries
) * sizeof(*ring
));
544 static void rtl8180_free_tx_ring(struct ieee80211_hw
*dev
, unsigned int prio
)
546 struct rtl8180_priv
*priv
= dev
->priv
;
547 struct rtl8180_tx_ring
*ring
= &priv
->tx_ring
[prio
];
549 while (skb_queue_len(&ring
->queue
)) {
550 struct rtl8180_tx_desc
*entry
= &ring
->desc
[ring
->idx
];
551 struct sk_buff
*skb
= __skb_dequeue(&ring
->queue
);
553 pci_unmap_single(priv
->pdev
, le32_to_cpu(entry
->tx_buf
),
554 skb
->len
, PCI_DMA_TODEVICE
);
556 ring
->idx
= (ring
->idx
+ 1) % ring
->entries
;
559 pci_free_consistent(priv
->pdev
, sizeof(*ring
->desc
)*ring
->entries
,
560 ring
->desc
, ring
->dma
);
564 static int rtl8180_start(struct ieee80211_hw
*dev
)
566 struct rtl8180_priv
*priv
= dev
->priv
;
570 ret
= rtl8180_init_rx_ring(dev
);
574 for (i
= 0; i
< 4; i
++)
575 if ((ret
= rtl8180_init_tx_ring(dev
, i
, 16)))
578 ret
= rtl8180_init_hw(dev
);
582 rtl818x_iowrite32(priv
, &priv
->map
->RDSAR
, priv
->rx_ring_dma
);
583 rtl818x_iowrite32(priv
, &priv
->map
->TBDA
, priv
->tx_ring
[3].dma
);
584 rtl818x_iowrite32(priv
, &priv
->map
->THPDA
, priv
->tx_ring
[2].dma
);
585 rtl818x_iowrite32(priv
, &priv
->map
->TNPDA
, priv
->tx_ring
[1].dma
);
586 rtl818x_iowrite32(priv
, &priv
->map
->TLPDA
, priv
->tx_ring
[0].dma
);
588 ret
= request_irq(priv
->pdev
->irq
, rtl8180_interrupt
,
589 IRQF_SHARED
, KBUILD_MODNAME
, dev
);
591 wiphy_err(dev
->wiphy
, "failed to register IRQ handler\n");
595 rtl818x_iowrite16(priv
, &priv
->map
->INT_MASK
, 0xFFFF);
597 rtl818x_iowrite32(priv
, &priv
->map
->MAR
[0], ~0);
598 rtl818x_iowrite32(priv
, &priv
->map
->MAR
[1], ~0);
600 reg
= RTL818X_RX_CONF_ONLYERLPKT
|
601 RTL818X_RX_CONF_RX_AUTORESETPHY
|
602 RTL818X_RX_CONF_MGMT
|
603 RTL818X_RX_CONF_DATA
|
604 (7 << 8 /* MAX RX DMA */) |
605 RTL818X_RX_CONF_BROADCAST
|
606 RTL818X_RX_CONF_NICMAC
;
609 reg
|= RTL818X_RX_CONF_CSDM1
| RTL818X_RX_CONF_CSDM2
;
611 reg
|= (priv
->rfparam
& RF_PARAM_CARRIERSENSE1
)
612 ? RTL818X_RX_CONF_CSDM1
: 0;
613 reg
|= (priv
->rfparam
& RF_PARAM_CARRIERSENSE2
)
614 ? RTL818X_RX_CONF_CSDM2
: 0;
618 rtl818x_iowrite32(priv
, &priv
->map
->RX_CONF
, reg
);
621 reg
= rtl818x_ioread8(priv
, &priv
->map
->CW_CONF
);
622 reg
&= ~RTL818X_CW_CONF_PERPACKET_CW
;
623 reg
|= RTL818X_CW_CONF_PERPACKET_RETRY
;
624 rtl818x_iowrite8(priv
, &priv
->map
->CW_CONF
, reg
);
626 reg
= rtl818x_ioread8(priv
, &priv
->map
->TX_AGC_CTL
);
627 reg
&= ~RTL818X_TX_AGC_CTL_PERPACKET_GAIN
;
628 reg
&= ~RTL818X_TX_AGC_CTL_PERPACKET_ANTSEL
;
629 reg
|= RTL818X_TX_AGC_CTL_FEEDBACK_ANT
;
630 rtl818x_iowrite8(priv
, &priv
->map
->TX_AGC_CTL
, reg
);
632 /* disable early TX */
633 rtl818x_iowrite8(priv
, (u8 __iomem
*)priv
->map
+ 0xec, 0x3f);
636 reg
= rtl818x_ioread32(priv
, &priv
->map
->TX_CONF
);
637 reg
|= (6 << 21 /* MAX TX DMA */) |
638 RTL818X_TX_CONF_NO_ICV
;
641 reg
&= ~RTL818X_TX_CONF_PROBE_DTS
;
643 reg
&= ~RTL818X_TX_CONF_HW_SEQNUM
;
645 reg
&= ~RTL818X_TX_CONF_DISCW
;
647 /* different meaning, same value on both rtl8185 and rtl8180 */
648 reg
&= ~RTL818X_TX_CONF_SAT_HWPLCP
;
650 rtl818x_iowrite32(priv
, &priv
->map
->TX_CONF
, reg
);
652 reg
= rtl818x_ioread8(priv
, &priv
->map
->CMD
);
653 reg
|= RTL818X_CMD_RX_ENABLE
;
654 reg
|= RTL818X_CMD_TX_ENABLE
;
655 rtl818x_iowrite8(priv
, &priv
->map
->CMD
, reg
);
660 rtl8180_free_rx_ring(dev
);
661 for (i
= 0; i
< 4; i
++)
662 if (priv
->tx_ring
[i
].desc
)
663 rtl8180_free_tx_ring(dev
, i
);
668 static void rtl8180_stop(struct ieee80211_hw
*dev
)
670 struct rtl8180_priv
*priv
= dev
->priv
;
674 rtl818x_iowrite16(priv
, &priv
->map
->INT_MASK
, 0);
676 reg
= rtl818x_ioread8(priv
, &priv
->map
->CMD
);
677 reg
&= ~RTL818X_CMD_TX_ENABLE
;
678 reg
&= ~RTL818X_CMD_RX_ENABLE
;
679 rtl818x_iowrite8(priv
, &priv
->map
->CMD
, reg
);
683 rtl818x_iowrite8(priv
, &priv
->map
->EEPROM_CMD
, RTL818X_EEPROM_CMD_CONFIG
);
684 reg
= rtl818x_ioread8(priv
, &priv
->map
->CONFIG4
);
685 rtl818x_iowrite8(priv
, &priv
->map
->CONFIG4
, reg
| RTL818X_CONFIG4_VCOOFF
);
686 rtl818x_iowrite8(priv
, &priv
->map
->EEPROM_CMD
, RTL818X_EEPROM_CMD_NORMAL
);
688 free_irq(priv
->pdev
->irq
, dev
);
690 rtl8180_free_rx_ring(dev
);
691 for (i
= 0; i
< 4; i
++)
692 rtl8180_free_tx_ring(dev
, i
);
695 static u64
rtl8180_get_tsf(struct ieee80211_hw
*dev
,
696 struct ieee80211_vif
*vif
)
698 struct rtl8180_priv
*priv
= dev
->priv
;
700 return rtl818x_ioread32(priv
, &priv
->map
->TSFT
[0]) |
701 (u64
)(rtl818x_ioread32(priv
, &priv
->map
->TSFT
[1])) << 32;
704 static void rtl8180_beacon_work(struct work_struct
*work
)
706 struct rtl8180_vif
*vif_priv
=
707 container_of(work
, struct rtl8180_vif
, beacon_work
.work
);
708 struct ieee80211_vif
*vif
=
709 container_of((void *)vif_priv
, struct ieee80211_vif
, drv_priv
);
710 struct ieee80211_hw
*dev
= vif_priv
->dev
;
711 struct ieee80211_mgmt
*mgmt
;
714 /* don't overflow the tx ring */
715 if (ieee80211_queue_stopped(dev
, 0))
718 /* grab a fresh beacon */
719 skb
= ieee80211_beacon_get(dev
, vif
);
724 * update beacon timestamp w/ TSF value
725 * TODO: make hardware update beacon timestamp
727 mgmt
= (struct ieee80211_mgmt
*)skb
->data
;
728 mgmt
->u
.beacon
.timestamp
= cpu_to_le64(rtl8180_get_tsf(dev
, vif
));
730 /* TODO: use actual beacon queue */
731 skb_set_queue_mapping(skb
, 0);
733 rtl8180_tx(dev
, NULL
, skb
);
737 * schedule next beacon
738 * TODO: use hardware support for beacon timing
740 schedule_delayed_work(&vif_priv
->beacon_work
,
741 usecs_to_jiffies(1024 * vif
->bss_conf
.beacon_int
));
744 static int rtl8180_add_interface(struct ieee80211_hw
*dev
,
745 struct ieee80211_vif
*vif
)
747 struct rtl8180_priv
*priv
= dev
->priv
;
748 struct rtl8180_vif
*vif_priv
;
751 * We only support one active interface at a time.
757 case NL80211_IFTYPE_STATION
:
758 case NL80211_IFTYPE_ADHOC
:
766 /* Initialize driver private area */
767 vif_priv
= (struct rtl8180_vif
*)&vif
->drv_priv
;
769 INIT_DELAYED_WORK(&vif_priv
->beacon_work
, rtl8180_beacon_work
);
770 vif_priv
->enable_beacon
= false;
772 rtl818x_iowrite8(priv
, &priv
->map
->EEPROM_CMD
, RTL818X_EEPROM_CMD_CONFIG
);
773 rtl818x_iowrite32(priv
, (__le32 __iomem
*)&priv
->map
->MAC
[0],
774 le32_to_cpu(*(__le32
*)vif
->addr
));
775 rtl818x_iowrite16(priv
, (__le16 __iomem
*)&priv
->map
->MAC
[4],
776 le16_to_cpu(*(__le16
*)(vif
->addr
+ 4)));
777 rtl818x_iowrite8(priv
, &priv
->map
->EEPROM_CMD
, RTL818X_EEPROM_CMD_NORMAL
);
782 static void rtl8180_remove_interface(struct ieee80211_hw
*dev
,
783 struct ieee80211_vif
*vif
)
785 struct rtl8180_priv
*priv
= dev
->priv
;
789 static int rtl8180_config(struct ieee80211_hw
*dev
, u32 changed
)
791 struct rtl8180_priv
*priv
= dev
->priv
;
792 struct ieee80211_conf
*conf
= &dev
->conf
;
794 priv
->rf
->set_chan(dev
, conf
);
799 static void rtl8180_bss_info_changed(struct ieee80211_hw
*dev
,
800 struct ieee80211_vif
*vif
,
801 struct ieee80211_bss_conf
*info
,
804 struct rtl8180_priv
*priv
= dev
->priv
;
805 struct rtl8180_vif
*vif_priv
;
809 vif_priv
= (struct rtl8180_vif
*)&vif
->drv_priv
;
811 if (changed
& BSS_CHANGED_BSSID
) {
812 for (i
= 0; i
< ETH_ALEN
; i
++)
813 rtl818x_iowrite8(priv
, &priv
->map
->BSSID
[i
],
816 if (is_valid_ether_addr(info
->bssid
)) {
817 if (vif
->type
== NL80211_IFTYPE_ADHOC
)
818 reg
= RTL818X_MSR_ADHOC
;
820 reg
= RTL818X_MSR_INFRA
;
822 reg
= RTL818X_MSR_NO_LINK
;
823 rtl818x_iowrite8(priv
, &priv
->map
->MSR
, reg
);
826 if (changed
& BSS_CHANGED_ERP_SLOT
&& priv
->rf
->conf_erp
)
827 priv
->rf
->conf_erp(dev
, info
);
829 if (changed
& BSS_CHANGED_BEACON_ENABLED
)
830 vif_priv
->enable_beacon
= info
->enable_beacon
;
832 if (changed
& (BSS_CHANGED_BEACON_ENABLED
| BSS_CHANGED_BEACON
)) {
833 cancel_delayed_work_sync(&vif_priv
->beacon_work
);
834 if (vif_priv
->enable_beacon
)
835 schedule_work(&vif_priv
->beacon_work
.work
);
839 static u64
rtl8180_prepare_multicast(struct ieee80211_hw
*dev
,
840 struct netdev_hw_addr_list
*mc_list
)
842 return netdev_hw_addr_list_count(mc_list
);
845 static void rtl8180_configure_filter(struct ieee80211_hw
*dev
,
846 unsigned int changed_flags
,
847 unsigned int *total_flags
,
850 struct rtl8180_priv
*priv
= dev
->priv
;
852 if (changed_flags
& FIF_FCSFAIL
)
853 priv
->rx_conf
^= RTL818X_RX_CONF_FCS
;
854 if (changed_flags
& FIF_CONTROL
)
855 priv
->rx_conf
^= RTL818X_RX_CONF_CTRL
;
856 if (changed_flags
& FIF_OTHER_BSS
)
857 priv
->rx_conf
^= RTL818X_RX_CONF_MONITOR
;
858 if (*total_flags
& FIF_ALLMULTI
|| multicast
> 0)
859 priv
->rx_conf
|= RTL818X_RX_CONF_MULTICAST
;
861 priv
->rx_conf
&= ~RTL818X_RX_CONF_MULTICAST
;
865 if (priv
->rx_conf
& RTL818X_RX_CONF_FCS
)
866 *total_flags
|= FIF_FCSFAIL
;
867 if (priv
->rx_conf
& RTL818X_RX_CONF_CTRL
)
868 *total_flags
|= FIF_CONTROL
;
869 if (priv
->rx_conf
& RTL818X_RX_CONF_MONITOR
)
870 *total_flags
|= FIF_OTHER_BSS
;
871 if (priv
->rx_conf
& RTL818X_RX_CONF_MULTICAST
)
872 *total_flags
|= FIF_ALLMULTI
;
874 rtl818x_iowrite32(priv
, &priv
->map
->RX_CONF
, priv
->rx_conf
);
877 static const struct ieee80211_ops rtl8180_ops
= {
879 .start
= rtl8180_start
,
880 .stop
= rtl8180_stop
,
881 .add_interface
= rtl8180_add_interface
,
882 .remove_interface
= rtl8180_remove_interface
,
883 .config
= rtl8180_config
,
884 .bss_info_changed
= rtl8180_bss_info_changed
,
885 .prepare_multicast
= rtl8180_prepare_multicast
,
886 .configure_filter
= rtl8180_configure_filter
,
887 .get_tsf
= rtl8180_get_tsf
,
890 static void rtl8180_eeprom_register_read(struct eeprom_93cx6
*eeprom
)
892 struct ieee80211_hw
*dev
= eeprom
->data
;
893 struct rtl8180_priv
*priv
= dev
->priv
;
894 u8 reg
= rtl818x_ioread8(priv
, &priv
->map
->EEPROM_CMD
);
896 eeprom
->reg_data_in
= reg
& RTL818X_EEPROM_CMD_WRITE
;
897 eeprom
->reg_data_out
= reg
& RTL818X_EEPROM_CMD_READ
;
898 eeprom
->reg_data_clock
= reg
& RTL818X_EEPROM_CMD_CK
;
899 eeprom
->reg_chip_select
= reg
& RTL818X_EEPROM_CMD_CS
;
902 static void rtl8180_eeprom_register_write(struct eeprom_93cx6
*eeprom
)
904 struct ieee80211_hw
*dev
= eeprom
->data
;
905 struct rtl8180_priv
*priv
= dev
->priv
;
908 if (eeprom
->reg_data_in
)
909 reg
|= RTL818X_EEPROM_CMD_WRITE
;
910 if (eeprom
->reg_data_out
)
911 reg
|= RTL818X_EEPROM_CMD_READ
;
912 if (eeprom
->reg_data_clock
)
913 reg
|= RTL818X_EEPROM_CMD_CK
;
914 if (eeprom
->reg_chip_select
)
915 reg
|= RTL818X_EEPROM_CMD_CS
;
917 rtl818x_iowrite8(priv
, &priv
->map
->EEPROM_CMD
, reg
);
918 rtl818x_ioread8(priv
, &priv
->map
->EEPROM_CMD
);
922 static int rtl8180_probe(struct pci_dev
*pdev
,
923 const struct pci_device_id
*id
)
925 struct ieee80211_hw
*dev
;
926 struct rtl8180_priv
*priv
;
927 unsigned long mem_addr
, mem_len
;
928 unsigned int io_addr
, io_len
;
930 struct eeprom_93cx6 eeprom
;
931 const char *chip_name
, *rf_name
= NULL
;
934 u8 mac_addr
[ETH_ALEN
];
936 err
= pci_enable_device(pdev
);
938 printk(KERN_ERR
"%s (rtl8180): Cannot enable new PCI device\n",
943 err
= pci_request_regions(pdev
, KBUILD_MODNAME
);
945 printk(KERN_ERR
"%s (rtl8180): Cannot obtain PCI resources\n",
950 io_addr
= pci_resource_start(pdev
, 0);
951 io_len
= pci_resource_len(pdev
, 0);
952 mem_addr
= pci_resource_start(pdev
, 1);
953 mem_len
= pci_resource_len(pdev
, 1);
955 if (mem_len
< sizeof(struct rtl818x_csr
) ||
956 io_len
< sizeof(struct rtl818x_csr
)) {
957 printk(KERN_ERR
"%s (rtl8180): Too short PCI resources\n",
963 if ((err
= pci_set_dma_mask(pdev
, DMA_BIT_MASK(32))) ||
964 (err
= pci_set_consistent_dma_mask(pdev
, DMA_BIT_MASK(32)))) {
965 printk(KERN_ERR
"%s (rtl8180): No suitable DMA available\n",
970 pci_set_master(pdev
);
972 dev
= ieee80211_alloc_hw(sizeof(*priv
), &rtl8180_ops
);
974 printk(KERN_ERR
"%s (rtl8180): ieee80211 alloc failed\n",
984 SET_IEEE80211_DEV(dev
, &pdev
->dev
);
985 pci_set_drvdata(pdev
, dev
);
987 priv
->map
= pci_iomap(pdev
, 1, mem_len
);
989 priv
->map
= pci_iomap(pdev
, 0, io_len
);
992 printk(KERN_ERR
"%s (rtl8180): Cannot map device memory\n",
997 BUILD_BUG_ON(sizeof(priv
->channels
) != sizeof(rtl818x_channels
));
998 BUILD_BUG_ON(sizeof(priv
->rates
) != sizeof(rtl818x_rates
));
1000 memcpy(priv
->channels
, rtl818x_channels
, sizeof(rtl818x_channels
));
1001 memcpy(priv
->rates
, rtl818x_rates
, sizeof(rtl818x_rates
));
1003 priv
->band
.band
= IEEE80211_BAND_2GHZ
;
1004 priv
->band
.channels
= priv
->channels
;
1005 priv
->band
.n_channels
= ARRAY_SIZE(rtl818x_channels
);
1006 priv
->band
.bitrates
= priv
->rates
;
1007 priv
->band
.n_bitrates
= 4;
1008 dev
->wiphy
->bands
[IEEE80211_BAND_2GHZ
] = &priv
->band
;
1010 dev
->flags
= IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING
|
1011 IEEE80211_HW_RX_INCLUDES_FCS
|
1012 IEEE80211_HW_SIGNAL_UNSPEC
;
1013 dev
->vif_data_size
= sizeof(struct rtl8180_vif
);
1014 dev
->wiphy
->interface_modes
= BIT(NL80211_IFTYPE_STATION
) |
1015 BIT(NL80211_IFTYPE_ADHOC
);
1017 dev
->max_signal
= 65;
1019 reg
= rtl818x_ioread32(priv
, &priv
->map
->TX_CONF
);
1020 reg
&= RTL818X_TX_CONF_HWVER_MASK
;
1022 case RTL818X_TX_CONF_R8180_ABCD
:
1023 chip_name
= "RTL8180";
1025 case RTL818X_TX_CONF_R8180_F
:
1026 chip_name
= "RTL8180vF";
1028 case RTL818X_TX_CONF_R8185_ABC
:
1029 chip_name
= "RTL8185";
1031 case RTL818X_TX_CONF_R8185_D
:
1032 chip_name
= "RTL8185vD";
1035 printk(KERN_ERR
"%s (rtl8180): Unknown chip! (0x%x)\n",
1036 pci_name(pdev
), reg
>> 25);
1040 priv
->r8185
= reg
& RTL818X_TX_CONF_R8185_ABC
;
1042 priv
->band
.n_bitrates
= ARRAY_SIZE(rtl818x_rates
);
1043 pci_try_set_mwi(pdev
);
1047 eeprom
.register_read
= rtl8180_eeprom_register_read
;
1048 eeprom
.register_write
= rtl8180_eeprom_register_write
;
1049 if (rtl818x_ioread32(priv
, &priv
->map
->RX_CONF
) & (1 << 6))
1050 eeprom
.width
= PCI_EEPROM_WIDTH_93C66
;
1052 eeprom
.width
= PCI_EEPROM_WIDTH_93C46
;
1054 rtl818x_iowrite8(priv
, &priv
->map
->EEPROM_CMD
, RTL818X_EEPROM_CMD_PROGRAM
);
1055 rtl818x_ioread8(priv
, &priv
->map
->EEPROM_CMD
);
1058 eeprom_93cx6_read(&eeprom
, 0x06, &eeprom_val
);
1060 switch (eeprom_val
) {
1061 case 1: rf_name
= "Intersil";
1063 case 2: rf_name
= "RFMD";
1065 case 3: priv
->rf
= &sa2400_rf_ops
;
1067 case 4: priv
->rf
= &max2820_rf_ops
;
1069 case 5: priv
->rf
= &grf5101_rf_ops
;
1071 case 9: priv
->rf
= rtl8180_detect_rf(dev
);
1074 rf_name
= "RTL8255";
1077 printk(KERN_ERR
"%s (rtl8180): Unknown RF! (0x%x)\n",
1078 pci_name(pdev
), eeprom_val
);
1083 printk(KERN_ERR
"%s (rtl8180): %s RF frontend not supported!\n",
1084 pci_name(pdev
), rf_name
);
1088 eeprom_93cx6_read(&eeprom
, 0x17, &eeprom_val
);
1089 priv
->csthreshold
= eeprom_val
>> 8;
1092 eeprom_93cx6_multiread(&eeprom
, 0xD, (__le16
*)&anaparam
, 2);
1093 priv
->anaparam
= le32_to_cpu(anaparam
);
1094 eeprom_93cx6_read(&eeprom
, 0x19, &priv
->rfparam
);
1097 eeprom_93cx6_multiread(&eeprom
, 0x7, (__le16
*)mac_addr
, 3);
1098 if (!is_valid_ether_addr(mac_addr
)) {
1099 printk(KERN_WARNING
"%s (rtl8180): Invalid hwaddr! Using"
1100 " randomly generated MAC addr\n", pci_name(pdev
));
1101 eth_random_addr(mac_addr
);
1103 SET_IEEE80211_PERM_ADDR(dev
, mac_addr
);
1106 for (i
= 0; i
< 14; i
+= 2) {
1108 eeprom_93cx6_read(&eeprom
, 0x10 + (i
>> 1), &txpwr
);
1109 priv
->channels
[i
].hw_value
= txpwr
& 0xFF;
1110 priv
->channels
[i
+ 1].hw_value
= txpwr
>> 8;
1115 for (i
= 0; i
< 14; i
+= 2) {
1117 eeprom_93cx6_read(&eeprom
, 0x20 + (i
>> 1), &txpwr
);
1118 priv
->channels
[i
].hw_value
|= (txpwr
& 0xFF) << 8;
1119 priv
->channels
[i
+ 1].hw_value
|= txpwr
& 0xFF00;
1123 rtl818x_iowrite8(priv
, &priv
->map
->EEPROM_CMD
, RTL818X_EEPROM_CMD_NORMAL
);
1125 spin_lock_init(&priv
->lock
);
1127 err
= ieee80211_register_hw(dev
);
1129 printk(KERN_ERR
"%s (rtl8180): Cannot register device\n",
1134 wiphy_info(dev
->wiphy
, "hwaddr %pm, %s + %s\n",
1135 mac_addr
, chip_name
, priv
->rf
->name
);
1140 pci_iounmap(pdev
, priv
->map
);
1143 ieee80211_free_hw(dev
);
1146 pci_release_regions(pdev
);
1147 pci_disable_device(pdev
);
1151 static void rtl8180_remove(struct pci_dev
*pdev
)
1153 struct ieee80211_hw
*dev
= pci_get_drvdata(pdev
);
1154 struct rtl8180_priv
*priv
;
1159 ieee80211_unregister_hw(dev
);
1163 pci_iounmap(pdev
, priv
->map
);
1164 pci_release_regions(pdev
);
1165 pci_disable_device(pdev
);
1166 ieee80211_free_hw(dev
);
1170 static int rtl8180_suspend(struct pci_dev
*pdev
, pm_message_t state
)
1172 pci_save_state(pdev
);
1173 pci_set_power_state(pdev
, pci_choose_state(pdev
, state
));
1177 static int rtl8180_resume(struct pci_dev
*pdev
)
1179 pci_set_power_state(pdev
, PCI_D0
);
1180 pci_restore_state(pdev
);
1184 #endif /* CONFIG_PM */
1186 static struct pci_driver rtl8180_driver
= {
1187 .name
= KBUILD_MODNAME
,
1188 .id_table
= rtl8180_table
,
1189 .probe
= rtl8180_probe
,
1190 .remove
= rtl8180_remove
,
1192 .suspend
= rtl8180_suspend
,
1193 .resume
= rtl8180_resume
,
1194 #endif /* CONFIG_PM */
1197 module_pci_driver(rtl8180_driver
);