Netdev List
 help / color / mirror / Atom feed
* RE: About the Davicom PHY in drivers/net/phy in Linux kernel
@ 2010-10-29  7:46 macpaul
  2010-11-01  2:27 ` Joseph Chang
  0 siblings, 1 reply; 5+ messages in thread
From: macpaul @ 2010-10-29  7:46 UTC (permalink / raw)
  To: joseph_chang, netdev; +Cc: afleming, jeff, f.rodo

Hi Joseph,

I just followed up your suggestion in previous mail, let me quote them here:

# quote
The recommend is changed to be as below:
 err = phy_write(phydev, MII_BMCR, BMCR_RESET);
    //err = phy_write(phydev, MII_BMCR, BMCR_ISOLATE);
   err = phy_write(phydev, MII_DM9161_SCR, MII_DM9161_SCR_INIT);
   err = phy_write(phydev, MII_DM9161_10BTCSR, MII_DM9161_10BTCSR_INIT);
  // err = phy_write(phydev, MII_NWAYTEST, 0x10);
    err = phy_write(phydev, MII_BMCR, BMCR_ANENABLE | BMCR_ANRESTART);
  *Note: Added a PHY reset command.
# end quote
> 
>  * == > Would you tell us your:
> 	CPU = ?
SoC: Faraday A320 (arm920t) / Andes AG101 (NDS32)
> 	Linux Kernel version= ?
Linux: 2.6.32
>       I will like to download the same source code from LXR.
>       And can check more detail for you.

I've believed that you have download the source already. :-)



^ permalink raw reply	[flat|nested] 5+ messages in thread
* RE: About the Davicom PHY in drivers/net/phy in Linux kernel
@ 2010-11-02  7:27 macpaul
  0 siblings, 0 replies; 5+ messages in thread
From: macpaul @ 2010-11-02  7:27 UTC (permalink / raw)
  To: joseph_chang, netdev; +Cc: afleming, jeff, f.rodo

Hi Joseph,

> From: Joseph Chang [mailto:joseph_chang@mail.davicom.com.tw]
> Sent: Monday, November 01, 2010 10:27 AM
> To: Macpaul Chih-Pin Lin(林智斌); netdev@vger.kernel.org
> Cc: afleming@freescale.com; jeff@garzik.org; f.rodo@til-technologies.fr
> Subject: RE: About the Davicom PHY in drivers/net/phy in Linux kernel
> 
> Dear MacPaul,
> 
>    1.Yes. I have downloaded it. And below is the know items.
> 
>      DM9161A
>      cpu: Faraday A320 (arm920t) + Andes AG101 (NDS32) ;SoC
>      OS: Linux: 2.6.32
>      Actions:
>        - davicom.c             // Download from LXR
>        - include-linux-mii.h   // Download from LXR

Yes

>    2.Your quote is right. Please tell us the test result.

On our EVB board, RESET won't have dhcp problem (unstable) however ISOLATE does.

>    3.I have a question for you,
>    Where is your company? I browse for andestech, And found that andestech
> located at
>     SiSoft SIPP Center! (Address: 2F, No.1, Li-Hsin First Road, Science-Based
> Industrial Park)
>     Is it right?

Yes. That's the location of my company.
> 
> Best Regards,
> Joseph CHANG
> System Application Engineering Division
> Davicom Semiconductor, Inc.
> No. 6 Li-Hsin Rd. VI, Science-Based Park,
> Hsin-Chu, Taiwan.
> Tel: 886-3-5798797 Ex 8534
> Fax: 886-3-5646929
> Web: http://www.davicom.com.tw
[Deleted]

Best regards,
Macpaul Lin

^ permalink raw reply	[flat|nested] 5+ messages in thread
* About the Davicom PHY in drivers/net/phy in Linux kernel
@ 2010-10-28  6:33 macpaul
  2010-10-28  7:59 ` Joseph Chang
  0 siblings, 1 reply; 5+ messages in thread
From: macpaul @ 2010-10-28  6:33 UTC (permalink / raw)
  To: netdev; +Cc: afleming, jeff, f.rodo, joseph_chang

Hi all,

According to the source code of Davicom PHY in Linux,
We should do "ISOLATE" command to PHY before setting "auto negotiation" or "MII/RMII".

However, I've found that with Faraday's MAC/GMAC controller (ftmac100/ftgmac100), setting ISOLATE for multiple PHY configuration will lead MDC become stop because the flaw inside the MAC controller. Faraday's MAC/GMAC will leverage the TX_CLK as the MDC source. When FTMAC100 send "ISOLATE" to Davicom's PHY, the TX_CLK send out from PHY will be stopped, then MDC will also become stop.

However, this mail wasn't meant to discuss about the design flaw inside the IC.

We've done two test to the following codes.

1st: if we just skip the " BMCR_ISOLATE" setting command, we will get PHY sometimes become unstable, for example, could not do DHCP request successfully.

2nd: if we replace "BMCR_ISOLATE" to "BMCR_RESET", we could get rid of the problem occurred by Faraday GMAC. And the PHY works well still.

I've found that in some other PHY implementation, for example, in "marvell.c", there are seems no ISOLATE commands. There are only RESET commands.
If we could replace BMCR_ISOLATE to BMCR_RESET in current kernel source, will there be any unpredictable behavior happened?

Please give us suggestion according to your experiences.
Thanks a lot.

+static int dm9161_config_aneg(struct phy_device *phydev)
+{
+	int err;
+
+	/* Isolate the PHY */
+	err = phy_write(phydev, MII_BMCR, BMCR_ISOLATE);
+
+	if (err < 0)
+		return err;
+
+	/* Configure the new settings */
+	err = genphy_config_aneg(phydev);
+
+	if (err < 0)
+		return err;
+
+	return 0;
+}
+
+static int dm9161_config_init(struct phy_device *phydev)
+{
+	int err;
+
+	/* Isolate the PHY */
+	err = phy_write(phydev, MII_BMCR, BMCR_ISOLATE);
+
+	if (err < 0)
+		return err;
+
+	/* Do not bypass the scrambler/descrambler */
+	err = phy_write(phydev, MII_DM9161_SCR, MII_DM9161_SCR_INIT);
+
+	if (err < 0)
+		return err;
+
+	/* Clear 10BTCSR to default */
+	err = phy_write(phydev, MII_DM9161_10BTCSR, MII_DM9161_10BTCSR_INIT);
+
+	if (err < 0)
+		return err;
+
+	/* Reconnect the PHY, and enable Autonegotiation */
+	err = phy_write(phydev, MII_BMCR, BMCR_ANENABLE);
+
+	if (err < 0)
+		return err;
+
+	return 0;

Best regards,
Macpaul Lin

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

end of thread, other threads:[~2010-11-02  7:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-29  7:46 About the Davicom PHY in drivers/net/phy in Linux kernel macpaul
2010-11-01  2:27 ` Joseph Chang
  -- strict thread matches above, loose matches on Subject: below --
2010-11-02  7:27 macpaul
2010-10-28  6:33 macpaul
2010-10-28  7:59 ` Joseph Chang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox