Page MenuHomeFreeBSD

vte(4): restore original MDC speed control register value after MAC reset, if it wasn't default

Authored by kevlo on Apr 19 2022, 5:17 AM.



Since vte_reset changes register value to MDCSC_DEFAULT value, which may not
be the original value, thus causing some phy registers read failures.
Restoring VTE_MDCSC value to original after reset solves the link state
flapping issue. Where here, add a new RDC phy.

Patch from Andrius V via NetBSD.

Test Plan

Tested on my ebox-3360-c2cf. Here's the dmesg:

Copyright (c) 1992-2022 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 14.0-CURRENT #5: Mon Apr 18 14:36:05 CST 2022 i386

FreeBSD clang version 13.0.0 ( llvmorg-13.0.0-0-gd7b669b3a303)
VT(vga): resolution 640x480
CPU: Pentium ProUnknown (1000.03-MHz 686-class CPU)

Origin="Vortex86 SoC"  Id=0x611

real memory = 1073741824 (1024 MB)
avail memory = 957796352 (913 MB)
Event timer "LAPIC" quality 100
ACPI APIC Table: <R D C APIC1759>
FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs
FreeBSD/SMP: 2 package(s) x 1 core(s)
random: unblocking device.
ioapic0 <Version 2.0> irqs 0-23
Launching APs: 1
random: entropy device external interface
kbd1 at kbdmux0
vtvga0: <VT VGA driver>
smbios0: <System Management BIOS> at iomem 0xf7430-0xf744e
smbios0: Version: 2.7
aesni0: No AES or SHA support.
acpi0: <R D C QA09 >
acpi0: Power Button (fixed)
cpu0: <ACPI CPU> on acpi0
attimer0: <AT timer> port 0x40-0x43 irq 0 on acpi0
Timecounter "i8254" frequency 1193182 Hz quality 0
Event timer "i8254" frequency 1193182 Hz quality 100
atrtc0: <AT realtime clock> port 0x70-0x71 irq 8 on acpi0
atrtc0: registered as a time-of-day clock, resolution 1.000000s
Event timer "RTC" frequency 32768 Hz quality 0
Timecounter "ACPI-fast" frequency 3579545 Hz quality 900
acpi_timer0: <24-bit timer at 3.579545MHz> port 0x808-0x80b on acpi0
pcib0: <ACPI Host-PCI bridge> port 0xcf8-0xcff on acpi0
pci0: <ACPI PCI bus> on pcib0
pcib1: <ACPI PCI-PCI bridge> irq 16 at device 1.0 on pci0
pcib2: <ACPI PCI-PCI bridge> irq 17 at device 2.0 on pci0
isab0: <PCI-ISA bridge> at device 7.0 on pci0
isa0: <ISA bus> on isab0
isab1: <PCI-ISA bridge> at device 7.1 on pci0
device_attach: isab1 attach returned 6
vte0: <RDC R6040 FastEthernet> port 0xd800-0xd8ff mem 0xfebdfc00-0xfebdfcff irq 19 at device 8.0 on pci0
vte0: using memory space register mapping
miibus0: <MII bus> on vte0
rdcphy0: <R6040 10/100 media interface> PHY 1 on miibus0
rdcphy0: none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
vte0: Ethernet address: 00:1b:eb:4d:7d:53
ohci0: <OHCI (generic) USB controller> mem 0xfebde000-0xfebdefff irq 18 at device 10.0 on pci0
usbus0 on ohci0
usbus0: 12Mbps Full Speed USB v1.0
ehci0: <EHCI (generic) USB 2.0 controller> mem 0xfebdf800-0xfebdf8ff irq 21 at device 10.1 on pci0
usbus1: EHCI version 1.0
usbus1 on ehci0
usbus1: 480Mbps High Speed USB v2.0
atapci0: <Generic ATA controller> port 0x1f0-0x1f7,0x3f6,0x170-0x177,0x376,0xe000-0xe00f at device 12.0 on pci0
ata0: <ATA channel> at channel 0 on atapci0
ata1: <ATA channel> at channel 1 on atapci0
vgapci0: <VGA-compatible display> port 0xdc00-0xdc7f mem 0xf8000000-0xfbffffff,0xfebe0000-0xfebfffff at device 13.0 on pci0
vgapci0: Boot video device
hdac0: <RDC M3010 HDA Controller> mem 0xfebd8000-0xfebdbfff irq 18 at device 14.0 on pci0
uart0: <16550 or compatible> port 0x3f8-0x3ff irq 4 flags 0x10 on acpi0
uart1: <16550 or compatible> port 0x2f8-0x2ff irq 3 on acpi0
orm0: <ISA Option ROM> at iomem 0xc0000-0xc7fff pnpid ORM0000 on isa0
atkbdc0: <Keyboard controller (i8042)> at port 0x60,0x64 on isa0
atkbd0: <AT Keyboard> irq 1 on atkbdc0
kbd0 at atkbd0
atkbd0: [GIANT-LOCKED]
ppc0: parallel port not found.
Timecounters tick every 1.000 msec
hdacc0: <Realtek ALC262 HDA CODEC> at cad 1 on hdac0
hdaa0: <Realtek ALC262 Audio Function Group> at nid 1 on hdacc0
pcm0: <Realtek ALC262 (Analog)> at nid 20 and 25 on hdaa0
pcm1: <Realtek ALC262 (Digital)> at nid 30 on hdaa0
pcm2: <Realtek ALC262 (Rear Analog Line-in)> at nid 26 on hdaa0
ugen0.1: <(0x17f3) OHCI root HUB> at usbus0
ugen1.1: <(0x17f3) EHCI root HUB> at usbus1
uhub0 on usbus0
uhub1 on usbus1
uhub0: <(0x17f3) OHCI root HUB, class 9/0, rev 1.00/1.00, addr 1> on usbus0
uhub1: <(0x17f3) EHCI root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus1
Trying to mount root from ufs:/dev/ada0s2a [rw]...
ada0 at ata1 bus 0 scbus1 target 0 lun 0
ada0: <SanDisk SD8SB8U128G1122 X4140000> ACS-2 ATA SATA 3.x device
ada0: Serial Number 170393422404
ada0: 33.300MB/s transfers (UDMA2, PIO 512bytes)
ada0: 122104MB (250069680 512 byte sectors)
GEOM: ada0s1: invalid disklabel.
GEOM: diskid/DISK-170393422404s1: invalid disklabel.
uhub0: 4 ports with 4 removable, self powered
Root mount waiting for: usbus1
uhub1: 4 ports with 4 removable, self powered
ugen0.2: <SEM USB Keyboard> at usbus0
ukbd0 on uhub0
ukbd0: <SEM USB Keyboard, class 0/0, rev 1.10/1.10, addr 2> on usbus0
kbd2 at ukbd0
lo0: link state changed to UP
vte0: link state changed to DOWN
vte0: link state changed to UP
uhid0 on uhub0
uhid0: <SEM USB Keyboard, class 0/0, rev 1.10/1.10, addr 2> on usbus0
Security policy loaded: MAC/ntpd (mac_ntpd)

Diff Detail

rG FreeBSD src repository
Lint Not Applicable
Tests Not Applicable

Event Timeline

kevlo requested review of this revision.Apr 19 2022, 5:17 AM
kevlo updated this revision to Diff 105151.
kevlo created this revision.

Add a new RDC phy.

I guess this looks ok? I don't know the hardware well enough to really opined, but the code looks ok. I would maybe add the new phy ID as a separate commit.

This revision is now accepted and ready to land.Apr 21 2022, 5:36 PM