From: Andrew Lunn <andrew@lunn.ch>
To: Serge Semin <Sergey.Semin@baikalelectronics.ru>
Cc: Alexandre Torgue <alexandre.torgue@st.com>,
netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com,
linux-kernel@vger.kernel.org,
Serge Semin <fancer.lancer@gmail.com>,
Alexey Malahov <Alexey.Malahov@baikalelectronics.ru>,
Jose Abreu <joabreu@synopsys.com>,
Pavel Parkhomenko <Pavel.Parkhomenko@baikalelectronics.ru>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Jakub Kicinski <kuba@kernel.org>,
Giuseppe Cavallaro <peppe.cavallaro@st.com>,
Vyacheslav Mitrofanov
<Vyacheslav.Mitrofanov@baikalelectronics.ru>,
"David S. Miller" <davem@davemloft.net>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [RFC] net: stmmac: Problem with adding the native GPIOs support
Date: Mon, 14 Dec 2020 16:31:43 +0100 [thread overview]
Message-ID: <20201214153143.GB2841266@lunn.ch> (raw)
In-Reply-To: <20201214092516.lmbezb6hrbda6hzo@mobilestation>
On Mon, Dec 14, 2020 at 12:25:16PM +0300, Serge Semin wrote:
> Hello folks,
>
> I've got a problem, which has been blowing by head up for more than three
> weeks now, and I'm desperately need your help in that matter. See our
> Baikal-T1 SoC is created with two DW GMAC v3.73a IP-cores. Each core
> has been synthesized with two GPIOs: one as GPI and another as GPO. There
> are multiple Baikal-T1-based devices have been created so far with active
> GMAC interface usage and each of them has been designed like this:
>
> +------------------------+
> | Baikal-T1 +------------+ +------------+
> | SoC | DW GMAC | | Some PHY |
> | | Rx-clk+<------+Rx-clk |
> | | | | |
> | | GPI+<------+#IRQ |
> | | | | |
> | | RGMII+<----->+RGMII |
> | | MDIO+<----->+MDIO |
> | | | | |
> | | GPO+------>+#RST |
> | | | | |
> | | Tx-clk+------>+Tx-clk |
> | | | | |
> | +------------+ +------------+
> +------------------------+
>
> Each of such devices has got en external RGMII-PHY attached configured via the
> MDIO bus with Rx-clock supplied by the PHY and Tx-clock consumed by it. The
> main peculiarity of such configuration is that the DW GMAC GPIOs have been used
> to catch the PHY IRQs and to reset the PHY. Seeing the GPIOs support hasn't
> been added to the STMMAC driver it's the very first setup for now, which has
> been using them.
It sounds like you need to cleanly implement a GPIO controller within
the stmmac driver. But you probably want to make it conditional on a
DT property. For example, look to see if there is the
'gpio-controller;'
> Anyway the hardware setup depicted above doesn't seem
> problematic at the first glance, but in fact it is. See, the DW *MAC driver
> (STMMAC ethernet driver) is doing the MAC reset each time it performs the
> device open or resume by means of the call-chain:
>
> stmmac_open()---+
> +->stmmac_hw_setup()->stmmac_init_dma_engine()->stmmac_reset().
> stmmac_resume()-+
>
> Such reset causes the whole interface reset: MAC, DMA and, what is more
> important, GPIOs as being exposed as part of the MAC registers. That
> in our case automatically causes the external PHY reset, what neither
> the STTMAC driver nor the PHY subsystem expect at all.
Is the reset of the GPIO sub block under software control? When you
have a GPIO controller implemented, you would want to disable this.
Once you have a GPIO controller, you can make use of the standard PHY
DT properties to allow the PHY driver to make use of the interrupt,
and to control the reset of the PHY.
Andrew
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2020-12-14 15:40 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-14 9:25 [RFC] net: stmmac: Problem with adding the native GPIOs support Serge Semin
2020-12-14 10:52 ` Alexandre Torgue
2020-12-15 8:10 ` Serge Semin
2020-12-14 15:31 ` Andrew Lunn [this message]
2020-12-15 8:25 ` Serge Semin
2020-12-15 13:58 ` Andrew Lunn
2020-12-15 14:52 ` Serge Semin
2020-12-16 2:03 ` Andrew Lunn
2020-12-16 5:31 ` Serge Semin
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=20201214153143.GB2841266@lunn.ch \
--to=andrew@lunn.ch \
--cc=Alexey.Malahov@baikalelectronics.ru \
--cc=Pavel.Parkhomenko@baikalelectronics.ru \
--cc=Sergey.Semin@baikalelectronics.ru \
--cc=Vyacheslav.Mitrofanov@baikalelectronics.ru \
--cc=alexandre.torgue@st.com \
--cc=davem@davemloft.net \
--cc=fancer.lancer@gmail.com \
--cc=joabreu@synopsys.com \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=peppe.cavallaro@st.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).