~ubuntu-branches/ubuntu/quantal/linux-linaro-mx51/quantal

« back to all changes in this revision

Viewing changes to drivers/net/niu.c

  • Committer: Package Import Robot
  • Author(s): John Rigby, John Rigby
  • Date: 2011-09-26 10:44:23 UTC
  • Revision ID: package-import@ubuntu.com-20110926104423-3o58a3c1bj7x00rs
Tags: 3.0.0-1007.9
[ John Rigby ]

Enable crypto modules and remove crypto-modules from
exclude-module files
LP: #826021

Show diffs side-by-side

added added

removed removed

Lines of Context:
1233
1233
 
1234
1234
        bmsr = err;
1235
1235
        if (bmsr & BMSR_LSTATUS) {
1236
 
                u16 adv, lpa, common, estat;
 
1236
                u16 adv, lpa;
1237
1237
 
1238
1238
                err = mii_read(np, np->phy_addr, MII_ADVERTISE);
1239
1239
                if (err < 0)
1245
1245
                        goto out;
1246
1246
                lpa = err;
1247
1247
 
1248
 
                common = adv & lpa;
1249
 
 
1250
1248
                err = mii_read(np, np->phy_addr, MII_ESTATUS);
1251
1249
                if (err < 0)
1252
1250
                        goto out;
1253
 
                estat = err;
1254
1251
                link_up = 1;
1255
1252
                current_speed = SPEED_1000;
1256
1253
                current_duplex = DUPLEX_FULL;
1650
1647
                break;
1651
1648
        }
1652
1649
 
1653
 
        return 0;
 
1650
        return err;
1654
1651
}
1655
1652
 
1656
1653
static int mii_reset(struct niu *np)
2381
2378
        struct niu_link_config *lp = &np->link_config;
2382
2379
        unsigned long ctrl_reg, test_cfg_reg, pll_cfg, i;
2383
2380
        u64 ctrl_val, test_cfg_val, sig, mask, val;
2384
 
        u64 reset_val;
2385
2381
 
2386
2382
        switch (np->port) {
2387
2383
        case 0:
2388
 
                reset_val =  ENET_SERDES_RESET_0;
2389
2384
                ctrl_reg = ENET_SERDES_0_CTRL_CFG;
2390
2385
                test_cfg_reg = ENET_SERDES_0_TEST_CFG;
2391
2386
                pll_cfg = ENET_SERDES_0_PLL_CFG;
2392
2387
                break;
2393
2388
        case 1:
2394
 
                reset_val =  ENET_SERDES_RESET_1;
2395
2389
                ctrl_reg = ENET_SERDES_1_CTRL_CFG;
2396
2390
                test_cfg_reg = ENET_SERDES_1_TEST_CFG;
2397
2391
                pll_cfg = ENET_SERDES_1_PLL_CFG;
6071
6065
        for (i = 0; i < np->num_ldg; i++) {
6072
6066
                struct niu_ldg *lp = &np->ldg[i];
6073
6067
 
6074
 
                err = request_irq(lp->irq, niu_interrupt,
6075
 
                                  IRQF_SHARED | IRQF_SAMPLE_RANDOM,
 
6068
                err = request_irq(lp->irq, niu_interrupt, IRQF_SHARED,
6076
6069
                                  np->irq_name[i], lp);
6077
6070
                if (err)
6078
6071
                        goto out_free_irqs;
6851
6844
        cmd->supported = lp->supported;
6852
6845
        cmd->advertising = lp->active_advertising;
6853
6846
        cmd->autoneg = lp->active_autoneg;
6854
 
        cmd->speed = lp->active_speed;
 
6847
        ethtool_cmd_speed_set(cmd, lp->active_speed);
6855
6848
        cmd->duplex = lp->active_duplex;
6856
6849
        cmd->port = (np->flags & NIU_FLAGS_FIBER) ? PORT_FIBRE : PORT_TP;
6857
6850
        cmd->transceiver = (np->flags & NIU_FLAGS_XCVR_SERDES) ?
6866
6859
        struct niu_link_config *lp = &np->link_config;
6867
6860
 
6868
6861
        lp->advertising = cmd->advertising;
6869
 
        lp->speed = cmd->speed;
 
6862
        lp->speed = ethtool_cmd_speed(cmd);
6870
6863
        lp->duplex = cmd->duplex;
6871
6864
        lp->autoneg = cmd->autoneg;
6872
6865
        return niu_init_link(np);
7023
7016
        case UDP_V4_FLOW:
7024
7017
                *class = CLASS_CODE_UDP_IPV4;
7025
7018
                break;
 
7019
        case AH_ESP_V4_FLOW:
7026
7020
        case AH_V4_FLOW:
7027
7021
        case ESP_V4_FLOW:
7028
7022
                *class = CLASS_CODE_AH_ESP_IPV4;
7036
7030
        case UDP_V6_FLOW:
7037
7031
                *class = CLASS_CODE_UDP_IPV6;
7038
7032
                break;
 
7033
        case AH_ESP_V6_FLOW:
7039
7034
        case AH_V6_FLOW:
7040
7035
        case ESP_V6_FLOW:
7041
7036
                *class = CLASS_CODE_AH_ESP_IPV6;
7889
7884
        nw64_mac(reg, val);
7890
7885
}
7891
7886
 
7892
 
static int niu_phys_id(struct net_device *dev, u32 data)
 
7887
static int niu_set_phys_id(struct net_device *dev,
 
7888
                           enum ethtool_phys_id_state state)
 
7889
 
7893
7890
{
7894
7891
        struct niu *np = netdev_priv(dev);
7895
 
        u64 orig_led_state;
7896
 
        int i;
7897
7892
 
7898
7893
        if (!netif_running(dev))
7899
7894
                return -EAGAIN;
7900
7895
 
7901
 
        if (data == 0)
7902
 
                data = 2;
7903
 
 
7904
 
        orig_led_state = niu_led_state_save(np);
7905
 
        for (i = 0; i < (data * 2); i++) {
7906
 
                int on = ((i % 2) == 0);
7907
 
 
7908
 
                niu_force_led(np, on);
7909
 
 
7910
 
                if (msleep_interruptible(500))
7911
 
                        break;
 
7896
        switch (state) {
 
7897
        case ETHTOOL_ID_ACTIVE:
 
7898
                np->orig_led_state = niu_led_state_save(np);
 
7899
                return 1;       /* cycle on/off once per second */
 
7900
 
 
7901
        case ETHTOOL_ID_ON:
 
7902
                niu_force_led(np, 1);
 
7903
                break;
 
7904
 
 
7905
        case ETHTOOL_ID_OFF:
 
7906
                niu_force_led(np, 0);
 
7907
                break;
 
7908
 
 
7909
        case ETHTOOL_ID_INACTIVE:
 
7910
                niu_led_state_restore(np, np->orig_led_state);
7912
7911
        }
7913
 
        niu_led_state_restore(np, orig_led_state);
7914
7912
 
7915
7913
        return 0;
7916
7914
}
7917
7915
 
7918
 
static int niu_set_flags(struct net_device *dev, u32 data)
7919
 
{
7920
 
        return ethtool_op_set_flags(dev, data, ETH_FLAG_RXHASH);
7921
 
}
7922
 
 
7923
7916
static const struct ethtool_ops niu_ethtool_ops = {
7924
7917
        .get_drvinfo            = niu_get_drvinfo,
7925
7918
        .get_link               = ethtool_op_get_link,
7933
7926
        .get_strings            = niu_get_strings,
7934
7927
        .get_sset_count         = niu_get_sset_count,
7935
7928
        .get_ethtool_stats      = niu_get_ethtool_stats,
7936
 
        .phys_id                = niu_phys_id,
 
7929
        .set_phys_id            = niu_set_phys_id,
7937
7930
        .get_rxnfc              = niu_get_nfc,
7938
7931
        .set_rxnfc              = niu_set_nfc,
7939
 
        .set_flags              = niu_set_flags,
7940
 
        .get_flags              = ethtool_op_get_flags,
7941
7932
};
7942
7933
 
7943
7934
static int niu_ldg_assign_ldn(struct niu *np, struct niu_parent *parent,
8131
8122
        netif_printk(np, probe, KERN_DEBUG, np->dev,
8132
8123
                     "VPD_SCAN: start[%x] end[%x]\n", start, end);
8133
8124
        while (start < end) {
8134
 
                int len, err, instance, type, prop_len;
 
8125
                int len, err, prop_len;
8135
8126
                char namebuf[64];
8136
8127
                u8 *prop_buf;
8137
8128
                int max_len;
8147
8138
                len = err;
8148
8139
                start += 3;
8149
8140
 
8150
 
                instance = niu_pci_eeprom_read(np, start);
8151
 
                type = niu_pci_eeprom_read(np, start + 3);
8152
8141
                prop_len = niu_pci_eeprom_read(np, start + 4);
8153
8142
                err = niu_pci_vpd_get_propname(np, start + 5, namebuf, 64);
8154
8143
                if (err < 0)
9207
9196
 
9208
9197
        first_chan = 0;
9209
9198
        for (i = 0; i < port; i++)
9210
 
                first_chan += parent->rxchan_per_port[port];
 
9199
                first_chan += parent->rxchan_per_port[i];
9211
9200
        num_chan = parent->rxchan_per_port[port];
9212
9201
 
9213
9202
        for (i = first_chan; i < (first_chan + num_chan); i++) {
9223
9212
 
9224
9213
        first_chan = 0;
9225
9214
        for (i = 0; i < port; i++)
9226
 
                first_chan += parent->txchan_per_port[port];
 
9215
                first_chan += parent->txchan_per_port[i];
9227
9216
        num_chan = parent->txchan_per_port[port];
9228
9217
        for (i = first_chan; i < (first_chan + num_chan); i++) {
9229
9218
                err = niu_ldg_assign_ldn(np, parent,
9768
9757
 
9769
9758
static void __devinit niu_set_basic_features(struct net_device *dev)
9770
9759
{
9771
 
        dev->features |= (NETIF_F_SG | NETIF_F_HW_CSUM |
9772
 
                          NETIF_F_GRO | NETIF_F_RXHASH);
 
9760
        dev->hw_features = NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_RXHASH;
 
9761
        dev->features |= dev->hw_features | NETIF_F_RXCSUM;
9773
9762
}
9774
9763
 
9775
9764
static int __devinit niu_pci_init_one(struct pci_dev *pdev,