From: Sean Anderson <sean.anderson@seco.com>
To: Ioana Ciornei <ioana.ciornei@nxp.com>,
"David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Madalin Bucur <madalin.bucur@nxp.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
Paolo Abeni <pabeni@redhat.com>,
Russell King <linux@armlinux.org.uk>,
Eric Dumazet <edumazet@google.com>,
Jonathan Corbet <corbet@lwn.net>,
Kishon Vijay Abraham I <kishon@ti.com>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Rob Herring <robh+dt@kernel.org>, Vinod Koul <vkoul@kernel.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"linux-phy@lists.infradead.org" <linux-phy@lists.infradead.org>
Subject: Re: [PATCH net-next 03/28] phy: fsl: Add QorIQ SerDes driver
Date: Sat, 18 Jun 2022 11:52:48 -0400 [thread overview]
Message-ID: <df411ea9-b12e-09f2-6f96-0fb4a023cb7d@seco.com> (raw)
In-Reply-To: <GV1PR04MB9055F41AD598F85648B54EE2E0AE9@GV1PR04MB9055.eurprd04.prod.outlook.com>
Hi Ioana,
On 6/18/22 8:39 AM, Ioana Ciornei wrote:
>>> Subject: [PATCH net-next 03/28] phy: fsl: Add QorIQ SerDes driver
>>>
>
> Sorry for the previous HTML formatted email...
>
>>
>> Hi Sean,
>>
>> I am very much interested in giving this driver a go on other SoCs as well
>> but at the moment I am in vacation until mid next week.
Please let me know your results. I have documented how to add support for
additional SoCs, so hopefully it should be fairly straightforward.
>>> This adds support for the "SerDes" devices found on various NXP QorIQ SoCs.
>>> There may be up to four SerDes devices on each SoC, each supporting up to
>>> eight lanes. Protocol support for each SerDes is highly heterogeneous, with
>>> each SoC typically having a totally different selection of supported
>>> protocols for each lane. Additionally, the SerDes devices on each SoC also
>>> have differing support. One SerDes will typically support Ethernet on most
>>> lanes, while the other will typically support PCIe on most lanes.
>>>
>>> There is wide hardware support for this SerDes. I have not done extensive
>>> digging, but it seems to be used on almost every QorIQ device, including
>>> the AMP and Layerscape series. Because each SoC typically has specific
>>> instructions and exceptions for its SerDes, I have limited the initial
>>> scope of this module to just the LS1046A. Additionally, I have only added
>>> support for Ethernet protocols. There is not a great need for dynamic
>>> reconfiguration for other protocols (SATA and PCIe handle rate changes in
>>> hardware), so support for them may never be added.>
>>> Nevertheless, I have tried to provide an obvious path for adding support
>>> for other SoCs as well as other protocols. SATA just needs support for
>>> configuring LNmSSCR0. PCIe may need to configure the equalization
>>> registers. It also uses multiple lanes. I have tried to write the driver
>>> with multi-lane support in mind, so there should not need to be any large
>>> changes. Although there are 6 protocols supported, I have only tested SGMII
>>> and XFI. The rest have been implemented as described in the datasheet.
>>>
>>> The PLLs are modeled as clocks proper. This lets us take advantage of the
>>> existing clock infrastructure. I have not given the same treatment to the
>>> lane "clocks" (dividers) because they need to be programmed in-concert with
>>> the rest of the lane settings. One tricky thing is that the VCO (pll) rate
>>> exceeds 2^32 (maxing out at around 5GHz). This will be a problem on 32-bit
>>> platforms, since clock rates are stored as unsigned longs. To work around
>>> this, the pll clock rate is generally treated in units of kHz.>
>>> The PLLs are configured rather interestingly. Instead of the usual direct
>>> programming of the appropriate divisors, the input and output clock rates
>>> are selected directly. Generally, the only restriction is that the input
>>> and output must be integer multiples of each other. This suggests some kind
>>> of internal look-up table. The datasheets generally list out the supported
>>> combinations explicitly, and not all input/output combinations are
>>> documented. I'm not sure if this is due to lack of support, or due to an
>>> oversight. If this becomes an issue, then some combinations can be
>>> blacklisted (or whitelisted). This may also be necessary for other SoCs
>>> which have more stringent clock requirements.
>>
>>
>> I didn't get a change to go through the driver like I would like, but are you
>> changing the PLL's rate at runtime?
Yes.
>> Do you take into consideration that a PLL might still be used by a PCIe or SATA
>> lane (which is not described in the DTS) and deny its rate reconfiguration
>> if this happens?
Yes.
When the device is probed, we go through the PCCRs and reserve any lane which is in
use for a protocol we don't support (PCIe, SATA). We also get both PLL's rates
exclusively and mark them as enabled.
>> I am asking this because when I added support for the Lynx 28G SerDes block what
>> I did in order to support rate change depending of the plugged SFP module was
>> just to change the PLL used by the lane, not the PLL rate itself.
>> This is because I was afraid of causing more harm then needed for all the
>> non-Ethernet lanes.
Yes. Since There is not much need for dynamic reconfiguration for other protocols,
I suspect that non-ethernet support will not be added soon (or perhaps ever).
>>>
>>> The general API call list for this PHY is documented under the driver-api
>>> docs. I think this is rather standard, except that most driverts configure
>>> the mode (protocol) at xlate-time. Unlike some other phys where e.g. PCIe
>>> x4 will use 4 separate phys all configured for PCIe, this driver uses one
>>> phy configured to use 4 lanes. This is because while the individual lanes
>>> may be configured individually, the protocol selection acts on all lanes at
>>> once. Additionally, the order which lanes should be configured in is
>>> specified by the datasheet. To coordinate this, lanes are reserved in
>>> phy_init, and released in phy_exit.
>>>
>>> When getting a phy, if a phy already exists for those lanes, it is reused.
>>> This is to make things like QSGMII work. Four MACs will all want to ensure
>>> that the lane is configured properly, and we need to ensure they can all
>>> call phy_init, etc. There is refcounting for phy_init and phy_power_on, so
>>> the phy will only be powered on once. However, there is no refcounting for
>>> phy_set_mode. A "rogue" MAC could set the mode to something non-QSGMII and
>>> break the other MACs. Perhaps there is an opportunity for future
>>> enhancement here.
>>>
>>> This driver was written with reference to the LS1046A reference manual.
>>> However, it was informed by reference manuals for all processors with
>>> MEMACs, especially the T4240 (which appears to have a "maxed-out"
>>> configuration).
>>>
>>> Signed-off-by: Sean Anderson <sean.anderson@seco.com>
>>> ---
>>> This appears to be the same underlying hardware as the Lynx 28G phy
>>> added in 8f73b37cf3fb ("phy: add support for the Layerscape SerDes
>>> 28G").
>>
>> The SerDes block used on L1046A (and a lot of other SoCs) is not the same
>> one as the Lynx 28G that I submitted. The Lynx 28G block is only included
>> on the LX2160A SoC and its variants.
OK. I looked over it quickly and it seemed to share many of the same registers.
>> The SerDes block that you are adding a driver for is the Lynx 10G SerDes,
>> which is why I would suggest renaming it to phy-fsl-lynx-10g.c.
Ah, thanks. Is this documented anywhere?
--Sean
next prev parent reply other threads:[~2022-06-18 15:53 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-17 20:32 [PATCH net-next 00/28] [RFC] net: dpaa: Convert to phylink Sean Anderson
2022-06-17 20:32 ` [PATCH net-next 01/28] dt-bindings: phy: Add QorIQ SerDes binding Sean Anderson
2022-06-17 23:27 ` Rob Herring
2022-06-18 1:15 ` Krzysztof Kozlowski
2022-06-18 3:38 ` Sean Anderson
2022-06-19 11:24 ` Krzysztof Kozlowski
2022-06-19 15:53 ` Sean Anderson
2022-06-20 10:54 ` Krzysztof Kozlowski
2022-06-20 17:19 ` Sean Anderson
2022-06-20 18:21 ` Krzysztof Kozlowski
2022-06-20 18:51 ` Sean Anderson
2022-06-21 7:12 ` Krzysztof Kozlowski
2022-06-17 20:32 ` [PATCH net-next 02/28] dt-bindings: net: fman: Add additional interface properties Sean Anderson
2022-06-18 1:16 ` Krzysztof Kozlowski
2022-06-18 15:55 ` Sean Anderson
2022-06-19 10:33 ` Krzysztof Kozlowski
2022-06-27 23:05 ` Rob Herring
2022-06-17 20:32 ` [PATCH net-next 03/28] phy: fsl: Add QorIQ SerDes driver Sean Anderson
2022-06-18 3:02 ` kernel test robot
[not found] ` <GV1PR04MB905598703F5E9A0989662EFDE0AE9@GV1PR04MB9055.eurprd04.prod.outlook.com>
2022-06-18 12:39 ` Ioana Ciornei
2022-06-18 15:52 ` Sean Anderson [this message]
2022-06-20 18:53 ` Sean Anderson
2022-06-17 20:32 ` [PATCH net-next 04/28] net: fman: Convert to SPDX identifiers Sean Anderson
2022-06-17 20:32 ` [PATCH net-next 05/28] net: fman: Don't pass comm_mode to enable/disable Sean Anderson
2022-06-17 20:32 ` [PATCH net-next 06/28] net: fman: Store en/disable in mac_device instead of mac_priv_s Sean Anderson
2022-06-17 20:32 ` [PATCH net-next 07/28] net: fman: dtsec: Always gracefully stop/start Sean Anderson
2022-06-17 20:32 ` [PATCH net-next 08/28] net: fman: Get PCS node in per-mac init Sean Anderson
2022-06-17 20:32 ` [PATCH net-next 09/28] net: fman: Store initialization function in match data Sean Anderson
2022-06-17 20:32 ` [PATCH net-next 10/28] net: fman: Move struct dev to mac_device Sean Anderson
2022-06-18 3:57 ` kernel test robot
2022-06-17 20:32 ` [PATCH net-next 11/28] net: fman: Configure fixed link in memac_initialization Sean Anderson
2022-06-17 20:32 ` [PATCH net-next 12/28] net: fman: Export/rename some common functions Sean Anderson
2022-06-17 20:32 ` [PATCH net-next 13/28] net: fman: memac: Use params instead of priv for max_speed Sean Anderson
2022-06-17 20:32 ` [PATCH net-next 14/28] net: fman: Move initialization to mac-specific files Sean Anderson
2022-06-17 20:32 ` [PATCH net-next 15/28] net: fman: Mark mac methods static Sean Anderson
2022-06-17 20:33 ` [PATCH net-next 16/28] net: fman: Inline several functions into initialization Sean Anderson
2022-06-17 20:33 ` [PATCH net-next 17/28] net: fman: Remove internal_phy_node from params Sean Anderson
2022-06-17 20:33 ` [PATCH net-next 18/28] net: fman: Map the base address once Sean Anderson
2022-06-18 2:01 ` kernel test robot
2022-06-17 20:33 ` [PATCH net-next 19/28] net: fman: Pass params directly to mac init Sean Anderson
2022-06-17 20:33 ` [PATCH net-next 20/28] net: fman: Use mac_dev for some params Sean Anderson
2022-06-17 20:33 ` [PATCH net-next 21/28] net: fman: Clean up error handling Sean Anderson
2022-06-17 20:33 ` [PATCH net-next 22/28] net: fman: memac: Add serdes support Sean Anderson
2022-06-17 20:33 ` [PATCH net-next 23/28] net: fman: memac: Use lynx pcs driver Sean Anderson
2022-06-17 20:33 ` [PATCH net-next 24/28] net: dpaa: Use mac_dev variable in dpaa_netdev_init Sean Anderson
2022-06-17 20:33 ` [PATCH net-next 25/28] [RFC] net: dpaa: Convert to phylink Sean Anderson
2022-06-17 22:01 ` Russell King (Oracle)
2022-06-18 0:45 ` Sean Anderson
2022-06-18 8:22 ` Russell King (Oracle)
2022-06-18 15:58 ` Sean Anderson
2022-06-23 22:39 ` Sean Anderson
2022-06-24 0:24 ` Russell King (Oracle)
2022-06-27 15:17 ` Sean Anderson
2022-06-17 20:33 ` [PATCH net-next 26/28] arm64: dts: ls1046ardb: Add serdes bindings Sean Anderson
2022-06-17 20:33 ` [PATCH net-next 27/28] arm64: dts: ls1046a: Add SerDes bindings Sean Anderson
2022-06-17 20:33 ` [PATCH net-next 28/28] arm64: dts: ls1046a: Specify which MACs support RGMII Sean Anderson
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=df411ea9-b12e-09f2-6f96-0fb4a023cb7d@seco.com \
--to=sean.anderson@seco.com \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@google.com \
--cc=ioana.ciornei@nxp.com \
--cc=kishon@ti.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=linux@armlinux.org.uk \
--cc=madalin.bucur@nxp.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=robh+dt@kernel.org \
--cc=vkoul@kernel.org \
/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
all inboxes | Powered by JetHome®