public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@free-electrons•com>
To: Giuseppe CAVALLARO <peppe.cavallaro@st•com>
Cc: Alexandre Torgue <alexandre.torgue@st•com>,
	<netdev@vger•kernel.org>, <stable@vger•kernel.org>
Subject: Re: [PATCH] net: ethernet: stmmac: properly set PS bit in MII configurations during reset
Date: Wed, 3 May 2017 17:11:51 +0200	[thread overview]
Message-ID: <20170503171151.154c0dc0@free-electrons.com> (raw)
In-Reply-To: <deea272a-f0a9-ad0b-4ad6-387723938314@st.com>

Hello Giuseppe,

On Wed, 3 May 2017 10:13:56 +0200, Giuseppe CAVALLARO wrote:

> this was initially set by using the hw->link.port; both the core_init 
> and adjust callback
> should invoke the hook and tuning the PS bit according to the speed and 
> mode.

But this doesn't work: core_init and adjust callbacks are called too
late / not at the appropriate time.

Here, I need the PS to be set after asserting the DMA reset bit but
*before* polling for the DMA reset bit to clear.

I.e, I need:

int dwmac_dma_reset(void __iomem *ioaddr, struct mac_device_info *hw,
                    phy_interface_t interface)
{
        u32 value = readl(ioaddr + DMA_BUS_MODE);
        int limit;

        /* DMA SW reset */
        value |= DMA_BUS_MODE_SFT_RESET;
        writel(value, ioaddr + DMA_BUS_MODE);

        /* ===> PS must be set here when the PHY interface is MII */

        limit = 10;
        while (limit--) {
                if (!(readl(ioaddr + DMA_BUS_MODE) & DMA_BUS_MODE_SFT_RESET))
                        break;
                mdelay(10);
        }

        if (limit < 0)
                return -EBUSY;

        return 0;
}

Setting PS *before* asserting the DMA reset bit doesn't work, because
asserting the DMA reset bit clears all bits in all registers.

Setting PS *after* waiting for the DMA reset bit to clear doesn't work,
because this bit never clears if the PS configuration is not correct
with the regard to the PHY being used (which was my original problem).

Am I missing something here?

Best regards,

Thomas Petazzoni
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

      parent reply	other threads:[~2017-05-03 15:11 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-27  9:45 [PATCH] net: ethernet: stmmac: properly set PS bit in MII configurations during reset Thomas Petazzoni
2017-05-02 19:00 ` David Miller
2017-05-03  8:13 ` Giuseppe CAVALLARO
2017-05-03 14:30   ` Corentin Labbe
2017-05-08 14:28     ` Giuseppe CAVALLARO
2017-05-08 19:12       ` Thomas Petazzoni
2017-05-10  7:03         ` Giuseppe CAVALLARO
2017-05-10  7:18           ` Thomas Petazzoni
2017-05-15 14:27             ` Thomas Petazzoni
2017-06-25 12:32               ` Thomas Petazzoni
2017-06-28 14:40                 ` Giuseppe CAVALLARO
2017-07-29 19:54                   ` Thomas Petazzoni
2017-08-02 12:33                     ` Giuseppe CAVALLARO
2017-05-03 15:11   ` Thomas Petazzoni [this message]

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=20170503171151.154c0dc0@free-electrons.com \
    --to=thomas.petazzoni@free-electrons$(echo .)com \
    --cc=alexandre.torgue@st$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=peppe.cavallaro@st$(echo .)com \
    --cc=stable@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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