linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* CONFIG_FEC is not good for mpc8xx ethernet?
@ 2010-10-18  8:13 Shawn Jin
  2010-10-18  8:40 ` tiejun.chen
  0 siblings, 1 reply; 9+ messages in thread
From: Shawn Jin @ 2010-10-18  8:13 UTC (permalink / raw)
  To: ppcdev

Hi,

My target is a mpc875 based board and has FEC ethernet. The phy is
AM79C874. I have the following configuration for the network support.

CONFIG_PHYLIB=y
CONFIG_NET_ETHERNET=y
CONFIG_MII=y
CONFIG_FS_ENET=y
CONFIG_FS_ENET_HAS_FEC=y
CONFIG_FS_ENET_MDIO_FEC=y

However I found that the phy support (AM79C874) is actually in
drivers/net/fec.c which is compiled only when CONFIG_FEC=y. However
CONFIG_FEC is not on for mpc8xx targets, seen the dependency below.

config FEC
        bool "FEC ethernet controller (of ColdFire and some i.MX CPUs)"
        depends on M523x || M527x || M5272 || M528x || M520x || M532x
|| MACH_MX27 || ARCH_MX35 || ARCH_MX25
        help
          Say Y here if you want to use the built-in 10/100 Fast ethernet
          controller on some Motorola ColdFire and Freescale i.MX processors.

Does it mean that the phy driver for AM79C874 doesn't exist for MPC8xx
and I'll have to write one for myself?

Thanks,
-Shawn.

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

* Re: CONFIG_FEC is not good for mpc8xx ethernet?
  2010-10-18  8:13 CONFIG_FEC is not good for mpc8xx ethernet? Shawn Jin
@ 2010-10-18  8:40 ` tiejun.chen
  2010-10-18 16:42   ` Scott Wood
  0 siblings, 1 reply; 9+ messages in thread
From: tiejun.chen @ 2010-10-18  8:40 UTC (permalink / raw)
  To: Shawn Jin; +Cc: ppcdev

Shawn Jin wrote:
> Hi,
> 
> My target is a mpc875 based board and has FEC ethernet. The phy is
> AM79C874. I have the following configuration for the network support.
> 
> CONFIG_PHYLIB=y
> CONFIG_NET_ETHERNET=y
> CONFIG_MII=y
> CONFIG_FS_ENET=y
> CONFIG_FS_ENET_HAS_FEC=y
> CONFIG_FS_ENET_MDIO_FEC=y
> 
> However I found that the phy support (AM79C874) is actually in
> drivers/net/fec.c which is compiled only when CONFIG_FEC=y. However

The phy driver should not be embedded into the NIC driver in theory.

I think you should include the phy driver, mdio-bitbang.c, which should be
support AMD79C874. But I'm not sure if it can work well based on your target and
maybe you have to fix/improve something.

Tiejun

> CONFIG_FEC is not on for mpc8xx targets, seen the dependency below.
> 
> config FEC
>         bool "FEC ethernet controller (of ColdFire and some i.MX CPUs)"
>         depends on M523x || M527x || M5272 || M528x || M520x || M532x
> || MACH_MX27 || ARCH_MX35 || ARCH_MX25
>         help
>           Say Y here if you want to use the built-in 10/100 Fast ethernet
>           controller on some Motorola ColdFire and Freescale i.MX processors.
> 
> Does it mean that the phy driver for AM79C874 doesn't exist for MPC8xx
> and I'll have to write one for myself?
> 
> Thanks,
> -Shawn.
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
> 

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

* Re: CONFIG_FEC is not good for mpc8xx ethernet?
  2010-10-18  8:40 ` tiejun.chen
@ 2010-10-18 16:42   ` Scott Wood
  2010-10-19  2:03     ` tiejun.chen
  0 siblings, 1 reply; 9+ messages in thread
From: Scott Wood @ 2010-10-18 16:42 UTC (permalink / raw)
  To: tiejun.chen; +Cc: ppcdev

On Mon, 18 Oct 2010 16:40:42 +0800
"tiejun.chen" <tiejun.chen@windriver.com> wrote:

> Shawn Jin wrote:
> > Hi,
> > 
> > My target is a mpc875 based board and has FEC ethernet. The phy is
> > AM79C874. I have the following configuration for the network support.
> > 
> > CONFIG_PHYLIB=y
> > CONFIG_NET_ETHERNET=y
> > CONFIG_MII=y
> > CONFIG_FS_ENET=y
> > CONFIG_FS_ENET_HAS_FEC=y
> > CONFIG_FS_ENET_MDIO_FEC=y
> > 
> > However I found that the phy support (AM79C874) is actually in
> > drivers/net/fec.c which is compiled only when CONFIG_FEC=y. However
> 
> The phy driver should not be embedded into the NIC driver in theory.

Right, those are handled by drivers/net/phy/.

> I think you should include the phy driver, mdio-bitbang.c, which should be
> support AMD79C874.

On MPC8xx you want drivers/net/fs_enet/mii-fec.c.  This is just the
MDIO driver; it doesn't handle any particular PHY.  I don't know if
there is a driver specifically for AM79C874, though the generic PHY
support may be good enough.

-Scott

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

* Re: CONFIG_FEC is not good for mpc8xx ethernet?
  2010-10-18 16:42   ` Scott Wood
@ 2010-10-19  2:03     ` tiejun.chen
  2010-10-20  7:03       ` Shawn Jin
  0 siblings, 1 reply; 9+ messages in thread
From: tiejun.chen @ 2010-10-19  2:03 UTC (permalink / raw)
  To: Scott Wood; +Cc: ppcdev

Scott Wood wrote:
> On Mon, 18 Oct 2010 16:40:42 +0800
> "tiejun.chen" <tiejun.chen@windriver.com> wrote:
> 
>> Shawn Jin wrote:
>>> Hi,
>>>
>>> My target is a mpc875 based board and has FEC ethernet. The phy is
>>> AM79C874. I have the following configuration for the network support.
>>>
>>> CONFIG_PHYLIB=y
>>> CONFIG_NET_ETHERNET=y
>>> CONFIG_MII=y
>>> CONFIG_FS_ENET=y
>>> CONFIG_FS_ENET_HAS_FEC=y
>>> CONFIG_FS_ENET_MDIO_FEC=y
>>>
>>> However I found that the phy support (AM79C874) is actually in
>>> drivers/net/fec.c which is compiled only when CONFIG_FEC=y. However
>> The phy driver should not be embedded into the NIC driver in theory.
> 
> Right, those are handled by drivers/net/phy/.
> 
>> I think you should include the phy driver, mdio-bitbang.c, which should be
>> support AMD79C874.
> 
> On MPC8xx you want drivers/net/fs_enet/mii-fec.c.  This is just the
> MDIO driver; it doesn't handle any particular PHY.  I don't know if
> there is a driver specifically for AM79C874, though the generic PHY
> support may be good enough.

Maybe.

I can found one related patch for supporting PHY AM79C874 on 2.6.15,
------
http://lists.ozlabs.org/pipermail/linuxppc-embedded/2005-November/021043.html

But I don't see that on the latest kernel, and also I don't know the history
completely for that. Maybe its already merged into one generic PHY driver but
I'm not sure.

Tiejun

> 
> -Scott
> 
> 

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

* Re: CONFIG_FEC is not good for mpc8xx ethernet?
  2010-10-19  2:03     ` tiejun.chen
@ 2010-10-20  7:03       ` Shawn Jin
  2010-10-20  7:46         ` tiejun.chen
  2010-10-20  9:19         ` Shawn Jin
  0 siblings, 2 replies; 9+ messages in thread
From: Shawn Jin @ 2010-10-20  7:03 UTC (permalink / raw)
  To: tiejun.chen; +Cc: Scott Wood, ppcdev

>> On MPC8xx you want drivers/net/fs_enet/mii-fec.c. =A0This is just the
>> MDIO driver; it doesn't handle any particular PHY. =A0I don't know if
>> there is a driver specifically for AM79C874, though the generic PHY
>> support may be good enough.
>
> Maybe.
>
> I can found one related patch for supporting PHY AM79C874 on 2.6.15,
> ------
> http://lists.ozlabs.org/pipermail/linuxppc-embedded/2005-November/021043.=
html
>
> But I don't see that on the latest kernel, and also I don't know the hist=
ory
> completely for that. Maybe its already merged into one generic PHY driver=
 but
> I'm not sure.

Thank Scott & Tiejun for valuable information.

The problem for me is that the PHY failed to be probed. The related
error messages are shown below. I even tried the patch Tiejun pointed
out. But that doesn't help. The phy ID read from the bus was all Fs.

FEC MII Bus: probed
mdio_bus fa200e00: error probing PHY at address 0

I don't know if AM79C874 requires any special handling. But from the
comment in mdiobb_cmd() there seems to be something special.
        /*
         * Send a 32 bit preamble ('1's) with an extra '1' bit for good
         * measure.  The IEEE spec says this is a PHY optional
         * requirement.  The AMD 79C874 requires one after power up and
         * one after a MII communications error.  This means that we are
         * doing more preambles than we need, but it is safer and will be
         * much more robust.
         */

If there is any network action in u-boot, e.g., tftp or ping, the PHY
can be successfully probed after that. Any hints what went wrong with
the PHY?

Thanks,
-Shawn.

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

* Re: CONFIG_FEC is not good for mpc8xx ethernet?
  2010-10-20  7:03       ` Shawn Jin
@ 2010-10-20  7:46         ` tiejun.chen
  2010-10-20  9:19         ` Shawn Jin
  1 sibling, 0 replies; 9+ messages in thread
From: tiejun.chen @ 2010-10-20  7:46 UTC (permalink / raw)
  To: Shawn Jin; +Cc: Scott Wood, ppcdev

Shawn Jin wrote:
>>> On MPC8xx you want drivers/net/fs_enet/mii-fec.c. �This is just the
>>> MDIO driver; it doesn't handle any particular PHY. �I don't know if
>>> there is a driver specifically for AM79C874, though the generic PHY
>>> support may be good enough.
>> Maybe.
>>
>> I can found one related patch for supporting PHY AM79C874 on 2.6.15,
>> ------
>> http://lists.ozlabs.org/pipermail/linuxppc-embedded/2005-November/021043.html
>>
>> But I don't see that on the latest kernel, and also I don't know the history
>> completely for that. Maybe its already merged into one generic PHY driver but
>> I'm not sure.
> 
> Thank Scott & Tiejun for valuable information.
> 
> The problem for me is that the PHY failed to be probed. The related
> error messages are shown below. I even tried the patch Tiejun pointed
> out. But that doesn't help. The phy ID read from the bus was all Fs.
> 
> FEC MII Bus: probed
> mdio_bus fa200e00: error probing PHY at address 0

Is this is all log related to PHY? And are you sure your PHY Address is zero?

Often there are at most 32 PHY devices resided one MDIO bus. So you can dump PHY
ID to check if there is a PHY firstly. A ID value of 0xffff indicates that the
address is invalid if I recalled properly.

But I think PHY driver already do the above process on Linux.

So looks MDIO driver cannot compatible for your platform. I recommend you try
debug mdio driver to access valid PHY ID firstly. Especially where/why this stop
at address '0'? When you can get a valid PHY ID you can go phy driver.

> 
> I don't know if AM79C874 requires any special handling. But from the
> comment in mdiobb_cmd() there seems to be something special.
>         /*
>          * Send a 32 bit preamble ('1's) with an extra '1' bit for good
>          * measure.  The IEEE spec says this is a PHY optional
>          * requirement.  The AMD 79C874 requires one after power up and
>          * one after a MII communications error.  This means that we are
>          * doing more preambles than we need, but it is safer and will be
>          * much more robust.
>          */
> 
> If there is any network action in u-boot, e.g., tftp or ping, the PHY
> can be successfully probed after that. Any hints what went wrong with

On bootstrap the driver should reset MDIO bus/PHY before probing PHY again.

Tiejun

> the PHY?
> 
> Thanks,
> -Shawn.
> 

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

* Re: CONFIG_FEC is not good for mpc8xx ethernet?
  2010-10-20  7:03       ` Shawn Jin
  2010-10-20  7:46         ` tiejun.chen
@ 2010-10-20  9:19         ` Shawn Jin
  2010-10-25  8:21           ` tiejun.chen
  1 sibling, 1 reply; 9+ messages in thread
From: Shawn Jin @ 2010-10-20  9:19 UTC (permalink / raw)
  To: tiejun.chen; +Cc: Scott Wood, ppcdev

> The problem for me is that the PHY failed to be probed. The related
> error messages are shown below. I even tried the patch Tiejun pointed
> out. But that doesn't help. The phy ID read from the bus was all Fs.
>
> FEC MII Bus: probed
> mdio_bus fa200e00: error probing PHY at address 0

I think I figured out the probing failure. My board uses PortD bit8 as
an input pin from phy's MDC. I didn't set up this pin assignment.

When probing the PHY the fs_enet_fec_mii_read() is called to get phy
id. The correct phy id was returned. However when I tried to set up
the ip address using the command "ifconfig eth0 192.168.0.4". The same
function was called again. But this time the fecp->fec_r_cntrl
mysteriously became 0 so the kernel reported bug for that.

# ifconfig eth0 192.168.0.4
------------[ cut here ]------------
kernel BUG at drivers/net/fs_enet/mii-fec.c:58!
Oops: Exception in kernel mode, sig: 5 [#1]
MyMPC870
NIP: c012b79c LR: c012963c CTR: c012b77c
REGS: c7457c60 TRAP: 0700   Not tainted  (2.6.33.5)
MSR: 00029032 <EE,ME,CE,IR,DR>  CR: 24020042  XER: 20000000
TASK = c7840000[236] 'ifconfig' THREAD: c7456000
GPR00: 00000001 c7457d10 c7840000 c7845400 00000000 00000001 ffffffff 00000000
GPR08: c77c44fc c906ce00 c784806c 00000b9f 84020042 100b986c 10096042 1009604f
GPR16: 1009603b 10096030 10096001 100b188e c7457e18 ffff8914 c742430c c740b000
GPR24: c7424300 c78443c0 00000001 00000000 c7845428 c7845400 c7845600 c7845600
NIP [c012b79c] fs_enet_fec_mii_read+0x20/0x90
LR [c012963c] mdiobus_read+0x50/0x74
Call Trace:
[c7457d10] [c0115744] driver_bound+0x60/0xa0 (unreliable)
[c7457d30] [c0129094] genphy_config_init+0x24/0xd4
[c7457d40] [c0128920] phy_init_hw+0x4c/0x78
[c7457d50] [c0128a40] phy_connect_direct+0x24/0x88
[c7457d70] [c0133e50] of_phy_connect+0x48/0x6c
[c7457d90] [c012ae10] fs_enet_open+0xf0/0x2cc
[c7457db0] [c0148a54] dev_open+0x100/0x138
[c7457dd0] [c0146ca0] dev_change_flags+0x80/0x1a8
[c7457df0] [c018e104] devinet_ioctl+0x630/0x750
[c7457e60] [c018eb5c] inet_ioctl+0xcc/0xf8
[c7457e70] [c01370d8] sock_ioctl+0x60/0x28c
[c7457e90] [c007dbcc] vfs_ioctl+0x38/0x9c
[c7457ea0] [c007ddf0] do_vfs_ioctl+0x84/0x708
[c7457f10] [c007e4b4] sys_ioctl+0x40/0x74
[c7457f40] [c000de60] ret_from_syscall+0x0/0x38
Instruction dump:
80010014 7c0803a6 38210010 4e800020 81230018 81290000 7c0004ac 80090144
0c000000 4c00012c 68000004 5400f7fe <0f000000> 5484b810 64846002 54a5925a
---[ end trace 41bf95259a68372e ]---
Trace/breakpoint trap

I cannot find where the fec_r_cntrl would be reset to 0 after
fs_enet_mdio_probe() sets it to FEC_RCNTRL_MII_MODE. Odd?

Thanks,
-Shawn.

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

* Re: CONFIG_FEC is not good for mpc8xx ethernet?
  2010-10-20  9:19         ` Shawn Jin
@ 2010-10-25  8:21           ` tiejun.chen
  2010-10-26  1:00             ` Shawn Jin
  0 siblings, 1 reply; 9+ messages in thread
From: tiejun.chen @ 2010-10-25  8:21 UTC (permalink / raw)
  To: Shawn Jin; +Cc: Scott Wood, ppcdev

Shawn Jin wrote:
>> The problem for me is that the PHY failed to be probed. The related
>> error messages are shown below. I even tried the patch Tiejun pointed
>> out. But that doesn't help. The phy ID read from the bus was all Fs.
>>
>> FEC MII Bus: probed
>> mdio_bus fa200e00: error probing PHY at address 0
> 
> I think I figured out the probing failure. My board uses PortD bit8 as
> an input pin from phy's MDC. I didn't set up this pin assignment.
> 
> When probing the PHY the fs_enet_fec_mii_read() is called to get phy
> id. The correct phy id was returned. However when I tried to set up
> the ip address using the command "ifconfig eth0 192.168.0.4". The same
> function was called again. But this time the fecp->fec_r_cntrl
> mysteriously became 0 so the kernel reported bug for that.

Sorry for this delay response since I'm a bit busying recently:)

If you're sure that work well at the first time it may be issued from PIN. Are
the PINs used to MDIO bus multiplexed? Maybe you miss something to re-configure
PIN with the appropriate mode, OUT direction and some GPIO REGs to bind your PHY
PINs. I means maybe other drivers also use same PINs and re-configure them, so
they don't work properly as the first time. So you can try adding some codes to
re-initial PINs as PHY expect on here to check this again.

Tiejun

> 
> # ifconfig eth0 192.168.0.4
> ------------[ cut here ]------------
> kernel BUG at drivers/net/fs_enet/mii-fec.c:58!
> Oops: Exception in kernel mode, sig: 5 [#1]
> MyMPC870
> NIP: c012b79c LR: c012963c CTR: c012b77c
> REGS: c7457c60 TRAP: 0700   Not tainted  (2.6.33.5)
> MSR: 00029032 <EE,ME,CE,IR,DR>  CR: 24020042  XER: 20000000
> TASK = c7840000[236] 'ifconfig' THREAD: c7456000
> GPR00: 00000001 c7457d10 c7840000 c7845400 00000000 00000001 ffffffff 00000000
> GPR08: c77c44fc c906ce00 c784806c 00000b9f 84020042 100b986c 10096042 1009604f
> GPR16: 1009603b 10096030 10096001 100b188e c7457e18 ffff8914 c742430c c740b000
> GPR24: c7424300 c78443c0 00000001 00000000 c7845428 c7845400 c7845600 c7845600
> NIP [c012b79c] fs_enet_fec_mii_read+0x20/0x90
> LR [c012963c] mdiobus_read+0x50/0x74
> Call Trace:
> [c7457d10] [c0115744] driver_bound+0x60/0xa0 (unreliable)
> [c7457d30] [c0129094] genphy_config_init+0x24/0xd4
> [c7457d40] [c0128920] phy_init_hw+0x4c/0x78
> [c7457d50] [c0128a40] phy_connect_direct+0x24/0x88
> [c7457d70] [c0133e50] of_phy_connect+0x48/0x6c
> [c7457d90] [c012ae10] fs_enet_open+0xf0/0x2cc
> [c7457db0] [c0148a54] dev_open+0x100/0x138
> [c7457dd0] [c0146ca0] dev_change_flags+0x80/0x1a8
> [c7457df0] [c018e104] devinet_ioctl+0x630/0x750
> [c7457e60] [c018eb5c] inet_ioctl+0xcc/0xf8
> [c7457e70] [c01370d8] sock_ioctl+0x60/0x28c
> [c7457e90] [c007dbcc] vfs_ioctl+0x38/0x9c
> [c7457ea0] [c007ddf0] do_vfs_ioctl+0x84/0x708
> [c7457f10] [c007e4b4] sys_ioctl+0x40/0x74
> [c7457f40] [c000de60] ret_from_syscall+0x0/0x38
> Instruction dump:
> 80010014 7c0803a6 38210010 4e800020 81230018 81290000 7c0004ac 80090144
> 0c000000 4c00012c 68000004 5400f7fe <0f000000> 5484b810 64846002 54a5925a
> ---[ end trace 41bf95259a68372e ]---
> Trace/breakpoint trap
> 
> I cannot find where the fec_r_cntrl would be reset to 0 after
> fs_enet_mdio_probe() sets it to FEC_RCNTRL_MII_MODE. Odd?
> 
> Thanks,
> -Shawn.
> 

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

* Re: CONFIG_FEC is not good for mpc8xx ethernet?
  2010-10-25  8:21           ` tiejun.chen
@ 2010-10-26  1:00             ` Shawn Jin
  0 siblings, 0 replies; 9+ messages in thread
From: Shawn Jin @ 2010-10-26  1:00 UTC (permalink / raw)
  To: tiejun.chen; +Cc: Scott Wood, ppcdev

> Sorry for this delay response since I'm a bit busying recently:)

No. Don't feel sorry about it. You're not obligated to answer any
questions here. I believe it is the free and willing to help spirit
that drive the open source community (linux particularly) to be such a
success. We all benefit from and contribute to this. :)

> If you're sure that work well at the first time it may be issued from PIN. Are
> the PINs used to MDIO bus multiplexed? Maybe you miss something to re-configure
> PIN with the appropriate mode, OUT direction and some GPIO REGs to bind your PHY
> PINs. I means maybe other drivers also use same PINs and re-configure them, so
> they don't work properly as the first time. So you can try adding some codes to
> re-initial PINs as PHY expect on here to check this again.

After the PIN assignment issue, the cause was simply an unnecessary
reset in fs_init_phy() that was added in the beginning. And I forgot
it. :-P

Tiejun, Scott, many thanks to your kind help.

-Shawn.

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

end of thread, other threads:[~2010-10-26  1:01 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-18  8:13 CONFIG_FEC is not good for mpc8xx ethernet? Shawn Jin
2010-10-18  8:40 ` tiejun.chen
2010-10-18 16:42   ` Scott Wood
2010-10-19  2:03     ` tiejun.chen
2010-10-20  7:03       ` Shawn Jin
2010-10-20  7:46         ` tiejun.chen
2010-10-20  9:19         ` Shawn Jin
2010-10-25  8:21           ` tiejun.chen
2010-10-26  1:00             ` Shawn Jin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).