~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to drivers/net/natsemi.c

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
140
140
module_param(mtu, int, 0);
141
141
module_param(debug, int, 0);
142
142
module_param(rx_copybreak, int, 0);
143
 
module_param(dspcfg_workaround, int, 1);
 
143
module_param(dspcfg_workaround, int, 0);
144
144
module_param_array(options, int, NULL, 0);
145
145
module_param_array(full_duplex, int, NULL, 0);
146
146
MODULE_PARM_DESC(mtu, "DP8381x MTU (all boards)");
203
203
IIId. Synchronization
204
204
 
205
205
Most operations are synchronized on the np->lock irq spinlock, except the
206
 
recieve and transmit paths which are synchronised using a combination of
 
206
receive and transmit paths which are synchronised using a combination of
207
207
hardware descriptor ownership, disabling interrupts and NAPI poll scheduling.
208
208
 
209
209
IVb. References
726
726
         * There are two addresses we must avoid:
727
727
         * - the address on the external phy that is used for transmission.
728
728
         * - the address that we want to access. User space can access phys
729
 
         *   on the mii bus with SIOCGMIIREG/SIOCSMIIREG, independant from the
 
729
         *   on the mii bus with SIOCGMIIREG/SIOCSMIIREG, independent from the
730
730
         *   phy that is used for transmission.
731
731
         */
732
732
 
860
860
                prev_eedata = eedata;
861
861
        }
862
862
 
 
863
        /* Store MAC Address in perm_addr */
 
864
        memcpy(dev->perm_addr, dev->dev_addr, ETH_ALEN);
 
865
 
863
866
        dev->base_addr = (unsigned long __force) ioaddr;
864
867
        dev->irq = irq;
865
868
 
1982
1985
 
1983
1986
        np->rx_head_desc = &np->rx_ring[0];
1984
1987
 
1985
 
        /* Please be carefull before changing this loop - at least gcc-2.95.1
 
1988
        /* Please be careful before changing this loop - at least gcc-2.95.1
1986
1989
         * miscompiles it otherwise.
1987
1990
         */
1988
1991
        /* Initialize all Rx descriptors. */
2025
2028
                np->rx_ring[i].cmd_status = 0;
2026
2029
                np->rx_ring[i].addr = cpu_to_le32(0xBADF00D0); /* An invalid address. */
2027
2030
                if (np->rx_skbuff[i]) {
2028
 
                        pci_unmap_single(np->pci_dev,
2029
 
                                np->rx_dma[i], buflen,
 
2031
                        pci_unmap_single(np->pci_dev, np->rx_dma[i],
 
2032
                                buflen + NATSEMI_PADDING,
2030
2033
                                PCI_DMA_FROMDEVICE);
2031
2034
                        dev_kfree_skb(np->rx_skbuff[i]);
2032
2035
                }
2357
2360
                                        PCI_DMA_FROMDEVICE);
2358
2361
                        } else {
2359
2362
                                pci_unmap_single(np->pci_dev, np->rx_dma[entry],
2360
 
                                        buflen, PCI_DMA_FROMDEVICE);
 
2363
                                                 buflen + NATSEMI_PADDING,
 
2364
                                                 PCI_DMA_FROMDEVICE);
2361
2365
                                skb_put(skb = np->rx_skbuff[entry], pkt_len);
2362
2366
                                np->rx_skbuff[entry] = NULL;
2363
2367
                        }
2817
2821
        u32 tmp;
2818
2822
 
2819
2823
        ecmd->port        = dev->if_port;
2820
 
        ecmd->speed       = np->speed;
 
2824
        ethtool_cmd_speed_set(ecmd, np->speed);
2821
2825
        ecmd->duplex      = np->duplex;
2822
2826
        ecmd->autoneg     = np->autoneg;
2823
2827
        ecmd->advertising = 0;
2875
2879
                tmp = mii_nway_result(
2876
2880
                        np->advertising & mdio_read(dev, MII_LPA));
2877
2881
                if (tmp == LPA_100FULL || tmp == LPA_100HALF)
2878
 
                        ecmd->speed  = SPEED_100;
 
2882
                        ethtool_cmd_speed_set(ecmd, SPEED_100);
2879
2883
                else
2880
 
                        ecmd->speed  = SPEED_10;
 
2884
                        ethtool_cmd_speed_set(ecmd, SPEED_10);
2881
2885
                if (tmp == LPA_100FULL || tmp == LPA_10FULL)
2882
2886
                        ecmd->duplex = DUPLEX_FULL;
2883
2887
                else
2905
2909
                        return -EINVAL;
2906
2910
                }
2907
2911
        } else if (ecmd->autoneg == AUTONEG_DISABLE) {
2908
 
                if (ecmd->speed != SPEED_10 && ecmd->speed != SPEED_100)
 
2912
                u32 speed = ethtool_cmd_speed(ecmd);
 
2913
                if (speed != SPEED_10 && speed != SPEED_100)
2909
2914
                        return -EINVAL;
2910
2915
                if (ecmd->duplex != DUPLEX_HALF && ecmd->duplex != DUPLEX_FULL)
2911
2916
                        return -EINVAL;
2953
2958
                if (ecmd->advertising & ADVERTISED_100baseT_Full)
2954
2959
                        np->advertising |= ADVERTISE_100FULL;
2955
2960
        } else {
2956
 
                np->speed  = ecmd->speed;
 
2961
                np->speed  = ethtool_cmd_speed(ecmd);
2957
2962
                np->duplex = ecmd->duplex;
2958
2963
                /* user overriding the initial full duplex parm? */
2959
2964
                if (np->duplex == DUPLEX_HALF)