2010-11-01 12:59:54     No ethernet / Davicom DM9161EP PHY

Document created by Aaronwu Employee on Aug 23, 2013
Version 1Show Document
  • View in full screen mode

2010-11-01 12:59:54     No ethernet / Davicom DM9161EP PHY

Andreas Schallenberg (GERMANY)

Message: 95449   

 

Hello,

 

I am adding the DNP/5370 board support, using 2009R1.1-RC4 sources.

The board has a Davicom DM 9161 EP PHY.  The ethernet device is working with U-Boot bot not with uClinux.

 

"ethtool" and "ifconfig" report:

 

root:~> ethtool eth0

Settings for eth0:

        Supported ports: [ TP MII ]

        Supported link modes:

        Supports auto-negotiation: No

        Advertised link modes:  Not reported

        Advertised auto-negotiation: No

        Speed: 10Mb/s

        Duplex: Half

        Port: MII

        PHYAD: 31

        Transceiver: external

        Auto-negotiation: on

        Link detected: no

 

root:~> ifconfig eth0

eth0      Link encap:Ethernet  HWaddr 02:08:AD:21:36:31

          inet addr:10.100.100.21  Bcast:10.100.255.255  Mask:255.255.0.0

          UP BROADCAST MULTICAST  MTU:1500  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

 

 

I guess this could be an issue with the ethernet PHY driver since the kernel boots with:

 

Davicom DM9161E: Registered new driver

Davicom DM9161A: Registered new driver

Davicom DM9131: Registered new driver

bfin_mii_bus: probed

bfin_mac: attached PHY driver [Generic PHY] (mii_bus:phy_addr=0:1f, irq=-1, mdc_clk=2500000Hz(mdc_div=23)@sclk=120MHz)

bfin_mac bfin_mac.0: Blackfin on-chip Ethernet MAC driver, Version 1.1

 

How do I make bfin_mac use the Davicom driver (and not "Generic PHY")? I tried this in the board file:

 

#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)

static struct platform_device davicom_phy_device = {

        .name    = "Davicom DM9161E",

//        .id      = 0x0181b880,

};

 

static struct platform_device bfin_mii_bus = {

    .name = "bfin_mii_bus",

        .dev.platform_data = &davicom_phy_device,

};

 

static struct platform_device bfin_mac_device = {

    .name = "bfin_mac",

    .dev.platform_data = &bfin_mii_bus,

};

#endif

 

But this is just a shot in the dark. Has anyone an idea how to debug this?

TranslateQuoteReplyEditDelete

 

 

2010-11-02 04:52:24     Re: No ethernet / Davicom DM9161EP PHY

Aaron Wu (CHINA)

Message: 95475   

 

Have you enabled the phy driver for davicom?  device driver -> network device support -> phy device support -> drivers for davicom phys.

QuoteReplyEditDelete

 

 

2010-11-02 05:20:08     Re: No ethernet / Davicom DM9161EP PHY

Andreas Schallenberg (GERMANY)

Message: 95476   

 

Yes, the "Drivers for Davicom PHYs" is enabled and it is the only enabled PHY driver.

 

There is no mention of a "Generic PHY". So I'm not sure if this is a base infrastructure

that is also used for the Davicom driver or if it is a separate driver.

TranslateQuoteReplyEditDelete

 

 

2010-11-02 05:27:49     Re: No ethernet / Davicom DM9161EP PHY

Aaron Wu (CHINA)

Message: 95477   

 

Thanks for the info.

 

From you log the generic one is attached. Generic PHY is not the "base infrastructure" as you mentioned, first it will try to probe a correct PHY on the mii port, if there is no other PHY then the generic one will be used, please find the details in drivers/net/bfin_mac.c, guess you have missed something.

QuoteReplyEditDelete

 

 

2010-11-02 09:53:28     Re: No ethernet / Davicom DM9161EP PHY

Andreas Schallenberg (GERMANY)

Message: 95484   

 

Found out some more bits. I can query the MII bus using u-boot now:

 

bfin> mii device

MII devices: 'Blackfin EMAC'

Current device: 'Blackfin EMAC'

bfin> mii info

PHY 0x00: OUI = 0x606E, Model = 0x08, Rev = 0x01, 100baseT, FDX

PHY 0x01: OUI = 0x0000, Model = 0x00, Rev = 0x00,  10baseT, HDX

PHY 0x02: OUI = 0x0000, Model = 0x00, Rev = 0x00,  10baseT, HDX

PHY 0x03: OUI = 0x0000, Model = 0x00, Rev = 0x00,  10baseT, HDX

PHY 0x04: OUI = 0x0000, Model = 0x00, Rev = 0x00,  10baseT, HDX

PHY 0x05: OUI = 0x0000, Model = 0x00, Rev = 0x00,  10baseT, HDX

PHY 0x06: OUI = 0x0000, Model = 0x00, Rev = 0x00,  10baseT, HDX

PHY 0x07: OUI = 0x0000, Model = 0x00, Rev = 0x00,  10baseT, HDX

PHY 0x08: OUI = 0x0000, Model = 0x00, Rev = 0x00,  10baseT, HDX

PHY 0x09: OUI = 0x0000, Model = 0x00, Rev = 0x00,  10baseT, HDX

PHY 0x0A: OUI = 0x0000, Model = 0x00, Rev = 0x00,  10baseT, HDX

PHY 0x0B: OUI = 0x0000, Model = 0x00, Rev = 0x00,  10baseT, HDX

PHY 0x0C: OUI = 0x0000, Model = 0x00, Rev = 0x00,  10baseT, HDX

PHY 0x0D: OUI = 0x0000, Model = 0x00, Rev = 0x00,  10baseT, HDX

PHY 0x0E: OUI = 0x0000, Model = 0x00, Rev = 0x00,  10baseT, HDX

PHY 0x0F: OUI = 0x0000, Model = 0x00, Rev = 0x00,  10baseT, HDX

PHY 0x10: OUI = 0x0000, Model = 0x00, Rev = 0x00,  10baseT, HDX

PHY 0x11: OUI = 0x0000, Model = 0x00, Rev = 0x00,  10baseT, HDX

PHY 0x12: OUI = 0x0000, Model = 0x00, Rev = 0x00,  10baseT, HDX

PHY 0x13: OUI = 0x0000, Model = 0x00, Rev = 0x00,  10baseT, HDX

PHY 0x14: OUI = 0x0000, Model = 0x00, Rev = 0x00,  10baseT, HDX

PHY 0x15: OUI = 0x0000, Model = 0x00, Rev = 0x00,  10baseT, HDX

PHY 0x16: OUI = 0x0000, Model = 0x00, Rev = 0x00,  10baseT, HDX

PHY 0x17: OUI = 0x0000, Model = 0x00, Rev = 0x00,  10baseT, HDX

PHY 0x18: OUI = 0x0000, Model = 0x00, Rev = 0x00,  10baseT, HDX

PHY 0x19: OUI = 0x0000, Model = 0x00, Rev = 0x00,  10baseT, HDX

PHY 0x1A: OUI = 0x0000, Model = 0x00, Rev = 0x00,  10baseT, HDX

PHY 0x1B: OUI = 0x0000, Model = 0x00, Rev = 0x00,  10baseT, HDX

PHY 0x1C: OUI = 0x0000, Model = 0x00, Rev = 0x00,  10baseT, HDX

PHY 0x1D: OUI = 0x0000, Model = 0x00, Rev = 0x00,  10baseT, HDX

PHY 0x1E: OUI = 0x0000, Model = 0x00, Rev = 0x00,  10baseT, HDX

PHY 0x1F: OUI = 0x0000, Model = 0x00, Rev = 0x00,  10baseT, HDX

...

 

0x606e is the OUI for Davicom. The PHY datasheet defines two registers for OUI, model and revision. OUI (without two leftmost bits, as documented), model 8 and revision 0 plus one 0-bit (as documented) give 0x181b880, as defined in the driver. The phy_id_mask is 0x0ffffff0 which would make the driver ignore the revision. So this definitely is the PHY device.

 

Next, up to Linux.

 

root:/sys/devices/platform/bfin_mii_bus.0> find

.

./uevent

./modalias

./subsystem

./driver

./mdio_bus

./mdio_bus/0

./mdio_bus/0/uevent

./mdio_bus/0/subsystem

./mdio_bus/0/device

./0:00

./0:00/uevent

./0:00/subsystem

./0:00/driver

./0:01

./0:01/uevent

./0:01/subsystem

./0:02

./0:02/uevent

./0:02/subsystem

./0:03

./0:03/uevent

./0:03/subsystem

...

./0:1d/uevent

./0:1d/subsystem

./0:1e

./0:1e/uevent

./0:1e/subsystem

./0:1f

./0:1f/uevent

./0:1f/subsystem

./0:1f/driver

 

This tells me that there are drivers attached to 0:00 and 0:1f.

 

root:/sys/devices/platform/bfin_mii_bus.0> cat 0\:00/uevent

DRIVER=Davicom DM9161E

root:/sys/devices/platform/bfin_mii_bus.0> cat 0\:1f/uevent

DRIVER=Generic PHY

 

So, the kernel sees two PHYs on the MII bus and selects the wrong one.

TranslateQuoteReplyEditDelete

 

 

2010-11-02 10:08:52     Re: No ethernet / Davicom DM9161EP PHY

Andreas Schallenberg (GERMANY)

Message: 95486   

 

The following patch makes the bfin_mac driver select the Davicom PHY:

 

Index: linux-2.6.x/drivers/net/bfin_mac.c

===================================================================

--- linux-2.6.x/drivers/net/bfin_mac.c  (Revision 1242)

+++ linux-2.6.x/drivers/net/bfin_mac.c  (Arbeitskopie)

@@ -402,7 +402,7 @@

        bfin_write_EMAC_SYSCTL(sysctl);

 

        /* search for connect PHY device */

-       for (i = PHY_MAX_ADDR - 1; i >= 0; i--) {

+       for (i = 0; i < PHY_MAX_ADDR; ++i) {

                struct phy_device *const tmp_phydev = lp->mii_bus->phy_map[i];

 

                if (!tmp_phydev)

 

Now I'll see if I can get the eth0 to work and report here.

TranslateQuoteReplyEditDelete

 

 

2010-11-02 12:48:17     Re: No ethernet / Davicom DM9161EP PHY

Andreas Schallenberg (GERMANY)

Message: 95490   

 

Still not working. The kernel now boots with:

 

bfin_mac: attached PHY driver [Davicom DM9161E] (mii_bus:phy_addr=0:00, irq=-1, mdc_clk=2500000Hz(mdc_div=23)@sclk=120MHz)

bfin_mac bfin_mac.0: Blackfin on-chip Ethernet MAC driver, Version 1.1

 

I put some printks into the bfin_mac driver and I see the function bfin_mac_hard_start_xmit being called. Each "ping" makes it want to transmit 42 bytes. However, wireshark on my host says that there is nothing emitted.

 

If I ping the board from my host, the function bfin_mac_rx() never gets called. Same with bfin_mac_interrupt.

 

Any idea where else to look into?

TranslateQuoteReplyEditDelete

 

 

2010-11-02 23:07:57     Re: No ethernet / Davicom DM9161EP PHY

Sonic Zhang (CHINA)

Message: 95501   

 

This has already been fixed in 2010R1-RC1.

QuoteReplyEditDelete

 

 

2010-11-02 23:09:29     Re: No ethernet / Davicom DM9161EP PHY

Aaron Wu (CHINA)

Message: 95502   

 

So the Davicom is probed and attached right? create a new thread for your problem

QuoteReplyEditDelete

 

 

2010-11-03 04:46:02     Re: No ethernet / Davicom DM9161EP PHY

Andreas Schallenberg (GERMANY)

Message: 95522   

 

With "this" you refer to the (now working) PHY selection? Or the remaining issue with no data being sent/received?

TranslateQuoteReplyEditDelete

 

 

2010-11-03 05:47:44     Re: No ethernet / Davicom DM9161EP PHY

Sonic Zhang (CHINA)

Message: 95523   

 

I mean the (now working) PHY selection.

QuoteReplyEditDelete

 

 

2010-11-04 06:17:50     Re: No ethernet / Davicom DM9161EP PHY

Andreas Schallenberg (GERMANY)

Message: 95552   

 

Thank you,  Aaron and Sonic. I'm now trying the 2010R1-RC2 uClinux release, hoping that I don't need to use patched kernel sources for bfin_mac so I can submit the board support file for future releases. Unfortunately there is trouble again (serial this time) and I will open a new thread for this now.

TranslateQuoteReplyEditDelete

Attachments

    Outcomes