Hey All,
I've been trying to get the Virtual Cable Test working on an AR8327 switch, but so far, no panache. I can read the registers, but I'm getting not very sensible results.
Question 1: within openwrt/switchdev, the vlan_port
maps to the PHY in the end? The number seems to match from that at last.
Question 2: The PHY MII address, is 0 - 5 is for the actual PHY's right? not some offset or anything.
Question 3: Though I'll try this next anyway, After poking the PHY registers, do we need to reset the switch via the BMCR? I know some changes to the PHY's require a PHY reset ...
Question 4: I see in AR8216.h the register 0x0098 as 'MDIO_CTRL' yet in all other datasheets this is called the 'HEADER_CTR" register. I know this chip can be controlled either via MDIO, or by injecting a few bytes into the TCP header. I haven't figured out how this switch chip is controlled exactly, but is it using this header injection? What's more interesting, all other datasheets, put the MDIO control on 0x003c. Is there some offset I missed? All supported chips in the driver use this same register ...
If there's any other thoughts on how to make this work, that would be much appreciated. Even if some vendor firmware offers this functionality. Of course it could be very much so the case, that this feature is simply broken in the PHY. The original firmware of the DUT (WDR4300) doesn't offer this feature in any case. What I have so far:
mutex_lock(&bus->mdio_lock);
for (unsigned int i = 0; i < result_len; i++) {
int val = -EINVAL;
int reg;
bus->write(bus, port, 0x16, i << 8 | 1);
ret = read_poll_timeout(bus->read, val,
val == 0, 1000, 100000, true /* false */,
bus, port, 0x16);
if (ret == -ETIMEDOUT)
goto out;
reg = bus->read(bus, port, 0x1c);
pr_err("Reg: 0x%x\n", reg);
};
mutex_unlock(&bus->mdio_lock);