diff options
Diffstat (limited to 'drivers/net/wireless/rtl818x/rtl8180_dev.c')
-rw-r--r-- | drivers/net/wireless/rtl818x/rtl8180_dev.c | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/drivers/net/wireless/rtl818x/rtl8180_dev.c b/drivers/net/wireless/rtl818x/rtl8180_dev.c index 16429c49139c..2131a442831a 100644 --- a/drivers/net/wireless/rtl818x/rtl8180_dev.c +++ b/drivers/net/wireless/rtl818x/rtl8180_dev.c | |||
@@ -17,6 +17,7 @@ | |||
17 | 17 | ||
18 | #include <linux/init.h> | 18 | #include <linux/init.h> |
19 | #include <linux/pci.h> | 19 | #include <linux/pci.h> |
20 | #include <linux/slab.h> | ||
20 | #include <linux/delay.h> | 21 | #include <linux/delay.h> |
21 | #include <linux/etherdevice.h> | 22 | #include <linux/etherdevice.h> |
22 | #include <linux/eeprom_93cx6.h> | 23 | #include <linux/eeprom_93cx6.h> |
@@ -33,7 +34,7 @@ MODULE_AUTHOR("Andrea Merello <andreamrl@tiscali.it>"); | |||
33 | MODULE_DESCRIPTION("RTL8180 / RTL8185 PCI wireless driver"); | 34 | MODULE_DESCRIPTION("RTL8180 / RTL8185 PCI wireless driver"); |
34 | MODULE_LICENSE("GPL"); | 35 | MODULE_LICENSE("GPL"); |
35 | 36 | ||
36 | static struct pci_device_id rtl8180_table[] __devinitdata = { | 37 | static DEFINE_PCI_DEVICE_TABLE(rtl8180_table) = { |
37 | /* rtl8185 */ | 38 | /* rtl8185 */ |
38 | { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8185) }, | 39 | { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8185) }, |
39 | { PCI_DEVICE(PCI_VENDOR_ID_BELKIN, 0x700f) }, | 40 | { PCI_DEVICE(PCI_VENDOR_ID_BELKIN, 0x700f) }, |
@@ -82,8 +83,6 @@ static const struct ieee80211_channel rtl818x_channels[] = { | |||
82 | }; | 83 | }; |
83 | 84 | ||
84 | 85 | ||
85 | |||
86 | |||
87 | void rtl8180_write_phy(struct ieee80211_hw *dev, u8 addr, u32 data) | 86 | void rtl8180_write_phy(struct ieee80211_hw *dev, u8 addr, u32 data) |
88 | { | 87 | { |
89 | struct rtl8180_priv *priv = dev->priv; | 88 | struct rtl8180_priv *priv = dev->priv; |
@@ -132,7 +131,6 @@ static void rtl8180_handle_rx(struct ieee80211_hw *dev) | |||
132 | 131 | ||
133 | rx_status.antenna = (flags2 >> 15) & 1; | 132 | rx_status.antenna = (flags2 >> 15) & 1; |
134 | /* TODO: improve signal/rssi reporting */ | 133 | /* TODO: improve signal/rssi reporting */ |
135 | rx_status.qual = flags2 & 0xFF; | ||
136 | rx_status.signal = (flags2 >> 8) & 0x7F; | 134 | rx_status.signal = (flags2 >> 8) & 0x7F; |
137 | /* XXX: is this correct? */ | 135 | /* XXX: is this correct? */ |
138 | rx_status.rate_idx = (flags >> 20) & 0xF; | 136 | rx_status.rate_idx = (flags >> 20) & 0xF; |
@@ -548,7 +546,7 @@ static int rtl8180_start(struct ieee80211_hw *dev) | |||
548 | rtl818x_iowrite32(priv, &priv->map->TNPDA, priv->tx_ring[1].dma); | 546 | rtl818x_iowrite32(priv, &priv->map->TNPDA, priv->tx_ring[1].dma); |
549 | rtl818x_iowrite32(priv, &priv->map->TLPDA, priv->tx_ring[0].dma); | 547 | rtl818x_iowrite32(priv, &priv->map->TLPDA, priv->tx_ring[0].dma); |
550 | 548 | ||
551 | ret = request_irq(priv->pdev->irq, &rtl8180_interrupt, | 549 | ret = request_irq(priv->pdev->irq, rtl8180_interrupt, |
552 | IRQF_SHARED, KBUILD_MODNAME, dev); | 550 | IRQF_SHARED, KBUILD_MODNAME, dev); |
553 | if (ret) { | 551 | if (ret) { |
554 | printk(KERN_ERR "%s: failed to register IRQ handler\n", | 552 | printk(KERN_ERR "%s: failed to register IRQ handler\n", |
@@ -616,7 +614,6 @@ static int rtl8180_start(struct ieee80211_hw *dev) | |||
616 | reg |= RTL818X_CMD_TX_ENABLE; | 614 | reg |= RTL818X_CMD_TX_ENABLE; |
617 | rtl818x_iowrite8(priv, &priv->map->CMD, reg); | 615 | rtl818x_iowrite8(priv, &priv->map->CMD, reg); |
618 | 616 | ||
619 | priv->mode = NL80211_IFTYPE_MONITOR; | ||
620 | return 0; | 617 | return 0; |
621 | 618 | ||
622 | err_free_rings: | 619 | err_free_rings: |
@@ -634,8 +631,6 @@ static void rtl8180_stop(struct ieee80211_hw *dev) | |||
634 | u8 reg; | 631 | u8 reg; |
635 | int i; | 632 | int i; |
636 | 633 | ||
637 | priv->mode = NL80211_IFTYPE_UNSPECIFIED; | ||
638 | |||
639 | rtl818x_iowrite16(priv, &priv->map->INT_MASK, 0); | 634 | rtl818x_iowrite16(priv, &priv->map->INT_MASK, 0); |
640 | 635 | ||
641 | reg = rtl818x_ioread8(priv, &priv->map->CMD); | 636 | reg = rtl818x_ioread8(priv, &priv->map->CMD); |
@@ -658,38 +653,39 @@ static void rtl8180_stop(struct ieee80211_hw *dev) | |||
658 | } | 653 | } |
659 | 654 | ||
660 | static int rtl8180_add_interface(struct ieee80211_hw *dev, | 655 | static int rtl8180_add_interface(struct ieee80211_hw *dev, |
661 | struct ieee80211_if_init_conf *conf) | 656 | struct ieee80211_vif *vif) |
662 | { | 657 | { |
663 | struct rtl8180_priv *priv = dev->priv; | 658 | struct rtl8180_priv *priv = dev->priv; |
664 | 659 | ||
665 | if (priv->mode != NL80211_IFTYPE_MONITOR) | 660 | /* |
666 | return -EOPNOTSUPP; | 661 | * We only support one active interface at a time. |
662 | */ | ||
663 | if (priv->vif) | ||
664 | return -EBUSY; | ||
667 | 665 | ||
668 | switch (conf->type) { | 666 | switch (vif->type) { |
669 | case NL80211_IFTYPE_STATION: | 667 | case NL80211_IFTYPE_STATION: |
670 | priv->mode = conf->type; | ||
671 | break; | 668 | break; |
672 | default: | 669 | default: |
673 | return -EOPNOTSUPP; | 670 | return -EOPNOTSUPP; |
674 | } | 671 | } |
675 | 672 | ||
676 | priv->vif = conf->vif; | 673 | priv->vif = vif; |
677 | 674 | ||
678 | rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG); | 675 | rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG); |
679 | rtl818x_iowrite32(priv, (__le32 __iomem *)&priv->map->MAC[0], | 676 | rtl818x_iowrite32(priv, (__le32 __iomem *)&priv->map->MAC[0], |
680 | le32_to_cpu(*(__le32 *)conf->mac_addr)); | 677 | le32_to_cpu(*(__le32 *)vif->addr)); |
681 | rtl818x_iowrite16(priv, (__le16 __iomem *)&priv->map->MAC[4], | 678 | rtl818x_iowrite16(priv, (__le16 __iomem *)&priv->map->MAC[4], |
682 | le16_to_cpu(*(__le16 *)(conf->mac_addr + 4))); | 679 | le16_to_cpu(*(__le16 *)(vif->addr + 4))); |
683 | rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL); | 680 | rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL); |
684 | 681 | ||
685 | return 0; | 682 | return 0; |
686 | } | 683 | } |
687 | 684 | ||
688 | static void rtl8180_remove_interface(struct ieee80211_hw *dev, | 685 | static void rtl8180_remove_interface(struct ieee80211_hw *dev, |
689 | struct ieee80211_if_init_conf *conf) | 686 | struct ieee80211_vif *vif) |
690 | { | 687 | { |
691 | struct rtl8180_priv *priv = dev->priv; | 688 | struct rtl8180_priv *priv = dev->priv; |
692 | priv->mode = NL80211_IFTYPE_MONITOR; | ||
693 | priv->vif = NULL; | 689 | priv->vif = NULL; |
694 | } | 690 | } |
695 | 691 | ||
@@ -766,6 +762,14 @@ static void rtl8180_configure_filter(struct ieee80211_hw *dev, | |||
766 | rtl818x_iowrite32(priv, &priv->map->RX_CONF, priv->rx_conf); | 762 | rtl818x_iowrite32(priv, &priv->map->RX_CONF, priv->rx_conf); |
767 | } | 763 | } |
768 | 764 | ||
765 | static u64 rtl8180_get_tsf(struct ieee80211_hw *dev) | ||
766 | { | ||
767 | struct rtl8180_priv *priv = dev->priv; | ||
768 | |||
769 | return rtl818x_ioread32(priv, &priv->map->TSFT[0]) | | ||
770 | (u64)(rtl818x_ioread32(priv, &priv->map->TSFT[1])) << 32; | ||
771 | } | ||
772 | |||
769 | static const struct ieee80211_ops rtl8180_ops = { | 773 | static const struct ieee80211_ops rtl8180_ops = { |
770 | .tx = rtl8180_tx, | 774 | .tx = rtl8180_tx, |
771 | .start = rtl8180_start, | 775 | .start = rtl8180_start, |
@@ -776,6 +780,7 @@ static const struct ieee80211_ops rtl8180_ops = { | |||
776 | .bss_info_changed = rtl8180_bss_info_changed, | 780 | .bss_info_changed = rtl8180_bss_info_changed, |
777 | .prepare_multicast = rtl8180_prepare_multicast, | 781 | .prepare_multicast = rtl8180_prepare_multicast, |
778 | .configure_filter = rtl8180_configure_filter, | 782 | .configure_filter = rtl8180_configure_filter, |
783 | .get_tsf = rtl8180_get_tsf, | ||
779 | }; | 784 | }; |
780 | 785 | ||
781 | static void rtl8180_eeprom_register_read(struct eeprom_93cx6 *eeprom) | 786 | static void rtl8180_eeprom_register_read(struct eeprom_93cx6 *eeprom) |