From: Ben Warren <biggerbadderben@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] MIIPHYBB: Return 0xFFFF if the PHY is not asserting TA.
Date: Mon, 20 Jul 2009 22:21:13 -0700 [thread overview]
Message-ID: <4A655049.406@gmail.com> (raw)
In-Reply-To: <4A4CEC92.9080906@RuggedCom.com>
Richard,
Richard Retanubun wrote:
> From d4c7dd98ac9a3f6fc4949079b84d7d811376cf3d Mon Sep 17 00:00:00 2001
> From: Richard Retanubun <RichardRetanubun@RuggedCom.com>
> Date: Thu, 2 Jul 2009 13:12:03 -0400
> Subject: [PATCH] MIIPHYBB: Return 0xFFFF if the PHY is not asserting TA.
>
> This patch sets the returned value to 0xFFFF if the PHY does not exist
> and does not assert Transfer Acknowledge. A NULL check for the value
> pointer is also added for buffer overflow protection.
>
> Without this patch 'mii info' will show 'phantom' devices because the
> value will be not be initialized and return with some random value.
> ---
> drivers/net/phy/miiphybb.c | 7 +++++++
> 1 files changed, 7 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/net/phy/miiphybb.c b/drivers/net/phy/miiphybb.c
> index e3c163a..b77c917 100644
> --- a/drivers/net/phy/miiphybb.c
> +++ b/drivers/net/phy/miiphybb.c
> @@ -127,6 +127,11 @@ int bb_miiphy_read (char *devname, unsigned char
> addr,
> volatile ioport_t *iop = ioport_addr ((immap_t *)
> CONFIG_SYS_IMMR, MDIO_PORT);
> #endif
>
> + if (value == NULL) {
> + puts("NULL value pointer\n");
> + return (-1);
> + }
> +
> miiphy_pre (1, addr, reg);
>
> /* tri-state our MDIO I/O pin so we can read */
> @@ -145,6 +150,8 @@ int bb_miiphy_read (char *devname, unsigned char
> addr,
> MDC (1);
> MIIDELAY;
> }
> + /* There is no PHY, set value to 0xFFFF and return */
> + *value = 0xFFFF;
> return (-1);
> }
>
Applied to net repo. Please add SOB next time and send e-mail as plain
text.
regards,
Ben
prev parent reply other threads:[~2009-07-21 5:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-02 17:21 [U-Boot] [PATCH] MIIPHYBB: Return 0xFFFF if the PHY is not asserting TA Richard Retanubun
2009-07-21 5:21 ` Ben Warren [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=4A655049.406@gmail.com \
--to=biggerbadderben@gmail.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