From: Ben Warren <bwarren@qstreams.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH] PPC4xx: Add Ethernet 1000BASE-X support for PPC4xx
Date: Mon, 29 Oct 2007 16:26:55 -0400 [thread overview]
Message-ID: <4726420F.8010008@qstreams.com> (raw)
In-Reply-To: <472611C8.4050107@arlinx.com>
Larry Johnson wrote:
> This patch adds a new switch: "CONFIG_PHY_DYNAMIC_ANEG". When this symbol
> is defined, the PHY will advertise it's capabilities for autonegotiation
> based on the capabilities shown in the PHY's status registers, including
> 1000BASE-X. When "CONFIG_PHY_DYNAMIC_ANEG" is not defined, the PHY will
> advertise hard-coded capabilities, as before.
>
>
<snip>
> -
> /*****************************************************************************
> *
> - * Determine the ethernet speed (10/100).
> + * Determine the ethernet speed (10/100/1000). Return 10 on error.
> */
> int miiphy_speed (char *devname, unsigned char addr)
> {
> - unsigned short reg;
> + u16 bmcr;
>
> #if defined(CONFIG_PHY_GIGE)
> - if (miiphy_read (devname, addr, PHY_1000BTSR, ®)) {
> - printf ("PHY 1000BT Status read failed\n");
> - } else {
> - if (reg != 0xFFFF) {
> - if ((reg & (PHY_1000BTSR_1000FD | PHY_1000BTSR_1000HD)) !=0) {
> - return (_1000BASET);
> - }
> + u16 btsr;
> +
> +#if defined(CONFIG_PHY_DYNAMIC_ANEG)
> + u16 bmsr;
> +
> + /* Check for 1000BASE-X. */
> + if (miiphy_read (devname, addr, PHY_BMSR, &bmsr)) {
> + printf ("PHY status");
> + goto miiphy_read_failed;
> + }
> + if (bmsr & PHY_BMSR_EXT_STAT) {
> + u16 exsr;
>
Please don't define variables in code blocks. The original code used a
single variable called 'reg' that worked well enough. The bitmasks
(PHY_BMSR_* and so on) effectively tell the reader what register he/she
is looking at.
I'm going to stop here and wait for you to separate content from
cosmetic, and hopefully fix up what I've mentioned here.
regards,
Ben
next prev parent reply other threads:[~2007-10-29 20:26 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-29 17:00 [U-Boot-Users] [PATCH] PPC4xx: Add Ethernet 1000BASE-X support for PPC4xx Larry Johnson
2007-10-29 17:33 ` Ben Warren
2007-10-29 18:41 ` Larry Johnson
2007-10-29 19:14 ` Jon Loeliger
2007-10-29 19:30 ` Stefan Roese
2007-10-29 19:43 ` Larry Johnson
2007-10-29 19:37 ` Ben Warren
2007-10-29 20:26 ` Wolfgang Denk
2007-10-29 20:25 ` Wolfgang Denk
2007-10-29 21:36 ` Larry Johnson
2007-10-29 19:33 ` Stefan Roese
2007-10-29 20:26 ` Ben Warren [this message]
2007-10-29 22:01 ` Larry Johnson
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=4726420F.8010008@qstreams.com \
--to=bwarren@qstreams.com \
--cc=u-boot@lists.denx.de \
/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