Skip to contentSkip to conversation

drivers/net/phy/marvell.c: 88e1111 can't get out sleep mode

DISCUSSION Wang Jian 3 participants 7 messages Sep 29, 2008 – Oct 2, 2008

Subsystems (3)
lore
Share & tools
lore

Wang Jian

author
#0 lore raw

Hi,

During my testing, I found that 88e1111 can't get out of sleep mode (Energy detect+) in certain condition.

I am working on a mpc8541 board, with TSEC (gianfar) connected to 88e1111 phy chip. The kenrel is 2.6.26-rc8 with several patches.

The following steps can 100% trigger the problem

1. unplug cable from tsec interfaces (eth0/eth1 in my case)
2. boot up and waiting for 6+ seconds
3. ifconfig eth0 up
4. plug in cable, the link can't be established and no way to bring it up

But these steps can make link up

1. boot up with cable plugged or plug the cable in 6 seconds after bootup
2. unplug cable
3. ifconfig eth0 up
4. plugin in cable, the link is up

I tried some workarounds and no success. so far I get these information

1. When cable plugged before ifconfig eth0 up and in the 6 seconds window, the bit 11 of register 17, "speed and duplex resolved" is true even unplug cable later
2. auto negotination enable bit (bit 12 of BMCR) is true in both cases

Can someone help me to confirm this problem? I can provide more information/prink output per request.

Note: I have these two patches applied (in current linus tree)

commit 7239016d52c6d568d069f083bdcd17f35ab79fd8

Author: Wang Jian <[email protected]>
Date:   Wed Jul 16 21:46:20 2008 +0800

commit 9cf8fa4334e60f27b4a392f432c292f3af268215

Author: Wang Jian <[email protected]>
Date:   Wed Jul 16 21:46:17 2008 +0800
#1 lore raw
Quoted 4 lines · Wang Jian

Hi,

During my testing, I found that 88e1111 can't get out of sleep mode (Energy detect+) in certain condition.

[...]

We had the same problem with development boards using that PHY and we stopped using the energy detect mode.

Ben.

Signature · 3 lines
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
author
#2 lore raw

According to datasheet, fiber/copper auto detect & auto switch depend on energy detect.

Or I misunderstand DIS_FC & DIS_SLEEP? When DIS_SLEEP is set, fiber/copper auto detect & auto switch still work?

Quoted 12 lines · Ben Hutchings
Quoted 4 lines · Wang Jian

Hi,

During my testing, I found that 88e1111 can't get out of sleep mode (Energy detect+) in certain condition.

[...]

We had the same problem with development boards using that PHY and we stopped using the energy detect mode.

Ben.

#3 lore raw
Quoted 5 lines · Wang Jian

According to datasheet, fiber/copper auto detect & auto switch depend on energy detect.

Or I misunderstand DIS_FC & DIS_SLEEP? When DIS_SLEEP is set, fiber/copper auto detect & auto switch still work?

[...]

I've no idea; we only ever used copper.

Ben.

Signature · 3 lines
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
#4 lore raw
In reply to Wang Jian
Quoted 8 lines · Wang Jian

Hi,

During my testing, I found that 88e1111 can't get out of sleep mode (Energy detect+) in certain condition.

I am working on a mpc8541 board, with TSEC (gianfar) connected to 88e1111 phy chip. The kenrel is 2.6.26-rc8 with several patches.

Quoted 7 lines

The following steps can 100% trigger the problem

1. unplug cable from tsec interfaces (eth0/eth1 in my case)
2. boot up and waiting for 6+ seconds
3. ifconfig eth0 up
4. plug in cable, the link can't be established and no way to bring it up

Is anything printed out to the log?

Are you polling or using an interrupt?

If you are using an interrupt, is it firing?

If you are polling, can you print out some debug information to see if it is successfully reading the PHY status?

Andy

author
#5 lore raw
Quoted 18 lines · Andy Fleming
Quoted 8 lines · Wang Jian

Hi,

During my testing, I found that 88e1111 can't get out of sleep mode (Energy detect+) in certain condition.

I am working on a mpc8541 board, with TSEC (gianfar) connected to 88e1111 phy chip. The kenrel is 2.6.26-rc8 with several patches.

Quoted 7 lines

The following steps can 100% trigger the problem

1. unplug cable from tsec interfaces (eth0/eth1 in my case)
2. boot up and waiting for 6+ seconds
3. ifconfig eth0 up
4. plug in cable, the link can't be established and no way to bring it up

Quoted 3 lines

Is anything printed out to the log?

Are you polling or using an interrupt?

I am using polling

Quoted 6 lines

If you are using an interrupt, is it firing?

If you are polling, can you print out some debug information to see if it is successfully reading the PHY status?

Ok, I use the following code to print out phy register. Note I print out 32bit, bit 31 = 1 means error

drivers/net/phy/marvell.c +5 -0
index 4aa5479..77a9e18 100644
@@ -312,7 +312,12 @@ static int marvell_read_status(struct phy_device *phydev)
                return err;
 
        if (AUTONEG_ENABLE == phydev->autoneg) {
+               status = phy_read(phydev, MII_BMCR);
+               printk(KERN_ERR "MII_BMCR=%08x, ", status);
+               status = phy_read(phydev, MII_BMSR);
+               printk("MII_BMSR=%08x, ", status);
                status = phy_read(phydev, MII_M1011_PHY_STATUS);
+               printk("MII_M1011_PHY_STATUS=%08x\n", status);
                if (status < 0)
                        return status;
 

Test 1: boot up with cable plugged in eth0

--- bootup with cable plugged in eth0 ---
/ $ ifconfig eth0 up
/ $ [ 7.804582] MII_BMCR=00001000, MII_BMSR=00007949, MII_M1011_PHY_STATUS=00008110

[    8.811583] MII_BMCR=00001000, MII_BMSR=0000796d, MII_M1011_PHY_STATUS=00007d00
[    8.819151] PHY: e0024520:04 - Link is Up - 100/Full
[   10.823581] MII_BMCR=00001000, MII_BMSR=0000796d, MII_M1011_PHY_STATUS=00006d00
[   12.830578] MII_BMCR=00001000, MII_BMSR=0000796d, MII_M1011_PHY_STATUS=00006d00
[   14.837578] MII_BMCR=00001000, MII_BMSR=0000796d, MII_M1011_PHY_STATUS=00006d00
[   16.844578] MII_BMCR=00001000, MII_BMSR=0000796d, MII_M1011_PHY_STATUS=00006d00
[   18.851578] MII_BMCR=00001000, MII_BMSR=0000796d, MII_M1011_PHY_STATUS=00006d00
[   20.858578] MII_BMCR=00001000, MII_BMSR=0000796d, MII_M1011_PHY_STATUS=00006d00
[   22.865578] MII_BMCR=00001000, MII_BMSR=0000796d, MII_M1011_PHY_STATUS=00006d00
[   24.872578] MII_BMCR=00001000, MII_BMSR=0000796d, MII_M1011_PHY_STATUS=00006d00
[   26.879578] MII_BMCR=00001000, MII_BMSR=0000796d, MII_M1011_PHY_STATUS=00006d00
[   28.886578] MII_BMCR=00001000, MII_BMSR=0000796d, MII_M1011_PHY_STATUS=00006d00
[   30.893578] MII_BMCR=00001000, MII_BMSR=0000796d, MII_M1011_PHY_STATUS=00006d00
[   32.900578] MII_BMCR=00001000, MII_BMSR=0000796d, MII_M1011_PHY_STATUS=00006d00
[   34.907578] MII_BMCR=00001000, MII_BMSR=0000796d, MII_M1011_PHY_STATUS=00006d00

ifconfig eth0[ 36.914585] MII_BMCR=00001000, MII_BMSR=0000796d, MII_M1011_PHY_STATUS=00006d00
down
--- 6+ seconds elapsed ---
/ $ ifconfig eth1 up
/ $ [ 48.462582] MII_BMCR=00001040, MII_BMSR=00000149, MII_M1011_PHY_STATUS=00008110

[   49.469583] MII_BMCR=00001040, MII_BMSR=00000149, MII_M1011_PHY_STATUS=00008150
[   50.476579] MII_BMCR=00001040, MII_BMSR=00000149, MII_M1011_PHY_STATUS=00008110
[   51.483578] MII_BMCR=00001040, MII_BMSR=00000149, MII_M1011_PHY_STATUS=00008150
--- plug cable to eth1 ---
[   52.490579] MII_BMCR=00001040, MII_BMSR=00000149, MII_M1011_PHY_STATUS=00008150
[   53.497579] MII_BMCR=00001040, MII_BMSR=00000149, MII_M1011_PHY_STATUS=00008110
[   54.504579] MII_BMCR=00001040, MII_BMSR=00000149, MII_M1011_PHY_STATUS=00008110
[   55.511579] MII_BMCR=00001040, MII_BMSR=00000149, MII_M1011_PHY_STATUS=00008150
[   56.518579] MII_BMCR=00001040, MII_BMSR=00000149, MII_M1011_PHY_STATUS=00008110
[   57.525579] MII_BMCR=00001040, MII_BMSR=00000149, MII_M1011_PHY_STATUS=00008150
[   58.532578] MII_BMCR=00001040, MII_BMSR=00000149, MII_M1011_PHY_STATUS=00008110
[   59.539579] MII_BMCR=00001040, MII_BMSR=00000149, MII_M1011_PHY_STATUS=00008110

Test 2: before ifconfig eth0 up, unplug cable, ifconfig eth0 up within 6 seconds window

/ $ ifconfig eth0 up
/ $ [ 7.568589] MII_BMCR=00001000, MII_BMSR=00007949, MII_M1011_PHY_STATUS=00008110

[    8.575588] MII_BMCR=00001000, MII_BMSR=00007949, MII_M1011_PHY_STATUS=00008150
[    9.582585] MII_BMCR=00001000, MII_BMSR=00007949, MII_M1011_PHY_STATUS=00008100
[   10.589585] MII_BMCR=00001000, MII_BMSR=00007949, MII_M1011_PHY_STATUS=00008100
[   11.596585] MII_BMCR=00001000, MII_BMSR=00007949, MII_M1011_PHY_STATUS=00008140
[   12.603585] MII_BMCR=00001000, MII_BMSR=00007949, MII_M1011_PHY_STATUS=00008150
[   13.610585] MII_BMCR=00001000, MII_BMSR=00007949, MII_M1011_PHY_STATUS=00008150
[   14.617585] MII_BMCR=00001000, MII_BMSR=00007949, MII_M1011_PHY_STATUS=00009110
[   15.624585] MII_BMCR=00001000, MII_BMSR=0000796d, MII_M1011_PHY_STATUS=00006d00
[   15.632148] PHY: e0024520:04 - Link is Up - 100/Full
[   17.636586] MII_BMCR=00001000, MII_BMSR=0000796d, MII_M1011_PHY_STATUS=00006d00
[   19.643584] MII_BMCR=00001000, MII_BMSR=0000796d, MII_M1011_PHY_STATUS=00006d00
[   21.650585] MII_BMCR=00001000, MII_BMSR=0000796d, MII_M1011_PHY_STATUS=00006d00
[   23.657585] MII_BMCR=00001000, MII_BMSR=0000796d, MII_M1011_PHY_STATUS=00006d00
[   25.664588] MII_BMCR=00001000, MII_BMSR=0000796d, MII_M1011_PHY_STATUS=00006d00
[   27.671585] MII_BMCR=00001000, MII_BMSR=0000796d, MII_M1011_PHY_STATUS=00006d00

In test 1 and 2, eth0 is used to transfer cuImage in u-boot

Test 3: plug cable to eth1 with 6 seconds window and unplug, then ifconfig eth1 up

/ $ ifconfig eth1 up
/ $ [ 12.469584] MII_BMCR=00001000, MII_BMSR=00007949, MII_M1011_PHY_STATUS=00008150

[   13.476585] MII_BMCR=00001000, MII_BMSR=00007949, MII_M1011_PHY_STATUS=00008110
[   14.483581] MII_BMCR=00001000, MII_BMSR=00007949, MII_M1011_PHY_STATUS=00008140
[   15.490581] MII_BMCR=00001000, MII_BMSR=00007949, MII_M1011_PHY_STATUS=00008140
[   16.497581] MII_BMCR=00001000, MII_BMSR=00007949, MII_M1011_PHY_STATUS=00008100
[   17.504580] MII_BMCR=00001000, MII_BMSR=00007949, MII_M1011_PHY_STATUS=00008140
--- plug cable ---
[   18.511581] MII_BMCR=00001000, MII_BMSR=0000796d, MII_M1011_PHY_STATUS=00007d40
[   18.519142] PHY: e0024520:05 - Link is Up - 100/Full
[   20.523583] MII_BMCR=00001000, MII_BMSR=0000796d, MII_M1011_PHY_STATUS=00006d40
[   22.530580] MII_BMCR=00001000, MII_BMSR=0000796d, MII_M1011_PHY_STATUS=00006d40
[   24.537580] MII_BMCR=00001000, MII_BMSR=0000796d, MII_M1011_PHY_STATUS=00006d40
[   26.544580] MII_BMCR=00001000, MII_BMSR=0000796d, MII_M1011_PHY_STATUS=00006d40
[   28.551580] MII_BMCR=00001000, MII_BMSR=0000796d, MII_M1011_PHY_STATUS=00006d40
[   30.558580] MII_BMCR=00001000, MII_BMSR=0000796d, MII_M1011_PHY_STATUS=00006d40

Hmm, I remove my debug code from m88e1111_config_init(), do you need this?

I have an idea that if the phy is in sleep mode, flip flop energy detect mode to leave sleep mode. This is done every 6 seconds, not so intrusive. I will try it later.

Quoted 4 lines

Andy

author
#6 lore raw
Quoted 4 lines · Wang Jian

I have an idea that if the phy is in sleep mode, flip flop energy detect mode to leave sleep mode. This is done every 6 seconds, not so intrusive. I will try it later.

No success so far.

MII_PDOWN then MII_RESET no success either.