From: Lukasz Majewski <lukma@denx.de>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Parthiban Veerasooran <Parthiban.Veerasooran@microchip.com>,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, robh+dt@kernel.org,
krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org,
corbet@lwn.net, steen.hegelund@microchip.com,
rdunlap@infradead.org, horms@kernel.org, casper.casan@gmail.com,
netdev@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
horatiu.vultur@microchip.com, Woojung.Huh@microchip.com,
Nicolas.Ferre@microchip.com, UNGLinuxDriver@microchip.com,
Thorsten.Kummermehr@microchip.com
Subject: Re: [RFC PATCH net-next 2/6] net: ethernet: add mac-phy interrupt support with reset complete handling
Date: Wed, 13 Sep 2023 15:26:25 +0200 [thread overview]
Message-ID: <20230913152625.73e32789@wsk> (raw)
In-Reply-To: <61a58960-f2f3-4772-8f12-0d1f9cfec2c5@lunn.ch>
[-- Attachment #1: Type: text/plain, Size: 4336 bytes --]
Hi Andrew,
> > Just maybe mine small remark. IMHO the reset shall not pollute the
> > IRQ hander. The RESETC is just set on the initialization phase and
> > only then shall be served. Please correct me if I'm wrong, but it
> > will not be handled during "normal" operation.
>
> This is something i also wondered. Maybe if the firmware in the
> MAC-PHY crashes, burns, and a watchdog reset it, could it assert
> RESETC? I think maybe a WARN_ON_ONCE() for RESETC in the interrupt
> handler would be useful, but otherwise ignore it. Probe can then poll
> during its reset.
>
> > > + regval = RESETC;
> > > + /* SPI host should write RESETC
> > > bit with one to
> > > + * clear the reset interrupt
> > > status.
> > > + */
> > > + ret = oa_tc6_perform_ctrl(tc6,
> > > OA_TC6_STS0,
> > > +
> > > ®val, 1, true,
> > > +
> > > false);
> >
> > Is this enough to have the IRQ_N deasserted (i.e. pulled HIGH)?
> >
> > The documentation states it clearly that one also needs to set SYNC
> > bit (BIT(15)) in the OA_CONFIG0 register (which would have the
> > 0x8006 value).
> >
> > Mine problem is that even after writing 0x40 to OA_STATUS0 and
> > 0x8006 to OA_CONFIG0 the IRQ_N is still LOW (it is pulled up via
> > 10K resistor).
> >
> > (I'm able to read those registers and those show expected values)
>
> What does STATUS0 and STATUS1 contain?
STATUS0 => 0x40, which is expected.
Then I do write 0x40 to STATUS0 -> bit6 (RESETC) is R/W1C
After reading the same register - I do receive 0x00 (it has been
cleared).
Then I write 0x8006 to OA_CONFIG0.
(Those two steps are regarded as "configuration" of LAN865x device in
the documentation)
In this patch set -> the OA_COFIG0 also has the 0x6 added to indicate
the SPI transfer chunk.
Dump of OA registers:
{0x11, 0x7c1b3, 0x5e5, 0x0, 0x8006, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x3000, 0x1fbf, 0x3ffe0003, 0x0, 0x0}
Status 0 (0x8) -> 0x0
Status 1 (0x9) -> 0x0
> That might be a dumb question,
> i've not read the details for interrupt handling yet, but maybe there
> is another interrupt pending? Or the interrupt mask needs writing?
All the interrupts on MASK{01} are masked.
Changing it to:
sts &= ~(OA_IMASK0_TXPEM | OA_IMASK0_TXBOEM | OA_IMASK0_TXBUEM |
OA_IMASK0_RXBOEM | OA_IMASK0_LOFEM | OA_IMASK0_HDREM
doesn't fix this problem.
>
> > Was it on purpose to not use the RST_N pin to perform GPIO based
> > reset?
> >
> > When I generate reset pulse (and keep it for low for > 5us) the
> > IRQ_N gets high. After some time it gets low (as expected). But
> > then it doesn't get high any more.
>
> Does the standard say RST_N is mandatory to be controlled by software?
> I could imagine RST_N is tied to the board global reset when the power
> supply is stable.
It can be GPIO controlled. However, it is not required. I've tied it to
3V3 and also left NC, but no change.
> Software reset is then used at probe time.
I've reconfigured the board to use only SW based reset (i.e. set bit0
in OA_RESET - 0x3).
>
> So this could be a board design decision. I can see this code getting
> extended in the future, an optional gpiod passed to the core for it to
> use.
I can omit the RST_N control. I'd just expect the IRQ_N to be high
after reset.
>
> > > msecs_to_jiffies(1));
> >
> > Please also clarify - does the LAN8651 require up to 1ms "settle
> > down" (after reset) time before it gets operational again?
>
> If this is not part of the standard, it really should be in the MAC
> driver, or configurable, since different devices might need different
> delays. But ideally, if the status bit says it is good to go, i would
> really expect it to be good to go. So this probably should be a
> LAN8651 quirk.
The documentation is silent about the "settle down time". The only
requirements is for RST_N assertion > 5us. However, when the IRQ_N goes
low, and the interrupt is served - it happens that I cannot read ID
from the chip via SPI.
>
> Andrew
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2023-09-13 13:26 UTC|newest]
Thread overview: 85+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-08 14:29 [RFC PATCH net-next 0/6] Add support for OPEN Alliance 10BASE-T1x MACPHY Serial Interface Parthiban Veerasooran
2023-09-08 14:29 ` [RFC PATCH net-next 1/6] net: ethernet: implement OPEN Alliance control transaction interface Parthiban Veerasooran
2023-09-09 13:33 ` Andrew Lunn
2023-09-12 13:03 ` Parthiban.Veerasooran
2023-09-13 1:32 ` Andrew Lunn
2023-09-21 12:27 ` Parthiban.Veerasooran
2023-09-21 19:16 ` Andrew Lunn
2023-09-22 4:31 ` Parthiban.Veerasooran
2023-09-13 1:36 ` Andrew Lunn
2023-09-19 11:40 ` Parthiban.Veerasooran
2023-09-13 2:11 ` Andrew Lunn
2023-09-19 11:38 ` Parthiban.Veerasooran
2023-09-19 15:13 ` Andrew Lunn
2023-09-20 12:40 ` Parthiban.Veerasooran
2023-09-20 13:37 ` Andrew Lunn
2023-09-21 9:15 ` Parthiban.Veerasooran
2023-09-13 2:16 ` Andrew Lunn
2023-09-19 11:13 ` Parthiban.Veerasooran
2023-09-19 12:58 ` Andrew Lunn
2023-09-21 12:36 ` Parthiban.Veerasooran
2023-09-21 19:19 ` Andrew Lunn
2023-09-22 4:39 ` Parthiban.Veerasooran
2023-09-26 12:54 ` Fwd: " Parthiban.Veerasooran
2023-09-08 14:29 ` [RFC PATCH net-next 2/6] net: ethernet: add mac-phy interrupt support with reset complete handling Parthiban Veerasooran
2023-09-09 13:39 ` Andrew Lunn
2023-09-12 12:44 ` Parthiban.Veerasooran
2023-09-13 2:19 ` Andrew Lunn
2023-09-19 11:04 ` Parthiban.Veerasooran
2023-09-11 12:51 ` Ziyang Xuan (William)
2023-09-12 12:10 ` Andrew Lunn
2023-09-12 12:28 ` Parthiban.Veerasooran
2023-09-13 2:39 ` Andrew Lunn
2023-09-19 13:07 ` Parthiban.Veerasooran
2023-09-19 13:21 ` Lukasz Majewski
2023-09-13 8:44 ` Lukasz Majewski
2023-09-13 12:36 ` Andrew Lunn
2023-09-13 13:26 ` Lukasz Majewski [this message]
2023-09-19 13:40 ` Parthiban.Veerasooran
2023-09-19 13:51 ` Lukasz Majewski
2023-09-08 14:29 ` [RFC PATCH net-next 3/6] net: ethernet: implement OA TC6 configuration function Parthiban Veerasooran
2023-09-14 0:46 ` Andrew Lunn
2023-09-19 10:57 ` Parthiban.Veerasooran
2023-09-19 12:54 ` Andrew Lunn
2023-09-20 12:42 ` Parthiban.Veerasooran
2023-09-08 14:29 ` [RFC PATCH net-next 4/6] net: ethernet: implement data transaction interface Parthiban Veerasooran
2023-09-10 17:58 ` Simon Horman
2023-09-12 13:47 ` Parthiban.Veerasooran
2023-09-11 12:59 ` Ziyang Xuan (William)
2023-09-12 10:32 ` Parthiban.Veerasooran
2023-09-14 1:18 ` Andrew Lunn
2023-09-18 10:02 ` Parthiban.Veerasooran
2023-09-18 13:01 ` Andrew Lunn
2023-09-19 10:12 ` Parthiban.Veerasooran
2023-09-08 14:29 ` [RFC PATCH net-next 5/6] microchip: lan865x: add driver support for Microchip's LAN865X MACPHY Parthiban Veerasooran
2023-09-10 17:44 ` Simon Horman
2023-09-12 10:53 ` Parthiban.Veerasooran
2023-09-11 13:17 ` Ziyang Xuan (William)
2023-09-12 11:41 ` Parthiban.Veerasooran
2023-09-14 1:51 ` Andrew Lunn
2023-09-19 9:18 ` Parthiban.Veerasooran
2023-09-19 12:50 ` Andrew Lunn
2023-09-20 12:53 ` Parthiban.Veerasooran
2023-09-14 1:55 ` Andrew Lunn
2023-09-18 11:23 ` Parthiban.Veerasooran
2023-09-15 13:01 ` David Wretman
2023-09-18 11:22 ` Parthiban.Veerasooran
2023-09-08 14:29 ` [RFC PATCH net-next 6/6] microchip: lan865x: add device-tree " Parthiban Veerasooran
2023-09-10 10:55 ` Krzysztof Kozlowski
2023-09-12 12:15 ` Parthiban.Veerasooran
2023-09-12 13:17 ` Krzysztof Kozlowski
2023-09-19 10:51 ` Parthiban.Veerasooran
2023-09-14 2:07 ` Andrew Lunn
2023-09-19 10:40 ` Parthiban.Veerasooran
2023-09-10 10:55 ` [RFC PATCH net-next 0/6] Add support for OPEN Alliance 10BASE-T1x MACPHY Serial Interface Krzysztof Kozlowski
2023-09-13 13:26 ` Parthiban.Veerasooran
2023-09-13 15:45 ` Krzysztof Kozlowski
2023-09-18 9:23 ` Parthiban.Veerasooran
2023-09-15 13:56 ` Alexander Dahl
2023-09-15 14:22 ` Andrew Lunn
2023-09-18 6:16 ` Parthiban.Veerasooran
2023-09-18 6:12 ` Parthiban.Veerasooran
2023-09-18 9:02 ` Fwd: " Parthiban.Veerasooran
2023-09-19 9:03 ` Parthiban.Veerasooran
2023-09-19 16:23 ` Jay Monkman
2023-09-19 18:09 ` Hennerich, Michael
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=20230913152625.73e32789@wsk \
--to=lukma@denx.de \
--cc=Nicolas.Ferre@microchip.com \
--cc=Parthiban.Veerasooran@microchip.com \
--cc=Thorsten.Kummermehr@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=Woojung.Huh@microchip.com \
--cc=andrew@lunn.ch \
--cc=casper.casan@gmail.com \
--cc=conor+dt@kernel.org \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@google.com \
--cc=horatiu.vultur@microchip.com \
--cc=horms@kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=kuba@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rdunlap@infradead.org \
--cc=robh+dt@kernel.org \
--cc=steen.hegelund@microchip.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).