On Sat, Dec 5, 2026 at 5:27 AM Віктор <vaks…@gmail.com> wrote:
> > Hi James, Alastair, all, > > While debugging 100 Mbit/s link flapping on Orange Pi Zero 2W (H618, > co-packaged AC300 EPHY) we measured how bits 15:12 of AC300 register > 0x06 affect the transmitted signal. The results suggest that the > calibration formula inherited from the Allwinner BSP, > > bgs = (0x03 + efuse_nibble) & 0xF; /* written to 0x06[15:12] */ > > produces the *weakest* TX drive on our boards, and that using the raw > eFuse nibble (no +3) gives a nominal 100BASE-TX level. As far as we can > see, the same offset is in the AC200/AC300 EPHY driver now in net-next > (AC300_EPHY_BGS_EFFUSE_OFFSET = 3) and in the ac300-phy.c series > ("(0x0F & (0x03 + caldata)) << 12"), so we would like to share the data. > > Disclosure: the investigation was done with the help of an AI assistant > (an LLM agent driving the board over SSH and analysing data) and a bench > oscilloscope. All numbers below come from the instrument; the > interpretation is ours and may be wrong -- we have no AC300 register > documentation. > > Setup > ----- > - Boards: Orange Pi Zero 2W (H618 + AC300), Ethernet via the 24-pin > expansion board (RJ45 + magnetics). Vendor BSP kernel 6.12.82 with > sunxi-gmac / sunxi-ephy (same calibration formula as above). > - eFuse SID 0x2c (2 bytes): bit 8 = AC300, bit 9 = 0 ("default" table), > low nibble = 5 or 6 on all boards we have: > board 1: 0x0505 board 2: 0x0505 board 3..5: 0x0506 (nibble 6) > -> driver writes 0x8802 (nibble 5) or 0x9802 (nibble 6). > - Register writes done at runtime through the BSP sunxi-gmac sysfs > mii_write; only bits 15:12 changed, low 12 bits kept (0x802). > - Scope: Hantek DSO5102P (100 MHz, 1 GS/s), x10 probe single-ended on > one wire of the TX pair (patch cord jacket opened, pair not untwisted), > ground on board GND. Link partner: Realtek USB GbE (holds 100 Mbit/s > link at every setting). Short persistence; cursors on the middle of > the MLT-3 plateaus, i.e. without edge overshoot. 100BASE-TX nominal > +-1 V +-5 % differential corresponds to 0.95..1.05 V plateau-to- > plateau on one wire. > - Pair identification: auto MDI-X may swap pairs on every link-up, so > before each board we checked that 0x8 -> 0x7 increases the amplitude > by ~0.45 V on the probed pair. > > Symptom > ------- > With the driver value (0x8/0x9) the link to an ASIX AX88179 USB adapter > (and to some routers) comes up at 100/Full and drops after ~1 s, cycle > ~3 s ("Link is Up - 100Mbps/Full" / "Link is Down"); BMSR shows link, > then it is lost after ~0.75 s (link_fail_inhibit_timer). 10 Mbit/s is > stable. No RX errors. A Realtek USB adapter keeps the link at 0x8. > Ruled out: cable/port, PWM 24 MHz clock (registers stable), services. > > Measurements: plateau-to-plateau amplitude on one wire, volts > -------------------------------------------------------------- > 0x06[15:12] 8 9 a b c d e f > as signed -8 -7 -6 -5 -4 -3 -2 -1 > board 2 .576 .608 .640 .672 .712 .736 .776 .816 > board 3 .560 .584 .624 .656 .704 .720 .768 .800 > board 4 .576 .608 .624 .664 .696 .728 .760 .784 > board 5 .592 .616 .624 .656 .696 .736 .776 .800 > > 0x06[15:12] 0 1 2 3 4 5 6 7 > as signed +0 +1 +2 +3 +4 +5 +6 +7 > board 2 .848 .872 .896 .936 .960 1.000 1.030 1.035 > board 3 .840 .872 .896 .936 .968 1.000 1.040 1.080 > board 4 .816 .840 .864 .904 .936 .968 1.000 1.020 > board 5 .840 .864 .896 .912 .928 .968 1.000 1.020 > > (board 2: eFuse nibble 5, driver value 8; boards 3-5: nibble 6, > driver value 9.) > > - The field behaves as a 4-bit two's-complement trim: amplitude rises > monotonically from 0x8 (-8) through 0xf, 0x0 to 0x7 (+7), > ~33 mV/step, chip-to-chip spread <= ~4 %. > - The driver value gives 0.58..0.62 V, i.e. ~40 % below nominal. > - Nominal 1.0 V is reached at +5 (boards 2, 3) or +6 (boards 4, 5).
I swept all 16 codes on two H616 boards, one with an AC200 and one with an AC300. On both, 100BASE-TX amplitude rose monotonically in signed order, from 0x8 (-8) to 0x7 (+7). Adding 3 to factory codes 5, 6 and 7 yields the bit patterns 0x8, 0x9 and 0xa. In four-bit two's complement those encode -8, -7 and -6, the three weakest settings. These are the spans between the outer idle plateaus, in mV at the scope input. I probed one PHY-side transformer lead with the same setup on both boards; the AC300 was using its normal preset. Code 0x0 0x1 0x4 0x5 0x6 0x7 0x8 0x9 0xa AC200 105.0 109.6 118.8 123.3 126.3 131.2 72.9 77.7 78.9 AC300 95.9 99.2 109.6 113.2 115.2 121.7 65.2 69.6 74.9 Those three negative settings were 28-33% below the span at the AC200 board's own factory code (0x1) and 35-43% below the span at the AC300 board's factory code (0x6).
> > Link test with the sensitive partner (ASIX AX88179), board 5 > ------------------------------------------------------------- > value 8 9* a b c d e f 0 1 2 3 4 5 6 7 > flaps/15 s 8 9 10 7 0 0 0 0 0 0 0 0 0 0 0 0 > (* = driver value) > > - Threshold for this receiver is between 0xb (0.656 V) and 0xc > (0.696 V). > - At 5, 6 and 7: 3000 pings of 1400 bytes every 10 ms, 0 % loss, > 0 link flaps, 0 RX errors on both sides.
Thanks for testing with the AX88179. My AC300 has the same low 16 fuse bits as your board 5 (0x0506). In a separate run the median span fell from 116.09 mV at 0x6 to 70.74 mV at 0x9, a 39.1% drop. My Intel I211 kept the link up at both settings. Your board 5 showed much the same drop (1.000 V to 0.616 V), but the AX88179 also exposed the link loss: nine flaps in 15 seconds at 0x9 and none at 0x6.
> - Board 1 (eFuse 5), earlier test with the same ASIX adapter: 0x8, 0x9, > 0xa flap (5..10 per 15 s), every other value is stable. > > For completeness, an earlier sweep on board 2 measured with the edge > overshoot included (persistence envelope, not plateaus) gave > 0.888 V at 0x8 ... 1.42 V at 0x7, same monotonic order; overshoot added > ~20-25 %, so those numbers should not be compared to the 100BASE-TX > level. > > Hypothesis > ---------- > The "+3" looks like it was carried over from the AC200 (H6) code, > where the field sits in a different register (I2C 0x6000) and may have > a different meaning/offset. For AC300 on these H618 parts, the raw eFuse > nibble alone gives: > > board 2 (nibble 5) -> 1.000 V > board 3 (nibble 6) -> 1.040 V > board 4 (nibble 6) -> 1.000 V > board 5 (nibble 6) -> 1.000 V > > all within 100BASE-TX tolerance, whereas (3 + nibble) wraps to -8/-7. > We changed the BSP driver locally to > > value |= (0x0F & ephy_cali) << 12;
The offset was in the vendor's H6 AC200 code. The later vendor AC300 code used the same formula, and mainline copied it. It may have been a bring-up setting, but I found no record of why it was chosen. On my AC200, keeping the offset (fuse 0x1, programmed 0x4) gave 118.80 mV. That's 3.65 mV (3.2%) above the AC300 at its factory code of 0x6 (115.15 mV). Without the AC200 offset I measured 109.59 mV, 5.56 mV (4.8%) below the AC300. Keeping the offset on AC200 gave the closer match on these two boards.
> > What we cannot tell > ------------------- > - The real meaning of the field (your drivers name it BGS, bandgap > select; we only observe that it scales the TX amplitude).
The sweeps show that changing the field scales TX amplitude. They don't establish which analog circuit it trims or whether it changes an ADC reference.
> - Whether "+3" is right for other nibble values (we only have 5 and > 6); a board with nibble 0..4 would discriminate between "raw nibble" > and "constant value" hypotheses.
We collected 1,705 H616 SoC eFuse readings. These are the counts for the low nibble at 0x0300622c (SID offset 0x2c), split by PHY variant using bit 8: Fuse code (hex) 0 1 2 3 4 5 6 7 8-f Total AC200 2 3 5 1 0 0 0 0 0 11 AC300 19 33 81 241 455 464 309 92 0 1,694 On AC300, 829 readings had codes 0..4. The other 865 (51.1%) had codes 5..7, where the old formula selects a negative trim. Keeping +3 and capping at +7 would instead map 1,320 of the 1,694 AC300 readings to +7. The survey tells us which codes the factory programmed, not what voltage each of those boards produced or how many lost link.
> - Absolute accuracy: single-ended measurement with a 100 MHz scope, > estimated +-5..10 %; relative comparison between settings is > reliable (same setup, same probe point).
The 0.95-1.05 V limit applies to the magnitude of each settled differential level [2]. Neither single-ended setup measures that directly. A differential measurement across a 100-ohm test load on board 5 at codes 6, 7 and 9 would let us compare the factory setting, the positive endpoint and the old driver setting against that limit.
> - Whether the BIT(9) "low calibration" table changes the picture.
I selected the alternate preset in software and swept all 16 codes on the same AC300. Going from 0x7 to 0x8 dropped the span from 137.5 to 75.5 mV, compared with 121.7 to 65.2 mV on the normal preset. The preset shifted the levels but didn't change their signed ordering.
> - We did not test the mainline driver itself, only the BSP one with > the same formula.
I posted the fix to netdev and Cc'd you [0]. It uses the factory trim on AC300, so board 5 gets 0x6 (+6) instead of 0x9 (-7). AC200 keeps the +3 offset. On both variants, if either the signed factory trim or the adjusted result falls outside 0..+7, the driver warns at probe and programs +7. That catches an AC200 fuse of 0xd (-3) even though adding 3 gives zero. None of the 1,705 readings would trigger the warning, and all 11 AC200 readings keep their previous setting.
> If someone has the AC300 documentation or the Allwinner rationale for > the +3, it would be great to know. We can run more measurements if that > helps.
The AC300 user manual [1] labels register 0x06[15:12] BGS_EFFUSE. I haven't found an Allwinner document that explains the offset. Could you try the posted patch on board 5 with the AX88179 at 100 Mbit/s and repeat the ping test? A result on the patch thread would confirm whether the mainline fix keeps that link up too. If it does, a Tested-by would be useful. [0] https://lore.kernel.org/all/2026…@gmail.com/ [1] https://github.com/DeciHD/allwinner_docs/blob/main/mfd_xpowers/AC300_User_Manual_V1.0.pdf [2] https://www.iol.unh.edu/sites/default/files/testsuites/ethernet/CL25_PMD/PMD_Test_Suite_v3.4.pdf#page=9
> > Thanks, > Viktor Lazarev <vaks…@gmail.com>