* [U-Boot] [PATCH] net, phy, cpsw: fix gigabit register access
@ 2013-07-23 13:32 Heiko Schocher
2013-07-23 22:17 ` Joe Hershberger
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Heiko Schocher @ 2013-07-23 13:32 UTC (permalink / raw)
To: u-boot
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;
u32 reg;
if (phy_reg & ~PHY_REG_MASK || phy_id & ~PHY_ID_MASK)
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index effe3e3..2fdccb8 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -291,7 +291,7 @@ int genphy_parse_link(struct phy_device *phydev)
/* We're using autonegotiation */
if (mii_reg & BMSR_ANEGCAPABLE) {
u32 lpa = 0;
- u32 gblpa = 0;
+ int gblpa = 0;
u32 estatus = 0;
/* Check for gigabit capability */
@@ -300,6 +300,10 @@ int genphy_parse_link(struct phy_device *phydev)
* both PHYs in the link
*/
gblpa = phy_read(phydev, MDIO_DEVAD_NONE, MII_STAT1000);
+ if (gblpa < 0) {
+ debug("Could not read MII_STAT1000. Ignoring gigabit capability\n");
+ gblpa = 0;
+ }
gblpa &= phy_read(phydev,
MDIO_DEVAD_NONE, MII_CTRL1000) << 2;
}
--
1.7.11.7
^ permalink raw reply related [flat|nested] 5+ messages in thread* [U-Boot] [PATCH] net, phy, cpsw: fix gigabit register access
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
2013-07-24 7:38 ` Mugunthan V N
2013-07-30 13:26 ` [U-Boot] " Tom Rini
2 siblings, 1 reply; 5+ messages in thread
From: Joe Hershberger @ 2013-07-23 22:17 UTC (permalink / raw)
To: u-boot
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?
> u32 reg;
>
> if (phy_reg & ~PHY_REG_MASK || phy_id & ~PHY_ID_MASK)
Seems OK otherwise.
-Joe
^ permalink raw reply [flat|nested] 5+ messages in thread* [U-Boot] [PATCH] net, phy, cpsw: fix gigabit register access
2013-07-23 22:17 ` Joe Hershberger
@ 2013-07-24 4:02 ` Heiko Schocher
0 siblings, 0 replies; 5+ messages in thread
From: Heiko Schocher @ 2013-07-24 4:02 UTC (permalink / raw)
To: u-boot
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH] net, phy, cpsw: fix gigabit register access
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 7:38 ` Mugunthan V N
2013-07-30 13:26 ` [U-Boot] " Tom Rini
2 siblings, 0 replies; 5+ messages in thread
From: Mugunthan V N @ 2013-07-24 7:38 UTC (permalink / raw)
To: u-boot
On 7/23/2013 7:02 PM, Heiko Schocher 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>
Looks correct
Acked-by: Mugunthan V N <mugunthanvnm@ti.com>
Regards
Mugunthan V N
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] net, phy, cpsw: fix gigabit register access
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 7:38 ` Mugunthan V N
@ 2013-07-30 13:26 ` Tom Rini
2 siblings, 0 replies; 5+ messages in thread
From: Tom Rini @ 2013-07-30 13:26 UTC (permalink / raw)
To: u-boot
On Tue, Jul 23, 2013 at 03:32:36PM +0200, Heiko Schocher 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>
> Acked-by: Mugunthan V N <mugunthanvnm@ti.com>
Applied to u-boot-ti/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130730/2847e130/attachment.pgp>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-07-30 13:26 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2013-07-24 7:38 ` Mugunthan V N
2013-07-30 13:26 ` [U-Boot] " Tom Rini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox