diff options
author | Arnd Bergmann <arnd@arndb.de> | 2011-11-23 15:47:41 -0500 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2011-11-23 15:47:41 -0500 |
commit | 58a273745fbb2fbd01d26e7a60f0acc8c1d99469 (patch) | |
tree | bc16200f3b6ea150b298422754e32959eaa339bc /drivers/net | |
parent | 951c486f62490e032da0ad17e93270b0cfb6687f (diff) | |
parent | 0116da4fcc1ae8a80d9002441e98768f2a6fa2fe (diff) |
Merge branches 'drivers/macb-gem' and 'drivers/pxa-gpio' into next/drivers
Diffstat (limited to 'drivers/net')
32 files changed, 640 insertions, 368 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index b2b9109b6712..b0c577256487 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -560,8 +560,8 @@ static int bond_update_speed_duplex(struct slave *slave) | |||
560 | u32 slave_speed; | 560 | u32 slave_speed; |
561 | int res; | 561 | int res; |
562 | 562 | ||
563 | slave->speed = -1; | 563 | slave->speed = SPEED_UNKNOWN; |
564 | slave->duplex = -1; | 564 | slave->duplex = DUPLEX_UNKNOWN; |
565 | 565 | ||
566 | res = __ethtool_get_settings(slave_dev, &ecmd); | 566 | res = __ethtool_get_settings(slave_dev, &ecmd); |
567 | if (res < 0) | 567 | if (res < 0) |
diff --git a/drivers/net/bonding/bond_procfs.c b/drivers/net/bonding/bond_procfs.c index 2acf0b080169..ad284baafe87 100644 --- a/drivers/net/bonding/bond_procfs.c +++ b/drivers/net/bonding/bond_procfs.c | |||
@@ -158,12 +158,12 @@ static void bond_info_show_slave(struct seq_file *seq, | |||
158 | seq_printf(seq, "\nSlave Interface: %s\n", slave->dev->name); | 158 | seq_printf(seq, "\nSlave Interface: %s\n", slave->dev->name); |
159 | seq_printf(seq, "MII Status: %s\n", | 159 | seq_printf(seq, "MII Status: %s\n", |
160 | (slave->link == BOND_LINK_UP) ? "up" : "down"); | 160 | (slave->link == BOND_LINK_UP) ? "up" : "down"); |
161 | if (slave->speed == -1) | 161 | if (slave->speed == SPEED_UNKNOWN) |
162 | seq_printf(seq, "Speed: %s\n", "Unknown"); | 162 | seq_printf(seq, "Speed: %s\n", "Unknown"); |
163 | else | 163 | else |
164 | seq_printf(seq, "Speed: %d Mbps\n", slave->speed); | 164 | seq_printf(seq, "Speed: %d Mbps\n", slave->speed); |
165 | 165 | ||
166 | if (slave->duplex == -1) | 166 | if (slave->duplex == DUPLEX_UNKNOWN) |
167 | seq_printf(seq, "Duplex: %s\n", "Unknown"); | 167 | seq_printf(seq, "Duplex: %s\n", "Unknown"); |
168 | else | 168 | else |
169 | seq_printf(seq, "Duplex: %s\n", slave->duplex ? "full" : "half"); | 169 | seq_printf(seq, "Duplex: %s\n", slave->duplex ? "full" : "half"); |
diff --git a/drivers/net/ethernet/Makefile b/drivers/net/ethernet/Makefile index be5dde040261..94b7f287d6c5 100644 --- a/drivers/net/ethernet/Makefile +++ b/drivers/net/ethernet/Makefile | |||
@@ -10,7 +10,7 @@ obj-$(CONFIG_NET_VENDOR_ALTEON) += alteon/ | |||
10 | obj-$(CONFIG_NET_VENDOR_AMD) += amd/ | 10 | obj-$(CONFIG_NET_VENDOR_AMD) += amd/ |
11 | obj-$(CONFIG_NET_VENDOR_APPLE) += apple/ | 11 | obj-$(CONFIG_NET_VENDOR_APPLE) += apple/ |
12 | obj-$(CONFIG_NET_VENDOR_ATHEROS) += atheros/ | 12 | obj-$(CONFIG_NET_VENDOR_ATHEROS) += atheros/ |
13 | obj-$(CONFIG_NET_ATMEL) += cadence/ | 13 | obj-$(CONFIG_NET_CADENCE) += cadence/ |
14 | obj-$(CONFIG_NET_BFIN) += adi/ | 14 | obj-$(CONFIG_NET_BFIN) += adi/ |
15 | obj-$(CONFIG_NET_VENDOR_BROADCOM) += broadcom/ | 15 | obj-$(CONFIG_NET_VENDOR_BROADCOM) += broadcom/ |
16 | obj-$(CONFIG_NET_VENDOR_BROCADE) += brocade/ | 16 | obj-$(CONFIG_NET_VENDOR_BROCADE) += brocade/ |
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index 161cbbb4814a..bf4074167d6a 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c | |||
@@ -89,10 +89,10 @@ static inline void _tg3_flag_clear(enum TG3_FLAGS flag, unsigned long *bits) | |||
89 | 89 | ||
90 | #define DRV_MODULE_NAME "tg3" | 90 | #define DRV_MODULE_NAME "tg3" |
91 | #define TG3_MAJ_NUM 3 | 91 | #define TG3_MAJ_NUM 3 |
92 | #define TG3_MIN_NUM 120 | 92 | #define TG3_MIN_NUM 121 |
93 | #define DRV_MODULE_VERSION \ | 93 | #define DRV_MODULE_VERSION \ |
94 | __stringify(TG3_MAJ_NUM) "." __stringify(TG3_MIN_NUM) | 94 | __stringify(TG3_MAJ_NUM) "." __stringify(TG3_MIN_NUM) |
95 | #define DRV_MODULE_RELDATE "August 18, 2011" | 95 | #define DRV_MODULE_RELDATE "November 2, 2011" |
96 | 96 | ||
97 | #define RESET_KIND_SHUTDOWN 0 | 97 | #define RESET_KIND_SHUTDOWN 0 |
98 | #define RESET_KIND_INIT 1 | 98 | #define RESET_KIND_INIT 1 |
@@ -628,19 +628,23 @@ static void tg3_ape_lock_init(struct tg3 *tp) | |||
628 | regbase = TG3_APE_PER_LOCK_GRANT; | 628 | regbase = TG3_APE_PER_LOCK_GRANT; |
629 | 629 | ||
630 | /* Make sure the driver hasn't any stale locks. */ | 630 | /* Make sure the driver hasn't any stale locks. */ |
631 | for (i = 0; i < 8; i++) { | 631 | for (i = TG3_APE_LOCK_PHY0; i <= TG3_APE_LOCK_GPIO; i++) { |
632 | if (i == TG3_APE_LOCK_GPIO) | 632 | switch (i) { |
633 | continue; | 633 | case TG3_APE_LOCK_PHY0: |
634 | tg3_ape_write32(tp, regbase + 4 * i, APE_LOCK_GRANT_DRIVER); | 634 | case TG3_APE_LOCK_PHY1: |
635 | case TG3_APE_LOCK_PHY2: | ||
636 | case TG3_APE_LOCK_PHY3: | ||
637 | bit = APE_LOCK_GRANT_DRIVER; | ||
638 | break; | ||
639 | default: | ||
640 | if (!tp->pci_fn) | ||
641 | bit = APE_LOCK_GRANT_DRIVER; | ||
642 | else | ||
643 | bit = 1 << tp->pci_fn; | ||
644 | } | ||
645 | tg3_ape_write32(tp, regbase + 4 * i, bit); | ||
635 | } | 646 | } |
636 | 647 | ||
637 | /* Clear the correct bit of the GPIO lock too. */ | ||
638 | if (!tp->pci_fn) | ||
639 | bit = APE_LOCK_GRANT_DRIVER; | ||
640 | else | ||
641 | bit = 1 << tp->pci_fn; | ||
642 | |||
643 | tg3_ape_write32(tp, regbase + 4 * TG3_APE_LOCK_GPIO, bit); | ||
644 | } | 648 | } |
645 | 649 | ||
646 | static int tg3_ape_lock(struct tg3 *tp, int locknum) | 650 | static int tg3_ape_lock(struct tg3 *tp, int locknum) |
@@ -658,6 +662,10 @@ static int tg3_ape_lock(struct tg3 *tp, int locknum) | |||
658 | return 0; | 662 | return 0; |
659 | case TG3_APE_LOCK_GRC: | 663 | case TG3_APE_LOCK_GRC: |
660 | case TG3_APE_LOCK_MEM: | 664 | case TG3_APE_LOCK_MEM: |
665 | if (!tp->pci_fn) | ||
666 | bit = APE_LOCK_REQ_DRIVER; | ||
667 | else | ||
668 | bit = 1 << tp->pci_fn; | ||
661 | break; | 669 | break; |
662 | default: | 670 | default: |
663 | return -EINVAL; | 671 | return -EINVAL; |
@@ -673,11 +681,6 @@ static int tg3_ape_lock(struct tg3 *tp, int locknum) | |||
673 | 681 | ||
674 | off = 4 * locknum; | 682 | off = 4 * locknum; |
675 | 683 | ||
676 | if (locknum != TG3_APE_LOCK_GPIO || !tp->pci_fn) | ||
677 | bit = APE_LOCK_REQ_DRIVER; | ||
678 | else | ||
679 | bit = 1 << tp->pci_fn; | ||
680 | |||
681 | tg3_ape_write32(tp, req + off, bit); | 684 | tg3_ape_write32(tp, req + off, bit); |
682 | 685 | ||
683 | /* Wait for up to 1 millisecond to acquire lock. */ | 686 | /* Wait for up to 1 millisecond to acquire lock. */ |
@@ -710,6 +713,10 @@ static void tg3_ape_unlock(struct tg3 *tp, int locknum) | |||
710 | return; | 713 | return; |
711 | case TG3_APE_LOCK_GRC: | 714 | case TG3_APE_LOCK_GRC: |
712 | case TG3_APE_LOCK_MEM: | 715 | case TG3_APE_LOCK_MEM: |
716 | if (!tp->pci_fn) | ||
717 | bit = APE_LOCK_GRANT_DRIVER; | ||
718 | else | ||
719 | bit = 1 << tp->pci_fn; | ||
713 | break; | 720 | break; |
714 | default: | 721 | default: |
715 | return; | 722 | return; |
@@ -720,11 +727,6 @@ static void tg3_ape_unlock(struct tg3 *tp, int locknum) | |||
720 | else | 727 | else |
721 | gnt = TG3_APE_PER_LOCK_GRANT; | 728 | gnt = TG3_APE_PER_LOCK_GRANT; |
722 | 729 | ||
723 | if (locknum != TG3_APE_LOCK_GPIO || !tp->pci_fn) | ||
724 | bit = APE_LOCK_GRANT_DRIVER; | ||
725 | else | ||
726 | bit = 1 << tp->pci_fn; | ||
727 | |||
728 | tg3_ape_write32(tp, gnt + 4 * locknum, bit); | 730 | tg3_ape_write32(tp, gnt + 4 * locknum, bit); |
729 | } | 731 | } |
730 | 732 | ||
@@ -5927,6 +5929,18 @@ static int tg3_poll_work(struct tg3_napi *tnapi, int work_done, int budget) | |||
5927 | return work_done; | 5929 | return work_done; |
5928 | } | 5930 | } |
5929 | 5931 | ||
5932 | static inline void tg3_reset_task_schedule(struct tg3 *tp) | ||
5933 | { | ||
5934 | if (!test_and_set_bit(TG3_FLAG_RESET_TASK_PENDING, tp->tg3_flags)) | ||
5935 | schedule_work(&tp->reset_task); | ||
5936 | } | ||
5937 | |||
5938 | static inline void tg3_reset_task_cancel(struct tg3 *tp) | ||
5939 | { | ||
5940 | cancel_work_sync(&tp->reset_task); | ||
5941 | tg3_flag_clear(tp, RESET_TASK_PENDING); | ||
5942 | } | ||
5943 | |||
5930 | static int tg3_poll_msix(struct napi_struct *napi, int budget) | 5944 | static int tg3_poll_msix(struct napi_struct *napi, int budget) |
5931 | { | 5945 | { |
5932 | struct tg3_napi *tnapi = container_of(napi, struct tg3_napi, napi); | 5946 | struct tg3_napi *tnapi = container_of(napi, struct tg3_napi, napi); |
@@ -5967,7 +5981,7 @@ static int tg3_poll_msix(struct napi_struct *napi, int budget) | |||
5967 | tx_recovery: | 5981 | tx_recovery: |
5968 | /* work_done is guaranteed to be less than budget. */ | 5982 | /* work_done is guaranteed to be less than budget. */ |
5969 | napi_complete(napi); | 5983 | napi_complete(napi); |
5970 | schedule_work(&tp->reset_task); | 5984 | tg3_reset_task_schedule(tp); |
5971 | return work_done; | 5985 | return work_done; |
5972 | } | 5986 | } |
5973 | 5987 | ||
@@ -6002,7 +6016,7 @@ static void tg3_process_error(struct tg3 *tp) | |||
6002 | tg3_dump_state(tp); | 6016 | tg3_dump_state(tp); |
6003 | 6017 | ||
6004 | tg3_flag_set(tp, ERROR_PROCESSED); | 6018 | tg3_flag_set(tp, ERROR_PROCESSED); |
6005 | schedule_work(&tp->reset_task); | 6019 | tg3_reset_task_schedule(tp); |
6006 | } | 6020 | } |
6007 | 6021 | ||
6008 | static int tg3_poll(struct napi_struct *napi, int budget) | 6022 | static int tg3_poll(struct napi_struct *napi, int budget) |
@@ -6049,7 +6063,7 @@ static int tg3_poll(struct napi_struct *napi, int budget) | |||
6049 | tx_recovery: | 6063 | tx_recovery: |
6050 | /* work_done is guaranteed to be less than budget. */ | 6064 | /* work_done is guaranteed to be less than budget. */ |
6051 | napi_complete(napi); | 6065 | napi_complete(napi); |
6052 | schedule_work(&tp->reset_task); | 6066 | tg3_reset_task_schedule(tp); |
6053 | return work_done; | 6067 | return work_done; |
6054 | } | 6068 | } |
6055 | 6069 | ||
@@ -6338,11 +6352,11 @@ static void tg3_reset_task(struct work_struct *work) | |||
6338 | { | 6352 | { |
6339 | struct tg3 *tp = container_of(work, struct tg3, reset_task); | 6353 | struct tg3 *tp = container_of(work, struct tg3, reset_task); |
6340 | int err; | 6354 | int err; |
6341 | unsigned int restart_timer; | ||
6342 | 6355 | ||
6343 | tg3_full_lock(tp, 0); | 6356 | tg3_full_lock(tp, 0); |
6344 | 6357 | ||
6345 | if (!netif_running(tp->dev)) { | 6358 | if (!netif_running(tp->dev)) { |
6359 | tg3_flag_clear(tp, RESET_TASK_PENDING); | ||
6346 | tg3_full_unlock(tp); | 6360 | tg3_full_unlock(tp); |
6347 | return; | 6361 | return; |
6348 | } | 6362 | } |
@@ -6355,9 +6369,6 @@ static void tg3_reset_task(struct work_struct *work) | |||
6355 | 6369 | ||
6356 | tg3_full_lock(tp, 1); | 6370 | tg3_full_lock(tp, 1); |
6357 | 6371 | ||
6358 | restart_timer = tg3_flag(tp, RESTART_TIMER); | ||
6359 | tg3_flag_clear(tp, RESTART_TIMER); | ||
6360 | |||
6361 | if (tg3_flag(tp, TX_RECOVERY_PENDING)) { | 6372 | if (tg3_flag(tp, TX_RECOVERY_PENDING)) { |
6362 | tp->write32_tx_mbox = tg3_write32_tx_mbox; | 6373 | tp->write32_tx_mbox = tg3_write32_tx_mbox; |
6363 | tp->write32_rx_mbox = tg3_write_flush_reg32; | 6374 | tp->write32_rx_mbox = tg3_write_flush_reg32; |
@@ -6372,14 +6383,13 @@ static void tg3_reset_task(struct work_struct *work) | |||
6372 | 6383 | ||
6373 | tg3_netif_start(tp); | 6384 | tg3_netif_start(tp); |
6374 | 6385 | ||
6375 | if (restart_timer) | ||
6376 | mod_timer(&tp->timer, jiffies + 1); | ||
6377 | |||
6378 | out: | 6386 | out: |
6379 | tg3_full_unlock(tp); | 6387 | tg3_full_unlock(tp); |
6380 | 6388 | ||
6381 | if (!err) | 6389 | if (!err) |
6382 | tg3_phy_start(tp); | 6390 | tg3_phy_start(tp); |
6391 | |||
6392 | tg3_flag_clear(tp, RESET_TASK_PENDING); | ||
6383 | } | 6393 | } |
6384 | 6394 | ||
6385 | static void tg3_tx_timeout(struct net_device *dev) | 6395 | static void tg3_tx_timeout(struct net_device *dev) |
@@ -6391,7 +6401,7 @@ static void tg3_tx_timeout(struct net_device *dev) | |||
6391 | tg3_dump_state(tp); | 6401 | tg3_dump_state(tp); |
6392 | } | 6402 | } |
6393 | 6403 | ||
6394 | schedule_work(&tp->reset_task); | 6404 | tg3_reset_task_schedule(tp); |
6395 | } | 6405 | } |
6396 | 6406 | ||
6397 | /* Test for DMA buffers crossing any 4GB boundaries: 4G, 8G, etc */ | 6407 | /* Test for DMA buffers crossing any 4GB boundaries: 4G, 8G, etc */ |
@@ -6442,31 +6452,26 @@ static bool tg3_tx_frag_set(struct tg3_napi *tnapi, u32 *entry, u32 *budget, | |||
6442 | hwbug = 1; | 6452 | hwbug = 1; |
6443 | 6453 | ||
6444 | if (tg3_flag(tp, 4K_FIFO_LIMIT)) { | 6454 | if (tg3_flag(tp, 4K_FIFO_LIMIT)) { |
6455 | u32 prvidx = *entry; | ||
6445 | u32 tmp_flag = flags & ~TXD_FLAG_END; | 6456 | u32 tmp_flag = flags & ~TXD_FLAG_END; |
6446 | while (len > TG3_TX_BD_DMA_MAX) { | 6457 | while (len > TG3_TX_BD_DMA_MAX && *budget) { |
6447 | u32 frag_len = TG3_TX_BD_DMA_MAX; | 6458 | u32 frag_len = TG3_TX_BD_DMA_MAX; |
6448 | len -= TG3_TX_BD_DMA_MAX; | 6459 | len -= TG3_TX_BD_DMA_MAX; |
6449 | 6460 | ||
6450 | if (len) { | 6461 | /* Avoid the 8byte DMA problem */ |
6451 | tnapi->tx_buffers[*entry].fragmented = true; | 6462 | if (len <= 8) { |
6452 | /* Avoid the 8byte DMA problem */ | 6463 | len += TG3_TX_BD_DMA_MAX / 2; |
6453 | if (len <= 8) { | 6464 | frag_len = TG3_TX_BD_DMA_MAX / 2; |
6454 | len += TG3_TX_BD_DMA_MAX / 2; | ||
6455 | frag_len = TG3_TX_BD_DMA_MAX / 2; | ||
6456 | } | ||
6457 | } else | ||
6458 | tmp_flag = flags; | ||
6459 | |||
6460 | if (*budget) { | ||
6461 | tg3_tx_set_bd(&tnapi->tx_ring[*entry], map, | ||
6462 | frag_len, tmp_flag, mss, vlan); | ||
6463 | (*budget)--; | ||
6464 | *entry = NEXT_TX(*entry); | ||
6465 | } else { | ||
6466 | hwbug = 1; | ||
6467 | break; | ||
6468 | } | 6465 | } |
6469 | 6466 | ||
6467 | tnapi->tx_buffers[*entry].fragmented = true; | ||
6468 | |||
6469 | tg3_tx_set_bd(&tnapi->tx_ring[*entry], map, | ||
6470 | frag_len, tmp_flag, mss, vlan); | ||
6471 | *budget -= 1; | ||
6472 | prvidx = *entry; | ||
6473 | *entry = NEXT_TX(*entry); | ||
6474 | |||
6470 | map += frag_len; | 6475 | map += frag_len; |
6471 | } | 6476 | } |
6472 | 6477 | ||
@@ -6474,10 +6479,11 @@ static bool tg3_tx_frag_set(struct tg3_napi *tnapi, u32 *entry, u32 *budget, | |||
6474 | if (*budget) { | 6479 | if (*budget) { |
6475 | tg3_tx_set_bd(&tnapi->tx_ring[*entry], map, | 6480 | tg3_tx_set_bd(&tnapi->tx_ring[*entry], map, |
6476 | len, flags, mss, vlan); | 6481 | len, flags, mss, vlan); |
6477 | (*budget)--; | 6482 | *budget -= 1; |
6478 | *entry = NEXT_TX(*entry); | 6483 | *entry = NEXT_TX(*entry); |
6479 | } else { | 6484 | } else { |
6480 | hwbug = 1; | 6485 | hwbug = 1; |
6486 | tnapi->tx_buffers[prvidx].fragmented = false; | ||
6481 | } | 6487 | } |
6482 | } | 6488 | } |
6483 | } else { | 6489 | } else { |
@@ -6509,7 +6515,7 @@ static void tg3_tx_skb_unmap(struct tg3_napi *tnapi, u32 entry, int last) | |||
6509 | txb = &tnapi->tx_buffers[entry]; | 6515 | txb = &tnapi->tx_buffers[entry]; |
6510 | } | 6516 | } |
6511 | 6517 | ||
6512 | for (i = 0; i < last; i++) { | 6518 | for (i = 0; i <= last; i++) { |
6513 | const skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; | 6519 | const skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; |
6514 | 6520 | ||
6515 | entry = NEXT_TX(entry); | 6521 | entry = NEXT_TX(entry); |
@@ -6559,6 +6565,8 @@ static int tigon3_dma_hwbug_workaround(struct tg3_napi *tnapi, | |||
6559 | dev_kfree_skb(new_skb); | 6565 | dev_kfree_skb(new_skb); |
6560 | ret = -1; | 6566 | ret = -1; |
6561 | } else { | 6567 | } else { |
6568 | u32 save_entry = *entry; | ||
6569 | |||
6562 | base_flags |= TXD_FLAG_END; | 6570 | base_flags |= TXD_FLAG_END; |
6563 | 6571 | ||
6564 | tnapi->tx_buffers[*entry].skb = new_skb; | 6572 | tnapi->tx_buffers[*entry].skb = new_skb; |
@@ -6568,7 +6576,7 @@ static int tigon3_dma_hwbug_workaround(struct tg3_napi *tnapi, | |||
6568 | if (tg3_tx_frag_set(tnapi, entry, budget, new_addr, | 6576 | if (tg3_tx_frag_set(tnapi, entry, budget, new_addr, |
6569 | new_skb->len, base_flags, | 6577 | new_skb->len, base_flags, |
6570 | mss, vlan)) { | 6578 | mss, vlan)) { |
6571 | tg3_tx_skb_unmap(tnapi, *entry, 0); | 6579 | tg3_tx_skb_unmap(tnapi, save_entry, -1); |
6572 | dev_kfree_skb(new_skb); | 6580 | dev_kfree_skb(new_skb); |
6573 | ret = -1; | 6581 | ret = -1; |
6574 | } | 6582 | } |
@@ -6758,11 +6766,10 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
6758 | 6766 | ||
6759 | if (tg3_tx_frag_set(tnapi, &entry, &budget, mapping, len, base_flags | | 6767 | if (tg3_tx_frag_set(tnapi, &entry, &budget, mapping, len, base_flags | |
6760 | ((skb_shinfo(skb)->nr_frags == 0) ? TXD_FLAG_END : 0), | 6768 | ((skb_shinfo(skb)->nr_frags == 0) ? TXD_FLAG_END : 0), |
6761 | mss, vlan)) | 6769 | mss, vlan)) { |
6762 | would_hit_hwbug = 1; | 6770 | would_hit_hwbug = 1; |
6763 | |||
6764 | /* Now loop through additional data fragments, and queue them. */ | 6771 | /* Now loop through additional data fragments, and queue them. */ |
6765 | if (skb_shinfo(skb)->nr_frags > 0) { | 6772 | } else if (skb_shinfo(skb)->nr_frags > 0) { |
6766 | u32 tmp_mss = mss; | 6773 | u32 tmp_mss = mss; |
6767 | 6774 | ||
6768 | if (!tg3_flag(tp, HW_TSO_1) && | 6775 | if (!tg3_flag(tp, HW_TSO_1) && |
@@ -6784,11 +6791,14 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
6784 | if (dma_mapping_error(&tp->pdev->dev, mapping)) | 6791 | if (dma_mapping_error(&tp->pdev->dev, mapping)) |
6785 | goto dma_error; | 6792 | goto dma_error; |
6786 | 6793 | ||
6787 | if (tg3_tx_frag_set(tnapi, &entry, &budget, mapping, | 6794 | if (!budget || |
6795 | tg3_tx_frag_set(tnapi, &entry, &budget, mapping, | ||
6788 | len, base_flags | | 6796 | len, base_flags | |
6789 | ((i == last) ? TXD_FLAG_END : 0), | 6797 | ((i == last) ? TXD_FLAG_END : 0), |
6790 | tmp_mss, vlan)) | 6798 | tmp_mss, vlan)) { |
6791 | would_hit_hwbug = 1; | 6799 | would_hit_hwbug = 1; |
6800 | break; | ||
6801 | } | ||
6792 | } | 6802 | } |
6793 | } | 6803 | } |
6794 | 6804 | ||
@@ -6828,7 +6838,7 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
6828 | return NETDEV_TX_OK; | 6838 | return NETDEV_TX_OK; |
6829 | 6839 | ||
6830 | dma_error: | 6840 | dma_error: |
6831 | tg3_tx_skb_unmap(tnapi, tnapi->tx_prod, i); | 6841 | tg3_tx_skb_unmap(tnapi, tnapi->tx_prod, --i); |
6832 | tnapi->tx_buffers[tnapi->tx_prod].skb = NULL; | 6842 | tnapi->tx_buffers[tnapi->tx_prod].skb = NULL; |
6833 | drop: | 6843 | drop: |
6834 | dev_kfree_skb(skb); | 6844 | dev_kfree_skb(skb); |
@@ -7281,7 +7291,8 @@ static void tg3_free_rings(struct tg3 *tp) | |||
7281 | if (!skb) | 7291 | if (!skb) |
7282 | continue; | 7292 | continue; |
7283 | 7293 | ||
7284 | tg3_tx_skb_unmap(tnapi, i, skb_shinfo(skb)->nr_frags); | 7294 | tg3_tx_skb_unmap(tnapi, i, |
7295 | skb_shinfo(skb)->nr_frags - 1); | ||
7285 | 7296 | ||
7286 | dev_kfree_skb_any(skb); | 7297 | dev_kfree_skb_any(skb); |
7287 | } | 7298 | } |
@@ -9200,7 +9211,7 @@ static void tg3_timer(unsigned long __opaque) | |||
9200 | { | 9211 | { |
9201 | struct tg3 *tp = (struct tg3 *) __opaque; | 9212 | struct tg3 *tp = (struct tg3 *) __opaque; |
9202 | 9213 | ||
9203 | if (tp->irq_sync) | 9214 | if (tp->irq_sync || tg3_flag(tp, RESET_TASK_PENDING)) |
9204 | goto restart_timer; | 9215 | goto restart_timer; |
9205 | 9216 | ||
9206 | spin_lock(&tp->lock); | 9217 | spin_lock(&tp->lock); |
@@ -9223,10 +9234,9 @@ static void tg3_timer(unsigned long __opaque) | |||
9223 | } | 9234 | } |
9224 | 9235 | ||
9225 | if (!(tr32(WDMAC_MODE) & WDMAC_MODE_ENABLE)) { | 9236 | if (!(tr32(WDMAC_MODE) & WDMAC_MODE_ENABLE)) { |
9226 | tg3_flag_set(tp, RESTART_TIMER); | ||
9227 | spin_unlock(&tp->lock); | 9237 | spin_unlock(&tp->lock); |
9228 | schedule_work(&tp->reset_task); | 9238 | tg3_reset_task_schedule(tp); |
9229 | return; | 9239 | goto restart_timer; |
9230 | } | 9240 | } |
9231 | } | 9241 | } |
9232 | 9242 | ||
@@ -9674,15 +9684,14 @@ static int tg3_open(struct net_device *dev) | |||
9674 | struct tg3_napi *tnapi = &tp->napi[i]; | 9684 | struct tg3_napi *tnapi = &tp->napi[i]; |
9675 | err = tg3_request_irq(tp, i); | 9685 | err = tg3_request_irq(tp, i); |
9676 | if (err) { | 9686 | if (err) { |
9677 | for (i--; i >= 0; i--) | 9687 | for (i--; i >= 0; i--) { |
9688 | tnapi = &tp->napi[i]; | ||
9678 | free_irq(tnapi->irq_vec, tnapi); | 9689 | free_irq(tnapi->irq_vec, tnapi); |
9679 | break; | 9690 | } |
9691 | goto err_out2; | ||
9680 | } | 9692 | } |
9681 | } | 9693 | } |
9682 | 9694 | ||
9683 | if (err) | ||
9684 | goto err_out2; | ||
9685 | |||
9686 | tg3_full_lock(tp, 0); | 9695 | tg3_full_lock(tp, 0); |
9687 | 9696 | ||
9688 | err = tg3_init_hw(tp, 1); | 9697 | err = tg3_init_hw(tp, 1); |
@@ -9783,7 +9792,7 @@ static int tg3_close(struct net_device *dev) | |||
9783 | struct tg3 *tp = netdev_priv(dev); | 9792 | struct tg3 *tp = netdev_priv(dev); |
9784 | 9793 | ||
9785 | tg3_napi_disable(tp); | 9794 | tg3_napi_disable(tp); |
9786 | cancel_work_sync(&tp->reset_task); | 9795 | tg3_reset_task_cancel(tp); |
9787 | 9796 | ||
9788 | netif_tx_stop_all_queues(dev); | 9797 | netif_tx_stop_all_queues(dev); |
9789 | 9798 | ||
@@ -11520,7 +11529,7 @@ static int tg3_run_loopback(struct tg3 *tp, u32 pktsz, bool tso_loopback) | |||
11520 | break; | 11529 | break; |
11521 | } | 11530 | } |
11522 | 11531 | ||
11523 | tg3_tx_skb_unmap(tnapi, tnapi->tx_prod - 1, 0); | 11532 | tg3_tx_skb_unmap(tnapi, tnapi->tx_prod - 1, -1); |
11524 | dev_kfree_skb(skb); | 11533 | dev_kfree_skb(skb); |
11525 | 11534 | ||
11526 | if (tx_idx != tnapi->tx_prod) | 11535 | if (tx_idx != tnapi->tx_prod) |
@@ -14228,12 +14237,30 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
14228 | val = tr32(MEMARB_MODE); | 14237 | val = tr32(MEMARB_MODE); |
14229 | tw32(MEMARB_MODE, val | MEMARB_MODE_ENABLE); | 14238 | tw32(MEMARB_MODE, val | MEMARB_MODE_ENABLE); |
14230 | 14239 | ||
14231 | if (tg3_flag(tp, PCIX_MODE)) { | 14240 | tp->pci_fn = PCI_FUNC(tp->pdev->devfn) & 3; |
14232 | pci_read_config_dword(tp->pdev, | 14241 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704 || |
14233 | tp->pcix_cap + PCI_X_STATUS, &val); | 14242 | tg3_flag(tp, 5780_CLASS)) { |
14234 | tp->pci_fn = val & 0x7; | 14243 | if (tg3_flag(tp, PCIX_MODE)) { |
14235 | } else { | 14244 | pci_read_config_dword(tp->pdev, |
14236 | tp->pci_fn = PCI_FUNC(tp->pdev->devfn) & 3; | 14245 | tp->pcix_cap + PCI_X_STATUS, |
14246 | &val); | ||
14247 | tp->pci_fn = val & 0x7; | ||
14248 | } | ||
14249 | } else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717) { | ||
14250 | tg3_read_mem(tp, NIC_SRAM_CPMU_STATUS, &val); | ||
14251 | if ((val & NIC_SRAM_CPMUSTAT_SIG_MSK) == | ||
14252 | NIC_SRAM_CPMUSTAT_SIG) { | ||
14253 | tp->pci_fn = val & TG3_CPMU_STATUS_FMSK_5717; | ||
14254 | tp->pci_fn = tp->pci_fn ? 1 : 0; | ||
14255 | } | ||
14256 | } else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719 || | ||
14257 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720) { | ||
14258 | tg3_read_mem(tp, NIC_SRAM_CPMU_STATUS, &val); | ||
14259 | if ((val & NIC_SRAM_CPMUSTAT_SIG_MSK) == | ||
14260 | NIC_SRAM_CPMUSTAT_SIG) { | ||
14261 | tp->pci_fn = (val & TG3_CPMU_STATUS_FMSK_5719) >> | ||
14262 | TG3_CPMU_STATUS_FSHFT_5719; | ||
14263 | } | ||
14237 | } | 14264 | } |
14238 | 14265 | ||
14239 | /* Get eeprom hw config before calling tg3_set_power_state(). | 14266 | /* Get eeprom hw config before calling tg3_set_power_state(). |
@@ -15665,7 +15692,7 @@ static void __devexit tg3_remove_one(struct pci_dev *pdev) | |||
15665 | if (tp->fw) | 15692 | if (tp->fw) |
15666 | release_firmware(tp->fw); | 15693 | release_firmware(tp->fw); |
15667 | 15694 | ||
15668 | cancel_work_sync(&tp->reset_task); | 15695 | tg3_reset_task_cancel(tp); |
15669 | 15696 | ||
15670 | if (tg3_flag(tp, USE_PHYLIB)) { | 15697 | if (tg3_flag(tp, USE_PHYLIB)) { |
15671 | tg3_phy_fini(tp); | 15698 | tg3_phy_fini(tp); |
@@ -15699,7 +15726,7 @@ static int tg3_suspend(struct device *device) | |||
15699 | if (!netif_running(dev)) | 15726 | if (!netif_running(dev)) |
15700 | return 0; | 15727 | return 0; |
15701 | 15728 | ||
15702 | flush_work_sync(&tp->reset_task); | 15729 | tg3_reset_task_cancel(tp); |
15703 | tg3_phy_stop(tp); | 15730 | tg3_phy_stop(tp); |
15704 | tg3_netif_stop(tp); | 15731 | tg3_netif_stop(tp); |
15705 | 15732 | ||
@@ -15812,12 +15839,10 @@ static pci_ers_result_t tg3_io_error_detected(struct pci_dev *pdev, | |||
15812 | tg3_netif_stop(tp); | 15839 | tg3_netif_stop(tp); |
15813 | 15840 | ||
15814 | del_timer_sync(&tp->timer); | 15841 | del_timer_sync(&tp->timer); |
15815 | tg3_flag_clear(tp, RESTART_TIMER); | ||
15816 | 15842 | ||
15817 | /* Want to make sure that the reset task doesn't run */ | 15843 | /* Want to make sure that the reset task doesn't run */ |
15818 | cancel_work_sync(&tp->reset_task); | 15844 | tg3_reset_task_cancel(tp); |
15819 | tg3_flag_clear(tp, TX_RECOVERY_PENDING); | 15845 | tg3_flag_clear(tp, TX_RECOVERY_PENDING); |
15820 | tg3_flag_clear(tp, RESTART_TIMER); | ||
15821 | 15846 | ||
15822 | netif_device_detach(netdev); | 15847 | netif_device_detach(netdev); |
15823 | 15848 | ||
diff --git a/drivers/net/ethernet/broadcom/tg3.h b/drivers/net/ethernet/broadcom/tg3.h index f32f288134c7..94b4bd049a33 100644 --- a/drivers/net/ethernet/broadcom/tg3.h +++ b/drivers/net/ethernet/broadcom/tg3.h | |||
@@ -1095,6 +1095,11 @@ | |||
1095 | #define TG3_CPMU_CLCK_ORIDE 0x00003624 | 1095 | #define TG3_CPMU_CLCK_ORIDE 0x00003624 |
1096 | #define CPMU_CLCK_ORIDE_MAC_ORIDE_EN 0x80000000 | 1096 | #define CPMU_CLCK_ORIDE_MAC_ORIDE_EN 0x80000000 |
1097 | 1097 | ||
1098 | #define TG3_CPMU_STATUS 0x0000362c | ||
1099 | #define TG3_CPMU_STATUS_FMSK_5717 0x20000000 | ||
1100 | #define TG3_CPMU_STATUS_FMSK_5719 0xc0000000 | ||
1101 | #define TG3_CPMU_STATUS_FSHFT_5719 30 | ||
1102 | |||
1098 | #define TG3_CPMU_CLCK_STAT 0x00003630 | 1103 | #define TG3_CPMU_CLCK_STAT 0x00003630 |
1099 | #define CPMU_CLCK_STAT_MAC_CLCK_MASK 0x001f0000 | 1104 | #define CPMU_CLCK_STAT_MAC_CLCK_MASK 0x001f0000 |
1100 | #define CPMU_CLCK_STAT_MAC_CLCK_62_5 0x00000000 | 1105 | #define CPMU_CLCK_STAT_MAC_CLCK_62_5 0x00000000 |
@@ -2128,6 +2133,10 @@ | |||
2128 | #define NIC_SRAM_RGMII_EXT_IBND_RX_EN 0x00000008 | 2133 | #define NIC_SRAM_RGMII_EXT_IBND_RX_EN 0x00000008 |
2129 | #define NIC_SRAM_RGMII_EXT_IBND_TX_EN 0x00000010 | 2134 | #define NIC_SRAM_RGMII_EXT_IBND_TX_EN 0x00000010 |
2130 | 2135 | ||
2136 | #define NIC_SRAM_CPMU_STATUS 0x00000e00 | ||
2137 | #define NIC_SRAM_CPMUSTAT_SIG 0x0000362c | ||
2138 | #define NIC_SRAM_CPMUSTAT_SIG_MSK 0x0000ffff | ||
2139 | |||
2131 | #define NIC_SRAM_RX_MINI_BUFFER_DESC 0x00001000 | 2140 | #define NIC_SRAM_RX_MINI_BUFFER_DESC 0x00001000 |
2132 | 2141 | ||
2133 | #define NIC_SRAM_DMA_DESC_POOL_BASE 0x00002000 | 2142 | #define NIC_SRAM_DMA_DESC_POOL_BASE 0x00002000 |
@@ -2344,9 +2353,13 @@ | |||
2344 | #define APE_PER_LOCK_GRANT_DRIVER 0x00001000 | 2353 | #define APE_PER_LOCK_GRANT_DRIVER 0x00001000 |
2345 | 2354 | ||
2346 | /* APE convenience enumerations. */ | 2355 | /* APE convenience enumerations. */ |
2347 | #define TG3_APE_LOCK_GRC 1 | 2356 | #define TG3_APE_LOCK_PHY0 0 |
2348 | #define TG3_APE_LOCK_MEM 4 | 2357 | #define TG3_APE_LOCK_GRC 1 |
2349 | #define TG3_APE_LOCK_GPIO 7 | 2358 | #define TG3_APE_LOCK_PHY1 2 |
2359 | #define TG3_APE_LOCK_PHY2 3 | ||
2360 | #define TG3_APE_LOCK_MEM 4 | ||
2361 | #define TG3_APE_LOCK_PHY3 5 | ||
2362 | #define TG3_APE_LOCK_GPIO 7 | ||
2350 | 2363 | ||
2351 | #define TG3_EEPROM_SB_F1R2_MBA_OFF 0x10 | 2364 | #define TG3_EEPROM_SB_F1R2_MBA_OFF 0x10 |
2352 | 2365 | ||
@@ -2866,7 +2879,6 @@ enum TG3_FLAGS { | |||
2866 | TG3_FLAG_JUMBO_CAPABLE, | 2879 | TG3_FLAG_JUMBO_CAPABLE, |
2867 | TG3_FLAG_CHIP_RESETTING, | 2880 | TG3_FLAG_CHIP_RESETTING, |
2868 | TG3_FLAG_INIT_COMPLETE, | 2881 | TG3_FLAG_INIT_COMPLETE, |
2869 | TG3_FLAG_RESTART_TIMER, | ||
2870 | TG3_FLAG_TSO_BUG, | 2882 | TG3_FLAG_TSO_BUG, |
2871 | TG3_FLAG_IS_5788, | 2883 | TG3_FLAG_IS_5788, |
2872 | TG3_FLAG_MAX_RXPEND_64, | 2884 | TG3_FLAG_MAX_RXPEND_64, |
@@ -2909,6 +2921,7 @@ enum TG3_FLAGS { | |||
2909 | TG3_FLAG_APE_HAS_NCSI, | 2921 | TG3_FLAG_APE_HAS_NCSI, |
2910 | TG3_FLAG_5717_PLUS, | 2922 | TG3_FLAG_5717_PLUS, |
2911 | TG3_FLAG_4K_FIFO_LIMIT, | 2923 | TG3_FLAG_4K_FIFO_LIMIT, |
2924 | TG3_FLAG_RESET_TASK_PENDING, | ||
2912 | 2925 | ||
2913 | /* Add new flags before this comment and TG3_FLAG_NUMBER_OF_FLAGS */ | 2926 | /* Add new flags before this comment and TG3_FLAG_NUMBER_OF_FLAGS */ |
2914 | TG3_FLAG_NUMBER_OF_FLAGS, /* Last entry in enum TG3_FLAGS */ | 2927 | TG3_FLAG_NUMBER_OF_FLAGS, /* Last entry in enum TG3_FLAGS */ |
diff --git a/drivers/net/ethernet/cadence/Kconfig b/drivers/net/ethernet/cadence/Kconfig index 98849a1fc749..a2e150059bc7 100644 --- a/drivers/net/ethernet/cadence/Kconfig +++ b/drivers/net/ethernet/cadence/Kconfig | |||
@@ -5,8 +5,8 @@ | |||
5 | config HAVE_NET_MACB | 5 | config HAVE_NET_MACB |
6 | bool | 6 | bool |
7 | 7 | ||
8 | config NET_ATMEL | 8 | config NET_CADENCE |
9 | bool "Atmel devices" | 9 | bool "Cadence devices" |
10 | depends on HAVE_NET_MACB || (ARM && ARCH_AT91RM9200) | 10 | depends on HAVE_NET_MACB || (ARM && ARCH_AT91RM9200) |
11 | ---help--- | 11 | ---help--- |
12 | If you have a network (Ethernet) card belonging to this class, say Y. | 12 | If you have a network (Ethernet) card belonging to this class, say Y. |
@@ -20,7 +20,7 @@ config NET_ATMEL | |||
20 | the remaining Atmel network card questions. If you say Y, you will be | 20 | the remaining Atmel network card questions. If you say Y, you will be |
21 | asked for your specific card in the following questions. | 21 | asked for your specific card in the following questions. |
22 | 22 | ||
23 | if NET_ATMEL | 23 | if NET_CADENCE |
24 | 24 | ||
25 | config ARM_AT91_ETHER | 25 | config ARM_AT91_ETHER |
26 | tristate "AT91RM9200 Ethernet support" | 26 | tristate "AT91RM9200 Ethernet support" |
@@ -32,14 +32,16 @@ config ARM_AT91_ETHER | |||
32 | ethernet support, then you should always answer Y to this. | 32 | ethernet support, then you should always answer Y to this. |
33 | 33 | ||
34 | config MACB | 34 | config MACB |
35 | tristate "Atmel MACB support" | 35 | tristate "Cadence MACB/GEM support" |
36 | depends on HAVE_NET_MACB | 36 | depends on HAVE_NET_MACB |
37 | select PHYLIB | 37 | select PHYLIB |
38 | ---help--- | 38 | ---help--- |
39 | The Atmel MACB ethernet interface is found on many AT32 and AT91 | 39 | The Cadence MACB ethernet interface is found on many Atmel AT32 and |
40 | parts. Say Y to include support for the MACB chip. | 40 | AT91 parts. This driver also supports the Cadence GEM (Gigabit |
41 | Ethernet MAC found in some ARM SoC devices). Note: the Gigabit mode | ||
42 | is not yet supported. Say Y to include support for the MACB/GEM chip. | ||
41 | 43 | ||
42 | To compile this driver as a module, choose M here: the module | 44 | To compile this driver as a module, choose M here: the module |
43 | will be called macb. | 45 | will be called macb. |
44 | 46 | ||
45 | endif # NET_ATMEL | 47 | endif # NET_CADENCE |
diff --git a/drivers/net/ethernet/cadence/at91_ether.c b/drivers/net/ethernet/cadence/at91_ether.c index 56624d303487..dfeb46cb3f74 100644 --- a/drivers/net/ethernet/cadence/at91_ether.c +++ b/drivers/net/ethernet/cadence/at91_ether.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/skbuff.h> | 26 | #include <linux/skbuff.h> |
27 | #include <linux/dma-mapping.h> | 27 | #include <linux/dma-mapping.h> |
28 | #include <linux/ethtool.h> | 28 | #include <linux/ethtool.h> |
29 | #include <linux/platform_data/macb.h> | ||
29 | #include <linux/platform_device.h> | 30 | #include <linux/platform_device.h> |
30 | #include <linux/clk.h> | 31 | #include <linux/clk.h> |
31 | #include <linux/gfp.h> | 32 | #include <linux/gfp.h> |
@@ -984,7 +985,7 @@ static const struct net_device_ops at91ether_netdev_ops = { | |||
984 | static int __init at91ether_setup(unsigned long phy_type, unsigned short phy_address, | 985 | static int __init at91ether_setup(unsigned long phy_type, unsigned short phy_address, |
985 | struct platform_device *pdev, struct clk *ether_clk) | 986 | struct platform_device *pdev, struct clk *ether_clk) |
986 | { | 987 | { |
987 | struct at91_eth_data *board_data = pdev->dev.platform_data; | 988 | struct macb_platform_data *board_data = pdev->dev.platform_data; |
988 | struct net_device *dev; | 989 | struct net_device *dev; |
989 | struct at91_private *lp; | 990 | struct at91_private *lp; |
990 | unsigned int val; | 991 | unsigned int val; |
diff --git a/drivers/net/ethernet/cadence/at91_ether.h b/drivers/net/ethernet/cadence/at91_ether.h index 353f4dab62be..3725fbb0defe 100644 --- a/drivers/net/ethernet/cadence/at91_ether.h +++ b/drivers/net/ethernet/cadence/at91_ether.h | |||
@@ -85,7 +85,9 @@ struct recv_desc_bufs | |||
85 | struct at91_private | 85 | struct at91_private |
86 | { | 86 | { |
87 | struct mii_if_info mii; /* ethtool support */ | 87 | struct mii_if_info mii; /* ethtool support */ |
88 | struct at91_eth_data board_data; /* board-specific configuration */ | 88 | struct macb_platform_data board_data; /* board-specific |
89 | * configuration (shared with | ||
90 | * macb for common data */ | ||
89 | struct clk *ether_clk; /* clock */ | 91 | struct clk *ether_clk; /* clock */ |
90 | 92 | ||
91 | /* PHY */ | 93 | /* PHY */ |
diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index a437b46e5490..64d61461bdc7 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Atmel MACB Ethernet Controller driver | 2 | * Cadence MACB/GEM Ethernet Controller driver |
3 | * | 3 | * |
4 | * Copyright (C) 2004-2006 Atmel Corporation | 4 | * Copyright (C) 2004-2006 Atmel Corporation |
5 | * | 5 | * |
@@ -8,6 +8,7 @@ | |||
8 | * published by the Free Software Foundation. | 8 | * published by the Free Software Foundation. |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
11 | #include <linux/clk.h> | 12 | #include <linux/clk.h> |
12 | #include <linux/module.h> | 13 | #include <linux/module.h> |
13 | #include <linux/moduleparam.h> | 14 | #include <linux/moduleparam.h> |
@@ -19,12 +20,10 @@ | |||
19 | #include <linux/netdevice.h> | 20 | #include <linux/netdevice.h> |
20 | #include <linux/etherdevice.h> | 21 | #include <linux/etherdevice.h> |
21 | #include <linux/dma-mapping.h> | 22 | #include <linux/dma-mapping.h> |
23 | #include <linux/platform_data/macb.h> | ||
22 | #include <linux/platform_device.h> | 24 | #include <linux/platform_device.h> |
23 | #include <linux/phy.h> | 25 | #include <linux/phy.h> |
24 | 26 | ||
25 | #include <mach/board.h> | ||
26 | #include <mach/cpu.h> | ||
27 | |||
28 | #include "macb.h" | 27 | #include "macb.h" |
29 | 28 | ||
30 | #define RX_BUFFER_SIZE 128 | 29 | #define RX_BUFFER_SIZE 128 |
@@ -60,9 +59,9 @@ static void __macb_set_hwaddr(struct macb *bp) | |||
60 | u16 top; | 59 | u16 top; |
61 | 60 | ||
62 | bottom = cpu_to_le32(*((u32 *)bp->dev->dev_addr)); | 61 | bottom = cpu_to_le32(*((u32 *)bp->dev->dev_addr)); |
63 | macb_writel(bp, SA1B, bottom); | 62 | macb_or_gem_writel(bp, SA1B, bottom); |
64 | top = cpu_to_le16(*((u16 *)(bp->dev->dev_addr + 4))); | 63 | top = cpu_to_le16(*((u16 *)(bp->dev->dev_addr + 4))); |
65 | macb_writel(bp, SA1T, top); | 64 | macb_or_gem_writel(bp, SA1T, top); |
66 | } | 65 | } |
67 | 66 | ||
68 | static void __init macb_get_hwaddr(struct macb *bp) | 67 | static void __init macb_get_hwaddr(struct macb *bp) |
@@ -71,8 +70,8 @@ static void __init macb_get_hwaddr(struct macb *bp) | |||
71 | u16 top; | 70 | u16 top; |
72 | u8 addr[6]; | 71 | u8 addr[6]; |
73 | 72 | ||
74 | bottom = macb_readl(bp, SA1B); | 73 | bottom = macb_or_gem_readl(bp, SA1B); |
75 | top = macb_readl(bp, SA1T); | 74 | top = macb_or_gem_readl(bp, SA1T); |
76 | 75 | ||
77 | addr[0] = bottom & 0xff; | 76 | addr[0] = bottom & 0xff; |
78 | addr[1] = (bottom >> 8) & 0xff; | 77 | addr[1] = (bottom >> 8) & 0xff; |
@@ -84,7 +83,7 @@ static void __init macb_get_hwaddr(struct macb *bp) | |||
84 | if (is_valid_ether_addr(addr)) { | 83 | if (is_valid_ether_addr(addr)) { |
85 | memcpy(bp->dev->dev_addr, addr, sizeof(addr)); | 84 | memcpy(bp->dev->dev_addr, addr, sizeof(addr)); |
86 | } else { | 85 | } else { |
87 | dev_info(&bp->pdev->dev, "invalid hw address, using random\n"); | 86 | netdev_info(bp->dev, "invalid hw address, using random\n"); |
88 | random_ether_addr(bp->dev->dev_addr); | 87 | random_ether_addr(bp->dev->dev_addr); |
89 | } | 88 | } |
90 | } | 89 | } |
@@ -178,11 +177,12 @@ static void macb_handle_link_change(struct net_device *dev) | |||
178 | 177 | ||
179 | if (status_change) { | 178 | if (status_change) { |
180 | if (phydev->link) | 179 | if (phydev->link) |
181 | printk(KERN_INFO "%s: link up (%d/%s)\n", | 180 | netdev_info(dev, "link up (%d/%s)\n", |
182 | dev->name, phydev->speed, | 181 | phydev->speed, |
183 | DUPLEX_FULL == phydev->duplex ? "Full":"Half"); | 182 | phydev->duplex == DUPLEX_FULL ? |
183 | "Full" : "Half"); | ||
184 | else | 184 | else |
185 | printk(KERN_INFO "%s: link down\n", dev->name); | 185 | netdev_info(dev, "link down\n"); |
186 | } | 186 | } |
187 | } | 187 | } |
188 | 188 | ||
@@ -191,12 +191,12 @@ static int macb_mii_probe(struct net_device *dev) | |||
191 | { | 191 | { |
192 | struct macb *bp = netdev_priv(dev); | 192 | struct macb *bp = netdev_priv(dev); |
193 | struct phy_device *phydev; | 193 | struct phy_device *phydev; |
194 | struct eth_platform_data *pdata; | 194 | struct macb_platform_data *pdata; |
195 | int ret; | 195 | int ret; |
196 | 196 | ||
197 | phydev = phy_find_first(bp->mii_bus); | 197 | phydev = phy_find_first(bp->mii_bus); |
198 | if (!phydev) { | 198 | if (!phydev) { |
199 | printk (KERN_ERR "%s: no PHY found\n", dev->name); | 199 | netdev_err(dev, "no PHY found\n"); |
200 | return -1; | 200 | return -1; |
201 | } | 201 | } |
202 | 202 | ||
@@ -209,7 +209,7 @@ static int macb_mii_probe(struct net_device *dev) | |||
209 | PHY_INTERFACE_MODE_RMII : | 209 | PHY_INTERFACE_MODE_RMII : |
210 | PHY_INTERFACE_MODE_MII); | 210 | PHY_INTERFACE_MODE_MII); |
211 | if (ret) { | 211 | if (ret) { |
212 | printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name); | 212 | netdev_err(dev, "Could not attach to PHY\n"); |
213 | return ret; | 213 | return ret; |
214 | } | 214 | } |
215 | 215 | ||
@@ -228,7 +228,7 @@ static int macb_mii_probe(struct net_device *dev) | |||
228 | 228 | ||
229 | static int macb_mii_init(struct macb *bp) | 229 | static int macb_mii_init(struct macb *bp) |
230 | { | 230 | { |
231 | struct eth_platform_data *pdata; | 231 | struct macb_platform_data *pdata; |
232 | int err = -ENXIO, i; | 232 | int err = -ENXIO, i; |
233 | 233 | ||
234 | /* Enable management port */ | 234 | /* Enable management port */ |
@@ -285,8 +285,8 @@ err_out: | |||
285 | static void macb_update_stats(struct macb *bp) | 285 | static void macb_update_stats(struct macb *bp) |
286 | { | 286 | { |
287 | u32 __iomem *reg = bp->regs + MACB_PFR; | 287 | u32 __iomem *reg = bp->regs + MACB_PFR; |
288 | u32 *p = &bp->hw_stats.rx_pause_frames; | 288 | u32 *p = &bp->hw_stats.macb.rx_pause_frames; |
289 | u32 *end = &bp->hw_stats.tx_pause_frames + 1; | 289 | u32 *end = &bp->hw_stats.macb.tx_pause_frames + 1; |
290 | 290 | ||
291 | WARN_ON((unsigned long)(end - p - 1) != (MACB_TPF - MACB_PFR) / 4); | 291 | WARN_ON((unsigned long)(end - p - 1) != (MACB_TPF - MACB_PFR) / 4); |
292 | 292 | ||
@@ -303,14 +303,13 @@ static void macb_tx(struct macb *bp) | |||
303 | status = macb_readl(bp, TSR); | 303 | status = macb_readl(bp, TSR); |
304 | macb_writel(bp, TSR, status); | 304 | macb_writel(bp, TSR, status); |
305 | 305 | ||
306 | dev_dbg(&bp->pdev->dev, "macb_tx status = %02lx\n", | 306 | netdev_dbg(bp->dev, "macb_tx status = %02lx\n", (unsigned long)status); |
307 | (unsigned long)status); | ||
308 | 307 | ||
309 | if (status & (MACB_BIT(UND) | MACB_BIT(TSR_RLE))) { | 308 | if (status & (MACB_BIT(UND) | MACB_BIT(TSR_RLE))) { |
310 | int i; | 309 | int i; |
311 | printk(KERN_ERR "%s: TX %s, resetting buffers\n", | 310 | netdev_err(bp->dev, "TX %s, resetting buffers\n", |
312 | bp->dev->name, status & MACB_BIT(UND) ? | 311 | status & MACB_BIT(UND) ? |
313 | "underrun" : "retry limit exceeded"); | 312 | "underrun" : "retry limit exceeded"); |
314 | 313 | ||
315 | /* Transfer ongoing, disable transmitter, to avoid confusion */ | 314 | /* Transfer ongoing, disable transmitter, to avoid confusion */ |
316 | if (status & MACB_BIT(TGO)) | 315 | if (status & MACB_BIT(TGO)) |
@@ -369,8 +368,8 @@ static void macb_tx(struct macb *bp) | |||
369 | if (!(bufstat & MACB_BIT(TX_USED))) | 368 | if (!(bufstat & MACB_BIT(TX_USED))) |
370 | break; | 369 | break; |
371 | 370 | ||
372 | dev_dbg(&bp->pdev->dev, "skb %u (data %p) TX complete\n", | 371 | netdev_dbg(bp->dev, "skb %u (data %p) TX complete\n", |
373 | tail, skb->data); | 372 | tail, skb->data); |
374 | dma_unmap_single(&bp->pdev->dev, rp->mapping, skb->len, | 373 | dma_unmap_single(&bp->pdev->dev, rp->mapping, skb->len, |
375 | DMA_TO_DEVICE); | 374 | DMA_TO_DEVICE); |
376 | bp->stats.tx_packets++; | 375 | bp->stats.tx_packets++; |
@@ -395,8 +394,8 @@ static int macb_rx_frame(struct macb *bp, unsigned int first_frag, | |||
395 | 394 | ||
396 | len = MACB_BFEXT(RX_FRMLEN, bp->rx_ring[last_frag].ctrl); | 395 | len = MACB_BFEXT(RX_FRMLEN, bp->rx_ring[last_frag].ctrl); |
397 | 396 | ||
398 | dev_dbg(&bp->pdev->dev, "macb_rx_frame frags %u - %u (len %u)\n", | 397 | netdev_dbg(bp->dev, "macb_rx_frame frags %u - %u (len %u)\n", |
399 | first_frag, last_frag, len); | 398 | first_frag, last_frag, len); |
400 | 399 | ||
401 | skb = dev_alloc_skb(len + RX_OFFSET); | 400 | skb = dev_alloc_skb(len + RX_OFFSET); |
402 | if (!skb) { | 401 | if (!skb) { |
@@ -437,8 +436,8 @@ static int macb_rx_frame(struct macb *bp, unsigned int first_frag, | |||
437 | 436 | ||
438 | bp->stats.rx_packets++; | 437 | bp->stats.rx_packets++; |
439 | bp->stats.rx_bytes += len; | 438 | bp->stats.rx_bytes += len; |
440 | dev_dbg(&bp->pdev->dev, "received skb of length %u, csum: %08x\n", | 439 | netdev_dbg(bp->dev, "received skb of length %u, csum: %08x\n", |
441 | skb->len, skb->csum); | 440 | skb->len, skb->csum); |
442 | netif_receive_skb(skb); | 441 | netif_receive_skb(skb); |
443 | 442 | ||
444 | return 0; | 443 | return 0; |
@@ -515,8 +514,8 @@ static int macb_poll(struct napi_struct *napi, int budget) | |||
515 | 514 | ||
516 | work_done = 0; | 515 | work_done = 0; |
517 | 516 | ||
518 | dev_dbg(&bp->pdev->dev, "poll: status = %08lx, budget = %d\n", | 517 | netdev_dbg(bp->dev, "poll: status = %08lx, budget = %d\n", |
519 | (unsigned long)status, budget); | 518 | (unsigned long)status, budget); |
520 | 519 | ||
521 | work_done = macb_rx(bp, budget); | 520 | work_done = macb_rx(bp, budget); |
522 | if (work_done < budget) { | 521 | if (work_done < budget) { |
@@ -565,8 +564,7 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id) | |||
565 | macb_writel(bp, IDR, MACB_RX_INT_FLAGS); | 564 | macb_writel(bp, IDR, MACB_RX_INT_FLAGS); |
566 | 565 | ||
567 | if (napi_schedule_prep(&bp->napi)) { | 566 | if (napi_schedule_prep(&bp->napi)) { |
568 | dev_dbg(&bp->pdev->dev, | 567 | netdev_dbg(bp->dev, "scheduling RX softirq\n"); |
569 | "scheduling RX softirq\n"); | ||
570 | __napi_schedule(&bp->napi); | 568 | __napi_schedule(&bp->napi); |
571 | } | 569 | } |
572 | } | 570 | } |
@@ -582,16 +580,19 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id) | |||
582 | 580 | ||
583 | if (status & MACB_BIT(ISR_ROVR)) { | 581 | if (status & MACB_BIT(ISR_ROVR)) { |
584 | /* We missed at least one packet */ | 582 | /* We missed at least one packet */ |
585 | bp->hw_stats.rx_overruns++; | 583 | if (macb_is_gem(bp)) |
584 | bp->hw_stats.gem.rx_overruns++; | ||
585 | else | ||
586 | bp->hw_stats.macb.rx_overruns++; | ||
586 | } | 587 | } |
587 | 588 | ||
588 | if (status & MACB_BIT(HRESP)) { | 589 | if (status & MACB_BIT(HRESP)) { |
589 | /* | 590 | /* |
590 | * TODO: Reset the hardware, and maybe move the printk | 591 | * TODO: Reset the hardware, and maybe move the |
591 | * to a lower-priority context as well (work queue?) | 592 | * netdev_err to a lower-priority context as well |
593 | * (work queue?) | ||
592 | */ | 594 | */ |
593 | printk(KERN_ERR "%s: DMA bus error: HRESP not OK\n", | 595 | netdev_err(dev, "DMA bus error: HRESP not OK\n"); |
594 | dev->name); | ||
595 | } | 596 | } |
596 | 597 | ||
597 | status = macb_readl(bp, ISR); | 598 | status = macb_readl(bp, ISR); |
@@ -626,16 +627,12 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
626 | unsigned long flags; | 627 | unsigned long flags; |
627 | 628 | ||
628 | #ifdef DEBUG | 629 | #ifdef DEBUG |
629 | int i; | 630 | netdev_dbg(bp->dev, |
630 | dev_dbg(&bp->pdev->dev, | 631 | "start_xmit: len %u head %p data %p tail %p end %p\n", |
631 | "start_xmit: len %u head %p data %p tail %p end %p\n", | 632 | skb->len, skb->head, skb->data, |
632 | skb->len, skb->head, skb->data, | 633 | skb_tail_pointer(skb), skb_end_pointer(skb)); |
633 | skb_tail_pointer(skb), skb_end_pointer(skb)); | 634 | print_hex_dump(KERN_DEBUG, "data: ", DUMP_PREFIX_OFFSET, 16, 1, |
634 | dev_dbg(&bp->pdev->dev, | 635 | skb->data, 16, true); |
635 | "data:"); | ||
636 | for (i = 0; i < 16; i++) | ||
637 | printk(" %02x", (unsigned int)skb->data[i]); | ||
638 | printk("\n"); | ||
639 | #endif | 636 | #endif |
640 | 637 | ||
641 | len = skb->len; | 638 | len = skb->len; |
@@ -645,21 +642,20 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
645 | if (TX_BUFFS_AVAIL(bp) < 1) { | 642 | if (TX_BUFFS_AVAIL(bp) < 1) { |
646 | netif_stop_queue(dev); | 643 | netif_stop_queue(dev); |
647 | spin_unlock_irqrestore(&bp->lock, flags); | 644 | spin_unlock_irqrestore(&bp->lock, flags); |
648 | dev_err(&bp->pdev->dev, | 645 | netdev_err(bp->dev, "BUG! Tx Ring full when queue awake!\n"); |
649 | "BUG! Tx Ring full when queue awake!\n"); | 646 | netdev_dbg(bp->dev, "tx_head = %u, tx_tail = %u\n", |
650 | dev_dbg(&bp->pdev->dev, "tx_head = %u, tx_tail = %u\n", | 647 | bp->tx_head, bp->tx_tail); |
651 | bp->tx_head, bp->tx_tail); | ||
652 | return NETDEV_TX_BUSY; | 648 | return NETDEV_TX_BUSY; |
653 | } | 649 | } |
654 | 650 | ||
655 | entry = bp->tx_head; | 651 | entry = bp->tx_head; |
656 | dev_dbg(&bp->pdev->dev, "Allocated ring entry %u\n", entry); | 652 | netdev_dbg(bp->dev, "Allocated ring entry %u\n", entry); |
657 | mapping = dma_map_single(&bp->pdev->dev, skb->data, | 653 | mapping = dma_map_single(&bp->pdev->dev, skb->data, |
658 | len, DMA_TO_DEVICE); | 654 | len, DMA_TO_DEVICE); |
659 | bp->tx_skb[entry].skb = skb; | 655 | bp->tx_skb[entry].skb = skb; |
660 | bp->tx_skb[entry].mapping = mapping; | 656 | bp->tx_skb[entry].mapping = mapping; |
661 | dev_dbg(&bp->pdev->dev, "Mapped skb data %p to DMA addr %08lx\n", | 657 | netdev_dbg(bp->dev, "Mapped skb data %p to DMA addr %08lx\n", |
662 | skb->data, (unsigned long)mapping); | 658 | skb->data, (unsigned long)mapping); |
663 | 659 | ||
664 | ctrl = MACB_BF(TX_FRMLEN, len); | 660 | ctrl = MACB_BF(TX_FRMLEN, len); |
665 | ctrl |= MACB_BIT(TX_LAST); | 661 | ctrl |= MACB_BIT(TX_LAST); |
@@ -723,27 +719,27 @@ static int macb_alloc_consistent(struct macb *bp) | |||
723 | &bp->rx_ring_dma, GFP_KERNEL); | 719 | &bp->rx_ring_dma, GFP_KERNEL); |
724 | if (!bp->rx_ring) | 720 | if (!bp->rx_ring) |
725 | goto out_err; | 721 | goto out_err; |
726 | dev_dbg(&bp->pdev->dev, | 722 | netdev_dbg(bp->dev, |
727 | "Allocated RX ring of %d bytes at %08lx (mapped %p)\n", | 723 | "Allocated RX ring of %d bytes at %08lx (mapped %p)\n", |
728 | size, (unsigned long)bp->rx_ring_dma, bp->rx_ring); | 724 | size, (unsigned long)bp->rx_ring_dma, bp->rx_ring); |
729 | 725 | ||
730 | size = TX_RING_BYTES; | 726 | size = TX_RING_BYTES; |
731 | bp->tx_ring = dma_alloc_coherent(&bp->pdev->dev, size, | 727 | bp->tx_ring = dma_alloc_coherent(&bp->pdev->dev, size, |
732 | &bp->tx_ring_dma, GFP_KERNEL); | 728 | &bp->tx_ring_dma, GFP_KERNEL); |
733 | if (!bp->tx_ring) | 729 | if (!bp->tx_ring) |
734 | goto out_err; | 730 | goto out_err; |
735 | dev_dbg(&bp->pdev->dev, | 731 | netdev_dbg(bp->dev, |
736 | "Allocated TX ring of %d bytes at %08lx (mapped %p)\n", | 732 | "Allocated TX ring of %d bytes at %08lx (mapped %p)\n", |
737 | size, (unsigned long)bp->tx_ring_dma, bp->tx_ring); | 733 | size, (unsigned long)bp->tx_ring_dma, bp->tx_ring); |
738 | 734 | ||
739 | size = RX_RING_SIZE * RX_BUFFER_SIZE; | 735 | size = RX_RING_SIZE * RX_BUFFER_SIZE; |
740 | bp->rx_buffers = dma_alloc_coherent(&bp->pdev->dev, size, | 736 | bp->rx_buffers = dma_alloc_coherent(&bp->pdev->dev, size, |
741 | &bp->rx_buffers_dma, GFP_KERNEL); | 737 | &bp->rx_buffers_dma, GFP_KERNEL); |
742 | if (!bp->rx_buffers) | 738 | if (!bp->rx_buffers) |
743 | goto out_err; | 739 | goto out_err; |
744 | dev_dbg(&bp->pdev->dev, | 740 | netdev_dbg(bp->dev, |
745 | "Allocated RX buffers of %d bytes at %08lx (mapped %p)\n", | 741 | "Allocated RX buffers of %d bytes at %08lx (mapped %p)\n", |
746 | size, (unsigned long)bp->rx_buffers_dma, bp->rx_buffers); | 742 | size, (unsigned long)bp->rx_buffers_dma, bp->rx_buffers); |
747 | 743 | ||
748 | return 0; | 744 | return 0; |
749 | 745 | ||
@@ -797,6 +793,84 @@ static void macb_reset_hw(struct macb *bp) | |||
797 | macb_readl(bp, ISR); | 793 | macb_readl(bp, ISR); |
798 | } | 794 | } |
799 | 795 | ||
796 | static u32 gem_mdc_clk_div(struct macb *bp) | ||
797 | { | ||
798 | u32 config; | ||
799 | unsigned long pclk_hz = clk_get_rate(bp->pclk); | ||
800 | |||
801 | if (pclk_hz <= 20000000) | ||
802 | config = GEM_BF(CLK, GEM_CLK_DIV8); | ||
803 | else if (pclk_hz <= 40000000) | ||
804 | config = GEM_BF(CLK, GEM_CLK_DIV16); | ||
805 | else if (pclk_hz <= 80000000) | ||
806 | config = GEM_BF(CLK, GEM_CLK_DIV32); | ||
807 | else if (pclk_hz <= 120000000) | ||
808 | config = GEM_BF(CLK, GEM_CLK_DIV48); | ||
809 | else if (pclk_hz <= 160000000) | ||
810 | config = GEM_BF(CLK, GEM_CLK_DIV64); | ||
811 | else | ||
812 | config = GEM_BF(CLK, GEM_CLK_DIV96); | ||
813 | |||
814 | return config; | ||
815 | } | ||
816 | |||
817 | static u32 macb_mdc_clk_div(struct macb *bp) | ||
818 | { | ||
819 | u32 config; | ||
820 | unsigned long pclk_hz; | ||
821 | |||
822 | if (macb_is_gem(bp)) | ||
823 | return gem_mdc_clk_div(bp); | ||
824 | |||
825 | pclk_hz = clk_get_rate(bp->pclk); | ||
826 | if (pclk_hz <= 20000000) | ||
827 | config = MACB_BF(CLK, MACB_CLK_DIV8); | ||
828 | else if (pclk_hz <= 40000000) | ||
829 | config = MACB_BF(CLK, MACB_CLK_DIV16); | ||
830 | else if (pclk_hz <= 80000000) | ||
831 | config = MACB_BF(CLK, MACB_CLK_DIV32); | ||
832 | else | ||
833 | config = MACB_BF(CLK, MACB_CLK_DIV64); | ||
834 | |||
835 | return config; | ||
836 | } | ||
837 | |||
838 | /* | ||
839 | * Get the DMA bus width field of the network configuration register that we | ||
840 | * should program. We find the width from decoding the design configuration | ||
841 | * register to find the maximum supported data bus width. | ||
842 | */ | ||
843 | static u32 macb_dbw(struct macb *bp) | ||
844 | { | ||
845 | if (!macb_is_gem(bp)) | ||
846 | return 0; | ||
847 | |||
848 | switch (GEM_BFEXT(DBWDEF, gem_readl(bp, DCFG1))) { | ||
849 | case 4: | ||
850 | return GEM_BF(DBW, GEM_DBW128); | ||
851 | case 2: | ||
852 | return GEM_BF(DBW, GEM_DBW64); | ||
853 | case 1: | ||
854 | default: | ||
855 | return GEM_BF(DBW, GEM_DBW32); | ||
856 | } | ||
857 | } | ||
858 | |||
859 | /* | ||
860 | * Configure the receive DMA engine to use the correct receive buffer size. | ||
861 | * This is a configurable parameter for GEM. | ||
862 | */ | ||
863 | static void macb_configure_dma(struct macb *bp) | ||
864 | { | ||
865 | u32 dmacfg; | ||
866 | |||
867 | if (macb_is_gem(bp)) { | ||
868 | dmacfg = gem_readl(bp, DMACFG) & ~GEM_BF(RXBS, -1L); | ||
869 | dmacfg |= GEM_BF(RXBS, RX_BUFFER_SIZE / 64); | ||
870 | gem_writel(bp, DMACFG, dmacfg); | ||
871 | } | ||
872 | } | ||
873 | |||
800 | static void macb_init_hw(struct macb *bp) | 874 | static void macb_init_hw(struct macb *bp) |
801 | { | 875 | { |
802 | u32 config; | 876 | u32 config; |
@@ -804,7 +878,7 @@ static void macb_init_hw(struct macb *bp) | |||
804 | macb_reset_hw(bp); | 878 | macb_reset_hw(bp); |
805 | __macb_set_hwaddr(bp); | 879 | __macb_set_hwaddr(bp); |
806 | 880 | ||
807 | config = macb_readl(bp, NCFGR) & MACB_BF(CLK, -1L); | 881 | config = macb_mdc_clk_div(bp); |
808 | config |= MACB_BIT(PAE); /* PAuse Enable */ | 882 | config |= MACB_BIT(PAE); /* PAuse Enable */ |
809 | config |= MACB_BIT(DRFCS); /* Discard Rx FCS */ | 883 | config |= MACB_BIT(DRFCS); /* Discard Rx FCS */ |
810 | config |= MACB_BIT(BIG); /* Receive oversized frames */ | 884 | config |= MACB_BIT(BIG); /* Receive oversized frames */ |
@@ -812,8 +886,11 @@ static void macb_init_hw(struct macb *bp) | |||
812 | config |= MACB_BIT(CAF); /* Copy All Frames */ | 886 | config |= MACB_BIT(CAF); /* Copy All Frames */ |
813 | if (!(bp->dev->flags & IFF_BROADCAST)) | 887 | if (!(bp->dev->flags & IFF_BROADCAST)) |
814 | config |= MACB_BIT(NBC); /* No BroadCast */ | 888 | config |= MACB_BIT(NBC); /* No BroadCast */ |
889 | config |= macb_dbw(bp); | ||
815 | macb_writel(bp, NCFGR, config); | 890 | macb_writel(bp, NCFGR, config); |
816 | 891 | ||
892 | macb_configure_dma(bp); | ||
893 | |||
817 | /* Initialize TX and RX buffers */ | 894 | /* Initialize TX and RX buffers */ |
818 | macb_writel(bp, RBQP, bp->rx_ring_dma); | 895 | macb_writel(bp, RBQP, bp->rx_ring_dma); |
819 | macb_writel(bp, TBQP, bp->tx_ring_dma); | 896 | macb_writel(bp, TBQP, bp->tx_ring_dma); |
@@ -909,8 +986,8 @@ static void macb_sethashtable(struct net_device *dev) | |||
909 | mc_filter[bitnr >> 5] |= 1 << (bitnr & 31); | 986 | mc_filter[bitnr >> 5] |= 1 << (bitnr & 31); |
910 | } | 987 | } |
911 | 988 | ||
912 | macb_writel(bp, HRB, mc_filter[0]); | 989 | macb_or_gem_writel(bp, HRB, mc_filter[0]); |
913 | macb_writel(bp, HRT, mc_filter[1]); | 990 | macb_or_gem_writel(bp, HRT, mc_filter[1]); |
914 | } | 991 | } |
915 | 992 | ||
916 | /* | 993 | /* |
@@ -932,8 +1009,8 @@ static void macb_set_rx_mode(struct net_device *dev) | |||
932 | 1009 | ||
933 | if (dev->flags & IFF_ALLMULTI) { | 1010 | if (dev->flags & IFF_ALLMULTI) { |
934 | /* Enable all multicast mode */ | 1011 | /* Enable all multicast mode */ |
935 | macb_writel(bp, HRB, -1); | 1012 | macb_or_gem_writel(bp, HRB, -1); |
936 | macb_writel(bp, HRT, -1); | 1013 | macb_or_gem_writel(bp, HRT, -1); |
937 | cfg |= MACB_BIT(NCFGR_MTI); | 1014 | cfg |= MACB_BIT(NCFGR_MTI); |
938 | } else if (!netdev_mc_empty(dev)) { | 1015 | } else if (!netdev_mc_empty(dev)) { |
939 | /* Enable specific multicasts */ | 1016 | /* Enable specific multicasts */ |
@@ -941,8 +1018,8 @@ static void macb_set_rx_mode(struct net_device *dev) | |||
941 | cfg |= MACB_BIT(NCFGR_MTI); | 1018 | cfg |= MACB_BIT(NCFGR_MTI); |
942 | } else if (dev->flags & (~IFF_ALLMULTI)) { | 1019 | } else if (dev->flags & (~IFF_ALLMULTI)) { |
943 | /* Disable all multicast mode */ | 1020 | /* Disable all multicast mode */ |
944 | macb_writel(bp, HRB, 0); | 1021 | macb_or_gem_writel(bp, HRB, 0); |
945 | macb_writel(bp, HRT, 0); | 1022 | macb_or_gem_writel(bp, HRT, 0); |
946 | cfg &= ~MACB_BIT(NCFGR_MTI); | 1023 | cfg &= ~MACB_BIT(NCFGR_MTI); |
947 | } | 1024 | } |
948 | 1025 | ||
@@ -954,7 +1031,7 @@ static int macb_open(struct net_device *dev) | |||
954 | struct macb *bp = netdev_priv(dev); | 1031 | struct macb *bp = netdev_priv(dev); |
955 | int err; | 1032 | int err; |
956 | 1033 | ||
957 | dev_dbg(&bp->pdev->dev, "open\n"); | 1034 | netdev_dbg(bp->dev, "open\n"); |
958 | 1035 | ||
959 | /* if the phy is not yet register, retry later*/ | 1036 | /* if the phy is not yet register, retry later*/ |
960 | if (!bp->phy_dev) | 1037 | if (!bp->phy_dev) |
@@ -965,9 +1042,8 @@ static int macb_open(struct net_device *dev) | |||
965 | 1042 | ||
966 | err = macb_alloc_consistent(bp); | 1043 | err = macb_alloc_consistent(bp); |
967 | if (err) { | 1044 | if (err) { |
968 | printk(KERN_ERR | 1045 | netdev_err(dev, "Unable to allocate DMA memory (error %d)\n", |
969 | "%s: Unable to allocate DMA memory (error %d)\n", | 1046 | err); |
970 | dev->name, err); | ||
971 | return err; | 1047 | return err; |
972 | } | 1048 | } |
973 | 1049 | ||
@@ -1005,11 +1081,62 @@ static int macb_close(struct net_device *dev) | |||
1005 | return 0; | 1081 | return 0; |
1006 | } | 1082 | } |
1007 | 1083 | ||
1084 | static void gem_update_stats(struct macb *bp) | ||
1085 | { | ||
1086 | u32 __iomem *reg = bp->regs + GEM_OTX; | ||
1087 | u32 *p = &bp->hw_stats.gem.tx_octets_31_0; | ||
1088 | u32 *end = &bp->hw_stats.gem.rx_udp_checksum_errors + 1; | ||
1089 | |||
1090 | for (; p < end; p++, reg++) | ||
1091 | *p += __raw_readl(reg); | ||
1092 | } | ||
1093 | |||
1094 | static struct net_device_stats *gem_get_stats(struct macb *bp) | ||
1095 | { | ||
1096 | struct gem_stats *hwstat = &bp->hw_stats.gem; | ||
1097 | struct net_device_stats *nstat = &bp->stats; | ||
1098 | |||
1099 | gem_update_stats(bp); | ||
1100 | |||
1101 | nstat->rx_errors = (hwstat->rx_frame_check_sequence_errors + | ||
1102 | hwstat->rx_alignment_errors + | ||
1103 | hwstat->rx_resource_errors + | ||
1104 | hwstat->rx_overruns + | ||
1105 | hwstat->rx_oversize_frames + | ||
1106 | hwstat->rx_jabbers + | ||
1107 | hwstat->rx_undersized_frames + | ||
1108 | hwstat->rx_length_field_frame_errors); | ||
1109 | nstat->tx_errors = (hwstat->tx_late_collisions + | ||
1110 | hwstat->tx_excessive_collisions + | ||
1111 | hwstat->tx_underrun + | ||
1112 | hwstat->tx_carrier_sense_errors); | ||
1113 | nstat->multicast = hwstat->rx_multicast_frames; | ||
1114 | nstat->collisions = (hwstat->tx_single_collision_frames + | ||
1115 | hwstat->tx_multiple_collision_frames + | ||
1116 | hwstat->tx_excessive_collisions); | ||
1117 | nstat->rx_length_errors = (hwstat->rx_oversize_frames + | ||
1118 | hwstat->rx_jabbers + | ||
1119 | hwstat->rx_undersized_frames + | ||
1120 | hwstat->rx_length_field_frame_errors); | ||
1121 | nstat->rx_over_errors = hwstat->rx_resource_errors; | ||
1122 | nstat->rx_crc_errors = hwstat->rx_frame_check_sequence_errors; | ||
1123 | nstat->rx_frame_errors = hwstat->rx_alignment_errors; | ||
1124 | nstat->rx_fifo_errors = hwstat->rx_overruns; | ||
1125 | nstat->tx_aborted_errors = hwstat->tx_excessive_collisions; | ||
1126 | nstat->tx_carrier_errors = hwstat->tx_carrier_sense_errors; | ||
1127 | nstat->tx_fifo_errors = hwstat->tx_underrun; | ||
1128 | |||
1129 | return nstat; | ||
1130 | } | ||
1131 | |||
1008 | static struct net_device_stats *macb_get_stats(struct net_device *dev) | 1132 | static struct net_device_stats *macb_get_stats(struct net_device *dev) |
1009 | { | 1133 | { |
1010 | struct macb *bp = netdev_priv(dev); | 1134 | struct macb *bp = netdev_priv(dev); |
1011 | struct net_device_stats *nstat = &bp->stats; | 1135 | struct net_device_stats *nstat = &bp->stats; |
1012 | struct macb_stats *hwstat = &bp->hw_stats; | 1136 | struct macb_stats *hwstat = &bp->hw_stats.macb; |
1137 | |||
1138 | if (macb_is_gem(bp)) | ||
1139 | return gem_get_stats(bp); | ||
1013 | 1140 | ||
1014 | /* read stats from hardware */ | 1141 | /* read stats from hardware */ |
1015 | macb_update_stats(bp); | 1142 | macb_update_stats(bp); |
@@ -1119,12 +1246,11 @@ static const struct net_device_ops macb_netdev_ops = { | |||
1119 | 1246 | ||
1120 | static int __init macb_probe(struct platform_device *pdev) | 1247 | static int __init macb_probe(struct platform_device *pdev) |
1121 | { | 1248 | { |
1122 | struct eth_platform_data *pdata; | 1249 | struct macb_platform_data *pdata; |
1123 | struct resource *regs; | 1250 | struct resource *regs; |
1124 | struct net_device *dev; | 1251 | struct net_device *dev; |
1125 | struct macb *bp; | 1252 | struct macb *bp; |
1126 | struct phy_device *phydev; | 1253 | struct phy_device *phydev; |
1127 | unsigned long pclk_hz; | ||
1128 | u32 config; | 1254 | u32 config; |
1129 | int err = -ENXIO; | 1255 | int err = -ENXIO; |
1130 | 1256 | ||
@@ -1152,28 +1278,19 @@ static int __init macb_probe(struct platform_device *pdev) | |||
1152 | 1278 | ||
1153 | spin_lock_init(&bp->lock); | 1279 | spin_lock_init(&bp->lock); |
1154 | 1280 | ||
1155 | #if defined(CONFIG_ARCH_AT91) | 1281 | bp->pclk = clk_get(&pdev->dev, "pclk"); |
1156 | bp->pclk = clk_get(&pdev->dev, "macb_clk"); | ||
1157 | if (IS_ERR(bp->pclk)) { | 1282 | if (IS_ERR(bp->pclk)) { |
1158 | dev_err(&pdev->dev, "failed to get macb_clk\n"); | 1283 | dev_err(&pdev->dev, "failed to get macb_clk\n"); |
1159 | goto err_out_free_dev; | 1284 | goto err_out_free_dev; |
1160 | } | 1285 | } |
1161 | clk_enable(bp->pclk); | 1286 | clk_enable(bp->pclk); |
1162 | #else | 1287 | |
1163 | bp->pclk = clk_get(&pdev->dev, "pclk"); | ||
1164 | if (IS_ERR(bp->pclk)) { | ||
1165 | dev_err(&pdev->dev, "failed to get pclk\n"); | ||
1166 | goto err_out_free_dev; | ||
1167 | } | ||
1168 | bp->hclk = clk_get(&pdev->dev, "hclk"); | 1288 | bp->hclk = clk_get(&pdev->dev, "hclk"); |
1169 | if (IS_ERR(bp->hclk)) { | 1289 | if (IS_ERR(bp->hclk)) { |
1170 | dev_err(&pdev->dev, "failed to get hclk\n"); | 1290 | dev_err(&pdev->dev, "failed to get hclk\n"); |
1171 | goto err_out_put_pclk; | 1291 | goto err_out_put_pclk; |
1172 | } | 1292 | } |
1173 | |||
1174 | clk_enable(bp->pclk); | ||
1175 | clk_enable(bp->hclk); | 1293 | clk_enable(bp->hclk); |
1176 | #endif | ||
1177 | 1294 | ||
1178 | bp->regs = ioremap(regs->start, resource_size(regs)); | 1295 | bp->regs = ioremap(regs->start, resource_size(regs)); |
1179 | if (!bp->regs) { | 1296 | if (!bp->regs) { |
@@ -1185,9 +1302,8 @@ static int __init macb_probe(struct platform_device *pdev) | |||
1185 | dev->irq = platform_get_irq(pdev, 0); | 1302 | dev->irq = platform_get_irq(pdev, 0); |
1186 | err = request_irq(dev->irq, macb_interrupt, 0, dev->name, dev); | 1303 | err = request_irq(dev->irq, macb_interrupt, 0, dev->name, dev); |
1187 | if (err) { | 1304 | if (err) { |
1188 | printk(KERN_ERR | 1305 | dev_err(&pdev->dev, "Unable to request IRQ %d (error %d)\n", |
1189 | "%s: Unable to request IRQ %d (error %d)\n", | 1306 | dev->irq, err); |
1190 | dev->name, dev->irq, err); | ||
1191 | goto err_out_iounmap; | 1307 | goto err_out_iounmap; |
1192 | } | 1308 | } |
1193 | 1309 | ||
@@ -1198,15 +1314,8 @@ static int __init macb_probe(struct platform_device *pdev) | |||
1198 | dev->base_addr = regs->start; | 1314 | dev->base_addr = regs->start; |
1199 | 1315 | ||
1200 | /* Set MII management clock divider */ | 1316 | /* Set MII management clock divider */ |
1201 | pclk_hz = clk_get_rate(bp->pclk); | 1317 | config = macb_mdc_clk_div(bp); |
1202 | if (pclk_hz <= 20000000) | 1318 | config |= macb_dbw(bp); |
1203 | config = MACB_BF(CLK, MACB_CLK_DIV8); | ||
1204 | else if (pclk_hz <= 40000000) | ||
1205 | config = MACB_BF(CLK, MACB_CLK_DIV16); | ||
1206 | else if (pclk_hz <= 80000000) | ||
1207 | config = MACB_BF(CLK, MACB_CLK_DIV32); | ||
1208 | else | ||
1209 | config = MACB_BF(CLK, MACB_CLK_DIV64); | ||
1210 | macb_writel(bp, NCFGR, config); | 1319 | macb_writel(bp, NCFGR, config); |
1211 | 1320 | ||
1212 | macb_get_hwaddr(bp); | 1321 | macb_get_hwaddr(bp); |
@@ -1214,15 +1323,16 @@ static int __init macb_probe(struct platform_device *pdev) | |||
1214 | 1323 | ||
1215 | if (pdata && pdata->is_rmii) | 1324 | if (pdata && pdata->is_rmii) |
1216 | #if defined(CONFIG_ARCH_AT91) | 1325 | #if defined(CONFIG_ARCH_AT91) |
1217 | macb_writel(bp, USRIO, (MACB_BIT(RMII) | MACB_BIT(CLKEN)) ); | 1326 | macb_or_gem_writel(bp, USRIO, (MACB_BIT(RMII) | |
1327 | MACB_BIT(CLKEN))); | ||
1218 | #else | 1328 | #else |
1219 | macb_writel(bp, USRIO, 0); | 1329 | macb_or_gem_writel(bp, USRIO, 0); |
1220 | #endif | 1330 | #endif |
1221 | else | 1331 | else |
1222 | #if defined(CONFIG_ARCH_AT91) | 1332 | #if defined(CONFIG_ARCH_AT91) |
1223 | macb_writel(bp, USRIO, MACB_BIT(CLKEN)); | 1333 | macb_or_gem_writel(bp, USRIO, MACB_BIT(CLKEN)); |
1224 | #else | 1334 | #else |
1225 | macb_writel(bp, USRIO, MACB_BIT(MII)); | 1335 | macb_or_gem_writel(bp, USRIO, MACB_BIT(MII)); |
1226 | #endif | 1336 | #endif |
1227 | 1337 | ||
1228 | bp->tx_pending = DEF_TX_RING_PENDING; | 1338 | bp->tx_pending = DEF_TX_RING_PENDING; |
@@ -1239,13 +1349,13 @@ static int __init macb_probe(struct platform_device *pdev) | |||
1239 | 1349 | ||
1240 | platform_set_drvdata(pdev, dev); | 1350 | platform_set_drvdata(pdev, dev); |
1241 | 1351 | ||
1242 | printk(KERN_INFO "%s: Atmel MACB at 0x%08lx irq %d (%pM)\n", | 1352 | netdev_info(dev, "Cadence %s at 0x%08lx irq %d (%pM)\n", |
1243 | dev->name, dev->base_addr, dev->irq, dev->dev_addr); | 1353 | macb_is_gem(bp) ? "GEM" : "MACB", dev->base_addr, |
1354 | dev->irq, dev->dev_addr); | ||
1244 | 1355 | ||
1245 | phydev = bp->phy_dev; | 1356 | phydev = bp->phy_dev; |
1246 | printk(KERN_INFO "%s: attached PHY driver [%s] " | 1357 | netdev_info(dev, "attached PHY driver [%s] (mii_bus:phy_addr=%s, irq=%d)\n", |
1247 | "(mii_bus:phy_addr=%s, irq=%d)\n", dev->name, | 1358 | phydev->drv->name, dev_name(&phydev->dev), phydev->irq); |
1248 | phydev->drv->name, dev_name(&phydev->dev), phydev->irq); | ||
1249 | 1359 | ||
1250 | return 0; | 1360 | return 0; |
1251 | 1361 | ||
@@ -1256,14 +1366,10 @@ err_out_free_irq: | |||
1256 | err_out_iounmap: | 1366 | err_out_iounmap: |
1257 | iounmap(bp->regs); | 1367 | iounmap(bp->regs); |
1258 | err_out_disable_clocks: | 1368 | err_out_disable_clocks: |
1259 | #ifndef CONFIG_ARCH_AT91 | ||
1260 | clk_disable(bp->hclk); | 1369 | clk_disable(bp->hclk); |
1261 | clk_put(bp->hclk); | 1370 | clk_put(bp->hclk); |
1262 | #endif | ||
1263 | clk_disable(bp->pclk); | 1371 | clk_disable(bp->pclk); |
1264 | #ifndef CONFIG_ARCH_AT91 | ||
1265 | err_out_put_pclk: | 1372 | err_out_put_pclk: |
1266 | #endif | ||
1267 | clk_put(bp->pclk); | 1373 | clk_put(bp->pclk); |
1268 | err_out_free_dev: | 1374 | err_out_free_dev: |
1269 | free_netdev(dev); | 1375 | free_netdev(dev); |
@@ -1289,10 +1395,8 @@ static int __exit macb_remove(struct platform_device *pdev) | |||
1289 | unregister_netdev(dev); | 1395 | unregister_netdev(dev); |
1290 | free_irq(dev->irq, dev); | 1396 | free_irq(dev->irq, dev); |
1291 | iounmap(bp->regs); | 1397 | iounmap(bp->regs); |
1292 | #ifndef CONFIG_ARCH_AT91 | ||
1293 | clk_disable(bp->hclk); | 1398 | clk_disable(bp->hclk); |
1294 | clk_put(bp->hclk); | 1399 | clk_put(bp->hclk); |
1295 | #endif | ||
1296 | clk_disable(bp->pclk); | 1400 | clk_disable(bp->pclk); |
1297 | clk_put(bp->pclk); | 1401 | clk_put(bp->pclk); |
1298 | free_netdev(dev); | 1402 | free_netdev(dev); |
@@ -1310,9 +1414,7 @@ static int macb_suspend(struct platform_device *pdev, pm_message_t state) | |||
1310 | 1414 | ||
1311 | netif_device_detach(netdev); | 1415 | netif_device_detach(netdev); |
1312 | 1416 | ||
1313 | #ifndef CONFIG_ARCH_AT91 | ||
1314 | clk_disable(bp->hclk); | 1417 | clk_disable(bp->hclk); |
1315 | #endif | ||
1316 | clk_disable(bp->pclk); | 1418 | clk_disable(bp->pclk); |
1317 | 1419 | ||
1318 | return 0; | 1420 | return 0; |
@@ -1324,9 +1426,7 @@ static int macb_resume(struct platform_device *pdev) | |||
1324 | struct macb *bp = netdev_priv(netdev); | 1426 | struct macb *bp = netdev_priv(netdev); |
1325 | 1427 | ||
1326 | clk_enable(bp->pclk); | 1428 | clk_enable(bp->pclk); |
1327 | #ifndef CONFIG_ARCH_AT91 | ||
1328 | clk_enable(bp->hclk); | 1429 | clk_enable(bp->hclk); |
1329 | #endif | ||
1330 | 1430 | ||
1331 | netif_device_attach(netdev); | 1431 | netif_device_attach(netdev); |
1332 | 1432 | ||
@@ -1361,6 +1461,6 @@ module_init(macb_init); | |||
1361 | module_exit(macb_exit); | 1461 | module_exit(macb_exit); |
1362 | 1462 | ||
1363 | MODULE_LICENSE("GPL"); | 1463 | MODULE_LICENSE("GPL"); |
1364 | MODULE_DESCRIPTION("Atmel MACB Ethernet driver"); | 1464 | MODULE_DESCRIPTION("Cadence MACB/GEM Ethernet driver"); |
1365 | MODULE_AUTHOR("Haavard Skinnemoen (Atmel)"); | 1465 | MODULE_AUTHOR("Haavard Skinnemoen (Atmel)"); |
1366 | MODULE_ALIAS("platform:macb"); | 1466 | MODULE_ALIAS("platform:macb"); |
diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h index d3212f6db703..193107884a5a 100644 --- a/drivers/net/ethernet/cadence/macb.h +++ b/drivers/net/ethernet/cadence/macb.h | |||
@@ -59,6 +59,24 @@ | |||
59 | #define MACB_TPQ 0x00bc | 59 | #define MACB_TPQ 0x00bc |
60 | #define MACB_USRIO 0x00c0 | 60 | #define MACB_USRIO 0x00c0 |
61 | #define MACB_WOL 0x00c4 | 61 | #define MACB_WOL 0x00c4 |
62 | #define MACB_MID 0x00fc | ||
63 | |||
64 | /* GEM register offsets. */ | ||
65 | #define GEM_NCFGR 0x0004 | ||
66 | #define GEM_USRIO 0x000c | ||
67 | #define GEM_DMACFG 0x0010 | ||
68 | #define GEM_HRB 0x0080 | ||
69 | #define GEM_HRT 0x0084 | ||
70 | #define GEM_SA1B 0x0088 | ||
71 | #define GEM_SA1T 0x008C | ||
72 | #define GEM_OTX 0x0100 | ||
73 | #define GEM_DCFG1 0x0280 | ||
74 | #define GEM_DCFG2 0x0284 | ||
75 | #define GEM_DCFG3 0x0288 | ||
76 | #define GEM_DCFG4 0x028c | ||
77 | #define GEM_DCFG5 0x0290 | ||
78 | #define GEM_DCFG6 0x0294 | ||
79 | #define GEM_DCFG7 0x0298 | ||
62 | 80 | ||
63 | /* Bitfields in NCR */ | 81 | /* Bitfields in NCR */ |
64 | #define MACB_LB_OFFSET 0 | 82 | #define MACB_LB_OFFSET 0 |
@@ -126,6 +144,21 @@ | |||
126 | #define MACB_IRXFCS_OFFSET 19 | 144 | #define MACB_IRXFCS_OFFSET 19 |
127 | #define MACB_IRXFCS_SIZE 1 | 145 | #define MACB_IRXFCS_SIZE 1 |
128 | 146 | ||
147 | /* GEM specific NCFGR bitfields. */ | ||
148 | #define GEM_CLK_OFFSET 18 | ||
149 | #define GEM_CLK_SIZE 3 | ||
150 | #define GEM_DBW_OFFSET 21 | ||
151 | #define GEM_DBW_SIZE 2 | ||
152 | |||
153 | /* Constants for data bus width. */ | ||
154 | #define GEM_DBW32 0 | ||
155 | #define GEM_DBW64 1 | ||
156 | #define GEM_DBW128 2 | ||
157 | |||
158 | /* Bitfields in DMACFG. */ | ||
159 | #define GEM_RXBS_OFFSET 16 | ||
160 | #define GEM_RXBS_SIZE 8 | ||
161 | |||
129 | /* Bitfields in NSR */ | 162 | /* Bitfields in NSR */ |
130 | #define MACB_NSR_LINK_OFFSET 0 | 163 | #define MACB_NSR_LINK_OFFSET 0 |
131 | #define MACB_NSR_LINK_SIZE 1 | 164 | #define MACB_NSR_LINK_SIZE 1 |
@@ -228,12 +261,30 @@ | |||
228 | #define MACB_WOL_MTI_OFFSET 19 | 261 | #define MACB_WOL_MTI_OFFSET 19 |
229 | #define MACB_WOL_MTI_SIZE 1 | 262 | #define MACB_WOL_MTI_SIZE 1 |
230 | 263 | ||
264 | /* Bitfields in MID */ | ||
265 | #define MACB_IDNUM_OFFSET 16 | ||
266 | #define MACB_IDNUM_SIZE 16 | ||
267 | #define MACB_REV_OFFSET 0 | ||
268 | #define MACB_REV_SIZE 16 | ||
269 | |||
270 | /* Bitfields in DCFG1. */ | ||
271 | #define GEM_DBWDEF_OFFSET 25 | ||
272 | #define GEM_DBWDEF_SIZE 3 | ||
273 | |||
231 | /* Constants for CLK */ | 274 | /* Constants for CLK */ |
232 | #define MACB_CLK_DIV8 0 | 275 | #define MACB_CLK_DIV8 0 |
233 | #define MACB_CLK_DIV16 1 | 276 | #define MACB_CLK_DIV16 1 |
234 | #define MACB_CLK_DIV32 2 | 277 | #define MACB_CLK_DIV32 2 |
235 | #define MACB_CLK_DIV64 3 | 278 | #define MACB_CLK_DIV64 3 |
236 | 279 | ||
280 | /* GEM specific constants for CLK. */ | ||
281 | #define GEM_CLK_DIV8 0 | ||
282 | #define GEM_CLK_DIV16 1 | ||
283 | #define GEM_CLK_DIV32 2 | ||
284 | #define GEM_CLK_DIV48 3 | ||
285 | #define GEM_CLK_DIV64 4 | ||
286 | #define GEM_CLK_DIV96 5 | ||
287 | |||
237 | /* Constants for MAN register */ | 288 | /* Constants for MAN register */ |
238 | #define MACB_MAN_SOF 1 | 289 | #define MACB_MAN_SOF 1 |
239 | #define MACB_MAN_WRITE 1 | 290 | #define MACB_MAN_WRITE 1 |
@@ -254,11 +305,52 @@ | |||
254 | << MACB_##name##_OFFSET)) \ | 305 | << MACB_##name##_OFFSET)) \ |
255 | | MACB_BF(name,value)) | 306 | | MACB_BF(name,value)) |
256 | 307 | ||
308 | #define GEM_BIT(name) \ | ||
309 | (1 << GEM_##name##_OFFSET) | ||
310 | #define GEM_BF(name, value) \ | ||
311 | (((value) & ((1 << GEM_##name##_SIZE) - 1)) \ | ||
312 | << GEM_##name##_OFFSET) | ||
313 | #define GEM_BFEXT(name, value)\ | ||
314 | (((value) >> GEM_##name##_OFFSET) \ | ||
315 | & ((1 << GEM_##name##_SIZE) - 1)) | ||
316 | #define GEM_BFINS(name, value, old) \ | ||
317 | (((old) & ~(((1 << GEM_##name##_SIZE) - 1) \ | ||
318 | << GEM_##name##_OFFSET)) \ | ||
319 | | GEM_BF(name, value)) | ||
320 | |||
257 | /* Register access macros */ | 321 | /* Register access macros */ |
258 | #define macb_readl(port,reg) \ | 322 | #define macb_readl(port,reg) \ |
259 | __raw_readl((port)->regs + MACB_##reg) | 323 | __raw_readl((port)->regs + MACB_##reg) |
260 | #define macb_writel(port,reg,value) \ | 324 | #define macb_writel(port,reg,value) \ |
261 | __raw_writel((value), (port)->regs + MACB_##reg) | 325 | __raw_writel((value), (port)->regs + MACB_##reg) |
326 | #define gem_readl(port, reg) \ | ||
327 | __raw_readl((port)->regs + GEM_##reg) | ||
328 | #define gem_writel(port, reg, value) \ | ||
329 | __raw_writel((value), (port)->regs + GEM_##reg) | ||
330 | |||
331 | /* | ||
332 | * Conditional GEM/MACB macros. These perform the operation to the correct | ||
333 | * register dependent on whether the device is a GEM or a MACB. For registers | ||
334 | * and bitfields that are common across both devices, use macb_{read,write}l | ||
335 | * to avoid the cost of the conditional. | ||
336 | */ | ||
337 | #define macb_or_gem_writel(__bp, __reg, __value) \ | ||
338 | ({ \ | ||
339 | if (macb_is_gem((__bp))) \ | ||
340 | gem_writel((__bp), __reg, __value); \ | ||
341 | else \ | ||
342 | macb_writel((__bp), __reg, __value); \ | ||
343 | }) | ||
344 | |||
345 | #define macb_or_gem_readl(__bp, __reg) \ | ||
346 | ({ \ | ||
347 | u32 __v; \ | ||
348 | if (macb_is_gem((__bp))) \ | ||
349 | __v = gem_readl((__bp), __reg); \ | ||
350 | else \ | ||
351 | __v = macb_readl((__bp), __reg); \ | ||
352 | __v; \ | ||
353 | }) | ||
262 | 354 | ||
263 | struct dma_desc { | 355 | struct dma_desc { |
264 | u32 addr; | 356 | u32 addr; |
@@ -358,6 +450,54 @@ struct macb_stats { | |||
358 | u32 tx_pause_frames; | 450 | u32 tx_pause_frames; |
359 | }; | 451 | }; |
360 | 452 | ||
453 | struct gem_stats { | ||
454 | u32 tx_octets_31_0; | ||
455 | u32 tx_octets_47_32; | ||
456 | u32 tx_frames; | ||
457 | u32 tx_broadcast_frames; | ||
458 | u32 tx_multicast_frames; | ||
459 | u32 tx_pause_frames; | ||
460 | u32 tx_64_byte_frames; | ||
461 | u32 tx_65_127_byte_frames; | ||
462 | u32 tx_128_255_byte_frames; | ||
463 | u32 tx_256_511_byte_frames; | ||
464 | u32 tx_512_1023_byte_frames; | ||
465 | u32 tx_1024_1518_byte_frames; | ||
466 | u32 tx_greater_than_1518_byte_frames; | ||
467 | u32 tx_underrun; | ||
468 | u32 tx_single_collision_frames; | ||
469 | u32 tx_multiple_collision_frames; | ||
470 | u32 tx_excessive_collisions; | ||
471 | u32 tx_late_collisions; | ||
472 | u32 tx_deferred_frames; | ||
473 | u32 tx_carrier_sense_errors; | ||
474 | u32 rx_octets_31_0; | ||
475 | u32 rx_octets_47_32; | ||
476 | u32 rx_frames; | ||
477 | u32 rx_broadcast_frames; | ||
478 | u32 rx_multicast_frames; | ||
479 | u32 rx_pause_frames; | ||
480 | u32 rx_64_byte_frames; | ||
481 | u32 rx_65_127_byte_frames; | ||
482 | u32 rx_128_255_byte_frames; | ||
483 | u32 rx_256_511_byte_frames; | ||
484 | u32 rx_512_1023_byte_frames; | ||
485 | u32 rx_1024_1518_byte_frames; | ||
486 | u32 rx_greater_than_1518_byte_frames; | ||
487 | u32 rx_undersized_frames; | ||
488 | u32 rx_oversize_frames; | ||
489 | u32 rx_jabbers; | ||
490 | u32 rx_frame_check_sequence_errors; | ||
491 | u32 rx_length_field_frame_errors; | ||
492 | u32 rx_symbol_errors; | ||
493 | u32 rx_alignment_errors; | ||
494 | u32 rx_resource_errors; | ||
495 | u32 rx_overruns; | ||
496 | u32 rx_ip_header_checksum_errors; | ||
497 | u32 rx_tcp_checksum_errors; | ||
498 | u32 rx_udp_checksum_errors; | ||
499 | }; | ||
500 | |||
361 | struct macb { | 501 | struct macb { |
362 | void __iomem *regs; | 502 | void __iomem *regs; |
363 | 503 | ||
@@ -376,7 +516,10 @@ struct macb { | |||
376 | struct net_device *dev; | 516 | struct net_device *dev; |
377 | struct napi_struct napi; | 517 | struct napi_struct napi; |
378 | struct net_device_stats stats; | 518 | struct net_device_stats stats; |
379 | struct macb_stats hw_stats; | 519 | union { |
520 | struct macb_stats macb; | ||
521 | struct gem_stats gem; | ||
522 | } hw_stats; | ||
380 | 523 | ||
381 | dma_addr_t rx_ring_dma; | 524 | dma_addr_t rx_ring_dma; |
382 | dma_addr_t tx_ring_dma; | 525 | dma_addr_t tx_ring_dma; |
@@ -391,4 +534,9 @@ struct macb { | |||
391 | unsigned int duplex; | 534 | unsigned int duplex; |
392 | }; | 535 | }; |
393 | 536 | ||
537 | static inline bool macb_is_gem(struct macb *bp) | ||
538 | { | ||
539 | return MACB_BFEXT(IDNUM, macb_readl(bp, MID)) == 0x2; | ||
540 | } | ||
541 | |||
394 | #endif /* _MACB_H */ | 542 | #endif /* _MACB_H */ |
diff --git a/drivers/net/ethernet/freescale/Kconfig b/drivers/net/ethernet/freescale/Kconfig index 1cf671643d1f..c520cfd3b298 100644 --- a/drivers/net/ethernet/freescale/Kconfig +++ b/drivers/net/ethernet/freescale/Kconfig | |||
@@ -7,8 +7,7 @@ config NET_VENDOR_FREESCALE | |||
7 | default y | 7 | default y |
8 | depends on FSL_SOC || QUICC_ENGINE || CPM1 || CPM2 || PPC_MPC512x || \ | 8 | depends on FSL_SOC || QUICC_ENGINE || CPM1 || CPM2 || PPC_MPC512x || \ |
9 | M523x || M527x || M5272 || M528x || M520x || M532x || \ | 9 | M523x || M527x || M5272 || M528x || M520x || M532x || \ |
10 | ARCH_MXC || ARCH_MXS || \ | 10 | ARCH_MXC || ARCH_MXS || (PPC_MPC52xx && PPC_BESTCOMM) |
11 | (PPC_MPC52xx && PPC_BESTCOMM) | ||
12 | ---help--- | 11 | ---help--- |
13 | If you have a network (Ethernet) card belonging to this class, say Y | 12 | If you have a network (Ethernet) card belonging to this class, say Y |
14 | and read the Ethernet-HOWTO, available from | 13 | and read the Ethernet-HOWTO, available from |
diff --git a/drivers/net/ethernet/intel/Kconfig b/drivers/net/ethernet/intel/Kconfig index 61029dc7fa6f..76213162fbe3 100644 --- a/drivers/net/ethernet/intel/Kconfig +++ b/drivers/net/ethernet/intel/Kconfig | |||
@@ -5,7 +5,11 @@ | |||
5 | config NET_VENDOR_INTEL | 5 | config NET_VENDOR_INTEL |
6 | bool "Intel devices" | 6 | bool "Intel devices" |
7 | default y | 7 | default y |
8 | depends on PCI || PCI_MSI | 8 | depends on PCI || PCI_MSI || ISA || ISA_DMA_API || ARM || \ |
9 | ARCH_ACORN || MCA || MCA_LEGACY || SNI_RM || SUN3 || \ | ||
10 | GSC || BVME6000 || MVME16x || ARCH_ENP2611 || \ | ||
11 | (ARM && ARCH_IXP4XX && IXP4XX_NPE && IXP4XX_QMGR) || \ | ||
12 | EXPERIMENTAL | ||
9 | ---help--- | 13 | ---help--- |
10 | If you have a network (Ethernet) card belonging to this class, say Y | 14 | If you have a network (Ethernet) card belonging to this class, say Y |
11 | and read the Ethernet-HOWTO, available from | 15 | and read the Ethernet-HOWTO, available from |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c index db95731863d7..00fcd39ad666 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | |||
@@ -442,12 +442,14 @@ static int ixgbe_set_vf_macvlan(struct ixgbe_adapter *adapter, | |||
442 | 442 | ||
443 | int ixgbe_check_vf_assignment(struct ixgbe_adapter *adapter) | 443 | int ixgbe_check_vf_assignment(struct ixgbe_adapter *adapter) |
444 | { | 444 | { |
445 | #ifdef CONFIG_PCI_IOV | ||
445 | int i; | 446 | int i; |
446 | for (i = 0; i < adapter->num_vfs; i++) { | 447 | for (i = 0; i < adapter->num_vfs; i++) { |
447 | if (adapter->vfinfo[i].vfdev->dev_flags & | 448 | if (adapter->vfinfo[i].vfdev->dev_flags & |
448 | PCI_DEV_FLAGS_ASSIGNED) | 449 | PCI_DEV_FLAGS_ASSIGNED) |
449 | return true; | 450 | return true; |
450 | } | 451 | } |
452 | #endif | ||
451 | return false; | 453 | return false; |
452 | } | 454 | } |
453 | 455 | ||
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.h index 4a5d8897faab..df04f1a3857c 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.h +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.h | |||
@@ -42,11 +42,11 @@ int ixgbe_ndo_set_vf_spoofchk(struct net_device *netdev, int vf, bool setting); | |||
42 | int ixgbe_ndo_get_vf_config(struct net_device *netdev, | 42 | int ixgbe_ndo_get_vf_config(struct net_device *netdev, |
43 | int vf, struct ifla_vf_info *ivi); | 43 | int vf, struct ifla_vf_info *ivi); |
44 | void ixgbe_check_vf_rate_limit(struct ixgbe_adapter *adapter); | 44 | void ixgbe_check_vf_rate_limit(struct ixgbe_adapter *adapter); |
45 | #ifdef CONFIG_PCI_IOV | ||
46 | void ixgbe_disable_sriov(struct ixgbe_adapter *adapter); | 45 | void ixgbe_disable_sriov(struct ixgbe_adapter *adapter); |
46 | int ixgbe_check_vf_assignment(struct ixgbe_adapter *adapter); | ||
47 | #ifdef CONFIG_PCI_IOV | ||
47 | void ixgbe_enable_sriov(struct ixgbe_adapter *adapter, | 48 | void ixgbe_enable_sriov(struct ixgbe_adapter *adapter, |
48 | const struct ixgbe_info *ii); | 49 | const struct ixgbe_info *ii); |
49 | int ixgbe_check_vf_assignment(struct ixgbe_adapter *adapter); | ||
50 | #endif | 50 | #endif |
51 | 51 | ||
52 | 52 | ||
diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c index cbd026f3bc57..fdc6c394c683 100644 --- a/drivers/net/ethernet/marvell/sky2.c +++ b/drivers/net/ethernet/marvell/sky2.c | |||
@@ -366,17 +366,6 @@ static void sky2_phy_init(struct sky2_hw *hw, unsigned port) | |||
366 | gm_phy_write(hw, port, PHY_MARV_FE_SPEC_2, spec); | 366 | gm_phy_write(hw, port, PHY_MARV_FE_SPEC_2, spec); |
367 | } | 367 | } |
368 | } else { | 368 | } else { |
369 | if (hw->chip_id >= CHIP_ID_YUKON_OPT) { | ||
370 | u16 ctrl2 = gm_phy_read(hw, port, PHY_MARV_EXT_CTRL_2); | ||
371 | |||
372 | /* enable PHY Reverse Auto-Negotiation */ | ||
373 | ctrl2 |= 1u << 13; | ||
374 | |||
375 | /* Write PHY changes (SW-reset must follow) */ | ||
376 | gm_phy_write(hw, port, PHY_MARV_EXT_CTRL_2, ctrl2); | ||
377 | } | ||
378 | |||
379 | |||
380 | /* disable energy detect */ | 369 | /* disable energy detect */ |
381 | ctrl &= ~PHY_M_PC_EN_DET_MSK; | 370 | ctrl &= ~PHY_M_PC_EN_DET_MSK; |
382 | 371 | ||
diff --git a/drivers/net/ethernet/natsemi/Kconfig b/drivers/net/ethernet/natsemi/Kconfig index 4a6b9fd073b6..eb836f770f50 100644 --- a/drivers/net/ethernet/natsemi/Kconfig +++ b/drivers/net/ethernet/natsemi/Kconfig | |||
@@ -5,7 +5,10 @@ | |||
5 | config NET_VENDOR_NATSEMI | 5 | config NET_VENDOR_NATSEMI |
6 | bool "National Semi-conductor devices" | 6 | bool "National Semi-conductor devices" |
7 | default y | 7 | default y |
8 | depends on MCA || MAC || MACH_JAZZ || PCI || XTENSA_PLATFORM_XT2000 | 8 | depends on AMIGA_PCMCIA || ARM || EISA || EXPERIMENTAL || H8300 || \ |
9 | ISA || M32R || MAC || MACH_JAZZ || MACH_TX49XX || MCA || \ | ||
10 | MCA_LEGACY || MIPS || PCI || PCMCIA || SUPERH || \ | ||
11 | XTENSA_PLATFORM_XT2000 || ZORRO | ||
9 | ---help--- | 12 | ---help--- |
10 | If you have a network (Ethernet) card belonging to this class, say Y | 13 | If you have a network (Ethernet) card belonging to this class, say Y |
11 | and read the Ethernet-HOWTO, available from | 14 | and read the Ethernet-HOWTO, available from |
diff --git a/drivers/net/ethernet/nvidia/forcedeth.c b/drivers/net/ethernet/nvidia/forcedeth.c index 1e37eb98c4e2..1dca57013cb2 100644 --- a/drivers/net/ethernet/nvidia/forcedeth.c +++ b/drivers/net/ethernet/nvidia/forcedeth.c | |||
@@ -1682,6 +1682,7 @@ static void nv_get_hw_stats(struct net_device *dev) | |||
1682 | np->estats.tx_pause += readl(base + NvRegTxPause); | 1682 | np->estats.tx_pause += readl(base + NvRegTxPause); |
1683 | np->estats.rx_pause += readl(base + NvRegRxPause); | 1683 | np->estats.rx_pause += readl(base + NvRegRxPause); |
1684 | np->estats.rx_drop_frame += readl(base + NvRegRxDropFrame); | 1684 | np->estats.rx_drop_frame += readl(base + NvRegRxDropFrame); |
1685 | np->estats.rx_errors_total += np->estats.rx_drop_frame; | ||
1685 | } | 1686 | } |
1686 | 1687 | ||
1687 | if (np->driver_data & DEV_HAS_STATISTICS_V3) { | 1688 | if (np->driver_data & DEV_HAS_STATISTICS_V3) { |
@@ -1706,11 +1707,14 @@ static struct net_device_stats *nv_get_stats(struct net_device *dev) | |||
1706 | nv_get_hw_stats(dev); | 1707 | nv_get_hw_stats(dev); |
1707 | 1708 | ||
1708 | /* copy to net_device stats */ | 1709 | /* copy to net_device stats */ |
1710 | dev->stats.tx_packets = np->estats.tx_packets; | ||
1711 | dev->stats.rx_bytes = np->estats.rx_bytes; | ||
1709 | dev->stats.tx_bytes = np->estats.tx_bytes; | 1712 | dev->stats.tx_bytes = np->estats.tx_bytes; |
1710 | dev->stats.tx_fifo_errors = np->estats.tx_fifo_errors; | 1713 | dev->stats.tx_fifo_errors = np->estats.tx_fifo_errors; |
1711 | dev->stats.tx_carrier_errors = np->estats.tx_carrier_errors; | 1714 | dev->stats.tx_carrier_errors = np->estats.tx_carrier_errors; |
1712 | dev->stats.rx_crc_errors = np->estats.rx_crc_errors; | 1715 | dev->stats.rx_crc_errors = np->estats.rx_crc_errors; |
1713 | dev->stats.rx_over_errors = np->estats.rx_over_errors; | 1716 | dev->stats.rx_over_errors = np->estats.rx_over_errors; |
1717 | dev->stats.rx_fifo_errors = np->estats.rx_drop_frame; | ||
1714 | dev->stats.rx_errors = np->estats.rx_errors_total; | 1718 | dev->stats.rx_errors = np->estats.rx_errors_total; |
1715 | dev->stats.tx_errors = np->estats.tx_errors_total; | 1719 | dev->stats.tx_errors = np->estats.tx_errors_total; |
1716 | } | 1720 | } |
@@ -2099,10 +2103,10 @@ static netdev_tx_t nv_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2099 | 2103 | ||
2100 | /* add fragments to entries count */ | 2104 | /* add fragments to entries count */ |
2101 | for (i = 0; i < fragments; i++) { | 2105 | for (i = 0; i < fragments; i++) { |
2102 | u32 size = skb_frag_size(&skb_shinfo(skb)->frags[i]); | 2106 | u32 frag_size = skb_frag_size(&skb_shinfo(skb)->frags[i]); |
2103 | 2107 | ||
2104 | entries += (size >> NV_TX2_TSO_MAX_SHIFT) + | 2108 | entries += (frag_size >> NV_TX2_TSO_MAX_SHIFT) + |
2105 | ((size & (NV_TX2_TSO_MAX_SIZE-1)) ? 1 : 0); | 2109 | ((frag_size & (NV_TX2_TSO_MAX_SIZE-1)) ? 1 : 0); |
2106 | } | 2110 | } |
2107 | 2111 | ||
2108 | spin_lock_irqsave(&np->lock, flags); | 2112 | spin_lock_irqsave(&np->lock, flags); |
@@ -2141,13 +2145,13 @@ static netdev_tx_t nv_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2141 | /* setup the fragments */ | 2145 | /* setup the fragments */ |
2142 | for (i = 0; i < fragments; i++) { | 2146 | for (i = 0; i < fragments; i++) { |
2143 | const skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; | 2147 | const skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; |
2144 | u32 size = skb_frag_size(frag); | 2148 | u32 frag_size = skb_frag_size(frag); |
2145 | offset = 0; | 2149 | offset = 0; |
2146 | 2150 | ||
2147 | do { | 2151 | do { |
2148 | prev_tx = put_tx; | 2152 | prev_tx = put_tx; |
2149 | prev_tx_ctx = np->put_tx_ctx; | 2153 | prev_tx_ctx = np->put_tx_ctx; |
2150 | bcnt = (size > NV_TX2_TSO_MAX_SIZE) ? NV_TX2_TSO_MAX_SIZE : size; | 2154 | bcnt = (frag_size > NV_TX2_TSO_MAX_SIZE) ? NV_TX2_TSO_MAX_SIZE : frag_size; |
2151 | np->put_tx_ctx->dma = skb_frag_dma_map( | 2155 | np->put_tx_ctx->dma = skb_frag_dma_map( |
2152 | &np->pci_dev->dev, | 2156 | &np->pci_dev->dev, |
2153 | frag, offset, | 2157 | frag, offset, |
@@ -2159,12 +2163,12 @@ static netdev_tx_t nv_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2159 | put_tx->flaglen = cpu_to_le32((bcnt-1) | tx_flags); | 2163 | put_tx->flaglen = cpu_to_le32((bcnt-1) | tx_flags); |
2160 | 2164 | ||
2161 | offset += bcnt; | 2165 | offset += bcnt; |
2162 | size -= bcnt; | 2166 | frag_size -= bcnt; |
2163 | if (unlikely(put_tx++ == np->last_tx.orig)) | 2167 | if (unlikely(put_tx++ == np->last_tx.orig)) |
2164 | put_tx = np->first_tx.orig; | 2168 | put_tx = np->first_tx.orig; |
2165 | if (unlikely(np->put_tx_ctx++ == np->last_tx_ctx)) | 2169 | if (unlikely(np->put_tx_ctx++ == np->last_tx_ctx)) |
2166 | np->put_tx_ctx = np->first_tx_ctx; | 2170 | np->put_tx_ctx = np->first_tx_ctx; |
2167 | } while (size); | 2171 | } while (frag_size); |
2168 | } | 2172 | } |
2169 | 2173 | ||
2170 | /* set last fragment flag */ | 2174 | /* set last fragment flag */ |
@@ -2213,10 +2217,10 @@ static netdev_tx_t nv_start_xmit_optimized(struct sk_buff *skb, | |||
2213 | 2217 | ||
2214 | /* add fragments to entries count */ | 2218 | /* add fragments to entries count */ |
2215 | for (i = 0; i < fragments; i++) { | 2219 | for (i = 0; i < fragments; i++) { |
2216 | u32 size = skb_frag_size(&skb_shinfo(skb)->frags[i]); | 2220 | u32 frag_size = skb_frag_size(&skb_shinfo(skb)->frags[i]); |
2217 | 2221 | ||
2218 | entries += (size >> NV_TX2_TSO_MAX_SHIFT) + | 2222 | entries += (frag_size >> NV_TX2_TSO_MAX_SHIFT) + |
2219 | ((size & (NV_TX2_TSO_MAX_SIZE-1)) ? 1 : 0); | 2223 | ((frag_size & (NV_TX2_TSO_MAX_SIZE-1)) ? 1 : 0); |
2220 | } | 2224 | } |
2221 | 2225 | ||
2222 | spin_lock_irqsave(&np->lock, flags); | 2226 | spin_lock_irqsave(&np->lock, flags); |
@@ -2257,13 +2261,13 @@ static netdev_tx_t nv_start_xmit_optimized(struct sk_buff *skb, | |||
2257 | /* setup the fragments */ | 2261 | /* setup the fragments */ |
2258 | for (i = 0; i < fragments; i++) { | 2262 | for (i = 0; i < fragments; i++) { |
2259 | skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; | 2263 | skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; |
2260 | u32 size = skb_frag_size(frag); | 2264 | u32 frag_size = skb_frag_size(frag); |
2261 | offset = 0; | 2265 | offset = 0; |
2262 | 2266 | ||
2263 | do { | 2267 | do { |
2264 | prev_tx = put_tx; | 2268 | prev_tx = put_tx; |
2265 | prev_tx_ctx = np->put_tx_ctx; | 2269 | prev_tx_ctx = np->put_tx_ctx; |
2266 | bcnt = (size > NV_TX2_TSO_MAX_SIZE) ? NV_TX2_TSO_MAX_SIZE : size; | 2270 | bcnt = (frag_size > NV_TX2_TSO_MAX_SIZE) ? NV_TX2_TSO_MAX_SIZE : frag_size; |
2267 | np->put_tx_ctx->dma = skb_frag_dma_map( | 2271 | np->put_tx_ctx->dma = skb_frag_dma_map( |
2268 | &np->pci_dev->dev, | 2272 | &np->pci_dev->dev, |
2269 | frag, offset, | 2273 | frag, offset, |
@@ -2276,12 +2280,12 @@ static netdev_tx_t nv_start_xmit_optimized(struct sk_buff *skb, | |||
2276 | put_tx->flaglen = cpu_to_le32((bcnt-1) | tx_flags); | 2280 | put_tx->flaglen = cpu_to_le32((bcnt-1) | tx_flags); |
2277 | 2281 | ||
2278 | offset += bcnt; | 2282 | offset += bcnt; |
2279 | size -= bcnt; | 2283 | frag_size -= bcnt; |
2280 | if (unlikely(put_tx++ == np->last_tx.ex)) | 2284 | if (unlikely(put_tx++ == np->last_tx.ex)) |
2281 | put_tx = np->first_tx.ex; | 2285 | put_tx = np->first_tx.ex; |
2282 | if (unlikely(np->put_tx_ctx++ == np->last_tx_ctx)) | 2286 | if (unlikely(np->put_tx_ctx++ == np->last_tx_ctx)) |
2283 | np->put_tx_ctx = np->first_tx_ctx; | 2287 | np->put_tx_ctx = np->first_tx_ctx; |
2284 | } while (size); | 2288 | } while (frag_size); |
2285 | } | 2289 | } |
2286 | 2290 | ||
2287 | /* set last fragment flag */ | 2291 | /* set last fragment flag */ |
@@ -2374,16 +2378,8 @@ static int nv_tx_done(struct net_device *dev, int limit) | |||
2374 | if (np->desc_ver == DESC_VER_1) { | 2378 | if (np->desc_ver == DESC_VER_1) { |
2375 | if (flags & NV_TX_LASTPACKET) { | 2379 | if (flags & NV_TX_LASTPACKET) { |
2376 | if (flags & NV_TX_ERROR) { | 2380 | if (flags & NV_TX_ERROR) { |
2377 | if (flags & NV_TX_UNDERFLOW) | ||
2378 | dev->stats.tx_fifo_errors++; | ||
2379 | if (flags & NV_TX_CARRIERLOST) | ||
2380 | dev->stats.tx_carrier_errors++; | ||
2381 | if ((flags & NV_TX_RETRYERROR) && !(flags & NV_TX_RETRYCOUNT_MASK)) | 2381 | if ((flags & NV_TX_RETRYERROR) && !(flags & NV_TX_RETRYCOUNT_MASK)) |
2382 | nv_legacybackoff_reseed(dev); | 2382 | nv_legacybackoff_reseed(dev); |
2383 | dev->stats.tx_errors++; | ||
2384 | } else { | ||
2385 | dev->stats.tx_packets++; | ||
2386 | dev->stats.tx_bytes += np->get_tx_ctx->skb->len; | ||
2387 | } | 2383 | } |
2388 | dev_kfree_skb_any(np->get_tx_ctx->skb); | 2384 | dev_kfree_skb_any(np->get_tx_ctx->skb); |
2389 | np->get_tx_ctx->skb = NULL; | 2385 | np->get_tx_ctx->skb = NULL; |
@@ -2392,16 +2388,8 @@ static int nv_tx_done(struct net_device *dev, int limit) | |||
2392 | } else { | 2388 | } else { |
2393 | if (flags & NV_TX2_LASTPACKET) { | 2389 | if (flags & NV_TX2_LASTPACKET) { |
2394 | if (flags & NV_TX2_ERROR) { | 2390 | if (flags & NV_TX2_ERROR) { |
2395 | if (flags & NV_TX2_UNDERFLOW) | ||
2396 | dev->stats.tx_fifo_errors++; | ||
2397 | if (flags & NV_TX2_CARRIERLOST) | ||
2398 | dev->stats.tx_carrier_errors++; | ||
2399 | if ((flags & NV_TX2_RETRYERROR) && !(flags & NV_TX2_RETRYCOUNT_MASK)) | 2391 | if ((flags & NV_TX2_RETRYERROR) && !(flags & NV_TX2_RETRYCOUNT_MASK)) |
2400 | nv_legacybackoff_reseed(dev); | 2392 | nv_legacybackoff_reseed(dev); |
2401 | dev->stats.tx_errors++; | ||
2402 | } else { | ||
2403 | dev->stats.tx_packets++; | ||
2404 | dev->stats.tx_bytes += np->get_tx_ctx->skb->len; | ||
2405 | } | 2393 | } |
2406 | dev_kfree_skb_any(np->get_tx_ctx->skb); | 2394 | dev_kfree_skb_any(np->get_tx_ctx->skb); |
2407 | np->get_tx_ctx->skb = NULL; | 2395 | np->get_tx_ctx->skb = NULL; |
@@ -2434,9 +2422,7 @@ static int nv_tx_done_optimized(struct net_device *dev, int limit) | |||
2434 | nv_unmap_txskb(np, np->get_tx_ctx); | 2422 | nv_unmap_txskb(np, np->get_tx_ctx); |
2435 | 2423 | ||
2436 | if (flags & NV_TX2_LASTPACKET) { | 2424 | if (flags & NV_TX2_LASTPACKET) { |
2437 | if (!(flags & NV_TX2_ERROR)) | 2425 | if (flags & NV_TX2_ERROR) { |
2438 | dev->stats.tx_packets++; | ||
2439 | else { | ||
2440 | if ((flags & NV_TX2_RETRYERROR) && !(flags & NV_TX2_RETRYCOUNT_MASK)) { | 2426 | if ((flags & NV_TX2_RETRYERROR) && !(flags & NV_TX2_RETRYCOUNT_MASK)) { |
2441 | if (np->driver_data & DEV_HAS_GEAR_MODE) | 2427 | if (np->driver_data & DEV_HAS_GEAR_MODE) |
2442 | nv_gear_backoff_reseed(dev); | 2428 | nv_gear_backoff_reseed(dev); |
@@ -2636,7 +2622,6 @@ static int nv_rx_process(struct net_device *dev, int limit) | |||
2636 | if ((flags & NV_RX_ERROR_MASK) == NV_RX_ERROR4) { | 2622 | if ((flags & NV_RX_ERROR_MASK) == NV_RX_ERROR4) { |
2637 | len = nv_getlen(dev, skb->data, len); | 2623 | len = nv_getlen(dev, skb->data, len); |
2638 | if (len < 0) { | 2624 | if (len < 0) { |
2639 | dev->stats.rx_errors++; | ||
2640 | dev_kfree_skb(skb); | 2625 | dev_kfree_skb(skb); |
2641 | goto next_pkt; | 2626 | goto next_pkt; |
2642 | } | 2627 | } |
@@ -2650,11 +2635,6 @@ static int nv_rx_process(struct net_device *dev, int limit) | |||
2650 | else { | 2635 | else { |
2651 | if (flags & NV_RX_MISSEDFRAME) | 2636 | if (flags & NV_RX_MISSEDFRAME) |
2652 | dev->stats.rx_missed_errors++; | 2637 | dev->stats.rx_missed_errors++; |
2653 | if (flags & NV_RX_CRCERR) | ||
2654 | dev->stats.rx_crc_errors++; | ||
2655 | if (flags & NV_RX_OVERFLOW) | ||
2656 | dev->stats.rx_over_errors++; | ||
2657 | dev->stats.rx_errors++; | ||
2658 | dev_kfree_skb(skb); | 2638 | dev_kfree_skb(skb); |
2659 | goto next_pkt; | 2639 | goto next_pkt; |
2660 | } | 2640 | } |
@@ -2670,7 +2650,6 @@ static int nv_rx_process(struct net_device *dev, int limit) | |||
2670 | if ((flags & NV_RX2_ERROR_MASK) == NV_RX2_ERROR4) { | 2650 | if ((flags & NV_RX2_ERROR_MASK) == NV_RX2_ERROR4) { |
2671 | len = nv_getlen(dev, skb->data, len); | 2651 | len = nv_getlen(dev, skb->data, len); |
2672 | if (len < 0) { | 2652 | if (len < 0) { |
2673 | dev->stats.rx_errors++; | ||
2674 | dev_kfree_skb(skb); | 2653 | dev_kfree_skb(skb); |
2675 | goto next_pkt; | 2654 | goto next_pkt; |
2676 | } | 2655 | } |
@@ -2682,11 +2661,6 @@ static int nv_rx_process(struct net_device *dev, int limit) | |||
2682 | } | 2661 | } |
2683 | /* the rest are hard errors */ | 2662 | /* the rest are hard errors */ |
2684 | else { | 2663 | else { |
2685 | if (flags & NV_RX2_CRCERR) | ||
2686 | dev->stats.rx_crc_errors++; | ||
2687 | if (flags & NV_RX2_OVERFLOW) | ||
2688 | dev->stats.rx_over_errors++; | ||
2689 | dev->stats.rx_errors++; | ||
2690 | dev_kfree_skb(skb); | 2664 | dev_kfree_skb(skb); |
2691 | goto next_pkt; | 2665 | goto next_pkt; |
2692 | } | 2666 | } |
@@ -2704,7 +2678,6 @@ static int nv_rx_process(struct net_device *dev, int limit) | |||
2704 | skb->protocol = eth_type_trans(skb, dev); | 2678 | skb->protocol = eth_type_trans(skb, dev); |
2705 | napi_gro_receive(&np->napi, skb); | 2679 | napi_gro_receive(&np->napi, skb); |
2706 | dev->stats.rx_packets++; | 2680 | dev->stats.rx_packets++; |
2707 | dev->stats.rx_bytes += len; | ||
2708 | next_pkt: | 2681 | next_pkt: |
2709 | if (unlikely(np->get_rx.orig++ == np->last_rx.orig)) | 2682 | if (unlikely(np->get_rx.orig++ == np->last_rx.orig)) |
2710 | np->get_rx.orig = np->first_rx.orig; | 2683 | np->get_rx.orig = np->first_rx.orig; |
@@ -2787,9 +2760,7 @@ static int nv_rx_process_optimized(struct net_device *dev, int limit) | |||
2787 | __vlan_hwaccel_put_tag(skb, vid); | 2760 | __vlan_hwaccel_put_tag(skb, vid); |
2788 | } | 2761 | } |
2789 | napi_gro_receive(&np->napi, skb); | 2762 | napi_gro_receive(&np->napi, skb); |
2790 | |||
2791 | dev->stats.rx_packets++; | 2763 | dev->stats.rx_packets++; |
2792 | dev->stats.rx_bytes += len; | ||
2793 | } else { | 2764 | } else { |
2794 | dev_kfree_skb(skb); | 2765 | dev_kfree_skb(skb); |
2795 | } | 2766 | } |
@@ -2962,11 +2933,11 @@ static void nv_set_multicast(struct net_device *dev) | |||
2962 | struct netdev_hw_addr *ha; | 2933 | struct netdev_hw_addr *ha; |
2963 | 2934 | ||
2964 | netdev_for_each_mc_addr(ha, dev) { | 2935 | netdev_for_each_mc_addr(ha, dev) { |
2965 | unsigned char *addr = ha->addr; | 2936 | unsigned char *hw_addr = ha->addr; |
2966 | u32 a, b; | 2937 | u32 a, b; |
2967 | 2938 | ||
2968 | a = le32_to_cpu(*(__le32 *) addr); | 2939 | a = le32_to_cpu(*(__le32 *) hw_addr); |
2969 | b = le16_to_cpu(*(__le16 *) (&addr[4])); | 2940 | b = le16_to_cpu(*(__le16 *) (&hw_addr[4])); |
2970 | alwaysOn[0] &= a; | 2941 | alwaysOn[0] &= a; |
2971 | alwaysOff[0] &= ~a; | 2942 | alwaysOff[0] &= ~a; |
2972 | alwaysOn[1] &= b; | 2943 | alwaysOn[1] &= b; |
@@ -3398,7 +3369,8 @@ static irqreturn_t nv_nic_irq_tx(int foo, void *data) | |||
3398 | 3369 | ||
3399 | for (i = 0;; i++) { | 3370 | for (i = 0;; i++) { |
3400 | events = readl(base + NvRegMSIXIrqStatus) & NVREG_IRQ_TX_ALL; | 3371 | events = readl(base + NvRegMSIXIrqStatus) & NVREG_IRQ_TX_ALL; |
3401 | writel(NVREG_IRQ_TX_ALL, base + NvRegMSIXIrqStatus); | 3372 | writel(events, base + NvRegMSIXIrqStatus); |
3373 | netdev_dbg(dev, "tx irq events: %08x\n", events); | ||
3402 | if (!(events & np->irqmask)) | 3374 | if (!(events & np->irqmask)) |
3403 | break; | 3375 | break; |
3404 | 3376 | ||
@@ -3509,7 +3481,8 @@ static irqreturn_t nv_nic_irq_rx(int foo, void *data) | |||
3509 | 3481 | ||
3510 | for (i = 0;; i++) { | 3482 | for (i = 0;; i++) { |
3511 | events = readl(base + NvRegMSIXIrqStatus) & NVREG_IRQ_RX_ALL; | 3483 | events = readl(base + NvRegMSIXIrqStatus) & NVREG_IRQ_RX_ALL; |
3512 | writel(NVREG_IRQ_RX_ALL, base + NvRegMSIXIrqStatus); | 3484 | writel(events, base + NvRegMSIXIrqStatus); |
3485 | netdev_dbg(dev, "rx irq events: %08x\n", events); | ||
3513 | if (!(events & np->irqmask)) | 3486 | if (!(events & np->irqmask)) |
3514 | break; | 3487 | break; |
3515 | 3488 | ||
@@ -3553,7 +3526,8 @@ static irqreturn_t nv_nic_irq_other(int foo, void *data) | |||
3553 | 3526 | ||
3554 | for (i = 0;; i++) { | 3527 | for (i = 0;; i++) { |
3555 | events = readl(base + NvRegMSIXIrqStatus) & NVREG_IRQ_OTHER; | 3528 | events = readl(base + NvRegMSIXIrqStatus) & NVREG_IRQ_OTHER; |
3556 | writel(NVREG_IRQ_OTHER, base + NvRegMSIXIrqStatus); | 3529 | writel(events, base + NvRegMSIXIrqStatus); |
3530 | netdev_dbg(dev, "irq events: %08x\n", events); | ||
3557 | if (!(events & np->irqmask)) | 3531 | if (!(events & np->irqmask)) |
3558 | break; | 3532 | break; |
3559 | 3533 | ||
@@ -3617,10 +3591,10 @@ static irqreturn_t nv_nic_irq_test(int foo, void *data) | |||
3617 | 3591 | ||
3618 | if (!(np->msi_flags & NV_MSI_X_ENABLED)) { | 3592 | if (!(np->msi_flags & NV_MSI_X_ENABLED)) { |
3619 | events = readl(base + NvRegIrqStatus) & NVREG_IRQSTAT_MASK; | 3593 | events = readl(base + NvRegIrqStatus) & NVREG_IRQSTAT_MASK; |
3620 | writel(NVREG_IRQ_TIMER, base + NvRegIrqStatus); | 3594 | writel(events & NVREG_IRQ_TIMER, base + NvRegIrqStatus); |
3621 | } else { | 3595 | } else { |
3622 | events = readl(base + NvRegMSIXIrqStatus) & NVREG_IRQSTAT_MASK; | 3596 | events = readl(base + NvRegMSIXIrqStatus) & NVREG_IRQSTAT_MASK; |
3623 | writel(NVREG_IRQ_TIMER, base + NvRegMSIXIrqStatus); | 3597 | writel(events & NVREG_IRQ_TIMER, base + NvRegMSIXIrqStatus); |
3624 | } | 3598 | } |
3625 | pci_push(base); | 3599 | pci_push(base); |
3626 | if (!(events & NVREG_IRQ_TIMER)) | 3600 | if (!(events & NVREG_IRQ_TIMER)) |
@@ -4566,7 +4540,7 @@ static void nv_get_ethtool_stats(struct net_device *dev, struct ethtool_stats *e | |||
4566 | struct fe_priv *np = netdev_priv(dev); | 4540 | struct fe_priv *np = netdev_priv(dev); |
4567 | 4541 | ||
4568 | /* update stats */ | 4542 | /* update stats */ |
4569 | nv_do_stats_poll((unsigned long)dev); | 4543 | nv_get_hw_stats(dev); |
4570 | 4544 | ||
4571 | memcpy(buffer, &np->estats, nv_get_sset_count(dev, ETH_SS_STATS)*sizeof(u64)); | 4545 | memcpy(buffer, &np->estats, nv_get_sset_count(dev, ETH_SS_STATS)*sizeof(u64)); |
4572 | } | 4546 | } |
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index a3ce3d4561ed..74134970b709 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c | |||
@@ -192,6 +192,13 @@ static rx_handler_result_t macvlan_handle_frame(struct sk_buff **pskb) | |||
192 | */ | 192 | */ |
193 | macvlan_broadcast(skb, port, src->dev, | 193 | macvlan_broadcast(skb, port, src->dev, |
194 | MACVLAN_MODE_VEPA); | 194 | MACVLAN_MODE_VEPA); |
195 | else { | ||
196 | /* forward to original port. */ | ||
197 | vlan = src; | ||
198 | ret = macvlan_broadcast_one(skb, vlan, eth, 0); | ||
199 | goto out; | ||
200 | } | ||
201 | |||
195 | return RX_HANDLER_PASS; | 202 | return RX_HANDLER_PASS; |
196 | } | 203 | } |
197 | 204 | ||
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index 7d6082160bcc..fae0fbd8bc88 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c | |||
@@ -1057,7 +1057,8 @@ netdev_tx_t usbnet_start_xmit (struct sk_buff *skb, | |||
1057 | unsigned long flags; | 1057 | unsigned long flags; |
1058 | int retval; | 1058 | int retval; |
1059 | 1059 | ||
1060 | skb_tx_timestamp(skb); | 1060 | if (skb) |
1061 | skb_tx_timestamp(skb); | ||
1061 | 1062 | ||
1062 | // some devices want funky USB-level framing, for | 1063 | // some devices want funky USB-level framing, for |
1063 | // win32 driver (usually) and/or hardware quirks | 1064 | // win32 driver (usually) and/or hardware quirks |
diff --git a/drivers/net/wireless/ath/ath9k/ar9002_calib.c b/drivers/net/wireless/ath/ath9k/ar9002_calib.c index e0ab0657cc3a..88279e325dca 100644 --- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c +++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c | |||
@@ -868,10 +868,6 @@ static bool ar9002_hw_init_cal(struct ath_hw *ah, struct ath9k_channel *chan) | |||
868 | /* Do PA Calibration */ | 868 | /* Do PA Calibration */ |
869 | ar9002_hw_pa_cal(ah, true); | 869 | ar9002_hw_pa_cal(ah, true); |
870 | 870 | ||
871 | /* Do NF Calibration after DC offset and other calibrations */ | ||
872 | ath9k_hw_loadnf(ah, chan); | ||
873 | ath9k_hw_start_nfcal(ah, true); | ||
874 | |||
875 | if (ah->caldata) | 871 | if (ah->caldata) |
876 | ah->caldata->nfcal_pending = true; | 872 | ah->caldata->nfcal_pending = true; |
877 | 873 | ||
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_calib.c b/drivers/net/wireless/ath/ath9k/ar9003_calib.c index 16851cb109a6..12a730dcb500 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c | |||
@@ -908,12 +908,15 @@ static bool ar9003_hw_rtt_restore(struct ath_hw *ah, struct ath9k_channel *chan) | |||
908 | int i; | 908 | int i; |
909 | bool restore; | 909 | bool restore; |
910 | 910 | ||
911 | if (!(ah->caps.hw_caps & ATH9K_HW_CAP_RTT) || !ah->caldata) | 911 | if (!ah->caldata) |
912 | return false; | 912 | return false; |
913 | 913 | ||
914 | hist = &ah->caldata->rtt_hist; | 914 | hist = &ah->caldata->rtt_hist; |
915 | if (!hist->num_readings) | ||
916 | return false; | ||
917 | |||
915 | ar9003_hw_rtt_enable(ah); | 918 | ar9003_hw_rtt_enable(ah); |
916 | ar9003_hw_rtt_set_mask(ah, 0x10); | 919 | ar9003_hw_rtt_set_mask(ah, 0x00); |
917 | for (i = 0; i < AR9300_MAX_CHAINS; i++) { | 920 | for (i = 0; i < AR9300_MAX_CHAINS; i++) { |
918 | if (!(ah->rxchainmask & (1 << i))) | 921 | if (!(ah->rxchainmask & (1 << i))) |
919 | continue; | 922 | continue; |
@@ -1070,6 +1073,7 @@ skip_tx_iqcal: | |||
1070 | if (is_reusable && (hist->num_readings < RTT_HIST_MAX)) { | 1073 | if (is_reusable && (hist->num_readings < RTT_HIST_MAX)) { |
1071 | u32 *table; | 1074 | u32 *table; |
1072 | 1075 | ||
1076 | hist->num_readings++; | ||
1073 | for (i = 0; i < AR9300_MAX_CHAINS; i++) { | 1077 | for (i = 0; i < AR9300_MAX_CHAINS; i++) { |
1074 | if (!(ah->rxchainmask & (1 << i))) | 1078 | if (!(ah->rxchainmask & (1 << i))) |
1075 | continue; | 1079 | continue; |
@@ -1081,9 +1085,6 @@ skip_tx_iqcal: | |||
1081 | ar9003_hw_rtt_disable(ah); | 1085 | ar9003_hw_rtt_disable(ah); |
1082 | } | 1086 | } |
1083 | 1087 | ||
1084 | ath9k_hw_loadnf(ah, chan); | ||
1085 | ath9k_hw_start_nfcal(ah, true); | ||
1086 | |||
1087 | /* Initialize list pointers */ | 1088 | /* Initialize list pointers */ |
1088 | ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL; | 1089 | ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL; |
1089 | ah->supp_cals = IQ_MISMATCH_CAL; | 1090 | ah->supp_cals = IQ_MISMATCH_CAL; |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.h b/drivers/net/wireless/ath/ath9k/ar9003_phy.h index 2f4023e66081..4114fe752c6b 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.h +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.h | |||
@@ -572,14 +572,14 @@ | |||
572 | 572 | ||
573 | #define AR_PHY_TXGAIN_TABLE (AR_SM_BASE + 0x300) | 573 | #define AR_PHY_TXGAIN_TABLE (AR_SM_BASE + 0x300) |
574 | 574 | ||
575 | #define AR_PHY_TX_IQCAL_CONTROL_0 (AR_SM_BASE + AR_SREV_9485(ah) ? \ | 575 | #define AR_PHY_TX_IQCAL_CONTROL_0 (AR_SM_BASE + (AR_SREV_9485(ah) ? \ |
576 | 0x3c4 : 0x444) | 576 | 0x3c4 : 0x444)) |
577 | #define AR_PHY_TX_IQCAL_CONTROL_1 (AR_SM_BASE + AR_SREV_9485(ah) ? \ | 577 | #define AR_PHY_TX_IQCAL_CONTROL_1 (AR_SM_BASE + (AR_SREV_9485(ah) ? \ |
578 | 0x3c8 : 0x448) | 578 | 0x3c8 : 0x448)) |
579 | #define AR_PHY_TX_IQCAL_START (AR_SM_BASE + AR_SREV_9485(ah) ? \ | 579 | #define AR_PHY_TX_IQCAL_START (AR_SM_BASE + (AR_SREV_9485(ah) ? \ |
580 | 0x3c4 : 0x440) | 580 | 0x3c4 : 0x440)) |
581 | #define AR_PHY_TX_IQCAL_STATUS_B0 (AR_SM_BASE + AR_SREV_9485(ah) ? \ | 581 | #define AR_PHY_TX_IQCAL_STATUS_B0 (AR_SM_BASE + (AR_SREV_9485(ah) ? \ |
582 | 0x3f0 : 0x48c) | 582 | 0x3f0 : 0x48c)) |
583 | #define AR_PHY_TX_IQCAL_CORR_COEFF_B0(_i) (AR_SM_BASE + \ | 583 | #define AR_PHY_TX_IQCAL_CORR_COEFF_B0(_i) (AR_SM_BASE + \ |
584 | (AR_SREV_9485(ah) ? \ | 584 | (AR_SREV_9485(ah) ? \ |
585 | 0x3d0 : 0x450) + ((_i) << 2)) | 585 | 0x3d0 : 0x450) + ((_i) << 2)) |
@@ -651,7 +651,7 @@ | |||
651 | #define AR_SWITCH_TABLE_ALL_S (0) | 651 | #define AR_SWITCH_TABLE_ALL_S (0) |
652 | 652 | ||
653 | #define AR_PHY_65NM_CH0_THERM (AR_SREV_9300(ah) ? 0x16290 :\ | 653 | #define AR_PHY_65NM_CH0_THERM (AR_SREV_9300(ah) ? 0x16290 :\ |
654 | (AR_SREV_9485(ah) ? 0x1628c : 0x16294)) | 654 | (AR_SREV_9462(ah) ? 0x16294 : 0x1628c)) |
655 | 655 | ||
656 | #define AR_PHY_65NM_CH0_THERM_LOCAL 0x80000000 | 656 | #define AR_PHY_65NM_CH0_THERM_LOCAL 0x80000000 |
657 | #define AR_PHY_65NM_CH0_THERM_LOCAL_S 31 | 657 | #define AR_PHY_65NM_CH0_THERM_LOCAL_S 31 |
@@ -668,12 +668,12 @@ | |||
668 | #define AR_PHY_65NM_CH2_RXTX2 0x16904 | 668 | #define AR_PHY_65NM_CH2_RXTX2 0x16904 |
669 | 669 | ||
670 | #define AR_CH0_TOP2 (AR_SREV_9300(ah) ? 0x1628c : \ | 670 | #define AR_CH0_TOP2 (AR_SREV_9300(ah) ? 0x1628c : \ |
671 | (AR_SREV_9485(ah) ? 0x16284 : 0x16290)) | 671 | (AR_SREV_9462(ah) ? 0x16290 : 0x16284)) |
672 | #define AR_CH0_TOP2_XPABIASLVL 0xf000 | 672 | #define AR_CH0_TOP2_XPABIASLVL 0xf000 |
673 | #define AR_CH0_TOP2_XPABIASLVL_S 12 | 673 | #define AR_CH0_TOP2_XPABIASLVL_S 12 |
674 | 674 | ||
675 | #define AR_CH0_XTAL (AR_SREV_9300(ah) ? 0x16294 : \ | 675 | #define AR_CH0_XTAL (AR_SREV_9300(ah) ? 0x16294 : \ |
676 | (AR_SREV_9485(ah) ? 0x16290 : 0x16298)) | 676 | (AR_SREV_9462(ah) ? 0x16298 : 0x16290)) |
677 | #define AR_CH0_XTAL_CAPINDAC 0x7f000000 | 677 | #define AR_CH0_XTAL_CAPINDAC 0x7f000000 |
678 | #define AR_CH0_XTAL_CAPINDAC_S 24 | 678 | #define AR_CH0_XTAL_CAPINDAC_S 24 |
679 | #define AR_CH0_XTAL_CAPOUTDAC 0x00fe0000 | 679 | #define AR_CH0_XTAL_CAPOUTDAC 0x00fe0000 |
@@ -908,8 +908,8 @@ | |||
908 | #define AR_PHY_TPC_5_B1 (AR_SM1_BASE + 0x208) | 908 | #define AR_PHY_TPC_5_B1 (AR_SM1_BASE + 0x208) |
909 | #define AR_PHY_TPC_6_B1 (AR_SM1_BASE + 0x20c) | 909 | #define AR_PHY_TPC_6_B1 (AR_SM1_BASE + 0x20c) |
910 | #define AR_PHY_TPC_11_B1 (AR_SM1_BASE + 0x220) | 910 | #define AR_PHY_TPC_11_B1 (AR_SM1_BASE + 0x220) |
911 | #define AR_PHY_PDADC_TAB_1 (AR_SM1_BASE + (AR_SREV_AR9300(ah) ? \ | 911 | #define AR_PHY_PDADC_TAB_1 (AR_SM1_BASE + (AR_SREV_AR9462(ah) ? \ |
912 | 0x240 : 0x280)) | 912 | 0x280 : 0x240)) |
913 | #define AR_PHY_TPC_19_B1 (AR_SM1_BASE + 0x240) | 913 | #define AR_PHY_TPC_19_B1 (AR_SM1_BASE + 0x240) |
914 | #define AR_PHY_TPC_19_B1_ALPHA_THERM 0xff | 914 | #define AR_PHY_TPC_19_B1_ALPHA_THERM 0xff |
915 | #define AR_PHY_TPC_19_B1_ALPHA_THERM_S 0 | 915 | #define AR_PHY_TPC_19_B1_ALPHA_THERM_S 0 |
@@ -931,10 +931,10 @@ | |||
931 | #define AR_PHY_AIC_SRAM_ADDR_B1 (AR_SM1_BASE + 0x5f0) | 931 | #define AR_PHY_AIC_SRAM_ADDR_B1 (AR_SM1_BASE + 0x5f0) |
932 | #define AR_PHY_AIC_SRAM_DATA_B1 (AR_SM1_BASE + 0x5f4) | 932 | #define AR_PHY_AIC_SRAM_DATA_B1 (AR_SM1_BASE + 0x5f4) |
933 | 933 | ||
934 | #define AR_PHY_RTT_TABLE_SW_INTF_B(i) (0x384 + (i) ? \ | 934 | #define AR_PHY_RTT_TABLE_SW_INTF_B(i) (0x384 + ((i) ? \ |
935 | AR_SM1_BASE : AR_SM_BASE) | 935 | AR_SM1_BASE : AR_SM_BASE)) |
936 | #define AR_PHY_RTT_TABLE_SW_INTF_1_B(i) (0x388 + (i) ? \ | 936 | #define AR_PHY_RTT_TABLE_SW_INTF_1_B(i) (0x388 + ((i) ? \ |
937 | AR_SM1_BASE : AR_SM_BASE) | 937 | AR_SM1_BASE : AR_SM_BASE)) |
938 | /* | 938 | /* |
939 | * Channel 2 Register Map | 939 | * Channel 2 Register Map |
940 | */ | 940 | */ |
diff --git a/drivers/net/wireless/ath/ath9k/ar9485_initvals.h b/drivers/net/wireless/ath/ath9k/ar9485_initvals.h index 611ea6ce8508..d16d029f81a9 100644 --- a/drivers/net/wireless/ath/ath9k/ar9485_initvals.h +++ b/drivers/net/wireless/ath/ath9k/ar9485_initvals.h | |||
@@ -521,7 +521,7 @@ static const u32 ar9485_1_1_radio_postamble[][2] = { | |||
521 | {0x000160ac, 0x24611800}, | 521 | {0x000160ac, 0x24611800}, |
522 | {0x000160b0, 0x03284f3e}, | 522 | {0x000160b0, 0x03284f3e}, |
523 | {0x0001610c, 0x00170000}, | 523 | {0x0001610c, 0x00170000}, |
524 | {0x00016140, 0x10804008}, | 524 | {0x00016140, 0x50804008}, |
525 | }; | 525 | }; |
526 | 526 | ||
527 | static const u32 ar9485_1_1_mac_postamble[][5] = { | 527 | static const u32 ar9485_1_1_mac_postamble[][5] = { |
@@ -603,7 +603,7 @@ static const u32 ar9485_1_1_radio_core[][2] = { | |||
603 | 603 | ||
604 | static const u32 ar9485_1_1_pcie_phy_pll_on_clkreq_enable_L1[][2] = { | 604 | static const u32 ar9485_1_1_pcie_phy_pll_on_clkreq_enable_L1[][2] = { |
605 | /* Addr allmodes */ | 605 | /* Addr allmodes */ |
606 | {0x00018c00, 0x10052e5e}, | 606 | {0x00018c00, 0x18052e5e}, |
607 | {0x00018c04, 0x000801d8}, | 607 | {0x00018c04, 0x000801d8}, |
608 | {0x00018c08, 0x0000080c}, | 608 | {0x00018c08, 0x0000080c}, |
609 | }; | 609 | }; |
@@ -776,7 +776,7 @@ static const u32 ar9485_modes_green_ob_db_tx_gain_1_1[][5] = { | |||
776 | 776 | ||
777 | static const u32 ar9485_1_1_pcie_phy_clkreq_disable_L1[][2] = { | 777 | static const u32 ar9485_1_1_pcie_phy_clkreq_disable_L1[][2] = { |
778 | /* Addr allmodes */ | 778 | /* Addr allmodes */ |
779 | {0x00018c00, 0x10013e5e}, | 779 | {0x00018c00, 0x18013e5e}, |
780 | {0x00018c04, 0x000801d8}, | 780 | {0x00018c04, 0x000801d8}, |
781 | {0x00018c08, 0x0000080c}, | 781 | {0x00018c08, 0x0000080c}, |
782 | }; | 782 | }; |
@@ -882,7 +882,7 @@ static const u32 ar9485_fast_clock_1_1_baseband_postamble[][3] = { | |||
882 | 882 | ||
883 | static const u32 ar9485_1_1_pcie_phy_pll_on_clkreq_disable_L1[][2] = { | 883 | static const u32 ar9485_1_1_pcie_phy_pll_on_clkreq_disable_L1[][2] = { |
884 | /* Addr allmodes */ | 884 | /* Addr allmodes */ |
885 | {0x00018c00, 0x10012e5e}, | 885 | {0x00018c00, 0x18012e5e}, |
886 | {0x00018c04, 0x000801d8}, | 886 | {0x00018c04, 0x000801d8}, |
887 | {0x00018c08, 0x0000080c}, | 887 | {0x00018c08, 0x0000080c}, |
888 | }; | 888 | }; |
@@ -1021,7 +1021,7 @@ static const u32 ar9485_common_rx_gain_1_1[][2] = { | |||
1021 | 1021 | ||
1022 | static const u32 ar9485_1_1_pcie_phy_clkreq_enable_L1[][2] = { | 1022 | static const u32 ar9485_1_1_pcie_phy_clkreq_enable_L1[][2] = { |
1023 | /* Addr allmodes */ | 1023 | /* Addr allmodes */ |
1024 | {0x00018c00, 0x10053e5e}, | 1024 | {0x00018c00, 0x18053e5e}, |
1025 | {0x00018c04, 0x000801d8}, | 1025 | {0x00018c04, 0x000801d8}, |
1026 | {0x00018c08, 0x0000080c}, | 1026 | {0x00018c08, 0x0000080c}, |
1027 | }; | 1027 | }; |
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index 4952ad8c4e8c..2f91acccb7db 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
@@ -1725,6 +1725,9 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan, | |||
1725 | if (!ath9k_hw_init_cal(ah, chan)) | 1725 | if (!ath9k_hw_init_cal(ah, chan)) |
1726 | return -EIO; | 1726 | return -EIO; |
1727 | 1727 | ||
1728 | ath9k_hw_loadnf(ah, chan); | ||
1729 | ath9k_hw_start_nfcal(ah, true); | ||
1730 | |||
1728 | ENABLE_REGWRITE_BUFFER(ah); | 1731 | ENABLE_REGWRITE_BUFFER(ah); |
1729 | 1732 | ||
1730 | ath9k_hw_restore_chainmask(ah); | 1733 | ath9k_hw_restore_chainmask(ah); |
diff --git a/drivers/net/wireless/ath/carl9170/tx.c b/drivers/net/wireless/ath/carl9170/tx.c index d20946939cd8..59472e1605cd 100644 --- a/drivers/net/wireless/ath/carl9170/tx.c +++ b/drivers/net/wireless/ath/carl9170/tx.c | |||
@@ -296,7 +296,8 @@ static void carl9170_tx_release(struct kref *ref) | |||
296 | super = (void *)skb->data; | 296 | super = (void *)skb->data; |
297 | txinfo->status.ampdu_len = super->s.rix; | 297 | txinfo->status.ampdu_len = super->s.rix; |
298 | txinfo->status.ampdu_ack_len = super->s.cnt; | 298 | txinfo->status.ampdu_ack_len = super->s.cnt; |
299 | } else if (txinfo->flags & IEEE80211_TX_STAT_ACK) { | 299 | } else if ((txinfo->flags & IEEE80211_TX_STAT_ACK) && |
300 | !(txinfo->flags & IEEE80211_TX_CTL_REQ_TX_STATUS)) { | ||
300 | /* | 301 | /* |
301 | * drop redundant tx_status reports: | 302 | * drop redundant tx_status reports: |
302 | * | 303 | * |
@@ -308,15 +309,17 @@ static void carl9170_tx_release(struct kref *ref) | |||
308 | * | 309 | * |
309 | * 3. minstrel_ht is picky, it only accepts | 310 | * 3. minstrel_ht is picky, it only accepts |
310 | * reports of frames with the TX_STATUS_AMPDU flag. | 311 | * reports of frames with the TX_STATUS_AMPDU flag. |
312 | * | ||
313 | * 4. mac80211 is not particularly interested in | ||
314 | * feedback either [CTL_REQ_TX_STATUS not set] | ||
311 | */ | 315 | */ |
312 | 316 | ||
313 | dev_kfree_skb_any(skb); | 317 | dev_kfree_skb_any(skb); |
314 | return; | 318 | return; |
315 | } else { | 319 | } else { |
316 | /* | 320 | /* |
317 | * Frame has failed, but we want to keep it in | 321 | * Either the frame transmission has failed or |
318 | * case it was lost due to a power-state | 322 | * mac80211 requested tx status. |
319 | * transition. | ||
320 | */ | 323 | */ |
321 | } | 324 | } |
322 | } | 325 | } |
diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c index c73e8600d218..58ea0e5fabfd 100644 --- a/drivers/net/wireless/b43/xmit.c +++ b/drivers/net/wireless/b43/xmit.c | |||
@@ -827,7 +827,6 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr) | |||
827 | #endif | 827 | #endif |
828 | return; | 828 | return; |
829 | drop: | 829 | drop: |
830 | b43dbg(dev->wl, "RX: Packet dropped\n"); | ||
831 | dev_kfree_skb_any(skb); | 830 | dev_kfree_skb_any(skb); |
832 | } | 831 | } |
833 | 832 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c index b247a56d5135..001fdf140abb 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.c +++ b/drivers/net/wireless/iwlwifi/iwl-core.c | |||
@@ -1755,16 +1755,6 @@ static inline int iwl_check_stuck_queue(struct iwl_priv *priv, int txq) | |||
1755 | { | 1755 | { |
1756 | if (iwl_trans_check_stuck_queue(trans(priv), txq)) { | 1756 | if (iwl_trans_check_stuck_queue(trans(priv), txq)) { |
1757 | int ret; | 1757 | int ret; |
1758 | if (txq == priv->shrd->cmd_queue) { | ||
1759 | /* | ||
1760 | * validate command queue still working | ||
1761 | * by sending "ECHO" command | ||
1762 | */ | ||
1763 | if (!iwl_cmd_echo_test(priv)) | ||
1764 | return 0; | ||
1765 | else | ||
1766 | IWL_DEBUG_HC(priv, "echo testing fail\n"); | ||
1767 | } | ||
1768 | ret = iwl_force_reset(priv, IWL_FW_RESET, false); | 1758 | ret = iwl_force_reset(priv, IWL_FW_RESET, false); |
1769 | return (ret == -EAGAIN) ? 0 : 1; | 1759 | return (ret == -EAGAIN) ? 0 : 1; |
1770 | } | 1760 | } |
diff --git a/drivers/net/wireless/iwlwifi/iwl-pci.c b/drivers/net/wireless/iwlwifi/iwl-pci.c index f0c623ade3ff..1800029911ad 100644 --- a/drivers/net/wireless/iwlwifi/iwl-pci.c +++ b/drivers/net/wireless/iwlwifi/iwl-pci.c | |||
@@ -446,10 +446,9 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
446 | pci_write_config_byte(pdev, PCI_CFG_RETRY_TIMEOUT, 0x00); | 446 | pci_write_config_byte(pdev, PCI_CFG_RETRY_TIMEOUT, 0x00); |
447 | 447 | ||
448 | err = pci_enable_msi(pdev); | 448 | err = pci_enable_msi(pdev); |
449 | if (err) { | 449 | if (err) |
450 | dev_printk(KERN_ERR, &pdev->dev, "pci_enable_msi failed"); | 450 | dev_printk(KERN_ERR, &pdev->dev, |
451 | goto out_iounmap; | 451 | "pci_enable_msi failed(0X%x)", err); |
452 | } | ||
453 | 452 | ||
454 | /* TODO: Move this away, not needed if not MSI */ | 453 | /* TODO: Move this away, not needed if not MSI */ |
455 | /* enable rfkill interrupt: hw bug w/a */ | 454 | /* enable rfkill interrupt: hw bug w/a */ |
@@ -470,7 +469,6 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
470 | 469 | ||
471 | out_disable_msi: | 470 | out_disable_msi: |
472 | pci_disable_msi(pdev); | 471 | pci_disable_msi(pdev); |
473 | out_iounmap: | ||
474 | pci_iounmap(pdev, pci_bus->hw_base); | 472 | pci_iounmap(pdev, pci_bus->hw_base); |
475 | out_pci_release_regions: | 473 | out_pci_release_regions: |
476 | pci_set_drvdata(pdev, NULL); | 474 | pci_set_drvdata(pdev, NULL); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c index 8e8c75c997ee..da3411057afc 100644 --- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c +++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c | |||
@@ -407,6 +407,7 @@ static void iwl_tx_queue_unmap(struct iwl_trans *trans, int txq_id) | |||
407 | struct iwl_queue *q = &txq->q; | 407 | struct iwl_queue *q = &txq->q; |
408 | enum dma_data_direction dma_dir; | 408 | enum dma_data_direction dma_dir; |
409 | unsigned long flags; | 409 | unsigned long flags; |
410 | spinlock_t *lock; | ||
410 | 411 | ||
411 | if (!q->n_bd) | 412 | if (!q->n_bd) |
412 | return; | 413 | return; |
@@ -414,19 +415,22 @@ static void iwl_tx_queue_unmap(struct iwl_trans *trans, int txq_id) | |||
414 | /* In the command queue, all the TBs are mapped as BIDI | 415 | /* In the command queue, all the TBs are mapped as BIDI |
415 | * so unmap them as such. | 416 | * so unmap them as such. |
416 | */ | 417 | */ |
417 | if (txq_id == trans->shrd->cmd_queue) | 418 | if (txq_id == trans->shrd->cmd_queue) { |
418 | dma_dir = DMA_BIDIRECTIONAL; | 419 | dma_dir = DMA_BIDIRECTIONAL; |
419 | else | 420 | lock = &trans->hcmd_lock; |
421 | } else { | ||
420 | dma_dir = DMA_TO_DEVICE; | 422 | dma_dir = DMA_TO_DEVICE; |
423 | lock = &trans->shrd->sta_lock; | ||
424 | } | ||
421 | 425 | ||
422 | spin_lock_irqsave(&trans->shrd->sta_lock, flags); | 426 | spin_lock_irqsave(lock, flags); |
423 | while (q->write_ptr != q->read_ptr) { | 427 | while (q->write_ptr != q->read_ptr) { |
424 | /* The read_ptr needs to bound by q->n_window */ | 428 | /* The read_ptr needs to bound by q->n_window */ |
425 | iwlagn_txq_free_tfd(trans, txq, get_cmd_index(q, q->read_ptr), | 429 | iwlagn_txq_free_tfd(trans, txq, get_cmd_index(q, q->read_ptr), |
426 | dma_dir); | 430 | dma_dir); |
427 | q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd); | 431 | q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd); |
428 | } | 432 | } |
429 | spin_unlock_irqrestore(&trans->shrd->sta_lock, flags); | 433 | spin_unlock_irqrestore(lock, flags); |
430 | } | 434 | } |
431 | 435 | ||
432 | /** | 436 | /** |
diff --git a/drivers/net/wireless/libertas/cfg.c b/drivers/net/wireless/libertas/cfg.c index ff6378276ff0..4fcd653bddc4 100644 --- a/drivers/net/wireless/libertas/cfg.c +++ b/drivers/net/wireless/libertas/cfg.c | |||
@@ -728,15 +728,9 @@ static void lbs_scan_worker(struct work_struct *work) | |||
728 | le16_to_cpu(scan_cmd->hdr.size), | 728 | le16_to_cpu(scan_cmd->hdr.size), |
729 | lbs_ret_scan, 0); | 729 | lbs_ret_scan, 0); |
730 | 730 | ||
731 | if (priv->scan_channel >= priv->scan_req->n_channels) { | 731 | if (priv->scan_channel >= priv->scan_req->n_channels) |
732 | /* Mark scan done */ | 732 | /* Mark scan done */ |
733 | if (priv->internal_scan) | 733 | lbs_scan_done(priv); |
734 | kfree(priv->scan_req); | ||
735 | else | ||
736 | cfg80211_scan_done(priv->scan_req, false); | ||
737 | |||
738 | priv->scan_req = NULL; | ||
739 | } | ||
740 | 734 | ||
741 | /* Restart network */ | 735 | /* Restart network */ |
742 | if (carrier) | 736 | if (carrier) |
@@ -774,6 +768,21 @@ static void _internal_start_scan(struct lbs_private *priv, bool internal, | |||
774 | lbs_deb_leave(LBS_DEB_CFG80211); | 768 | lbs_deb_leave(LBS_DEB_CFG80211); |
775 | } | 769 | } |
776 | 770 | ||
771 | /* | ||
772 | * Clean up priv->scan_req. Should be used to handle the allocation details. | ||
773 | */ | ||
774 | void lbs_scan_done(struct lbs_private *priv) | ||
775 | { | ||
776 | WARN_ON(!priv->scan_req); | ||
777 | |||
778 | if (priv->internal_scan) | ||
779 | kfree(priv->scan_req); | ||
780 | else | ||
781 | cfg80211_scan_done(priv->scan_req, false); | ||
782 | |||
783 | priv->scan_req = NULL; | ||
784 | } | ||
785 | |||
777 | static int lbs_cfg_scan(struct wiphy *wiphy, | 786 | static int lbs_cfg_scan(struct wiphy *wiphy, |
778 | struct net_device *dev, | 787 | struct net_device *dev, |
779 | struct cfg80211_scan_request *request) | 788 | struct cfg80211_scan_request *request) |
diff --git a/drivers/net/wireless/libertas/cfg.h b/drivers/net/wireless/libertas/cfg.h index a02ee151710e..558168ce634d 100644 --- a/drivers/net/wireless/libertas/cfg.h +++ b/drivers/net/wireless/libertas/cfg.h | |||
@@ -16,6 +16,7 @@ int lbs_reg_notifier(struct wiphy *wiphy, | |||
16 | void lbs_send_disconnect_notification(struct lbs_private *priv); | 16 | void lbs_send_disconnect_notification(struct lbs_private *priv); |
17 | void lbs_send_mic_failureevent(struct lbs_private *priv, u32 event); | 17 | void lbs_send_mic_failureevent(struct lbs_private *priv, u32 event); |
18 | 18 | ||
19 | void lbs_scan_done(struct lbs_private *priv); | ||
19 | void lbs_scan_deinit(struct lbs_private *priv); | 20 | void lbs_scan_deinit(struct lbs_private *priv); |
20 | int lbs_disconnect(struct lbs_private *priv, u16 reason); | 21 | int lbs_disconnect(struct lbs_private *priv, u16 reason); |
21 | 22 | ||
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index 4ae99a40dbf7..957681dede17 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c | |||
@@ -255,10 +255,8 @@ static int lbs_eth_stop(struct net_device *dev) | |||
255 | 255 | ||
256 | lbs_update_mcast(priv); | 256 | lbs_update_mcast(priv); |
257 | cancel_delayed_work_sync(&priv->scan_work); | 257 | cancel_delayed_work_sync(&priv->scan_work); |
258 | if (priv->scan_req) { | 258 | if (priv->scan_req) |
259 | cfg80211_scan_done(priv->scan_req, false); | 259 | lbs_scan_done(priv); |
260 | priv->scan_req = NULL; | ||
261 | } | ||
262 | 260 | ||
263 | netif_carrier_off(priv->dev); | 261 | netif_carrier_off(priv->dev); |
264 | 262 | ||