netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Timur Tabi <timur@codeaurora.org>
To: Zefir Kurtisi <zefir.kurtisi@neratec.com>, netdev@vger.kernel.org
Cc: andrew@lunn.ch, f.fainelli@gmail.com
Subject: Re: [PATCH 2/2] at803x: double check SGMII side autoneg
Date: Thu, 19 Jan 2017 20:38:15 -0600	[thread overview]
Message-ID: <44eb0b95-1868-396b-db6b-18d233eff853@codeaurora.org> (raw)
In-Reply-To: <759d6323-ffac-ebe8-b197-4e1165be5673@neratec.com>

Zefir Kurtisi wrote:
> It always operates at 675MHz, which with two lines gives 1.25Gbps,
> which at 10/8 coding gives exactly 1Gbps net data rate. If the
> at803x's copper side autonegotiates to 1Gbps, the bits traversing
> over the SGMII match the copper side 1:1. In case the copper side
> autonegotiates to e.g. 100Mbps, each bit at the copper side on the
> SGMII bus is replicated and sent 10x times - or 100x times in case of
> 10Mbps. The MAC side of the ETH needs to be aware of how the SGMII
> data has to be interpreted, and this is why you have to set the bits
> you are referring to.

So does this mean that the SGMII link should not be autonegotiated? I 
currently have this code:

     if (phydev->autoneg == AUTONEG_ENABLE) {
         val &= ~(FORCE_AN_RX_CFG | FORCE_AN_TX_CFG);
         val |= AN_ENABLE;
         writel(val, phy->base + EMAC_SGMII_PHY_AUTONEG_CFG2);
     } else {
         ...

So if the external PHY is set to autonegotiate, then the SGMII block is 
set to also negotiate.  Now that I think about it, this seems wrong. 
And in fact, I'm not sure how it works.  It seems that the this only 
makes sense if the SGMII block is configured to act as the only PHY. 
This is an option that the hardware supports but my driver does not.  So 
perhaps I should remove this part, and just do the rest:


	u32 speed_cfg;

	switch (phydev->speed) {
	case SPEED_10:
		speed_cfg = SPDMODE_10;
		break;
	case SPEED_100:
		speed_cfg = SPDMODE_100;
		break;
	case SPEED_1000:
		speed_cfg = SPDMODE_1000;
		break;
	default:
		return -EINVAL;
	}

	if (phydev->duplex == DUPLEX_FULL)
		speed_cfg |= DUPLEX_MODE;

	val &= ~AN_ENABLE;
	writel(speed_cfg, phy->base + EMAC_SGMII_PHY_SPEED_CFG1);
	writel(val, phy->base + EMAC_SGMII_PHY_AUTONEG_CFG2);

Should I be doing this all the time?

> To track down who is causing the additional message, I would proceed
> with following technique that helped me dig down a similar problem:
> since you control the events in question and there is no risk of
> flooding the kernel log, in the top of phy.c::phy_print_status() add
> a dump_stack() call. In the debug log ensure that all of the traces
> end up in the same phydev->adjust_link() callback handler (in your
> case emac_adjust_link()).

That's a good idea, thanks.

-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the
Code Aurora Forum, hosted by The Linux Foundation.

  parent reply	other threads:[~2017-01-20  2:38 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-24 10:40 [PATCH 0/2] at803x: don't power-down SGMII link Zefir Kurtisi
2016-10-24 10:40 ` [PATCH 1/2] Revert "at803x: fix suspend/resume for SGMII link" Zefir Kurtisi
2016-10-27 20:05   ` David Miller
2016-10-24 10:40 ` [PATCH 2/2] at803x: double check SGMII side autoneg Zefir Kurtisi
2016-10-27 20:05   ` David Miller
2016-10-28 22:24   ` Timur Tabi
2016-11-01 11:13     ` Zefir Kurtisi
2017-01-17 23:32   ` Timur Tabi
2017-01-18 11:00     ` Zefir Kurtisi
2017-01-18 13:13       ` Timur Tabi
2017-01-18 13:53         ` Zefir Kurtisi
2017-01-18 15:02           ` Timur Tabi
2017-01-19  9:43             ` Zefir Kurtisi
2017-01-19 18:01               ` Florian Fainelli
2017-01-20  2:38               ` Timur Tabi [this message]
2017-01-20 15:31                 ` Zefir Kurtisi
2017-05-22 20:12   ` Timur Tabi
2017-05-22 21:02     ` Andrew Lunn
2017-05-22 21:10       ` Florian Fainelli
2017-05-22 21:19         ` Timur Tabi
2017-05-22 21:50           ` Florian Fainelli
2017-05-22 21:09     ` Andrew Lunn
2017-05-22 21:29       ` Timur Tabi
2017-05-22 21:32         ` Andrew Lunn
2017-05-23 15:54           ` Timur Tabi
2017-05-23 16:07             ` Andrew Lunn
2017-05-23 16:33               ` Timur Tabi
2017-05-24  7:18                 ` Matthias May
2017-05-24 13:29                   ` Timur Tabi
2017-05-24 13:40                     ` Andrew Lunn
2017-05-24 13:48                       ` Timur Tabi
2017-05-24 14:09                         ` Andrew Lunn
2017-05-24 18:58                           ` Timur Tabi
2017-05-24 19:34                             ` Andrew Lunn
2017-05-24 20:57                               ` Timur Tabi
2017-05-24 21:15                                 ` Andrew Lunn
2017-05-24 21:20                                   ` Timur Tabi
2017-05-24 21:28                                     ` Florian Fainelli
2017-05-24 21:32                                       ` Timur Tabi
2017-05-24 21:36                                         ` Florian Fainelli
2017-05-24 22:03                                           ` Timur Tabi
2017-05-24 21:19                                 ` Florian Fainelli
2017-06-01 11:45                     ` Zefir Kurtisi
2017-06-01 14:48                       ` Timur Tabi
2016-10-25 17:31 ` [PATCH 0/2] at803x: don't power-down SGMII link Timur Tabi
2016-10-27  8:05   ` Zefir Kurtisi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=44eb0b95-1868-396b-db6b-18d233eff853@codeaurora.org \
    --to=timur@codeaurora.org \
    --cc=andrew@lunn.ch \
    --cc=f.fainelli@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=zefir.kurtisi@neratec.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).