lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sun, 23 Dec 2018 11:43:05 +0100
From:   Marek Vasut <marex@...x.de>
To:     Andrew Lunn <andrew@...n.ch>
Cc:     linux-usb@...r.kernel.org,
        "David S . Miller" <davem@...emloft.net>,
        Nisar Sayed <Nisar.Sayed@...rochip.com>,
        Woojung Huh <Woojung.Huh@...rochip.com>,
        netdev <netdev@...r.kernel.org>,
        Florian Fainelli <f.fainelli@...il.com>
Subject: Re: [PATCH] smsc95xx: Add support for automated PHY address detection

On 12/23/18 11:23 AM, Andrew Lunn wrote:
>>> +static int smsc95xx_phy_address(struct usbnet *dev)
>>> +{
>>> +	u32 read_buf;
>>> +	int ret, id1, id2, phyad;
>>> +
>>> +	ret = smsc95xx_read_reg(dev, HW_CFG, &read_buf);
>>> +	if (ret < 0)
>>> +		return ret;
>>> +
>>> +	/* Check if using external PHY, if not, use internal PHY address */
>>> +	if (!(read_buf & HW_CFG_PSEL_))
>>> +		return SMSC95XX_INTERNAL_PHY_ID;
>>> +
>>> +	/*
>>> +	 * Detect external PHY address. Here we probe the MDIO bus from
>>> +	 * the highest address, since some PHYs respond also on address
>>> +	 * zero, which they consider MDIO broadcast address. We really
>>> +	 * want to get their proper address instead though, so we scan
>>> +	 * address zero last.
>>> +	 */
>>> +	for (phyad = 0x1f; phyad >= 0; phyad--) {
>>> +		id1 = smsc95xx_mdio_read(dev->net, phyad, MII_PHYSID1);
>>> +		id2 = smsc95xx_mdio_read(dev->net, phyad, MII_PHYSID2);
>>> +		/* Check for valid response from the PHY */
>>> +		if (id1 > 0 && id2 > 0 && id1 != 0x7fff && id2 != 0xffff)
>>> +			return phyad;
>>> +	}
> 
> This would be so much easier if the driver used the core mdio/phy
> code. Just set mdio->phy_mask to ~BIT(0) and then use
> phy_find_first().

That's in the pipeline, along with PM cleanups, but low prio.

> Anyway, net is closed at the moment, so please repost in three weeks
> time.

OK

-- 
Best regards,
Marek Vasut

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ