]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/net/via-velocity.c
Merge branch 'tmp' into upstream
[linux-2.6-omap-h63xx.git] / drivers / net / via-velocity.c
index 019dcf2457b4a089cd2e15813245f7f67698c282..f23d207ad3fc46ca2d29e10a7526a93443be6470 100644 (file)
@@ -229,7 +229,8 @@ static int rx_copybreak = 200;
 module_param(rx_copybreak, int, 0644);
 MODULE_PARM_DESC(rx_copybreak, "Copy breakpoint for copy-only-tiny-frames");
 
-static void velocity_init_info(struct pci_dev *pdev, struct velocity_info *vptr, struct velocity_info_tbl *info);
+static void velocity_init_info(struct pci_dev *pdev, struct velocity_info *vptr,
+                              const struct velocity_info_tbl *info);
 static int velocity_get_pci_info(struct velocity_info *, struct pci_dev *pdev);
 static void velocity_print_info(struct velocity_info *vptr);
 static int velocity_open(struct net_device *dev);
@@ -294,9 +295,9 @@ static void velocity_unregister_notifier(void)
  *     Internal board variants. At the moment we have only one
  */
 
-static struct velocity_info_tbl chip_info_table[] = {
-       {CHIP_TYPE_VT6110, "VIA Networking Velocity Family Gigabit Ethernet Adapter", 256, 1, 0x00FFFFFFUL},
-       {0, NULL}
+static const struct velocity_info_tbl chip_info_table[] __devinitdata = {
+       {CHIP_TYPE_VT6110, "VIA Networking Velocity Family Gigabit Ethernet Adapter", 1, 0x00FFFFFFUL},
+       { }
 };
 
 /*
@@ -685,7 +686,7 @@ static int __devinit velocity_found1(struct pci_dev *pdev, const struct pci_devi
        static int first = 1;
        struct net_device *dev;
        int i;
-       struct velocity_info_tbl *info = &chip_info_table[ent->driver_data];
+       const struct velocity_info_tbl *info = &chip_info_table[ent->driver_data];
        struct velocity_info *vptr;
        struct mac_regs __iomem * regs;
        int ret = -ENOMEM;
@@ -694,14 +695,14 @@ static int __devinit velocity_found1(struct pci_dev *pdev, const struct pci_devi
         * can support more than MAX_UNITS.
         */
        if (velocity_nics >= MAX_UNITS) {
-               dev_printk(KERN_NOTICE, &pdev->dev, "already found %d NICs.\n", 
+               dev_notice(&pdev->dev, "already found %d NICs.\n", 
                           velocity_nics);
                return -ENODEV;
        }
 
        dev = alloc_etherdev(sizeof(struct velocity_info));
        if (!dev) {
-               dev_printk(KERN_ERR, &pdev->dev, "allocate net device failed.\n");
+               dev_err(&pdev->dev, "allocate net device failed.\n");
                goto out;
        }
        
@@ -738,11 +739,11 @@ static int __devinit velocity_found1(struct pci_dev *pdev, const struct pci_devi
 
        ret = pci_request_regions(pdev, VELOCITY_NAME);
        if (ret < 0) {
-               dev_printk(KERN_ERR, &pdev->dev, "No PCI resources.\n");
+               dev_err(&pdev->dev, "No PCI resources.\n");
                goto err_disable;
        }
 
-       regs = ioremap(vptr->memaddr, vptr->io_size);
+       regs = ioremap(vptr->memaddr, VELOCITY_IO_SIZE);
        if (regs == NULL) {
                ret = -EIO;
                goto err_release_res;
@@ -860,13 +861,14 @@ static void __devinit velocity_print_info(struct velocity_info *vptr)
  *     discovered.
  */
 
-static void __devinit velocity_init_info(struct pci_dev *pdev, struct velocity_info *vptr, struct velocity_info_tbl *info)
+static void __devinit velocity_init_info(struct pci_dev *pdev,
+                                        struct velocity_info *vptr,
+                                        const struct velocity_info_tbl *info)
 {
        memset(vptr, 0, sizeof(struct velocity_info));
 
        vptr->pdev = pdev;
        vptr->chip_id = info->chip_id;
-       vptr->io_size = info->io_size;
        vptr->num_txq = info->txqueue;
        vptr->multicast_limit = MCAM_SIZE;
        spin_lock_init(&vptr->lock);
@@ -893,19 +895,19 @@ static int __devinit velocity_get_pci_info(struct velocity_info *vptr, struct pc
        vptr->memaddr = pci_resource_start(pdev, 1);
        
        if (!(pci_resource_flags(pdev, 0) & IORESOURCE_IO)) {
-               dev_printk(KERN_ERR, &pdev->dev,
+               dev_err(&pdev->dev,
                           "region #0 is not an I/O resource, aborting.\n");
                return -EINVAL;
        }
 
        if ((pci_resource_flags(pdev, 1) & IORESOURCE_IO)) {
-               dev_printk(KERN_ERR, &pdev->dev,
+               dev_err(&pdev->dev,
                           "region #1 is an I/O resource, aborting.\n");
                return -EINVAL;
        }
 
-       if (pci_resource_len(pdev, 1) < 256) {
-               dev_printk(KERN_ERR, &pdev->dev, "region #1 is too small.\n");
+       if (pci_resource_len(pdev, 1) < VELOCITY_IO_SIZE) {
+               dev_err(&pdev->dev, "region #1 is too small.\n");
                return -EINVAL;
        }
        vptr->pdev = pdev;
@@ -2107,8 +2109,6 @@ static void velocity_set_multi(struct net_device *dev)
        struct dev_mc_list *mclist;
 
        if (dev->flags & IFF_PROMISC) { /* Set promiscuous. */
-               /* Unconditionally log net taps. */
-               printk(KERN_NOTICE "%s: Promiscuous mode enabled.\n", dev->name);
                writel(0xffffffff, &regs->MARCAM[0]);
                writel(0xffffffff, &regs->MARCAM[4]);
                rx_mode = (RCR_AM | RCR_AB | RCR_PROM);
@@ -2248,7 +2248,7 @@ static int __init velocity_init_module(void)
        int ret;
 
        velocity_register_notifier();
-       ret = pci_module_init(&velocity_driver);
+       ret = pci_register_driver(&velocity_driver);
        if (ret < 0)
                velocity_unregister_notifier();
        return ret;
@@ -2740,7 +2740,7 @@ static u32 check_connection_type(struct mac_regs __iomem * regs)
 
        if (PHYSR0 & PHYSR0_SPDG)
                status |= VELOCITY_SPEED_1000;
-       if (PHYSR0 & PHYSR0_SPD10)
+       else if (PHYSR0 & PHYSR0_SPD10)
                status |= VELOCITY_SPEED_10;
        else
                status |= VELOCITY_SPEED_100;
@@ -2849,8 +2849,17 @@ static int velocity_get_settings(struct net_device *dev, struct ethtool_cmd *cmd
        u32 status;
        status = check_connection_type(vptr->mac_regs);
 
-       cmd->supported = SUPPORTED_TP | SUPPORTED_Autoneg | SUPPORTED_10baseT_Half | SUPPORTED_10baseT_Full | SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Full | SUPPORTED_1000baseT_Half | SUPPORTED_1000baseT_Full;
-       if (status & VELOCITY_SPEED_100)
+       cmd->supported = SUPPORTED_TP |
+                       SUPPORTED_Autoneg |
+                       SUPPORTED_10baseT_Half |
+                       SUPPORTED_10baseT_Full |
+                       SUPPORTED_100baseT_Half |
+                       SUPPORTED_100baseT_Full |
+                       SUPPORTED_1000baseT_Half |
+                       SUPPORTED_1000baseT_Full;
+       if (status & VELOCITY_SPEED_1000)
+               cmd->speed = SPEED_1000;
+       else if (status & VELOCITY_SPEED_100)
                cmd->speed = SPEED_100;
        else
                cmd->speed = SPEED_10;
@@ -2894,7 +2903,7 @@ static u32 velocity_get_link(struct net_device *dev)
 {
        struct velocity_info *vptr = netdev_priv(dev);
        struct mac_regs __iomem * regs = vptr->mac_regs;
-       return BYTE_REG_BITS_IS_ON(PHYSR0_LINKGD, &regs->PHYSR0)  ? 0 : 1;
+       return BYTE_REG_BITS_IS_ON(PHYSR0_LINKGD, &regs->PHYSR0) ? 1 : 0;
 }
 
 static void velocity_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)