
From: "SuD (Alex)" <sud@latinsud.com>

I recently was given a surecom 10/100 ethernet card and found that i could
not change Mac address for it as other driver/devices allow.  I tried to
implement the missing feature and noticed that the device is quite peculiar
(or either my system is broken), when trying to fill mac address registers
(no matter whether io_ops is set): - If I write a byte (writeb) to an even
i/o address it seems like actually a word was written (the next byte is set
to 0).  - If I write a byte to an odd i/o address my pc gets bad freezed.

That made think of writing 16bit words (writew) for the memory address, as
opposed to what most driver examples do.  It works for me (I hope i set the
lines at the right place in device_open function after the device is
reset).  I hope the code is clean enough and does not mess with byte
ordering.  This is the patch (this time against 2.6.5):

(akpm: Is this right on big-endian?)


---

 25-akpm/drivers/net/fealnx.c |    5 +++++
 1 files changed, 5 insertions(+)

diff -puN drivers/net/fealnx.c~fealnx-mac-address-and-other-issues drivers/net/fealnx.c
--- 25/drivers/net/fealnx.c~fealnx-mac-address-and-other-issues	2004-04-22 22:29:22.623217512 -0700
+++ 25-akpm/drivers/net/fealnx.c	2004-04-22 22:29:22.627216904 -0700
@@ -858,12 +858,17 @@ static int netdev_open(struct net_device
 {
 	struct netdev_private *np = dev->priv;
 	long ioaddr = dev->base_addr;
+	int i;
 
 	writel(0x00000001, ioaddr + BCR);	/* Reset */
 
 	if (request_irq(dev->irq, &intr_handler, SA_SHIRQ, dev->name, dev))
 		return -EAGAIN;
 
+	for (i = 0; i < 3; i++)
+		writew(((unsigned short*)dev->dev_addr)[i],
+				ioaddr + PAR0 + i*2);
+
 	init_ring(dev);
 
 	writel(np->rx_ring_dma, ioaddr + RXLBA);

_
