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] [day] [month] [year] [list]
Message-ID: <46425AC7.5070808@garzik.org>
Date:	Wed, 09 May 2007 19:35:35 -0400
From:	Jeff Garzik <jeff@...zik.org>
To:	Kim Phillips <kim.phillips@...escale.com>
CC:	netdev@...r.kernel.org
Subject: Re: [PATCH 2/6] phylib: add the ICPlus IP175C PHY driver

Kim Phillips wrote:
> +		/* master reset */
> +		err = phydev->bus->write(phydev->bus, 30, 0, 0x175c);
> +		if (err < 0)
> +			return err;
> +
> +		/* data sheet specifies reset period is 2 msec */
> +		udelay(3000);
> +
> +		/* enable IP175C mode */
> +		err = phydev->bus->write(phydev->bus, 29, 31, 0x175c);
> +		if (err < 0)
> +			return err;

1) use mdelay()

2) write-followed-by-delay does not guarantee the delay, because you 
have not factored in PCI posting (or other bus delays)


> +		/* Set MII0 speed and duplex (in PHY mode) */
> +		err = phydev->bus->write(phydev->bus, 29, 22, 0x420);
> +		if (err < 0)
> +			return err;
> +
> +		for (i=0; i<5; i++) {
> +			err = phydev->bus->write(phydev->bus, i, MII_BMCR, BMCR_RESET);
> +		}
> +		udelay(3000);

ditto


> +		full_reset_performed = 1;
> +	}
> +
> +	if (phydev->addr != 4) {
> +		phydev->state = PHY_RUNNING;
> +		phydev->speed = SPEED_100;
> +		phydev->duplex = DUPLEX_FULL;
> +		phydev->link = 1;
> +		netif_carrier_on(phydev->attached_dev);
> +	}
> +
> +	return 0;
> +}
> +
> +static int ip175c_read_status(struct phy_device *phydev)
> +{
> +	if (phydev->addr == 4) { /* if WAN port */
> +		genphy_read_status(phydev);
> +	} else {
> +		/* Don't need to read status for switch ports */
> +		phydev->irq = PHY_IGNORE_INTERRUPT;
> +	}
> +
> +	return 0;
> +}
> +
> +
> +static int ip175c_config_aneg(struct phy_device *phydev)
> +{
> +	if (phydev->addr == 4) { /* if WAN port */
> +		genphy_config_aneg(phydev);
> +	}

codingstyle: remove braces around single C statements

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ