All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Garzik <jeff@garzik.org>
To: Kim Phillips <kim.phillips@freescale.com>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH 2/6] phylib: add the ICPlus IP175C PHY driver
Date: Wed, 09 May 2007 19:35:35 -0400	[thread overview]
Message-ID: <46425AC7.5070808@garzik.org> (raw)
In-Reply-To: <20070508175010.4c024666.kim.phillips@freescale.com>

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


      reply	other threads:[~2007-05-09 23:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-08 22:50 [PATCH 2/6] phylib: add the ICPlus IP175C PHY driver Kim Phillips
2007-05-09 23:35 ` Jeff Garzik [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46425AC7.5070808@garzik.org \
    --to=jeff@garzik.org \
    --cc=kim.phillips@freescale.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.