netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFT] Realtek 8168 ethernet support
@ 2006-06-01 20:02 Daniel Drake
  2006-06-01 22:24 ` Francois Romieu
  2006-06-08 21:31 ` Randy.Dunlap
  0 siblings, 2 replies; 18+ messages in thread
From: Daniel Drake @ 2006-06-01 20:02 UTC (permalink / raw)
  To: netdev

I've produced this patch which should allow the r8169 driver to work with the
new Realtek 8168 chips. These are found in PCI-Express form and onboard some
newer motherboards.

Does anyone own this hardware? I'm looking for someone to test it before I
send it on.

Signed-off-by: Daniel Drake <dsd@gentoo.org>

Index: linux/drivers/net/r8169.c
===================================================================
--- linux.orig/drivers/net/r8169.c
+++ linux/drivers/net/r8169.c
@@ -184,6 +184,7 @@ static const struct {
 
 static struct pci_device_id rtl8169_pci_tbl[] = {
 	{ PCI_DEVICE(PCI_VENDOR_ID_REALTEK,	0x8169), },
+	{ PCI_DEVICE(PCI_VENDOR_ID_REALTEK,	0x8168), },
 	{ PCI_DEVICE(PCI_VENDOR_ID_DLINK,	0x4300), },
 	{ PCI_DEVICE(0x16ec,			0x0116), },
 	{ PCI_VENDOR_ID_LINKSYS,		0x1032, PCI_ANY_ID, 0x0024, },
@@ -1398,6 +1399,7 @@ rtl8169_init_board(struct pci_dev *pdev,
 	struct net_device *dev;
 	struct rtl8169_private *tp;
 	int rc = -ENOMEM, i, acpi_idle_state = 0, pm_cap;
+	u32 mmio_base = 0;
 
 	assert(ioaddr_out != NULL);
 
@@ -1442,20 +1444,24 @@ rtl8169_init_board(struct pci_dev *pdev,
 		}
 	}
 
-	/* make sure PCI base addr 1 is MMIO */
-	if (!(pci_resource_flags(pdev, 1) & IORESOURCE_MEM)) {
-		if (netif_msg_probe(tp)) {
-			printk(KERN_ERR PFX
-			       "region #1 not an MMIO resource, aborting\n");
-		}
-		rc = -ENODEV;
-		goto err_out_mwi;
+	/* find MMIO resource: this varies between 8168 and 8169 */
+	for (i = 0; i < 5; i++) {
+		/* check resource type */
+		if (!(pci_resource_flags(pdev, i) & IORESOURCE_MEM))
+			continue;
+
+		/* check for weird/broken PCI region reporting */
+		if (pci_resource_len(pdev, i) < R8169_REGS_SIZE)
+			continue;
+
+		mmio_base = pci_resource_start(pdev, i);
+		break;
 	}
-	/* check for weird/broken PCI region reporting */
-	if (pci_resource_len(pdev, 1) < R8169_REGS_SIZE) {
+
+	if (mmio_base == 0) {
 		if (netif_msg_probe(tp)) {
 			printk(KERN_ERR PFX
-			       "Invalid PCI region size(s), aborting\n");
+			       "couldn't find valid MMIO resource, aborting\n");
 		}
 		rc = -ENODEV;
 		goto err_out_mwi;
@@ -1490,7 +1496,7 @@ rtl8169_init_board(struct pci_dev *pdev,
 	pci_set_master(pdev);
 
 	/* ioremap MMIO region */
-	ioaddr = ioremap(pci_resource_start(pdev, 1), R8169_REGS_SIZE);
+	ioaddr = ioremap(mmio_base, R8169_REGS_SIZE);
 	if (ioaddr == NULL) {
 		if (netif_msg_probe(tp))
 			printk(KERN_ERR PFX "cannot remap MMIO, aborting\n");

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2006-07-21 13:02 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-01 20:02 [RFT] Realtek 8168 ethernet support Daniel Drake
2006-06-01 22:24 ` Francois Romieu
2006-06-02  1:38   ` Jeff Garzik
2006-06-08 21:31 ` Randy.Dunlap
2006-06-08 23:41   ` Francois Romieu
2006-06-09  2:40   ` Jeff Garzik
2006-06-09  2:49     ` Randy.Dunlap
2006-06-09 18:33     ` Francois Romieu
2006-06-09 18:48       ` Jeff Garzik
2006-06-10 12:05         ` Francois Romieu
2006-06-10 22:48           ` Francois Romieu
2006-06-11 23:30             ` Francois Romieu
2006-06-12 10:30               ` Mourad De Clerck
2006-06-12 18:49                 ` Francois Romieu
     [not found]                   ` <448DE38D.8070503@aquazul.com>
2006-06-12 22:29                     ` Francois Romieu
2006-06-18 17:25                       ` Mourad De Clerck
2006-07-18 22:14               ` Francois Romieu
2006-07-21 13:02                 ` Daniel Drake

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).