All of lore.kernel.org
 help / color / mirror / Atom feed
* davinci_emac/mdio: SOFT_RESET of EMAC module resets MDIO on AM1808
@ 2012-02-23  9:09 Christian Riesch
  2012-02-23 16:06 ` Gole, Anant
  2012-02-24 13:02 ` Rajashekhara, Sudhakar
  0 siblings, 2 replies; 7+ messages in thread
From: Christian Riesch @ 2012-02-23  9:09 UTC (permalink / raw)
  To: netdev, davinci-linux-open-source, cyril, anantgole

Hi,
I observed this behavior on a Texas Instruments AM1808 SoC (AM1808
experimenter's kit) running the current mainline kernel:

# ifconfig eth0 down
# ifconfig eth0 up
davinci_mdio davinci_mdio.0: resetting idled controller
net eth0: attached PHY driver [Generic PHY] (mii_bus:phy_addr=davinci_mdio-0:00)
# PHY: davinci_mdio-0:00 - Link is Up - 100/Full

After each ifconfig eth0 up I get this 'resetting idled controller'
warning. I added a few debug messages to the davinci_mdio driver and
noticed that the MDIO control register was set to its reset value
(clock divider 0xff and MDIO turned off) after an ifconfig eth0 up.
Therefore, this warning is issued and a reconfiguration of the MDIO
controller is done by the driver.

Now the question was: Who is turning off the MDIO controller? After a
bit of debugging I found out that the reset of the MDIO controller
seems to be caused by these lines in the davinci_emac driver in
emac_hw_enable() in drivers/net/ethernet/ti/davinci_emac.c:

emac_write(EMAC_SOFTRESET, 1);
while (emac_read(EMAC_SOFTRESET))
        cpu_relax();

According to the AM1808 Technical Reference Manual (sections 18.2.14.1
and 18.3.3.34 in [1]), writing a 1 to the EMAC_SOFTRESET register
resets the EMAC module, but not the MDIO module. However, when I
comment out the code above, the MDIO control register is not affected
and the warning 'resetting idled controller' disappears.

Is this an error in the documentation? Or in hardware? Or did I miss
something here? I already asked this questions in TI's E2E forum [2]
but did not get an answer yet. I would like to ask all the TI people
out there to help me getting an answer to this question. Thanks you!

Anyway, I think this should be fixed since it's bad when a driver
(davinci_emac) resets another driver's (davinci_mdio's) hardware.

Best regards,
Christian

[1] http://www.ti.com/litv/pdf/spruh82a
[2] http://e2e.ti.com/support/dsp/omap_applications_processors/f/42/t/164314.aspx

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: davinci_emac/mdio: SOFT_RESET of EMAC module resets MDIO on AM1808
  2012-02-23  9:09 davinci_emac/mdio: SOFT_RESET of EMAC module resets MDIO on AM1808 Christian Riesch
@ 2012-02-23 16:06 ` Gole, Anant
  2012-02-24 13:02 ` Rajashekhara, Sudhakar
  1 sibling, 0 replies; 7+ messages in thread
From: Gole, Anant @ 2012-02-23 16:06 UTC (permalink / raw)
  To: Christian Riesch, netdev, davinci-linux-open-source, Chemparathy, Cyril
  Cc: Govindarajan, Sriramakrishnan, N, Mugunthan V, Nori, Sekhar

>Now the question was: Who is turning off the MDIO controller? After a
>bit of debugging I found out that the reset of the MDIO controller
>seems to be caused by these lines in the davinci_emac driver in
>emac_hw_enable() in drivers/net/ethernet/ti/davinci_emac.c:
>
>emac_write(EMAC_SOFTRESET, 1);
>while (emac_read(EMAC_SOFTRESET))
>        cpu_relax();
>
>According to the AM1808 Technical Reference Manual (sections 18.2.14.1
>and 18.3.3.34 in [1]), writing a 1 to the EMAC_SOFTRESET register
>resets the EMAC module, but not the MDIO module. However, when I
>comment out the code above, the MDIO control register is not affected
>and the warning 'resetting idled controller' disappears.
>
>Is this an error in the documentation? Or in hardware? Or did I miss
>something here? I already asked this questions in TI's E2E forum [2]
>but did not get an answer yet. I would like to ask all the TI people
>out there to help me getting an answer to this question. Thanks you!


Christian,
We are looking into this right now. We believe that the mac reset 
should not impact MDIO reset but clearly you are seeing that
behavior and we need to investigate.

>
>Anyway, I think this should be fixed since it's bad when a driver
>(davinci_emac) resets another driver's (davinci_mdio's) hardware.
>
Once we find the root cause of this we would be able to fix this.
right now the EMAC reset code is not incorrect - just need to find
why it shows the wrong behavior with MDIO and if this is seen
only on AM1808 - will update you as soon as we find out.

Regards,
Anant

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: davinci_emac/mdio: SOFT_RESET of EMAC module resets MDIO on AM1808
  2012-02-23  9:09 davinci_emac/mdio: SOFT_RESET of EMAC module resets MDIO on AM1808 Christian Riesch
  2012-02-23 16:06 ` Gole, Anant
@ 2012-02-24 13:02 ` Rajashekhara, Sudhakar
  2012-02-24 14:15   ` Christian Riesch
  1 sibling, 1 reply; 7+ messages in thread
From: Rajashekhara, Sudhakar @ 2012-02-24 13:02 UTC (permalink / raw)
  To: Christian Riesch, netdev, davinci-linux-open-source, Chemparathy,
	Cyril, Gole, Anant

Hi Christian,

On Thu, Feb 23, 2012 at 14:39:49, Christian Riesch wrote:
> Hi,
> I observed this behavior on a Texas Instruments AM1808 SoC (AM1808
> experimenter's kit) running the current mainline kernel:
> 
> # ifconfig eth0 down
> # ifconfig eth0 up
> davinci_mdio davinci_mdio.0: resetting idled controller
> net eth0: attached PHY driver [Generic PHY] (mii_bus:phy_addr=davinci_mdio-0:00)
> # PHY: davinci_mdio-0:00 - Link is Up - 100/Full
> 

I also observed this issue with the kernel from linux-davinci tree from
gitorious.

> After each ifconfig eth0 up I get this 'resetting idled controller'
> warning. I added a few debug messages to the davinci_mdio driver and
> noticed that the MDIO control register was set to its reset value
> (clock divider 0xff and MDIO turned off) after an ifconfig eth0 up.
> Therefore, this warning is issued and a reconfiguration of the MDIO
> controller is done by the driver.
> 
> Now the question was: Who is turning off the MDIO controller? After a
> bit of debugging I found out that the reset of the MDIO controller
> seems to be caused by these lines in the davinci_emac driver in
> emac_hw_enable() in drivers/net/ethernet/ti/davinci_emac.c:
> 
> emac_write(EMAC_SOFTRESET, 1);
> while (emac_read(EMAC_SOFTRESET))
>         cpu_relax();
> 
> According to the AM1808 Technical Reference Manual (sections 18.2.14.1
> and 18.3.3.34 in [1]), writing a 1 to the EMAC_SOFTRESET register
> resets the EMAC module, but not the MDIO module. However, when I
> comment out the code above, the MDIO control register is not affected
> and the warning 'resetting idled controller' disappears.
> 

But this was not the case for me. Even after commenting out the above lines,
I could still see that MDIO was getting reset.

During eth0 up, the smsc_phy_config_init() function calls the mdiobus_read()
function. During this sequence if the MDIO state machine is in IDLE state,
then MDIO is reset causing the above warning message to appear.

In summary, EMAC reset is not causing the MDIO reset to happen.

Thanks,
Sudhakar

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: davinci_emac/mdio: SOFT_RESET of EMAC module resets MDIO on AM1808
  2012-02-24 13:02 ` Rajashekhara, Sudhakar
@ 2012-02-24 14:15   ` Christian Riesch
  2012-02-27 10:15     ` Rajashekhara, Sudhakar
  2012-02-28  5:46     ` Rajashekhara, Sudhakar
  0 siblings, 2 replies; 7+ messages in thread
From: Christian Riesch @ 2012-02-24 14:15 UTC (permalink / raw)
  To: sudhakar.raj
  Cc: netdev, davinci-linux-open-source, cyril, anantgole, Christian Riesch

Hello Sudhakar,

On Fri, Feb 24, 2012 at 2:02 PM, Rajashekhara, Sudhakar <sudhakar.raj@ti.com> wrote:
> On Thu, Feb 23, 2012 at 14:39:49, Christian Riesch wrote:
>> Hi,
>> I observed this behavior on a Texas Instruments AM1808 SoC (AM1808
>> experimenter's kit) running the current mainline kernel:
>>
>> # ifconfig eth0 down
>> # ifconfig eth0 up
>> davinci_mdio davinci_mdio.0: resetting idled controller
>> net eth0: attached PHY driver [Generic PHY] (mii_bus:phy_addr=davinci_mdio-0:00)
>> # PHY: davinci_mdio-0:00 - Link is Up - 100/Full
>>
>
> I also observed this issue with the kernel from linux-davinci tree from
> gitorious.
>
>> After each ifconfig eth0 up I get this 'resetting idled controller'
>> warning. I added a few debug messages to the davinci_mdio driver and
>> noticed that the MDIO control register was set to its reset value
>> (clock divider 0xff and MDIO turned off) after an ifconfig eth0 up.
>> Therefore, this warning is issued and a reconfiguration of the MDIO
>> controller is done by the driver.
>>
>> Now the question was: Who is turning off the MDIO controller? After a
>> bit of debugging I found out that the reset of the MDIO controller
>> seems to be caused by these lines in the davinci_emac driver in
>> emac_hw_enable() in drivers/net/ethernet/ti/davinci_emac.c:
>>
>> emac_write(EMAC_SOFTRESET, 1);
>> while (emac_read(EMAC_SOFTRESET))
>>         cpu_relax();
>>
>> According to the AM1808 Technical Reference Manual (sections 18.2.14.1
>> and 18.3.3.34 in [1]), writing a 1 to the EMAC_SOFTRESET register
>> resets the EMAC module, but not the MDIO module. However, when I
>> comment out the code above, the MDIO control register is not affected
>> and the warning 'resetting idled controller' disappears.
>>
>
> But this was not the case for me. Even after commenting out the above lines,
> I could still see that MDIO was getting reset.

Uh, I am sorry. I forgot to mention that there is a second
emac_write(EMAC_SOFTRESET,1); in emac_dev_stop() in davinci_emac.c. 
This one must also be commented out to make the resetting idled controller 
message go away.

The patch below shows that changes that I did. May I please ask you to try
again with these changes?

Regards, Christian

>
> During eth0 up, the smsc_phy_config_init() function calls the mdiobus_read()
> function. During this sequence if the MDIO state machine is in IDLE state,
> then MDIO is reset causing the above warning message to appear.
>
> In summary, EMAC reset is not causing the MDIO reset to happen.

---
 drivers/net/ethernet/ti/davinci_emac.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c
index 4b2f545..733d538 100644
--- a/drivers/net/ethernet/ti/davinci_emac.c
+++ b/drivers/net/ethernet/ti/davinci_emac.c
@@ -1290,10 +1290,10 @@ static int emac_hw_enable(struct emac_priv *priv)
 	u32 val, mbp_enable, mac_control;
 
 	/* Soft reset */
-	emac_write(EMAC_SOFTRESET, 1);
+/*	emac_write(EMAC_SOFTRESET, 1);
 	while (emac_read(EMAC_SOFTRESET))
 		cpu_relax();
-
+*/
 	/* Disable interrupt & Set pacing for more interrupts initially */
 	emac_int_disable(priv);
 
@@ -1672,7 +1672,7 @@ static int emac_dev_stop(struct net_device *ndev)
 	netif_carrier_off(ndev);
 	emac_int_disable(priv);
 	cpdma_ctlr_stop(priv->dma);
-	emac_write(EMAC_SOFTRESET, 1);
+/*	emac_write(EMAC_SOFTRESET, 1);*/
 
 	if (priv->phydev)
 		phy_disconnect(priv->phydev);
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* RE: davinci_emac/mdio: SOFT_RESET of EMAC module resets MDIO on AM1808
  2012-02-24 14:15   ` Christian Riesch
@ 2012-02-27 10:15     ` Rajashekhara, Sudhakar
  2012-02-28  5:46     ` Rajashekhara, Sudhakar
  1 sibling, 0 replies; 7+ messages in thread
From: Rajashekhara, Sudhakar @ 2012-02-27 10:15 UTC (permalink / raw)
  To: Christian Riesch
  Cc: netdev, davinci-linux-open-source, Chemparathy, Cyril, Gole, Anant

Hi Christian,

On Fri, Feb 24, 2012 at 19:45:23, Christian Riesch wrote:
> Hello Sudhakar,
> 
> On Fri, Feb 24, 2012 at 2:02 PM, Rajashekhara, Sudhakar <sudhakar.raj@ti.com> wrote:
> > On Thu, Feb 23, 2012 at 14:39:49, Christian Riesch wrote:
> >> Hi,
> >> I observed this behavior on a Texas Instruments AM1808 SoC (AM1808
> >> experimenter's kit) running the current mainline kernel:
> >>

[snip]

> >>
> >> According to the AM1808 Technical Reference Manual (sections 18.2.14.1
> >> and 18.3.3.34 in [1]), writing a 1 to the EMAC_SOFTRESET register
> >> resets the EMAC module, but not the MDIO module. However, when I
> >> comment out the code above, the MDIO control register is not affected
> >> and the warning 'resetting idled controller' disappears.
> >>
> >
> > But this was not the case for me. Even after commenting out the above lines,
> > I could still see that MDIO was getting reset.
> 
> Uh, I am sorry. I forgot to mention that there is a second
> emac_write(EMAC_SOFTRESET,1); in emac_dev_stop() in davinci_emac.c. 
> This one must also be commented out to make the resetting idled controller 
> message go away.
> 
> The patch below shows that changes that I did. May I please ask you to try
> again with these changes?
> 

I was able to reproduce the issue. I'll debug this further and get back to you.

Regards,
Sudhakar

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: davinci_emac/mdio: SOFT_RESET of EMAC module resets MDIO on AM1808
  2012-02-24 14:15   ` Christian Riesch
  2012-02-27 10:15     ` Rajashekhara, Sudhakar
@ 2012-02-28  5:46     ` Rajashekhara, Sudhakar
       [not found]       ` <B6A220404B6BFC4BBD2AB91C54D39DF431776D23-Er742YJ7I/eIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
  1 sibling, 1 reply; 7+ messages in thread
From: Rajashekhara, Sudhakar @ 2012-02-28  5:46 UTC (permalink / raw)
  To: Christian Riesch, Chemparathy, Cyril
  Cc: netdev, davinci-linux-open-source, Gole, Anant

Hi Christian,

On Mon, Feb 27, 2012 at 15:44:54, Rajashekhara, Sudhakar wrote:
> Hi Christian,
> 
> On Fri, Feb 24, 2012 at 19:45:23, Christian Riesch wrote:
> > Hello Sudhakar,
> > 
> > On Fri, Feb 24, 2012 at 2:02 PM, Rajashekhara, Sudhakar <sudhakar.raj@ti.com> wrote:
> > > On Thu, Feb 23, 2012 at 14:39:49, Christian Riesch wrote:
> > >> Hi,
> > >> I observed this behavior on a Texas Instruments AM1808 SoC (AM1808
> > >> experimenter's kit) running the current mainline kernel:
> > >>
> 
> [snip]
> 
> > >>
> > >> According to the AM1808 Technical Reference Manual (sections 18.2.14.1
> > >> and 18.3.3.34 in [1]), writing a 1 to the EMAC_SOFTRESET register
> > >> resets the EMAC module, but not the MDIO module. However, when I
> > >> comment out the code above, the MDIO control register is not affected
> > >> and the warning 'resetting idled controller' disappears.
> > >>
> > >
> > > But this was not the case for me. Even after commenting out the above lines,
> > > I could still see that MDIO was getting reset.
> > 
> > Uh, I am sorry. I forgot to mention that there is a second
> > emac_write(EMAC_SOFTRESET,1); in emac_dev_stop() in davinci_emac.c. 
> > This one must also be commented out to make the resetting idled controller 
> > message go away.
> > 
> > The patch below shows that changes that I did. May I please ask you to try
> > again with these changes?
> > 
> 
> I was able to reproduce the issue. I'll debug this further and get back to you.
> 

I was going through the mailing list discussions where a work around for emac
soft-reset tie-up to mdio controller has been proposed. I think this was a known
issue on TI's da8xx family of devices. Please refer to the thread at
http://www.spinics.net/lists/netdev/msg140465.html.

Cyril,
As you have mentioned in your patch, did you get any confirmation from TI designer
regarding emac soft reset behavior? I see that nothing has been mentioned in the
EMAC user guide.

Thanks,
Sudhakar

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: davinci_emac/mdio: SOFT_RESET of EMAC module resets MDIO on AM1808
       [not found]       ` <B6A220404B6BFC4BBD2AB91C54D39DF431776D23-Er742YJ7I/eIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
@ 2012-03-12  7:04         ` Christian Riesch
  0 siblings, 0 replies; 7+ messages in thread
From: Christian Riesch @ 2012-03-12  7:04 UTC (permalink / raw)
  To: Rajashekhara, Sudhakar
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
	davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/,
	Gole,  Anant


[-- Attachment #1.1: Type: text/plain, Size: 2148 bytes --]

On Tuesday, February 28, 2012, Rajashekhara, Sudhakar <sudhakar.raj-l0cyMroinI0@public.gmane.org>
wrote:
> Hi Christian,
>
> On Mon, Feb 27, 2012 at 15:44:54, Rajashekhara, Sudhakar wrote:
>> Hi Christian,
>>
>> On Fri, Feb 24, 2012 at 19:45:23, Christian Riesch wrote:
>> > Hello Sudhakar,
>> >
>> > On Fri, Feb 24, 2012 at 2:02 PM, Rajashekhara, Sudhakar <
sudhakar.raj-l0cyMroinI0@public.gmane.org> wrote:
>> > > On Thu, Feb 23, 2012 at 14:39:49, Christian Riesch wrote:
>> > >> Hi,
>> > >> I observed this behavior on a Texas Instruments AM1808 SoC (AM1808
>> > >> experimenter's kit) running the current mainline kernel:
>> > >>
>>
>> [snip]
>>
>> > >>
>> > >> According to the AM1808 Technical Reference Manual (sections
18.2.14.1
>> > >> and 18.3.3.34 in [1]), writing a 1 to the EMAC_SOFTRESET register
>> > >> resets the EMAC module, but not the MDIO module. However, when I
>> > >> comment out the code above, the MDIO control register is not
affected
>> > >> and the warning 'resetting idled controller' disappears.
>> > >>
>> > >
>> > > But this was not the case for me. Even after commenting out the
above lines,
>> > > I could still see that MDIO was getting reset.
>> >
>> > Uh, I am sorry. I forgot to mention that there is a second
>> > emac_write(EMAC_SOFTRESET,1); in emac_dev_stop() in davinci_emac.c.
>> > This one must also be commented out to make the resetting idled
controller
>> > message go away.
>> >
>> > The patch below shows that changes that I did. May I please ask you to
try
>> > again with these changes?
>> >
>>
>> I was able to reproduce the issue. I'll debug this further and get back
to you.
>>
>
> I was going through the mailing list discussions where a work around for
emac
> soft-reset tie-up to mdio controller has been proposed. I think this was
a known
> issue on TI's da8xx family of devices. Please refer to the thread at
> http://www.spinics.net/lists/netdev/msg140465.html.
>
> Cyril,
> As you have mentioned in your patch, did you get any confirmation from TI
designer
> regarding emac soft reset behavior? I see that nothing has been mentioned
in the
> EMAC user guide.

Ping?

Thanks, Christian

[-- Attachment #1.2: Type: text/html, Size: 2972 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-03-12  7:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-23  9:09 davinci_emac/mdio: SOFT_RESET of EMAC module resets MDIO on AM1808 Christian Riesch
2012-02-23 16:06 ` Gole, Anant
2012-02-24 13:02 ` Rajashekhara, Sudhakar
2012-02-24 14:15   ` Christian Riesch
2012-02-27 10:15     ` Rajashekhara, Sudhakar
2012-02-28  5:46     ` Rajashekhara, Sudhakar
     [not found]       ` <B6A220404B6BFC4BBD2AB91C54D39DF431776D23-Er742YJ7I/eIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2012-03-12  7:04         ` Christian Riesch

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.