[realtek] rtl8139 driver for selected media patch

Bernard Lee leewkb@yahoo.com
Mon, 6 Aug 2001 11:15:38 -0700 (PDT)


--0-221812336-997121738=:86173
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hi there,

I came across a cosmetic enhancement for rtl8139
driver.

RTL8139 users are usually provided with a DOS utility
program to select default media type. e.g.
rset8139.exe by Realtek to support those generic
cards. This utility updates the EEPROM byte offset
0x0C, sometimes disabling auto-negotiation.

Those cards will have BMCR register (MII reg 0)
modified.

The existing kernel 2.2.19 rtl8139 driver ignores BMCR
register and reads Link-Partner register for media
type. It may displays a message of "setting
half-duplex" for those cards programmed with 100baseTX
full-duplex...

A possible fix is to check the ANE bit in BMCR
register. If ANE bit is cleared, read selected media
type in BMCD register. Should auto-negotiation be
disabled, we don't need to do runtime auto-sense.

For this purpose, rtl8129_open() is modified. The
attached diff file is based on v1.07 included in Linux
kernel 2.2.19.

Hope it works for others too.

Best Regards,

Bernard Lee


__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/
--0-221812336-997121738=:86173
Content-Type: application/x-unknown; name="rtl8139.c.diff"
Content-Transfer-Encoding: base64
Content-Description: rtl8139.c.diff
Content-Disposition: attachment; filename="rtl8139.c.diff"

NzEyLDcxOGM3MTIsNzUxCjwgCQl1MTYgbWlpX3JlZzUgPSBtZGlvX3JlYWQo
ZGV2LCB0cC0+cGh5c1swXSwgNSk7CjwgCQlpZiAobWlpX3JlZzUgPT0gMHhm
ZmZmKQo8IAkJCTsJCQkJCS8qIE5vdCB0aGVyZSAqLwo8IAkJZWxzZSBpZiAo
KG1paV9yZWc1ICYgMHgwMTAwKSA9PSAweDAxMDAKPCAJCQkJIHx8IChtaWlf
cmVnNSAmIDB4MDBDMCkgPT0gMHgwMDQwKQo8IAkJCXRwLT5mdWxsX2R1cGxl
eCA9IDE7CjwgCQlpZiAocnRsODEyOV9kZWJ1ZyA+IDEpCi0tLQo+ICAgICAg
ICA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