public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Heiko Schocher <hs@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] net, phy, cpsw: fix gigabit register access
Date: Wed, 24 Jul 2013 06:02:47 +0200	[thread overview]
Message-ID: <51EF51E7.4050307@denx.de> (raw)
In-Reply-To: <CANr=Z=bjozEfvcY9M99j8vDfLyRWGd0LSEnR3iAC+gMomsMg2Q@mail.gmail.com>

Hello Joe,

Am 24.07.2013 00:17, schrieb Joe Hershberger:
> On Tue, Jul 23, 2013 at 8:32 AM, Heiko Schocher<hs@denx.de>  wrote:
>> accessing a lan9303 switch with the cpsw driver results in wrong
>> speed detection, as the switch sets the BMSR_ERCAP in BMSR
>> register, and follow read of the MII_STAT1000 register fails, as
>> the switch does not support it. Current code did not check,
>> if a phy_read() fails ... fix this.
>>
>> Signed-off-by: Heiko Schocher<hs@denx.de>
>> Cc: Joe Hershberger<joe.hershberger@gmail.com>
>> ---
>>   drivers/net/cpsw.c    | 2 +-
>>   drivers/net/phy/phy.c | 6 +++++-
>>   2 Dateien ge?ndert, 6 Zeilen hinzugef?gt(+), 2 Zeilen entfernt(-)
>>
>> diff --git a/drivers/net/cpsw.c b/drivers/net/cpsw.c
>> index 379b679..52c08ed 100644
>> --- a/drivers/net/cpsw.c
>> +++ b/drivers/net/cpsw.c
>> @@ -489,7 +489,7 @@ static inline void wait_for_idle(void)
>>   static int cpsw_mdio_read(struct mii_dev *bus, int phy_id,
>>                                  int dev_addr, int phy_reg)
>>   {
>> -       unsigned short data;
>> +       int data;
>
> How is this change related to the substance of the patch?

data is returned, and the code do:

         data = (reg & USERACCESS_ACK) ? (reg & USERACCESS_DATA) : -1;
         return data;

So if data is short only, the return value is in case, the phy
read fails, 0xffff instead 0xffffffff ...

>>          u32 reg;
>>
>>          if (phy_reg&  ~PHY_REG_MASK || phy_id&  ~PHY_ID_MASK)
>
> Seems OK otherwise.

Thanks!

bye,
Heiko
-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

  reply	other threads:[~2013-07-24  4:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-23 13:32 [U-Boot] [PATCH] net, phy, cpsw: fix gigabit register access Heiko Schocher
2013-07-23 22:17 ` Joe Hershberger
2013-07-24  4:02   ` Heiko Schocher [this message]
2013-07-24  7:38 ` Mugunthan V N
2013-07-30 13:26 ` [U-Boot] " Tom Rini

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=51EF51E7.4050307@denx.de \
    --to=hs@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox