Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c8014fe1 authored by Florian Fainelli's avatar Florian Fainelli Committed by David S. Miller
Browse files

r6040: check for absent PHY



Some devices have two R6040 MACs but the second one
is not wired to any PHY, therefore the interface is
just unusable. Warn the user about that and prevent
device from registering.

Tested-by: default avatarbifferos <bifferos@yahoo.co.uk>
Signed-off-by: default avatarFlorian Fainelli <florian@openwrt.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent aee64faf
Loading
Loading
Loading
Loading
+8 −0
Original line number Original line Diff line number Diff line
@@ -742,6 +742,14 @@ static int r6040_up(struct net_device *dev)
	struct r6040_private *lp = netdev_priv(dev);
	struct r6040_private *lp = netdev_priv(dev);
	void __iomem *ioaddr = lp->base;
	void __iomem *ioaddr = lp->base;
	int ret;
	int ret;
	u16 val;

	/* Check presence of a second PHY */
	val = r6040_phy_read(ioaddr, lp->phy_addr, 2);
	if (val == 0xFFFF) {
		printk(KERN_ERR DRV_NAME " no second PHY attached\n");
		return -EIO;
	}


	/* Initialise and alloc RX/TX buffers */
	/* Initialise and alloc RX/TX buffers */
	r6040_init_txbufs(dev);
	r6040_init_txbufs(dev);