aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/cassini.c
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /drivers/net/cassini.c
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'drivers/net/cassini.c')
-rw-r--r--drivers/net/cassini.c69
1 files changed, 43 insertions, 26 deletions
diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c
index 28c88eeec757..22ce03e55b83 100644
--- a/drivers/net/cassini.c
+++ b/drivers/net/cassini.c
@@ -51,7 +51,7 @@
51 * TX has 4 queues. currently these queues are used in a round-robin 51 * TX has 4 queues. currently these queues are used in a round-robin
52 * fashion for load balancing. They can also be used for QoS. for that 52 * fashion for load balancing. They can also be used for QoS. for that
53 * to work, however, QoS information needs to be exposed down to the driver 53 * to work, however, QoS information needs to be exposed down to the driver
54 * level so that subqueues get targetted to particular transmit rings. 54 * level so that subqueues get targeted to particular transmit rings.
55 * alternatively, the queues can be configured via use of the all-purpose 55 * alternatively, the queues can be configured via use of the all-purpose
56 * ioctl. 56 * ioctl.
57 * 57 *
@@ -419,7 +419,7 @@ static u16 cas_phy_read(struct cas *cp, int reg)
419 udelay(10); 419 udelay(10);
420 cmd = readl(cp->regs + REG_MIF_FRAME); 420 cmd = readl(cp->regs + REG_MIF_FRAME);
421 if (cmd & MIF_FRAME_TURN_AROUND_LSB) 421 if (cmd & MIF_FRAME_TURN_AROUND_LSB)
422 return (cmd & MIF_FRAME_DATA_MASK); 422 return cmd & MIF_FRAME_DATA_MASK;
423 } 423 }
424 return 0xFFFF; /* -1 */ 424 return 0xFFFF; /* -1 */
425} 425}
@@ -709,10 +709,11 @@ static void cas_begin_auto_negotiation(struct cas *cp, struct ethtool_cmd *ep)
709 if (ep->autoneg == AUTONEG_ENABLE) 709 if (ep->autoneg == AUTONEG_ENABLE)
710 cp->link_cntl = BMCR_ANENABLE; 710 cp->link_cntl = BMCR_ANENABLE;
711 else { 711 else {
712 u32 speed = ethtool_cmd_speed(ep);
712 cp->link_cntl = 0; 713 cp->link_cntl = 0;
713 if (ep->speed == SPEED_100) 714 if (speed == SPEED_100)
714 cp->link_cntl |= BMCR_SPEED100; 715 cp->link_cntl |= BMCR_SPEED100;
715 else if (ep->speed == SPEED_1000) 716 else if (speed == SPEED_1000)
716 cp->link_cntl |= CAS_BMCR_SPEED1000; 717 cp->link_cntl |= CAS_BMCR_SPEED1000;
717 if (ep->duplex == DUPLEX_FULL) 718 if (ep->duplex == DUPLEX_FULL)
718 cp->link_cntl |= BMCR_FULLDPLX; 719 cp->link_cntl |= BMCR_FULLDPLX;
@@ -804,7 +805,7 @@ static int cas_reset_mii_phy(struct cas *cp)
804 break; 805 break;
805 udelay(10); 806 udelay(10);
806 } 807 }
807 return (limit <= 0); 808 return limit <= 0;
808} 809}
809 810
810static int cas_saturn_firmware_init(struct cas *cp) 811static int cas_saturn_firmware_init(struct cas *cp)
@@ -2149,7 +2150,7 @@ end_copy_pkt:
2149 skb->csum = csum_unfold(~csum); 2150 skb->csum = csum_unfold(~csum);
2150 skb->ip_summed = CHECKSUM_COMPLETE; 2151 skb->ip_summed = CHECKSUM_COMPLETE;
2151 } else 2152 } else
2152 skb->ip_summed = CHECKSUM_NONE; 2153 skb_checksum_none_assert(skb);
2153 return len; 2154 return len;
2154} 2155}
2155 2156
@@ -2788,7 +2789,7 @@ static inline int cas_xmit_tx_ringN(struct cas *cp, int ring,
2788 2789
2789 ctrl = 0; 2790 ctrl = 0;
2790 if (skb->ip_summed == CHECKSUM_PARTIAL) { 2791 if (skb->ip_summed == CHECKSUM_PARTIAL) {
2791 const u64 csum_start_off = skb_transport_offset(skb); 2792 const u64 csum_start_off = skb_checksum_start_offset(skb);
2792 const u64 csum_stuff_off = csum_start_off + skb->csum_offset; 2793 const u64 csum_stuff_off = csum_start_off + skb->csum_offset;
2793 2794
2794 ctrl = TX_DESC_CSUM_EN | 2795 ctrl = TX_DESC_CSUM_EN |
@@ -3203,6 +3204,10 @@ static int cas_get_vpd_info(struct cas *cp, unsigned char *dev_addr,
3203 int phy_type = CAS_PHY_MII_MDIO0; /* default phy type */ 3204 int phy_type = CAS_PHY_MII_MDIO0; /* default phy type */
3204 int mac_off = 0; 3205 int mac_off = 0;
3205 3206
3207#if defined(CONFIG_SPARC)
3208 const unsigned char *addr;
3209#endif
3210
3206 /* give us access to the PROM */ 3211 /* give us access to the PROM */
3207 writel(BIM_LOCAL_DEV_PROM | BIM_LOCAL_DEV_PAD, 3212 writel(BIM_LOCAL_DEV_PROM | BIM_LOCAL_DEV_PAD,
3208 cp->regs + REG_BIM_LOCAL_DEV_EN); 3213 cp->regs + REG_BIM_LOCAL_DEV_EN);
@@ -3350,6 +3355,14 @@ use_random_mac_addr:
3350 if (found & VPD_FOUND_MAC) 3355 if (found & VPD_FOUND_MAC)
3351 goto done; 3356 goto done;
3352 3357
3358#if defined(CONFIG_SPARC)
3359 addr = of_get_property(cp->of_node, "local-mac-address", NULL);
3360 if (addr != NULL) {
3361 memcpy(dev_addr, addr, 6);
3362 goto done;
3363 }
3364#endif
3365
3353 /* Sun MAC prefix then 3 random bytes. */ 3366 /* Sun MAC prefix then 3 random bytes. */
3354 pr_info("MAC address not found in ROM VPD\n"); 3367 pr_info("MAC address not found in ROM VPD\n");
3355 dev_addr[0] = 0x08; 3368 dev_addr[0] = 0x08;
@@ -3880,7 +3893,7 @@ static int cas_change_mtu(struct net_device *dev, int new_mtu)
3880 schedule_work(&cp->reset_task); 3893 schedule_work(&cp->reset_task);
3881#endif 3894#endif
3882 3895
3883 flush_scheduled_work(); 3896 flush_work_sync(&cp->reset_task);
3884 return 0; 3897 return 0;
3885} 3898}
3886 3899
@@ -4593,18 +4606,17 @@ static int cas_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
4593 if (bmcr & BMCR_ANENABLE) { 4606 if (bmcr & BMCR_ANENABLE) {
4594 cmd->advertising |= ADVERTISED_Autoneg; 4607 cmd->advertising |= ADVERTISED_Autoneg;
4595 cmd->autoneg = AUTONEG_ENABLE; 4608 cmd->autoneg = AUTONEG_ENABLE;
4596 cmd->speed = ((speed == 10) ? 4609 ethtool_cmd_speed_set(cmd, ((speed == 10) ?
4597 SPEED_10 : 4610 SPEED_10 :
4598 ((speed == 1000) ? 4611 ((speed == 1000) ?
4599 SPEED_1000 : SPEED_100)); 4612 SPEED_1000 : SPEED_100)));
4600 cmd->duplex = full_duplex ? DUPLEX_FULL : DUPLEX_HALF; 4613 cmd->duplex = full_duplex ? DUPLEX_FULL : DUPLEX_HALF;
4601 } else { 4614 } else {
4602 cmd->autoneg = AUTONEG_DISABLE; 4615 cmd->autoneg = AUTONEG_DISABLE;
4603 cmd->speed = 4616 ethtool_cmd_speed_set(cmd, ((bmcr & CAS_BMCR_SPEED1000) ?
4604 (bmcr & CAS_BMCR_SPEED1000) ? 4617 SPEED_1000 :
4605 SPEED_1000 : 4618 ((bmcr & BMCR_SPEED100) ?
4606 ((bmcr & BMCR_SPEED100) ? SPEED_100: 4619 SPEED_100 : SPEED_10)));
4607 SPEED_10);
4608 cmd->duplex = 4620 cmd->duplex =
4609 (bmcr & BMCR_FULLDPLX) ? 4621 (bmcr & BMCR_FULLDPLX) ?
4610 DUPLEX_FULL : DUPLEX_HALF; 4622 DUPLEX_FULL : DUPLEX_HALF;
@@ -4621,14 +4633,14 @@ static int cas_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
4621 * settings that we configured. 4633 * settings that we configured.
4622 */ 4634 */
4623 if (cp->link_cntl & BMCR_ANENABLE) { 4635 if (cp->link_cntl & BMCR_ANENABLE) {
4624 cmd->speed = 0; 4636 ethtool_cmd_speed_set(cmd, 0);
4625 cmd->duplex = 0xff; 4637 cmd->duplex = 0xff;
4626 } else { 4638 } else {
4627 cmd->speed = SPEED_10; 4639 ethtool_cmd_speed_set(cmd, SPEED_10);
4628 if (cp->link_cntl & BMCR_SPEED100) { 4640 if (cp->link_cntl & BMCR_SPEED100) {
4629 cmd->speed = SPEED_100; 4641 ethtool_cmd_speed_set(cmd, SPEED_100);
4630 } else if (cp->link_cntl & CAS_BMCR_SPEED1000) { 4642 } else if (cp->link_cntl & CAS_BMCR_SPEED1000) {
4631 cmd->speed = SPEED_1000; 4643 ethtool_cmd_speed_set(cmd, SPEED_1000);
4632 } 4644 }
4633 cmd->duplex = (cp->link_cntl & BMCR_FULLDPLX)? 4645 cmd->duplex = (cp->link_cntl & BMCR_FULLDPLX)?
4634 DUPLEX_FULL : DUPLEX_HALF; 4646 DUPLEX_FULL : DUPLEX_HALF;
@@ -4641,6 +4653,7 @@ static int cas_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
4641{ 4653{
4642 struct cas *cp = netdev_priv(dev); 4654 struct cas *cp = netdev_priv(dev);
4643 unsigned long flags; 4655 unsigned long flags;
4656 u32 speed = ethtool_cmd_speed(cmd);
4644 4657
4645 /* Verify the settings we care about. */ 4658 /* Verify the settings we care about. */
4646 if (cmd->autoneg != AUTONEG_ENABLE && 4659 if (cmd->autoneg != AUTONEG_ENABLE &&
@@ -4648,9 +4661,9 @@ static int cas_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
4648 return -EINVAL; 4661 return -EINVAL;
4649 4662
4650 if (cmd->autoneg == AUTONEG_DISABLE && 4663 if (cmd->autoneg == AUTONEG_DISABLE &&
4651 ((cmd->speed != SPEED_1000 && 4664 ((speed != SPEED_1000 &&
4652 cmd->speed != SPEED_100 && 4665 speed != SPEED_100 &&
4653 cmd->speed != SPEED_10) || 4666 speed != SPEED_10) ||
4654 (cmd->duplex != DUPLEX_HALF && 4667 (cmd->duplex != DUPLEX_HALF &&
4655 cmd->duplex != DUPLEX_FULL))) 4668 cmd->duplex != DUPLEX_FULL)))
4656 return -EINVAL; 4669 return -EINVAL;
@@ -5019,6 +5032,10 @@ static int __devinit cas_init_one(struct pci_dev *pdev,
5019 cp->msg_enable = (cassini_debug < 0) ? CAS_DEF_MSG_ENABLE : 5032 cp->msg_enable = (cassini_debug < 0) ? CAS_DEF_MSG_ENABLE :
5020 cassini_debug; 5033 cassini_debug;
5021 5034
5035#if defined(CONFIG_SPARC)
5036 cp->of_node = pci_device_to_OF_node(pdev);
5037#endif
5038
5022 cp->link_transition = LINK_TRANSITION_UNKNOWN; 5039 cp->link_transition = LINK_TRANSITION_UNKNOWN;
5023 cp->link_transition_jiffies_valid = 0; 5040 cp->link_transition_jiffies_valid = 0;
5024 5041
@@ -5149,7 +5166,7 @@ err_out_free_res:
5149 pci_release_regions(pdev); 5166 pci_release_regions(pdev);
5150 5167
5151err_write_cacheline: 5168err_write_cacheline:
5152 /* Try to restore it in case the error occured after we 5169 /* Try to restore it in case the error occurred after we
5153 * set it. 5170 * set it.
5154 */ 5171 */
5155 pci_write_config_byte(pdev, PCI_CACHE_LINE_SIZE, orig_cacheline_size); 5172 pci_write_config_byte(pdev, PCI_CACHE_LINE_SIZE, orig_cacheline_size);
@@ -5177,7 +5194,7 @@ static void __devexit cas_remove_one(struct pci_dev *pdev)
5177 vfree(cp->fw_data); 5194 vfree(cp->fw_data);
5178 5195
5179 mutex_lock(&cp->pm_mutex); 5196 mutex_lock(&cp->pm_mutex);
5180 flush_scheduled_work(); 5197 cancel_work_sync(&cp->reset_task);
5181 if (cp->hw_running) 5198 if (cp->hw_running)
5182 cas_shutdown(cp); 5199 cas_shutdown(cp);
5183 mutex_unlock(&cp->pm_mutex); 5200 mutex_unlock(&cp->pm_mutex);