diff --git a/drivers/net/usb/sr9700.c b/drivers/net/usb/sr9700.c index cb7d2f798fb4..0060f9aa21f7 100644 --- a/drivers/net/usb/sr9700.c +++ b/drivers/net/usb/sr9700.c @@ -50,10 +50,15 @@ static int sr_read_reg(struct usbnet *dev, u8 reg, u8 *value) return sr_read(dev, reg, 1, value); } +/* SoftwareCannery: a zero-length WR_REGS (value in wValue, no data stage) never completes through WebUSB on + * Android, and WebUSB has no control-transfer timeout; the same register write with a 1-byte data stage does. */ +static int sr_write(struct usbnet *dev, u8 reg, u16 length, void *data); static int sr_write_reg(struct usbnet *dev, u8 reg, u8 value) { - return usbnet_write_cmd(dev, SR_WR_REGS, SR_REQ_WR_REG, - value, reg, NULL, 0); + /* SoftwareCannery 2026-11-13: WR_REG (0x03), value in wValue, no data stage. Zero-length WR_REGS (0x01) + * never completes through WebUSB on Android, and the chip ignores a 1-byte WR_REGS write (PHY reads + * stayed 0xFFFF and RX never started). 0x03 completes and takes effect (the reset already used it). */ + return usbnet_write_cmd(dev, SR_WR_REG, SR_REQ_WR_REG, value, reg, NULL, 0); } static void sr_write_async(struct usbnet *dev, u8 reg, u16 length, @@ -65,7 +70,7 @@ static void sr_write_async(struct usbnet *dev, u8 reg, u16 length, static void sr_write_reg_async(struct usbnet *dev, u8 reg, u8 value) { - usbnet_write_cmd_async(dev, SR_WR_REGS, SR_REQ_WR_REG, + usbnet_write_cmd_async(dev, SR_WR_REG, SR_REQ_WR_REG, value, reg, NULL, 0); } @@ -222,6 +227,11 @@ static void sr_mdio_write(struct net_device *netdev, int phy_id, int loc, netdev_dbg(netdev, "Only internal phy supported\n"); return; } + /* SoftwareCannery 2026-11-13: through WebUSB the PHY data register (EPDR) never takes the data-stage + * write, so a PHY write would store 0xFFFF (power-down|isolate) and kill the link. The PHY's power-on + * defaults autonegotiate correctly, so PHY writes are skipped. */ + if (1) + return; netdev_dbg(netdev, "sr_mdio_write() phy_id=0x%02x, loc=0x%02x, val=0x%04x\n", phy_id, loc, val); @@ -270,7 +280,9 @@ static void sr9700_set_multicast(struct net_device *netdev) */ u8 *hashes = (u8 *)&dev->data; /* rx_ctl setting : enable, disable_long, disable_crc */ - u8 rx_ctl = RCR_RXEN | RCR_DIS_CRC | RCR_DIS_LONG; + /* SoftwareCannery: promiscuous always - the multicast table (incl. the broadcast bit) is a data-stage + * write that does not land through WebUSB, so without this ARP broadcasts are filtered out. */ + u8 rx_ctl = RCR_RXEN | RCR_DIS_CRC | RCR_DIS_LONG | RCR_PRMSC; memset(hashes, 0x00, SR_MCAST_SIZE); /* broadcast address */ @@ -350,7 +362,10 @@ static int sr9700_bind(struct usbnet *dev, struct usb_interface *intf) mii->phy_id_mask = 0x1f; mii->reg_num_mask = 0x1f; - sr_write_reg(dev, SR_NCR, NCR_RST); + /* SoftwareCannery: the reset goes out as WR_REG (0x03), as dm9601 sends it. The chip resets in the middle + * of a zero-length WR_REGS (0x01) and never finishes that request; a PC host times it out after 5 s, but + * WebUSB has no control-transfer timeout, so the device would stay wedged. Everything else is stock. */ + usbnet_write_cmd(dev, SR_WR_REG, SR_REQ_WR_REG, NCR_RST, SR_NCR, NULL, 0); udelay(20); /* read MAC @@ -366,7 +381,8 @@ static int sr9700_bind(struct usbnet *dev, struct usb_interface *intf) eth_hw_addr_set(netdev, addr); /* power up and reset phy */ - sr_write_reg(dev, SR_PRR, PRR_PHY_RST); + /* SoftwareCannery: no PHY reset - after a reset the PHY needs MII writes (autoneg restart) that cannot land through WebUSB; its power-on state links fine. */ + if (0) sr_write_reg(dev, SR_PRR, PRR_PHY_RST); /* at least 10ms, here 20ms for safe */ msleep(20); sr_write_reg(dev, SR_PRR, 0);