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

« back to all changes in this revision

Viewing changes to drivers/net/sis900.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:
240
240
 *      @net_dev: the net device to get address for
241
241
 *
242
242
 *      Older SiS900 and friends, use EEPROM to store MAC address.
243
 
 *      MAC address is read from read_eeprom() into @net_dev->dev_addr.
 
243
 *      MAC address is read from read_eeprom() into @net_dev->dev_addr and
 
244
 *      @net_dev->perm_addr.
244
245
 */
245
246
 
246
247
static int __devinit sis900_get_mac_addr(struct pci_dev * pci_dev, struct net_device *net_dev)
261
262
        for (i = 0; i < 3; i++)
262
263
                ((u16 *)(net_dev->dev_addr))[i] = read_eeprom(ioaddr, i+EEPROMMACAddr);
263
264
 
 
265
        /* Store MAC Address in perm_addr */
 
266
        memcpy(net_dev->perm_addr, net_dev->dev_addr, ETH_ALEN);
 
267
 
264
268
        return 1;
265
269
}
266
270
 
271
275
 *
272
276
 *      SiS630E model, use APC CMOS RAM to store MAC address.
273
277
 *      APC CMOS RAM is accessed through ISA bridge.
274
 
 *      MAC address is read into @net_dev->dev_addr.
 
278
 *      MAC address is read into @net_dev->dev_addr and
 
279
 *      @net_dev->perm_addr.
275
280
 */
276
281
 
277
282
static int __devinit sis630e_get_mac_addr(struct pci_dev * pci_dev,
296
301
                outb(0x09 + i, 0x70);
297
302
                ((u8 *)(net_dev->dev_addr))[i] = inb(0x71);
298
303
        }
 
304
 
 
305
        /* Store MAC Address in perm_addr */
 
306
        memcpy(net_dev->perm_addr, net_dev->dev_addr, ETH_ALEN);
 
307
 
299
308
        pci_write_config_byte(isa_bridge, 0x48, reg & ~0x40);
300
309
        pci_dev_put(isa_bridge);
301
310
 
310
319
 *
311
320
 *      SiS635 model, set MAC Reload Bit to load Mac address from APC
312
321
 *      to rfdr. rfdr is accessed through rfcr. MAC address is read into
313
 
 *      @net_dev->dev_addr.
 
322
 *      @net_dev->dev_addr and @net_dev->perm_addr.
314
323
 */
315
324
 
316
325
static int __devinit sis635_get_mac_addr(struct pci_dev * pci_dev,
334
343
                *( ((u16 *)net_dev->dev_addr) + i) = inw(ioaddr + rfdr);
335
344
        }
336
345
 
 
346
        /* Store MAC Address in perm_addr */
 
347
        memcpy(net_dev->perm_addr, net_dev->dev_addr, ETH_ALEN);
 
348
 
337
349
        /* enable packet filtering */
338
350
        outl(rfcrSave | RFEN, rfcr + ioaddr);
339
351
 
353
365
 *      EEDONE signal to refuse EEPROM access by LAN.
354
366
 *      The EEPROM map of SiS962 or SiS963 is different to SiS900.
355
367
 *      The signature field in SiS962 or SiS963 spec is meaningless.
356
 
 *      MAC address is read into @net_dev->dev_addr.
 
368
 *      MAC address is read into @net_dev->dev_addr and @net_dev->perm_addr.
357
369
 */
358
370
 
359
371
static int __devinit sis96x_get_mac_addr(struct pci_dev * pci_dev,
372
384
                        for (i = 0; i < 3; i++)
373
385
                                ((u16 *)(net_dev->dev_addr))[i] = read_eeprom(ioaddr, i+EEPROMMACAddr);
374
386
 
 
387
                        /* Store MAC Address in perm_addr */
 
388
                        memcpy(net_dev->perm_addr, net_dev->dev_addr, ETH_ALEN);
 
389
 
375
390
                        outl(EEDONE, ee_addr);
376
391
                        return 1;
377
392
                } else {
495
510
        sis_priv->mii_info.reg_num_mask = 0x1f;
496
511
 
497
512
        /* Get Mac address according to the chip revision */
498
 
        pci_read_config_byte(pci_dev, PCI_CLASS_REVISION, &(sis_priv->chipset_rev));
 
513
        sis_priv->chipset_rev = pci_dev->revision;
499
514
        if(netif_msg_probe(sis_priv))
500
515
                printk(KERN_DEBUG "%s: detected revision %2.2x, "
501
516
                                "trying to get MAC address...\n",
532
547
        /* save our host bridge revision */
533
548
        dev = pci_get_device(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_630, NULL);
534
549
        if (dev) {
535
 
                pci_read_config_byte(dev, PCI_CLASS_REVISION, &sis_priv->host_bridge_rev);
 
550
                sis_priv->host_bridge_rev = dev->revision;
536
551
                pci_dev_put(dev);
537
552
        }
538
553
 
1180
1195
 *
1181
1196
 *      630E equalizer workaround rule(Cyrus Huang 08/15)
1182
1197
 *      PHY register 14h(Test)
1183
 
 *      Bit 14: 0 -- Automatically dectect (default)
 
1198
 *      Bit 14: 0 -- Automatically detect (default)
1184
1199
 *              1 -- Manually set Equalizer filter
1185
1200
 *      Bit 13: 0 -- (Default)
1186
1201
 *              1 -- Speed up convergence of equalizer setting
1192
1207
 *      Then set equalizer value, and set Bit 14 to 1, Bit 9 to 0
1193
1208
 *      Link Off:Set Bit 13 to 1, Bit 14 to 0
1194
1209
 *      Calculate Equalizer value:
1195
 
 *      When Link is ON and Bit 14 is 0, SIS900PHY will auto-dectect proper equalizer value.
 
1210
 *      When Link is ON and Bit 14 is 0, SIS900PHY will auto-detect proper equalizer value.
1196
1211
 *      When the equalizer is stable, this value is not a fixed value. It will be within
1197
1212
 *      a small range(eg. 7~9). Then we get a minimum and a maximum value(eg. min=7, max=9)
1198
1213
 *      0 <= max <= 4  --> set equalizer to max
1723
1738
                rx_size = data_size - CRC_SIZE;
1724
1739
 
1725
1740
#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
1726
 
                /* ``TOOLONG'' flag means jumbo packet recived. */
 
1741
                /* ``TOOLONG'' flag means jumbo packet received. */
1727
1742
                if ((rx_status & TOOLONG) && data_size <= MAX_FRAME_SIZE)
1728
1743
                        rx_status &= (~ ((unsigned int)TOOLONG));
1729
1744
#endif