All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH 3/9] Add Ethernet 1000BASE-X support for PPC4xx
Date: Thu, 27 Dec 2007 16:11:47 +0100	[thread overview]
Message-ID: <200712271611.47715.sr@denx.de> (raw)
In-Reply-To: <476D7037.8090901@arlinx.com>

On Saturday 22 December 2007, 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.

Sorry for the late review, but I have still some remarks. Please see below.

> Signed-off-by: Larry Johnson <lrj@acm.org>
> ---
>  cpu/ppc4xx/miiphy.c |  143
> +++++++++++++++++++++++++++++++++++--------------- 1 files changed, 100
> insertions(+), 43 deletions(-)
>
> diff --git a/cpu/ppc4xx/miiphy.c b/cpu/ppc4xx/miiphy.c
> index 98ba0a7..97ec023 100644
> --- a/cpu/ppc4xx/miiphy.c
> +++ b/cpu/ppc4xx/miiphy.c
> @@ -27,19 +27,6 @@
>
>    |  Author:	 Mark Wisner
>
> -  |  Change Activity-
> -  |
> -  |  Date	 Description of Change					     BY
> -  |  ---------	 ---------------------					     ---
> -  |  05-May-99	 Created						     MKW
> -  |  01-Jul-99	 Changed clock setting of sta_reg from 66Mhz to 50Mhz to
> -  |		 better match OPB speed. Also modified delay times.	     JWB
> -  |  29-Jul-99	 Added Full duplex support				     MKW
> -  |  24-Aug-99	 Removed printf from dp83843_duplex()			     JWB
> -  |  19-Jul-00	 Ported to esd cpci405					     sr
> -  |  23-Dec-03	 Ported from miiphy.c to 440GX Travis Sawyer		     TBS
> -  |		 <travis.sawyer@sandburst.com>
> -  |
>   
> +--------------------------------------------------------------------------
>---*/
>
>  #include <common.h>
> @@ -61,7 +48,6 @@ void miiphy_dump (char *devname, unsigned char addr)
>  	unsigned long i;
>  	unsigned short data;
>
> -
>  	for (i = 0; i < 0x1A; i++) {
>  		if (miiphy_read (devname, addr, i, &data)) {
>  			printf ("read error for reg %lx\n", i);
> @@ -76,15 +62,87 @@ void miiphy_dump (char *devname, unsigned char addr)
>  	}			/* end for loop */
>  }				/* end dump */
>
> -
>  /***********************************************************/
>  /* (Re)start autonegotiation				   */
>  /***********************************************************/
>  int phy_setup_aneg (char *devname, unsigned char addr)
>  {
> -	unsigned short ctl, adv;
> +	u16 bmcr;
> +
> +#if defined(CONFIG_PHY_DYNAMIC_ANEG)
> +	/*
> +	 * Set up advertisement based on capablilities reported by the PHY.
> +	 * This should work for both copper and fiber.
> +	 */
> +	u16 bmsr;
> +#if defined(CONFIG_PHY_GIGE)
> +	u16 exsr = 0x0000;
> +#endif
> +
> +	miiphy_read (devname, addr, PHY_BMSR, &bmsr);
> +
> +#if defined(CONFIG_PHY_GIGE)
> +	if (bmsr & PHY_BMSR_EXT_STAT) {
> +		miiphy_read (devname, addr, PHY_EXSR, &exsr);
> +	}

No parantheses (braces ?) for one line statements please.

> +	if (exsr & (PHY_EXSR_1000XF | PHY_EXSR_1000XH)) {
> +		/* 1000BASE-X */
> +		u16 anar = 0x0000;
> +
> +		if (exsr & PHY_EXSR_1000XF) {
> +			anar |= PHY_X_ANLPAR_FD;
> +		}
> +		if (exsr & PHY_EXSR_1000XH) {
> +			anar |= PHY_X_ANLPAR_HD;
> +		}

Again, please check the complete source for such on lined statements and 
remove those braces.

Thanks.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================

      reply	other threads:[~2007-12-27 15:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-22 20:14 [U-Boot-Users] [PATCH 3/9] Add Ethernet 1000BASE-X support for PPC4xx Larry Johnson
2007-12-27 15:11 ` Stefan Roese [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=200712271611.47715.sr@denx.de \
    --to=sr@denx.de \
    --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 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.