public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot-Users] Fix for MII utils
@ 2003-10-20 17:00 Steven Scholz
  2003-10-20 17:02 ` [U-Boot-Users] " Steven Scholz
  2003-10-20 19:22 ` [U-Boot-Users] " Wolfgang Denk
  0 siblings, 2 replies; 6+ messages in thread
From: Steven Scholz @ 2003-10-20 17:00 UTC (permalink / raw)
  To: u-boot

Hi there,

the attached patch addresses two MII related issues:
a) mii info <addr> ignored <addr> and always showed info for 32 PHYs
b) The "Trick" mentioned in miiphy_info():
"	* Trick: we are reading two 16 registers into a 32 bit variable
	* so we do a 16 read into the high order bits of the variable (big
	* endian, you know), shift it down 16 bits, and the read the rest."
     does obviously not work on little endian machines.

* Patch by Steven Scholz, 20 Oct 2003
   - "mii info <addr>" now only shows the info for PHY "addr" as the help
      message already suggests
   - Endian fix for miiphy_info()


Thanks,

Steven

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot-Users] Re: Fix for MII utils
  2003-10-20 17:00 [U-Boot-Users] Fix for MII utils Steven Scholz
@ 2003-10-20 17:02 ` Steven Scholz
  2003-12-06 22:50   ` Wolfgang Denk
  2003-10-20 19:22 ` [U-Boot-Users] " Wolfgang Denk
  1 sibling, 1 reply; 6+ messages in thread
From: Steven Scholz @ 2003-10-20 17:02 UTC (permalink / raw)
  To: u-boot

I wrote:

> * Patch by Steven Scholz, 20 Oct 2003
>   - "mii info <addr>" now only shows the info for PHY "addr" as the help
>      message already suggests
>   - Endian fix for miiphy_info()

:-(
Stupip Netscape...
Patch attached now.

Steven

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: mii_fix.patch
Url: http://lists.denx.de/pipermail/u-boot/attachments/20031020/8a812558/attachment.txt 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot-Users] Fix for MII utils
  2003-10-20 17:00 [U-Boot-Users] Fix for MII utils Steven Scholz
  2003-10-20 17:02 ` [U-Boot-Users] " Steven Scholz
@ 2003-10-20 19:22 ` Wolfgang Denk
  2003-10-21  5:39   ` Steven Scholz
  1 sibling, 1 reply; 6+ messages in thread
From: Wolfgang Denk @ 2003-10-20 19:22 UTC (permalink / raw)
  To: u-boot

In message <3F9414BC.8030701@imc-berlin.de> you wrote:
> 
> the attached patch addresses two MII related issues:

Patch missing.

Best regards,

Wolfgang Denk

-- 
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd at denx.de
Eschew obfuscation.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot-Users] Fix for MII utils
  2003-10-20 19:22 ` [U-Boot-Users] " Wolfgang Denk
@ 2003-10-21  5:39   ` Steven Scholz
  2003-11-06 11:17     ` Steven Scholz
  0 siblings, 1 reply; 6+ messages in thread
From: Steven Scholz @ 2003-10-21  5:39 UTC (permalink / raw)
  To: u-boot

Wolfgang Denk wrote:
> In message <3F9414BC.8030701@imc-berlin.de> you wrote:
> 
>>the attached patch addresses two MII related issues:
> 
> 
> Patch missing.

Hmmm. Sorry. :-(

Steven
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: mii_fix.patch
Url: http://lists.denx.de/pipermail/u-boot/attachments/20031021/df73ff10/attachment.txt 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot-Users] Fix for MII utils
  2003-10-21  5:39   ` Steven Scholz
@ 2003-11-06 11:17     ` Steven Scholz
  0 siblings, 0 replies; 6+ messages in thread
From: Steven Scholz @ 2003-11-06 11:17 UTC (permalink / raw)
  To: u-boot

Steven Scholz wrote:

Any comments on the patch?

> ------------------------------------------------------------------------
> 
> Index: common/cmd_mii.c
> ===================================================================
> RCS file: /cvsroot/u-boot/u-boot/common/cmd_mii.c,v
> retrieving revision 1.4
> diff -p -u -r1.4 cmd_mii.c
> --- common/cmd_mii.c	1 Jul 2003 21:07:07 -0000	1.4
> +++ common/cmd_mii.c	20 Oct 2003 16:53:16 -0000
> @@ -81,7 +81,7 @@ int do_mii (cmd_tbl_t * cmdtp, int flag,
>  	 * check info/read/write.
>  	 */
>  	if (op == 'i') {
> -		int j;
> +		unsigned char j, start, end;
>  		unsigned int oui;
>  		unsigned char model;
>  		unsigned char rev;
> @@ -89,7 +89,13 @@ int do_mii (cmd_tbl_t * cmdtp, int flag,
>  		/*
>  		 * Look for any and all PHYs.  Valid addresses are 0..31.
>  		 */
> -		for (j = 0; j < 32; j++) {
> +		if (argc >= 3) {
> +			start = addr; end = addr + 1;
> +		} else {
> +			start = 0; end = 32;
> +		}
> +
> +		for (j = start; j < end; j++) {
>  			if (miiphy_info (j, &oui, &model, &rev) == 0) {
>  				printf ("PHY 0x%02X: "
>  					"OUI = 0x%04X, "
> Index: common/miiphyutil.c
> ===================================================================
> RCS file: /cvsroot/u-boot/u-boot/common/miiphyutil.c,v
> retrieving revision 1.2
> diff -p -u -r1.2 miiphyutil.c
> --- common/miiphyutil.c	8 Oct 2003 22:33:00 -0000	1.2
> +++ common/miiphyutil.c	20 Oct 2003 16:53:16 -0000
> @@ -47,19 +47,15 @@ int miiphy_info (unsigned char addr,
>  		 unsigned char *model, unsigned char *rev)
>  {
>  	unsigned int reg = 0;
> +	unsigned short tmp;
>  
> -	/*
> -	 * Trick: we are reading two 16 registers into a 32 bit variable
> -	 * so we do a 16 read into the high order bits of the variable (big
> -	 * endian, you know), shift it down 16 bits, and the read the rest.
> -	 */
> -	if (miiphy_read (addr, PHY_PHYIDR2, (unsigned short *) &reg) != 0) {
> +	if (miiphy_read (addr, PHY_PHYIDR2, &tmp) != 0) {
>  #ifdef DEBUG
>  		printf ("PHY ID register 2 read failed\n");
>  #endif
>  		return (-1);
>  	}
> -	reg >>= 16;
> +	reg = tmp;
>  
>  #ifdef DEBUG
>  	printf ("PHY_PHYIDR2 @ 0x%x = 0x%04x\n", addr, reg);
> @@ -69,12 +65,13 @@ int miiphy_info (unsigned char addr,
>  		return (-1);
>  	}
>  
> -	if (miiphy_read (addr, PHY_PHYIDR1, (unsigned short *) &reg) != 0) {
> +	if (miiphy_read (addr, PHY_PHYIDR1, &tmp) != 0) {
>  #ifdef DEBUG
>  		printf ("PHY ID register 1 read failed\n");
>  #endif
>  		return (-1);
>  	}
> +	reg |= tmp << 16;
>  #ifdef DEBUG
>  	printf ("PHY_PHYIDR[1,2] @ 0x%x = 0x%08x\n", addr, reg);
>  #endif


-- 
Steven Scholz

imc Measurement & Control               imc Me?systeme GmbH
Voltastr. 5                             Voltastr. 5
13355 Berlin                            13355 Berlin
Germany                                 Deutschland
fon: +49 30 467090-0                    Tel: 030 / 467090-0
fax: +49 30 4631576                     fax: 030 / 4631576

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot-Users] Re: Fix for MII utils
  2003-10-20 17:02 ` [U-Boot-Users] " Steven Scholz
@ 2003-12-06 22:50   ` Wolfgang Denk
  0 siblings, 0 replies; 6+ messages in thread
From: Wolfgang Denk @ 2003-12-06 22:50 UTC (permalink / raw)
  To: u-boot

In message <3F94151D.2000205@imc-berlin.de> you wrote:
> 
> > * Patch by Steven Scholz, 20 Oct 2003
> >   - "mii info <addr>" now only shows the info for PHY "addr" as the help
> >      message already suggests
> >   - Endian fix for miiphy_info()

Added. Sorry it took so long.

Best regards,

Wolfgang Denk

-- 
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd at denx.de
Genius doesn't work on an assembly line basis.  You can't simply say,
"Today I will be brilliant."
	-- Kirk, "The Ultimate Computer", stardate 4731.3

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2003-12-06 22:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-10-20 17:00 [U-Boot-Users] Fix for MII utils Steven Scholz
2003-10-20 17:02 ` [U-Boot-Users] " Steven Scholz
2003-12-06 22:50   ` Wolfgang Denk
2003-10-20 19:22 ` [U-Boot-Users] " Wolfgang Denk
2003-10-21  5:39   ` Steven Scholz
2003-11-06 11:17     ` Steven Scholz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox