Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (166 commits) Revert "ax25: zero length frame filtering in AX25" Revert "netrom: zero length frame filtering in NetRom" cfg80211: default CONFIG_WIRELESS_OLD_REGULATORY to n mac80211/iwlwifi: move virtual A-MDPU queue bookkeeping to iwlwifi mac80211: fix aggregation to not require queue stop mac80211: add skb length sanity checking mac80211: unify and fix TX aggregation start mac80211: clean up __ieee80211_tx args mac80211: rework the pending packets code mac80211: fix A-MPDU queue assignment mac80211: rewrite fragmentation iwlwifi: show current driver status in user readable format b43: Add BCM4307 PCI-ID cfg80211: fix locking in nl80211_set_wiphy mac80211: fix RX path ath5k: properly drop packets from ops->tx ar9170: single module build ath9k: fix dma mapping leak of rx buffer upon rmmod rt2x00: New USB ID for rt73usb ath5k: warn and correct rate for unknown hw rate indexes ...
This commit is contained in:
commit
5d80f8e5a9
|
@ -227,6 +227,12 @@ usage should require reading the full document.
|
|||
!Pinclude/net/mac80211.h Powersave support
|
||||
</chapter>
|
||||
|
||||
<chapter id="beacon-filter">
|
||||
<title>Beacon filter support</title>
|
||||
!Pinclude/net/mac80211.h Beacon filter support
|
||||
!Finclude/net/mac80211.h ieee80211_beacon_loss
|
||||
</chapter>
|
||||
|
||||
<chapter id="qos">
|
||||
<title>Multiple queues and QoS support</title>
|
||||
<para>TBD</para>
|
||||
|
|
|
@ -6,20 +6,47 @@ be removed from this file.
|
|||
|
||||
---------------------------
|
||||
|
||||
What: old static regulatory information and ieee80211_regdom module parameter
|
||||
When: 2.6.29
|
||||
What: The ieee80211_regdom module parameter
|
||||
When: March 2010 / desktop catchup
|
||||
|
||||
Why: This was inherited by the CONFIG_WIRELESS_OLD_REGULATORY code,
|
||||
and currently serves as an option for users to define an
|
||||
ISO / IEC 3166 alpha2 code for the country they are currently
|
||||
present in. Although there are userspace API replacements for this
|
||||
through nl80211 distributions haven't yet caught up with implementing
|
||||
decent alternatives through standard GUIs. Although available as an
|
||||
option through iw or wpa_supplicant its just a matter of time before
|
||||
distributions pick up good GUI options for this. The ideal solution
|
||||
would actually consist of intelligent designs which would do this for
|
||||
the user automatically even when travelling through different countries.
|
||||
Until then we leave this module parameter as a compromise.
|
||||
|
||||
When userspace improves with reasonable widely-available alternatives for
|
||||
this we will no longer need this module parameter. This entry hopes that
|
||||
by the super-futuristically looking date of "March 2010" we will have
|
||||
such replacements widely available.
|
||||
|
||||
Who: Luis R. Rodriguez <lrodriguez@atheros.com>
|
||||
|
||||
---------------------------
|
||||
|
||||
What: CONFIG_WIRELESS_OLD_REGULATORY - old static regulatory information
|
||||
When: March 2010 / desktop catchup
|
||||
|
||||
Why: The old regulatory infrastructure has been replaced with a new one
|
||||
which does not require statically defined regulatory domains. We do
|
||||
not want to keep static regulatory domains in the kernel due to the
|
||||
the dynamic nature of regulatory law and localization. We kept around
|
||||
the old static definitions for the regulatory domains of:
|
||||
|
||||
* US
|
||||
* JP
|
||||
* EU
|
||||
|
||||
and used by default the US when CONFIG_WIRELESS_OLD_REGULATORY was
|
||||
set. We also kept around the ieee80211_regdom module parameter in case
|
||||
some applications were relying on it. Changing regulatory domains
|
||||
can now be done instead by using nl80211, as is done with iw.
|
||||
set. We will remove this option once the standard Linux desktop catches
|
||||
up with the new userspace APIs we have implemented.
|
||||
|
||||
Who: Luis R. Rodriguez <lrodriguez@atheros.com>
|
||||
|
||||
---------------------------
|
||||
|
|
10
MAINTAINERS
10
MAINTAINERS
|
@ -765,6 +765,14 @@ L: linux-wireless@vger.kernel.org
|
|||
L: ath9k-devel@lists.ath9k.org
|
||||
S: Supported
|
||||
|
||||
ATHEROS AR9170 WIRELESS DRIVER
|
||||
P: Christian Lamparter
|
||||
M: chunkeey@web.de
|
||||
L: linux-wireless@vger.kernel.org
|
||||
W: http://wireless.kernel.org/en/users/Drivers/ar9170
|
||||
S: Maintained
|
||||
F: drivers/net/wireless/ar9170/
|
||||
|
||||
ATI_REMOTE2 DRIVER
|
||||
P: Ville Syrjala
|
||||
M: syrjala@sci.fi
|
||||
|
@ -3602,7 +3610,7 @@ S: Maintained
|
|||
RALINK RT2X00 WIRELESS LAN DRIVER
|
||||
P: rt2x00 project
|
||||
L: linux-wireless@vger.kernel.org
|
||||
L: rt2400-devel@lists.sourceforge.net
|
||||
L: users@rt2x00.serialmonkey.com
|
||||
W: http://rt2x00.serialmonkey.com/
|
||||
S: Maintained
|
||||
T: git kernel.org:/pub/scm/linux/kernel/git/ivd/rt2x00.git
|
||||
|
|
|
@ -86,7 +86,7 @@ static int uml_net_rx(struct net_device *dev)
|
|||
drop_skb->dev = dev;
|
||||
/* Read a packet into drop_skb and don't do anything with it. */
|
||||
(*lp->read)(lp->fd, drop_skb, lp);
|
||||
lp->stats.rx_dropped++;
|
||||
dev->stats.rx_dropped++;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -99,8 +99,8 @@ static int uml_net_rx(struct net_device *dev)
|
|||
skb_trim(skb, pkt_len);
|
||||
skb->protocol = (*lp->protocol)(skb);
|
||||
|
||||
lp->stats.rx_bytes += skb->len;
|
||||
lp->stats.rx_packets++;
|
||||
dev->stats.rx_bytes += skb->len;
|
||||
dev->stats.rx_packets++;
|
||||
netif_rx(skb);
|
||||
return pkt_len;
|
||||
}
|
||||
|
@ -224,8 +224,8 @@ static int uml_net_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
|||
len = (*lp->write)(lp->fd, skb, lp);
|
||||
|
||||
if (len == skb->len) {
|
||||
lp->stats.tx_packets++;
|
||||
lp->stats.tx_bytes += skb->len;
|
||||
dev->stats.tx_packets++;
|
||||
dev->stats.tx_bytes += skb->len;
|
||||
dev->trans_start = jiffies;
|
||||
netif_start_queue(dev);
|
||||
|
||||
|
@ -234,7 +234,7 @@ static int uml_net_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
|||
}
|
||||
else if (len == 0) {
|
||||
netif_start_queue(dev);
|
||||
lp->stats.tx_dropped++;
|
||||
dev->stats.tx_dropped++;
|
||||
}
|
||||
else {
|
||||
netif_start_queue(dev);
|
||||
|
@ -248,12 +248,6 @@ static int uml_net_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static struct net_device_stats *uml_net_get_stats(struct net_device *dev)
|
||||
{
|
||||
struct uml_net_private *lp = netdev_priv(dev);
|
||||
return &lp->stats;
|
||||
}
|
||||
|
||||
static void uml_net_set_multicast_list(struct net_device *dev)
|
||||
{
|
||||
return;
|
||||
|
@ -377,6 +371,18 @@ static void net_device_release(struct device *dev)
|
|||
free_netdev(netdev);
|
||||
}
|
||||
|
||||
static const struct net_device_ops uml_netdev_ops = {
|
||||
.ndo_open = uml_net_open,
|
||||
.ndo_stop = uml_net_close,
|
||||
.ndo_start_xmit = uml_net_start_xmit,
|
||||
.ndo_set_multicast_list = uml_net_set_multicast_list,
|
||||
.ndo_tx_timeout = uml_net_tx_timeout,
|
||||
.ndo_set_mac_address = uml_net_set_mac,
|
||||
.ndo_change_mtu = uml_net_change_mtu,
|
||||
.ndo_set_mac_address = eth_mac_addr,
|
||||
.ndo_validate_addr = eth_validate_addr,
|
||||
};
|
||||
|
||||
/*
|
||||
* Ensures that platform_driver_register is called only once by
|
||||
* eth_configure. Will be set in an initcall.
|
||||
|
@ -473,14 +479,7 @@ static void eth_configure(int n, void *init, char *mac,
|
|||
|
||||
set_ether_mac(dev, device->mac);
|
||||
dev->mtu = transport->user->mtu;
|
||||
dev->open = uml_net_open;
|
||||
dev->hard_start_xmit = uml_net_start_xmit;
|
||||
dev->stop = uml_net_close;
|
||||
dev->get_stats = uml_net_get_stats;
|
||||
dev->set_multicast_list = uml_net_set_multicast_list;
|
||||
dev->tx_timeout = uml_net_tx_timeout;
|
||||
dev->set_mac_address = uml_net_set_mac;
|
||||
dev->change_mtu = uml_net_change_mtu;
|
||||
dev->netdev_ops = ¨_netdev_ops;
|
||||
dev->ethtool_ops = ¨_net_ethtool_ops;
|
||||
dev->watchdog_timeo = (HZ >> 1);
|
||||
dev->irq = UM_ETH_IRQ;
|
||||
|
|
|
@ -26,7 +26,7 @@ struct uml_net_private {
|
|||
spinlock_t lock;
|
||||
struct net_device *dev;
|
||||
struct timer_list tl;
|
||||
struct net_device_stats stats;
|
||||
|
||||
struct work_struct work;
|
||||
int fd;
|
||||
unsigned char mac[ETH_ALEN];
|
||||
|
|
|
@ -353,9 +353,6 @@ el2_probe1(struct net_device *dev, int ioaddr)
|
|||
|
||||
dev->netdev_ops = &el2_netdev_ops;
|
||||
dev->ethtool_ops = &netdev_ethtool_ops;
|
||||
#ifdef CONFIG_NET_POLL_CONTROLLER
|
||||
dev->poll_controller = eip_poll;
|
||||
#endif
|
||||
|
||||
retval = register_netdev(dev);
|
||||
if (retval)
|
||||
|
|
|
@ -972,6 +972,14 @@ config ENC28J60_WRITEVERIFY
|
|||
Enable the verify after the buffer write useful for debugging purpose.
|
||||
If unsure, say N.
|
||||
|
||||
config ETHOC
|
||||
tristate "OpenCores 10/100 Mbps Ethernet MAC support"
|
||||
depends on NET_ETHERNET
|
||||
select MII
|
||||
select PHYLIB
|
||||
help
|
||||
Say Y here if you want to use the OpenCores 10/100 Mbps Ethernet MAC.
|
||||
|
||||
config SMC911X
|
||||
tristate "SMSC LAN911[5678] support"
|
||||
select CRC32
|
||||
|
|
|
@ -230,6 +230,7 @@ obj-$(CONFIG_PASEMI_MAC) += pasemi_mac_driver.o
|
|||
pasemi_mac_driver-objs := pasemi_mac.o pasemi_mac_ethtool.o
|
||||
obj-$(CONFIG_MLX4_CORE) += mlx4/
|
||||
obj-$(CONFIG_ENC28J60) += enc28j60.o
|
||||
obj-$(CONFIG_ETHOC) += ethoc.o
|
||||
|
||||
obj-$(CONFIG_XTENSA_XT2000_SONIC) += xtsonic.o
|
||||
|
||||
|
|
|
@ -143,6 +143,22 @@ out:
|
|||
}
|
||||
#endif
|
||||
|
||||
static const struct net_device_ops ac_netdev_ops = {
|
||||
.ndo_open = ac_open,
|
||||
.ndo_stop = ac_close_card,
|
||||
|
||||
.ndo_start_xmit = ei_start_xmit,
|
||||
.ndo_tx_timeout = ei_tx_timeout,
|
||||
.ndo_get_stats = ei_get_stats,
|
||||
.ndo_set_multicast_list = ei_set_multicast_list,
|
||||
.ndo_validate_addr = eth_validate_addr,
|
||||
.ndo_set_mac_address = eth_mac_addr,
|
||||
.ndo_change_mtu = eth_change_mtu,
|
||||
#ifdef CONFIG_NET_POLL_CONTROLLER
|
||||
.ndo_poll_controller = ei_poll,
|
||||
#endif
|
||||
};
|
||||
|
||||
static int __init ac_probe1(int ioaddr, struct net_device *dev)
|
||||
{
|
||||
int i, retval;
|
||||
|
@ -253,11 +269,7 @@ static int __init ac_probe1(int ioaddr, struct net_device *dev)
|
|||
ei_status.block_output = &ac_block_output;
|
||||
ei_status.get_8390_hdr = &ac_get_8390_hdr;
|
||||
|
||||
dev->open = &ac_open;
|
||||
dev->stop = &ac_close_card;
|
||||
#ifdef CONFIG_NET_POLL_CONTROLLER
|
||||
dev->poll_controller = ei_poll;
|
||||
#endif
|
||||
dev->netdev_ops = &ac_netdev_ops;
|
||||
NS8390_init(dev, 0);
|
||||
|
||||
retval = register_netdev(dev);
|
||||
|
|
|
@ -171,7 +171,6 @@ static unsigned int cops_debug = COPS_DEBUG;
|
|||
|
||||
struct cops_local
|
||||
{
|
||||
struct net_device_stats stats;
|
||||
int board; /* Holds what board type is. */
|
||||
int nodeid; /* Set to 1 once have nodeid. */
|
||||
unsigned char node_acquire; /* Node ID when acquired. */
|
||||
|
@ -197,7 +196,6 @@ static int cops_send_packet (struct sk_buff *skb, struct net_device *dev);
|
|||
static void set_multicast_list (struct net_device *dev);
|
||||
static int cops_ioctl (struct net_device *dev, struct ifreq *rq, int cmd);
|
||||
static int cops_close (struct net_device *dev);
|
||||
static struct net_device_stats *cops_get_stats (struct net_device *dev);
|
||||
|
||||
static void cleanup_card(struct net_device *dev)
|
||||
{
|
||||
|
@ -260,6 +258,15 @@ out:
|
|||
return ERR_PTR(err);
|
||||
}
|
||||
|
||||
static const struct net_device_ops cops_netdev_ops = {
|
||||
.ndo_open = cops_open,
|
||||
.ndo_stop = cops_close,
|
||||
.ndo_start_xmit = cops_send_packet,
|
||||
.ndo_tx_timeout = cops_timeout,
|
||||
.ndo_do_ioctl = cops_ioctl,
|
||||
.ndo_set_multicast_list = set_multicast_list,
|
||||
};
|
||||
|
||||
/*
|
||||
* This is the real probe routine. Linux has a history of friendly device
|
||||
* probes on the ISA bus. A good device probes avoids doing writes, and
|
||||
|
@ -333,16 +340,9 @@ static int __init cops_probe1(struct net_device *dev, int ioaddr)
|
|||
/* Copy local board variable to lp struct. */
|
||||
lp->board = board;
|
||||
|
||||
dev->hard_start_xmit = cops_send_packet;
|
||||
dev->tx_timeout = cops_timeout;
|
||||
dev->netdev_ops = &cops_netdev_ops;
|
||||
dev->watchdog_timeo = HZ * 2;
|
||||
|
||||
dev->get_stats = cops_get_stats;
|
||||
dev->open = cops_open;
|
||||
dev->stop = cops_close;
|
||||
dev->do_ioctl = cops_ioctl;
|
||||
dev->set_multicast_list = set_multicast_list;
|
||||
dev->mc_list = NULL;
|
||||
|
||||
/* Tell the user where the card is and what mode we're in. */
|
||||
if(board==DAYNA)
|
||||
|
@ -797,7 +797,7 @@ static void cops_rx(struct net_device *dev)
|
|||
{
|
||||
printk(KERN_WARNING "%s: Memory squeeze, dropping packet.\n",
|
||||
dev->name);
|
||||
lp->stats.rx_dropped++;
|
||||
dev->stats.rx_dropped++;
|
||||
while(pkt_len--) /* Discard packet */
|
||||
inb(ioaddr);
|
||||
spin_unlock_irqrestore(&lp->lock, flags);
|
||||
|
@ -819,7 +819,7 @@ static void cops_rx(struct net_device *dev)
|
|||
{
|
||||
printk(KERN_WARNING "%s: Bad packet length of %d bytes.\n",
|
||||
dev->name, pkt_len);
|
||||
lp->stats.tx_errors++;
|
||||
dev->stats.tx_errors++;
|
||||
dev_kfree_skb_any(skb);
|
||||
return;
|
||||
}
|
||||
|
@ -836,7 +836,7 @@ static void cops_rx(struct net_device *dev)
|
|||
if(rsp_type != LAP_RESPONSE)
|
||||
{
|
||||
printk(KERN_WARNING "%s: Bad packet type %d.\n", dev->name, rsp_type);
|
||||
lp->stats.tx_errors++;
|
||||
dev->stats.tx_errors++;
|
||||
dev_kfree_skb_any(skb);
|
||||
return;
|
||||
}
|
||||
|
@ -846,8 +846,8 @@ static void cops_rx(struct net_device *dev)
|
|||
skb_reset_transport_header(skb); /* Point to data (Skip header). */
|
||||
|
||||
/* Update the counters. */
|
||||
lp->stats.rx_packets++;
|
||||
lp->stats.rx_bytes += skb->len;
|
||||
dev->stats.rx_packets++;
|
||||
dev->stats.rx_bytes += skb->len;
|
||||
|
||||
/* Send packet to a higher place. */
|
||||
netif_rx(skb);
|
||||
|
@ -858,7 +858,7 @@ static void cops_timeout(struct net_device *dev)
|
|||
struct cops_local *lp = netdev_priv(dev);
|
||||
int ioaddr = dev->base_addr;
|
||||
|
||||
lp->stats.tx_errors++;
|
||||
dev->stats.tx_errors++;
|
||||
if(lp->board==TANGENT)
|
||||
{
|
||||
if((inb(ioaddr+TANG_CARD_STATUS)&TANG_TX_READY)==0)
|
||||
|
@ -916,8 +916,8 @@ static int cops_send_packet(struct sk_buff *skb, struct net_device *dev)
|
|||
spin_unlock_irqrestore(&lp->lock, flags); /* Restore interrupts. */
|
||||
|
||||
/* Done sending packet, update counters and cleanup. */
|
||||
lp->stats.tx_packets++;
|
||||
lp->stats.tx_bytes += skb->len;
|
||||
dev->stats.tx_packets++;
|
||||
dev->stats.tx_bytes += skb->len;
|
||||
dev->trans_start = jiffies;
|
||||
dev_kfree_skb (skb);
|
||||
return 0;
|
||||
|
@ -986,15 +986,6 @@ static int cops_close(struct net_device *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the current statistics.
|
||||
* This may be called with the card open or closed.
|
||||
*/
|
||||
static struct net_device_stats *cops_get_stats(struct net_device *dev)
|
||||
{
|
||||
struct cops_local *lp = netdev_priv(dev);
|
||||
return &lp->stats;
|
||||
}
|
||||
|
||||
#ifdef MODULE
|
||||
static struct net_device *cops_dev;
|
||||
|
|
|
@ -261,7 +261,6 @@ static unsigned char *ltdmacbuf;
|
|||
|
||||
struct ltpc_private
|
||||
{
|
||||
struct net_device_stats stats;
|
||||
struct atalk_addr my_addr;
|
||||
};
|
||||
|
||||
|
@ -699,7 +698,6 @@ static int do_read(struct net_device *dev, void *cbuf, int cbuflen,
|
|||
static struct timer_list ltpc_timer;
|
||||
|
||||
static int ltpc_xmit(struct sk_buff *skb, struct net_device *dev);
|
||||
static struct net_device_stats *ltpc_get_stats(struct net_device *dev);
|
||||
|
||||
static int read_30 ( struct net_device *dev)
|
||||
{
|
||||
|
@ -726,8 +724,6 @@ static int sendup_buffer (struct net_device *dev)
|
|||
int dnode, snode, llaptype, len;
|
||||
int sklen;
|
||||
struct sk_buff *skb;
|
||||
struct ltpc_private *ltpc_priv = netdev_priv(dev);
|
||||
struct net_device_stats *stats = <pc_priv->stats;
|
||||
struct lt_rcvlap *ltc = (struct lt_rcvlap *) ltdmacbuf;
|
||||
|
||||
if (ltc->command != LT_RCVLAP) {
|
||||
|
@ -779,8 +775,8 @@ static int sendup_buffer (struct net_device *dev)
|
|||
|
||||
skb_reset_transport_header(skb);
|
||||
|
||||
stats->rx_packets++;
|
||||
stats->rx_bytes+=skb->len;
|
||||
dev->stats.rx_packets++;
|
||||
dev->stats.rx_bytes += skb->len;
|
||||
|
||||
/* toss it onwards */
|
||||
netif_rx(skb);
|
||||
|
@ -904,10 +900,6 @@ static int ltpc_xmit(struct sk_buff *skb, struct net_device *dev)
|
|||
/* in kernel 1.3.xx, on entry skb->data points to ddp header,
|
||||
* and skb->len is the length of the ddp data + ddp header
|
||||
*/
|
||||
|
||||
struct ltpc_private *ltpc_priv = netdev_priv(dev);
|
||||
struct net_device_stats *stats = <pc_priv->stats;
|
||||
|
||||
int i;
|
||||
struct lt_sendlap cbuf;
|
||||
unsigned char *hdr;
|
||||
|
@ -936,20 +928,13 @@ static int ltpc_xmit(struct sk_buff *skb, struct net_device *dev)
|
|||
printk("\n");
|
||||
}
|
||||
|
||||
stats->tx_packets++;
|
||||
stats->tx_bytes+=skb->len;
|
||||
dev->stats.tx_packets++;
|
||||
dev->stats.tx_bytes += skb->len;
|
||||
|
||||
dev_kfree_skb(skb);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct net_device_stats *ltpc_get_stats(struct net_device *dev)
|
||||
{
|
||||
struct ltpc_private *ltpc_priv = netdev_priv(dev);
|
||||
struct net_device_stats *stats = <pc_priv->stats;
|
||||
return stats;
|
||||
}
|
||||
|
||||
/* initialization stuff */
|
||||
|
||||
static int __init ltpc_probe_dma(int base, int dma)
|
||||
|
@ -1027,6 +1012,12 @@ static int __init ltpc_probe_dma(int base, int dma)
|
|||
return (want & 2) ? 3 : 1;
|
||||
}
|
||||
|
||||
static const struct net_device_ops ltpc_netdev = {
|
||||
.ndo_start_xmit = ltpc_xmit,
|
||||
.ndo_do_ioctl = ltpc_ioctl,
|
||||
.ndo_set_multicast_list = set_multicast_list,
|
||||
};
|
||||
|
||||
struct net_device * __init ltpc_probe(void)
|
||||
{
|
||||
struct net_device *dev;
|
||||
|
@ -1133,14 +1124,7 @@ struct net_device * __init ltpc_probe(void)
|
|||
else
|
||||
printk(KERN_INFO "Apple/Farallon LocalTalk-PC card at %03x, DMA%d. Using polled mode.\n",io,dma);
|
||||
|
||||
/* Fill in the fields of the device structure with ethernet-generic values. */
|
||||
dev->hard_start_xmit = ltpc_xmit;
|
||||
dev->get_stats = ltpc_get_stats;
|
||||
|
||||
/* add the ltpc-specific things */
|
||||
dev->do_ioctl = <pc_ioctl;
|
||||
|
||||
dev->set_multicast_list = &set_multicast_list;
|
||||
dev->netdev_ops = <pc_netdev;
|
||||
dev->mc_list = NULL;
|
||||
dev->base_addr = io;
|
||||
dev->irq = irq;
|
||||
|
|
|
@ -249,6 +249,17 @@ out:
|
|||
return ERR_PTR(err);
|
||||
}
|
||||
|
||||
static const struct net_device_ops at1700_netdev_ops = {
|
||||
.ndo_open = net_open,
|
||||
.ndo_stop = net_close,
|
||||
.ndo_start_xmit = net_send_packet,
|
||||
.ndo_set_multicast_list = set_rx_mode,
|
||||
.ndo_tx_timeout = net_tx_timeout,
|
||||
.ndo_change_mtu = eth_change_mtu,
|
||||
.ndo_set_mac_address = eth_mac_addr,
|
||||
.ndo_validate_addr = eth_validate_addr,
|
||||
};
|
||||
|
||||
/* The Fujitsu datasheet suggests that the NIC be probed for by checking its
|
||||
"signature", the default bit pattern after a reset. This *doesn't* work --
|
||||
there is no way to reset the bus interface without a complete power-cycle!
|
||||
|
@ -448,13 +459,7 @@ found:
|
|||
if (net_debug)
|
||||
printk(version);
|
||||
|
||||
memset(lp, 0, sizeof(struct net_local));
|
||||
|
||||
dev->open = net_open;
|
||||
dev->stop = net_close;
|
||||
dev->hard_start_xmit = net_send_packet;
|
||||
dev->set_multicast_list = &set_rx_mode;
|
||||
dev->tx_timeout = net_tx_timeout;
|
||||
dev->netdev_ops = &at1700_netdev_ops;
|
||||
dev->watchdog_timeo = TX_TIMEOUT;
|
||||
|
||||
spin_lock_init(&lp->lock);
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
*/
|
||||
|
||||
#include "be.h"
|
||||
#include <asm/div64.h>
|
||||
|
||||
MODULE_VERSION(DRV_VER);
|
||||
MODULE_DEVICE_TABLE(pci, be_dev_ids);
|
||||
|
@ -290,6 +291,17 @@ static struct net_device_stats *be_get_stats(struct net_device *dev)
|
|||
return &adapter->stats.net_stats;
|
||||
}
|
||||
|
||||
static u32 be_calc_rate(u64 bytes, unsigned long ticks)
|
||||
{
|
||||
u64 rate = bytes;
|
||||
|
||||
do_div(rate, ticks / HZ);
|
||||
rate <<= 3; /* bytes/sec -> bits/sec */
|
||||
do_div(rate, 1000000ul); /* MB/Sec */
|
||||
|
||||
return rate;
|
||||
}
|
||||
|
||||
static void be_tx_rate_update(struct be_adapter *adapter)
|
||||
{
|
||||
struct be_drvr_stats *stats = drvr_stats(adapter);
|
||||
|
@ -303,11 +315,9 @@ static void be_tx_rate_update(struct be_adapter *adapter)
|
|||
|
||||
/* Update tx rate once in two seconds */
|
||||
if ((now - stats->be_tx_jiffies) > 2 * HZ) {
|
||||
u32 r;
|
||||
r = (stats->be_tx_bytes - stats->be_tx_bytes_prev) /
|
||||
((now - stats->be_tx_jiffies) / HZ);
|
||||
r = r / 1000000; /* M bytes/s */
|
||||
stats->be_tx_rate = r * 8; /* M bits/s */
|
||||
stats->be_tx_rate = be_calc_rate(stats->be_tx_bytes
|
||||
- stats->be_tx_bytes_prev,
|
||||
now - stats->be_tx_jiffies);
|
||||
stats->be_tx_jiffies = now;
|
||||
stats->be_tx_bytes_prev = stats->be_tx_bytes;
|
||||
}
|
||||
|
@ -599,7 +609,6 @@ static void be_rx_rate_update(struct be_adapter *adapter)
|
|||
{
|
||||
struct be_drvr_stats *stats = drvr_stats(adapter);
|
||||
ulong now = jiffies;
|
||||
u32 rate;
|
||||
|
||||
/* Wrapped around */
|
||||
if (time_before(now, stats->be_rx_jiffies)) {
|
||||
|
@ -611,10 +620,9 @@ static void be_rx_rate_update(struct be_adapter *adapter)
|
|||
if ((now - stats->be_rx_jiffies) < 2 * HZ)
|
||||
return;
|
||||
|
||||
rate = (stats->be_rx_bytes - stats->be_rx_bytes_prev) /
|
||||
((now - stats->be_rx_jiffies) / HZ);
|
||||
rate = rate / 1000000; /* MB/Sec */
|
||||
stats->be_rx_rate = rate * 8; /* Mega Bits/Sec */
|
||||
stats->be_rx_rate = be_calc_rate(stats->be_rx_bytes
|
||||
- stats->be_rx_bytes_prev,
|
||||
now - stats->be_rx_jiffies);
|
||||
stats->be_rx_jiffies = now;
|
||||
stats->be_rx_bytes_prev = stats->be_rx_bytes;
|
||||
}
|
||||
|
|
|
@ -501,6 +501,21 @@ static void net_poll_controller(struct net_device *dev)
|
|||
}
|
||||
#endif
|
||||
|
||||
static const struct net_device_ops net_ops = {
|
||||
.ndo_open = net_open,
|
||||
.ndo_stop = net_close,
|
||||
.ndo_tx_timeout = net_timeout,
|
||||
.ndo_start_xmit = net_send_packet,
|
||||
.ndo_get_stats = net_get_stats,
|
||||
.ndo_set_multicast_list = set_multicast_list,
|
||||
.ndo_set_mac_address = set_mac_address,
|
||||
#ifdef CONFIG_NET_POLL_CONTROLLER
|
||||
.ndo_poll_controller = net_poll_controller,
|
||||
#endif
|
||||
.ndo_change_mtu = eth_change_mtu,
|
||||
.ndo_validate_addr = eth_validate_addr,
|
||||
};
|
||||
|
||||
/* This is the real probe routine. Linux has a history of friendly device
|
||||
probes on the ISA bus. A good device probes avoids doing writes, and
|
||||
verifies that the correct device exists and functions.
|
||||
|
@ -843,17 +858,8 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular)
|
|||
/* print the ethernet address. */
|
||||
printk(", MAC %pM", dev->dev_addr);
|
||||
|
||||
dev->open = net_open;
|
||||
dev->stop = net_close;
|
||||
dev->tx_timeout = net_timeout;
|
||||
dev->netdev_ops = &net_ops;
|
||||
dev->watchdog_timeo = HZ;
|
||||
dev->hard_start_xmit = net_send_packet;
|
||||
dev->get_stats = net_get_stats;
|
||||
dev->set_multicast_list = set_multicast_list;
|
||||
dev->set_mac_address = set_mac_address;
|
||||
#ifdef CONFIG_NET_POLL_CONTROLLER
|
||||
dev->poll_controller = net_poll_controller;
|
||||
#endif
|
||||
|
||||
printk("\n");
|
||||
if (net_debug)
|
||||
|
|
|
@ -85,6 +85,8 @@ struct fl_pg_chunk {
|
|||
struct page *page;
|
||||
void *va;
|
||||
unsigned int offset;
|
||||
u64 *p_cnt;
|
||||
DECLARE_PCI_UNMAP_ADDR(mapping);
|
||||
};
|
||||
|
||||
struct rx_desc;
|
||||
|
@ -101,6 +103,7 @@ struct sge_fl { /* SGE per free-buffer list state */
|
|||
struct fl_pg_chunk pg_chunk;/* page chunk cache */
|
||||
unsigned int use_pages; /* whether FL uses pages or sk_buffs */
|
||||
unsigned int order; /* order of page allocations */
|
||||
unsigned int alloc_size; /* size of allocated buffer */
|
||||
struct rx_desc *desc; /* address of HW Rx descriptor ring */
|
||||
struct rx_sw_desc *sdesc; /* address of SW Rx descriptor ring */
|
||||
dma_addr_t phys_addr; /* physical address of HW ring start */
|
||||
|
@ -291,6 +294,7 @@ void t3_os_link_fault_handler(struct adapter *adapter, int port_id);
|
|||
|
||||
void t3_sge_start(struct adapter *adap);
|
||||
void t3_sge_stop(struct adapter *adap);
|
||||
void t3_start_sge_timers(struct adapter *adap);
|
||||
void t3_stop_sge_timers(struct adapter *adap);
|
||||
void t3_free_sge_resources(struct adapter *adap);
|
||||
void t3_sge_err_intr_handler(struct adapter *adapter);
|
||||
|
|
|
@ -191,7 +191,8 @@ struct mdio_ops {
|
|||
};
|
||||
|
||||
struct adapter_info {
|
||||
unsigned char nports; /* # of ports */
|
||||
unsigned char nports0; /* # of ports on channel 0 */
|
||||
unsigned char nports1; /* # of ports on channel 1 */
|
||||
unsigned char phy_base_addr; /* MDIO PHY base address */
|
||||
unsigned int gpio_out; /* GPIO output settings */
|
||||
unsigned char gpio_intr[MAX_NPORTS]; /* GPIO PHY IRQ pins */
|
||||
|
@ -422,6 +423,7 @@ struct adapter_params {
|
|||
unsigned short b_wnd[NCCTRL_WIN];
|
||||
|
||||
unsigned int nports; /* # of ethernet ports */
|
||||
unsigned int chan_map; /* bitmap of in-use Tx channels */
|
||||
unsigned int stats_update_period; /* MAC stats accumulation period */
|
||||
unsigned int linkpoll_period; /* link poll period in 0.1s */
|
||||
unsigned int rev; /* chip revision */
|
||||
|
|
|
@ -602,7 +602,6 @@ static int setup_sge_qsets(struct adapter *adap)
|
|||
&adap->params.sge.qset[qset_idx], ntxq, dev,
|
||||
netdev_get_tx_queue(dev, j));
|
||||
if (err) {
|
||||
t3_stop_sge_timers(adap);
|
||||
t3_free_sge_resources(adap);
|
||||
return err;
|
||||
}
|
||||
|
@ -1046,6 +1045,8 @@ static int cxgb_up(struct adapter *adap)
|
|||
setup_rss(adap);
|
||||
if (!(adap->flags & NAPI_INIT))
|
||||
init_napi(adap);
|
||||
|
||||
t3_start_sge_timers(adap);
|
||||
adap->flags |= FULL_INIT_DONE;
|
||||
}
|
||||
|
||||
|
@ -2870,6 +2871,9 @@ static void t3_io_resume(struct pci_dev *pdev)
|
|||
{
|
||||
struct adapter *adapter = pci_get_drvdata(pdev);
|
||||
|
||||
CH_ALERT(adapter, "adapter recovering, PEX ERR 0x%x\n",
|
||||
t3_read_reg(adapter, A_PCIE_PEX_ERR));
|
||||
|
||||
t3_resume_ports(adapter);
|
||||
}
|
||||
|
||||
|
@ -3002,7 +3006,7 @@ static int __devinit init_one(struct pci_dev *pdev,
|
|||
static int version_printed;
|
||||
|
||||
int i, err, pci_using_dac = 0;
|
||||
unsigned long mmio_start, mmio_len;
|
||||
resource_size_t mmio_start, mmio_len;
|
||||
const struct adapter_info *ai;
|
||||
struct adapter *adapter = NULL;
|
||||
struct port_info *pi;
|
||||
|
@ -3082,7 +3086,7 @@ static int __devinit init_one(struct pci_dev *pdev,
|
|||
INIT_WORK(&adapter->fatal_error_handler_task, fatal_error_task);
|
||||
INIT_DELAYED_WORK(&adapter->adap_check_task, t3_adap_check_task);
|
||||
|
||||
for (i = 0; i < ai->nports; ++i) {
|
||||
for (i = 0; i < ai->nports0 + ai->nports1; ++i) {
|
||||
struct net_device *netdev;
|
||||
|
||||
netdev = alloc_etherdev_mq(sizeof(struct port_info), SGE_QSETS);
|
||||
|
@ -3172,7 +3176,7 @@ static int __devinit init_one(struct pci_dev *pdev,
|
|||
|
||||
out_free_dev:
|
||||
iounmap(adapter->regs);
|
||||
for (i = ai->nports - 1; i >= 0; --i)
|
||||
for (i = ai->nports0 + ai->nports1 - 1; i >= 0; --i)
|
||||
if (adapter->port[i])
|
||||
free_netdev(adapter->port[i]);
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
#define SGE_RX_COPY_THRES 256
|
||||
#define SGE_RX_PULL_LEN 128
|
||||
|
||||
#define SGE_PG_RSVD SMP_CACHE_BYTES
|
||||
/*
|
||||
* Page chunk size for FL0 buffers if FL0 is to be populated with page chunks.
|
||||
* It must be a divisor of PAGE_SIZE. If set to 0 FL0 will use sk_buffs
|
||||
|
@ -57,8 +58,10 @@
|
|||
*/
|
||||
#define FL0_PG_CHUNK_SIZE 2048
|
||||
#define FL0_PG_ORDER 0
|
||||
#define FL0_PG_ALLOC_SIZE (PAGE_SIZE << FL0_PG_ORDER)
|
||||
#define FL1_PG_CHUNK_SIZE (PAGE_SIZE > 8192 ? 16384 : 8192)
|
||||
#define FL1_PG_ORDER (PAGE_SIZE > 8192 ? 0 : 1)
|
||||
#define FL1_PG_ALLOC_SIZE (PAGE_SIZE << FL1_PG_ORDER)
|
||||
|
||||
#define SGE_RX_DROP_THRES 16
|
||||
#define RX_RECLAIM_PERIOD (HZ/4)
|
||||
|
@ -345,13 +348,21 @@ static inline int should_restart_tx(const struct sge_txq *q)
|
|||
return q->in_use - r < (q->size >> 1);
|
||||
}
|
||||
|
||||
static void clear_rx_desc(const struct sge_fl *q, struct rx_sw_desc *d)
|
||||
static void clear_rx_desc(struct pci_dev *pdev, const struct sge_fl *q,
|
||||
struct rx_sw_desc *d)
|
||||
{
|
||||
if (q->use_pages) {
|
||||
if (d->pg_chunk.page)
|
||||
if (q->use_pages && d->pg_chunk.page) {
|
||||
(*d->pg_chunk.p_cnt)--;
|
||||
if (!*d->pg_chunk.p_cnt)
|
||||
pci_unmap_page(pdev,
|
||||
pci_unmap_addr(&d->pg_chunk, mapping),
|
||||
q->alloc_size, PCI_DMA_FROMDEVICE);
|
||||
|
||||
put_page(d->pg_chunk.page);
|
||||
d->pg_chunk.page = NULL;
|
||||
} else {
|
||||
pci_unmap_single(pdev, pci_unmap_addr(d, dma_addr),
|
||||
q->buf_size, PCI_DMA_FROMDEVICE);
|
||||
kfree_skb(d->skb);
|
||||
d->skb = NULL;
|
||||
}
|
||||
|
@ -372,9 +383,8 @@ static void free_rx_bufs(struct pci_dev *pdev, struct sge_fl *q)
|
|||
while (q->credits--) {
|
||||
struct rx_sw_desc *d = &q->sdesc[cidx];
|
||||
|
||||
pci_unmap_single(pdev, pci_unmap_addr(d, dma_addr),
|
||||
q->buf_size, PCI_DMA_FROMDEVICE);
|
||||
clear_rx_desc(q, d);
|
||||
|
||||
clear_rx_desc(pdev, q, d);
|
||||
if (++cidx == q->size)
|
||||
cidx = 0;
|
||||
}
|
||||
|
@ -417,18 +427,39 @@ static inline int add_one_rx_buf(void *va, unsigned int len,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int alloc_pg_chunk(struct sge_fl *q, struct rx_sw_desc *sd, gfp_t gfp,
|
||||
static inline int add_one_rx_chunk(dma_addr_t mapping, struct rx_desc *d,
|
||||
unsigned int gen)
|
||||
{
|
||||
d->addr_lo = cpu_to_be32(mapping);
|
||||
d->addr_hi = cpu_to_be32((u64) mapping >> 32);
|
||||
wmb();
|
||||
d->len_gen = cpu_to_be32(V_FLD_GEN1(gen));
|
||||
d->gen2 = cpu_to_be32(V_FLD_GEN2(gen));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int alloc_pg_chunk(struct adapter *adapter, struct sge_fl *q,
|
||||
struct rx_sw_desc *sd, gfp_t gfp,
|
||||
unsigned int order)
|
||||
{
|
||||
if (!q->pg_chunk.page) {
|
||||
dma_addr_t mapping;
|
||||
|
||||
q->pg_chunk.page = alloc_pages(gfp, order);
|
||||
if (unlikely(!q->pg_chunk.page))
|
||||
return -ENOMEM;
|
||||
q->pg_chunk.va = page_address(q->pg_chunk.page);
|
||||
q->pg_chunk.p_cnt = q->pg_chunk.va + (PAGE_SIZE << order) -
|
||||
SGE_PG_RSVD;
|
||||
q->pg_chunk.offset = 0;
|
||||
mapping = pci_map_page(adapter->pdev, q->pg_chunk.page,
|
||||
0, q->alloc_size, PCI_DMA_FROMDEVICE);
|
||||
pci_unmap_addr_set(&q->pg_chunk, mapping, mapping);
|
||||
}
|
||||
sd->pg_chunk = q->pg_chunk;
|
||||
|
||||
prefetch(sd->pg_chunk.p_cnt);
|
||||
|
||||
q->pg_chunk.offset += q->buf_size;
|
||||
if (q->pg_chunk.offset == (PAGE_SIZE << order))
|
||||
q->pg_chunk.page = NULL;
|
||||
|
@ -436,6 +467,12 @@ static int alloc_pg_chunk(struct sge_fl *q, struct rx_sw_desc *sd, gfp_t gfp,
|
|||
q->pg_chunk.va += q->buf_size;
|
||||
get_page(q->pg_chunk.page);
|
||||
}
|
||||
|
||||
if (sd->pg_chunk.offset == 0)
|
||||
*sd->pg_chunk.p_cnt = 1;
|
||||
else
|
||||
*sd->pg_chunk.p_cnt += 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -460,36 +497,44 @@ static inline void ring_fl_db(struct adapter *adap, struct sge_fl *q)
|
|||
*/
|
||||
static int refill_fl(struct adapter *adap, struct sge_fl *q, int n, gfp_t gfp)
|
||||
{
|
||||
void *buf_start;
|
||||
struct rx_sw_desc *sd = &q->sdesc[q->pidx];
|
||||
struct rx_desc *d = &q->desc[q->pidx];
|
||||
unsigned int count = 0;
|
||||
|
||||
while (n--) {
|
||||
dma_addr_t mapping;
|
||||
int err;
|
||||
|
||||
if (q->use_pages) {
|
||||
if (unlikely(alloc_pg_chunk(q, sd, gfp, q->order))) {
|
||||
if (unlikely(alloc_pg_chunk(adap, q, sd, gfp,
|
||||
q->order))) {
|
||||
nomem: q->alloc_failed++;
|
||||
break;
|
||||
}
|
||||
buf_start = sd->pg_chunk.va;
|
||||
} else {
|
||||
struct sk_buff *skb = alloc_skb(q->buf_size, gfp);
|
||||
mapping = pci_unmap_addr(&sd->pg_chunk, mapping) +
|
||||
sd->pg_chunk.offset;
|
||||
pci_unmap_addr_set(sd, dma_addr, mapping);
|
||||
|
||||
add_one_rx_chunk(mapping, d, q->gen);
|
||||
pci_dma_sync_single_for_device(adap->pdev, mapping,
|
||||
q->buf_size - SGE_PG_RSVD,
|
||||
PCI_DMA_FROMDEVICE);
|
||||
} else {
|
||||
void *buf_start;
|
||||
|
||||
struct sk_buff *skb = alloc_skb(q->buf_size, gfp);
|
||||
if (!skb)
|
||||
goto nomem;
|
||||
|
||||
sd->skb = skb;
|
||||
buf_start = skb->data;
|
||||
}
|
||||
|
||||
err = add_one_rx_buf(buf_start, q->buf_size, d, sd, q->gen,
|
||||
adap->pdev);
|
||||
err = add_one_rx_buf(buf_start, q->buf_size, d, sd,
|
||||
q->gen, adap->pdev);
|
||||
if (unlikely(err)) {
|
||||
clear_rx_desc(q, sd);
|
||||
clear_rx_desc(adap->pdev, q, sd);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
d++;
|
||||
sd++;
|
||||
|
@ -795,18 +840,18 @@ static struct sk_buff *get_packet_pg(struct adapter *adap, struct sge_fl *fl,
|
|||
struct sk_buff *newskb, *skb;
|
||||
struct rx_sw_desc *sd = &fl->sdesc[fl->cidx];
|
||||
|
||||
newskb = skb = q->pg_skb;
|
||||
dma_addr_t dma_addr = pci_unmap_addr(sd, dma_addr);
|
||||
|
||||
newskb = skb = q->pg_skb;
|
||||
if (!skb && (len <= SGE_RX_COPY_THRES)) {
|
||||
newskb = alloc_skb(len, GFP_ATOMIC);
|
||||
if (likely(newskb != NULL)) {
|
||||
__skb_put(newskb, len);
|
||||
pci_dma_sync_single_for_cpu(adap->pdev,
|
||||
pci_unmap_addr(sd, dma_addr), len,
|
||||
pci_dma_sync_single_for_cpu(adap->pdev, dma_addr, len,
|
||||
PCI_DMA_FROMDEVICE);
|
||||
memcpy(newskb->data, sd->pg_chunk.va, len);
|
||||
pci_dma_sync_single_for_device(adap->pdev,
|
||||
pci_unmap_addr(sd, dma_addr), len,
|
||||
pci_dma_sync_single_for_device(adap->pdev, dma_addr,
|
||||
len,
|
||||
PCI_DMA_FROMDEVICE);
|
||||
} else if (!drop_thres)
|
||||
return NULL;
|
||||
|
@ -820,16 +865,25 @@ recycle:
|
|||
if (unlikely(q->rx_recycle_buf || (!skb && fl->credits <= drop_thres)))
|
||||
goto recycle;
|
||||
|
||||
prefetch(sd->pg_chunk.p_cnt);
|
||||
|
||||
if (!skb)
|
||||
newskb = alloc_skb(SGE_RX_PULL_LEN, GFP_ATOMIC);
|
||||
|
||||
if (unlikely(!newskb)) {
|
||||
if (!drop_thres)
|
||||
return NULL;
|
||||
goto recycle;
|
||||
}
|
||||
|
||||
pci_unmap_single(adap->pdev, pci_unmap_addr(sd, dma_addr),
|
||||
fl->buf_size, PCI_DMA_FROMDEVICE);
|
||||
pci_dma_sync_single_for_cpu(adap->pdev, dma_addr, len,
|
||||
PCI_DMA_FROMDEVICE);
|
||||
(*sd->pg_chunk.p_cnt)--;
|
||||
if (!*sd->pg_chunk.p_cnt)
|
||||
pci_unmap_page(adap->pdev,
|
||||
pci_unmap_addr(&sd->pg_chunk, mapping),
|
||||
fl->alloc_size,
|
||||
PCI_DMA_FROMDEVICE);
|
||||
if (!skb) {
|
||||
__skb_put(newskb, SGE_RX_PULL_LEN);
|
||||
memcpy(newskb->data, sd->pg_chunk.va, SGE_RX_PULL_LEN);
|
||||
|
@ -1089,7 +1143,7 @@ static void write_tx_pkt_wr(struct adapter *adap, struct sk_buff *skb,
|
|||
struct tx_desc *d = &q->desc[pidx];
|
||||
struct cpl_tx_pkt *cpl = (struct cpl_tx_pkt *)d;
|
||||
|
||||
cpl->len = htonl(skb->len | 0x80000000);
|
||||
cpl->len = htonl(skb->len);
|
||||
cntrl = V_TXPKT_INTF(pi->port_id);
|
||||
|
||||
if (vlan_tx_tag_present(skb) && pi->vlan_grp)
|
||||
|
@ -1958,8 +2012,8 @@ static void rx_eth(struct adapter *adap, struct sge_rspq *rq,
|
|||
skb_pull(skb, sizeof(*p) + pad);
|
||||
skb->protocol = eth_type_trans(skb, adap->port[p->iff]);
|
||||
pi = netdev_priv(skb->dev);
|
||||
if ((pi->rx_offload & T3_RX_CSUM) && p->csum_valid && p->csum == htons(0xffff) &&
|
||||
!p->fragment) {
|
||||
if ((pi->rx_offload & T3_RX_CSUM) && p->csum_valid &&
|
||||
p->csum == htons(0xffff) && !p->fragment) {
|
||||
qs->port_stats[SGE_PSTAT_RX_CSUM_GOOD]++;
|
||||
skb->ip_summed = CHECKSUM_UNNECESSARY;
|
||||
} else
|
||||
|
@ -2034,10 +2088,19 @@ static void lro_add_page(struct adapter *adap, struct sge_qset *qs,
|
|||
fl->credits--;
|
||||
|
||||
len -= offset;
|
||||
pci_unmap_single(adap->pdev, pci_unmap_addr(sd, dma_addr),
|
||||
fl->buf_size, PCI_DMA_FROMDEVICE);
|
||||
pci_dma_sync_single_for_cpu(adap->pdev,
|
||||
pci_unmap_addr(sd, dma_addr),
|
||||
fl->buf_size - SGE_PG_RSVD,
|
||||
PCI_DMA_FROMDEVICE);
|
||||
|
||||
prefetch(&qs->lro_frag_tbl);
|
||||
(*sd->pg_chunk.p_cnt)--;
|
||||
if (!*sd->pg_chunk.p_cnt)
|
||||
pci_unmap_page(adap->pdev,
|
||||
pci_unmap_addr(&sd->pg_chunk, mapping),
|
||||
fl->alloc_size,
|
||||
PCI_DMA_FROMDEVICE);
|
||||
|
||||
prefetch(qs->lro_va);
|
||||
|
||||
rx_frag += nr_frags;
|
||||
rx_frag->page = sd->pg_chunk.page;
|
||||
|
@ -2047,6 +2110,7 @@ static void lro_add_page(struct adapter *adap, struct sge_qset *qs,
|
|||
qs->lro_frag_tbl.nr_frags++;
|
||||
qs->lro_frag_tbl.len = frag_len;
|
||||
|
||||
|
||||
if (!complete)
|
||||
return;
|
||||
|
||||
|
@ -2236,6 +2300,8 @@ no_mem:
|
|||
if (fl->use_pages) {
|
||||
void *addr = fl->sdesc[fl->cidx].pg_chunk.va;
|
||||
|
||||
prefetch(&qs->lro_frag_tbl);
|
||||
|
||||
prefetch(addr);
|
||||
#if L1_CACHE_BYTES < 128
|
||||
prefetch(addr + L1_CACHE_BYTES);
|
||||
|
@ -2972,21 +3038,23 @@ int t3_sge_alloc_qset(struct adapter *adapter, unsigned int id, int nports,
|
|||
q->fl[1].use_pages = FL1_PG_CHUNK_SIZE > 0;
|
||||
q->fl[0].order = FL0_PG_ORDER;
|
||||
q->fl[1].order = FL1_PG_ORDER;
|
||||
q->fl[0].alloc_size = FL0_PG_ALLOC_SIZE;
|
||||
q->fl[1].alloc_size = FL1_PG_ALLOC_SIZE;
|
||||
|
||||
spin_lock_irq(&adapter->sge.reg_lock);
|
||||
|
||||
/* FL threshold comparison uses < */
|
||||
ret = t3_sge_init_rspcntxt(adapter, q->rspq.cntxt_id, irq_vec_idx,
|
||||
q->rspq.phys_addr, q->rspq.size,
|
||||
q->fl[0].buf_size, 1, 0);
|
||||
q->fl[0].buf_size - SGE_PG_RSVD, 1, 0);
|
||||
if (ret)
|
||||
goto err_unlock;
|
||||
|
||||
for (i = 0; i < SGE_RXQ_PER_SET; ++i) {
|
||||
ret = t3_sge_init_flcntxt(adapter, q->fl[i].cntxt_id, 0,
|
||||
q->fl[i].phys_addr, q->fl[i].size,
|
||||
q->fl[i].buf_size, p->cong_thres, 1,
|
||||
0);
|
||||
q->fl[i].buf_size - SGE_PG_RSVD,
|
||||
p->cong_thres, 1, 0);
|
||||
if (ret)
|
||||
goto err_unlock;
|
||||
}
|
||||
|
@ -3044,9 +3112,6 @@ int t3_sge_alloc_qset(struct adapter *adapter, unsigned int id, int nports,
|
|||
t3_write_reg(adapter, A_SG_GTS, V_RSPQ(q->rspq.cntxt_id) |
|
||||
V_NEWTIMER(q->rspq.holdoff_tmr));
|
||||
|
||||
mod_timer(&q->tx_reclaim_timer, jiffies + TX_RECLAIM_PERIOD);
|
||||
mod_timer(&q->rx_reclaim_timer, jiffies + RX_RECLAIM_PERIOD);
|
||||
|
||||
return 0;
|
||||
|
||||
err_unlock:
|
||||
|
@ -3056,6 +3121,27 @@ err:
|
|||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* t3_start_sge_timers - start SGE timer call backs
|
||||
* @adap: the adapter
|
||||
*
|
||||
* Starts each SGE queue set's timer call back
|
||||
*/
|
||||
void t3_start_sge_timers(struct adapter *adap)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < SGE_QSETS; ++i) {
|
||||
struct sge_qset *q = &adap->sge.qs[i];
|
||||
|
||||
if (q->tx_reclaim_timer.function)
|
||||
mod_timer(&q->tx_reclaim_timer, jiffies + TX_RECLAIM_PERIOD);
|
||||
|
||||
if (q->rx_reclaim_timer.function)
|
||||
mod_timer(&q->rx_reclaim_timer, jiffies + RX_RECLAIM_PERIOD);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* t3_stop_sge_timers - stop SGE timer call backs
|
||||
* @adap: the adapter
|
||||
|
|
|
@ -493,20 +493,20 @@ int t3_phy_lasi_intr_handler(struct cphy *phy)
|
|||
}
|
||||
|
||||
static const struct adapter_info t3_adap_info[] = {
|
||||
{2, 0,
|
||||
{1, 1, 0,
|
||||
F_GPIO2_OEN | F_GPIO4_OEN |
|
||||
F_GPIO2_OUT_VAL | F_GPIO4_OUT_VAL, { S_GPIO3, S_GPIO5 }, 0,
|
||||
&mi1_mdio_ops, "Chelsio PE9000"},
|
||||
{2, 0,
|
||||
{1, 1, 0,
|
||||
F_GPIO2_OEN | F_GPIO4_OEN |
|
||||
F_GPIO2_OUT_VAL | F_GPIO4_OUT_VAL, { S_GPIO3, S_GPIO5 }, 0,
|
||||
&mi1_mdio_ops, "Chelsio T302"},
|
||||
{1, 0,
|
||||
{1, 0, 0,
|
||||
F_GPIO1_OEN | F_GPIO6_OEN | F_GPIO7_OEN | F_GPIO10_OEN |
|
||||
F_GPIO11_OEN | F_GPIO1_OUT_VAL | F_GPIO6_OUT_VAL | F_GPIO10_OUT_VAL,
|
||||
{ 0 }, SUPPORTED_10000baseT_Full | SUPPORTED_AUI,
|
||||
&mi1_mdio_ext_ops, "Chelsio T310"},
|
||||
{2, 0,
|
||||
{1, 1, 0,
|
||||
F_GPIO1_OEN | F_GPIO2_OEN | F_GPIO4_OEN | F_GPIO5_OEN | F_GPIO6_OEN |
|
||||
F_GPIO7_OEN | F_GPIO10_OEN | F_GPIO11_OEN | F_GPIO1_OUT_VAL |
|
||||
F_GPIO5_OUT_VAL | F_GPIO6_OUT_VAL | F_GPIO10_OUT_VAL,
|
||||
|
@ -514,7 +514,7 @@ static const struct adapter_info t3_adap_info[] = {
|
|||
&mi1_mdio_ext_ops, "Chelsio T320"},
|
||||
{},
|
||||
{},
|
||||
{1, 0,
|
||||
{1, 0, 0,
|
||||
F_GPIO1_OEN | F_GPIO2_OEN | F_GPIO4_OEN | F_GPIO6_OEN | F_GPIO7_OEN |
|
||||
F_GPIO10_OEN | F_GPIO1_OUT_VAL | F_GPIO6_OUT_VAL | F_GPIO10_OUT_VAL,
|
||||
{ S_GPIO9 }, SUPPORTED_10000baseT_Full | SUPPORTED_AUI,
|
||||
|
@ -2128,16 +2128,40 @@ void t3_port_intr_clear(struct adapter *adapter, int idx)
|
|||
static int t3_sge_write_context(struct adapter *adapter, unsigned int id,
|
||||
unsigned int type)
|
||||
{
|
||||
if (type == F_RESPONSEQ) {
|
||||
/*
|
||||
* Can't write the Response Queue Context bits for
|
||||
* Interrupt Armed or the Reserve bits after the chip
|
||||
* has been initialized out of reset. Writing to these
|
||||
* bits can confuse the hardware.
|
||||
*/
|
||||
t3_write_reg(adapter, A_SG_CONTEXT_MASK0, 0xffffffff);
|
||||
t3_write_reg(adapter, A_SG_CONTEXT_MASK1, 0xffffffff);
|
||||
t3_write_reg(adapter, A_SG_CONTEXT_MASK2, 0x17ffffff);
|
||||
t3_write_reg(adapter, A_SG_CONTEXT_MASK3, 0xffffffff);
|
||||
} else {
|
||||
t3_write_reg(adapter, A_SG_CONTEXT_MASK0, 0xffffffff);
|
||||
t3_write_reg(adapter, A_SG_CONTEXT_MASK1, 0xffffffff);
|
||||
t3_write_reg(adapter, A_SG_CONTEXT_MASK2, 0xffffffff);
|
||||
t3_write_reg(adapter, A_SG_CONTEXT_MASK3, 0xffffffff);
|
||||
}
|
||||
t3_write_reg(adapter, A_SG_CONTEXT_CMD,
|
||||
V_CONTEXT_CMD_OPCODE(1) | type | V_CONTEXT(id));
|
||||
return t3_wait_op_done(adapter, A_SG_CONTEXT_CMD, F_CONTEXT_CMD_BUSY,
|
||||
0, SG_CONTEXT_CMD_ATTEMPTS, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* clear_sge_ctxt - completely clear an SGE context
|
||||
* @adapter: the adapter
|
||||
* @id: the context id
|
||||
* @type: the context type
|
||||
*
|
||||
* Completely clear an SGE context. Used predominantly at post-reset
|
||||
* initialization. Note in particular that we don't skip writing to any
|
||||
* "sensitive bits" in the contexts the way that t3_sge_write_context()
|
||||
* does ...
|
||||
*/
|
||||
static int clear_sge_ctxt(struct adapter *adap, unsigned int id,
|
||||
unsigned int type)
|
||||
{
|
||||
|
@ -2145,7 +2169,14 @@ static int clear_sge_ctxt(struct adapter *adap, unsigned int id,
|
|||
t3_write_reg(adap, A_SG_CONTEXT_DATA1, 0);
|
||||
t3_write_reg(adap, A_SG_CONTEXT_DATA2, 0);
|
||||
t3_write_reg(adap, A_SG_CONTEXT_DATA3, 0);
|
||||
return t3_sge_write_context(adap, id, type);
|
||||
t3_write_reg(adap, A_SG_CONTEXT_MASK0, 0xffffffff);
|
||||
t3_write_reg(adap, A_SG_CONTEXT_MASK1, 0xffffffff);
|
||||
t3_write_reg(adap, A_SG_CONTEXT_MASK2, 0xffffffff);
|
||||
t3_write_reg(adap, A_SG_CONTEXT_MASK3, 0xffffffff);
|
||||
t3_write_reg(adap, A_SG_CONTEXT_CMD,
|
||||
V_CONTEXT_CMD_OPCODE(1) | type | V_CONTEXT(id));
|
||||
return t3_wait_op_done(adap, A_SG_CONTEXT_CMD, F_CONTEXT_CMD_BUSY,
|
||||
0, SG_CONTEXT_CMD_ATTEMPTS, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2729,10 +2760,10 @@ static void tp_config(struct adapter *adap, const struct tp_params *p)
|
|||
F_TCPCHECKSUMOFFLOAD | V_IPTTL(64));
|
||||
t3_write_reg(adap, A_TP_TCP_OPTIONS, V_MTUDEFAULT(576) |
|
||||
F_MTUENABLE | V_WINDOWSCALEMODE(1) |
|
||||
V_TIMESTAMPSMODE(0) | V_SACKMODE(1) | V_SACKRX(1));
|
||||
V_TIMESTAMPSMODE(1) | V_SACKMODE(1) | V_SACKRX(1));
|
||||
t3_write_reg(adap, A_TP_DACK_CONFIG, V_AUTOSTATE3(1) |
|
||||
V_AUTOSTATE2(1) | V_AUTOSTATE1(0) |
|
||||
V_BYTETHRESHOLD(16384) | V_MSSTHRESHOLD(2) |
|
||||
V_BYTETHRESHOLD(26880) | V_MSSTHRESHOLD(2) |
|
||||
F_AUTOCAREFUL | F_AUTOENABLE | V_DACK_MODE(1));
|
||||
t3_set_reg_field(adap, A_TP_IN_CONFIG, F_RXFBARBPRIO | F_TXFBARBPRIO,
|
||||
F_IPV6ENABLE | F_NICMODE);
|
||||
|
@ -3196,20 +3227,22 @@ int t3_mps_set_active_ports(struct adapter *adap, unsigned int port_mask)
|
|||
}
|
||||
|
||||
/*
|
||||
* Perform the bits of HW initialization that are dependent on the number
|
||||
* of available ports.
|
||||
* Perform the bits of HW initialization that are dependent on the Tx
|
||||
* channels being used.
|
||||
*/
|
||||
static void init_hw_for_avail_ports(struct adapter *adap, int nports)
|
||||
static void chan_init_hw(struct adapter *adap, unsigned int chan_map)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (nports == 1) {
|
||||
if (chan_map != 3) { /* one channel */
|
||||
t3_set_reg_field(adap, A_ULPRX_CTL, F_ROUND_ROBIN, 0);
|
||||
t3_set_reg_field(adap, A_ULPTX_CONFIG, F_CFG_RR_ARB, 0);
|
||||
t3_write_reg(adap, A_MPS_CFG, F_TPRXPORTEN | F_TPTXPORT0EN |
|
||||
F_PORT0ACTIVE | F_ENFORCEPKT);
|
||||
t3_write_reg(adap, A_PM1_TX_CFG, 0xffffffff);
|
||||
} else {
|
||||
t3_write_reg(adap, A_MPS_CFG, F_TPRXPORTEN | F_ENFORCEPKT |
|
||||
(chan_map == 1 ? F_TPTXPORT0EN | F_PORT0ACTIVE :
|
||||
F_TPTXPORT1EN | F_PORT1ACTIVE));
|
||||
t3_write_reg(adap, A_PM1_TX_CFG,
|
||||
chan_map == 1 ? 0xffffffff : 0);
|
||||
} else { /* two channels */
|
||||
t3_set_reg_field(adap, A_ULPRX_CTL, 0, F_ROUND_ROBIN);
|
||||
t3_set_reg_field(adap, A_ULPTX_CONFIG, 0, F_CFG_RR_ARB);
|
||||
t3_write_reg(adap, A_ULPTX_DMA_WEIGHT,
|
||||
|
@ -3517,7 +3550,7 @@ int t3_init_hw(struct adapter *adapter, u32 fw_params)
|
|||
t3_write_reg(adapter, A_PM1_RX_CFG, 0xffffffff);
|
||||
t3_write_reg(adapter, A_PM1_RX_MODE, 0);
|
||||
t3_write_reg(adapter, A_PM1_TX_MODE, 0);
|
||||
init_hw_for_avail_ports(adapter, adapter->params.nports);
|
||||
chan_init_hw(adapter, adapter->params.chan_map);
|
||||
t3_sge_init(adapter, &adapter->params.sge);
|
||||
|
||||
t3_write_reg(adapter, A_T3DBG_GPIO_ACT_LOW, calc_gpio_intr(adapter));
|
||||
|
@ -3754,7 +3787,8 @@ int t3_prep_adapter(struct adapter *adapter, const struct adapter_info *ai,
|
|||
get_pci_mode(adapter, &adapter->params.pci);
|
||||
|
||||
adapter->params.info = ai;
|
||||
adapter->params.nports = ai->nports;
|
||||
adapter->params.nports = ai->nports0 + ai->nports1;
|
||||
adapter->params.chan_map = !!ai->nports0 | (!!ai->nports1 << 1);
|
||||
adapter->params.rev = t3_read_reg(adapter, A_PL_REV);
|
||||
/*
|
||||
* We used to only run the "adapter check task" once a second if
|
||||
|
@ -3785,7 +3819,7 @@ int t3_prep_adapter(struct adapter *adapter, const struct adapter_info *ai,
|
|||
mc7_prep(adapter, &adapter->pmtx, MC7_PMTX_BASE_ADDR, "PMTX");
|
||||
mc7_prep(adapter, &adapter->cm, MC7_CM_BASE_ADDR, "CM");
|
||||
|
||||
p->nchan = ai->nports;
|
||||
p->nchan = adapter->params.chan_map == 3 ? 2 : 1;
|
||||
p->pmrx_size = t3_mc7_size(&adapter->pmrx);
|
||||
p->pmtx_size = t3_mc7_size(&adapter->pmtx);
|
||||
p->cm_size = t3_mc7_size(&adapter->cm);
|
||||
|
|
|
@ -566,6 +566,18 @@ MODULE_LICENSE("GPL");
|
|||
outw(CSR0, DEPCA_ADDR);\
|
||||
outw(STOP, DEPCA_DATA)
|
||||
|
||||
static const struct net_device_ops depca_netdev_ops = {
|
||||
.ndo_open = depca_open,
|
||||
.ndo_start_xmit = depca_start_xmit,
|
||||
.ndo_stop = depca_close,
|
||||
.ndo_set_multicast_list = set_multicast_list,
|
||||
.ndo_do_ioctl = depca_ioctl,
|
||||
.ndo_tx_timeout = depca_tx_timeout,
|
||||
.ndo_change_mtu = eth_change_mtu,
|
||||
.ndo_set_mac_address = eth_mac_addr,
|
||||
.ndo_validate_addr = eth_validate_addr,
|
||||
};
|
||||
|
||||
static int __init depca_hw_init (struct net_device *dev, struct device *device)
|
||||
{
|
||||
struct depca_private *lp;
|
||||
|
@ -793,12 +805,7 @@ static int __init depca_hw_init (struct net_device *dev, struct device *device)
|
|||
}
|
||||
|
||||
/* The DEPCA-specific entries in the device structure. */
|
||||
dev->open = &depca_open;
|
||||
dev->hard_start_xmit = &depca_start_xmit;
|
||||
dev->stop = &depca_close;
|
||||
dev->set_multicast_list = &set_multicast_list;
|
||||
dev->do_ioctl = &depca_ioctl;
|
||||
dev->tx_timeout = depca_tx_timeout;
|
||||
dev->netdev_ops = &depca_netdev_ops;
|
||||
dev->watchdog_timeo = TX_TIMEOUT;
|
||||
|
||||
dev->mem_start = 0;
|
||||
|
|
|
@ -739,6 +739,17 @@ static void __init eepro_print_info (struct net_device *dev)
|
|||
|
||||
static const struct ethtool_ops eepro_ethtool_ops;
|
||||
|
||||
static const struct net_device_ops eepro_netdev_ops = {
|
||||
.ndo_open = eepro_open,
|
||||
.ndo_stop = eepro_close,
|
||||
.ndo_start_xmit = eepro_send_packet,
|
||||
.ndo_set_multicast_list = set_multicast_list,
|
||||
.ndo_tx_timeout = eepro_tx_timeout,
|
||||
.ndo_change_mtu = eth_change_mtu,
|
||||
.ndo_set_mac_address = eth_mac_addr,
|
||||
.ndo_validate_addr = eth_validate_addr,
|
||||
};
|
||||
|
||||
/* This is the real probe routine. Linux has a history of friendly device
|
||||
probes on the ISA bus. A good device probe avoids doing writes, and
|
||||
verifies that the correct device exists and functions. */
|
||||
|
@ -851,11 +862,7 @@ static int __init eepro_probe1(struct net_device *dev, int autoprobe)
|
|||
}
|
||||
}
|
||||
|
||||
dev->open = eepro_open;
|
||||
dev->stop = eepro_close;
|
||||
dev->hard_start_xmit = eepro_send_packet;
|
||||
dev->set_multicast_list = &set_multicast_list;
|
||||
dev->tx_timeout = eepro_tx_timeout;
|
||||
dev->netdev_ops = &eepro_netdev_ops;
|
||||
dev->watchdog_timeo = TX_TIMEOUT;
|
||||
dev->ethtool_ops = &eepro_ethtool_ops;
|
||||
|
||||
|
|
|
@ -1043,6 +1043,17 @@ static void eexp_hw_tx_pio(struct net_device *dev, unsigned short *buf,
|
|||
lp->last_tx = jiffies;
|
||||
}
|
||||
|
||||
static const struct net_device_ops eexp_netdev_ops = {
|
||||
.ndo_open = eexp_open,
|
||||
.ndo_stop = eexp_close,
|
||||
.ndo_start_xmit = eexp_xmit,
|
||||
.ndo_set_multicast_list = eexp_set_multicast,
|
||||
.ndo_tx_timeout = eexp_timeout,
|
||||
.ndo_change_mtu = eth_change_mtu,
|
||||
.ndo_set_mac_address = eth_mac_addr,
|
||||
.ndo_validate_addr = eth_validate_addr,
|
||||
};
|
||||
|
||||
/*
|
||||
* Sanity check the suspected EtherExpress card
|
||||
* Read hardware address, reset card, size memory and initialize buffer
|
||||
|
@ -1163,11 +1174,7 @@ static int __init eexp_hw_probe(struct net_device *dev, unsigned short ioaddr)
|
|||
lp->rx_buf_start = TX_BUF_START + (lp->num_tx_bufs*TX_BUF_SIZE);
|
||||
lp->width = buswidth;
|
||||
|
||||
dev->open = eexp_open;
|
||||
dev->stop = eexp_close;
|
||||
dev->hard_start_xmit = eexp_xmit;
|
||||
dev->set_multicast_list = &eexp_set_multicast;
|
||||
dev->tx_timeout = eexp_timeout;
|
||||
dev->netdev_ops = &eexp_netdev_ops;
|
||||
dev->watchdog_timeo = 2*HZ;
|
||||
|
||||
return register_netdev(dev);
|
||||
|
|
|
@ -475,6 +475,17 @@ out:
|
|||
}
|
||||
#endif
|
||||
|
||||
static const struct net_device_ops eth16i_netdev_ops = {
|
||||
.ndo_open = eth16i_open,
|
||||
.ndo_stop = eth16i_close,
|
||||
.ndo_start_xmit = eth16i_tx,
|
||||
.ndo_set_multicast_list = eth16i_multicast,
|
||||
.ndo_tx_timeout = eth16i_timeout,
|
||||
.ndo_change_mtu = eth_change_mtu,
|
||||
.ndo_set_mac_address = eth_mac_addr,
|
||||
.ndo_validate_addr = eth_validate_addr,
|
||||
};
|
||||
|
||||
static int __init eth16i_probe1(struct net_device *dev, int ioaddr)
|
||||
{
|
||||
struct eth16i_local *lp = netdev_priv(dev);
|
||||
|
@ -549,12 +560,7 @@ static int __init eth16i_probe1(struct net_device *dev, int ioaddr)
|
|||
BITCLR(ioaddr + CONFIG_REG_1, POWERUP);
|
||||
|
||||
/* Initialize the device structure */
|
||||
memset(lp, 0, sizeof(struct eth16i_local));
|
||||
dev->open = eth16i_open;
|
||||
dev->stop = eth16i_close;
|
||||
dev->hard_start_xmit = eth16i_tx;
|
||||
dev->set_multicast_list = eth16i_multicast;
|
||||
dev->tx_timeout = eth16i_timeout;
|
||||
dev->netdev_ops = ð16i_netdev_ops;
|
||||
dev->watchdog_timeo = TX_TIMEOUT;
|
||||
spin_lock_init(&lp->lock);
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -388,6 +388,18 @@ static int __init ewrk3_probe1(struct net_device *dev, u_long iobase, int irq)
|
|||
return err;
|
||||
}
|
||||
|
||||
static const struct net_device_ops ewrk3_netdev_ops = {
|
||||
.ndo_open = ewrk3_open,
|
||||
.ndo_start_xmit = ewrk3_queue_pkt,
|
||||
.ndo_stop = ewrk3_close,
|
||||
.ndo_set_multicast_list = set_multicast_list,
|
||||
.ndo_do_ioctl = ewrk3_ioctl,
|
||||
.ndo_tx_timeout = ewrk3_timeout,
|
||||
.ndo_change_mtu = eth_change_mtu,
|
||||
.ndo_set_mac_address = eth_mac_addr,
|
||||
.ndo_validate_addr = eth_validate_addr,
|
||||
};
|
||||
|
||||
static int __init
|
||||
ewrk3_hw_init(struct net_device *dev, u_long iobase)
|
||||
{
|
||||
|
@ -603,16 +615,11 @@ ewrk3_hw_init(struct net_device *dev, u_long iobase)
|
|||
printk(version);
|
||||
}
|
||||
/* The EWRK3-specific entries in the device structure. */
|
||||
dev->open = ewrk3_open;
|
||||
dev->hard_start_xmit = ewrk3_queue_pkt;
|
||||
dev->stop = ewrk3_close;
|
||||
dev->set_multicast_list = set_multicast_list;
|
||||
dev->do_ioctl = ewrk3_ioctl;
|
||||
dev->netdev_ops = &ewrk3_netdev_ops;
|
||||
if (lp->adapter_name[4] == '3')
|
||||
SET_ETHTOOL_OPS(dev, ðtool_ops_203);
|
||||
else
|
||||
SET_ETHTOOL_OPS(dev, ðtool_ops);
|
||||
dev->tx_timeout = ewrk3_timeout;
|
||||
dev->watchdog_timeo = QUEUE_PKT_TIMEOUT;
|
||||
|
||||
dev->mem_start = 0;
|
||||
|
|
|
@ -1239,19 +1239,9 @@ static int gfar_enet_open(struct net_device *dev)
|
|||
return err;
|
||||
}
|
||||
|
||||
static inline struct txfcb *gfar_add_fcb(struct sk_buff **skbp)
|
||||
static inline struct txfcb *gfar_add_fcb(struct sk_buff *skb)
|
||||
{
|
||||
struct txfcb *fcb;
|
||||
struct sk_buff *skb = *skbp;
|
||||
|
||||
if (unlikely(skb_headroom(skb) < GMAC_FCB_LEN)) {
|
||||
struct sk_buff *old_skb = skb;
|
||||
skb = skb_realloc_headroom(old_skb, GMAC_FCB_LEN);
|
||||
if (!skb)
|
||||
return NULL;
|
||||
dev_kfree_skb_any(old_skb);
|
||||
}
|
||||
fcb = (struct txfcb *)skb_push(skb, GMAC_FCB_LEN);
|
||||
struct txfcb *fcb = (struct txfcb *)skb_push(skb, GMAC_FCB_LEN);
|
||||
cacheable_memzero(fcb, GMAC_FCB_LEN);
|
||||
|
||||
return fcb;
|
||||
|
@ -1320,6 +1310,22 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
|||
|
||||
base = priv->tx_bd_base;
|
||||
|
||||
/* make space for additional header when fcb is needed */
|
||||
if (((skb->ip_summed == CHECKSUM_PARTIAL) ||
|
||||
(priv->vlgrp && vlan_tx_tag_present(skb))) &&
|
||||
(skb_headroom(skb) < GMAC_FCB_LEN)) {
|
||||
struct sk_buff *skb_new;
|
||||
|
||||
skb_new = skb_realloc_headroom(skb, GMAC_FCB_LEN);
|
||||
if (!skb_new) {
|
||||
dev->stats.tx_errors++;
|
||||
kfree_skb(skb);
|
||||
return NETDEV_TX_OK;
|
||||
}
|
||||
kfree_skb(skb);
|
||||
skb = skb_new;
|
||||
}
|
||||
|
||||
/* total number of fragments in the SKB */
|
||||
nr_frags = skb_shinfo(skb)->nr_frags;
|
||||
|
||||
|
@ -1372,20 +1378,18 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
|||
|
||||
/* Set up checksumming */
|
||||
if (CHECKSUM_PARTIAL == skb->ip_summed) {
|
||||
fcb = gfar_add_fcb(&skb);
|
||||
if (likely(fcb != NULL)) {
|
||||
fcb = gfar_add_fcb(skb);
|
||||
lstatus |= BD_LFLAG(TXBD_TOE);
|
||||
gfar_tx_checksum(skb, fcb);
|
||||
}
|
||||
}
|
||||
|
||||
if (priv->vlgrp && vlan_tx_tag_present(skb)) {
|
||||
if (unlikely(NULL == fcb))
|
||||
fcb = gfar_add_fcb(&skb);
|
||||
if (likely(fcb != NULL)) {
|
||||
if (unlikely(NULL == fcb)) {
|
||||
fcb = gfar_add_fcb(skb);
|
||||
lstatus |= BD_LFLAG(TXBD_TOE);
|
||||
gfar_tx_vlan(skb, fcb);
|
||||
}
|
||||
|
||||
gfar_tx_vlan(skb, fcb);
|
||||
}
|
||||
|
||||
/* setup the TxBD length and buffer pointer for the first BD */
|
||||
|
@ -1433,7 +1437,7 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
|||
/* Unlock priv */
|
||||
spin_unlock_irqrestore(&priv->txlock, flags);
|
||||
|
||||
return 0;
|
||||
return NETDEV_TX_OK;
|
||||
}
|
||||
|
||||
/* Stops the kernel queue, and halts the controller */
|
||||
|
|
|
@ -905,6 +905,17 @@ static char *ibmlana_adapter_names[] __devinitdata = {
|
|||
NULL
|
||||
};
|
||||
|
||||
|
||||
static const struct net_device_ops ibmlana_netdev_ops = {
|
||||
.ndo_open = ibmlana_open,
|
||||
.ndo_stop = ibmlana_close,
|
||||
.ndo_start_xmit = ibmlana_tx,
|
||||
.ndo_set_multicast_list = ibmlana_set_multicast_list,
|
||||
.ndo_change_mtu = eth_change_mtu,
|
||||
.ndo_set_mac_address = eth_mac_addr,
|
||||
.ndo_validate_addr = eth_validate_addr,
|
||||
};
|
||||
|
||||
static int __devinit ibmlana_init_one(struct device *kdev)
|
||||
{
|
||||
struct mca_device *mdev = to_mca_device(kdev);
|
||||
|
@ -973,11 +984,7 @@ static int __devinit ibmlana_init_one(struct device *kdev)
|
|||
mca_device_set_claim(mdev, 1);
|
||||
|
||||
/* set methods */
|
||||
|
||||
dev->open = ibmlana_open;
|
||||
dev->stop = ibmlana_close;
|
||||
dev->hard_start_xmit = ibmlana_tx;
|
||||
dev->set_multicast_list = ibmlana_set_multicast_list;
|
||||
dev->netdev_ops = &ibmlana_netdev_ops;
|
||||
dev->flags |= IFF_MULTICAST;
|
||||
|
||||
/* copy out MAC address */
|
||||
|
|
|
@ -1524,6 +1524,13 @@ toshoboe_close (struct pci_dev *pci_dev)
|
|||
free_netdev(self->netdev);
|
||||
}
|
||||
|
||||
static const struct net_device_ops toshoboe_netdev_ops = {
|
||||
.ndo_open = toshoboe_net_open,
|
||||
.ndo_stop = toshoboe_net_close,
|
||||
.ndo_start_xmit = toshoboe_hard_xmit,
|
||||
.ndo_do_ioctl = toshoboe_net_ioctl,
|
||||
};
|
||||
|
||||
static int
|
||||
toshoboe_open (struct pci_dev *pci_dev, const struct pci_device_id *pdid)
|
||||
{
|
||||
|
@ -1657,10 +1664,7 @@ toshoboe_open (struct pci_dev *pci_dev, const struct pci_device_id *pdid)
|
|||
#endif
|
||||
|
||||
SET_NETDEV_DEV(dev, &pci_dev->dev);
|
||||
dev->hard_start_xmit = toshoboe_hard_xmit;
|
||||
dev->open = toshoboe_net_open;
|
||||
dev->stop = toshoboe_net_close;
|
||||
dev->do_ioctl = toshoboe_net_ioctl;
|
||||
dev->netdev_ops = &toshoboe_netdev_ops;
|
||||
|
||||
err = register_netdev(dev);
|
||||
if (err)
|
||||
|
|
|
@ -454,6 +454,18 @@ out:
|
|||
}
|
||||
#endif
|
||||
|
||||
static const struct net_device_ops lance_netdev_ops = {
|
||||
.ndo_open = lance_open,
|
||||
.ndo_start_xmit = lance_start_xmit,
|
||||
.ndo_stop = lance_close,
|
||||
.ndo_get_stats = lance_get_stats,
|
||||
.ndo_set_multicast_list = set_multicast_list,
|
||||
.ndo_tx_timeout = lance_tx_timeout,
|
||||
.ndo_change_mtu = eth_change_mtu,
|
||||
.ndo_set_mac_address = eth_mac_addr,
|
||||
.ndo_validate_addr = eth_validate_addr,
|
||||
};
|
||||
|
||||
static int __init lance_probe1(struct net_device *dev, int ioaddr, int irq, int options)
|
||||
{
|
||||
struct lance_private *lp;
|
||||
|
@ -714,12 +726,7 @@ static int __init lance_probe1(struct net_device *dev, int ioaddr, int irq, int
|
|||
printk(version);
|
||||
|
||||
/* The LANCE-specific entries in the device structure. */
|
||||
dev->open = lance_open;
|
||||
dev->hard_start_xmit = lance_start_xmit;
|
||||
dev->stop = lance_close;
|
||||
dev->get_stats = lance_get_stats;
|
||||
dev->set_multicast_list = set_multicast_list;
|
||||
dev->tx_timeout = lance_tx_timeout;
|
||||
dev->netdev_ops = &lance_netdev_ops;
|
||||
dev->watchdog_timeo = TX_TIMEOUT;
|
||||
|
||||
err = register_netdev(dev);
|
||||
|
|
|
@ -952,6 +952,17 @@ static void print_eth(char *add)
|
|||
(unsigned char) add[12], (unsigned char) add[13]);
|
||||
}
|
||||
|
||||
static const struct net_device_ops i596_netdev_ops = {
|
||||
.ndo_open = i596_open,
|
||||
.ndo_stop = i596_close,
|
||||
.ndo_start_xmit = i596_start_xmit,
|
||||
.ndo_set_multicast_list = set_multicast_list,
|
||||
.ndo_tx_timeout = i596_tx_timeout,
|
||||
.ndo_change_mtu = eth_change_mtu,
|
||||
.ndo_set_mac_address = eth_mac_addr,
|
||||
.ndo_validate_addr = eth_validate_addr,
|
||||
};
|
||||
|
||||
static int __init lp486e_probe(struct net_device *dev) {
|
||||
struct i596_private *lp;
|
||||
unsigned char eth_addr[6] = { 0, 0xaa, 0, 0, 0, 0 };
|
||||
|
@ -1014,12 +1025,8 @@ static int __init lp486e_probe(struct net_device *dev) {
|
|||
printk("\n");
|
||||
|
||||
/* The LP486E-specific entries in the device structure. */
|
||||
dev->open = &i596_open;
|
||||
dev->stop = &i596_close;
|
||||
dev->hard_start_xmit = &i596_start_xmit;
|
||||
dev->set_multicast_list = &set_multicast_list;
|
||||
dev->netdev_ops = &i596_netdev_ops;
|
||||
dev->watchdog_timeo = 5*HZ;
|
||||
dev->tx_timeout = i596_tx_timeout;
|
||||
|
||||
#if 0
|
||||
/* selftest reports 0x320925ae - don't know what that means */
|
||||
|
|
|
@ -441,6 +441,18 @@ out:
|
|||
return ERR_PTR(err);
|
||||
}
|
||||
|
||||
static const struct net_device_ops ni52_netdev_ops = {
|
||||
.ndo_open = ni52_open,
|
||||
.ndo_stop = ni52_close,
|
||||
.ndo_get_stats = ni52_get_stats,
|
||||
.ndo_tx_timeout = ni52_timeout,
|
||||
.ndo_start_xmit = ni52_send_packet,
|
||||
.ndo_set_multicast_list = set_multicast_list,
|
||||
.ndo_change_mtu = eth_change_mtu,
|
||||
.ndo_set_mac_address = eth_mac_addr,
|
||||
.ndo_validate_addr = eth_validate_addr,
|
||||
};
|
||||
|
||||
static int __init ni52_probe1(struct net_device *dev, int ioaddr)
|
||||
{
|
||||
int i, size, retval;
|
||||
|
@ -561,15 +573,8 @@ static int __init ni52_probe1(struct net_device *dev, int ioaddr)
|
|||
printk("IRQ %d (assigned and not checked!).\n", dev->irq);
|
||||
}
|
||||
|
||||
dev->open = ni52_open;
|
||||
dev->stop = ni52_close;
|
||||
dev->get_stats = ni52_get_stats;
|
||||
dev->tx_timeout = ni52_timeout;
|
||||
dev->netdev_ops = &ni52_netdev_ops;
|
||||
dev->watchdog_timeo = HZ/20;
|
||||
dev->hard_start_xmit = ni52_send_packet;
|
||||
dev->set_multicast_list = set_multicast_list;
|
||||
|
||||
dev->if_port = 0;
|
||||
|
||||
return 0;
|
||||
out:
|
||||
|
|
|
@ -237,7 +237,7 @@ struct priv
|
|||
void *tmdbounce[TMDNUM];
|
||||
int tmdbouncenum;
|
||||
int lock,xmit_queued;
|
||||
struct net_device_stats stats;
|
||||
|
||||
void *self;
|
||||
int cmdr_addr;
|
||||
int cardno;
|
||||
|
@ -257,7 +257,6 @@ static void ni65_timeout(struct net_device *dev);
|
|||
static int ni65_close(struct net_device *dev);
|
||||
static int ni65_alloc_buffer(struct net_device *dev);
|
||||
static void ni65_free_buffer(struct priv *p);
|
||||
static struct net_device_stats *ni65_get_stats(struct net_device *);
|
||||
static void set_multicast_list(struct net_device *dev);
|
||||
|
||||
static int irqtab[] __initdata = { 9,12,15,5 }; /* irq config-translate */
|
||||
|
@ -401,6 +400,17 @@ out:
|
|||
return ERR_PTR(err);
|
||||
}
|
||||
|
||||
static const struct net_device_ops ni65_netdev_ops = {
|
||||
.ndo_open = ni65_open,
|
||||
.ndo_stop = ni65_close,
|
||||
.ndo_start_xmit = ni65_send_packet,
|
||||
.ndo_tx_timeout = ni65_timeout,
|
||||
.ndo_set_multicast_list = set_multicast_list,
|
||||
.ndo_change_mtu = eth_change_mtu,
|
||||
.ndo_set_mac_address = eth_mac_addr,
|
||||
.ndo_validate_addr = eth_validate_addr,
|
||||
};
|
||||
|
||||
/*
|
||||
* this is the real card probe ..
|
||||
*/
|
||||
|
@ -549,13 +559,9 @@ static int __init ni65_probe1(struct net_device *dev,int ioaddr)
|
|||
}
|
||||
|
||||
dev->base_addr = ioaddr;
|
||||
dev->open = ni65_open;
|
||||
dev->stop = ni65_close;
|
||||
dev->hard_start_xmit = ni65_send_packet;
|
||||
dev->tx_timeout = ni65_timeout;
|
||||
dev->netdev_ops = &ni65_netdev_ops;
|
||||
dev->watchdog_timeo = HZ/2;
|
||||
dev->get_stats = ni65_get_stats;
|
||||
dev->set_multicast_list = set_multicast_list;
|
||||
|
||||
return 0; /* everything is OK */
|
||||
}
|
||||
|
||||
|
@ -901,13 +907,13 @@ static irqreturn_t ni65_interrupt(int irq, void * dev_id)
|
|||
if(debuglevel > 1)
|
||||
printk(KERN_ERR "%s: general error: %04x.\n",dev->name,csr0);
|
||||
if(csr0 & CSR0_BABL)
|
||||
p->stats.tx_errors++;
|
||||
dev->stats.tx_errors++;
|
||||
if(csr0 & CSR0_MISS) {
|
||||
int i;
|
||||
for(i=0;i<RMDNUM;i++)
|
||||
printk("%02x ",p->rmdhead[i].u.s.status);
|
||||
printk("\n");
|
||||
p->stats.rx_errors++;
|
||||
dev->stats.rx_errors++;
|
||||
}
|
||||
if(csr0 & CSR0_MERR) {
|
||||
if(debuglevel > 1)
|
||||
|
@ -997,12 +1003,12 @@ static void ni65_xmit_intr(struct net_device *dev,int csr0)
|
|||
#endif
|
||||
/* checking some errors */
|
||||
if(tmdp->status2 & XMIT_RTRY)
|
||||
p->stats.tx_aborted_errors++;
|
||||
dev->stats.tx_aborted_errors++;
|
||||
if(tmdp->status2 & XMIT_LCAR)
|
||||
p->stats.tx_carrier_errors++;
|
||||
dev->stats.tx_carrier_errors++;
|
||||
if(tmdp->status2 & (XMIT_BUFF | XMIT_UFLO )) {
|
||||
/* this stops the xmitter */
|
||||
p->stats.tx_fifo_errors++;
|
||||
dev->stats.tx_fifo_errors++;
|
||||
if(debuglevel > 0)
|
||||
printk(KERN_ERR "%s: Xmit FIFO/BUFF error\n",dev->name);
|
||||
if(p->features & INIT_RING_BEFORE_START) {
|
||||
|
@ -1016,12 +1022,12 @@ static void ni65_xmit_intr(struct net_device *dev,int csr0)
|
|||
if(debuglevel > 2)
|
||||
printk(KERN_ERR "%s: xmit-error: %04x %02x-%04x\n",dev->name,csr0,(int) tmdstat,(int) tmdp->status2);
|
||||
if(!(csr0 & CSR0_BABL)) /* don't count errors twice */
|
||||
p->stats.tx_errors++;
|
||||
dev->stats.tx_errors++;
|
||||
tmdp->status2 = 0;
|
||||
}
|
||||
else {
|
||||
p->stats.tx_bytes -= (short)(tmdp->blen);
|
||||
p->stats.tx_packets++;
|
||||
dev->stats.tx_bytes -= (short)(tmdp->blen);
|
||||
dev->stats.tx_packets++;
|
||||
}
|
||||
|
||||
#ifdef XMT_VIA_SKB
|
||||
|
@ -1057,7 +1063,7 @@ static void ni65_recv_intr(struct net_device *dev,int csr0)
|
|||
if(!(rmdstat & RCV_ERR)) {
|
||||
if(rmdstat & RCV_START)
|
||||
{
|
||||
p->stats.rx_length_errors++;
|
||||
dev->stats.rx_length_errors++;
|
||||
printk(KERN_ERR "%s: recv, packet too long: %d\n",dev->name,rmdp->mlen & 0x0fff);
|
||||
}
|
||||
}
|
||||
|
@ -1066,16 +1072,16 @@ static void ni65_recv_intr(struct net_device *dev,int csr0)
|
|||
printk(KERN_ERR "%s: receive-error: %04x, lance-status: %04x/%04x\n",
|
||||
dev->name,(int) rmdstat,csr0,(int) inw(PORT+L_DATAREG) );
|
||||
if(rmdstat & RCV_FRAM)
|
||||
p->stats.rx_frame_errors++;
|
||||
dev->stats.rx_frame_errors++;
|
||||
if(rmdstat & RCV_OFLO)
|
||||
p->stats.rx_over_errors++;
|
||||
dev->stats.rx_over_errors++;
|
||||
if(rmdstat & RCV_CRC)
|
||||
p->stats.rx_crc_errors++;
|
||||
dev->stats.rx_crc_errors++;
|
||||
if(rmdstat & RCV_BUF_ERR)
|
||||
p->stats.rx_fifo_errors++;
|
||||
dev->stats.rx_fifo_errors++;
|
||||
}
|
||||
if(!(csr0 & CSR0_MISS)) /* don't count errors twice */
|
||||
p->stats.rx_errors++;
|
||||
dev->stats.rx_errors++;
|
||||
}
|
||||
else if( (len = (rmdp->mlen & 0x0fff) - 4) >= 60)
|
||||
{
|
||||
|
@ -1106,20 +1112,20 @@ static void ni65_recv_intr(struct net_device *dev,int csr0)
|
|||
skb_put(skb,len);
|
||||
skb_copy_to_linear_data(skb, (unsigned char *) p->recvbounce[p->rmdnum],len);
|
||||
#endif
|
||||
p->stats.rx_packets++;
|
||||
p->stats.rx_bytes += len;
|
||||
dev->stats.rx_packets++;
|
||||
dev->stats.rx_bytes += len;
|
||||
skb->protocol=eth_type_trans(skb,dev);
|
||||
netif_rx(skb);
|
||||
}
|
||||
else
|
||||
{
|
||||
printk(KERN_ERR "%s: can't alloc new sk_buff\n",dev->name);
|
||||
p->stats.rx_dropped++;
|
||||
dev->stats.rx_dropped++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
printk(KERN_INFO "%s: received runt packet\n",dev->name);
|
||||
p->stats.rx_errors++;
|
||||
dev->stats.rx_errors++;
|
||||
}
|
||||
rmdp->blen = -(R_BUF_SIZE-8);
|
||||
rmdp->mlen = 0;
|
||||
|
@ -1213,23 +1219,6 @@ static int ni65_send_packet(struct sk_buff *skb, struct net_device *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static struct net_device_stats *ni65_get_stats(struct net_device *dev)
|
||||
{
|
||||
|
||||
#if 0
|
||||
int i;
|
||||
struct priv *p = dev->ml_priv;
|
||||
for(i=0;i<RMDNUM;i++)
|
||||
{
|
||||
struct rmd *rmdp = p->rmdhead + ((p->rmdnum + i) & (RMDNUM-1));
|
||||
printk("%02x ",rmdp->u.s.status);
|
||||
}
|
||||
printk("\n");
|
||||
#endif
|
||||
|
||||
return &((struct priv *)dev->ml_priv)->stats;
|
||||
}
|
||||
|
||||
static void set_multicast_list(struct net_device *dev)
|
||||
{
|
||||
if(!ni65_lance_reinit(dev))
|
||||
|
|
|
@ -143,6 +143,17 @@ out:
|
|||
return ERR_PTR(err);
|
||||
}
|
||||
|
||||
static const struct net_device_ops seeq8005_netdev_ops = {
|
||||
.ndo_open = seeq8005_open,
|
||||
.ndo_stop = seeq8005_close,
|
||||
.ndo_start_xmit = seeq8005_send_packet,
|
||||
.ndo_tx_timeout = seeq8005_timeout,
|
||||
.ndo_set_multicast_list = set_multicast_list,
|
||||
.ndo_change_mtu = eth_change_mtu,
|
||||
.ndo_set_mac_address = eth_mac_addr,
|
||||
.ndo_validate_addr = eth_validate_addr,
|
||||
};
|
||||
|
||||
/* This is the real probe routine. Linux has a history of friendly device
|
||||
probes on the ISA bus. A good device probes avoids doing writes, and
|
||||
verifies that the correct device exists and functions. */
|
||||
|
@ -332,12 +343,8 @@ static int __init seeq8005_probe1(struct net_device *dev, int ioaddr)
|
|||
}
|
||||
}
|
||||
#endif
|
||||
dev->open = seeq8005_open;
|
||||
dev->stop = seeq8005_close;
|
||||
dev->hard_start_xmit = seeq8005_send_packet;
|
||||
dev->tx_timeout = seeq8005_timeout;
|
||||
dev->netdev_ops = &seeq8005_netdev_ops;
|
||||
dev->watchdog_timeo = HZ/20;
|
||||
dev->set_multicast_list = set_multicast_list;
|
||||
dev->flags &= ~IFF_MULTICAST;
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -142,9 +142,6 @@ static int __init do_ultra_probe(struct net_device *dev)
|
|||
int base_addr = dev->base_addr;
|
||||
int irq = dev->irq;
|
||||
|
||||
#ifdef CONFIG_NET_POLL_CONTROLLER
|
||||
dev->poll_controller = &ultra_poll;
|
||||
#endif
|
||||
if (base_addr > 0x1ff) /* Check a single specified location. */
|
||||
return ultra_probe1(dev, base_addr);
|
||||
else if (base_addr != 0) /* Don't probe at all. */
|
||||
|
@ -199,7 +196,7 @@ static const struct net_device_ops ultra_netdev_ops = {
|
|||
.ndo_set_mac_address = eth_mac_addr,
|
||||
.ndo_change_mtu = eth_change_mtu,
|
||||
#ifdef CONFIG_NET_POLL_CONTROLLER
|
||||
.ndo_poll_controller = ei_poll,
|
||||
.ndo_poll_controller = ultra_poll,
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
|
@ -153,6 +153,22 @@ out:
|
|||
return ERR_PTR(err);
|
||||
}
|
||||
|
||||
|
||||
static const struct net_device_ops ultra32_netdev_ops = {
|
||||
.ndo_open = ultra32_open,
|
||||
.ndo_stop = ultra32_close,
|
||||
.ndo_start_xmit = ei_start_xmit,
|
||||
.ndo_tx_timeout = ei_tx_timeout,
|
||||
.ndo_get_stats = ei_get_stats,
|
||||
.ndo_set_multicast_list = ei_set_multicast_list,
|
||||
.ndo_validate_addr = eth_validate_addr,
|
||||
.ndo_set_mac_address = eth_mac_addr,
|
||||
.ndo_change_mtu = eth_change_mtu,
|
||||
#ifdef CONFIG_NET_POLL_CONTROLLER
|
||||
.ndo_poll_controller = ei_poll,
|
||||
#endif
|
||||
};
|
||||
|
||||
static int __init ultra32_probe1(struct net_device *dev, int ioaddr)
|
||||
{
|
||||
int i, edge, media, retval;
|
||||
|
@ -273,11 +289,8 @@ static int __init ultra32_probe1(struct net_device *dev, int ioaddr)
|
|||
ei_status.block_output = &ultra32_block_output;
|
||||
ei_status.get_8390_hdr = &ultra32_get_8390_hdr;
|
||||
ei_status.reset_8390 = &ultra32_reset_8390;
|
||||
dev->open = &ultra32_open;
|
||||
dev->stop = &ultra32_close;
|
||||
#ifdef CONFIG_NET_POLL_CONTROLLER
|
||||
dev->poll_controller = ei_poll;
|
||||
#endif
|
||||
|
||||
dev->netdev_ops = &ultra32_netdev_ops;
|
||||
NS8390_init(dev, 0);
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -831,6 +831,17 @@ static int __init smc_findirq(int ioaddr)
|
|||
#endif
|
||||
}
|
||||
|
||||
static const struct net_device_ops smc_netdev_ops = {
|
||||
.ndo_open = smc_open,
|
||||
.ndo_stop = smc_close,
|
||||
.ndo_start_xmit = smc_wait_to_send_packet,
|
||||
.ndo_tx_timeout = smc_timeout,
|
||||
.ndo_set_multicast_list = smc_set_multicast_list,
|
||||
.ndo_change_mtu = eth_change_mtu,
|
||||
.ndo_set_mac_address = eth_mac_addr,
|
||||
.ndo_validate_addr = eth_validate_addr,
|
||||
};
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
. Function: smc_probe( int ioaddr )
|
||||
.
|
||||
|
@ -1044,12 +1055,8 @@ static int __init smc_probe(struct net_device *dev, int ioaddr)
|
|||
goto err_out;
|
||||
}
|
||||
|
||||
dev->open = smc_open;
|
||||
dev->stop = smc_close;
|
||||
dev->hard_start_xmit = smc_wait_to_send_packet;
|
||||
dev->tx_timeout = smc_timeout;
|
||||
dev->netdev_ops = &smc_netdev_ops;
|
||||
dev->watchdog_timeo = HZ/20;
|
||||
dev->set_multicast_list = smc_set_multicast_list;
|
||||
|
||||
return 0;
|
||||
|
||||
|
|
|
@ -1680,6 +1680,7 @@ static int smsc911x_eeprom_write_location(struct smsc911x_data *pdata,
|
|||
u8 address, u8 data)
|
||||
{
|
||||
u32 op = E2P_CMD_EPC_CMD_ERASE_ | address;
|
||||
u32 temp;
|
||||
int ret;
|
||||
|
||||
SMSC_TRACE(DRV, "address 0x%x, data 0x%x", address, data);
|
||||
|
@ -1688,6 +1689,10 @@ static int smsc911x_eeprom_write_location(struct smsc911x_data *pdata,
|
|||
if (!ret) {
|
||||
op = E2P_CMD_EPC_CMD_WRITE_ | address;
|
||||
smsc911x_reg_write(pdata, E2P_DATA, (u32)data);
|
||||
|
||||
/* Workaround for hardware read-after-write restriction */
|
||||
temp = smsc911x_reg_read(pdata, BYTE_TEST);
|
||||
|
||||
ret = smsc911x_eeprom_send_cmd(pdata, op);
|
||||
}
|
||||
|
||||
|
|
|
@ -142,7 +142,7 @@ static void madgemc_sifwritew(struct net_device *dev, unsigned short val, unsign
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
static struct net_device_ops madgemc_netdev_ops __read_mostly;
|
||||
|
||||
static int __devinit madgemc_probe(struct device *device)
|
||||
{
|
||||
|
@ -168,7 +168,7 @@ static int __devinit madgemc_probe(struct device *device)
|
|||
goto getout;
|
||||
}
|
||||
|
||||
dev->dma = 0;
|
||||
dev->netdev_ops = &madgemc_netdev_ops;
|
||||
|
||||
card = kmalloc(sizeof(struct card_info), GFP_KERNEL);
|
||||
if (card==NULL) {
|
||||
|
@ -348,9 +348,6 @@ static int __devinit madgemc_probe(struct device *device)
|
|||
|
||||
memcpy(tp->ProductID, "Madge MCA 16/4 ", PROD_ID_SIZE + 1);
|
||||
|
||||
dev->open = madgemc_open;
|
||||
dev->stop = madgemc_close;
|
||||
|
||||
tp->tmspriv = card;
|
||||
dev_set_drvdata(device, dev);
|
||||
|
||||
|
@ -758,6 +755,10 @@ static struct mca_driver madgemc_driver = {
|
|||
|
||||
static int __init madgemc_init (void)
|
||||
{
|
||||
madgemc_netdev_ops = tms380tr_netdev_ops;
|
||||
madgemc_netdev_ops.ndo_open = madgemc_open;
|
||||
madgemc_netdev_ops.ndo_stop = madgemc_close;
|
||||
|
||||
return mca_register_driver (&madgemc_driver);
|
||||
}
|
||||
|
||||
|
|
|
@ -116,6 +116,8 @@ nodev:
|
|||
return -ENODEV;
|
||||
}
|
||||
|
||||
static struct net_device_ops proteon_netdev_ops __read_mostly;
|
||||
|
||||
static int __init setup_card(struct net_device *dev, struct device *pdev)
|
||||
{
|
||||
struct net_local *tp;
|
||||
|
@ -167,8 +169,7 @@ static int __init setup_card(struct net_device *dev, struct device *pdev)
|
|||
|
||||
tp->tmspriv = NULL;
|
||||
|
||||
dev->open = proteon_open;
|
||||
dev->stop = tms380tr_close;
|
||||
dev->netdev_ops = &proteon_netdev_ops;
|
||||
|
||||
if (dev->irq == 0)
|
||||
{
|
||||
|
@ -352,6 +353,10 @@ static int __init proteon_init(void)
|
|||
struct platform_device *pdev;
|
||||
int i, num = 0, err = 0;
|
||||
|
||||
proteon_netdev_ops = tms380tr_netdev_ops;
|
||||
proteon_netdev_ops.ndo_open = proteon_open;
|
||||
proteon_netdev_ops.ndo_stop = tms380tr_close;
|
||||
|
||||
err = platform_driver_register(&proteon_driver);
|
||||
if (err)
|
||||
return err;
|
||||
|
|
|
@ -133,6 +133,8 @@ static int __init sk_isa_probe1(struct net_device *dev, int ioaddr)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static struct net_device_ops sk_isa_netdev_ops __read_mostly;
|
||||
|
||||
static int __init setup_card(struct net_device *dev, struct device *pdev)
|
||||
{
|
||||
struct net_local *tp;
|
||||
|
@ -184,8 +186,7 @@ static int __init setup_card(struct net_device *dev, struct device *pdev)
|
|||
|
||||
tp->tmspriv = NULL;
|
||||
|
||||
dev->open = sk_isa_open;
|
||||
dev->stop = tms380tr_close;
|
||||
dev->netdev_ops = &sk_isa_netdev_ops;
|
||||
|
||||
if (dev->irq == 0)
|
||||
{
|
||||
|
@ -362,6 +363,10 @@ static int __init sk_isa_init(void)
|
|||
struct platform_device *pdev;
|
||||
int i, num = 0, err = 0;
|
||||
|
||||
sk_isa_netdev_ops = tms380tr_netdev_ops;
|
||||
sk_isa_netdev_ops.ndo_open = sk_isa_open;
|
||||
sk_isa_netdev_ops.ndo_stop = tms380tr_close;
|
||||
|
||||
err = platform_driver_register(&sk_isa_driver);
|
||||
if (err)
|
||||
return err;
|
||||
|
|
|
@ -124,7 +124,6 @@ static unsigned int smctr_get_num_rx_bdbs(struct net_device *dev);
|
|||
static int smctr_get_physical_drop_number(struct net_device *dev);
|
||||
static __u8 *smctr_get_rx_pointer(struct net_device *dev, short queue);
|
||||
static int smctr_get_station_id(struct net_device *dev);
|
||||
static struct net_device_stats *smctr_get_stats(struct net_device *dev);
|
||||
static FCBlock *smctr_get_tx_fcb(struct net_device *dev, __u16 queue,
|
||||
__u16 bytes_count);
|
||||
static int smctr_get_upstream_neighbor_addr(struct net_device *dev);
|
||||
|
@ -3633,6 +3632,14 @@ out:
|
|||
return ERR_PTR(err);
|
||||
}
|
||||
|
||||
static const struct net_device_ops smctr_netdev_ops = {
|
||||
.ndo_open = smctr_open,
|
||||
.ndo_stop = smctr_close,
|
||||
.ndo_start_xmit = smctr_send_packet,
|
||||
.ndo_tx_timeout = smctr_timeout,
|
||||
.ndo_get_stats = smctr_get_stats,
|
||||
.ndo_set_multicast_list = smctr_set_multicast_list,
|
||||
};
|
||||
|
||||
static int __init smctr_probe1(struct net_device *dev, int ioaddr)
|
||||
{
|
||||
|
@ -3683,13 +3690,8 @@ static int __init smctr_probe1(struct net_device *dev, int ioaddr)
|
|||
(unsigned int)dev->base_addr,
|
||||
dev->irq, tp->rom_base, tp->ram_base);
|
||||
|
||||
dev->open = smctr_open;
|
||||
dev->stop = smctr_close;
|
||||
dev->hard_start_xmit = smctr_send_packet;
|
||||
dev->tx_timeout = smctr_timeout;
|
||||
dev->netdev_ops = &smctr_netdev_ops;
|
||||
dev->watchdog_timeo = HZ;
|
||||
dev->get_stats = smctr_get_stats;
|
||||
dev->set_multicast_list = &smctr_set_multicast_list;
|
||||
return (0);
|
||||
|
||||
out:
|
||||
|
|
|
@ -2009,6 +2009,9 @@ static void ucc_geth_stop(struct ucc_geth_private *ugeth)
|
|||
/* Disable Rx and Tx */
|
||||
clrbits32(&ug_regs->maccfg1, MACCFG1_ENABLE_RX | MACCFG1_ENABLE_TX);
|
||||
|
||||
phy_disconnect(ugeth->phydev);
|
||||
ugeth->phydev = NULL;
|
||||
|
||||
ucc_geth_memclean(ugeth);
|
||||
}
|
||||
|
||||
|
@ -3345,6 +3348,14 @@ static int ucc_geth_open(struct net_device *dev)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
err = init_phy(dev);
|
||||
if (err) {
|
||||
if (netif_msg_ifup(ugeth))
|
||||
ugeth_err("%s: Cannot initialize PHY, aborting.",
|
||||
dev->name);
|
||||
return err;
|
||||
}
|
||||
|
||||
err = ucc_struct_init(ugeth);
|
||||
if (err) {
|
||||
if (netif_msg_ifup(ugeth))
|
||||
|
@ -3381,13 +3392,6 @@ static int ucc_geth_open(struct net_device *dev)
|
|||
&ugeth->ug_regs->macstnaddr1,
|
||||
&ugeth->ug_regs->macstnaddr2);
|
||||
|
||||
err = init_phy(dev);
|
||||
if (err) {
|
||||
if (netif_msg_ifup(ugeth))
|
||||
ugeth_err("%s: Cannot initialize PHY, aborting.", dev->name);
|
||||
goto out_err;
|
||||
}
|
||||
|
||||
phy_start(ugeth->phydev);
|
||||
|
||||
err = ugeth_enable(ugeth, COMM_DIR_RX_AND_TX);
|
||||
|
@ -3430,9 +3434,6 @@ static int ucc_geth_close(struct net_device *dev)
|
|||
|
||||
free_irq(ugeth->ug_info->uf_info.irq, ugeth->dev);
|
||||
|
||||
phy_disconnect(ugeth->phydev);
|
||||
ugeth->phydev = NULL;
|
||||
|
||||
netif_stop_queue(dev);
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -714,19 +714,19 @@ static int sdla_transmit(struct sk_buff *skb, struct net_device *dev)
|
|||
switch (ret)
|
||||
{
|
||||
case SDLA_RET_OK:
|
||||
flp->stats.tx_packets++;
|
||||
dev->stats.tx_packets++;
|
||||
ret = DLCI_RET_OK;
|
||||
break;
|
||||
|
||||
case SDLA_RET_CIR_OVERFLOW:
|
||||
case SDLA_RET_BUF_OVERSIZE:
|
||||
case SDLA_RET_NO_BUFS:
|
||||
flp->stats.tx_dropped++;
|
||||
dev->stats.tx_dropped++;
|
||||
ret = DLCI_RET_DROP;
|
||||
break;
|
||||
|
||||
default:
|
||||
flp->stats.tx_errors++;
|
||||
dev->stats.tx_errors++;
|
||||
ret = DLCI_RET_ERR;
|
||||
break;
|
||||
}
|
||||
|
@ -807,7 +807,7 @@ static void sdla_receive(struct net_device *dev)
|
|||
if (i == CONFIG_DLCI_MAX)
|
||||
{
|
||||
printk(KERN_NOTICE "%s: Received packet from invalid DLCI %i, ignoring.", dev->name, dlci);
|
||||
flp->stats.rx_errors++;
|
||||
dev->stats.rx_errors++;
|
||||
success = 0;
|
||||
}
|
||||
}
|
||||
|
@ -819,7 +819,7 @@ static void sdla_receive(struct net_device *dev)
|
|||
if (skb == NULL)
|
||||
{
|
||||
printk(KERN_NOTICE "%s: Memory squeeze, dropping packet.\n", dev->name);
|
||||
flp->stats.rx_dropped++;
|
||||
dev->stats.rx_dropped++;
|
||||
success = 0;
|
||||
}
|
||||
else
|
||||
|
@ -859,7 +859,7 @@ static void sdla_receive(struct net_device *dev)
|
|||
|
||||
if (success)
|
||||
{
|
||||
flp->stats.rx_packets++;
|
||||
dev->stats.rx_packets++;
|
||||
dlp = netdev_priv(master);
|
||||
(*dlp->receive)(skb, master);
|
||||
}
|
||||
|
@ -1590,13 +1590,14 @@ fail:
|
|||
return err;
|
||||
}
|
||||
|
||||
static struct net_device_stats *sdla_stats(struct net_device *dev)
|
||||
{
|
||||
struct frad_local *flp;
|
||||
flp = netdev_priv(dev);
|
||||
|
||||
return(&flp->stats);
|
||||
}
|
||||
static const struct net_device_ops sdla_netdev_ops = {
|
||||
.ndo_open = sdla_open,
|
||||
.ndo_stop = sdla_close,
|
||||
.ndo_do_ioctl = sdla_ioctl,
|
||||
.ndo_set_config = sdla_set_config,
|
||||
.ndo_start_xmit = sdla_transmit,
|
||||
.ndo_change_mtu = sdla_change_mtu,
|
||||
};
|
||||
|
||||
static void setup_sdla(struct net_device *dev)
|
||||
{
|
||||
|
@ -1604,20 +1605,13 @@ static void setup_sdla(struct net_device *dev)
|
|||
|
||||
netdev_boot_setup_check(dev);
|
||||
|
||||
dev->netdev_ops = &sdla_netdev_ops;
|
||||
dev->flags = 0;
|
||||
dev->type = 0xFFFF;
|
||||
dev->hard_header_len = 0;
|
||||
dev->addr_len = 0;
|
||||
dev->mtu = SDLA_MAX_MTU;
|
||||
|
||||
dev->open = sdla_open;
|
||||
dev->stop = sdla_close;
|
||||
dev->do_ioctl = sdla_ioctl;
|
||||
dev->set_config = sdla_set_config;
|
||||
dev->get_stats = sdla_stats;
|
||||
dev->hard_start_xmit = sdla_transmit;
|
||||
dev->change_mtu = sdla_change_mtu;
|
||||
|
||||
flp->activate = sdla_activate;
|
||||
flp->deactivate = sdla_deactivate;
|
||||
flp->assoc = sdla_assoc;
|
||||
|
|
|
@ -485,6 +485,7 @@ config MWL8K
|
|||
source "drivers/net/wireless/p54/Kconfig"
|
||||
source "drivers/net/wireless/ath5k/Kconfig"
|
||||
source "drivers/net/wireless/ath9k/Kconfig"
|
||||
source "drivers/net/wireless/ar9170/Kconfig"
|
||||
source "drivers/net/wireless/ipw2x00/Kconfig"
|
||||
source "drivers/net/wireless/iwlwifi/Kconfig"
|
||||
source "drivers/net/wireless/hostap/Kconfig"
|
||||
|
|
|
@ -57,5 +57,6 @@ obj-$(CONFIG_P54_COMMON) += p54/
|
|||
|
||||
obj-$(CONFIG_ATH5K) += ath5k/
|
||||
obj-$(CONFIG_ATH9K) += ath9k/
|
||||
obj-$(CONFIG_AR9170_USB) += ar9170/
|
||||
|
||||
obj-$(CONFIG_MAC80211_HWSIM) += mac80211_hwsim.o
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
config AR9170_USB
|
||||
tristate "Atheros AR9170 802.11n USB support"
|
||||
depends on USB && MAC80211 && WLAN_80211 && EXPERIMENTAL
|
||||
select FW_LOADER
|
||||
help
|
||||
This is a driver for the Atheros "otus" 802.11n USB devices.
|
||||
|
||||
These devices require additional firmware (2 files).
|
||||
For now, these files can be downloaded from here:
|
||||
http://wireless.kernel.org/en/users/Drivers/ar9170
|
||||
|
||||
If you choose to build a module, it'll be called ar9170usb.
|
||||
|
||||
config AR9170_LEDS
|
||||
bool
|
||||
depends on AR9170_USB && MAC80211_LEDS && (LEDS_CLASS = y || LEDS_CLASS = AR9170_USB)
|
||||
default y
|
|
@ -0,0 +1,3 @@
|
|||
ar9170usb-objs := usb.o main.o cmd.o mac.o phy.o led.o
|
||||
|
||||
obj-$(CONFIG_AR9170_USB) += ar9170usb.o
|
|
@ -0,0 +1,209 @@
|
|||
/*
|
||||
* Atheros AR9170 driver
|
||||
*
|
||||
* Driver specific definitions
|
||||
*
|
||||
* Copyright 2008, Johannes Berg <johannes@sipsolutions.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, see
|
||||
* http://www.gnu.org/licenses/.
|
||||
*
|
||||
* This file incorporates work covered by the following copyright and
|
||||
* permission notice:
|
||||
* Copyright (c) 2007-2008 Atheros Communications, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifndef __AR9170_H
|
||||
#define __AR9170_H
|
||||
|
||||
#include <linux/completion.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <net/wireless.h>
|
||||
#include <net/mac80211.h>
|
||||
#ifdef CONFIG_AR9170_LEDS
|
||||
#include <linux/leds.h>
|
||||
#endif /* CONFIG_AR9170_LEDS */
|
||||
#include "eeprom.h"
|
||||
#include "hw.h"
|
||||
|
||||
#define PAYLOAD_MAX (AR9170_MAX_CMD_LEN/4 - 1)
|
||||
|
||||
enum ar9170_bw {
|
||||
AR9170_BW_20,
|
||||
AR9170_BW_40_BELOW,
|
||||
AR9170_BW_40_ABOVE,
|
||||
|
||||
__AR9170_NUM_BW,
|
||||
};
|
||||
|
||||
enum ar9170_rf_init_mode {
|
||||
AR9170_RFI_NONE,
|
||||
AR9170_RFI_WARM,
|
||||
AR9170_RFI_COLD,
|
||||
};
|
||||
|
||||
#define AR9170_MAX_RX_BUFFER_SIZE 8192
|
||||
|
||||
#ifdef CONFIG_AR9170_LEDS
|
||||
struct ar9170;
|
||||
|
||||
struct ar9170_led {
|
||||
struct ar9170 *ar;
|
||||
struct led_classdev l;
|
||||
char name[32];
|
||||
unsigned int toggled;
|
||||
bool registered;
|
||||
};
|
||||
|
||||
#endif /* CONFIG_AR9170_LEDS */
|
||||
|
||||
enum ar9170_device_state {
|
||||
AR9170_UNKNOWN_STATE,
|
||||
AR9170_STOPPED,
|
||||
AR9170_IDLE,
|
||||
AR9170_STARTED,
|
||||
AR9170_ASSOCIATED,
|
||||
};
|
||||
|
||||
struct ar9170 {
|
||||
struct ieee80211_hw *hw;
|
||||
struct mutex mutex;
|
||||
enum ar9170_device_state state;
|
||||
|
||||
int (*open)(struct ar9170 *);
|
||||
void (*stop)(struct ar9170 *);
|
||||
int (*tx)(struct ar9170 *, struct sk_buff *, bool, unsigned int);
|
||||
int (*exec_cmd)(struct ar9170 *, enum ar9170_cmd, u32 ,
|
||||
void *, u32 , void *);
|
||||
void (*callback_cmd)(struct ar9170 *, u32 , void *);
|
||||
|
||||
/* interface mode settings */
|
||||
struct ieee80211_vif *vif;
|
||||
u8 mac_addr[ETH_ALEN];
|
||||
u8 bssid[ETH_ALEN];
|
||||
|
||||
/* beaconing */
|
||||
struct sk_buff *beacon;
|
||||
struct work_struct beacon_work;
|
||||
|
||||
/* cryptographic engine */
|
||||
u64 usedkeys;
|
||||
bool rx_software_decryption;
|
||||
bool disable_offload;
|
||||
|
||||
/* filter settings */
|
||||
struct work_struct filter_config_work;
|
||||
u64 cur_mc_hash, want_mc_hash;
|
||||
u32 cur_filter, want_filter;
|
||||
unsigned int filter_changed;
|
||||
bool sniffer_enabled;
|
||||
|
||||
/* PHY */
|
||||
struct ieee80211_channel *channel;
|
||||
int noise[4];
|
||||
|
||||
/* power calibration data */
|
||||
u8 power_5G_leg[4];
|
||||
u8 power_2G_cck[4];
|
||||
u8 power_2G_ofdm[4];
|
||||
u8 power_5G_ht20[8];
|
||||
u8 power_5G_ht40[8];
|
||||
u8 power_2G_ht20[8];
|
||||
u8 power_2G_ht40[8];
|
||||
|
||||
#ifdef CONFIG_AR9170_LEDS
|
||||
struct delayed_work led_work;
|
||||
struct ar9170_led leds[AR9170_NUM_LEDS];
|
||||
#endif /* CONFIG_AR9170_LEDS */
|
||||
|
||||
/* qos queue settings */
|
||||
spinlock_t tx_stats_lock;
|
||||
struct ieee80211_tx_queue_stats tx_stats[5];
|
||||
struct ieee80211_tx_queue_params edcf[5];
|
||||
|
||||
spinlock_t cmdlock;
|
||||
__le32 cmdbuf[PAYLOAD_MAX + 1];
|
||||
|
||||
/* MAC statistics */
|
||||
struct ieee80211_low_level_stats stats;
|
||||
|
||||
/* EEPROM */
|
||||
struct ar9170_eeprom eeprom;
|
||||
|
||||
/* global tx status for unregistered Stations. */
|
||||
struct sk_buff_head global_tx_status;
|
||||
struct sk_buff_head global_tx_status_waste;
|
||||
struct delayed_work tx_status_janitor;
|
||||
};
|
||||
|
||||
struct ar9170_sta_info {
|
||||
struct sk_buff_head tx_status[__AR9170_NUM_TXQ];
|
||||
};
|
||||
|
||||
#define IS_STARTED(a) (a->state >= AR9170_STARTED)
|
||||
#define IS_ACCEPTING_CMD(a) (a->state >= AR9170_IDLE)
|
||||
|
||||
#define AR9170_FILTER_CHANGED_PROMISC BIT(0)
|
||||
#define AR9170_FILTER_CHANGED_MULTICAST BIT(1)
|
||||
#define AR9170_FILTER_CHANGED_FRAMEFILTER BIT(2)
|
||||
|
||||
/* exported interface */
|
||||
void *ar9170_alloc(size_t priv_size);
|
||||
int ar9170_register(struct ar9170 *ar, struct device *pdev);
|
||||
void ar9170_rx(struct ar9170 *ar, struct sk_buff *skb);
|
||||
void ar9170_unregister(struct ar9170 *ar);
|
||||
void ar9170_handle_tx_status(struct ar9170 *ar, struct sk_buff *skb,
|
||||
bool update_statistics, u16 tx_status);
|
||||
|
||||
/* MAC */
|
||||
int ar9170_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb);
|
||||
int ar9170_init_mac(struct ar9170 *ar);
|
||||
int ar9170_set_qos(struct ar9170 *ar);
|
||||
int ar9170_update_multicast(struct ar9170 *ar);
|
||||
int ar9170_update_frame_filter(struct ar9170 *ar);
|
||||
int ar9170_set_operating_mode(struct ar9170 *ar);
|
||||
int ar9170_set_beacon_timers(struct ar9170 *ar);
|
||||
int ar9170_set_hwretry_limit(struct ar9170 *ar, u32 max_retry);
|
||||
int ar9170_update_beacon(struct ar9170 *ar);
|
||||
void ar9170_new_beacon(struct work_struct *work);
|
||||
int ar9170_upload_key(struct ar9170 *ar, u8 id, const u8 *mac, u8 ktype,
|
||||
u8 keyidx, u8 *keydata, int keylen);
|
||||
int ar9170_disable_key(struct ar9170 *ar, u8 id);
|
||||
|
||||
/* LEDs */
|
||||
#ifdef CONFIG_AR9170_LEDS
|
||||
int ar9170_register_leds(struct ar9170 *ar);
|
||||
void ar9170_unregister_leds(struct ar9170 *ar);
|
||||
#endif /* CONFIG_AR9170_LEDS */
|
||||
int ar9170_init_leds(struct ar9170 *ar);
|
||||
int ar9170_set_leds_state(struct ar9170 *ar, u32 led_state);
|
||||
|
||||
/* PHY / RF */
|
||||
int ar9170_init_phy(struct ar9170 *ar, enum ieee80211_band band);
|
||||
int ar9170_init_rf(struct ar9170 *ar);
|
||||
int ar9170_set_channel(struct ar9170 *ar, struct ieee80211_channel *channel,
|
||||
enum ar9170_rf_init_mode rfi, enum ar9170_bw bw);
|
||||
|
||||
#endif /* __AR9170_H */
|
|
@ -0,0 +1,129 @@
|
|||
/*
|
||||
* Atheros AR9170 driver
|
||||
*
|
||||
* Basic HW register/memory/command access functions
|
||||
*
|
||||
* Copyright 2008, Johannes Berg <johannes@sipsolutions.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, see
|
||||
* http://www.gnu.org/licenses/.
|
||||
*
|
||||
* This file incorporates work covered by the following copyright and
|
||||
* permission notice:
|
||||
* Copyright (c) 2007-2008 Atheros Communications, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "ar9170.h"
|
||||
#include "cmd.h"
|
||||
|
||||
int ar9170_write_mem(struct ar9170 *ar, const __le32 *data, size_t len)
|
||||
{
|
||||
int err;
|
||||
|
||||
if (unlikely(!IS_ACCEPTING_CMD(ar)))
|
||||
return 0;
|
||||
|
||||
err = ar->exec_cmd(ar, AR9170_CMD_WMEM, len, (u8 *) data, 0, NULL);
|
||||
if (err)
|
||||
printk(KERN_DEBUG "%s: writing memory failed\n",
|
||||
wiphy_name(ar->hw->wiphy));
|
||||
return err;
|
||||
}
|
||||
|
||||
int ar9170_write_reg(struct ar9170 *ar, const u32 reg, const u32 val)
|
||||
{
|
||||
__le32 buf[2] = {
|
||||
cpu_to_le32(reg),
|
||||
cpu_to_le32(val),
|
||||
};
|
||||
int err;
|
||||
|
||||
if (unlikely(!IS_ACCEPTING_CMD(ar)))
|
||||
return 0;
|
||||
|
||||
err = ar->exec_cmd(ar, AR9170_CMD_WREG, sizeof(buf),
|
||||
(u8 *) buf, 0, NULL);
|
||||
if (err)
|
||||
printk(KERN_DEBUG "%s: writing reg %#x (val %#x) failed\n",
|
||||
wiphy_name(ar->hw->wiphy), reg, val);
|
||||
return err;
|
||||
}
|
||||
|
||||
static int ar9170_read_mreg(struct ar9170 *ar, int nregs,
|
||||
const u32 *regs, u32 *out)
|
||||
{
|
||||
int i, err;
|
||||
__le32 *offs, *res;
|
||||
|
||||
if (unlikely(!IS_ACCEPTING_CMD(ar)))
|
||||
return 0;
|
||||
|
||||
/* abuse "out" for the register offsets, must be same length */
|
||||
offs = (__le32 *)out;
|
||||
for (i = 0; i < nregs; i++)
|
||||
offs[i] = cpu_to_le32(regs[i]);
|
||||
|
||||
/* also use the same buffer for the input */
|
||||
res = (__le32 *)out;
|
||||
|
||||
err = ar->exec_cmd(ar, AR9170_CMD_RREG,
|
||||
4 * nregs, (u8 *)offs,
|
||||
4 * nregs, (u8 *)res);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
/* convert result to cpu endian */
|
||||
for (i = 0; i < nregs; i++)
|
||||
out[i] = le32_to_cpu(res[i]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ar9170_read_reg(struct ar9170 *ar, u32 reg, u32 *val)
|
||||
{
|
||||
return ar9170_read_mreg(ar, 1, ®, val);
|
||||
}
|
||||
|
||||
int ar9170_echo_test(struct ar9170 *ar, u32 v)
|
||||
{
|
||||
__le32 echobuf = cpu_to_le32(v);
|
||||
__le32 echores;
|
||||
int err;
|
||||
|
||||
if (unlikely(!IS_ACCEPTING_CMD(ar)))
|
||||
return -ENODEV;
|
||||
|
||||
err = ar->exec_cmd(ar, AR9170_CMD_ECHO,
|
||||
4, (u8 *)&echobuf,
|
||||
4, (u8 *)&echores);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
if (echobuf != echores)
|
||||
return -EINVAL;
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,91 @@
|
|||
/*
|
||||
* Atheros AR9170 driver
|
||||
*
|
||||
* Basic HW register/memory/command access functions
|
||||
*
|
||||
* Copyright 2008, Johannes Berg <johannes@sipsolutions.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, see
|
||||
* http://www.gnu.org/licenses/.
|
||||
*
|
||||
* This file incorporates work covered by the following copyright and
|
||||
* permission notice:
|
||||
* Copyright (c) 2007-2008 Atheros Communications, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifndef __CMD_H
|
||||
#define __CMD_H
|
||||
|
||||
#include "ar9170.h"
|
||||
|
||||
/* basic HW access */
|
||||
int ar9170_write_mem(struct ar9170 *ar, const __le32 *data, size_t len);
|
||||
int ar9170_write_reg(struct ar9170 *ar, const u32 reg, const u32 val);
|
||||
int ar9170_read_reg(struct ar9170 *ar, u32 reg, u32 *val);
|
||||
int ar9170_echo_test(struct ar9170 *ar, u32 v);
|
||||
|
||||
/*
|
||||
* Macros to facilitate writing multiple registers in a single
|
||||
* write-combining USB command. Note that when the first group
|
||||
* fails the whole thing will fail without any others attempted,
|
||||
* but you won't know which write in the group failed.
|
||||
*/
|
||||
#define ar9170_regwrite_begin(ar) \
|
||||
do { \
|
||||
int __nreg = 0, __err = 0; \
|
||||
struct ar9170 *__ar = ar;
|
||||
|
||||
#define ar9170_regwrite(r, v) do { \
|
||||
__ar->cmdbuf[2 * __nreg + 1] = cpu_to_le32(r); \
|
||||
__ar->cmdbuf[2 * __nreg + 2] = cpu_to_le32(v); \
|
||||
__nreg++; \
|
||||
if ((__nreg >= PAYLOAD_MAX/2)) { \
|
||||
if (IS_ACCEPTING_CMD(__ar)) \
|
||||
__err = ar->exec_cmd(__ar, AR9170_CMD_WREG, \
|
||||
8 * __nreg, \
|
||||
(u8 *) &__ar->cmdbuf[1], \
|
||||
0, NULL); \
|
||||
__nreg = 0; \
|
||||
if (__err) \
|
||||
goto __regwrite_out; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define ar9170_regwrite_finish() \
|
||||
__regwrite_out : \
|
||||
if (__nreg) { \
|
||||
if (IS_ACCEPTING_CMD(__ar)) \
|
||||
__err = ar->exec_cmd(__ar, AR9170_CMD_WREG, \
|
||||
8 * __nreg, \
|
||||
(u8 *) &__ar->cmdbuf[1], \
|
||||
0, NULL); \
|
||||
__nreg = 0; \
|
||||
}
|
||||
|
||||
#define ar9170_regwrite_result() \
|
||||
__err; \
|
||||
} while (0);
|
||||
|
||||
#endif /* __CMD_H */
|
|
@ -0,0 +1,179 @@
|
|||
/*
|
||||
* Atheros AR9170 driver
|
||||
*
|
||||
* EEPROM layout
|
||||
*
|
||||
* Copyright 2008, Johannes Berg <johannes@sipsolutions.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, see
|
||||
* http://www.gnu.org/licenses/.
|
||||
*
|
||||
* This file incorporates work covered by the following copyright and
|
||||
* permission notice:
|
||||
* Copyright (c) 2007-2008 Atheros Communications, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifndef __AR9170_EEPROM_H
|
||||
#define __AR9170_EEPROM_H
|
||||
|
||||
#define AR5416_MAX_CHAINS 2
|
||||
#define AR5416_MODAL_SPURS 5
|
||||
|
||||
struct ar9170_eeprom_modal {
|
||||
__le32 antCtrlChain[AR5416_MAX_CHAINS];
|
||||
__le32 antCtrlCommon;
|
||||
s8 antennaGainCh[AR5416_MAX_CHAINS];
|
||||
u8 switchSettling;
|
||||
u8 txRxAttenCh[AR5416_MAX_CHAINS];
|
||||
u8 rxTxMarginCh[AR5416_MAX_CHAINS];
|
||||
s8 adcDesiredSize;
|
||||
s8 pgaDesiredSize;
|
||||
u8 xlnaGainCh[AR5416_MAX_CHAINS];
|
||||
u8 txEndToXpaOff;
|
||||
u8 txEndToRxOn;
|
||||
u8 txFrameToXpaOn;
|
||||
u8 thresh62;
|
||||
s8 noiseFloorThreshCh[AR5416_MAX_CHAINS];
|
||||
u8 xpdGain;
|
||||
u8 xpd;
|
||||
s8 iqCalICh[AR5416_MAX_CHAINS];
|
||||
s8 iqCalQCh[AR5416_MAX_CHAINS];
|
||||
u8 pdGainOverlap;
|
||||
u8 ob;
|
||||
u8 db;
|
||||
u8 xpaBiasLvl;
|
||||
u8 pwrDecreaseFor2Chain;
|
||||
u8 pwrDecreaseFor3Chain;
|
||||
u8 txFrameToDataStart;
|
||||
u8 txFrameToPaOn;
|
||||
u8 ht40PowerIncForPdadc;
|
||||
u8 bswAtten[AR5416_MAX_CHAINS];
|
||||
u8 bswMargin[AR5416_MAX_CHAINS];
|
||||
u8 swSettleHt40;
|
||||
u8 reserved[22];
|
||||
struct spur_channel {
|
||||
__le16 spurChan;
|
||||
u8 spurRangeLow;
|
||||
u8 spurRangeHigh;
|
||||
} __packed spur_channels[AR5416_MODAL_SPURS];
|
||||
} __packed;
|
||||
|
||||
#define AR5416_NUM_PD_GAINS 4
|
||||
#define AR5416_PD_GAIN_ICEPTS 5
|
||||
|
||||
struct ar9170_calibration_data_per_freq {
|
||||
u8 pwr_pdg[AR5416_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS];
|
||||
u8 vpd_pdg[AR5416_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS];
|
||||
} __packed;
|
||||
|
||||
#define AR5416_NUM_5G_CAL_PIERS 8
|
||||
#define AR5416_NUM_2G_CAL_PIERS 4
|
||||
|
||||
#define AR5416_NUM_5G_TARGET_PWRS 8
|
||||
#define AR5416_NUM_2G_CCK_TARGET_PWRS 3
|
||||
#define AR5416_NUM_2G_OFDM_TARGET_PWRS 4
|
||||
#define AR5416_MAX_NUM_TGT_PWRS 8
|
||||
|
||||
struct ar9170_calibration_target_power_legacy {
|
||||
u8 freq;
|
||||
u8 power[4];
|
||||
} __packed;
|
||||
|
||||
struct ar9170_calibration_target_power_ht {
|
||||
u8 freq;
|
||||
u8 power[8];
|
||||
} __packed;
|
||||
|
||||
#define AR5416_NUM_CTLS 24
|
||||
|
||||
struct ar9170_calctl_edges {
|
||||
u8 channel;
|
||||
#define AR9170_CALCTL_EDGE_FLAGS 0xC0
|
||||
u8 power_flags;
|
||||
} __packed;
|
||||
|
||||
#define AR5416_NUM_BAND_EDGES 8
|
||||
|
||||
struct ar9170_calctl_data {
|
||||
struct ar9170_calctl_edges
|
||||
control_edges[AR5416_MAX_CHAINS][AR5416_NUM_BAND_EDGES];
|
||||
} __packed;
|
||||
|
||||
|
||||
struct ar9170_eeprom {
|
||||
__le16 length;
|
||||
__le16 checksum;
|
||||
__le16 version;
|
||||
u8 operating_flags;
|
||||
#define AR9170_OPFLAG_5GHZ 1
|
||||
#define AR9170_OPFLAG_2GHZ 2
|
||||
u8 misc;
|
||||
__le16 reg_domain[2];
|
||||
u8 mac_address[6];
|
||||
u8 rx_mask;
|
||||
u8 tx_mask;
|
||||
__le16 rf_silent;
|
||||
__le16 bluetooth_options;
|
||||
__le16 device_capabilities;
|
||||
__le32 build_number;
|
||||
u8 deviceType;
|
||||
u8 reserved[33];
|
||||
|
||||
u8 customer_data[64];
|
||||
|
||||
struct ar9170_eeprom_modal
|
||||
modal_header[2];
|
||||
|
||||
u8 cal_freq_pier_5G[AR5416_NUM_5G_CAL_PIERS];
|
||||
u8 cal_freq_pier_2G[AR5416_NUM_2G_CAL_PIERS];
|
||||
|
||||
struct ar9170_calibration_data_per_freq
|
||||
cal_pier_data_5G[AR5416_MAX_CHAINS][AR5416_NUM_5G_CAL_PIERS],
|
||||
cal_pier_data_2G[AR5416_MAX_CHAINS][AR5416_NUM_2G_CAL_PIERS];
|
||||
|
||||
/* power calibration data */
|
||||
struct ar9170_calibration_target_power_legacy
|
||||
cal_tgt_pwr_5G[AR5416_NUM_5G_TARGET_PWRS];
|
||||
struct ar9170_calibration_target_power_ht
|
||||
cal_tgt_pwr_5G_ht20[AR5416_NUM_5G_TARGET_PWRS],
|
||||
cal_tgt_pwr_5G_ht40[AR5416_NUM_5G_TARGET_PWRS];
|
||||
|
||||
struct ar9170_calibration_target_power_legacy
|
||||
cal_tgt_pwr_2G_cck[AR5416_NUM_2G_CCK_TARGET_PWRS],
|
||||
cal_tgt_pwr_2G_ofdm[AR5416_NUM_2G_OFDM_TARGET_PWRS];
|
||||
struct ar9170_calibration_target_power_ht
|
||||
cal_tgt_pwr_2G_ht20[AR5416_NUM_2G_OFDM_TARGET_PWRS],
|
||||
cal_tgt_pwr_2G_ht40[AR5416_NUM_2G_OFDM_TARGET_PWRS];
|
||||
|
||||
/* conformance testing limits */
|
||||
u8 ctl_index[AR5416_NUM_CTLS];
|
||||
struct ar9170_calctl_data
|
||||
ctl_data[AR5416_NUM_CTLS];
|
||||
|
||||
u8 pad;
|
||||
__le16 subsystem_id;
|
||||
} __packed;
|
||||
|
||||
#endif /* __AR9170_EEPROM_H */
|
|
@ -0,0 +1,417 @@
|
|||
/*
|
||||
* Atheros AR9170 driver
|
||||
*
|
||||
* Hardware-specific definitions
|
||||
*
|
||||
* Copyright 2008, Johannes Berg <johannes@sipsolutions.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, see
|
||||
* http://www.gnu.org/licenses/.
|
||||
*
|
||||
* This file incorporates work covered by the following copyright and
|
||||
* permission notice:
|
||||
* Copyright (c) 2007-2008 Atheros Communications, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifndef __AR9170_HW_H
|
||||
#define __AR9170_HW_H
|
||||
|
||||
#define AR9170_MAX_CMD_LEN 64
|
||||
|
||||
enum ar9170_cmd {
|
||||
AR9170_CMD_RREG = 0x00,
|
||||
AR9170_CMD_WREG = 0x01,
|
||||
AR9170_CMD_RMEM = 0x02,
|
||||
AR9170_CMD_WMEM = 0x03,
|
||||
AR9170_CMD_BITAND = 0x04,
|
||||
AR9170_CMD_BITOR = 0x05,
|
||||
AR9170_CMD_EKEY = 0x28,
|
||||
AR9170_CMD_DKEY = 0x29,
|
||||
AR9170_CMD_FREQUENCY = 0x30,
|
||||
AR9170_CMD_RF_INIT = 0x31,
|
||||
AR9170_CMD_SYNTH = 0x32,
|
||||
AR9170_CMD_FREQ_START = 0x33,
|
||||
AR9170_CMD_ECHO = 0x80,
|
||||
AR9170_CMD_TALLY = 0x81,
|
||||
AR9170_CMD_TALLY_APD = 0x82,
|
||||
AR9170_CMD_CONFIG = 0x83,
|
||||
AR9170_CMD_RESET = 0x90,
|
||||
AR9170_CMD_DKRESET = 0x91,
|
||||
AR9170_CMD_DKTX_STATUS = 0x92,
|
||||
AR9170_CMD_FDC = 0xA0,
|
||||
AR9170_CMD_WREEPROM = 0xB0,
|
||||
AR9170_CMD_WFLASH = 0xB0,
|
||||
AR9170_CMD_FLASH_ERASE = 0xB1,
|
||||
AR9170_CMD_FLASH_PROG = 0xB2,
|
||||
AR9170_CMD_FLASH_CHKSUM = 0xB3,
|
||||
AR9170_CMD_FLASH_READ = 0xB4,
|
||||
AR9170_CMD_FW_DL_INIT = 0xB5,
|
||||
AR9170_CMD_MEM_WREEPROM = 0xBB,
|
||||
};
|
||||
|
||||
/* endpoints */
|
||||
#define AR9170_EP_TX 1
|
||||
#define AR9170_EP_RX 2
|
||||
#define AR9170_EP_IRQ 3
|
||||
#define AR9170_EP_CMD 4
|
||||
|
||||
#define AR9170_EEPROM_START 0x1600
|
||||
|
||||
#define AR9170_GPIO_REG_BASE 0x1d0100
|
||||
#define AR9170_GPIO_REG_PORT_TYPE AR9170_GPIO_REG_BASE
|
||||
#define AR9170_GPIO_REG_DATA (AR9170_GPIO_REG_BASE + 4)
|
||||
#define AR9170_NUM_LEDS 2
|
||||
|
||||
|
||||
#define AR9170_USB_REG_BASE 0x1e1000
|
||||
#define AR9170_USB_REG_DMA_CTL (AR9170_USB_REG_BASE + 0x108)
|
||||
#define AR9170_DMA_CTL_ENABLE_TO_DEVICE 0x1
|
||||
#define AR9170_DMA_CTL_ENABLE_FROM_DEVICE 0x2
|
||||
#define AR9170_DMA_CTL_HIGH_SPEED 0x4
|
||||
#define AR9170_DMA_CTL_PACKET_MODE 0x8
|
||||
|
||||
#define AR9170_USB_REG_MAX_AGG_UPLOAD (AR9170_USB_REG_BASE + 0x110)
|
||||
#define AR9170_USB_REG_UPLOAD_TIME_CTL (AR9170_USB_REG_BASE + 0x114)
|
||||
|
||||
|
||||
|
||||
#define AR9170_MAC_REG_BASE 0x1c3000
|
||||
|
||||
#define AR9170_MAC_REG_TSF_L (AR9170_MAC_REG_BASE + 0x514)
|
||||
#define AR9170_MAC_REG_TSF_H (AR9170_MAC_REG_BASE + 0x518)
|
||||
|
||||
#define AR9170_MAC_REG_ATIM_WINDOW (AR9170_MAC_REG_BASE + 0x51C)
|
||||
#define AR9170_MAC_REG_BCN_PERIOD (AR9170_MAC_REG_BASE + 0x520)
|
||||
#define AR9170_MAC_REG_PRETBTT (AR9170_MAC_REG_BASE + 0x524)
|
||||
|
||||
#define AR9170_MAC_REG_MAC_ADDR_L (AR9170_MAC_REG_BASE + 0x610)
|
||||
#define AR9170_MAC_REG_MAC_ADDR_H (AR9170_MAC_REG_BASE + 0x614)
|
||||
#define AR9170_MAC_REG_BSSID_L (AR9170_MAC_REG_BASE + 0x618)
|
||||
#define AR9170_MAC_REG_BSSID_H (AR9170_MAC_REG_BASE + 0x61c)
|
||||
|
||||
#define AR9170_MAC_REG_GROUP_HASH_TBL_L (AR9170_MAC_REG_BASE + 0x624)
|
||||
#define AR9170_MAC_REG_GROUP_HASH_TBL_H (AR9170_MAC_REG_BASE + 0x628)
|
||||
|
||||
#define AR9170_MAC_REG_RX_TIMEOUT (AR9170_MAC_REG_BASE + 0x62C)
|
||||
|
||||
#define AR9170_MAC_REG_BASIC_RATE (AR9170_MAC_REG_BASE + 0x630)
|
||||
#define AR9170_MAC_REG_MANDATORY_RATE (AR9170_MAC_REG_BASE + 0x634)
|
||||
#define AR9170_MAC_REG_RTS_CTS_RATE (AR9170_MAC_REG_BASE + 0x638)
|
||||
#define AR9170_MAC_REG_BACKOFF_PROTECT (AR9170_MAC_REG_BASE + 0x63c)
|
||||
#define AR9170_MAC_REG_RX_THRESHOLD (AR9170_MAC_REG_BASE + 0x640)
|
||||
#define AR9170_MAC_REG_RX_PE_DELAY (AR9170_MAC_REG_BASE + 0x64C)
|
||||
|
||||
#define AR9170_MAC_REG_DYNAMIC_SIFS_ACK (AR9170_MAC_REG_BASE + 0x658)
|
||||
#define AR9170_MAC_REG_SNIFFER (AR9170_MAC_REG_BASE + 0x674)
|
||||
#define AR9170_MAC_REG_SNIFFER_ENABLE_PROMISC BIT(0)
|
||||
#define AR9170_MAC_REG_SNIFFER_DEFAULTS 0x02000000
|
||||
#define AR9170_MAC_REG_ENCRYPTION (AR9170_MAC_REG_BASE + 0x678)
|
||||
#define AR9170_MAC_REG_ENCRYPTION_RX_SOFTWARE BIT(3)
|
||||
#define AR9170_MAC_REG_ENCRYPTION_DEFAULTS 0x70
|
||||
|
||||
#define AR9170_MAC_REG_MISC_680 (AR9170_MAC_REG_BASE + 0x680)
|
||||
#define AR9170_MAC_REG_TX_UNDERRUN (AR9170_MAC_REG_BASE + 0x688)
|
||||
|
||||
#define AR9170_MAC_REG_FRAMETYPE_FILTER (AR9170_MAC_REG_BASE + 0x68c)
|
||||
#define AR9170_MAC_REG_FTF_ASSOC_REQ BIT(0)
|
||||
#define AR9170_MAC_REG_FTF_ASSOC_RESP BIT(1)
|
||||
#define AR9170_MAC_REG_FTF_REASSOC_REQ BIT(2)
|
||||
#define AR9170_MAC_REG_FTF_REASSOC_RESP BIT(3)
|
||||
#define AR9170_MAC_REG_FTF_PRB_REQ BIT(4)
|
||||
#define AR9170_MAC_REG_FTF_PRB_RESP BIT(5)
|
||||
#define AR9170_MAC_REG_FTF_BIT6 BIT(6)
|
||||
#define AR9170_MAC_REG_FTF_BIT7 BIT(7)
|
||||
#define AR9170_MAC_REG_FTF_BEACON BIT(8)
|
||||
#define AR9170_MAC_REG_FTF_ATIM BIT(9)
|
||||
#define AR9170_MAC_REG_FTF_DEASSOC BIT(10)
|
||||
#define AR9170_MAC_REG_FTF_AUTH BIT(11)
|
||||
#define AR9170_MAC_REG_FTF_DEAUTH BIT(12)
|
||||
#define AR9170_MAC_REG_FTF_BIT13 BIT(13)
|
||||
#define AR9170_MAC_REG_FTF_BIT14 BIT(14)
|
||||
#define AR9170_MAC_REG_FTF_BIT15 BIT(15)
|
||||
#define AR9170_MAC_REG_FTF_BAR BIT(24)
|
||||
#define AR9170_MAC_REG_FTF_BIT25 BIT(25)
|
||||
#define AR9170_MAC_REG_FTF_PSPOLL BIT(26)
|
||||
#define AR9170_MAC_REG_FTF_RTS BIT(27)
|
||||
#define AR9170_MAC_REG_FTF_CTS BIT(28)
|
||||
#define AR9170_MAC_REG_FTF_ACK BIT(29)
|
||||
#define AR9170_MAC_REG_FTF_CFE BIT(30)
|
||||
#define AR9170_MAC_REG_FTF_CFE_ACK BIT(31)
|
||||
#define AR9170_MAC_REG_FTF_DEFAULTS 0x0500ffff
|
||||
#define AR9170_MAC_REG_FTF_MONITOR 0xfd00ffff
|
||||
|
||||
#define AR9170_MAC_REG_RX_TOTAL (AR9170_MAC_REG_BASE + 0x6A0)
|
||||
#define AR9170_MAC_REG_RX_CRC32 (AR9170_MAC_REG_BASE + 0x6A4)
|
||||
#define AR9170_MAC_REG_RX_CRC16 (AR9170_MAC_REG_BASE + 0x6A8)
|
||||
#define AR9170_MAC_REG_RX_ERR_DECRYPTION_UNI (AR9170_MAC_REG_BASE + 0x6AC)
|
||||
#define AR9170_MAC_REG_RX_OVERRUN (AR9170_MAC_REG_BASE + 0x6B0)
|
||||
#define AR9170_MAC_REG_RX_ERR_DECRYPTION_MUL (AR9170_MAC_REG_BASE + 0x6BC)
|
||||
#define AR9170_MAC_REG_TX_RETRY (AR9170_MAC_REG_BASE + 0x6CC)
|
||||
#define AR9170_MAC_REG_TX_TOTAL (AR9170_MAC_REG_BASE + 0x6F4)
|
||||
|
||||
|
||||
#define AR9170_MAC_REG_ACK_EXTENSION (AR9170_MAC_REG_BASE + 0x690)
|
||||
#define AR9170_MAC_REG_EIFS_AND_SIFS (AR9170_MAC_REG_BASE + 0x698)
|
||||
|
||||
#define AR9170_MAC_REG_SLOT_TIME (AR9170_MAC_REG_BASE + 0x6F0)
|
||||
|
||||
#define AR9170_MAC_REG_POWERMANAGEMENT (AR9170_MAC_REG_BASE + 0x700)
|
||||
#define AR9170_MAC_REG_POWERMGT_IBSS 0xe0
|
||||
#define AR9170_MAC_REG_POWERMGT_AP 0xa1
|
||||
#define AR9170_MAC_REG_POWERMGT_STA 0x2
|
||||
#define AR9170_MAC_REG_POWERMGT_AP_WDS 0x3
|
||||
#define AR9170_MAC_REG_POWERMGT_DEFAULTS (0xf << 24)
|
||||
|
||||
#define AR9170_MAC_REG_ROLL_CALL_TBL_L (AR9170_MAC_REG_BASE + 0x704)
|
||||
#define AR9170_MAC_REG_ROLL_CALL_TBL_H (AR9170_MAC_REG_BASE + 0x708)
|
||||
|
||||
#define AR9170_MAC_REG_AC0_CW (AR9170_MAC_REG_BASE + 0xB00)
|
||||
#define AR9170_MAC_REG_AC1_CW (AR9170_MAC_REG_BASE + 0xB04)
|
||||
#define AR9170_MAC_REG_AC2_CW (AR9170_MAC_REG_BASE + 0xB08)
|
||||
#define AR9170_MAC_REG_AC3_CW (AR9170_MAC_REG_BASE + 0xB0C)
|
||||
#define AR9170_MAC_REG_AC4_CW (AR9170_MAC_REG_BASE + 0xB10)
|
||||
#define AR9170_MAC_REG_AC1_AC0_AIFS (AR9170_MAC_REG_BASE + 0xB14)
|
||||
#define AR9170_MAC_REG_AC3_AC2_AIFS (AR9170_MAC_REG_BASE + 0xB18)
|
||||
|
||||
#define AR9170_MAC_REG_RETRY_MAX (AR9170_MAC_REG_BASE + 0xB28)
|
||||
|
||||
#define AR9170_MAC_REG_FCS_SELECT (AR9170_MAC_REG_BASE + 0xBB0)
|
||||
#define AR9170_MAC_FCS_SWFCS 0x1
|
||||
#define AR9170_MAC_FCS_FIFO_PROT 0x4
|
||||
|
||||
|
||||
#define AR9170_MAC_REG_TXOP_NOT_ENOUGH_IND (AR9170_MAC_REG_BASE + 0xB30)
|
||||
|
||||
#define AR9170_MAC_REG_AC1_AC0_TXOP (AR9170_MAC_REG_BASE + 0xB44)
|
||||
#define AR9170_MAC_REG_AC3_AC2_TXOP (AR9170_MAC_REG_BASE + 0xB48)
|
||||
|
||||
#define AR9170_MAC_REG_ACK_TABLE (AR9170_MAC_REG_BASE + 0xC00)
|
||||
#define AR9170_MAC_REG_AMPDU_RX_THRESH (AR9170_MAC_REG_BASE + 0xC50)
|
||||
|
||||
#define AR9170_MAC_REG_TXRX_MPI (AR9170_MAC_REG_BASE + 0xD7C)
|
||||
#define AR9170_MAC_TXRX_MPI_TX_MPI_MASK 0x0000000f
|
||||
#define AR9170_MAC_TXRX_MPI_TX_TO_MASK 0x0000fff0
|
||||
#define AR9170_MAC_TXRX_MPI_RX_MPI_MASK 0x000f0000
|
||||
#define AR9170_MAC_TXRX_MPI_RX_TO_MASK 0xfff00000
|
||||
|
||||
#define AR9170_MAC_REG_BCN_ADDR (AR9170_MAC_REG_BASE + 0xD84)
|
||||
#define AR9170_MAC_REG_BCN_LENGTH (AR9170_MAC_REG_BASE + 0xD88)
|
||||
#define AR9170_MAC_REG_BCN_PLCP (AR9170_MAC_REG_BASE + 0xD90)
|
||||
#define AR9170_MAC_REG_BCN_CTRL (AR9170_MAC_REG_BASE + 0xD94)
|
||||
#define AR9170_MAC_REG_BCN_HT1 (AR9170_MAC_REG_BASE + 0xDA0)
|
||||
#define AR9170_MAC_REG_BCN_HT2 (AR9170_MAC_REG_BASE + 0xDA4)
|
||||
|
||||
|
||||
#define AR9170_PWR_REG_BASE 0x1D4000
|
||||
|
||||
#define AR9170_PWR_REG_CLOCK_SEL (AR9170_PWR_REG_BASE + 0x008)
|
||||
#define AR9170_PWR_CLK_AHB_40MHZ 0
|
||||
#define AR9170_PWR_CLK_AHB_20_22MHZ 1
|
||||
#define AR9170_PWR_CLK_AHB_40_44MHZ 2
|
||||
#define AR9170_PWR_CLK_AHB_80_88MHZ 3
|
||||
#define AR9170_PWR_CLK_DAC_160_INV_DLY 0x70
|
||||
|
||||
|
||||
/* put beacon here in memory */
|
||||
#define AR9170_BEACON_BUFFER_ADDRESS 0x117900
|
||||
|
||||
|
||||
struct ar9170_tx_control {
|
||||
__le16 length;
|
||||
__le16 mac_control;
|
||||
__le32 phy_control;
|
||||
u8 frame_data[0];
|
||||
} __packed;
|
||||
|
||||
/* these are either-or */
|
||||
#define AR9170_TX_MAC_PROT_RTS 0x0001
|
||||
#define AR9170_TX_MAC_PROT_CTS 0x0002
|
||||
|
||||
#define AR9170_TX_MAC_NO_ACK 0x0004
|
||||
/* if unset, MAC will only do SIFS space before frame */
|
||||
#define AR9170_TX_MAC_BACKOFF 0x0008
|
||||
#define AR9170_TX_MAC_BURST 0x0010
|
||||
#define AR9170_TX_MAC_AGGR 0x0020
|
||||
|
||||
/* encryption is a two-bit field */
|
||||
#define AR9170_TX_MAC_ENCR_NONE 0x0000
|
||||
#define AR9170_TX_MAC_ENCR_RC4 0x0040
|
||||
#define AR9170_TX_MAC_ENCR_CENC 0x0080
|
||||
#define AR9170_TX_MAC_ENCR_AES 0x00c0
|
||||
|
||||
#define AR9170_TX_MAC_MMIC 0x0100
|
||||
#define AR9170_TX_MAC_HW_DURATION 0x0200
|
||||
#define AR9170_TX_MAC_QOS_SHIFT 10
|
||||
#define AR9170_TX_MAC_QOS_MASK (3 << AR9170_TX_MAC_QOS_SHIFT)
|
||||
#define AR9170_TX_MAC_AGGR_QOS_BIT1 0x0400
|
||||
#define AR9170_TX_MAC_AGGR_QOS_BIT2 0x0800
|
||||
#define AR9170_TX_MAC_DISABLE_TXOP 0x1000
|
||||
#define AR9170_TX_MAC_TXOP_RIFS 0x2000
|
||||
#define AR9170_TX_MAC_IMM_AMPDU 0x4000
|
||||
#define AR9170_TX_MAC_RATE_PROBE 0x8000
|
||||
|
||||
/* either-or */
|
||||
#define AR9170_TX_PHY_MOD_CCK 0x00000000
|
||||
#define AR9170_TX_PHY_MOD_OFDM 0x00000001
|
||||
#define AR9170_TX_PHY_MOD_HT 0x00000002
|
||||
|
||||
/* depends on modulation */
|
||||
#define AR9170_TX_PHY_SHORT_PREAMBLE 0x00000004
|
||||
#define AR9170_TX_PHY_GREENFIELD 0x00000004
|
||||
|
||||
#define AR9170_TX_PHY_BW_SHIFT 3
|
||||
#define AR9170_TX_PHY_BW_MASK (3 << AR9170_TX_PHY_BW_SHIFT)
|
||||
#define AR9170_TX_PHY_BW_20MHZ 0
|
||||
#define AR9170_TX_PHY_BW_40MHZ 2
|
||||
#define AR9170_TX_PHY_BW_40MHZ_DUP 3
|
||||
|
||||
#define AR9170_TX_PHY_TX_HEAVY_CLIP_SHIFT 6
|
||||
#define AR9170_TX_PHY_TX_HEAVY_CLIP_MASK (7 << AR9170_TX_PHY_TX_HEAVY_CLIP_SHIFT)
|
||||
|
||||
#define AR9170_TX_PHY_TX_PWR_SHIFT 9
|
||||
#define AR9170_TX_PHY_TX_PWR_MASK (0x3f << AR9170_TX_PHY_TX_PWR_SHIFT)
|
||||
|
||||
/* not part of the hw-spec */
|
||||
#define AR9170_TX_PHY_QOS_SHIFT 25
|
||||
#define AR9170_TX_PHY_QOS_MASK (3 << AR9170_TX_PHY_QOS_SHIFT)
|
||||
|
||||
#define AR9170_TX_PHY_TXCHAIN_SHIFT 15
|
||||
#define AR9170_TX_PHY_TXCHAIN_MASK (7 << AR9170_TX_PHY_TXCHAIN_SHIFT)
|
||||
#define AR9170_TX_PHY_TXCHAIN_1 1
|
||||
/* use for cck, ofdm 6/9/12/18/24 and HT if capable */
|
||||
#define AR9170_TX_PHY_TXCHAIN_2 5
|
||||
|
||||
#define AR9170_TX_PHY_MCS_SHIFT 18
|
||||
#define AR9170_TX_PHY_MCS_MASK (0x7f << AR9170_TX_PHY_MCS_SHIFT)
|
||||
|
||||
#define AR9170_TX_PHY_SHORT_GI 0x80000000
|
||||
|
||||
struct ar9170_rx_head {
|
||||
u8 plcp[12];
|
||||
};
|
||||
|
||||
struct ar9170_rx_tail {
|
||||
union {
|
||||
struct {
|
||||
u8 rssi_ant0, rssi_ant1, rssi_ant2,
|
||||
rssi_ant0x, rssi_ant1x, rssi_ant2x,
|
||||
rssi_combined;
|
||||
};
|
||||
u8 rssi[7];
|
||||
};
|
||||
|
||||
u8 evm_stream0[6], evm_stream1[6];
|
||||
u8 phy_err;
|
||||
u8 SAidx, DAidx;
|
||||
u8 error;
|
||||
u8 status;
|
||||
};
|
||||
|
||||
#define AR9170_ENC_ALG_NONE 0x0
|
||||
#define AR9170_ENC_ALG_WEP64 0x1
|
||||
#define AR9170_ENC_ALG_TKIP 0x2
|
||||
#define AR9170_ENC_ALG_AESCCMP 0x4
|
||||
#define AR9170_ENC_ALG_WEP128 0x5
|
||||
#define AR9170_ENC_ALG_WEP256 0x6
|
||||
#define AR9170_ENC_ALG_CENC 0x7
|
||||
|
||||
#define AR9170_RX_ENC_SOFTWARE 0x8
|
||||
|
||||
static inline u8 ar9170_get_decrypt_type(struct ar9170_rx_tail *t)
|
||||
{
|
||||
return (t->SAidx & 0xc0) >> 4 |
|
||||
(t->DAidx & 0xc0) >> 6;
|
||||
}
|
||||
|
||||
#define AR9170_RX_STATUS_MODULATION_MASK 0x03
|
||||
#define AR9170_RX_STATUS_MODULATION_CCK 0x00
|
||||
#define AR9170_RX_STATUS_MODULATION_OFDM 0x01
|
||||
#define AR9170_RX_STATUS_MODULATION_HT 0x02
|
||||
#define AR9170_RX_STATUS_MODULATION_DUPOFDM 0x03
|
||||
|
||||
/* depends on modulation */
|
||||
#define AR9170_RX_STATUS_SHORT_PREAMBLE 0x08
|
||||
#define AR9170_RX_STATUS_GREENFIELD 0x08
|
||||
|
||||
#define AR9170_RX_STATUS_MPDU_MASK 0x30
|
||||
#define AR9170_RX_STATUS_MPDU_SINGLE 0x00
|
||||
#define AR9170_RX_STATUS_MPDU_FIRST 0x10
|
||||
#define AR9170_RX_STATUS_MPDU_MIDDLE 0x20
|
||||
#define AR9170_RX_STATUS_MPDU_LAST 0x30
|
||||
|
||||
|
||||
#define AR9170_RX_ERROR_RXTO 0x01
|
||||
#define AR9170_RX_ERROR_OVERRUN 0x02
|
||||
#define AR9170_RX_ERROR_DECRYPT 0x04
|
||||
#define AR9170_RX_ERROR_FCS 0x08
|
||||
#define AR9170_RX_ERROR_WRONG_RA 0x10
|
||||
#define AR9170_RX_ERROR_PLCP 0x20
|
||||
#define AR9170_RX_ERROR_MMIC 0x40
|
||||
|
||||
struct ar9170_cmd_tx_status {
|
||||
__le16 unkn;
|
||||
u8 dst[ETH_ALEN];
|
||||
__le32 rate;
|
||||
__le16 status;
|
||||
} __packed;
|
||||
|
||||
#define AR9170_TX_STATUS_COMPLETE 0x00
|
||||
#define AR9170_TX_STATUS_RETRY 0x01
|
||||
#define AR9170_TX_STATUS_FAILED 0x02
|
||||
|
||||
struct ar9170_cmd_ba_failed_count {
|
||||
__le16 failed;
|
||||
__le16 rate;
|
||||
} __packed;
|
||||
|
||||
struct ar9170_cmd_response {
|
||||
u8 flag;
|
||||
u8 type;
|
||||
|
||||
union {
|
||||
struct ar9170_cmd_tx_status tx_status;
|
||||
struct ar9170_cmd_ba_failed_count ba_fail_cnt;
|
||||
u8 data[0];
|
||||
};
|
||||
} __packed;
|
||||
|
||||
/* QoS */
|
||||
|
||||
/* mac80211 queue to HW/FW map */
|
||||
static const u8 ar9170_qos_hwmap[4] = { 3, 2, 0, 1 };
|
||||
|
||||
/* HW/FW queue to mac80211 map */
|
||||
static const u8 ar9170_qos_mac80211map[4] = { 2, 3, 1, 0 };
|
||||
|
||||
enum ar9170_txq {
|
||||
AR9170_TXQ_BE,
|
||||
AR9170_TXQ_BK,
|
||||
AR9170_TXQ_VI,
|
||||
AR9170_TXQ_VO,
|
||||
|
||||
__AR9170_NUM_TXQ,
|
||||
};
|
||||
|
||||
#endif /* __AR9170_HW_H */
|
|
@ -0,0 +1,171 @@
|
|||
/*
|
||||
* Atheros AR9170 driver
|
||||
*
|
||||
* LED handling
|
||||
*
|
||||
* Copyright 2008, Johannes Berg <johannes@sipsolutions.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, see
|
||||
* http://www.gnu.org/licenses/.
|
||||
*
|
||||
* This file incorporates work covered by the following copyright and
|
||||
* permission notice:
|
||||
* Copyright (c) 2007-2008 Atheros Communications, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "ar9170.h"
|
||||
#include "cmd.h"
|
||||
|
||||
int ar9170_set_leds_state(struct ar9170 *ar, u32 led_state)
|
||||
{
|
||||
return ar9170_write_reg(ar, AR9170_GPIO_REG_DATA, led_state);
|
||||
}
|
||||
|
||||
int ar9170_init_leds(struct ar9170 *ar)
|
||||
{
|
||||
int err;
|
||||
|
||||
/* disable LEDs */
|
||||
/* GPIO [0/1 mode: output, 2/3: input] */
|
||||
err = ar9170_write_reg(ar, AR9170_GPIO_REG_PORT_TYPE, 3);
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
/* GPIO 0/1 value: off */
|
||||
err = ar9170_set_leds_state(ar, 0);
|
||||
|
||||
out:
|
||||
return err;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_AR9170_LEDS
|
||||
static void ar9170_update_leds(struct work_struct *work)
|
||||
{
|
||||
struct ar9170 *ar = container_of(work, struct ar9170, led_work.work);
|
||||
int i, tmp, blink_delay = 1000;
|
||||
u32 led_val = 0;
|
||||
bool rerun = false;
|
||||
|
||||
if (unlikely(!IS_ACCEPTING_CMD(ar)))
|
||||
return ;
|
||||
|
||||
mutex_lock(&ar->mutex);
|
||||
for (i = 0; i < AR9170_NUM_LEDS; i++)
|
||||
if (ar->leds[i].toggled) {
|
||||
led_val |= 1 << i;
|
||||
|
||||
tmp = 70 + 200 / (ar->leds[i].toggled);
|
||||
if (tmp < blink_delay)
|
||||
blink_delay = tmp;
|
||||
|
||||
if (ar->leds[i].toggled > 1)
|
||||
ar->leds[i].toggled = 0;
|
||||
|
||||
rerun = true;
|
||||
}
|
||||
|
||||
ar9170_set_leds_state(ar, led_val);
|
||||
mutex_unlock(&ar->mutex);
|
||||
|
||||
if (rerun)
|
||||
queue_delayed_work(ar->hw->workqueue, &ar->led_work,
|
||||
msecs_to_jiffies(blink_delay));
|
||||
}
|
||||
|
||||
static void ar9170_led_brightness_set(struct led_classdev *led,
|
||||
enum led_brightness brightness)
|
||||
{
|
||||
struct ar9170_led *arl = container_of(led, struct ar9170_led, l);
|
||||
struct ar9170 *ar = arl->ar;
|
||||
|
||||
arl->toggled++;
|
||||
|
||||
if (likely(IS_ACCEPTING_CMD(ar) && brightness))
|
||||
queue_delayed_work(ar->hw->workqueue, &ar->led_work, HZ/10);
|
||||
}
|
||||
|
||||
static int ar9170_register_led(struct ar9170 *ar, int i, char *name,
|
||||
char *trigger)
|
||||
{
|
||||
int err;
|
||||
|
||||
snprintf(ar->leds[i].name, sizeof(ar->leds[i].name),
|
||||
"ar9170-%s::%s", wiphy_name(ar->hw->wiphy), name);
|
||||
|
||||
ar->leds[i].ar = ar;
|
||||
ar->leds[i].l.name = ar->leds[i].name;
|
||||
ar->leds[i].l.brightness_set = ar9170_led_brightness_set;
|
||||
ar->leds[i].l.brightness = 0;
|
||||
ar->leds[i].l.default_trigger = trigger;
|
||||
|
||||
err = led_classdev_register(wiphy_dev(ar->hw->wiphy),
|
||||
&ar->leds[i].l);
|
||||
if (err)
|
||||
printk(KERN_ERR "%s: failed to register %s LED (%d).\n",
|
||||
wiphy_name(ar->hw->wiphy), ar->leds[i].name, err);
|
||||
else
|
||||
ar->leds[i].registered = true;
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
void ar9170_unregister_leds(struct ar9170 *ar)
|
||||
{
|
||||
int i;
|
||||
|
||||
cancel_delayed_work_sync(&ar->led_work);
|
||||
|
||||
for (i = 0; i < AR9170_NUM_LEDS; i++)
|
||||
if (ar->leds[i].registered) {
|
||||
led_classdev_unregister(&ar->leds[i].l);
|
||||
ar->leds[i].registered = false;
|
||||
}
|
||||
}
|
||||
|
||||
int ar9170_register_leds(struct ar9170 *ar)
|
||||
{
|
||||
int err;
|
||||
|
||||
INIT_DELAYED_WORK(&ar->led_work, ar9170_update_leds);
|
||||
|
||||
err = ar9170_register_led(ar, 0, "tx",
|
||||
ieee80211_get_tx_led_name(ar->hw));
|
||||
if (err)
|
||||
goto fail;
|
||||
|
||||
err = ar9170_register_led(ar, 1, "assoc",
|
||||
ieee80211_get_assoc_led_name(ar->hw));
|
||||
if (err)
|
||||
goto fail;
|
||||
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
ar9170_unregister_leds(ar);
|
||||
return err;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_AR9170_LEDS */
|
|
@ -0,0 +1,452 @@
|
|||
/*
|
||||
* Atheros AR9170 driver
|
||||
*
|
||||
* MAC programming
|
||||
*
|
||||
* Copyright 2008, Johannes Berg <johannes@sipsolutions.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, see
|
||||
* http://www.gnu.org/licenses/.
|
||||
*
|
||||
* This file incorporates work covered by the following copyright and
|
||||
* permission notice:
|
||||
* Copyright (c) 2007-2008 Atheros Communications, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#include "ar9170.h"
|
||||
#include "cmd.h"
|
||||
|
||||
int ar9170_set_qos(struct ar9170 *ar)
|
||||
{
|
||||
ar9170_regwrite_begin(ar);
|
||||
|
||||
ar9170_regwrite(AR9170_MAC_REG_AC0_CW, ar->edcf[0].cw_min |
|
||||
(ar->edcf[0].cw_max << 16));
|
||||
ar9170_regwrite(AR9170_MAC_REG_AC1_CW, ar->edcf[1].cw_min |
|
||||
(ar->edcf[1].cw_max << 16));
|
||||
ar9170_regwrite(AR9170_MAC_REG_AC2_CW, ar->edcf[2].cw_min |
|
||||
(ar->edcf[2].cw_max << 16));
|
||||
ar9170_regwrite(AR9170_MAC_REG_AC3_CW, ar->edcf[3].cw_min |
|
||||
(ar->edcf[3].cw_max << 16));
|
||||
ar9170_regwrite(AR9170_MAC_REG_AC4_CW, ar->edcf[4].cw_min |
|
||||
(ar->edcf[4].cw_max << 16));
|
||||
|
||||
ar9170_regwrite(AR9170_MAC_REG_AC1_AC0_AIFS,
|
||||
((ar->edcf[0].aifs * 9 + 10)) |
|
||||
((ar->edcf[1].aifs * 9 + 10) << 12) |
|
||||
((ar->edcf[2].aifs * 9 + 10) << 24));
|
||||
ar9170_regwrite(AR9170_MAC_REG_AC3_AC2_AIFS,
|
||||
((ar->edcf[2].aifs * 9 + 10) >> 8) |
|
||||
((ar->edcf[3].aifs * 9 + 10) << 4) |
|
||||
((ar->edcf[4].aifs * 9 + 10) << 16));
|
||||
|
||||
ar9170_regwrite(AR9170_MAC_REG_AC1_AC0_TXOP,
|
||||
ar->edcf[0].txop | ar->edcf[1].txop << 16);
|
||||
ar9170_regwrite(AR9170_MAC_REG_AC3_AC2_TXOP,
|
||||
ar->edcf[1].txop | ar->edcf[3].txop << 16);
|
||||
|
||||
ar9170_regwrite_finish();
|
||||
|
||||
return ar9170_regwrite_result();
|
||||
}
|
||||
|
||||
int ar9170_init_mac(struct ar9170 *ar)
|
||||
{
|
||||
ar9170_regwrite_begin(ar);
|
||||
|
||||
ar9170_regwrite(AR9170_MAC_REG_ACK_EXTENSION, 0x40);
|
||||
|
||||
ar9170_regwrite(AR9170_MAC_REG_RETRY_MAX, 0);
|
||||
|
||||
/* enable MMIC */
|
||||
ar9170_regwrite(AR9170_MAC_REG_SNIFFER,
|
||||
AR9170_MAC_REG_SNIFFER_DEFAULTS);
|
||||
|
||||
ar9170_regwrite(AR9170_MAC_REG_RX_THRESHOLD, 0xc1f80);
|
||||
|
||||
ar9170_regwrite(AR9170_MAC_REG_RX_PE_DELAY, 0x70);
|
||||
ar9170_regwrite(AR9170_MAC_REG_EIFS_AND_SIFS, 0xa144000);
|
||||
ar9170_regwrite(AR9170_MAC_REG_SLOT_TIME, 9 << 10);
|
||||
|
||||
/* CF-END mode */
|
||||
ar9170_regwrite(0x1c3b2c, 0x19000000);
|
||||
|
||||
/* NAV protects ACK only (in TXOP) */
|
||||
ar9170_regwrite(0x1c3b38, 0x201);
|
||||
|
||||
/* Set Beacon PHY CTRL's TPC to 0x7, TA1=1 */
|
||||
/* OTUS set AM to 0x1 */
|
||||
ar9170_regwrite(AR9170_MAC_REG_BCN_HT1, 0x8000170);
|
||||
|
||||
ar9170_regwrite(AR9170_MAC_REG_BACKOFF_PROTECT, 0x105);
|
||||
|
||||
/* AGG test code*/
|
||||
/* Aggregation MAX number and timeout */
|
||||
ar9170_regwrite(0x1c3b9c, 0x10000a);
|
||||
|
||||
ar9170_regwrite(AR9170_MAC_REG_FRAMETYPE_FILTER,
|
||||
AR9170_MAC_REG_FTF_DEFAULTS);
|
||||
|
||||
/* Enable deaggregator, response in sniffer mode */
|
||||
ar9170_regwrite(0x1c3c40, 0x1 | 1<<30);
|
||||
|
||||
/* rate sets */
|
||||
ar9170_regwrite(AR9170_MAC_REG_BASIC_RATE, 0x150f);
|
||||
ar9170_regwrite(AR9170_MAC_REG_MANDATORY_RATE, 0x150f);
|
||||
ar9170_regwrite(AR9170_MAC_REG_RTS_CTS_RATE, 0x10b01bb);
|
||||
|
||||
/* MIMO response control */
|
||||
ar9170_regwrite(0x1c3694, 0x4003C1E);/* bit 26~28 otus-AM */
|
||||
|
||||
/* switch MAC to OTUS interface */
|
||||
ar9170_regwrite(0x1c3600, 0x3);
|
||||
|
||||
ar9170_regwrite(AR9170_MAC_REG_AMPDU_RX_THRESH, 0xffff);
|
||||
|
||||
/* set PHY register read timeout (??) */
|
||||
ar9170_regwrite(AR9170_MAC_REG_MISC_680, 0xf00008);
|
||||
|
||||
/* Disable Rx TimeOut, workaround for BB. */
|
||||
ar9170_regwrite(AR9170_MAC_REG_RX_TIMEOUT, 0x0);
|
||||
|
||||
/* Set CPU clock frequency to 88/80MHz */
|
||||
ar9170_regwrite(AR9170_PWR_REG_CLOCK_SEL,
|
||||
AR9170_PWR_CLK_AHB_80_88MHZ |
|
||||
AR9170_PWR_CLK_DAC_160_INV_DLY);
|
||||
|
||||
/* Set WLAN DMA interrupt mode: generate int per packet */
|
||||
ar9170_regwrite(AR9170_MAC_REG_TXRX_MPI, 0x110011);
|
||||
|
||||
ar9170_regwrite(AR9170_MAC_REG_FCS_SELECT,
|
||||
AR9170_MAC_FCS_FIFO_PROT);
|
||||
|
||||
/* Disables the CF_END frame, undocumented register */
|
||||
ar9170_regwrite(AR9170_MAC_REG_TXOP_NOT_ENOUGH_IND,
|
||||
0x141E0F48);
|
||||
|
||||
ar9170_regwrite_finish();
|
||||
|
||||
return ar9170_regwrite_result();
|
||||
}
|
||||
|
||||
static int ar9170_set_mac_reg(struct ar9170 *ar, const u32 reg, const u8 *mac)
|
||||
{
|
||||
static const u8 zero[ETH_ALEN] = { 0 };
|
||||
|
||||
if (!mac)
|
||||
mac = zero;
|
||||
|
||||
ar9170_regwrite_begin(ar);
|
||||
|
||||
ar9170_regwrite(reg,
|
||||
(mac[3] << 24) | (mac[2] << 16) |
|
||||
(mac[1] << 8) | mac[0]);
|
||||
|
||||
ar9170_regwrite(reg + 4, (mac[5] << 8) | mac[4]);
|
||||
|
||||
ar9170_regwrite_finish();
|
||||
|
||||
return ar9170_regwrite_result();
|
||||
}
|
||||
|
||||
int ar9170_update_multicast(struct ar9170 *ar)
|
||||
{
|
||||
int err;
|
||||
|
||||
ar9170_regwrite_begin(ar);
|
||||
ar9170_regwrite(AR9170_MAC_REG_GROUP_HASH_TBL_H,
|
||||
ar->want_mc_hash >> 32);
|
||||
ar9170_regwrite(AR9170_MAC_REG_GROUP_HASH_TBL_L,
|
||||
ar->want_mc_hash);
|
||||
|
||||
ar9170_regwrite_finish();
|
||||
err = ar9170_regwrite_result();
|
||||
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
ar->cur_mc_hash = ar->want_mc_hash;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ar9170_update_frame_filter(struct ar9170 *ar)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = ar9170_write_reg(ar, AR9170_MAC_REG_FRAMETYPE_FILTER,
|
||||
ar->want_filter);
|
||||
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
ar->cur_filter = ar->want_filter;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ar9170_set_promiscouous(struct ar9170 *ar)
|
||||
{
|
||||
u32 encr_mode, sniffer;
|
||||
int err;
|
||||
|
||||
err = ar9170_read_reg(ar, AR9170_MAC_REG_SNIFFER, &sniffer);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
err = ar9170_read_reg(ar, AR9170_MAC_REG_ENCRYPTION, &encr_mode);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
if (ar->sniffer_enabled) {
|
||||
sniffer |= AR9170_MAC_REG_SNIFFER_ENABLE_PROMISC;
|
||||
|
||||
/*
|
||||
* Rx decryption works in place.
|
||||
*
|
||||
* If we don't disable it, the hardware will render all
|
||||
* encrypted frames which are encrypted with an unknown
|
||||
* key useless.
|
||||
*/
|
||||
|
||||
encr_mode |= AR9170_MAC_REG_ENCRYPTION_RX_SOFTWARE;
|
||||
ar->sniffer_enabled = true;
|
||||
} else {
|
||||
sniffer &= ~AR9170_MAC_REG_SNIFFER_ENABLE_PROMISC;
|
||||
|
||||
if (ar->rx_software_decryption)
|
||||
encr_mode |= AR9170_MAC_REG_ENCRYPTION_RX_SOFTWARE;
|
||||
else
|
||||
encr_mode &= ~AR9170_MAC_REG_ENCRYPTION_RX_SOFTWARE;
|
||||
}
|
||||
|
||||
ar9170_regwrite_begin(ar);
|
||||
ar9170_regwrite(AR9170_MAC_REG_ENCRYPTION, encr_mode);
|
||||
ar9170_regwrite(AR9170_MAC_REG_SNIFFER, sniffer);
|
||||
ar9170_regwrite_finish();
|
||||
|
||||
return ar9170_regwrite_result();
|
||||
}
|
||||
|
||||
int ar9170_set_operating_mode(struct ar9170 *ar)
|
||||
{
|
||||
u32 pm_mode = AR9170_MAC_REG_POWERMGT_DEFAULTS;
|
||||
u8 *mac_addr, *bssid;
|
||||
int err;
|
||||
|
||||
if (ar->vif) {
|
||||
mac_addr = ar->mac_addr;
|
||||
bssid = ar->bssid;
|
||||
|
||||
switch (ar->vif->type) {
|
||||
case NL80211_IFTYPE_MESH_POINT:
|
||||
case NL80211_IFTYPE_ADHOC:
|
||||
pm_mode |= AR9170_MAC_REG_POWERMGT_IBSS;
|
||||
break;
|
||||
/* case NL80211_IFTYPE_AP:
|
||||
pm_mode |= AR9170_MAC_REG_POWERMGT_AP;
|
||||
break;*/
|
||||
case NL80211_IFTYPE_WDS:
|
||||
pm_mode |= AR9170_MAC_REG_POWERMGT_AP_WDS;
|
||||
break;
|
||||
case NL80211_IFTYPE_MONITOR:
|
||||
ar->sniffer_enabled = true;
|
||||
ar->rx_software_decryption = true;
|
||||
break;
|
||||
default:
|
||||
pm_mode |= AR9170_MAC_REG_POWERMGT_STA;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
mac_addr = NULL;
|
||||
bssid = NULL;
|
||||
}
|
||||
|
||||
err = ar9170_set_mac_reg(ar, AR9170_MAC_REG_MAC_ADDR_L, mac_addr);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
err = ar9170_set_mac_reg(ar, AR9170_MAC_REG_BSSID_L, bssid);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
err = ar9170_set_promiscouous(ar);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
ar9170_regwrite_begin(ar);
|
||||
|
||||
ar9170_regwrite(AR9170_MAC_REG_POWERMANAGEMENT, pm_mode);
|
||||
ar9170_regwrite_finish();
|
||||
|
||||
return ar9170_regwrite_result();
|
||||
}
|
||||
|
||||
int ar9170_set_hwretry_limit(struct ar9170 *ar, unsigned int max_retry)
|
||||
{
|
||||
u32 tmp = min_t(u32, 0x33333, max_retry * 0x11111);
|
||||
|
||||
return ar9170_write_reg(ar, AR9170_MAC_REG_RETRY_MAX, tmp);
|
||||
}
|
||||
|
||||
int ar9170_set_beacon_timers(struct ar9170 *ar)
|
||||
{
|
||||
u32 v = 0;
|
||||
u32 pretbtt = 0;
|
||||
|
||||
v |= ar->hw->conf.beacon_int;
|
||||
|
||||
if (ar->vif) {
|
||||
switch (ar->vif->type) {
|
||||
case NL80211_IFTYPE_MESH_POINT:
|
||||
case NL80211_IFTYPE_ADHOC:
|
||||
v |= BIT(25);
|
||||
break;
|
||||
case NL80211_IFTYPE_AP:
|
||||
v |= BIT(24);
|
||||
pretbtt = (ar->hw->conf.beacon_int - 6) << 16;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
v |= ar->vif->bss_conf.dtim_period << 16;
|
||||
}
|
||||
|
||||
ar9170_regwrite_begin(ar);
|
||||
|
||||
ar9170_regwrite(AR9170_MAC_REG_PRETBTT, pretbtt);
|
||||
ar9170_regwrite(AR9170_MAC_REG_BCN_PERIOD, v);
|
||||
ar9170_regwrite_finish();
|
||||
return ar9170_regwrite_result();
|
||||
}
|
||||
|
||||
int ar9170_update_beacon(struct ar9170 *ar)
|
||||
{
|
||||
struct sk_buff *skb;
|
||||
__le32 *data, *old = NULL;
|
||||
u32 word;
|
||||
int i;
|
||||
|
||||
skb = ieee80211_beacon_get(ar->hw, ar->vif);
|
||||
if (!skb)
|
||||
return -ENOMEM;
|
||||
|
||||
data = (__le32 *)skb->data;
|
||||
if (ar->beacon)
|
||||
old = (__le32 *)ar->beacon->data;
|
||||
|
||||
ar9170_regwrite_begin(ar);
|
||||
for (i = 0; i < DIV_ROUND_UP(skb->len, 4); i++) {
|
||||
/*
|
||||
* XXX: This accesses beyond skb data for up
|
||||
* to the last 3 bytes!!
|
||||
*/
|
||||
|
||||
if (old && (data[i] == old[i]))
|
||||
continue;
|
||||
|
||||
word = le32_to_cpu(data[i]);
|
||||
ar9170_regwrite(AR9170_BEACON_BUFFER_ADDRESS + 4 * i, word);
|
||||
}
|
||||
|
||||
/* XXX: use skb->cb info */
|
||||
if (ar->hw->conf.channel->band == IEEE80211_BAND_2GHZ)
|
||||
ar9170_regwrite(AR9170_MAC_REG_BCN_PLCP,
|
||||
((skb->len + 4) << (3+16)) + 0x0400);
|
||||
else
|
||||
ar9170_regwrite(AR9170_MAC_REG_BCN_PLCP,
|
||||
((skb->len + 4) << (3+16)) + 0x0400);
|
||||
|
||||
ar9170_regwrite(AR9170_MAC_REG_BCN_LENGTH, skb->len + 4);
|
||||
ar9170_regwrite(AR9170_MAC_REG_BCN_ADDR, AR9170_BEACON_BUFFER_ADDRESS);
|
||||
ar9170_regwrite(AR9170_MAC_REG_BCN_CTRL, 1);
|
||||
|
||||
ar9170_regwrite_finish();
|
||||
|
||||
dev_kfree_skb(ar->beacon);
|
||||
ar->beacon = skb;
|
||||
|
||||
return ar9170_regwrite_result();
|
||||
}
|
||||
|
||||
void ar9170_new_beacon(struct work_struct *work)
|
||||
{
|
||||
struct ar9170 *ar = container_of(work, struct ar9170,
|
||||
beacon_work);
|
||||
struct sk_buff *skb;
|
||||
|
||||
if (unlikely(!IS_STARTED(ar)))
|
||||
return ;
|
||||
|
||||
mutex_lock(&ar->mutex);
|
||||
|
||||
if (!ar->vif)
|
||||
goto out;
|
||||
|
||||
ar9170_update_beacon(ar);
|
||||
|
||||
rcu_read_lock();
|
||||
while ((skb = ieee80211_get_buffered_bc(ar->hw, ar->vif)))
|
||||
ar9170_op_tx(ar->hw, skb);
|
||||
|
||||
rcu_read_unlock();
|
||||
|
||||
out:
|
||||
mutex_unlock(&ar->mutex);
|
||||
}
|
||||
|
||||
int ar9170_upload_key(struct ar9170 *ar, u8 id, const u8 *mac, u8 ktype,
|
||||
u8 keyidx, u8 *keydata, int keylen)
|
||||
{
|
||||
__le32 vals[7];
|
||||
static const u8 bcast[ETH_ALEN] =
|
||||
{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
|
||||
u8 dummy;
|
||||
|
||||
mac = mac ? : bcast;
|
||||
|
||||
vals[0] = cpu_to_le32((keyidx << 16) + id);
|
||||
vals[1] = cpu_to_le32(mac[1] << 24 | mac[0] << 16 | ktype);
|
||||
vals[2] = cpu_to_le32(mac[5] << 24 | mac[4] << 16 |
|
||||
mac[3] << 8 | mac[2]);
|
||||
memset(&vals[3], 0, 16);
|
||||
if (keydata)
|
||||
memcpy(&vals[3], keydata, keylen);
|
||||
|
||||
return ar->exec_cmd(ar, AR9170_CMD_EKEY,
|
||||
sizeof(vals), (u8 *)vals,
|
||||
1, &dummy);
|
||||
}
|
||||
|
||||
int ar9170_disable_key(struct ar9170 *ar, u8 id)
|
||||
{
|
||||
__le32 val = cpu_to_le32(id);
|
||||
u8 dummy;
|
||||
|
||||
return ar->exec_cmd(ar, AR9170_CMD_EKEY,
|
||||
sizeof(val), (u8 *)&val,
|
||||
1, &dummy);
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,748 @@
|
|||
/*
|
||||
* Atheros AR9170 driver
|
||||
*
|
||||
* USB - frontend
|
||||
*
|
||||
* Copyright 2008, Johannes Berg <johannes@sipsolutions.net>
|
||||
* Copyright 2009, Christian Lamparter <chunkeey@web.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, see
|
||||
* http://www.gnu.org/licenses/.
|
||||
*
|
||||
* This file incorporates work covered by the following copyright and
|
||||
* permission notice:
|
||||
* Copyright (c) 2007-2008 Atheros Communications, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/usb.h>
|
||||
#include <linux/firmware.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <net/mac80211.h>
|
||||
#include "ar9170.h"
|
||||
#include "cmd.h"
|
||||
#include "hw.h"
|
||||
#include "usb.h"
|
||||
|
||||
MODULE_AUTHOR("Johannes Berg <johannes@sipsolutions.net>");
|
||||
MODULE_AUTHOR("Christian Lamparter <chunkeey@web.de>");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_DESCRIPTION("Atheros AR9170 802.11n USB wireless");
|
||||
MODULE_FIRMWARE("ar9170-1.fw");
|
||||
MODULE_FIRMWARE("ar9170-2.fw");
|
||||
|
||||
static struct usb_device_id ar9170_usb_ids[] = {
|
||||
/* Atheros 9170 */
|
||||
{ USB_DEVICE(0x0cf3, 0x9170) },
|
||||
/* Atheros TG121N */
|
||||
{ USB_DEVICE(0x0cf3, 0x1001) },
|
||||
/* D-Link DWA 160A */
|
||||
{ USB_DEVICE(0x07d1, 0x3c10) },
|
||||
/* Netgear WNDA3100 */
|
||||
{ USB_DEVICE(0x0846, 0x9010) },
|
||||
/* Netgear WN111 v2 */
|
||||
{ USB_DEVICE(0x0846, 0x9001) },
|
||||
/* Zydas ZD1221 */
|
||||
{ USB_DEVICE(0x0ace, 0x1221) },
|
||||
/* Z-Com UB81 BG */
|
||||
{ USB_DEVICE(0x0cde, 0x0023) },
|
||||
/* Z-Com UB82 ABG */
|
||||
{ USB_DEVICE(0x0cde, 0x0026) },
|
||||
/* Arcadyan WN7512 */
|
||||
{ USB_DEVICE(0x083a, 0xf522) },
|
||||
/* Planex GWUS300 */
|
||||
{ USB_DEVICE(0x2019, 0x5304) },
|
||||
/* IO-Data WNGDNUS2 */
|
||||
{ USB_DEVICE(0x04bb, 0x093f) },
|
||||
|
||||
/* terminate */
|
||||
{}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(usb, ar9170_usb_ids);
|
||||
|
||||
static void ar9170_usb_tx_urb_complete_free(struct urb *urb)
|
||||
{
|
||||
struct sk_buff *skb = urb->context;
|
||||
struct ar9170_usb *aru = (struct ar9170_usb *)
|
||||
usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0));
|
||||
|
||||
if (!aru) {
|
||||
dev_kfree_skb_irq(skb);
|
||||
return ;
|
||||
}
|
||||
|
||||
ar9170_handle_tx_status(&aru->common, skb, false,
|
||||
AR9170_TX_STATUS_COMPLETE);
|
||||
}
|
||||
|
||||
static void ar9170_usb_tx_urb_complete(struct urb *urb)
|
||||
{
|
||||
}
|
||||
|
||||
static void ar9170_usb_irq_completed(struct urb *urb)
|
||||
{
|
||||
struct ar9170_usb *aru = urb->context;
|
||||
|
||||
switch (urb->status) {
|
||||
/* everything is fine */
|
||||
case 0:
|
||||
break;
|
||||
|
||||
/* disconnect */
|
||||
case -ENOENT:
|
||||
case -ECONNRESET:
|
||||
case -ENODEV:
|
||||
case -ESHUTDOWN:
|
||||
goto free;
|
||||
|
||||
default:
|
||||
goto resubmit;
|
||||
}
|
||||
|
||||
print_hex_dump_bytes("ar9170 irq: ", DUMP_PREFIX_OFFSET,
|
||||
urb->transfer_buffer, urb->actual_length);
|
||||
|
||||
resubmit:
|
||||
usb_anchor_urb(urb, &aru->rx_submitted);
|
||||
if (usb_submit_urb(urb, GFP_ATOMIC)) {
|
||||
usb_unanchor_urb(urb);
|
||||
goto free;
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
free:
|
||||
usb_buffer_free(aru->udev, 64, urb->transfer_buffer, urb->transfer_dma);
|
||||
}
|
||||
|
||||
static void ar9170_usb_rx_completed(struct urb *urb)
|
||||
{
|
||||
struct sk_buff *skb = urb->context;
|
||||
struct ar9170_usb *aru = (struct ar9170_usb *)
|
||||
usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0));
|
||||
int err;
|
||||
|
||||
if (!aru)
|
||||
goto free;
|
||||
|
||||
switch (urb->status) {
|
||||
/* everything is fine */
|
||||
case 0:
|
||||
break;
|
||||
|
||||
/* disconnect */
|
||||
case -ENOENT:
|
||||
case -ECONNRESET:
|
||||
case -ENODEV:
|
||||
case -ESHUTDOWN:
|
||||
goto free;
|
||||
|
||||
default:
|
||||
goto resubmit;
|
||||
}
|
||||
|
||||
skb_put(skb, urb->actual_length);
|
||||
ar9170_rx(&aru->common, skb);
|
||||
|
||||
resubmit:
|
||||
skb_reset_tail_pointer(skb);
|
||||
skb_trim(skb, 0);
|
||||
|
||||
usb_anchor_urb(urb, &aru->rx_submitted);
|
||||
err = usb_submit_urb(urb, GFP_ATOMIC);
|
||||
if (err) {
|
||||
usb_unanchor_urb(urb);
|
||||
dev_kfree_skb_irq(skb);
|
||||
}
|
||||
|
||||
return ;
|
||||
|
||||
free:
|
||||
dev_kfree_skb_irq(skb);
|
||||
return;
|
||||
}
|
||||
|
||||
static int ar9170_usb_prep_rx_urb(struct ar9170_usb *aru,
|
||||
struct urb *urb, gfp_t gfp)
|
||||
{
|
||||
struct sk_buff *skb;
|
||||
|
||||
skb = __dev_alloc_skb(AR9170_MAX_RX_BUFFER_SIZE + 32, gfp);
|
||||
if (!skb)
|
||||
return -ENOMEM;
|
||||
|
||||
/* reserve some space for mac80211's radiotap */
|
||||
skb_reserve(skb, 32);
|
||||
|
||||
usb_fill_bulk_urb(urb, aru->udev,
|
||||
usb_rcvbulkpipe(aru->udev, AR9170_EP_RX),
|
||||
skb->data, min(skb_tailroom(skb),
|
||||
AR9170_MAX_RX_BUFFER_SIZE),
|
||||
ar9170_usb_rx_completed, skb);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ar9170_usb_alloc_rx_irq_urb(struct ar9170_usb *aru)
|
||||
{
|
||||
struct urb *urb = NULL;
|
||||
void *ibuf;
|
||||
int err = -ENOMEM;
|
||||
|
||||
/* initialize interrupt endpoint */
|
||||
urb = usb_alloc_urb(0, GFP_KERNEL);
|
||||
if (!urb)
|
||||
goto out;
|
||||
|
||||
ibuf = usb_buffer_alloc(aru->udev, 64, GFP_KERNEL, &urb->transfer_dma);
|
||||
if (!ibuf)
|
||||
goto out;
|
||||
|
||||
usb_fill_int_urb(urb, aru->udev,
|
||||
usb_rcvintpipe(aru->udev, AR9170_EP_IRQ), ibuf,
|
||||
64, ar9170_usb_irq_completed, aru, 1);
|
||||
urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
|
||||
|
||||
usb_anchor_urb(urb, &aru->rx_submitted);
|
||||
err = usb_submit_urb(urb, GFP_KERNEL);
|
||||
if (err) {
|
||||
usb_unanchor_urb(urb);
|
||||
usb_buffer_free(aru->udev, 64, urb->transfer_buffer,
|
||||
urb->transfer_dma);
|
||||
}
|
||||
|
||||
out:
|
||||
usb_free_urb(urb);
|
||||
return err;
|
||||
}
|
||||
|
||||
static int ar9170_usb_alloc_rx_bulk_urbs(struct ar9170_usb *aru)
|
||||
{
|
||||
struct urb *urb;
|
||||
int i;
|
||||
int err = -EINVAL;
|
||||
|
||||
for (i = 0; i < AR9170_NUM_RX_URBS; i++) {
|
||||
err = -ENOMEM;
|
||||
urb = usb_alloc_urb(0, GFP_KERNEL);
|
||||
if (!urb)
|
||||
goto err_out;
|
||||
|
||||
err = ar9170_usb_prep_rx_urb(aru, urb, GFP_KERNEL);
|
||||
if (err) {
|
||||
usb_free_urb(urb);
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
usb_anchor_urb(urb, &aru->rx_submitted);
|
||||
err = usb_submit_urb(urb, GFP_KERNEL);
|
||||
if (err) {
|
||||
usb_unanchor_urb(urb);
|
||||
dev_kfree_skb_any((void *) urb->transfer_buffer);
|
||||
usb_free_urb(urb);
|
||||
goto err_out;
|
||||
}
|
||||
usb_free_urb(urb);
|
||||
}
|
||||
|
||||
/* the device now waiting for a firmware. */
|
||||
aru->common.state = AR9170_IDLE;
|
||||
return 0;
|
||||
|
||||
err_out:
|
||||
|
||||
usb_kill_anchored_urbs(&aru->rx_submitted);
|
||||
return err;
|
||||
}
|
||||
|
||||
static void ar9170_usb_cancel_urbs(struct ar9170_usb *aru)
|
||||
{
|
||||
int ret;
|
||||
|
||||
aru->common.state = AR9170_UNKNOWN_STATE;
|
||||
|
||||
usb_unlink_anchored_urbs(&aru->tx_submitted);
|
||||
|
||||
/* give the LED OFF command and the deauth frame a chance to air. */
|
||||
ret = usb_wait_anchor_empty_timeout(&aru->tx_submitted,
|
||||
msecs_to_jiffies(100));
|
||||
if (ret == 0)
|
||||
dev_err(&aru->udev->dev, "kill pending tx urbs.\n");
|
||||
usb_poison_anchored_urbs(&aru->tx_submitted);
|
||||
|
||||
usb_poison_anchored_urbs(&aru->rx_submitted);
|
||||
}
|
||||
|
||||
static int ar9170_usb_exec_cmd(struct ar9170 *ar, enum ar9170_cmd cmd,
|
||||
unsigned int plen, void *payload,
|
||||
unsigned int outlen, void *out)
|
||||
{
|
||||
struct ar9170_usb *aru = (void *) ar;
|
||||
struct urb *urb = NULL;
|
||||
unsigned long flags;
|
||||
int err = -ENOMEM;
|
||||
|
||||
if (unlikely(!IS_ACCEPTING_CMD(ar)))
|
||||
return -EPERM;
|
||||
|
||||
if (WARN_ON(plen > AR9170_MAX_CMD_LEN - 4))
|
||||
return -EINVAL;
|
||||
|
||||
urb = usb_alloc_urb(0, GFP_ATOMIC);
|
||||
if (unlikely(!urb))
|
||||
goto err_free;
|
||||
|
||||
ar->cmdbuf[0] = cpu_to_le32(plen);
|
||||
ar->cmdbuf[0] |= cpu_to_le32(cmd << 8);
|
||||
/* writing multiple regs fills this buffer already */
|
||||
if (plen && payload != (u8 *)(&ar->cmdbuf[1]))
|
||||
memcpy(&ar->cmdbuf[1], payload, plen);
|
||||
|
||||
spin_lock_irqsave(&aru->common.cmdlock, flags);
|
||||
aru->readbuf = (u8 *)out;
|
||||
aru->readlen = outlen;
|
||||
spin_unlock_irqrestore(&aru->common.cmdlock, flags);
|
||||
|
||||
usb_fill_int_urb(urb, aru->udev,
|
||||
usb_sndbulkpipe(aru->udev, AR9170_EP_CMD),
|
||||
aru->common.cmdbuf, plen + 4,
|
||||
ar9170_usb_tx_urb_complete, NULL, 1);
|
||||
|
||||
usb_anchor_urb(urb, &aru->tx_submitted);
|
||||
err = usb_submit_urb(urb, GFP_ATOMIC);
|
||||
if (err) {
|
||||
usb_unanchor_urb(urb);
|
||||
usb_free_urb(urb);
|
||||
goto err_unbuf;
|
||||
}
|
||||
usb_free_urb(urb);
|
||||
|
||||
err = wait_for_completion_timeout(&aru->cmd_wait, HZ);
|
||||
if (err == 0) {
|
||||
err = -ETIMEDOUT;
|
||||
goto err_unbuf;
|
||||
}
|
||||
|
||||
if (outlen >= 0 && aru->readlen != outlen) {
|
||||
err = -EMSGSIZE;
|
||||
goto err_unbuf;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
err_unbuf:
|
||||
/* Maybe the device was removed in the second we were waiting? */
|
||||
if (IS_STARTED(ar)) {
|
||||
dev_err(&aru->udev->dev, "no command feedback "
|
||||
"received (%d).\n", err);
|
||||
|
||||
/* provide some maybe useful debug information */
|
||||
print_hex_dump_bytes("ar9170 cmd: ", DUMP_PREFIX_NONE,
|
||||
aru->common.cmdbuf, plen + 4);
|
||||
dump_stack();
|
||||
}
|
||||
|
||||
/* invalidate to avoid completing the next prematurely */
|
||||
spin_lock_irqsave(&aru->common.cmdlock, flags);
|
||||
aru->readbuf = NULL;
|
||||
aru->readlen = 0;
|
||||
spin_unlock_irqrestore(&aru->common.cmdlock, flags);
|
||||
|
||||
err_free:
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static int ar9170_usb_tx(struct ar9170 *ar, struct sk_buff *skb,
|
||||
bool txstatus_needed, unsigned int extra_len)
|
||||
{
|
||||
struct ar9170_usb *aru = (struct ar9170_usb *) ar;
|
||||
struct urb *urb;
|
||||
int err;
|
||||
|
||||
if (unlikely(!IS_STARTED(ar))) {
|
||||
/* Seriously, what were you drink... err... thinking!? */
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
urb = usb_alloc_urb(0, GFP_ATOMIC);
|
||||
if (unlikely(!urb))
|
||||
return -ENOMEM;
|
||||
|
||||
usb_fill_bulk_urb(urb, aru->udev,
|
||||
usb_sndbulkpipe(aru->udev, AR9170_EP_TX),
|
||||
skb->data, skb->len + extra_len, (txstatus_needed ?
|
||||
ar9170_usb_tx_urb_complete :
|
||||
ar9170_usb_tx_urb_complete_free), skb);
|
||||
urb->transfer_flags |= URB_ZERO_PACKET;
|
||||
|
||||
usb_anchor_urb(urb, &aru->tx_submitted);
|
||||
err = usb_submit_urb(urb, GFP_ATOMIC);
|
||||
if (unlikely(err))
|
||||
usb_unanchor_urb(urb);
|
||||
|
||||
usb_free_urb(urb);
|
||||
return err;
|
||||
}
|
||||
|
||||
static void ar9170_usb_callback_cmd(struct ar9170 *ar, u32 len , void *buffer)
|
||||
{
|
||||
struct ar9170_usb *aru = (void *) ar;
|
||||
unsigned long flags;
|
||||
u32 in, out;
|
||||
|
||||
if (!buffer)
|
||||
return ;
|
||||
|
||||
in = le32_to_cpup((__le32 *)buffer);
|
||||
out = le32_to_cpu(ar->cmdbuf[0]);
|
||||
|
||||
/* mask off length byte */
|
||||
out &= ~0xFF;
|
||||
|
||||
if (aru->readlen >= 0) {
|
||||
/* add expected length */
|
||||
out |= aru->readlen;
|
||||
} else {
|
||||
/* add obtained length */
|
||||
out |= in & 0xFF;
|
||||
}
|
||||
|
||||
/*
|
||||
* Some commands (e.g: AR9170_CMD_FREQUENCY) have a variable response
|
||||
* length and we cannot predict the correct length in advance.
|
||||
* So we only check if we provided enough space for the data.
|
||||
*/
|
||||
if (unlikely(out < in)) {
|
||||
dev_warn(&aru->udev->dev, "received invalid command response "
|
||||
"got %d bytes, instead of %d bytes "
|
||||
"and the resp length is %d bytes\n",
|
||||
in, out, len);
|
||||
print_hex_dump_bytes("ar9170 invalid resp: ",
|
||||
DUMP_PREFIX_OFFSET, buffer, len);
|
||||
/*
|
||||
* Do not complete, then the command times out,
|
||||
* and we get a stack trace from there.
|
||||
*/
|
||||
return ;
|
||||
}
|
||||
|
||||
spin_lock_irqsave(&aru->common.cmdlock, flags);
|
||||
if (aru->readbuf && len > 0) {
|
||||
memcpy(aru->readbuf, buffer + 4, len - 4);
|
||||
aru->readbuf = NULL;
|
||||
}
|
||||
complete(&aru->cmd_wait);
|
||||
spin_unlock_irqrestore(&aru->common.cmdlock, flags);
|
||||
}
|
||||
|
||||
static int ar9170_usb_upload(struct ar9170_usb *aru, const void *data,
|
||||
size_t len, u32 addr, bool complete)
|
||||
{
|
||||
int transfer, err;
|
||||
u8 *buf = kmalloc(4096, GFP_KERNEL);
|
||||
|
||||
if (!buf)
|
||||
return -ENOMEM;
|
||||
|
||||
while (len) {
|
||||
transfer = min_t(int, len, 4096);
|
||||
memcpy(buf, data, transfer);
|
||||
|
||||
err = usb_control_msg(aru->udev, usb_sndctrlpipe(aru->udev, 0),
|
||||
0x30 /* FW DL */, 0x40 | USB_DIR_OUT,
|
||||
addr >> 8, 0, buf, transfer, 1000);
|
||||
|
||||
if (err < 0) {
|
||||
kfree(buf);
|
||||
return err;
|
||||
}
|
||||
|
||||
len -= transfer;
|
||||
data += transfer;
|
||||
addr += transfer;
|
||||
}
|
||||
kfree(buf);
|
||||
|
||||
if (complete) {
|
||||
err = usb_control_msg(aru->udev, usb_sndctrlpipe(aru->udev, 0),
|
||||
0x31 /* FW DL COMPLETE */,
|
||||
0x40 | USB_DIR_OUT, 0, 0, NULL, 0, 5000);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ar9170_usb_request_firmware(struct ar9170_usb *aru)
|
||||
{
|
||||
int err = 0;
|
||||
|
||||
err = request_firmware(&aru->init_values, "ar9170-1.fw",
|
||||
&aru->udev->dev);
|
||||
if (err) {
|
||||
dev_err(&aru->udev->dev, "file with init values not found.\n");
|
||||
return err;
|
||||
}
|
||||
|
||||
err = request_firmware(&aru->firmware, "ar9170-2.fw", &aru->udev->dev);
|
||||
if (err) {
|
||||
release_firmware(aru->init_values);
|
||||
dev_err(&aru->udev->dev, "firmware file not found.\n");
|
||||
return err;
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static int ar9170_usb_reset(struct ar9170_usb *aru)
|
||||
{
|
||||
int ret, lock = (aru->intf->condition != USB_INTERFACE_BINDING);
|
||||
|
||||
if (lock) {
|
||||
ret = usb_lock_device_for_reset(aru->udev, aru->intf);
|
||||
if (ret < 0) {
|
||||
dev_err(&aru->udev->dev, "unable to lock device "
|
||||
"for reset (%d).\n", ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
ret = usb_reset_device(aru->udev);
|
||||
if (lock)
|
||||
usb_unlock_device(aru->udev);
|
||||
|
||||
/* let it rest - for a second - */
|
||||
msleep(1000);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int ar9170_usb_upload_firmware(struct ar9170_usb *aru)
|
||||
{
|
||||
int err;
|
||||
|
||||
/* First, upload initial values to device RAM */
|
||||
err = ar9170_usb_upload(aru, aru->init_values->data,
|
||||
aru->init_values->size, 0x102800, false);
|
||||
if (err) {
|
||||
dev_err(&aru->udev->dev, "firmware part 1 "
|
||||
"upload failed (%d).\n", err);
|
||||
return err;
|
||||
}
|
||||
|
||||
/* Then, upload the firmware itself and start it */
|
||||
return ar9170_usb_upload(aru, aru->firmware->data, aru->firmware->size,
|
||||
0x200000, true);
|
||||
}
|
||||
|
||||
static int ar9170_usb_init_transport(struct ar9170_usb *aru)
|
||||
{
|
||||
struct ar9170 *ar = (void *) &aru->common;
|
||||
int err;
|
||||
|
||||
ar9170_regwrite_begin(ar);
|
||||
|
||||
/* Set USB Rx stream mode MAX packet number to 2 */
|
||||
ar9170_regwrite(AR9170_USB_REG_MAX_AGG_UPLOAD, 0x4);
|
||||
|
||||
/* Set USB Rx stream mode timeout to 10us */
|
||||
ar9170_regwrite(AR9170_USB_REG_UPLOAD_TIME_CTL, 0x80);
|
||||
|
||||
ar9170_regwrite_finish();
|
||||
|
||||
err = ar9170_regwrite_result();
|
||||
if (err)
|
||||
dev_err(&aru->udev->dev, "USB setup failed (%d).\n", err);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static void ar9170_usb_stop(struct ar9170 *ar)
|
||||
{
|
||||
struct ar9170_usb *aru = (void *) ar;
|
||||
int ret;
|
||||
|
||||
if (IS_ACCEPTING_CMD(ar))
|
||||
aru->common.state = AR9170_STOPPED;
|
||||
|
||||
/* lets wait a while until the tx - queues are dried out */
|
||||
ret = usb_wait_anchor_empty_timeout(&aru->tx_submitted,
|
||||
msecs_to_jiffies(1000));
|
||||
if (ret == 0)
|
||||
dev_err(&aru->udev->dev, "kill pending tx urbs.\n");
|
||||
|
||||
usb_poison_anchored_urbs(&aru->tx_submitted);
|
||||
|
||||
/*
|
||||
* Note:
|
||||
* So far we freed all tx urbs, but we won't dare to touch any rx urbs.
|
||||
* Else we would end up with a unresponsive device...
|
||||
*/
|
||||
}
|
||||
|
||||
static int ar9170_usb_open(struct ar9170 *ar)
|
||||
{
|
||||
struct ar9170_usb *aru = (void *) ar;
|
||||
int err;
|
||||
|
||||
usb_unpoison_anchored_urbs(&aru->tx_submitted);
|
||||
err = ar9170_usb_init_transport(aru);
|
||||
if (err) {
|
||||
usb_poison_anchored_urbs(&aru->tx_submitted);
|
||||
return err;
|
||||
}
|
||||
|
||||
aru->common.state = AR9170_IDLE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ar9170_usb_probe(struct usb_interface *intf,
|
||||
const struct usb_device_id *id)
|
||||
{
|
||||
struct ar9170_usb *aru;
|
||||
struct ar9170 *ar;
|
||||
struct usb_device *udev;
|
||||
int err;
|
||||
|
||||
aru = ar9170_alloc(sizeof(*aru));
|
||||
if (IS_ERR(aru)) {
|
||||
err = PTR_ERR(aru);
|
||||
goto out;
|
||||
}
|
||||
|
||||
udev = interface_to_usbdev(intf);
|
||||
usb_get_dev(udev);
|
||||
aru->udev = udev;
|
||||
aru->intf = intf;
|
||||
ar = &aru->common;
|
||||
|
||||
usb_set_intfdata(intf, aru);
|
||||
SET_IEEE80211_DEV(ar->hw, &udev->dev);
|
||||
|
||||
init_usb_anchor(&aru->rx_submitted);
|
||||
init_usb_anchor(&aru->tx_submitted);
|
||||
init_completion(&aru->cmd_wait);
|
||||
|
||||
aru->common.stop = ar9170_usb_stop;
|
||||
aru->common.open = ar9170_usb_open;
|
||||
aru->common.tx = ar9170_usb_tx;
|
||||
aru->common.exec_cmd = ar9170_usb_exec_cmd;
|
||||
aru->common.callback_cmd = ar9170_usb_callback_cmd;
|
||||
|
||||
err = ar9170_usb_reset(aru);
|
||||
if (err)
|
||||
goto err_unlock;
|
||||
|
||||
err = ar9170_usb_request_firmware(aru);
|
||||
if (err)
|
||||
goto err_unlock;
|
||||
|
||||
err = ar9170_usb_alloc_rx_irq_urb(aru);
|
||||
if (err)
|
||||
goto err_freefw;
|
||||
|
||||
err = ar9170_usb_alloc_rx_bulk_urbs(aru);
|
||||
if (err)
|
||||
goto err_unrx;
|
||||
|
||||
err = ar9170_usb_upload_firmware(aru);
|
||||
if (err) {
|
||||
err = ar9170_echo_test(&aru->common, 0x60d43110);
|
||||
if (err) {
|
||||
/* force user invention, by disabling the device */
|
||||
err = usb_driver_set_configuration(aru->udev, -1);
|
||||
dev_err(&aru->udev->dev, "device is in a bad state. "
|
||||
"please reconnect it!\n");
|
||||
goto err_unrx;
|
||||
}
|
||||
}
|
||||
|
||||
err = ar9170_usb_open(ar);
|
||||
if (err)
|
||||
goto err_unrx;
|
||||
|
||||
err = ar9170_register(ar, &udev->dev);
|
||||
|
||||
ar9170_usb_stop(ar);
|
||||
if (err)
|
||||
goto err_unrx;
|
||||
|
||||
return 0;
|
||||
|
||||
err_unrx:
|
||||
ar9170_usb_cancel_urbs(aru);
|
||||
|
||||
err_freefw:
|
||||
release_firmware(aru->init_values);
|
||||
release_firmware(aru->firmware);
|
||||
|
||||
err_unlock:
|
||||
usb_set_intfdata(intf, NULL);
|
||||
usb_put_dev(udev);
|
||||
ieee80211_free_hw(ar->hw);
|
||||
out:
|
||||
return err;
|
||||
}
|
||||
|
||||
static void ar9170_usb_disconnect(struct usb_interface *intf)
|
||||
{
|
||||
struct ar9170_usb *aru = usb_get_intfdata(intf);
|
||||
|
||||
if (!aru)
|
||||
return;
|
||||
|
||||
aru->common.state = AR9170_IDLE;
|
||||
ar9170_unregister(&aru->common);
|
||||
ar9170_usb_cancel_urbs(aru);
|
||||
|
||||
release_firmware(aru->init_values);
|
||||
release_firmware(aru->firmware);
|
||||
|
||||
usb_put_dev(aru->udev);
|
||||
usb_set_intfdata(intf, NULL);
|
||||
ieee80211_free_hw(aru->common.hw);
|
||||
}
|
||||
|
||||
static struct usb_driver ar9170_driver = {
|
||||
.name = "ar9170usb",
|
||||
.probe = ar9170_usb_probe,
|
||||
.disconnect = ar9170_usb_disconnect,
|
||||
.id_table = ar9170_usb_ids,
|
||||
.soft_unbind = 1,
|
||||
};
|
||||
|
||||
static int __init ar9170_init(void)
|
||||
{
|
||||
return usb_register(&ar9170_driver);
|
||||
}
|
||||
|
||||
static void __exit ar9170_exit(void)
|
||||
{
|
||||
usb_deregister(&ar9170_driver);
|
||||
}
|
||||
|
||||
module_init(ar9170_init);
|
||||
module_exit(ar9170_exit);
|
|
@ -0,0 +1,74 @@
|
|||
/*
|
||||
* Atheros AR9170 USB driver
|
||||
*
|
||||
* Driver specific definitions
|
||||
*
|
||||
* Copyright 2008, Johannes Berg <johannes@sipsolutions.net>
|
||||
* Copyright 2009, Christian Lamparter <chunkeey@web.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, see
|
||||
* http://www.gnu.org/licenses/.
|
||||
*
|
||||
* This file incorporates work covered by the following copyright and
|
||||
* permission notice:
|
||||
* Copyright (c) 2007-2008 Atheros Communications, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifndef __USB_H
|
||||
#define __USB_H
|
||||
|
||||
#include <linux/usb.h>
|
||||
#include <linux/completion.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/leds.h>
|
||||
#include <net/wireless.h>
|
||||
#include <net/mac80211.h>
|
||||
#include <linux/firmware.h>
|
||||
#include "eeprom.h"
|
||||
#include "hw.h"
|
||||
#include "ar9170.h"
|
||||
|
||||
#define AR9170_NUM_RX_URBS 16
|
||||
|
||||
struct firmware;
|
||||
|
||||
struct ar9170_usb {
|
||||
struct ar9170 common;
|
||||
struct usb_device *udev;
|
||||
struct usb_interface *intf;
|
||||
|
||||
struct usb_anchor rx_submitted;
|
||||
struct usb_anchor tx_submitted;
|
||||
|
||||
spinlock_t cmdlock;
|
||||
struct completion cmd_wait;
|
||||
int readlen;
|
||||
u8 *readbuf;
|
||||
|
||||
const struct firmware *init_values;
|
||||
const struct firmware *firmware;
|
||||
};
|
||||
|
||||
#endif /* __USB_H */
|
|
@ -1030,7 +1030,17 @@ static int arlan_mac_addr(struct net_device *dev, void *p)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static const struct net_device_ops arlan_netdev_ops = {
|
||||
.ndo_open = arlan_open,
|
||||
.ndo_stop = arlan_close,
|
||||
.ndo_start_xmit = arlan_tx,
|
||||
.ndo_get_stats = arlan_statistics,
|
||||
.ndo_set_multicast_list = arlan_set_multicast,
|
||||
.ndo_change_mtu = arlan_change_mtu,
|
||||
.ndo_set_mac_address = arlan_mac_addr,
|
||||
.ndo_tx_timeout = arlan_tx_timeout,
|
||||
.ndo_validate_addr = eth_validate_addr,
|
||||
};
|
||||
|
||||
static int __init arlan_setup_device(struct net_device *dev, int num)
|
||||
{
|
||||
|
@ -1042,14 +1052,7 @@ static int __init arlan_setup_device(struct net_device *dev, int num)
|
|||
ap->conf = (struct arlan_shmem *)(ap+1);
|
||||
|
||||
dev->tx_queue_len = tx_queue_len;
|
||||
dev->open = arlan_open;
|
||||
dev->stop = arlan_close;
|
||||
dev->hard_start_xmit = arlan_tx;
|
||||
dev->get_stats = arlan_statistics;
|
||||
dev->set_multicast_list = arlan_set_multicast;
|
||||
dev->change_mtu = arlan_change_mtu;
|
||||
dev->set_mac_address = arlan_mac_addr;
|
||||
dev->tx_timeout = arlan_tx_timeout;
|
||||
dev->netdev_ops = &arlan_netdev_ops;
|
||||
dev->watchdog_timeo = 3*HZ;
|
||||
|
||||
ap->irq_test_done = 0;
|
||||
|
|
|
@ -204,9 +204,9 @@
|
|||
#define AR5K_TUNE_CWMAX_11B 1023
|
||||
#define AR5K_TUNE_CWMAX_XR 7
|
||||
#define AR5K_TUNE_NOISE_FLOOR -72
|
||||
#define AR5K_TUNE_MAX_TXPOWER 60
|
||||
#define AR5K_TUNE_DEFAULT_TXPOWER 30
|
||||
#define AR5K_TUNE_TPC_TXPOWER true
|
||||
#define AR5K_TUNE_MAX_TXPOWER 63
|
||||
#define AR5K_TUNE_DEFAULT_TXPOWER 25
|
||||
#define AR5K_TUNE_TPC_TXPOWER false
|
||||
#define AR5K_TUNE_ANT_DIVERSITY true
|
||||
#define AR5K_TUNE_HWTXTRIES 4
|
||||
|
||||
|
@ -551,11 +551,11 @@ enum ath5k_pkt_type {
|
|||
*/
|
||||
#define AR5K_TXPOWER_OFDM(_r, _v) ( \
|
||||
((0 & 1) << ((_v) + 6)) | \
|
||||
(((ah->ah_txpower.txp_rates[(_r)]) & 0x3f) << (_v)) \
|
||||
(((ah->ah_txpower.txp_rates_power_table[(_r)]) & 0x3f) << (_v)) \
|
||||
)
|
||||
|
||||
#define AR5K_TXPOWER_CCK(_r, _v) ( \
|
||||
(ah->ah_txpower.txp_rates[(_r)] & 0x3f) << (_v) \
|
||||
(ah->ah_txpower.txp_rates_power_table[(_r)] & 0x3f) << (_v) \
|
||||
)
|
||||
|
||||
/*
|
||||
|
@ -1085,13 +1085,25 @@ struct ath5k_hw {
|
|||
struct ath5k_gain ah_gain;
|
||||
u8 ah_offset[AR5K_MAX_RF_BANKS];
|
||||
|
||||
|
||||
struct {
|
||||
u16 txp_pcdac[AR5K_EEPROM_POWER_TABLE_SIZE];
|
||||
u16 txp_rates[AR5K_MAX_RATES];
|
||||
s16 txp_min;
|
||||
s16 txp_max;
|
||||
/* Temporary tables used for interpolation */
|
||||
u8 tmpL[AR5K_EEPROM_N_PD_GAINS]
|
||||
[AR5K_EEPROM_POWER_TABLE_SIZE];
|
||||
u8 tmpR[AR5K_EEPROM_N_PD_GAINS]
|
||||
[AR5K_EEPROM_POWER_TABLE_SIZE];
|
||||
u8 txp_pd_table[AR5K_EEPROM_POWER_TABLE_SIZE * 2];
|
||||
u16 txp_rates_power_table[AR5K_MAX_RATES];
|
||||
u8 txp_min_idx;
|
||||
bool txp_tpc;
|
||||
/* Values in 0.25dB units */
|
||||
s16 txp_min_pwr;
|
||||
s16 txp_max_pwr;
|
||||
s16 txp_offset;
|
||||
s16 txp_ofdm;
|
||||
/* Values in dB units */
|
||||
s16 txp_cck_ofdm_pwr_delta;
|
||||
s16 txp_cck_ofdm_gainf_delta;
|
||||
} ah_txpower;
|
||||
|
||||
struct {
|
||||
|
@ -1161,6 +1173,7 @@ extern void ath5k_hw_update_mib_counters(struct ath5k_hw *ah, struct ieee80211_l
|
|||
|
||||
/* EEPROM access functions */
|
||||
extern int ath5k_eeprom_init(struct ath5k_hw *ah);
|
||||
extern void ath5k_eeprom_detach(struct ath5k_hw *ah);
|
||||
extern int ath5k_eeprom_read_mac(struct ath5k_hw *ah, u8 *mac);
|
||||
extern bool ath5k_eeprom_is_hb63(struct ath5k_hw *ah);
|
||||
|
||||
|
@ -1256,8 +1269,8 @@ extern void ath5k_hw_set_def_antenna(struct ath5k_hw *ah, unsigned int ant);
|
|||
extern unsigned int ath5k_hw_get_def_antenna(struct ath5k_hw *ah);
|
||||
extern int ath5k_hw_phy_disable(struct ath5k_hw *ah);
|
||||
/* TX power setup */
|
||||
extern int ath5k_hw_txpower(struct ath5k_hw *ah, struct ieee80211_channel *channel, unsigned int txpower);
|
||||
extern int ath5k_hw_set_txpower_limit(struct ath5k_hw *ah, unsigned int power);
|
||||
extern int ath5k_hw_txpower(struct ath5k_hw *ah, struct ieee80211_channel *channel, u8 ee_mode, u8 txpower);
|
||||
extern int ath5k_hw_set_txpower_limit(struct ath5k_hw *ah, u8 ee_mode, u8 txpower);
|
||||
|
||||
/*
|
||||
* Functions used internaly
|
||||
|
|
|
@ -341,6 +341,8 @@ void ath5k_hw_detach(struct ath5k_hw *ah)
|
|||
if (ah->ah_rf_banks != NULL)
|
||||
kfree(ah->ah_rf_banks);
|
||||
|
||||
ath5k_eeprom_detach(ah);
|
||||
|
||||
/* assume interrupts are down */
|
||||
kfree(ah);
|
||||
}
|
||||
|
|
|
@ -685,13 +685,6 @@ ath5k_pci_resume(struct pci_dev *pdev)
|
|||
if (err)
|
||||
return err;
|
||||
|
||||
/*
|
||||
* Suspend/Resume resets the PCI configuration space, so we have to
|
||||
* re-disable the RETRY_TIMEOUT register (0x41) to keep
|
||||
* PCI Tx retries from interfering with C3 CPU state
|
||||
*/
|
||||
pci_write_config_byte(pdev, 0x41, 0);
|
||||
|
||||
err = request_irq(pdev->irq, ath5k_intr, IRQF_SHARED, "ath", sc);
|
||||
if (err) {
|
||||
ATH5K_ERR(sc, "request_irq failed\n");
|
||||
|
@ -1095,9 +1088,18 @@ ath5k_mode_setup(struct ath5k_softc *sc)
|
|||
static inline int
|
||||
ath5k_hw_to_driver_rix(struct ath5k_softc *sc, int hw_rix)
|
||||
{
|
||||
WARN(hw_rix < 0 || hw_rix >= AR5K_MAX_RATES,
|
||||
"hw_rix out of bounds: %x\n", hw_rix);
|
||||
return sc->rate_idx[sc->curband->band][hw_rix];
|
||||
int rix;
|
||||
|
||||
/* return base rate on errors */
|
||||
if (WARN(hw_rix < 0 || hw_rix >= AR5K_MAX_RATES,
|
||||
"hw_rix out of bounds: %x\n", hw_rix))
|
||||
return 0;
|
||||
|
||||
rix = sc->rate_idx[sc->curband->band][hw_rix];
|
||||
if (WARN(rix < 0, "invalid hw_rix: %x\n", hw_rix))
|
||||
rix = 0;
|
||||
|
||||
return rix;
|
||||
}
|
||||
|
||||
/***************\
|
||||
|
@ -1216,6 +1218,9 @@ ath5k_txbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf)
|
|||
|
||||
pktlen = skb->len;
|
||||
|
||||
/* FIXME: If we are in g mode and rate is a CCK rate
|
||||
* subtract ah->ah_txpower.txp_cck_ofdm_pwr_delta
|
||||
* from tx power (value is in dB units already) */
|
||||
if (info->control.hw_key) {
|
||||
keyidx = info->control.hw_key->hw_key_idx;
|
||||
pktlen += info->control.hw_key->icv_len;
|
||||
|
@ -2044,6 +2049,9 @@ ath5k_beacon_setup(struct ath5k_softc *sc, struct ath5k_buf *bf)
|
|||
antenna = sc->bsent & 4 ? 2 : 1;
|
||||
}
|
||||
|
||||
/* FIXME: If we are in g mode and rate is a CCK rate
|
||||
* subtract ah->ah_txpower.txp_cck_ofdm_pwr_delta
|
||||
* from tx power (value is in dB units already) */
|
||||
ds->ds_data = bf->skbaddr;
|
||||
ret = ah->ah_setup_tx_desc(ah, ds, skb->len,
|
||||
ieee80211_get_hdrlen_from_skb(skb),
|
||||
|
@ -2305,7 +2313,7 @@ ath5k_init(struct ath5k_softc *sc)
|
|||
sc->curband = &sc->sbands[sc->curchan->band];
|
||||
sc->imask = AR5K_INT_RXOK | AR5K_INT_RXERR | AR5K_INT_RXEOL |
|
||||
AR5K_INT_RXORN | AR5K_INT_TXDESC | AR5K_INT_TXEOL |
|
||||
AR5K_INT_FATAL | AR5K_INT_GLOBAL | AR5K_INT_MIB;
|
||||
AR5K_INT_FATAL | AR5K_INT_GLOBAL;
|
||||
ret = ath5k_reset(sc, false, false);
|
||||
if (ret)
|
||||
goto done;
|
||||
|
@ -2554,7 +2562,7 @@ ath5k_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
|
|||
if (skb_headroom(skb) < padsize) {
|
||||
ATH5K_ERR(sc, "tx hdrlen not %%4: %d not enough"
|
||||
" headroom to pad %d\n", hdrlen, padsize);
|
||||
return NETDEV_TX_BUSY;
|
||||
goto drop_packet;
|
||||
}
|
||||
skb_push(skb, padsize);
|
||||
memmove(skb->data, skb->data+padsize, hdrlen);
|
||||
|
@ -2565,7 +2573,7 @@ ath5k_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
|
|||
ATH5K_ERR(sc, "no further txbuf available, dropping packet\n");
|
||||
spin_unlock_irqrestore(&sc->txbuflock, flags);
|
||||
ieee80211_stop_queue(hw, skb_get_queue_mapping(skb));
|
||||
return NETDEV_TX_BUSY;
|
||||
goto drop_packet;
|
||||
}
|
||||
bf = list_first_entry(&sc->txbuf, struct ath5k_buf, list);
|
||||
list_del(&bf->list);
|
||||
|
@ -2582,10 +2590,12 @@ ath5k_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
|
|||
list_add_tail(&bf->list, &sc->txbuf);
|
||||
sc->txbuf_len++;
|
||||
spin_unlock_irqrestore(&sc->txbuflock, flags);
|
||||
dev_kfree_skb_any(skb);
|
||||
return NETDEV_TX_OK;
|
||||
goto drop_packet;
|
||||
}
|
||||
return NETDEV_TX_OK;
|
||||
|
||||
drop_packet:
|
||||
dev_kfree_skb_any(skb);
|
||||
return NETDEV_TX_OK;
|
||||
}
|
||||
|
||||
|
@ -2608,12 +2618,6 @@ ath5k_reset(struct ath5k_softc *sc, bool stop, bool change_channel)
|
|||
goto err;
|
||||
}
|
||||
|
||||
/*
|
||||
* This is needed only to setup initial state
|
||||
* but it's best done after a reset.
|
||||
*/
|
||||
ath5k_hw_set_txpower_limit(sc->ah, 0);
|
||||
|
||||
ret = ath5k_rx_start(sc);
|
||||
if (ret) {
|
||||
ATH5K_ERR(sc, "can't start recv logic\n");
|
||||
|
|
|
@ -112,7 +112,7 @@ struct ath5k_softc {
|
|||
struct ieee80211_supported_band sbands[IEEE80211_NUM_BANDS];
|
||||
struct ieee80211_channel channels[ATH_CHAN_MAX];
|
||||
struct ieee80211_rate rates[IEEE80211_NUM_BANDS][AR5K_MAX_RATES];
|
||||
u8 rate_idx[IEEE80211_NUM_BANDS][AR5K_MAX_RATES];
|
||||
s8 rate_idx[IEEE80211_NUM_BANDS][AR5K_MAX_RATES];
|
||||
enum nl80211_iftype opmode;
|
||||
struct ath5k_hw *ah; /* Atheros HW */
|
||||
|
||||
|
|
|
@ -194,6 +194,10 @@ static int ath5k_hw_setup_4word_tx_desc(struct ath5k_hw *ah,
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
tx_power += ah->ah_txpower.txp_offset;
|
||||
if (tx_power > AR5K_TUNE_MAX_TXPOWER)
|
||||
tx_power = AR5K_TUNE_MAX_TXPOWER;
|
||||
|
||||
/* Clear descriptor */
|
||||
memset(&desc->ud.ds_tx5212, 0, sizeof(struct ath5k_hw_5212_tx_desc));
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2008 Reyk Floeter <reyk@openbsd.org>
|
||||
* Copyright (c) 2006-2008 Nick Kossifidis <mickflemm@gmail.com>
|
||||
* Copyright (c) 2008 Felix Fietkau <nbd@openwrt.org>
|
||||
* Copyright (c) 2006-2009 Nick Kossifidis <mickflemm@gmail.com>
|
||||
* Copyright (c) 2008-2009 Felix Fietkau <nbd@openwrt.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -98,11 +98,6 @@ ath5k_eeprom_init_header(struct ath5k_hw *ah)
|
|||
int ret;
|
||||
u16 val;
|
||||
|
||||
/* Initial TX thermal adjustment values */
|
||||
ee->ee_tx_clip = 4;
|
||||
ee->ee_pwd_84 = ee->ee_pwd_90 = 1;
|
||||
ee->ee_gain_select = 1;
|
||||
|
||||
/*
|
||||
* Read values from EEPROM and store them in the capability structure
|
||||
*/
|
||||
|
@ -504,35 +499,6 @@ ath5k_eeprom_init_modes(struct ath5k_hw *ah)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* Used to match PCDAC steps with power values on RF5111 chips
|
||||
* (eeprom versions < 4). For RF5111 we have 10 pre-defined PCDAC
|
||||
* steps that match with the power values we read from eeprom. On
|
||||
* older eeprom versions (< 3.2) these steps are equaly spaced at
|
||||
* 10% of the pcdac curve -until the curve reaches it's maximum-
|
||||
* (10 steps from 0 to 100%) but on newer eeprom versions (>= 3.2)
|
||||
* these 10 steps are spaced in a different way. This function returns
|
||||
* the pcdac steps based on eeprom version and curve min/max so that we
|
||||
* can have pcdac/pwr points.
|
||||
*/
|
||||
static inline void
|
||||
ath5k_get_pcdac_intercepts(struct ath5k_hw *ah, u8 min, u8 max, u8 *vp)
|
||||
{
|
||||
static const u16 intercepts3[] =
|
||||
{ 0, 5, 10, 20, 30, 50, 70, 85, 90, 95, 100 };
|
||||
static const u16 intercepts3_2[] =
|
||||
{ 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 };
|
||||
const u16 *ip;
|
||||
int i;
|
||||
|
||||
if (ah->ah_ee_version >= AR5K_EEPROM_VERSION_3_2)
|
||||
ip = intercepts3_2;
|
||||
else
|
||||
ip = intercepts3;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(intercepts3); i++)
|
||||
*vp++ = (ip[i] * max + (100 - ip[i]) * min) / 100;
|
||||
}
|
||||
|
||||
/* Read the frequency piers for each mode (mostly used on newer eeproms with 0xff
|
||||
* frequency mask) */
|
||||
static inline int
|
||||
|
@ -546,28 +512,27 @@ ath5k_eeprom_read_freq_list(struct ath5k_hw *ah, int *offset, int max,
|
|||
int ret;
|
||||
u16 val;
|
||||
|
||||
ee->ee_n_piers[mode] = 0;
|
||||
while(i < max) {
|
||||
AR5K_EEPROM_READ(o++, val);
|
||||
|
||||
freq1 = (val >> 8) & 0xff;
|
||||
freq2 = val & 0xff;
|
||||
freq1 = val & 0xff;
|
||||
if (!freq1)
|
||||
break;
|
||||
|
||||
if (freq1) {
|
||||
pc[i++].freq = ath5k_eeprom_bin2freq(ee,
|
||||
freq1, mode);
|
||||
ee->ee_n_piers[mode]++;
|
||||
}
|
||||
|
||||
if (freq2) {
|
||||
freq2 = (val >> 8) & 0xff;
|
||||
if (!freq2)
|
||||
break;
|
||||
|
||||
pc[i++].freq = ath5k_eeprom_bin2freq(ee,
|
||||
freq2, mode);
|
||||
ee->ee_n_piers[mode]++;
|
||||
}
|
||||
|
||||
if (!freq1 || !freq2)
|
||||
break;
|
||||
}
|
||||
|
||||
/* return new offset */
|
||||
*offset = o;
|
||||
|
||||
|
@ -652,13 +617,122 @@ ath5k_eeprom_init_11bg_2413(struct ath5k_hw *ah, unsigned int mode, int offset)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* Read power calibration for RF5111 chips
|
||||
/*
|
||||
* Read power calibration for RF5111 chips
|
||||
*
|
||||
* For RF5111 we have an XPD -eXternal Power Detector- curve
|
||||
* for each calibrated channel. Each curve has PCDAC steps on
|
||||
* x axis and power on y axis and looks like a logarithmic
|
||||
* function. To recreate the curve and pass the power values
|
||||
* on the pcdac table, we read 10 points here and interpolate later.
|
||||
* for each calibrated channel. Each curve has 0,5dB Power steps
|
||||
* on x axis and PCDAC steps (offsets) on y axis and looks like an
|
||||
* exponential function. To recreate the curve we read 11 points
|
||||
* here and interpolate later.
|
||||
*/
|
||||
|
||||
/* Used to match PCDAC steps with power values on RF5111 chips
|
||||
* (eeprom versions < 4). For RF5111 we have 11 pre-defined PCDAC
|
||||
* steps that match with the power values we read from eeprom. On
|
||||
* older eeprom versions (< 3.2) these steps are equaly spaced at
|
||||
* 10% of the pcdac curve -until the curve reaches it's maximum-
|
||||
* (11 steps from 0 to 100%) but on newer eeprom versions (>= 3.2)
|
||||
* these 11 steps are spaced in a different way. This function returns
|
||||
* the pcdac steps based on eeprom version and curve min/max so that we
|
||||
* can have pcdac/pwr points.
|
||||
*/
|
||||
static inline void
|
||||
ath5k_get_pcdac_intercepts(struct ath5k_hw *ah, u8 min, u8 max, u8 *vp)
|
||||
{
|
||||
const static u16 intercepts3[] =
|
||||
{ 0, 5, 10, 20, 30, 50, 70, 85, 90, 95, 100 };
|
||||
const static u16 intercepts3_2[] =
|
||||
{ 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 };
|
||||
const u16 *ip;
|
||||
int i;
|
||||
|
||||
if (ah->ah_ee_version >= AR5K_EEPROM_VERSION_3_2)
|
||||
ip = intercepts3_2;
|
||||
else
|
||||
ip = intercepts3;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(intercepts3); i++)
|
||||
vp[i] = (ip[i] * max + (100 - ip[i]) * min) / 100;
|
||||
}
|
||||
|
||||
/* Convert RF5111 specific data to generic raw data
|
||||
* used by interpolation code */
|
||||
static int
|
||||
ath5k_eeprom_convert_pcal_info_5111(struct ath5k_hw *ah, int mode,
|
||||
struct ath5k_chan_pcal_info *chinfo)
|
||||
{
|
||||
struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
|
||||
struct ath5k_chan_pcal_info_rf5111 *pcinfo;
|
||||
struct ath5k_pdgain_info *pd;
|
||||
u8 pier, point, idx;
|
||||
u8 *pdgain_idx = ee->ee_pdc_to_idx[mode];
|
||||
|
||||
/* Fill raw data for each calibration pier */
|
||||
for (pier = 0; pier < ee->ee_n_piers[mode]; pier++) {
|
||||
|
||||
pcinfo = &chinfo[pier].rf5111_info;
|
||||
|
||||
/* Allocate pd_curves for this cal pier */
|
||||
chinfo[pier].pd_curves =
|
||||
kcalloc(AR5K_EEPROM_N_PD_CURVES,
|
||||
sizeof(struct ath5k_pdgain_info),
|
||||
GFP_KERNEL);
|
||||
|
||||
if (!chinfo[pier].pd_curves)
|
||||
return -ENOMEM;
|
||||
|
||||
/* Only one curve for RF5111
|
||||
* find out which one and place
|
||||
* in in pd_curves.
|
||||
* Note: ee_x_gain is reversed here */
|
||||
for (idx = 0; idx < AR5K_EEPROM_N_PD_CURVES; idx++) {
|
||||
|
||||
if (!((ee->ee_x_gain[mode] >> idx) & 0x1)) {
|
||||
pdgain_idx[0] = idx;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ee->ee_pd_gains[mode] = 1;
|
||||
|
||||
pd = &chinfo[pier].pd_curves[idx];
|
||||
|
||||
pd->pd_points = AR5K_EEPROM_N_PWR_POINTS_5111;
|
||||
|
||||
/* Allocate pd points for this curve */
|
||||
pd->pd_step = kcalloc(AR5K_EEPROM_N_PWR_POINTS_5111,
|
||||
sizeof(u8), GFP_KERNEL);
|
||||
if (!pd->pd_step)
|
||||
return -ENOMEM;
|
||||
|
||||
pd->pd_pwr = kcalloc(AR5K_EEPROM_N_PWR_POINTS_5111,
|
||||
sizeof(s16), GFP_KERNEL);
|
||||
if (!pd->pd_pwr)
|
||||
return -ENOMEM;
|
||||
|
||||
/* Fill raw dataset
|
||||
* (convert power to 0.25dB units
|
||||
* for RF5112 combatibility) */
|
||||
for (point = 0; point < pd->pd_points; point++) {
|
||||
|
||||
/* Absolute values */
|
||||
pd->pd_pwr[point] = 2 * pcinfo->pwr[point];
|
||||
|
||||
/* Already sorted */
|
||||
pd->pd_step[point] = pcinfo->pcdac[point];
|
||||
}
|
||||
|
||||
/* Set min/max pwr */
|
||||
chinfo[pier].min_pwr = pd->pd_pwr[0];
|
||||
chinfo[pier].max_pwr = pd->pd_pwr[10];
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Parse EEPROM data */
|
||||
static int
|
||||
ath5k_eeprom_read_pcal_info_5111(struct ath5k_hw *ah, int mode)
|
||||
{
|
||||
|
@ -747,30 +821,165 @@ ath5k_eeprom_read_pcal_info_5111(struct ath5k_hw *ah, int mode)
|
|||
cdata->pcdac_max, cdata->pcdac);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return ath5k_eeprom_convert_pcal_info_5111(ah, mode, pcal);
|
||||
}
|
||||
|
||||
/* Read power calibration for RF5112 chips
|
||||
|
||||
/*
|
||||
* Read power calibration for RF5112 chips
|
||||
*
|
||||
* For RF5112 we have 4 XPD -eXternal Power Detector- curves
|
||||
* for each calibrated channel on 0, -6, -12 and -18dbm but we only
|
||||
* use the higher (3) and the lower (0) curves. Each curve has PCDAC
|
||||
* steps on x axis and power on y axis and looks like a linear
|
||||
* function. To recreate the curve and pass the power values
|
||||
* on the pcdac table, we read 4 points for xpd 0 and 3 points
|
||||
* for xpd 3 here and interpolate later.
|
||||
* use the higher (3) and the lower (0) curves. Each curve has 0.5dB
|
||||
* power steps on x axis and PCDAC steps on y axis and looks like a
|
||||
* linear function. To recreate the curve and pass the power values
|
||||
* on hw, we read 4 points for xpd 0 (lower gain -> max power)
|
||||
* and 3 points for xpd 3 (higher gain -> lower power) here and
|
||||
* interpolate later.
|
||||
*
|
||||
* Note: Many vendors just use xpd 0 so xpd 3 is zeroed.
|
||||
*/
|
||||
|
||||
/* Convert RF5112 specific data to generic raw data
|
||||
* used by interpolation code */
|
||||
static int
|
||||
ath5k_eeprom_convert_pcal_info_5112(struct ath5k_hw *ah, int mode,
|
||||
struct ath5k_chan_pcal_info *chinfo)
|
||||
{
|
||||
struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
|
||||
struct ath5k_chan_pcal_info_rf5112 *pcinfo;
|
||||
u8 *pdgain_idx = ee->ee_pdc_to_idx[mode];
|
||||
unsigned int pier, pdg, point;
|
||||
|
||||
/* Fill raw data for each calibration pier */
|
||||
for (pier = 0; pier < ee->ee_n_piers[mode]; pier++) {
|
||||
|
||||
pcinfo = &chinfo[pier].rf5112_info;
|
||||
|
||||
/* Allocate pd_curves for this cal pier */
|
||||
chinfo[pier].pd_curves =
|
||||
kcalloc(AR5K_EEPROM_N_PD_CURVES,
|
||||
sizeof(struct ath5k_pdgain_info),
|
||||
GFP_KERNEL);
|
||||
|
||||
if (!chinfo[pier].pd_curves)
|
||||
return -ENOMEM;
|
||||
|
||||
/* Fill pd_curves */
|
||||
for (pdg = 0; pdg < ee->ee_pd_gains[mode]; pdg++) {
|
||||
|
||||
u8 idx = pdgain_idx[pdg];
|
||||
struct ath5k_pdgain_info *pd =
|
||||
&chinfo[pier].pd_curves[idx];
|
||||
|
||||
/* Lowest gain curve (max power) */
|
||||
if (pdg == 0) {
|
||||
/* One more point for better accuracy */
|
||||
pd->pd_points = AR5K_EEPROM_N_XPD0_POINTS;
|
||||
|
||||
/* Allocate pd points for this curve */
|
||||
pd->pd_step = kcalloc(pd->pd_points,
|
||||
sizeof(u8), GFP_KERNEL);
|
||||
|
||||
if (!pd->pd_step)
|
||||
return -ENOMEM;
|
||||
|
||||
pd->pd_pwr = kcalloc(pd->pd_points,
|
||||
sizeof(s16), GFP_KERNEL);
|
||||
|
||||
if (!pd->pd_pwr)
|
||||
return -ENOMEM;
|
||||
|
||||
|
||||
/* Fill raw dataset
|
||||
* (all power levels are in 0.25dB units) */
|
||||
pd->pd_step[0] = pcinfo->pcdac_x0[0];
|
||||
pd->pd_pwr[0] = pcinfo->pwr_x0[0];
|
||||
|
||||
for (point = 1; point < pd->pd_points;
|
||||
point++) {
|
||||
/* Absolute values */
|
||||
pd->pd_pwr[point] =
|
||||
pcinfo->pwr_x0[point];
|
||||
|
||||
/* Deltas */
|
||||
pd->pd_step[point] =
|
||||
pd->pd_step[point - 1] +
|
||||
pcinfo->pcdac_x0[point];
|
||||
}
|
||||
|
||||
/* Set min power for this frequency */
|
||||
chinfo[pier].min_pwr = pd->pd_pwr[0];
|
||||
|
||||
/* Highest gain curve (min power) */
|
||||
} else if (pdg == 1) {
|
||||
|
||||
pd->pd_points = AR5K_EEPROM_N_XPD3_POINTS;
|
||||
|
||||
/* Allocate pd points for this curve */
|
||||
pd->pd_step = kcalloc(pd->pd_points,
|
||||
sizeof(u8), GFP_KERNEL);
|
||||
|
||||
if (!pd->pd_step)
|
||||
return -ENOMEM;
|
||||
|
||||
pd->pd_pwr = kcalloc(pd->pd_points,
|
||||
sizeof(s16), GFP_KERNEL);
|
||||
|
||||
if (!pd->pd_pwr)
|
||||
return -ENOMEM;
|
||||
|
||||
/* Fill raw dataset
|
||||
* (all power levels are in 0.25dB units) */
|
||||
for (point = 0; point < pd->pd_points;
|
||||
point++) {
|
||||
/* Absolute values */
|
||||
pd->pd_pwr[point] =
|
||||
pcinfo->pwr_x3[point];
|
||||
|
||||
/* Fixed points */
|
||||
pd->pd_step[point] =
|
||||
pcinfo->pcdac_x3[point];
|
||||
}
|
||||
|
||||
/* Since we have a higher gain curve
|
||||
* override min power */
|
||||
chinfo[pier].min_pwr = pd->pd_pwr[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Parse EEPROM data */
|
||||
static int
|
||||
ath5k_eeprom_read_pcal_info_5112(struct ath5k_hw *ah, int mode)
|
||||
{
|
||||
struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
|
||||
struct ath5k_chan_pcal_info_rf5112 *chan_pcal_info;
|
||||
struct ath5k_chan_pcal_info *gen_chan_info;
|
||||
u8 *pdgain_idx = ee->ee_pdc_to_idx[mode];
|
||||
u32 offset;
|
||||
unsigned int i, c;
|
||||
u8 i, c;
|
||||
u16 val;
|
||||
int ret;
|
||||
u8 pd_gains = 0;
|
||||
|
||||
/* Count how many curves we have and
|
||||
* identify them (which one of the 4
|
||||
* available curves we have on each count).
|
||||
* Curves are stored from lower (x0) to
|
||||
* higher (x3) gain */
|
||||
for (i = 0; i < AR5K_EEPROM_N_PD_CURVES; i++) {
|
||||
/* ee_x_gain[mode] is x gain mask */
|
||||
if ((ee->ee_x_gain[mode] >> i) & 0x1)
|
||||
pdgain_idx[pd_gains++] = i;
|
||||
}
|
||||
ee->ee_pd_gains[mode] = pd_gains;
|
||||
|
||||
if (pd_gains == 0 || pd_gains > 2)
|
||||
return -EINVAL;
|
||||
|
||||
switch (mode) {
|
||||
case AR5K_EEPROM_MODE_11A:
|
||||
|
@ -808,13 +1017,13 @@ ath5k_eeprom_read_pcal_info_5112(struct ath5k_hw *ah, int mode)
|
|||
for (i = 0; i < ee->ee_n_piers[mode]; i++) {
|
||||
chan_pcal_info = &gen_chan_info[i].rf5112_info;
|
||||
|
||||
/* Power values in dBm * 4
|
||||
/* Power values in quarter dB
|
||||
* for the lower xpd gain curve
|
||||
* (0 dBm -> higher output power) */
|
||||
for (c = 0; c < AR5K_EEPROM_N_XPD0_POINTS; c++) {
|
||||
AR5K_EEPROM_READ(offset++, val);
|
||||
chan_pcal_info->pwr_x0[c] = (val & 0xff);
|
||||
chan_pcal_info->pwr_x0[++c] = ((val >> 8) & 0xff);
|
||||
chan_pcal_info->pwr_x0[c] = (s8) (val & 0xff);
|
||||
chan_pcal_info->pwr_x0[++c] = (s8) ((val >> 8) & 0xff);
|
||||
}
|
||||
|
||||
/* PCDAC steps
|
||||
|
@ -825,12 +1034,12 @@ ath5k_eeprom_read_pcal_info_5112(struct ath5k_hw *ah, int mode)
|
|||
chan_pcal_info->pcdac_x0[2] = ((val >> 5) & 0x1f);
|
||||
chan_pcal_info->pcdac_x0[3] = ((val >> 10) & 0x1f);
|
||||
|
||||
/* Power values in dBm * 4
|
||||
/* Power values in quarter dB
|
||||
* for the higher xpd gain curve
|
||||
* (18 dBm -> lower output power) */
|
||||
AR5K_EEPROM_READ(offset++, val);
|
||||
chan_pcal_info->pwr_x3[0] = (val & 0xff);
|
||||
chan_pcal_info->pwr_x3[1] = ((val >> 8) & 0xff);
|
||||
chan_pcal_info->pwr_x3[0] = (s8) (val & 0xff);
|
||||
chan_pcal_info->pwr_x3[1] = (s8) ((val >> 8) & 0xff);
|
||||
|
||||
AR5K_EEPROM_READ(offset++, val);
|
||||
chan_pcal_info->pwr_x3[2] = (val & 0xff);
|
||||
|
@ -843,24 +1052,36 @@ ath5k_eeprom_read_pcal_info_5112(struct ath5k_hw *ah, int mode)
|
|||
chan_pcal_info->pcdac_x3[2] = 63;
|
||||
|
||||
if (ee->ee_version >= AR5K_EEPROM_VERSION_4_3) {
|
||||
chan_pcal_info->pcdac_x0[0] = ((val >> 8) & 0xff);
|
||||
chan_pcal_info->pcdac_x0[0] = ((val >> 8) & 0x3f);
|
||||
|
||||
/* Last xpd0 power level is also channel maximum */
|
||||
gen_chan_info[i].max_pwr = chan_pcal_info->pwr_x0[3];
|
||||
} else {
|
||||
chan_pcal_info->pcdac_x0[0] = 1;
|
||||
gen_chan_info[i].max_pwr = ((val >> 8) & 0xff);
|
||||
gen_chan_info[i].max_pwr = (s8) ((val >> 8) & 0xff);
|
||||
}
|
||||
|
||||
/* Recreate pcdac_x0 table for this channel using pcdac steps */
|
||||
chan_pcal_info->pcdac_x0[1] += chan_pcal_info->pcdac_x0[0];
|
||||
chan_pcal_info->pcdac_x0[2] += chan_pcal_info->pcdac_x0[1];
|
||||
chan_pcal_info->pcdac_x0[3] += chan_pcal_info->pcdac_x0[2];
|
||||
}
|
||||
|
||||
return 0;
|
||||
return ath5k_eeprom_convert_pcal_info_5112(ah, mode, gen_chan_info);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Read power calibration for RF2413 chips
|
||||
*
|
||||
* For RF2413 we have a Power to PDDAC table (Power Detector)
|
||||
* instead of a PCDAC and 4 pd gain curves for each calibrated channel.
|
||||
* Each curve has power on x axis in 0.5 db steps and PDDADC steps on y
|
||||
* axis and looks like an exponential function like the RF5111 curve.
|
||||
*
|
||||
* To recreate the curves we read here the points and interpolate
|
||||
* later. Note that in most cases only 2 (higher and lower) curves are
|
||||
* used (like RF5112) but vendors have the oportunity to include all
|
||||
* 4 curves on eeprom. The final curve (higher power) has an extra
|
||||
* point for better accuracy like RF5112.
|
||||
*/
|
||||
|
||||
/* For RF2413 power calibration data doesn't start on a fixed location and
|
||||
* if a mode is not supported, it's section is missing -not zeroed-.
|
||||
* So we need to calculate the starting offset for each section by using
|
||||
|
@ -890,12 +1111,14 @@ ath5k_cal_data_offset_2413(struct ath5k_eeprom_info *ee, int mode)
|
|||
switch(mode) {
|
||||
case AR5K_EEPROM_MODE_11G:
|
||||
if (AR5K_EEPROM_HDR_11B(ee->ee_header))
|
||||
offset += ath5k_pdgains_size_2413(ee, AR5K_EEPROM_MODE_11B) +
|
||||
offset += ath5k_pdgains_size_2413(ee,
|
||||
AR5K_EEPROM_MODE_11B) +
|
||||
AR5K_EEPROM_N_2GHZ_CHAN_2413 / 2;
|
||||
/* fall through */
|
||||
case AR5K_EEPROM_MODE_11B:
|
||||
if (AR5K_EEPROM_HDR_11A(ee->ee_header))
|
||||
offset += ath5k_pdgains_size_2413(ee, AR5K_EEPROM_MODE_11A) +
|
||||
offset += ath5k_pdgains_size_2413(ee,
|
||||
AR5K_EEPROM_MODE_11A) +
|
||||
AR5K_EEPROM_N_5GHZ_CHAN / 2;
|
||||
/* fall through */
|
||||
case AR5K_EEPROM_MODE_11A:
|
||||
|
@ -907,37 +1130,118 @@ ath5k_cal_data_offset_2413(struct ath5k_eeprom_info *ee, int mode)
|
|||
return offset;
|
||||
}
|
||||
|
||||
/* Read power calibration for RF2413 chips
|
||||
* For RF2413 we have a PDDAC table (Power Detector) instead
|
||||
* of a PCDAC and 4 pd gain curves for each calibrated channel.
|
||||
* Each curve has PDDAC steps on x axis and power on y axis and
|
||||
* looks like an exponential function. To recreate the curves
|
||||
* we read here the points and interpolate later. Note that
|
||||
* in most cases only higher and lower curves are used (like
|
||||
* RF5112) but vendors have the oportunity to include all 4
|
||||
* curves on eeprom. The final curve (higher power) has an extra
|
||||
* point for better accuracy like RF5112.
|
||||
*/
|
||||
/* Convert RF2413 specific data to generic raw data
|
||||
* used by interpolation code */
|
||||
static int
|
||||
ath5k_eeprom_convert_pcal_info_2413(struct ath5k_hw *ah, int mode,
|
||||
struct ath5k_chan_pcal_info *chinfo)
|
||||
{
|
||||
struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
|
||||
struct ath5k_chan_pcal_info_rf2413 *pcinfo;
|
||||
u8 *pdgain_idx = ee->ee_pdc_to_idx[mode];
|
||||
unsigned int pier, pdg, point;
|
||||
|
||||
/* Fill raw data for each calibration pier */
|
||||
for (pier = 0; pier < ee->ee_n_piers[mode]; pier++) {
|
||||
|
||||
pcinfo = &chinfo[pier].rf2413_info;
|
||||
|
||||
/* Allocate pd_curves for this cal pier */
|
||||
chinfo[pier].pd_curves =
|
||||
kcalloc(AR5K_EEPROM_N_PD_CURVES,
|
||||
sizeof(struct ath5k_pdgain_info),
|
||||
GFP_KERNEL);
|
||||
|
||||
if (!chinfo[pier].pd_curves)
|
||||
return -ENOMEM;
|
||||
|
||||
/* Fill pd_curves */
|
||||
for (pdg = 0; pdg < ee->ee_pd_gains[mode]; pdg++) {
|
||||
|
||||
u8 idx = pdgain_idx[pdg];
|
||||
struct ath5k_pdgain_info *pd =
|
||||
&chinfo[pier].pd_curves[idx];
|
||||
|
||||
/* One more point for the highest power
|
||||
* curve (lowest gain) */
|
||||
if (pdg == ee->ee_pd_gains[mode] - 1)
|
||||
pd->pd_points = AR5K_EEPROM_N_PD_POINTS;
|
||||
else
|
||||
pd->pd_points = AR5K_EEPROM_N_PD_POINTS - 1;
|
||||
|
||||
/* Allocate pd points for this curve */
|
||||
pd->pd_step = kcalloc(pd->pd_points,
|
||||
sizeof(u8), GFP_KERNEL);
|
||||
|
||||
if (!pd->pd_step)
|
||||
return -ENOMEM;
|
||||
|
||||
pd->pd_pwr = kcalloc(pd->pd_points,
|
||||
sizeof(s16), GFP_KERNEL);
|
||||
|
||||
if (!pd->pd_pwr)
|
||||
return -ENOMEM;
|
||||
|
||||
/* Fill raw dataset
|
||||
* convert all pwr levels to
|
||||
* quarter dB for RF5112 combatibility */
|
||||
pd->pd_step[0] = pcinfo->pddac_i[pdg];
|
||||
pd->pd_pwr[0] = 4 * pcinfo->pwr_i[pdg];
|
||||
|
||||
for (point = 1; point < pd->pd_points; point++) {
|
||||
|
||||
pd->pd_pwr[point] = pd->pd_pwr[point - 1] +
|
||||
2 * pcinfo->pwr[pdg][point - 1];
|
||||
|
||||
pd->pd_step[point] = pd->pd_step[point - 1] +
|
||||
pcinfo->pddac[pdg][point - 1];
|
||||
|
||||
}
|
||||
|
||||
/* Highest gain curve -> min power */
|
||||
if (pdg == 0)
|
||||
chinfo[pier].min_pwr = pd->pd_pwr[0];
|
||||
|
||||
/* Lowest gain curve -> max power */
|
||||
if (pdg == ee->ee_pd_gains[mode] - 1)
|
||||
chinfo[pier].max_pwr =
|
||||
pd->pd_pwr[pd->pd_points - 1];
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Parse EEPROM data */
|
||||
static int
|
||||
ath5k_eeprom_read_pcal_info_2413(struct ath5k_hw *ah, int mode)
|
||||
{
|
||||
struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
|
||||
struct ath5k_chan_pcal_info_rf2413 *chan_pcal_info;
|
||||
struct ath5k_chan_pcal_info *gen_chan_info;
|
||||
unsigned int i, c;
|
||||
struct ath5k_chan_pcal_info_rf2413 *pcinfo;
|
||||
struct ath5k_chan_pcal_info *chinfo;
|
||||
u8 *pdgain_idx = ee->ee_pdc_to_idx[mode];
|
||||
u32 offset;
|
||||
int ret;
|
||||
int idx, i, ret;
|
||||
u16 val;
|
||||
u8 pd_gains = 0;
|
||||
|
||||
if (ee->ee_x_gain[mode] & 0x1) pd_gains++;
|
||||
if ((ee->ee_x_gain[mode] >> 1) & 0x1) pd_gains++;
|
||||
if ((ee->ee_x_gain[mode] >> 2) & 0x1) pd_gains++;
|
||||
if ((ee->ee_x_gain[mode] >> 3) & 0x1) pd_gains++;
|
||||
/* Count how many curves we have and
|
||||
* identify them (which one of the 4
|
||||
* available curves we have on each count).
|
||||
* Curves are stored from higher to
|
||||
* lower gain so we go backwards */
|
||||
for (idx = AR5K_EEPROM_N_PD_CURVES - 1; idx >= 0; idx--) {
|
||||
/* ee_x_gain[mode] is x gain mask */
|
||||
if ((ee->ee_x_gain[mode] >> idx) & 0x1)
|
||||
pdgain_idx[pd_gains++] = idx;
|
||||
|
||||
}
|
||||
ee->ee_pd_gains[mode] = pd_gains;
|
||||
|
||||
if (pd_gains == 0)
|
||||
return -EINVAL;
|
||||
|
||||
offset = ath5k_cal_data_offset_2413(ee, mode);
|
||||
ee->ee_n_piers[mode] = 0;
|
||||
switch (mode) {
|
||||
case AR5K_EEPROM_MODE_11A:
|
||||
if (!AR5K_EEPROM_HDR_11A(ee->ee_header))
|
||||
|
@ -945,7 +1249,7 @@ ath5k_eeprom_read_pcal_info_2413(struct ath5k_hw *ah, int mode)
|
|||
|
||||
ath5k_eeprom_init_11a_pcal_freq(ah, offset);
|
||||
offset += AR5K_EEPROM_N_5GHZ_CHAN / 2;
|
||||
gen_chan_info = ee->ee_pwr_cal_a;
|
||||
chinfo = ee->ee_pwr_cal_a;
|
||||
break;
|
||||
case AR5K_EEPROM_MODE_11B:
|
||||
if (!AR5K_EEPROM_HDR_11B(ee->ee_header))
|
||||
|
@ -953,7 +1257,7 @@ ath5k_eeprom_read_pcal_info_2413(struct ath5k_hw *ah, int mode)
|
|||
|
||||
ath5k_eeprom_init_11bg_2413(ah, mode, offset);
|
||||
offset += AR5K_EEPROM_N_2GHZ_CHAN_2413 / 2;
|
||||
gen_chan_info = ee->ee_pwr_cal_b;
|
||||
chinfo = ee->ee_pwr_cal_b;
|
||||
break;
|
||||
case AR5K_EEPROM_MODE_11G:
|
||||
if (!AR5K_EEPROM_HDR_11G(ee->ee_header))
|
||||
|
@ -961,41 +1265,35 @@ ath5k_eeprom_read_pcal_info_2413(struct ath5k_hw *ah, int mode)
|
|||
|
||||
ath5k_eeprom_init_11bg_2413(ah, mode, offset);
|
||||
offset += AR5K_EEPROM_N_2GHZ_CHAN_2413 / 2;
|
||||
gen_chan_info = ee->ee_pwr_cal_g;
|
||||
chinfo = ee->ee_pwr_cal_g;
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (pd_gains == 0)
|
||||
return 0;
|
||||
|
||||
for (i = 0; i < ee->ee_n_piers[mode]; i++) {
|
||||
chan_pcal_info = &gen_chan_info[i].rf2413_info;
|
||||
pcinfo = &chinfo[i].rf2413_info;
|
||||
|
||||
/*
|
||||
* Read pwr_i, pddac_i and the first
|
||||
* 2 pd points (pwr, pddac)
|
||||
*/
|
||||
AR5K_EEPROM_READ(offset++, val);
|
||||
chan_pcal_info->pwr_i[0] = val & 0x1f;
|
||||
chan_pcal_info->pddac_i[0] = (val >> 5) & 0x7f;
|
||||
chan_pcal_info->pwr[0][0] =
|
||||
(val >> 12) & 0xf;
|
||||
pcinfo->pwr_i[0] = val & 0x1f;
|
||||
pcinfo->pddac_i[0] = (val >> 5) & 0x7f;
|
||||
pcinfo->pwr[0][0] = (val >> 12) & 0xf;
|
||||
|
||||
AR5K_EEPROM_READ(offset++, val);
|
||||
chan_pcal_info->pddac[0][0] = val & 0x3f;
|
||||
chan_pcal_info->pwr[0][1] = (val >> 6) & 0xf;
|
||||
chan_pcal_info->pddac[0][1] =
|
||||
(val >> 10) & 0x3f;
|
||||
pcinfo->pddac[0][0] = val & 0x3f;
|
||||
pcinfo->pwr[0][1] = (val >> 6) & 0xf;
|
||||
pcinfo->pddac[0][1] = (val >> 10) & 0x3f;
|
||||
|
||||
AR5K_EEPROM_READ(offset++, val);
|
||||
chan_pcal_info->pwr[0][2] = val & 0xf;
|
||||
chan_pcal_info->pddac[0][2] =
|
||||
(val >> 4) & 0x3f;
|
||||
pcinfo->pwr[0][2] = val & 0xf;
|
||||
pcinfo->pddac[0][2] = (val >> 4) & 0x3f;
|
||||
|
||||
chan_pcal_info->pwr[0][3] = 0;
|
||||
chan_pcal_info->pddac[0][3] = 0;
|
||||
pcinfo->pwr[0][3] = 0;
|
||||
pcinfo->pddac[0][3] = 0;
|
||||
|
||||
if (pd_gains > 1) {
|
||||
/*
|
||||
|
@ -1003,44 +1301,36 @@ ath5k_eeprom_read_pcal_info_2413(struct ath5k_hw *ah, int mode)
|
|||
* so it only has 2 pd points.
|
||||
* Continue wih pd gain 1.
|
||||
*/
|
||||
chan_pcal_info->pwr_i[1] = (val >> 10) & 0x1f;
|
||||
pcinfo->pwr_i[1] = (val >> 10) & 0x1f;
|
||||
|
||||
chan_pcal_info->pddac_i[1] = (val >> 15) & 0x1;
|
||||
pcinfo->pddac_i[1] = (val >> 15) & 0x1;
|
||||
AR5K_EEPROM_READ(offset++, val);
|
||||
chan_pcal_info->pddac_i[1] |= (val & 0x3F) << 1;
|
||||
pcinfo->pddac_i[1] |= (val & 0x3F) << 1;
|
||||
|
||||
chan_pcal_info->pwr[1][0] = (val >> 6) & 0xf;
|
||||
chan_pcal_info->pddac[1][0] =
|
||||
(val >> 10) & 0x3f;
|
||||
pcinfo->pwr[1][0] = (val >> 6) & 0xf;
|
||||
pcinfo->pddac[1][0] = (val >> 10) & 0x3f;
|
||||
|
||||
AR5K_EEPROM_READ(offset++, val);
|
||||
chan_pcal_info->pwr[1][1] = val & 0xf;
|
||||
chan_pcal_info->pddac[1][1] =
|
||||
(val >> 4) & 0x3f;
|
||||
chan_pcal_info->pwr[1][2] =
|
||||
(val >> 10) & 0xf;
|
||||
pcinfo->pwr[1][1] = val & 0xf;
|
||||
pcinfo->pddac[1][1] = (val >> 4) & 0x3f;
|
||||
pcinfo->pwr[1][2] = (val >> 10) & 0xf;
|
||||
|
||||
chan_pcal_info->pddac[1][2] =
|
||||
(val >> 14) & 0x3;
|
||||
pcinfo->pddac[1][2] = (val >> 14) & 0x3;
|
||||
AR5K_EEPROM_READ(offset++, val);
|
||||
chan_pcal_info->pddac[1][2] |=
|
||||
(val & 0xF) << 2;
|
||||
pcinfo->pddac[1][2] |= (val & 0xF) << 2;
|
||||
|
||||
chan_pcal_info->pwr[1][3] = 0;
|
||||
chan_pcal_info->pddac[1][3] = 0;
|
||||
pcinfo->pwr[1][3] = 0;
|
||||
pcinfo->pddac[1][3] = 0;
|
||||
} else if (pd_gains == 1) {
|
||||
/*
|
||||
* Pd gain 0 is the last one so
|
||||
* read the extra point.
|
||||
*/
|
||||
chan_pcal_info->pwr[0][3] =
|
||||
(val >> 10) & 0xf;
|
||||
pcinfo->pwr[0][3] = (val >> 10) & 0xf;
|
||||
|
||||
chan_pcal_info->pddac[0][3] =
|
||||
(val >> 14) & 0x3;
|
||||
pcinfo->pddac[0][3] = (val >> 14) & 0x3;
|
||||
AR5K_EEPROM_READ(offset++, val);
|
||||
chan_pcal_info->pddac[0][3] |=
|
||||
(val & 0xF) << 2;
|
||||
pcinfo->pddac[0][3] |= (val & 0xF) << 2;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1048,105 +1338,65 @@ ath5k_eeprom_read_pcal_info_2413(struct ath5k_hw *ah, int mode)
|
|||
* as above.
|
||||
*/
|
||||
if (pd_gains > 2) {
|
||||
chan_pcal_info->pwr_i[2] = (val >> 4) & 0x1f;
|
||||
chan_pcal_info->pddac_i[2] = (val >> 9) & 0x7f;
|
||||
pcinfo->pwr_i[2] = (val >> 4) & 0x1f;
|
||||
pcinfo->pddac_i[2] = (val >> 9) & 0x7f;
|
||||
|
||||
AR5K_EEPROM_READ(offset++, val);
|
||||
chan_pcal_info->pwr[2][0] =
|
||||
(val >> 0) & 0xf;
|
||||
chan_pcal_info->pddac[2][0] =
|
||||
(val >> 4) & 0x3f;
|
||||
chan_pcal_info->pwr[2][1] =
|
||||
(val >> 10) & 0xf;
|
||||
pcinfo->pwr[2][0] = (val >> 0) & 0xf;
|
||||
pcinfo->pddac[2][0] = (val >> 4) & 0x3f;
|
||||
pcinfo->pwr[2][1] = (val >> 10) & 0xf;
|
||||
|
||||
chan_pcal_info->pddac[2][1] =
|
||||
(val >> 14) & 0x3;
|
||||
pcinfo->pddac[2][1] = (val >> 14) & 0x3;
|
||||
AR5K_EEPROM_READ(offset++, val);
|
||||
chan_pcal_info->pddac[2][1] |=
|
||||
(val & 0xF) << 2;
|
||||
pcinfo->pddac[2][1] |= (val & 0xF) << 2;
|
||||
|
||||
chan_pcal_info->pwr[2][2] =
|
||||
(val >> 4) & 0xf;
|
||||
chan_pcal_info->pddac[2][2] =
|
||||
(val >> 8) & 0x3f;
|
||||
pcinfo->pwr[2][2] = (val >> 4) & 0xf;
|
||||
pcinfo->pddac[2][2] = (val >> 8) & 0x3f;
|
||||
|
||||
chan_pcal_info->pwr[2][3] = 0;
|
||||
chan_pcal_info->pddac[2][3] = 0;
|
||||
pcinfo->pwr[2][3] = 0;
|
||||
pcinfo->pddac[2][3] = 0;
|
||||
} else if (pd_gains == 2) {
|
||||
chan_pcal_info->pwr[1][3] =
|
||||
(val >> 4) & 0xf;
|
||||
chan_pcal_info->pddac[1][3] =
|
||||
(val >> 8) & 0x3f;
|
||||
pcinfo->pwr[1][3] = (val >> 4) & 0xf;
|
||||
pcinfo->pddac[1][3] = (val >> 8) & 0x3f;
|
||||
}
|
||||
|
||||
if (pd_gains > 3) {
|
||||
chan_pcal_info->pwr_i[3] = (val >> 14) & 0x3;
|
||||
pcinfo->pwr_i[3] = (val >> 14) & 0x3;
|
||||
AR5K_EEPROM_READ(offset++, val);
|
||||
chan_pcal_info->pwr_i[3] |= ((val >> 0) & 0x7) << 2;
|
||||
pcinfo->pwr_i[3] |= ((val >> 0) & 0x7) << 2;
|
||||
|
||||
chan_pcal_info->pddac_i[3] = (val >> 3) & 0x7f;
|
||||
chan_pcal_info->pwr[3][0] =
|
||||
(val >> 10) & 0xf;
|
||||
chan_pcal_info->pddac[3][0] =
|
||||
(val >> 14) & 0x3;
|
||||
pcinfo->pddac_i[3] = (val >> 3) & 0x7f;
|
||||
pcinfo->pwr[3][0] = (val >> 10) & 0xf;
|
||||
pcinfo->pddac[3][0] = (val >> 14) & 0x3;
|
||||
|
||||
AR5K_EEPROM_READ(offset++, val);
|
||||
chan_pcal_info->pddac[3][0] |=
|
||||
(val & 0xF) << 2;
|
||||
chan_pcal_info->pwr[3][1] =
|
||||
(val >> 4) & 0xf;
|
||||
chan_pcal_info->pddac[3][1] =
|
||||
(val >> 8) & 0x3f;
|
||||
pcinfo->pddac[3][0] |= (val & 0xF) << 2;
|
||||
pcinfo->pwr[3][1] = (val >> 4) & 0xf;
|
||||
pcinfo->pddac[3][1] = (val >> 8) & 0x3f;
|
||||
|
||||
chan_pcal_info->pwr[3][2] =
|
||||
(val >> 14) & 0x3;
|
||||
pcinfo->pwr[3][2] = (val >> 14) & 0x3;
|
||||
AR5K_EEPROM_READ(offset++, val);
|
||||
chan_pcal_info->pwr[3][2] |=
|
||||
((val >> 0) & 0x3) << 2;
|
||||
pcinfo->pwr[3][2] |= ((val >> 0) & 0x3) << 2;
|
||||
|
||||
chan_pcal_info->pddac[3][2] =
|
||||
(val >> 2) & 0x3f;
|
||||
chan_pcal_info->pwr[3][3] =
|
||||
(val >> 8) & 0xf;
|
||||
pcinfo->pddac[3][2] = (val >> 2) & 0x3f;
|
||||
pcinfo->pwr[3][3] = (val >> 8) & 0xf;
|
||||
|
||||
chan_pcal_info->pddac[3][3] =
|
||||
(val >> 12) & 0xF;
|
||||
pcinfo->pddac[3][3] = (val >> 12) & 0xF;
|
||||
AR5K_EEPROM_READ(offset++, val);
|
||||
chan_pcal_info->pddac[3][3] |=
|
||||
((val >> 0) & 0x3) << 4;
|
||||
pcinfo->pddac[3][3] |= ((val >> 0) & 0x3) << 4;
|
||||
} else if (pd_gains == 3) {
|
||||
chan_pcal_info->pwr[2][3] =
|
||||
(val >> 14) & 0x3;
|
||||
pcinfo->pwr[2][3] = (val >> 14) & 0x3;
|
||||
AR5K_EEPROM_READ(offset++, val);
|
||||
chan_pcal_info->pwr[2][3] |=
|
||||
((val >> 0) & 0x3) << 2;
|
||||
pcinfo->pwr[2][3] |= ((val >> 0) & 0x3) << 2;
|
||||
|
||||
chan_pcal_info->pddac[2][3] =
|
||||
(val >> 2) & 0x3f;
|
||||
}
|
||||
|
||||
for (c = 0; c < pd_gains; c++) {
|
||||
/* Recreate pwr table for this channel using pwr steps */
|
||||
chan_pcal_info->pwr[c][0] += chan_pcal_info->pwr_i[c] * 2;
|
||||
chan_pcal_info->pwr[c][1] += chan_pcal_info->pwr[c][0];
|
||||
chan_pcal_info->pwr[c][2] += chan_pcal_info->pwr[c][1];
|
||||
chan_pcal_info->pwr[c][3] += chan_pcal_info->pwr[c][2];
|
||||
if (chan_pcal_info->pwr[c][3] == chan_pcal_info->pwr[c][2])
|
||||
chan_pcal_info->pwr[c][3] = 0;
|
||||
|
||||
/* Recreate pddac table for this channel using pddac steps */
|
||||
chan_pcal_info->pddac[c][0] += chan_pcal_info->pddac_i[c];
|
||||
chan_pcal_info->pddac[c][1] += chan_pcal_info->pddac[c][0];
|
||||
chan_pcal_info->pddac[c][2] += chan_pcal_info->pddac[c][1];
|
||||
chan_pcal_info->pddac[c][3] += chan_pcal_info->pddac[c][2];
|
||||
if (chan_pcal_info->pddac[c][3] == chan_pcal_info->pddac[c][2])
|
||||
chan_pcal_info->pddac[c][3] = 0;
|
||||
pcinfo->pddac[2][3] = (val >> 2) & 0x3f;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return ath5k_eeprom_convert_pcal_info_2413(ah, mode, chinfo);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Read per rate target power (this is the maximum tx power
|
||||
* supported by the card). This info is used when setting
|
||||
|
@ -1154,11 +1404,12 @@ ath5k_eeprom_read_pcal_info_2413(struct ath5k_hw *ah, int mode)
|
|||
*
|
||||
* This also works for v5 EEPROMs.
|
||||
*/
|
||||
static int ath5k_eeprom_read_target_rate_pwr_info(struct ath5k_hw *ah, unsigned int mode)
|
||||
static int
|
||||
ath5k_eeprom_read_target_rate_pwr_info(struct ath5k_hw *ah, unsigned int mode)
|
||||
{
|
||||
struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
|
||||
struct ath5k_rate_pcal_info *rate_pcal_info;
|
||||
u16 *rate_target_pwr_num;
|
||||
u8 *rate_target_pwr_num;
|
||||
u32 offset;
|
||||
u16 val;
|
||||
int ret, i;
|
||||
|
@ -1264,7 +1515,9 @@ ath5k_eeprom_read_pcal_info(struct ath5k_hw *ah)
|
|||
else
|
||||
read_pcal = ath5k_eeprom_read_pcal_info_5111;
|
||||
|
||||
for (mode = AR5K_EEPROM_MODE_11A; mode <= AR5K_EEPROM_MODE_11G; mode++) {
|
||||
|
||||
for (mode = AR5K_EEPROM_MODE_11A; mode <= AR5K_EEPROM_MODE_11G;
|
||||
mode++) {
|
||||
err = read_pcal(ah, mode);
|
||||
if (err)
|
||||
return err;
|
||||
|
@ -1277,6 +1530,62 @@ ath5k_eeprom_read_pcal_info(struct ath5k_hw *ah)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
ath5k_eeprom_free_pcal_info(struct ath5k_hw *ah, int mode)
|
||||
{
|
||||
struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
|
||||
struct ath5k_chan_pcal_info *chinfo;
|
||||
u8 pier, pdg;
|
||||
|
||||
switch (mode) {
|
||||
case AR5K_EEPROM_MODE_11A:
|
||||
if (!AR5K_EEPROM_HDR_11A(ee->ee_header))
|
||||
return 0;
|
||||
chinfo = ee->ee_pwr_cal_a;
|
||||
break;
|
||||
case AR5K_EEPROM_MODE_11B:
|
||||
if (!AR5K_EEPROM_HDR_11B(ee->ee_header))
|
||||
return 0;
|
||||
chinfo = ee->ee_pwr_cal_b;
|
||||
break;
|
||||
case AR5K_EEPROM_MODE_11G:
|
||||
if (!AR5K_EEPROM_HDR_11G(ee->ee_header))
|
||||
return 0;
|
||||
chinfo = ee->ee_pwr_cal_g;
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
for (pier = 0; pier < ee->ee_n_piers[mode]; pier++) {
|
||||
if (!chinfo[pier].pd_curves)
|
||||
continue;
|
||||
|
||||
for (pdg = 0; pdg < ee->ee_pd_gains[mode]; pdg++) {
|
||||
struct ath5k_pdgain_info *pd =
|
||||
&chinfo[pier].pd_curves[pdg];
|
||||
|
||||
if (pd != NULL) {
|
||||
kfree(pd->pd_step);
|
||||
kfree(pd->pd_pwr);
|
||||
}
|
||||
}
|
||||
|
||||
kfree(chinfo[pier].pd_curves);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
ath5k_eeprom_detach(struct ath5k_hw *ah)
|
||||
{
|
||||
u8 mode;
|
||||
|
||||
for (mode = AR5K_EEPROM_MODE_11A; mode <= AR5K_EEPROM_MODE_11G; mode++)
|
||||
ath5k_eeprom_free_pcal_info(ah, mode);
|
||||
}
|
||||
|
||||
/* Read conformance test limits used for regulatory control */
|
||||
static int
|
||||
ath5k_eeprom_read_ctl_info(struct ath5k_hw *ah)
|
||||
|
@ -1457,3 +1766,4 @@ bool ath5k_eeprom_is_hb63(struct ath5k_hw *ah)
|
|||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -173,6 +173,7 @@
|
|||
#define AR5K_EEPROM_N_5GHZ_CHAN 10
|
||||
#define AR5K_EEPROM_N_2GHZ_CHAN 3
|
||||
#define AR5K_EEPROM_N_2GHZ_CHAN_2413 4
|
||||
#define AR5K_EEPROM_N_2GHZ_CHAN_MAX 4
|
||||
#define AR5K_EEPROM_MAX_CHAN 10
|
||||
#define AR5K_EEPROM_N_PWR_POINTS_5111 11
|
||||
#define AR5K_EEPROM_N_PCDAC 11
|
||||
|
@ -193,7 +194,7 @@
|
|||
#define AR5K_EEPROM_SCALE_OC_DELTA(_x) (((_x) * 2) / 10)
|
||||
#define AR5K_EEPROM_N_CTLS(_v) AR5K_EEPROM_OFF(_v, 16, 32)
|
||||
#define AR5K_EEPROM_MAX_CTLS 32
|
||||
#define AR5K_EEPROM_N_XPD_PER_CHANNEL 4
|
||||
#define AR5K_EEPROM_N_PD_CURVES 4
|
||||
#define AR5K_EEPROM_N_XPD0_POINTS 4
|
||||
#define AR5K_EEPROM_N_XPD3_POINTS 3
|
||||
#define AR5K_EEPROM_N_PD_GAINS 4
|
||||
|
@ -232,7 +233,7 @@ enum ath5k_ctl_mode {
|
|||
AR5K_CTL_11B = 1,
|
||||
AR5K_CTL_11G = 2,
|
||||
AR5K_CTL_TURBO = 3,
|
||||
AR5K_CTL_108G = 4,
|
||||
AR5K_CTL_TURBOG = 4,
|
||||
AR5K_CTL_2GHT20 = 5,
|
||||
AR5K_CTL_5GHT20 = 6,
|
||||
AR5K_CTL_2GHT40 = 7,
|
||||
|
@ -240,6 +241,29 @@ enum ath5k_ctl_mode {
|
|||
AR5K_CTL_MODE_M = 15,
|
||||
};
|
||||
|
||||
/* Default CTL ids for the 3 main reg domains.
|
||||
* Atheros only uses these by default but vendors
|
||||
* can have up to 32 different CTLs for different
|
||||
* scenarios. Note that theese values are ORed with
|
||||
* the mode id (above) so we can have up to 24 CTL
|
||||
* datasets out of these 3 main regdomains. That leaves
|
||||
* 8 ids that can be used by vendors and since 0x20 is
|
||||
* missing from HAL sources i guess this is the set of
|
||||
* custom CTLs vendors can use. */
|
||||
#define AR5K_CTL_FCC 0x10
|
||||
#define AR5K_CTL_CUSTOM 0x20
|
||||
#define AR5K_CTL_ETSI 0x30
|
||||
#define AR5K_CTL_MKK 0x40
|
||||
|
||||
/* Indicates a CTL with only mode set and
|
||||
* no reg domain mapping, such CTLs are used
|
||||
* for world roaming domains or simply when
|
||||
* a reg domain is not set */
|
||||
#define AR5K_CTL_NO_REGDOMAIN 0xf0
|
||||
|
||||
/* Indicates an empty (invalid) CTL */
|
||||
#define AR5K_CTL_NO_CTL 0xff
|
||||
|
||||
/* Per channel calibration data, used for power table setup */
|
||||
struct ath5k_chan_pcal_info_rf5111 {
|
||||
/* Power levels in half dbm units
|
||||
|
@ -257,7 +281,7 @@ struct ath5k_chan_pcal_info_rf5111 {
|
|||
struct ath5k_chan_pcal_info_rf5112 {
|
||||
/* Power levels in quarter dBm units
|
||||
* for lower (0) and higher (3)
|
||||
* level curves */
|
||||
* level curves in 0.25dB units */
|
||||
s8 pwr_x0[AR5K_EEPROM_N_XPD0_POINTS];
|
||||
s8 pwr_x3[AR5K_EEPROM_N_XPD3_POINTS];
|
||||
/* PCDAC table steps
|
||||
|
@ -270,35 +294,61 @@ struct ath5k_chan_pcal_info_rf2413 {
|
|||
/* Starting pwr/pddac values */
|
||||
s8 pwr_i[AR5K_EEPROM_N_PD_GAINS];
|
||||
u8 pddac_i[AR5K_EEPROM_N_PD_GAINS];
|
||||
/* (pwr,pddac) points */
|
||||
/* (pwr,pddac) points
|
||||
* power levels in 0.5dB units */
|
||||
s8 pwr[AR5K_EEPROM_N_PD_GAINS]
|
||||
[AR5K_EEPROM_N_PD_POINTS];
|
||||
u8 pddac[AR5K_EEPROM_N_PD_GAINS]
|
||||
[AR5K_EEPROM_N_PD_POINTS];
|
||||
};
|
||||
|
||||
enum ath5k_powertable_type {
|
||||
AR5K_PWRTABLE_PWR_TO_PCDAC = 0,
|
||||
AR5K_PWRTABLE_LINEAR_PCDAC = 1,
|
||||
AR5K_PWRTABLE_PWR_TO_PDADC = 2,
|
||||
};
|
||||
|
||||
struct ath5k_pdgain_info {
|
||||
u8 pd_points;
|
||||
u8 *pd_step;
|
||||
/* Power values are in
|
||||
* 0.25dB units */
|
||||
s16 *pd_pwr;
|
||||
};
|
||||
|
||||
struct ath5k_chan_pcal_info {
|
||||
/* Frequency */
|
||||
u16 freq;
|
||||
/* Max available power */
|
||||
s8 max_pwr;
|
||||
/* Tx power boundaries */
|
||||
s16 max_pwr;
|
||||
s16 min_pwr;
|
||||
union {
|
||||
struct ath5k_chan_pcal_info_rf5111 rf5111_info;
|
||||
struct ath5k_chan_pcal_info_rf5112 rf5112_info;
|
||||
struct ath5k_chan_pcal_info_rf2413 rf2413_info;
|
||||
};
|
||||
/* Raw values used by phy code
|
||||
* Curves are stored in order from lower
|
||||
* gain to higher gain (max txpower -> min txpower) */
|
||||
struct ath5k_pdgain_info *pd_curves;
|
||||
};
|
||||
|
||||
/* Per rate calibration data for each mode, used for power table setup */
|
||||
/* Per rate calibration data for each mode,
|
||||
* used for rate power table setup.
|
||||
* Note: Values in 0.5dB units */
|
||||
struct ath5k_rate_pcal_info {
|
||||
u16 freq; /* Frequency */
|
||||
/* Power level for 6-24Mbit/s rates */
|
||||
/* Power level for 6-24Mbit/s rates or
|
||||
* 1Mb rate */
|
||||
u16 target_power_6to24;
|
||||
/* Power level for 36Mbit rate */
|
||||
/* Power level for 36Mbit rate or
|
||||
* 2Mb rate */
|
||||
u16 target_power_36;
|
||||
/* Power level for 48Mbit rate */
|
||||
/* Power level for 48Mbit rate or
|
||||
* 5.5Mbit rate */
|
||||
u16 target_power_48;
|
||||
/* Power level for 54Mbit rate */
|
||||
/* Power level for 54Mbit rate or
|
||||
* 11Mbit rate */
|
||||
u16 target_power_54;
|
||||
};
|
||||
|
||||
|
@ -330,12 +380,6 @@ struct ath5k_eeprom_info {
|
|||
u16 ee_cck_ofdm_power_delta;
|
||||
u16 ee_scaled_cck_delta;
|
||||
|
||||
/* Used for tx thermal adjustment (eeprom_init, rfregs) */
|
||||
u16 ee_tx_clip;
|
||||
u16 ee_pwd_84;
|
||||
u16 ee_pwd_90;
|
||||
u16 ee_gain_select;
|
||||
|
||||
/* RF Calibration settings (reset, rfregs) */
|
||||
u16 ee_i_cal[AR5K_EEPROM_N_MODES];
|
||||
u16 ee_q_cal[AR5K_EEPROM_N_MODES];
|
||||
|
@ -363,23 +407,25 @@ struct ath5k_eeprom_info {
|
|||
/* Power calibration data */
|
||||
u16 ee_false_detect[AR5K_EEPROM_N_MODES];
|
||||
|
||||
/* Number of pd gain curves per mode (RF2413) */
|
||||
/* Number of pd gain curves per mode */
|
||||
u8 ee_pd_gains[AR5K_EEPROM_N_MODES];
|
||||
/* Back mapping pdcurve number -> pdcurve index in pd->pd_curves */
|
||||
u8 ee_pdc_to_idx[AR5K_EEPROM_N_MODES][AR5K_EEPROM_N_PD_GAINS];
|
||||
|
||||
u8 ee_n_piers[AR5K_EEPROM_N_MODES];
|
||||
struct ath5k_chan_pcal_info ee_pwr_cal_a[AR5K_EEPROM_N_5GHZ_CHAN];
|
||||
struct ath5k_chan_pcal_info ee_pwr_cal_b[AR5K_EEPROM_N_2GHZ_CHAN];
|
||||
struct ath5k_chan_pcal_info ee_pwr_cal_g[AR5K_EEPROM_N_2GHZ_CHAN];
|
||||
struct ath5k_chan_pcal_info ee_pwr_cal_b[AR5K_EEPROM_N_2GHZ_CHAN_MAX];
|
||||
struct ath5k_chan_pcal_info ee_pwr_cal_g[AR5K_EEPROM_N_2GHZ_CHAN_MAX];
|
||||
|
||||
/* Per rate target power levels */
|
||||
u16 ee_rate_target_pwr_num[AR5K_EEPROM_N_MODES];
|
||||
u8 ee_rate_target_pwr_num[AR5K_EEPROM_N_MODES];
|
||||
struct ath5k_rate_pcal_info ee_rate_tpwr_a[AR5K_EEPROM_N_5GHZ_CHAN];
|
||||
struct ath5k_rate_pcal_info ee_rate_tpwr_b[AR5K_EEPROM_N_2GHZ_CHAN];
|
||||
struct ath5k_rate_pcal_info ee_rate_tpwr_g[AR5K_EEPROM_N_2GHZ_CHAN];
|
||||
struct ath5k_rate_pcal_info ee_rate_tpwr_b[AR5K_EEPROM_N_2GHZ_CHAN_MAX];
|
||||
struct ath5k_rate_pcal_info ee_rate_tpwr_g[AR5K_EEPROM_N_2GHZ_CHAN_MAX];
|
||||
|
||||
/* Conformance test limits (Unused) */
|
||||
u16 ee_ctls;
|
||||
u16 ee_ctl[AR5K_EEPROM_MAX_CTLS];
|
||||
u8 ee_ctls;
|
||||
u8 ee_ctl[AR5K_EEPROM_MAX_CTLS];
|
||||
struct ath5k_edge_power ee_ctl_pwr[AR5K_EEPROM_N_EDGES * AR5K_EEPROM_MAX_CTLS];
|
||||
|
||||
/* Noise Floor Calibration settings */
|
||||
|
|
|
@ -1510,8 +1510,8 @@ int ath5k_hw_write_initvals(struct ath5k_hw *ah, u8 mode, bool change_channel)
|
|||
rf2425_ini_mode_end, mode);
|
||||
|
||||
ath5k_hw_ini_registers(ah,
|
||||
ARRAY_SIZE(rf2413_ini_common_end),
|
||||
rf2413_ini_common_end, change_channel);
|
||||
ARRAY_SIZE(rf2425_ini_common_end),
|
||||
rf2425_ini_common_end, change_channel);
|
||||
|
||||
ath5k_hw_ini_registers(ah,
|
||||
ARRAY_SIZE(rf5112_ini_bbgain),
|
||||
|
|
|
@ -65,6 +65,8 @@ static const struct pci_device_id ath5k_led_devices[] = {
|
|||
{ ATH_SDEVICE(PCI_VENDOR_ID_AMBIT, 0x0422), ATH_LED(1, 1) },
|
||||
/* E-machines E510 (tuliom@gmail.com) */
|
||||
{ ATH_SDEVICE(PCI_VENDOR_ID_AMBIT, 0x0428), ATH_LED(3, 0) },
|
||||
/* Acer Extensa 5620z (nekoreeve@gmail.com) */
|
||||
{ ATH_SDEVICE(PCI_VENDOR_ID_QMI, 0x0105), ATH_LED(3, 0) },
|
||||
{ }
|
||||
};
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1553,6 +1553,19 @@
|
|||
|
||||
/*===5212 Specific PCU registers===*/
|
||||
|
||||
/*
|
||||
* Transmit power control register
|
||||
*/
|
||||
#define AR5K_TPC 0x80e8
|
||||
#define AR5K_TPC_ACK 0x0000003f /* ack frames */
|
||||
#define AR5K_TPC_ACK_S 0
|
||||
#define AR5K_TPC_CTS 0x00003f00 /* cts frames */
|
||||
#define AR5K_TPC_CTS_S 8
|
||||
#define AR5K_TPC_CHIRP 0x003f0000 /* chirp frames */
|
||||
#define AR5K_TPC_CHIRP_S 16
|
||||
#define AR5K_TPC_DOPPLER 0x0f000000 /* doppler chirp span */
|
||||
#define AR5K_TPC_DOPPLER_S 24
|
||||
|
||||
/*
|
||||
* XR (eXtended Range) mode register
|
||||
*/
|
||||
|
@ -2550,6 +2563,12 @@
|
|||
#define AR5K_PHY_TPC_RG1 0xa258
|
||||
#define AR5K_PHY_TPC_RG1_NUM_PD_GAIN 0x0000c000
|
||||
#define AR5K_PHY_TPC_RG1_NUM_PD_GAIN_S 14
|
||||
#define AR5K_PHY_TPC_RG1_PDGAIN_1 0x00030000
|
||||
#define AR5K_PHY_TPC_RG1_PDGAIN_1_S 16
|
||||
#define AR5K_PHY_TPC_RG1_PDGAIN_2 0x000c0000
|
||||
#define AR5K_PHY_TPC_RG1_PDGAIN_2_S 18
|
||||
#define AR5K_PHY_TPC_RG1_PDGAIN_3 0x00300000
|
||||
#define AR5K_PHY_TPC_RG1_PDGAIN_3_S 20
|
||||
|
||||
#define AR5K_PHY_TPC_RG5 0xa26C
|
||||
#define AR5K_PHY_TPC_RG5_PD_GAIN_OVERLAP 0x0000000F
|
||||
|
|
|
@ -664,10 +664,7 @@ static void ath5k_hw_commit_eeprom_settings(struct ath5k_hw *ah,
|
|||
struct ieee80211_channel *channel, u8 *ant, u8 ee_mode)
|
||||
{
|
||||
struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
|
||||
|
||||
/* Set CCK to OFDM power delta */
|
||||
if (ah->ah_phy_revision >= AR5K_SREV_PHY_5212A) {
|
||||
int16_t cck_ofdm_pwr_delta;
|
||||
s16 cck_ofdm_pwr_delta;
|
||||
|
||||
/* Adjust power delta for channel 14 */
|
||||
if (channel->center_freq == 2484)
|
||||
|
@ -678,15 +675,24 @@ static void ath5k_hw_commit_eeprom_settings(struct ath5k_hw *ah,
|
|||
cck_ofdm_pwr_delta =
|
||||
(ee->ee_cck_ofdm_power_delta * 2) / 10;
|
||||
|
||||
/* Set CCK to OFDM power delta on tx power
|
||||
* adjustment register */
|
||||
if (ah->ah_phy_revision >= AR5K_SREV_PHY_5212A) {
|
||||
if (channel->hw_value == CHANNEL_G)
|
||||
ath5k_hw_reg_write(ah,
|
||||
AR5K_REG_SM((ee->ee_cck_ofdm_power_delta * -1),
|
||||
AR5K_REG_SM((ee->ee_cck_ofdm_gain_delta * -1),
|
||||
AR5K_PHY_TX_PWR_ADJ_CCK_GAIN_DELTA) |
|
||||
AR5K_REG_SM((cck_ofdm_pwr_delta * -1),
|
||||
AR5K_PHY_TX_PWR_ADJ_CCK_PCDAC_INDEX),
|
||||
AR5K_PHY_TX_PWR_ADJ);
|
||||
else
|
||||
ath5k_hw_reg_write(ah, 0, AR5K_PHY_TX_PWR_ADJ);
|
||||
} else {
|
||||
/* For older revs we scale power on sw during tx power
|
||||
* setup */
|
||||
ah->ah_txpower.txp_cck_ofdm_pwr_delta = cck_ofdm_pwr_delta;
|
||||
ah->ah_txpower.txp_cck_ofdm_gainf_delta =
|
||||
ee->ee_cck_ofdm_gain_delta;
|
||||
}
|
||||
|
||||
/* Set antenna idle switch table */
|
||||
|
@ -994,7 +1000,8 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
|
|||
/*
|
||||
* Set TX power (FIXME)
|
||||
*/
|
||||
ret = ath5k_hw_txpower(ah, channel, AR5K_TUNE_DEFAULT_TXPOWER);
|
||||
ret = ath5k_hw_txpower(ah, channel, ee_mode,
|
||||
AR5K_TUNE_DEFAULT_TXPOWER);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2008 Atheros Communications Inc.
|
||||
* Copyright (c) 2008-2009 Atheros Communications Inc.
|
||||
* Copyright (c) 2009 Gabor Juhos <juhosg@openwrt.org>
|
||||
* Copyright (c) 2009 Imre Kaloz <kaloz@openwrt.org>
|
||||
*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2008 Atheros Communications Inc.
|
||||
* Copyright (c) 2008-2009 Atheros Communications Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2008 Atheros Communications Inc.
|
||||
* Copyright (c) 2008-2009 Atheros Communications Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2008 Atheros Communications Inc.
|
||||
* Copyright (c) 2008-2009 Atheros Communications Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -295,13 +295,9 @@ struct ath_tx_control {
|
|||
enum ath9k_internal_frame_type frame_type;
|
||||
};
|
||||
|
||||
struct ath_xmit_status {
|
||||
int retries;
|
||||
int flags;
|
||||
#define ATH_TX_ERROR 0x01
|
||||
#define ATH_TX_XRETRY 0x02
|
||||
#define ATH_TX_BAR 0x04
|
||||
};
|
||||
|
||||
/* All RSSI values are noise floor adjusted */
|
||||
struct ath_tx_stat {
|
||||
|
@ -390,6 +386,7 @@ void ath_tx_aggr_resume(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid
|
|||
|
||||
struct ath_vif {
|
||||
int av_bslot;
|
||||
__le64 tsf_adjust; /* TSF adjustment for staggered beacons */
|
||||
enum nl80211_iftype av_opmode;
|
||||
struct ath_buf *av_bcbuf;
|
||||
struct ath_tx_control av_btxctl;
|
||||
|
@ -406,7 +403,7 @@ struct ath_vif {
|
|||
* number of beacon intervals, the game's up.
|
||||
*/
|
||||
#define BSTUCK_THRESH (9 * ATH_BCBUF)
|
||||
#define ATH_BCBUF 1
|
||||
#define ATH_BCBUF 4
|
||||
#define ATH_DEFAULT_BINTVAL 100 /* TU */
|
||||
#define ATH_DEFAULT_BMISS_LIMIT 10
|
||||
#define IEEE80211_MS_TO_TU(x) (((x) * 1000) / 1024)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2008 Atheros Communications Inc.
|
||||
* Copyright (c) 2008-2009 Atheros Communications Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -70,7 +70,8 @@ static void ath_beacon_setup(struct ath_softc *sc, struct ath_vif *avp,
|
|||
ds = bf->bf_desc;
|
||||
flags = ATH9K_TXDESC_NOACK;
|
||||
|
||||
if (sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC &&
|
||||
if (((sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC) ||
|
||||
(sc->sc_ah->opmode == NL80211_IFTYPE_MESH_POINT)) &&
|
||||
(ah->caps.hw_caps & ATH9K_HW_CAP_VEOL)) {
|
||||
ds->ds_link = bf->bf_daddr; /* self-linked */
|
||||
flags |= ATH9K_TXDESC_VEOL;
|
||||
|
@ -153,6 +154,8 @@ static struct ath_buf *ath_beacon_generate(struct ieee80211_hw *hw,
|
|||
bf->bf_mpdu = skb;
|
||||
if (skb == NULL)
|
||||
return NULL;
|
||||
((struct ieee80211_mgmt *)skb->data)->u.beacon.timestamp =
|
||||
avp->tsf_adjust;
|
||||
|
||||
info = IEEE80211_SKB_CB(skb);
|
||||
if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) {
|
||||
|
@ -253,7 +256,6 @@ int ath_beacon_alloc(struct ath_wiphy *aphy, struct ieee80211_vif *vif)
|
|||
{
|
||||
struct ath_softc *sc = aphy->sc;
|
||||
struct ath_vif *avp;
|
||||
struct ieee80211_hdr *hdr;
|
||||
struct ath_buf *bf;
|
||||
struct sk_buff *skb;
|
||||
__le64 tstamp;
|
||||
|
@ -316,42 +318,33 @@ int ath_beacon_alloc(struct ath_wiphy *aphy, struct ieee80211_vif *vif)
|
|||
|
||||
tstamp = ((struct ieee80211_mgmt *)skb->data)->u.beacon.timestamp;
|
||||
sc->beacon.bc_tstamp = le64_to_cpu(tstamp);
|
||||
|
||||
/*
|
||||
* Calculate a TSF adjustment factor required for
|
||||
* staggered beacons. Note that we assume the format
|
||||
* of the beacon frame leaves the tstamp field immediately
|
||||
* following the header.
|
||||
*/
|
||||
/* Calculate a TSF adjustment factor required for staggered beacons. */
|
||||
if (avp->av_bslot > 0) {
|
||||
u64 tsfadjust;
|
||||
__le64 val;
|
||||
int intval;
|
||||
|
||||
intval = sc->hw->conf.beacon_int ?
|
||||
sc->hw->conf.beacon_int : ATH_DEFAULT_BINTVAL;
|
||||
|
||||
/*
|
||||
* The beacon interval is in TU's; the TSF in usecs.
|
||||
* We figure out how many TU's to add to align the
|
||||
* timestamp then convert to TSF units and handle
|
||||
* byte swapping before writing it in the frame.
|
||||
* The hardware will then add this each time a beacon
|
||||
* frame is sent. Note that we align vif's 1..N
|
||||
* and leave vif 0 untouched. This means vap 0
|
||||
* has a timestamp in one beacon interval while the
|
||||
* others get a timestamp aligned to the next interval.
|
||||
* Calculate the TSF offset for this beacon slot, i.e., the
|
||||
* number of usecs that need to be added to the timestamp field
|
||||
* in Beacon and Probe Response frames. Beacon slot 0 is
|
||||
* processed at the correct offset, so it does not require TSF
|
||||
* adjustment. Other slots are adjusted to get the timestamp
|
||||
* close to the TBTT for the BSS.
|
||||
*/
|
||||
tsfadjust = (intval * (ATH_BCBUF - avp->av_bslot)) / ATH_BCBUF;
|
||||
val = cpu_to_le64(tsfadjust << 10); /* TU->TSF */
|
||||
tsfadjust = intval * avp->av_bslot / ATH_BCBUF;
|
||||
avp->tsf_adjust = cpu_to_le64(TU_TO_USEC(tsfadjust));
|
||||
|
||||
DPRINTF(sc, ATH_DBG_BEACON,
|
||||
"stagger beacons, bslot %d intval %u tsfadjust %llu\n",
|
||||
avp->av_bslot, intval, (unsigned long long)tsfadjust);
|
||||
|
||||
hdr = (struct ieee80211_hdr *)skb->data;
|
||||
memcpy(&hdr[1], &val, sizeof(val));
|
||||
}
|
||||
((struct ieee80211_mgmt *)skb->data)->u.beacon.timestamp =
|
||||
avp->tsf_adjust;
|
||||
} else
|
||||
avp->tsf_adjust = cpu_to_le64(0);
|
||||
|
||||
bf->bf_mpdu = skb;
|
||||
bf->bf_buf_addr = bf->bf_dmacontext =
|
||||
|
@ -447,8 +440,16 @@ void ath_beacon_tasklet(unsigned long data)
|
|||
tsf = ath9k_hw_gettsf64(ah);
|
||||
tsftu = TSF_TO_TU(tsf>>32, tsf);
|
||||
slot = ((tsftu % intval) * ATH_BCBUF) / intval;
|
||||
vif = sc->beacon.bslot[(slot + 1) % ATH_BCBUF];
|
||||
aphy = sc->beacon.bslot_aphy[(slot + 1) % ATH_BCBUF];
|
||||
/*
|
||||
* Reverse the slot order to get slot 0 on the TBTT offset that does
|
||||
* not require TSF adjustment and other slots adding
|
||||
* slot/ATH_BCBUF * beacon_int to timestamp. For example, with
|
||||
* ATH_BCBUF = 4, we process beacon slots as follows: 3 2 1 0 3 2 1 ..
|
||||
* and slot 0 is at correct offset to TBTT.
|
||||
*/
|
||||
slot = ATH_BCBUF - slot - 1;
|
||||
vif = sc->beacon.bslot[slot];
|
||||
aphy = sc->beacon.bslot_aphy[slot];
|
||||
|
||||
DPRINTF(sc, ATH_DBG_BEACON,
|
||||
"slot %d [tsf %llu tsftu %u intval %u] vif %p\n",
|
||||
|
@ -728,6 +729,7 @@ void ath_beacon_config(struct ath_softc *sc, struct ieee80211_vif *vif)
|
|||
ath_beacon_config_ap(sc, &conf, avp);
|
||||
break;
|
||||
case NL80211_IFTYPE_ADHOC:
|
||||
case NL80211_IFTYPE_MESH_POINT:
|
||||
ath_beacon_config_adhoc(sc, &conf, avp, vif);
|
||||
break;
|
||||
case NL80211_IFTYPE_STATION:
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2008 Atheros Communications Inc.
|
||||
* Copyright (c) 2008-2009 Atheros Communications Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2008 Atheros Communications Inc.
|
||||
* Copyright (c) 2008-2009 Atheros Communications Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2008 Atheros Communications Inc.
|
||||
* Copyright (c) 2008-2009 Atheros Communications Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2008 Atheros Communications Inc.
|
||||
* Copyright (c) 2008-2009 Atheros Communications Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2008 Atheros Communications Inc.
|
||||
* Copyright (c) 2008-2009 Atheros Communications Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -342,8 +342,7 @@ static int ath9k_hw_4k_get_eeprom_rev(struct ath_hw *ah)
|
|||
static bool ath9k_hw_4k_fill_eeprom(struct ath_hw *ah)
|
||||
{
|
||||
#define SIZE_EEPROM_4K (sizeof(struct ar5416_eeprom_4k) / sizeof(u16))
|
||||
struct ar5416_eeprom_4k *eep = &ah->eeprom.map4k;
|
||||
u16 *eep_data;
|
||||
u16 *eep_data = (u16 *)&ah->eeprom.map4k;
|
||||
int addr, eep_start_loc = 0;
|
||||
|
||||
eep_start_loc = 64;
|
||||
|
@ -353,8 +352,6 @@ static bool ath9k_hw_4k_fill_eeprom(struct ath_hw *ah)
|
|||
"Reading from EEPROM, not flash\n");
|
||||
}
|
||||
|
||||
eep_data = (u16 *)eep;
|
||||
|
||||
for (addr = 0; addr < SIZE_EEPROM_4K; addr++) {
|
||||
if (!ath9k_hw_nvram_read(ah, addr + eep_start_loc, eep_data)) {
|
||||
DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
|
||||
|
@ -363,6 +360,7 @@ static bool ath9k_hw_4k_fill_eeprom(struct ath_hw *ah)
|
|||
}
|
||||
eep_data++;
|
||||
}
|
||||
|
||||
return true;
|
||||
#undef SIZE_EEPROM_4K
|
||||
}
|
||||
|
@ -379,10 +377,9 @@ static int ath9k_hw_4k_check_eeprom(struct ath_hw *ah)
|
|||
|
||||
|
||||
if (!ath9k_hw_use_flash(ah)) {
|
||||
|
||||
if (!ath9k_hw_nvram_read(ah, AR5416_EEPROM_MAGIC_OFFSET,
|
||||
&magic)) {
|
||||
DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
|
||||
DPRINTF(ah->ah_sc, ATH_DBG_FATAL,
|
||||
"Reading Magic # failed\n");
|
||||
return false;
|
||||
}
|
||||
|
@ -401,16 +398,9 @@ static int ath9k_hw_4k_check_eeprom(struct ath_hw *ah)
|
|||
temp = swab16(*eepdata);
|
||||
*eepdata = temp;
|
||||
eepdata++;
|
||||
|
||||
DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
|
||||
"0x%04X ", *eepdata);
|
||||
|
||||
if (((addr + 1) % 6) == 0)
|
||||
DPRINTF(ah->ah_sc,
|
||||
ATH_DBG_EEPROM, "\n");
|
||||
}
|
||||
} else {
|
||||
DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
|
||||
DPRINTF(ah->ah_sc, ATH_DBG_FATAL,
|
||||
"Invalid EEPROM Magic. "
|
||||
"endianness mismatch.\n");
|
||||
return -EINVAL;
|
||||
|
@ -426,7 +416,7 @@ static int ath9k_hw_4k_check_eeprom(struct ath_hw *ah)
|
|||
else
|
||||
el = ah->eeprom.map4k.baseEepHeader.length;
|
||||
|
||||
if (el > sizeof(struct ar5416_eeprom_def))
|
||||
if (el > sizeof(struct ar5416_eeprom_4k))
|
||||
el = sizeof(struct ar5416_eeprom_4k) / sizeof(u16);
|
||||
else
|
||||
el = el / sizeof(u16);
|
||||
|
@ -441,7 +431,7 @@ static int ath9k_hw_4k_check_eeprom(struct ath_hw *ah)
|
|||
u16 word;
|
||||
|
||||
DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
|
||||
"EEPROM Endianness is not native.. Changing \n");
|
||||
"EEPROM Endianness is not native.. Changing\n");
|
||||
|
||||
word = swab16(eep->baseEepHeader.length);
|
||||
eep->baseEepHeader.length = word;
|
||||
|
@ -483,7 +473,7 @@ static int ath9k_hw_4k_check_eeprom(struct ath_hw *ah)
|
|||
|
||||
if (sum != 0xffff || ah->eep_ops->get_eeprom_ver(ah) != AR5416_EEP_VER ||
|
||||
ah->eep_ops->get_eeprom_rev(ah) < AR5416_EEP_NO_BACK_VER) {
|
||||
DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
|
||||
DPRINTF(ah->ah_sc, ATH_DBG_FATAL,
|
||||
"Bad EEPROM checksum 0x%x or revision 0x%04x\n",
|
||||
sum, ah->eep_ops->get_eeprom_ver(ah));
|
||||
return -EINVAL;
|
||||
|
@ -1203,26 +1193,11 @@ static void ath9k_hw_4k_set_addac(struct ath_hw *ah,
|
|||
}
|
||||
}
|
||||
|
||||
static bool ath9k_hw_4k_set_board_values(struct ath_hw *ah,
|
||||
struct ath9k_channel *chan)
|
||||
static void ath9k_hw_4k_set_gain(struct ath_hw *ah,
|
||||
struct modal_eep_4k_header *pModal,
|
||||
struct ar5416_eeprom_4k *eep,
|
||||
u8 txRxAttenLocal, int regChainOffset)
|
||||
{
|
||||
struct modal_eep_4k_header *pModal;
|
||||
struct ar5416_eeprom_4k *eep = &ah->eeprom.map4k;
|
||||
int regChainOffset;
|
||||
u8 txRxAttenLocal;
|
||||
u8 ob[5], db1[5], db2[5];
|
||||
u8 ant_div_control1, ant_div_control2;
|
||||
u32 regVal;
|
||||
|
||||
|
||||
pModal = &eep->modalHeader;
|
||||
|
||||
txRxAttenLocal = 23;
|
||||
|
||||
REG_WRITE(ah, AR_PHY_SWITCH_COM,
|
||||
ah->eep_ops->get_eeprom_antenna_cfg(ah, chan));
|
||||
|
||||
regChainOffset = 0;
|
||||
REG_WRITE(ah, AR_PHY_SWITCH_CHAIN_0 + regChainOffset,
|
||||
pModal->antCtrlChain[0]);
|
||||
|
||||
|
@ -1236,6 +1211,7 @@ static bool ath9k_hw_4k_set_board_values(struct ath_hw *ah,
|
|||
if ((eep->baseEepHeader.version & AR5416_EEP_VER_MINOR_MASK) >=
|
||||
AR5416_EEP_MINOR_VER_3) {
|
||||
txRxAttenLocal = pModal->txRxAttenCh[0];
|
||||
|
||||
REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
|
||||
AR_PHY_GAIN_2GHZ_XATTEN1_MARGIN, pModal->bswMargin[0]);
|
||||
REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
|
||||
|
@ -1254,6 +1230,26 @@ static bool ath9k_hw_4k_set_board_values(struct ath_hw *ah,
|
|||
|
||||
if (AR_SREV_9285_11(ah))
|
||||
REG_WRITE(ah, AR9285_AN_TOP4, (AR9285_AN_TOP4_DEFAULT | 0x14));
|
||||
}
|
||||
|
||||
static void ath9k_hw_4k_set_board_values(struct ath_hw *ah,
|
||||
struct ath9k_channel *chan)
|
||||
{
|
||||
struct modal_eep_4k_header *pModal;
|
||||
struct ar5416_eeprom_4k *eep = &ah->eeprom.map4k;
|
||||
u8 txRxAttenLocal;
|
||||
u8 ob[5], db1[5], db2[5];
|
||||
u8 ant_div_control1, ant_div_control2;
|
||||
u32 regVal;
|
||||
|
||||
pModal = &eep->modalHeader;
|
||||
txRxAttenLocal = 23;
|
||||
|
||||
REG_WRITE(ah, AR_PHY_SWITCH_COM,
|
||||
ah->eep_ops->get_eeprom_antenna_cfg(ah, chan));
|
||||
|
||||
/* Single chain for 4K EEPROM*/
|
||||
ath9k_hw_4k_set_gain(ah, pModal, eep, txRxAttenLocal, 0);
|
||||
|
||||
/* Initialize Ant Diversity settings from EEPROM */
|
||||
if (pModal->version == 3) {
|
||||
|
@ -1295,9 +1291,6 @@ static bool ath9k_hw_4k_set_board_values(struct ath_hw *ah,
|
|||
db2[4] = ((pModal->db2_234 >> 8) & 0xf);
|
||||
|
||||
} else if (pModal->version == 1) {
|
||||
|
||||
DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
|
||||
"EEPROM Model version is set to 1 \n");
|
||||
ob[0] = (pModal->ob_01 & 0xf);
|
||||
ob[1] = ob[2] = ob[3] = ob[4] = (pModal->ob_01 >> 4) & 0xf;
|
||||
db1[0] = (pModal->db1_01 & 0xf);
|
||||
|
@ -1385,8 +1378,6 @@ static bool ath9k_hw_4k_set_board_values(struct ath_hw *ah,
|
|||
AR_PHY_SETTLING_SWITCH,
|
||||
pModal->swSettleHt40);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static u16 ath9k_hw_4k_get_eeprom_antenna_cfg(struct ath_hw *ah,
|
||||
|
@ -1464,16 +1455,13 @@ static int ath9k_hw_def_get_eeprom_rev(struct ath_hw *ah)
|
|||
static bool ath9k_hw_def_fill_eeprom(struct ath_hw *ah)
|
||||
{
|
||||
#define SIZE_EEPROM_DEF (sizeof(struct ar5416_eeprom_def) / sizeof(u16))
|
||||
struct ar5416_eeprom_def *eep = &ah->eeprom.def;
|
||||
u16 *eep_data;
|
||||
u16 *eep_data = (u16 *)&ah->eeprom.def;
|
||||
int addr, ar5416_eep_start_loc = 0x100;
|
||||
|
||||
eep_data = (u16 *)eep;
|
||||
|
||||
for (addr = 0; addr < SIZE_EEPROM_DEF; addr++) {
|
||||
if (!ath9k_hw_nvram_read(ah, addr + ar5416_eep_start_loc,
|
||||
eep_data)) {
|
||||
DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
|
||||
DPRINTF(ah->ah_sc, ATH_DBG_FATAL,
|
||||
"Unable to read eeprom region\n");
|
||||
return false;
|
||||
}
|
||||
|
@ -1492,15 +1480,12 @@ static int ath9k_hw_def_check_eeprom(struct ath_hw *ah)
|
|||
bool need_swap = false;
|
||||
int i, addr, size;
|
||||
|
||||
if (!ath9k_hw_nvram_read(ah, AR5416_EEPROM_MAGIC_OFFSET,
|
||||
&magic)) {
|
||||
DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
|
||||
"Reading Magic # failed\n");
|
||||
if (!ath9k_hw_nvram_read(ah, AR5416_EEPROM_MAGIC_OFFSET, &magic)) {
|
||||
DPRINTF(ah->ah_sc, ATH_DBG_FATAL, "Reading Magic # failed\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!ath9k_hw_use_flash(ah)) {
|
||||
|
||||
DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
|
||||
"Read Magic = 0x%04X\n", magic);
|
||||
|
||||
|
@ -1516,18 +1501,11 @@ static int ath9k_hw_def_check_eeprom(struct ath_hw *ah)
|
|||
temp = swab16(*eepdata);
|
||||
*eepdata = temp;
|
||||
eepdata++;
|
||||
|
||||
DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
|
||||
"0x%04X ", *eepdata);
|
||||
|
||||
if (((addr + 1) % 6) == 0)
|
||||
DPRINTF(ah->ah_sc,
|
||||
ATH_DBG_EEPROM, "\n");
|
||||
}
|
||||
} else {
|
||||
DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
|
||||
DPRINTF(ah->ah_sc, ATH_DBG_FATAL,
|
||||
"Invalid EEPROM Magic. "
|
||||
"endianness mismatch.\n");
|
||||
"Endianness mismatch.\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
@ -1556,7 +1534,7 @@ static int ath9k_hw_def_check_eeprom(struct ath_hw *ah)
|
|||
u16 word;
|
||||
|
||||
DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
|
||||
"EEPROM Endianness is not native.. Changing \n");
|
||||
"EEPROM Endianness is not native.. Changing.\n");
|
||||
|
||||
word = swab16(eep->baseEepHeader.length);
|
||||
eep->baseEepHeader.length = word;
|
||||
|
@ -1602,7 +1580,7 @@ static int ath9k_hw_def_check_eeprom(struct ath_hw *ah)
|
|||
|
||||
if (sum != 0xffff || ah->eep_ops->get_eeprom_ver(ah) != AR5416_EEP_VER ||
|
||||
ah->eep_ops->get_eeprom_rev(ah) < AR5416_EEP_NO_BACK_VER) {
|
||||
DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
|
||||
DPRINTF(ah->ah_sc, ATH_DBG_FATAL,
|
||||
"Bad EEPROM checksum 0x%x or revision 0x%04x\n",
|
||||
sum, ah->eep_ops->get_eeprom_ver(ah));
|
||||
return -EINVAL;
|
||||
|
@ -1614,7 +1592,6 @@ static int ath9k_hw_def_check_eeprom(struct ath_hw *ah)
|
|||
static u32 ath9k_hw_def_get_eeprom(struct ath_hw *ah,
|
||||
enum eeprom_param param)
|
||||
{
|
||||
#define AR5416_VER_MASK (pBase->version & AR5416_EEP_VER_MINOR_MASK)
|
||||
struct ar5416_eeprom_def *eep = &ah->eeprom.def;
|
||||
struct modal_eep_header *pModal = eep->modalHeader;
|
||||
struct base_eep_header *pBase = &eep->baseEepHeader;
|
||||
|
@ -1681,21 +1658,73 @@ static u32 ath9k_hw_def_get_eeprom(struct ath_hw *ah,
|
|||
default:
|
||||
return 0;
|
||||
}
|
||||
#undef AR5416_VER_MASK
|
||||
}
|
||||
|
||||
/* XXX: Clean me up, make me more legible */
|
||||
static bool ath9k_hw_def_set_board_values(struct ath_hw *ah,
|
||||
static void ath9k_hw_def_set_gain(struct ath_hw *ah,
|
||||
struct modal_eep_header *pModal,
|
||||
struct ar5416_eeprom_def *eep,
|
||||
u8 txRxAttenLocal, int regChainOffset, int i)
|
||||
{
|
||||
if (AR5416_VER_MASK >= AR5416_EEP_MINOR_VER_3) {
|
||||
txRxAttenLocal = pModal->txRxAttenCh[i];
|
||||
|
||||
if (AR_SREV_9280_10_OR_LATER(ah)) {
|
||||
REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
|
||||
AR_PHY_GAIN_2GHZ_XATTEN1_MARGIN,
|
||||
pModal->bswMargin[i]);
|
||||
REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
|
||||
AR_PHY_GAIN_2GHZ_XATTEN1_DB,
|
||||
pModal->bswAtten[i]);
|
||||
REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
|
||||
AR_PHY_GAIN_2GHZ_XATTEN2_MARGIN,
|
||||
pModal->xatten2Margin[i]);
|
||||
REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
|
||||
AR_PHY_GAIN_2GHZ_XATTEN2_DB,
|
||||
pModal->xatten2Db[i]);
|
||||
} else {
|
||||
REG_WRITE(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
|
||||
(REG_READ(ah, AR_PHY_GAIN_2GHZ + regChainOffset) &
|
||||
~AR_PHY_GAIN_2GHZ_BSW_MARGIN)
|
||||
| SM(pModal-> bswMargin[i],
|
||||
AR_PHY_GAIN_2GHZ_BSW_MARGIN));
|
||||
REG_WRITE(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
|
||||
(REG_READ(ah, AR_PHY_GAIN_2GHZ + regChainOffset) &
|
||||
~AR_PHY_GAIN_2GHZ_BSW_ATTEN)
|
||||
| SM(pModal->bswAtten[i],
|
||||
AR_PHY_GAIN_2GHZ_BSW_ATTEN));
|
||||
}
|
||||
}
|
||||
|
||||
if (AR_SREV_9280_10_OR_LATER(ah)) {
|
||||
REG_RMW_FIELD(ah,
|
||||
AR_PHY_RXGAIN + regChainOffset,
|
||||
AR9280_PHY_RXGAIN_TXRX_ATTEN, txRxAttenLocal);
|
||||
REG_RMW_FIELD(ah,
|
||||
AR_PHY_RXGAIN + regChainOffset,
|
||||
AR9280_PHY_RXGAIN_TXRX_MARGIN, pModal->rxTxMarginCh[i]);
|
||||
} else {
|
||||
REG_WRITE(ah,
|
||||
AR_PHY_RXGAIN + regChainOffset,
|
||||
(REG_READ(ah, AR_PHY_RXGAIN + regChainOffset) &
|
||||
~AR_PHY_RXGAIN_TXRX_ATTEN)
|
||||
| SM(txRxAttenLocal, AR_PHY_RXGAIN_TXRX_ATTEN));
|
||||
REG_WRITE(ah,
|
||||
AR_PHY_GAIN_2GHZ + regChainOffset,
|
||||
(REG_READ(ah, AR_PHY_GAIN_2GHZ + regChainOffset) &
|
||||
~AR_PHY_GAIN_2GHZ_RXTX_MARGIN) |
|
||||
SM(pModal->rxTxMarginCh[i], AR_PHY_GAIN_2GHZ_RXTX_MARGIN));
|
||||
}
|
||||
}
|
||||
|
||||
static void ath9k_hw_def_set_board_values(struct ath_hw *ah,
|
||||
struct ath9k_channel *chan)
|
||||
{
|
||||
#define AR5416_VER_MASK (eep->baseEepHeader.version & AR5416_EEP_VER_MINOR_MASK)
|
||||
struct modal_eep_header *pModal;
|
||||
struct ar5416_eeprom_def *eep = &ah->eeprom.def;
|
||||
int i, regChainOffset;
|
||||
u8 txRxAttenLocal;
|
||||
|
||||
pModal = &(eep->modalHeader[IS_CHAN_2GHZ(chan)]);
|
||||
|
||||
txRxAttenLocal = IS_CHAN_2GHZ(chan) ? 23 : 44;
|
||||
|
||||
REG_WRITE(ah, AR_PHY_SWITCH_COM,
|
||||
|
@ -1708,8 +1737,7 @@ static bool ath9k_hw_def_set_board_values(struct ath_hw *ah,
|
|||
}
|
||||
|
||||
if (AR_SREV_5416_20_OR_LATER(ah) &&
|
||||
(ah->rxchainmask == 5 || ah->txchainmask == 5)
|
||||
&& (i != 0))
|
||||
(ah->rxchainmask == 5 || ah->txchainmask == 5) && (i != 0))
|
||||
regChainOffset = (i == 1) ? 0x2000 : 0x1000;
|
||||
else
|
||||
regChainOffset = i * 0x1000;
|
||||
|
@ -1718,9 +1746,7 @@ static bool ath9k_hw_def_set_board_values(struct ath_hw *ah,
|
|||
pModal->antCtrlChain[i]);
|
||||
|
||||
REG_WRITE(ah, AR_PHY_TIMING_CTRL4(0) + regChainOffset,
|
||||
(REG_READ(ah,
|
||||
AR_PHY_TIMING_CTRL4(0) +
|
||||
regChainOffset) &
|
||||
(REG_READ(ah, AR_PHY_TIMING_CTRL4(0) + regChainOffset) &
|
||||
~(AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF |
|
||||
AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF)) |
|
||||
SM(pModal->iqCalICh[i],
|
||||
|
@ -1728,87 +1754,9 @@ static bool ath9k_hw_def_set_board_values(struct ath_hw *ah,
|
|||
SM(pModal->iqCalQCh[i],
|
||||
AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF));
|
||||
|
||||
if ((i == 0) || AR_SREV_5416_20_OR_LATER(ah)) {
|
||||
if (AR5416_VER_MASK >= AR5416_EEP_MINOR_VER_3) {
|
||||
txRxAttenLocal = pModal->txRxAttenCh[i];
|
||||
if (AR_SREV_9280_10_OR_LATER(ah)) {
|
||||
REG_RMW_FIELD(ah,
|
||||
AR_PHY_GAIN_2GHZ +
|
||||
regChainOffset,
|
||||
AR_PHY_GAIN_2GHZ_XATTEN1_MARGIN,
|
||||
pModal->
|
||||
bswMargin[i]);
|
||||
REG_RMW_FIELD(ah,
|
||||
AR_PHY_GAIN_2GHZ +
|
||||
regChainOffset,
|
||||
AR_PHY_GAIN_2GHZ_XATTEN1_DB,
|
||||
pModal->
|
||||
bswAtten[i]);
|
||||
REG_RMW_FIELD(ah,
|
||||
AR_PHY_GAIN_2GHZ +
|
||||
regChainOffset,
|
||||
AR_PHY_GAIN_2GHZ_XATTEN2_MARGIN,
|
||||
pModal->
|
||||
xatten2Margin[i]);
|
||||
REG_RMW_FIELD(ah,
|
||||
AR_PHY_GAIN_2GHZ +
|
||||
regChainOffset,
|
||||
AR_PHY_GAIN_2GHZ_XATTEN2_DB,
|
||||
pModal->
|
||||
xatten2Db[i]);
|
||||
} else {
|
||||
REG_WRITE(ah,
|
||||
AR_PHY_GAIN_2GHZ +
|
||||
regChainOffset,
|
||||
(REG_READ(ah,
|
||||
AR_PHY_GAIN_2GHZ +
|
||||
regChainOffset) &
|
||||
~AR_PHY_GAIN_2GHZ_BSW_MARGIN)
|
||||
| SM(pModal->
|
||||
bswMargin[i],
|
||||
AR_PHY_GAIN_2GHZ_BSW_MARGIN));
|
||||
REG_WRITE(ah,
|
||||
AR_PHY_GAIN_2GHZ +
|
||||
regChainOffset,
|
||||
(REG_READ(ah,
|
||||
AR_PHY_GAIN_2GHZ +
|
||||
regChainOffset) &
|
||||
~AR_PHY_GAIN_2GHZ_BSW_ATTEN)
|
||||
| SM(pModal->bswAtten[i],
|
||||
AR_PHY_GAIN_2GHZ_BSW_ATTEN));
|
||||
}
|
||||
}
|
||||
if (AR_SREV_9280_10_OR_LATER(ah)) {
|
||||
REG_RMW_FIELD(ah,
|
||||
AR_PHY_RXGAIN +
|
||||
regChainOffset,
|
||||
AR9280_PHY_RXGAIN_TXRX_ATTEN,
|
||||
txRxAttenLocal);
|
||||
REG_RMW_FIELD(ah,
|
||||
AR_PHY_RXGAIN +
|
||||
regChainOffset,
|
||||
AR9280_PHY_RXGAIN_TXRX_MARGIN,
|
||||
pModal->rxTxMarginCh[i]);
|
||||
} else {
|
||||
REG_WRITE(ah,
|
||||
AR_PHY_RXGAIN + regChainOffset,
|
||||
(REG_READ(ah,
|
||||
AR_PHY_RXGAIN +
|
||||
regChainOffset) &
|
||||
~AR_PHY_RXGAIN_TXRX_ATTEN) |
|
||||
SM(txRxAttenLocal,
|
||||
AR_PHY_RXGAIN_TXRX_ATTEN));
|
||||
REG_WRITE(ah,
|
||||
AR_PHY_GAIN_2GHZ +
|
||||
regChainOffset,
|
||||
(REG_READ(ah,
|
||||
AR_PHY_GAIN_2GHZ +
|
||||
regChainOffset) &
|
||||
~AR_PHY_GAIN_2GHZ_RXTX_MARGIN) |
|
||||
SM(pModal->rxTxMarginCh[i],
|
||||
AR_PHY_GAIN_2GHZ_RXTX_MARGIN));
|
||||
}
|
||||
}
|
||||
if ((i == 0) || AR_SREV_5416_20_OR_LATER(ah))
|
||||
ath9k_hw_def_set_gain(ah, pModal, eep, txRxAttenLocal,
|
||||
regChainOffset, i);
|
||||
}
|
||||
|
||||
if (AR_SREV_9280_10_OR_LATER(ah)) {
|
||||
|
@ -1855,8 +1803,6 @@ static bool ath9k_hw_def_set_board_values(struct ath_hw *ah,
|
|||
AR_AN_TOP2_LOCALBIAS,
|
||||
AR_AN_TOP2_LOCALBIAS_S,
|
||||
pModal->local_bias);
|
||||
DPRINTF(ah->ah_sc, ATH_DBG_EEPROM, "ForceXPAon: %d\n",
|
||||
pModal->force_xpaon);
|
||||
REG_RMW_FIELD(ah, AR_PHY_XPA_CFG, AR_PHY_FORCE_XPA_CFG,
|
||||
pModal->force_xpaon);
|
||||
}
|
||||
|
@ -1882,6 +1828,7 @@ static bool ath9k_hw_def_set_board_values(struct ath_hw *ah,
|
|||
|
||||
REG_RMW_FIELD(ah, AR_PHY_RF_CTL3, AR_PHY_TX_END_TO_A2_RX_ON,
|
||||
pModal->txEndToRxOn);
|
||||
|
||||
if (AR_SREV_9280_10_OR_LATER(ah)) {
|
||||
REG_RMW_FIELD(ah, AR_PHY_CCA, AR9280_PHY_CCA_THRESH62,
|
||||
pModal->thresh62);
|
||||
|
@ -1935,9 +1882,6 @@ static bool ath9k_hw_def_set_board_values(struct ath_hw *ah,
|
|||
AR_PHY_TX_DESIRED_SCALE_CCK,
|
||||
eep->baseEepHeader.desiredScaleCCK);
|
||||
}
|
||||
|
||||
return true;
|
||||
#undef AR5416_VER_MASK
|
||||
}
|
||||
|
||||
static void ath9k_hw_def_set_addac(struct ath_hw *ah,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2008 Atheros Communications Inc.
|
||||
* Copyright (c) 2008-2009 Atheros Communications Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -95,6 +95,7 @@
|
|||
#define FREQ2FBIN(x, y) ((y) ? ((x) - 2300) : (((x) - 4800) / 5))
|
||||
#define ath9k_hw_use_flash(_ah) (!(_ah->ah_flags & AH_USE_EEPROM))
|
||||
|
||||
#define AR5416_VER_MASK (eep->baseEepHeader.version & AR5416_EEP_VER_MINOR_MASK)
|
||||
#define OLC_FOR_AR9280_20_LATER (AR_SREV_9280_20_OR_LATER(ah) && \
|
||||
ah->eep_ops->get_eeprom(ah, EEP_OL_PWRCTRL))
|
||||
|
||||
|
@ -489,7 +490,7 @@ struct eeprom_ops {
|
|||
u8 (*get_num_ant_config)(struct ath_hw *hw, enum ieee80211_band band);
|
||||
u16 (*get_eeprom_antenna_cfg)(struct ath_hw *hw,
|
||||
struct ath9k_channel *chan);
|
||||
bool (*set_board_values)(struct ath_hw *hw, struct ath9k_channel *chan);
|
||||
void (*set_board_values)(struct ath_hw *hw, struct ath9k_channel *chan);
|
||||
void (*set_addac)(struct ath_hw *hw, struct ath9k_channel *chan);
|
||||
int (*set_txpower)(struct ath_hw *hw, struct ath9k_channel *chan,
|
||||
u16 cfgCtl, u8 twiceAntennaReduction,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2008 Atheros Communications Inc.
|
||||
* Copyright (c) 2008-2009 Atheros Communications Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -588,6 +588,10 @@ static int ath9k_hw_post_attach(struct ath_hw *ah)
|
|||
ecode = ath9k_hw_eeprom_attach(ah);
|
||||
if (ecode != 0)
|
||||
return ecode;
|
||||
|
||||
DPRINTF(ah->ah_sc, ATH_DBG_CONFIG, "Eeprom VER: %d, REV: %d\n",
|
||||
ah->eep_ops->get_eeprom_ver(ah), ah->eep_ops->get_eeprom_rev(ah));
|
||||
|
||||
ecode = ath9k_hw_rfattach(ah);
|
||||
if (ecode != 0)
|
||||
return ecode;
|
||||
|
@ -1444,6 +1448,7 @@ static void ath9k_hw_set_operating_mode(struct ath_hw *ah, int opmode)
|
|||
REG_CLR_BIT(ah, AR_CFG, AR_CFG_AP_ADHOC_INDICATION);
|
||||
break;
|
||||
case NL80211_IFTYPE_ADHOC:
|
||||
case NL80211_IFTYPE_MESH_POINT:
|
||||
REG_WRITE(ah, AR_STA_ID1, val | AR_STA_ID1_ADHOC
|
||||
| AR_STA_ID1_KSRCH_MODE);
|
||||
REG_SET_BIT(ah, AR_CFG, AR_CFG_AP_ADHOC_INDICATION);
|
||||
|
@ -2273,11 +2278,7 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
|
|||
else
|
||||
ath9k_hw_spur_mitigate(ah, chan);
|
||||
|
||||
if (!ah->eep_ops->set_board_values(ah, chan)) {
|
||||
DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
|
||||
"error setting board options\n");
|
||||
return -EIO;
|
||||
}
|
||||
ah->eep_ops->set_board_values(ah, chan);
|
||||
|
||||
ath9k_hw_decrease_chain_power(ah, chan);
|
||||
|
||||
|
@ -3149,6 +3150,7 @@ void ath9k_hw_beaconinit(struct ath_hw *ah, u32 next_beacon, u32 beacon_period)
|
|||
flags |= AR_TBTT_TIMER_EN;
|
||||
break;
|
||||
case NL80211_IFTYPE_ADHOC:
|
||||
case NL80211_IFTYPE_MESH_POINT:
|
||||
REG_SET_BIT(ah, AR_TXCFG,
|
||||
AR_TXCFG_ADHOC_BEACON_ATIM_TX_POLICY);
|
||||
REG_WRITE(ah, AR_NEXT_NDP_TIMER,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2008 Atheros Communications Inc.
|
||||
* Copyright (c) 2008-2009 Atheros Communications Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2008 Atheros Communications Inc.
|
||||
* Copyright (c) 2008-2009 Atheros Communications Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2008 Atheros Communications Inc.
|
||||
* Copyright (c) 2008-2009 Atheros Communications Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2008 Atheros Communications Inc.
|
||||
* Copyright (c) 2008-2009 Atheros Communications Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2008 Atheros Communications Inc.
|
||||
* Copyright (c) 2008-2009 Atheros Communications Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -940,6 +940,11 @@ static void ath_led_blink_work(struct work_struct *work)
|
|||
|
||||
if (!(sc->sc_flags & SC_OP_LED_ASSOCIATED))
|
||||
return;
|
||||
|
||||
if ((sc->led_on_duration == ATH_LED_ON_DURATION_IDLE) ||
|
||||
(sc->led_off_duration == ATH_LED_OFF_DURATION_IDLE))
|
||||
ath9k_hw_set_gpio(sc->sc_ah, ATH_LED_PIN, 0);
|
||||
else
|
||||
ath9k_hw_set_gpio(sc->sc_ah, ATH_LED_PIN,
|
||||
(sc->sc_flags & SC_OP_LED_ON) ? 1 : 0);
|
||||
|
||||
|
@ -948,10 +953,12 @@ static void ath_led_blink_work(struct work_struct *work)
|
|||
msecs_to_jiffies(sc->led_off_duration) :
|
||||
msecs_to_jiffies(sc->led_on_duration));
|
||||
|
||||
sc->led_on_duration =
|
||||
max((ATH_LED_ON_DURATION_IDLE - sc->led_on_cnt), 25);
|
||||
sc->led_off_duration =
|
||||
max((ATH_LED_OFF_DURATION_IDLE - sc->led_off_cnt), 10);
|
||||
sc->led_on_duration = sc->led_on_cnt ?
|
||||
max((ATH_LED_ON_DURATION_IDLE - sc->led_on_cnt), 25) :
|
||||
ATH_LED_ON_DURATION_IDLE;
|
||||
sc->led_off_duration = sc->led_off_cnt ?
|
||||
max((ATH_LED_OFF_DURATION_IDLE - sc->led_off_cnt), 10) :
|
||||
ATH_LED_OFF_DURATION_IDLE;
|
||||
sc->led_on_cnt = sc->led_off_cnt = 0;
|
||||
if (sc->sc_flags & SC_OP_LED_ON)
|
||||
sc->sc_flags &= ~SC_OP_LED_ON;
|
||||
|
@ -1592,7 +1599,8 @@ void ath_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
|
|||
hw->wiphy->interface_modes =
|
||||
BIT(NL80211_IFTYPE_AP) |
|
||||
BIT(NL80211_IFTYPE_STATION) |
|
||||
BIT(NL80211_IFTYPE_ADHOC);
|
||||
BIT(NL80211_IFTYPE_ADHOC) |
|
||||
BIT(NL80211_IFTYPE_MESH_POINT);
|
||||
|
||||
hw->wiphy->reg_notifier = ath9k_reg_notifier;
|
||||
hw->wiphy->strict_regulatory = true;
|
||||
|
@ -2200,18 +2208,13 @@ static int ath9k_add_interface(struct ieee80211_hw *hw,
|
|||
ic_opmode = NL80211_IFTYPE_STATION;
|
||||
break;
|
||||
case NL80211_IFTYPE_ADHOC:
|
||||
if (sc->nbcnvifs >= ATH_BCBUF) {
|
||||
ret = -ENOBUFS;
|
||||
goto out;
|
||||
}
|
||||
ic_opmode = NL80211_IFTYPE_ADHOC;
|
||||
break;
|
||||
case NL80211_IFTYPE_AP:
|
||||
case NL80211_IFTYPE_MESH_POINT:
|
||||
if (sc->nbcnvifs >= ATH_BCBUF) {
|
||||
ret = -ENOBUFS;
|
||||
goto out;
|
||||
}
|
||||
ic_opmode = NL80211_IFTYPE_AP;
|
||||
ic_opmode = conf->type;
|
||||
break;
|
||||
default:
|
||||
DPRINTF(sc, ATH_DBG_FATAL,
|
||||
|
@ -2247,7 +2250,8 @@ static int ath9k_add_interface(struct ieee80211_hw *hw,
|
|||
* Note we only do this (at the moment) for station mode.
|
||||
*/
|
||||
if ((conf->type == NL80211_IFTYPE_STATION) ||
|
||||
(conf->type == NL80211_IFTYPE_ADHOC)) {
|
||||
(conf->type == NL80211_IFTYPE_ADHOC) ||
|
||||
(conf->type == NL80211_IFTYPE_MESH_POINT)) {
|
||||
if (ath9k_hw_phycounters(sc->sc_ah))
|
||||
sc->imask |= ATH9K_INT_MIB;
|
||||
sc->imask |= ATH9K_INT_TSFOOR;
|
||||
|
@ -2294,8 +2298,9 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw,
|
|||
del_timer_sync(&sc->ani.timer);
|
||||
|
||||
/* Reclaim beacon resources */
|
||||
if (sc->sc_ah->opmode == NL80211_IFTYPE_AP ||
|
||||
sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC) {
|
||||
if ((sc->sc_ah->opmode == NL80211_IFTYPE_AP) ||
|
||||
(sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC) ||
|
||||
(sc->sc_ah->opmode == NL80211_IFTYPE_MESH_POINT)) {
|
||||
ath9k_hw_stoptxdma(sc->sc_ah, sc->beacon.beaconq);
|
||||
ath_beacon_return(sc, avp);
|
||||
}
|
||||
|
@ -2428,6 +2433,7 @@ static int ath9k_config_interface(struct ieee80211_hw *hw,
|
|||
switch (vif->type) {
|
||||
case NL80211_IFTYPE_STATION:
|
||||
case NL80211_IFTYPE_ADHOC:
|
||||
case NL80211_IFTYPE_MESH_POINT:
|
||||
/* Set BSSID */
|
||||
memcpy(sc->curbssid, conf->bssid, ETH_ALEN);
|
||||
memcpy(avp->bssid, conf->bssid, ETH_ALEN);
|
||||
|
@ -2451,7 +2457,8 @@ static int ath9k_config_interface(struct ieee80211_hw *hw,
|
|||
}
|
||||
|
||||
if ((vif->type == NL80211_IFTYPE_ADHOC) ||
|
||||
(vif->type == NL80211_IFTYPE_AP)) {
|
||||
(vif->type == NL80211_IFTYPE_AP) ||
|
||||
(vif->type == NL80211_IFTYPE_MESH_POINT)) {
|
||||
if ((conf->changed & IEEE80211_IFCC_BEACON) ||
|
||||
(conf->changed & IEEE80211_IFCC_BEACON_ENABLED &&
|
||||
conf->enable_beacon)) {
|
||||
|
@ -2723,7 +2730,7 @@ static int ath9k_ampdu_action(struct ieee80211_hw *hw,
|
|||
|
||||
ieee80211_stop_tx_ba_cb_irqsafe(hw, sta->addr, tid);
|
||||
break;
|
||||
case IEEE80211_AMPDU_TX_RESUME:
|
||||
case IEEE80211_AMPDU_TX_OPERATIONAL:
|
||||
ath_tx_aggr_resume(sc, sta, tid);
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2008 Atheros Communications Inc.
|
||||
* Copyright (c) 2008-2009 Atheros Communications Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -87,7 +87,6 @@ static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
|||
struct ath_softc *sc;
|
||||
struct ieee80211_hw *hw;
|
||||
u8 csz;
|
||||
u32 val;
|
||||
int ret = 0;
|
||||
struct ath_hw *ah;
|
||||
|
||||
|
@ -134,14 +133,6 @@ static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
|||
|
||||
pci_set_master(pdev);
|
||||
|
||||
/*
|
||||
* Disable the RETRY_TIMEOUT register (0x41) to keep
|
||||
* PCI Tx retries from interfering with C3 CPU state.
|
||||
*/
|
||||
pci_read_config_dword(pdev, 0x40, &val);
|
||||
if ((val & 0x0000ff00) != 0)
|
||||
pci_write_config_dword(pdev, 0x40, val & 0xffff00ff);
|
||||
|
||||
ret = pci_request_region(pdev, 0, "ath9k");
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "PCI memory region reserve error\n");
|
||||
|
@ -253,21 +244,12 @@ static int ath_pci_resume(struct pci_dev *pdev)
|
|||
struct ieee80211_hw *hw = pci_get_drvdata(pdev);
|
||||
struct ath_wiphy *aphy = hw->priv;
|
||||
struct ath_softc *sc = aphy->sc;
|
||||
u32 val;
|
||||
int err;
|
||||
|
||||
err = pci_enable_device(pdev);
|
||||
if (err)
|
||||
return err;
|
||||
pci_restore_state(pdev);
|
||||
/*
|
||||
* Suspend/Resume resets the PCI configuration space, so we have to
|
||||
* re-disable the RETRY_TIMEOUT register (0x41) to keep
|
||||
* PCI Tx retries from interfering with C3 CPU state
|
||||
*/
|
||||
pci_read_config_dword(pdev, 0x40, &val);
|
||||
if ((val & 0x0000ff00) != 0)
|
||||
pci_write_config_dword(pdev, 0x40, val & 0xffff00ff);
|
||||
|
||||
/* Enable LED */
|
||||
ath9k_hw_cfg_output(sc->sc_ah, ATH_LED_PIN,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2008 Atheros Communications Inc.
|
||||
* Copyright (c) 2008-2009 Atheros Communications Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2008 Atheros Communications Inc.
|
||||
* Copyright (c) 2008-2009 Atheros Communications Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2004 Video54 Technologies, Inc.
|
||||
* Copyright (c) 2004-2008 Atheros Communications, Inc.
|
||||
* Copyright (c) 2004-2009 Atheros Communications, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -864,6 +864,8 @@ static void ath_rc_ratefind(struct ath_softc *sc,
|
|||
rate_table, nrix, 1, 0);
|
||||
ath_rc_rate_set_series(rate_table, &rates[i++], txrc,
|
||||
try_per_rate, nrix, 0);
|
||||
|
||||
tx_info->flags |= IEEE80211_TX_CTL_RATE_CTRL_PROBE;
|
||||
} else {
|
||||
try_per_rate = (ATH_11N_TXMAXTRY/4);
|
||||
/* Set the choosen rate. No RTS for first series entry. */
|
||||
|
@ -1468,16 +1470,18 @@ static void ath_rc_init(struct ath_softc *sc,
|
|||
ath_rc_priv->ht_cap);
|
||||
}
|
||||
|
||||
static u8 ath_rc_build_ht_caps(struct ath_softc *sc, bool is_ht, bool is_cw40,
|
||||
bool is_sgi40)
|
||||
static u8 ath_rc_build_ht_caps(struct ath_softc *sc, struct ieee80211_sta *sta,
|
||||
bool is_cw40, bool is_sgi40)
|
||||
{
|
||||
u8 caps = 0;
|
||||
|
||||
if (is_ht) {
|
||||
if (sta->ht_cap.ht_supported) {
|
||||
caps = WLAN_RC_HT_FLAG;
|
||||
if (sc->sc_ah->caps.tx_chainmask != 1 &&
|
||||
ath9k_hw_getcapability(sc->sc_ah, ATH9K_CAP_DS, 0, NULL))
|
||||
ath9k_hw_getcapability(sc->sc_ah, ATH9K_CAP_DS, 0, NULL)) {
|
||||
if (sta->ht_cap.mcs.rx_mask[1])
|
||||
caps |= WLAN_RC_DS_FLAG;
|
||||
}
|
||||
if (is_cw40)
|
||||
caps |= WLAN_RC_40_FLAG;
|
||||
if (is_sgi40)
|
||||
|
@ -1615,6 +1619,7 @@ static void ath_rate_init(void *priv, struct ieee80211_supported_band *sband,
|
|||
/* Choose rate table first */
|
||||
|
||||
if ((sc->sc_ah->opmode == NL80211_IFTYPE_STATION) ||
|
||||
(sc->sc_ah->opmode == NL80211_IFTYPE_MESH_POINT) ||
|
||||
(sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC)) {
|
||||
rate_table = ath_choose_rate_table(sc, sband->band,
|
||||
sta->ht_cap.ht_supported,
|
||||
|
@ -1624,8 +1629,7 @@ static void ath_rate_init(void *priv, struct ieee80211_supported_band *sband,
|
|||
rate_table = sc->cur_rate_table;
|
||||
}
|
||||
|
||||
ath_rc_priv->ht_cap = ath_rc_build_ht_caps(sc, sta->ht_cap.ht_supported,
|
||||
is_cw40, is_sgi40);
|
||||
ath_rc_priv->ht_cap = ath_rc_build_ht_caps(sc, sta, is_cw40, is_sgi40);
|
||||
ath_rc_init(sc, priv_sta, sband, sta, rate_table);
|
||||
}
|
||||
|
||||
|
@ -1659,8 +1663,7 @@ static void ath_rate_update(void *priv, struct ieee80211_supported_band *sband,
|
|||
rate_table = ath_choose_rate_table(sc, sband->band,
|
||||
sta->ht_cap.ht_supported,
|
||||
oper_cw40);
|
||||
ath_rc_priv->ht_cap = ath_rc_build_ht_caps(sc,
|
||||
sta->ht_cap.ht_supported,
|
||||
ath_rc_priv->ht_cap = ath_rc_build_ht_caps(sc, sta,
|
||||
oper_cw40, oper_sgi40);
|
||||
ath_rc_init(sc, priv_sta, sband, sta, rate_table);
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (c) 2004 Sam Leffler, Errno Consulting
|
||||
* Copyright (c) 2004 Video54 Technologies, Inc.
|
||||
* Copyright (c) 2008 Atheros Communications Inc.
|
||||
* Copyright (c) 2008-2009 Atheros Communications Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2008 Atheros Communications Inc.
|
||||
* Copyright (c) 2008-2009 Atheros Communications Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -344,9 +344,14 @@ void ath_rx_cleanup(struct ath_softc *sc)
|
|||
|
||||
list_for_each_entry(bf, &sc->rx.rxbuf, list) {
|
||||
skb = bf->bf_mpdu;
|
||||
if (skb)
|
||||
if (skb) {
|
||||
dma_unmap_single(sc->dev,
|
||||
bf->bf_buf_addr,
|
||||
sc->rx.bufsize,
|
||||
DMA_FROM_DEVICE);
|
||||
dev_kfree_skb(skb);
|
||||
}
|
||||
}
|
||||
|
||||
if (sc->rx.rxdma.dd_desc_len != 0)
|
||||
ath_descdma_cleanup(sc, &sc->rx.rxdma, &sc->rx.rxbuf);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2008 Atheros Communications Inc.
|
||||
* Copyright (c) 2008-2009 Atheros Communications Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2008 Atheros Communications Inc.
|
||||
* Copyright (c) 2008-2009 Atheros Communications Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2008 Atheros Communications Inc.
|
||||
* Copyright (c) 2008-2009 Atheros Communications Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2008 Atheros Communications Inc.
|
||||
* Copyright (c) 2008-2009 Atheros Communications Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2008 Atheros Communications Inc.
|
||||
* Copyright (c) 2008-2009 Atheros Communications Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -64,6 +64,10 @@ static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf,
|
|||
static void ath_tx_txqaddbuf(struct ath_softc *sc, struct ath_txq *txq,
|
||||
struct list_head *head);
|
||||
static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf);
|
||||
static int ath_tx_num_badfrms(struct ath_softc *sc, struct ath_buf *bf,
|
||||
int txok);
|
||||
static void ath_tx_rc_status(struct ath_buf *bf, struct ath_desc *ds,
|
||||
int nbad, int txok, bool update_rc);
|
||||
|
||||
/*********************/
|
||||
/* Aggregation logic */
|
||||
|
@ -274,9 +278,10 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
|
|||
struct ath_buf *bf_next, *bf_last = bf->bf_lastbf;
|
||||
struct ath_desc *ds = bf_last->bf_desc;
|
||||
struct list_head bf_head, bf_pending;
|
||||
u16 seq_st = 0;
|
||||
u16 seq_st = 0, acked_cnt = 0, txfail_cnt = 0;
|
||||
u32 ba[WME_BA_BMP_SIZE >> 5];
|
||||
int isaggr, txfail, txpending, sendbar = 0, needreset = 0;
|
||||
int isaggr, txfail, txpending, sendbar = 0, needreset = 0, nbad = 0;
|
||||
bool rc_update = true;
|
||||
|
||||
skb = (struct sk_buff *)bf->bf_mpdu;
|
||||
hdr = (struct ieee80211_hdr *)skb->data;
|
||||
|
@ -316,6 +321,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
|
|||
INIT_LIST_HEAD(&bf_pending);
|
||||
INIT_LIST_HEAD(&bf_head);
|
||||
|
||||
nbad = ath_tx_num_badfrms(sc, bf, txok);
|
||||
while (bf) {
|
||||
txfail = txpending = 0;
|
||||
bf_next = bf->bf_next;
|
||||
|
@ -323,8 +329,10 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
|
|||
if (ATH_BA_ISSET(ba, ATH_BA_INDEX(seq_st, bf->bf_seqno))) {
|
||||
/* transmit completion, subframe is
|
||||
* acked by block ack */
|
||||
acked_cnt++;
|
||||
} else if (!isaggr && txok) {
|
||||
/* transmit completion */
|
||||
acked_cnt++;
|
||||
} else {
|
||||
if (!(tid->state & AGGR_CLEANUP) &&
|
||||
ds->ds_txstat.ts_flags != ATH9K_TX_SW_ABORTED) {
|
||||
|
@ -335,6 +343,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
|
|||
bf->bf_state.bf_type |= BUF_XRETRY;
|
||||
txfail = 1;
|
||||
sendbar = 1;
|
||||
txfail_cnt++;
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
|
@ -361,6 +370,13 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
|
|||
ath_tx_update_baw(sc, tid, bf->bf_seqno);
|
||||
spin_unlock_bh(&txq->axq_lock);
|
||||
|
||||
if (rc_update && (acked_cnt == 1 || txfail_cnt == 1)) {
|
||||
ath_tx_rc_status(bf, ds, nbad, txok, true);
|
||||
rc_update = false;
|
||||
} else {
|
||||
ath_tx_rc_status(bf, ds, nbad, txok, false);
|
||||
}
|
||||
|
||||
ath_tx_complete_buf(sc, bf, &bf_head, !txfail, sendbar);
|
||||
} else {
|
||||
/* retry the un-acked ones */
|
||||
|
@ -1734,7 +1750,7 @@ exit:
|
|||
/*****************/
|
||||
|
||||
static void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb,
|
||||
struct ath_xmit_status *tx_status)
|
||||
int tx_flags)
|
||||
{
|
||||
struct ieee80211_hw *hw = sc->hw;
|
||||
struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
|
||||
|
@ -1755,18 +1771,14 @@ static void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb,
|
|||
tx_info->rate_driver_data[0] = NULL;
|
||||
}
|
||||
|
||||
if (tx_status->flags & ATH_TX_BAR) {
|
||||
if (tx_flags & ATH_TX_BAR)
|
||||
tx_info->flags |= IEEE80211_TX_STAT_AMPDU_NO_BACK;
|
||||
tx_status->flags &= ~ATH_TX_BAR;
|
||||
}
|
||||
|
||||
if (!(tx_status->flags & (ATH_TX_ERROR | ATH_TX_XRETRY))) {
|
||||
if (!(tx_flags & (ATH_TX_ERROR | ATH_TX_XRETRY))) {
|
||||
/* Frame was ACKed */
|
||||
tx_info->flags |= IEEE80211_TX_STAT_ACK;
|
||||
}
|
||||
|
||||
tx_info->status.rates[0].count = tx_status->retries + 1;
|
||||
|
||||
hdrlen = ieee80211_get_hdrlen_from_skb(skb);
|
||||
padsize = hdrlen & 3;
|
||||
if (padsize && hdrlen >= 24) {
|
||||
|
@ -1789,29 +1801,22 @@ static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf,
|
|||
int txok, int sendbar)
|
||||
{
|
||||
struct sk_buff *skb = bf->bf_mpdu;
|
||||
struct ath_xmit_status tx_status;
|
||||
unsigned long flags;
|
||||
int tx_flags = 0;
|
||||
|
||||
/*
|
||||
* Set retry information.
|
||||
* NB: Don't use the information in the descriptor, because the frame
|
||||
* could be software retried.
|
||||
*/
|
||||
tx_status.retries = bf->bf_retries;
|
||||
tx_status.flags = 0;
|
||||
|
||||
if (sendbar)
|
||||
tx_status.flags = ATH_TX_BAR;
|
||||
tx_flags = ATH_TX_BAR;
|
||||
|
||||
if (!txok) {
|
||||
tx_status.flags |= ATH_TX_ERROR;
|
||||
tx_flags |= ATH_TX_ERROR;
|
||||
|
||||
if (bf_isxretried(bf))
|
||||
tx_status.flags |= ATH_TX_XRETRY;
|
||||
tx_flags |= ATH_TX_XRETRY;
|
||||
}
|
||||
|
||||
dma_unmap_single(sc->dev, bf->bf_dmacontext, skb->len, DMA_TO_DEVICE);
|
||||
ath_tx_complete(sc, skb, &tx_status);
|
||||
ath_tx_complete(sc, skb, tx_flags);
|
||||
|
||||
/*
|
||||
* Return the list of ath_buf of this mpdu to free queue
|
||||
|
@ -1852,27 +1857,40 @@ static int ath_tx_num_badfrms(struct ath_softc *sc, struct ath_buf *bf,
|
|||
return nbad;
|
||||
}
|
||||
|
||||
static void ath_tx_rc_status(struct ath_buf *bf, struct ath_desc *ds, int nbad)
|
||||
static void ath_tx_rc_status(struct ath_buf *bf, struct ath_desc *ds,
|
||||
int nbad, int txok, bool update_rc)
|
||||
{
|
||||
struct sk_buff *skb = (struct sk_buff *)bf->bf_mpdu;
|
||||
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
|
||||
struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
|
||||
struct ath_tx_info_priv *tx_info_priv = ATH_TX_INFO_PRIV(tx_info);
|
||||
struct ieee80211_hw *hw = tx_info_priv->aphy->hw;
|
||||
u8 i, tx_rateindex;
|
||||
|
||||
tx_info_priv->update_rc = false;
|
||||
if (txok)
|
||||
tx_info->status.ack_signal = ds->ds_txstat.ts_rssi;
|
||||
|
||||
tx_rateindex = ds->ds_txstat.ts_rateindex;
|
||||
WARN_ON(tx_rateindex >= hw->max_rates);
|
||||
|
||||
tx_info_priv->update_rc = update_rc;
|
||||
if (ds->ds_txstat.ts_status & ATH9K_TXERR_FILT)
|
||||
tx_info->flags |= IEEE80211_TX_STAT_TX_FILTERED;
|
||||
|
||||
if ((ds->ds_txstat.ts_status & ATH9K_TXERR_FILT) == 0 &&
|
||||
(bf->bf_flags & ATH9K_TXDESC_NOACK) == 0) {
|
||||
(bf->bf_flags & ATH9K_TXDESC_NOACK) == 0 && update_rc) {
|
||||
if (ieee80211_is_data(hdr->frame_control)) {
|
||||
memcpy(&tx_info_priv->tx, &ds->ds_txstat,
|
||||
sizeof(tx_info_priv->tx));
|
||||
tx_info_priv->n_frames = bf->bf_nframes;
|
||||
tx_info_priv->n_bad_frames = nbad;
|
||||
tx_info_priv->update_rc = true;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = tx_rateindex + 1; i < hw->max_rates; i++)
|
||||
tx_info->status.rates[i].count = 0;
|
||||
|
||||
tx_info->status.rates[tx_rateindex].count = bf->bf_retries + 1;
|
||||
}
|
||||
|
||||
static void ath_wake_mac80211_queue(struct ath_softc *sc, struct ath_txq *txq)
|
||||
|
@ -1897,7 +1915,7 @@ static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq)
|
|||
struct ath_buf *bf, *lastbf, *bf_held = NULL;
|
||||
struct list_head bf_head;
|
||||
struct ath_desc *ds;
|
||||
int txok, nbad = 0;
|
||||
int txok;
|
||||
int status;
|
||||
|
||||
DPRINTF(sc, ATH_DBG_QUEUE, "tx queue %d (%x), link %p\n",
|
||||
|
@ -1991,13 +2009,9 @@ static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq)
|
|||
bf->bf_retries = ds->ds_txstat.ts_longretry;
|
||||
if (ds->ds_txstat.ts_status & ATH9K_TXERR_XRETRY)
|
||||
bf->bf_state.bf_type |= BUF_XRETRY;
|
||||
nbad = 0;
|
||||
} else {
|
||||
nbad = ath_tx_num_badfrms(sc, bf, txok);
|
||||
ath_tx_rc_status(bf, ds, 0, txok, true);
|
||||
}
|
||||
|
||||
ath_tx_rc_status(bf, ds, nbad);
|
||||
|
||||
if (bf_isampdu(bf))
|
||||
ath_tx_complete_aggr(sc, txq, bf, &bf_head, txok);
|
||||
else
|
||||
|
|
|
@ -3993,6 +3993,8 @@ static void setup_struct_wldev_for_init(struct b43_wldev *dev)
|
|||
dev->irq_reason = 0;
|
||||
memset(dev->dma_reason, 0, sizeof(dev->dma_reason));
|
||||
dev->irq_savedstate = B43_IRQ_MASKTEMPLATE;
|
||||
if (b43_modparam_verbose < B43_VERBOSITY_DEBUG)
|
||||
dev->irq_savedstate &= ~B43_IRQ_PHY_TXERR;
|
||||
|
||||
dev->mac_suspended = 1;
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue