Netdev List
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Jens Osterkamp <jens@de.ibm.com>
Cc: jgarzik@pobox.com, Linas Vepstas <linas@austin.ibm.com>,
	James K Lewis <jim@jklewis.com>,
	Ishizaki Kou <kou.ishizaki@toshiba.co.jp>,
	netdev@vger.kernel.org, cbe-oss-dev@ozlabs.org
Subject: Re: [PATCH] [v3] spidernet : add improved phy support
Date: Tue, 13 Feb 2007 08:40:57 +1100	[thread overview]
Message-ID: <1171316457.20192.21.camel@localhost.localdomain> (raw)
In-Reply-To: <200702122135.34417.jens@de.ibm.com>


> +static int bcm5461_enable_fiber(struct mii_phy* phy, int autoneg)
> +{
> +	/* select fiber mode, enable 1000 base-X registers */
> +	phy_write(phy, MII_NCONFIG, 0xfc0b);
> +
> +	if (autoneg) {
> +		/* enable fiber with no autonegotiation */
> +		phy_write(phy, MII_ADVERTISE, 0x01e0);
> +		phy_write(phy, MII_BMCR, 0x1140);
> +	} else {
> +		/* enable fiber with autonegotiation */
> +		phy_write(phy, MII_BMCR, 0x0140);
> +	}
> +
> +	phy->autoneg = autoneg;
> +
> +	return 0;
> +}

Something is backward... either the code or the comments...

Also, I dislike the autoneg bits without using any constants. Why not
use the normal setup_aneg() ? I think what is needed is a set_link_mode
or something like that that takes (fiber/copper) as an argument (or
better, use the proper names as documented by the chip).

Doesn't matter to much right now, if the code works. Have you had a
chance to check you don't break G5s with 5421 sungem ? If yes, then the
patch is good to go for now but we should revisit and/or try to merge
that with the generic PHY layer at one point.

Ben.
 


  reply	other threads:[~2007-02-12 21:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-12 20:35 [PATCH] [v3] spidernet : add improved phy support Jens Osterkamp
2007-02-12 21:40 ` Benjamin Herrenschmidt [this message]
2007-02-12 23:26 ` Linas Vepstas

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=1171316457.20192.21.camel@localhost.localdomain \
    --to=benh@kernel.crashing.org \
    --cc=cbe-oss-dev@ozlabs.org \
    --cc=jens@de.ibm.com \
    --cc=jgarzik@pobox.com \
    --cc=jim@jklewis.com \
    --cc=kou.ishizaki@toshiba.co.jp \
    --cc=linas@austin.ibm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox