From: Steven Scholz <steven.scholz@imc-berlin.de>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] Fix for MII utils
Date: Thu, 06 Nov 2003 12:17:17 +0100 [thread overview]
Message-ID: <3FAA2DBD.2020803@imc-berlin.de> (raw)
In-Reply-To: <3F94C67C.7010802@imc-berlin.de>
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 *) ®) != 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 *) ®) != 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
prev parent reply other threads:[~2003-11-06 11:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
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 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=3FAA2DBD.2020803@imc-berlin.de \
--to=steven.scholz@imc-berlin.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox