[realtek] Implementing set_mac_address for the rtl8139 driver?

Donald Becker becker@scyld.com
Thu, 4 Jan 2001 11:13:06 -0500 (EST)


On Thu, 4 Jan 2001, Ben Greear wrote:

> But, it worked no better than the default which didn't try to poke
> anything into the driver...

OK, I sat down and tried to figure out what is going on.
I don't fully understand what the problem is with the rtl8139, but the
following change works:

____

static int rtl8129_open(struct net_device *dev)
{
	struct rtl8129_private *tp = (struct rtl8129_private *)dev->priv;
	long ioaddr = dev->base_addr;
	int i;


	printk("%s: Setting station address to %8.8x %8.8x.\n", dev->name,
		   *(u32*)(dev->dev_addr + 0), *(u32*)(dev->dev_addr + 4));
+	outl(cpu_to_le32(*(u32*)(dev->dev_addr + 0)), ioaddr + MAC0 + 0);
+	outl(cpu_to_le32(*(u32*)(dev->dev_addr + 4)), ioaddr + MAC0 + 4);
	printk("%s: Read station address as %8.8x %8.8x.\n", dev->name,
		   inl(ioaddr + MAC0 + 0), inl(ioaddr + MAC0 + 4));

	/* Soft reset the chip. */
	outb(CmdReset, ioaddr + ChipCmd);
________________

This is not the final patch!
I'm still working on is why this works before the reset, but not after.

With the original rtl8129 chips writing the MAC0 register could be done at
any time the receiver wasn't enabled, and writing with outb() instead of
outl() worked correctly.  With the rtl8139B chip that I'm testing with now
only 32 bit writes work and the writes only take effect when the chip is in
a specific, as yet unknown, state.

> Here is some diags (at this point, I've run these commands):
> 	ifconfig eth1 down
> 	ifconfig eth1 hw ether 00:48:54:85:2F:BB
> 	ifconfig eth1 up

This is the right test.
I run 'rtl8139-diag' to see if the change has taken hold.

> RealTek chip registers at 0xe000
>  0x000: 89544800 00006bf2 80000000 00000000
         station address^^    ^^ multicast filter.

Which chip were you using with the Tulip driver that was causing problems?


Donald Becker				becker@scyld.com
Scyld Computing Corporation		http://www.scyld.com
410 Severn Ave. Suite 210		Second Generation Beowulf Clusters
Annapolis MD 21403			410-990-9993