From: Sean Anderson <sean.anderson@seco.com>
To: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
"David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Madalin Bucur <madalin.bucur@nxp.com>,
netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Paolo Abeni <pabeni@redhat.com>,
Russell King <linux@armlinux.org.uk>,
Eric Dumazet <edumazet@google.com>,
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, linux-phy@lists.infradead.org,
Ioana Ciornei <ioana.ciornei@nxp.com>
Subject: Re: [PATCH net-next 01/28] dt-bindings: phy: Add QorIQ SerDes binding
Date: Mon, 20 Jun 2022 14:51:00 -0400 [thread overview]
Message-ID: <5d724f49-71c4-96ad-b756-06b5683fa112@seco.com> (raw)
In-Reply-To: <e922714b-29c7-0f41-9e5c-9a0aef9fb5de@linaro.org>
On 6/20/22 2:21 PM, Krzysztof Kozlowski wrote:
>>>> - samsung_usb2_phy_config in drivers/phy/samsung/
>>>
>>> This one is a good example - where do you see there compatibles with
>>> arbitrary numbers attached?
>>
>> samsung_usb2_phy_of_match in drivers/phy/samsung/phy-samsung-usb2.c
>>
>> There is a different compatible for each SoC variant. Each compatible selects a struct
>> containing
>>
>> - A list of phys, each with custom power on and off functions
>> - A function which converts a rate to an arbitrary value to program into a register
>>
>> This is further documented in Documentation/driver-api/phy/samsung-usb2.rst
>
> Exactly, please follow this approach. Compatible is per different
> device, e.g. different SoC variant. Of course you could have different
> devices on same SoC, but "1" and "2" are not different devices.
(in this case they are)
>>
>>>> - qmp_phy_init_tbl in drivers/phy/qualcomm/phy-qcom-qmp.c
>>>>
>>>> All of these drivers (and there are more)
>>>>
>>>> - Use a driver-internal struct to encode information specific to different device models.
>>>> - Select that struct based on the compatible
>>>
>>> Driver implementation. You can do it in many different ways. Does not
>>> matter for the bindings.
>>
>> And because this both describes the hardware and is convenient to the implementation,
>> I have chosen this way.
>>
>>>>
>>>> The other thing is that while the LS1046A SerDes are fairly generic, other SerDes of this
>>>> type have particular restructions on the clocks. E.g. on some SoCs, certain protocols
>>>> cannot be used together (even if they would otherwise be legal), and some protocols must
>>>> use particular PLLs (whereas in general there is no such restriction). There are also
>>>> some register fields which are required to program on some SoCs, and which are reserved
>>>> on others.
>>>
>>> Just to be clear, because you are quite unspecific here ("some
>>> protocols") - we talk about the same protocol programmed on two of these
>>> serdes (serdes-1 and serdes-2 how you call it). Does it use different
>>> registers?
>>
>> Yes.
>>
>>> Are some registers - for the same protocol - reserved in one version?
>>
>> Yes.
>>
>> For example, I excerpt part of the documentation for PCCR2 on the T4240:
>>
>>> XFIa Configuration:
>>> XFIA_CFG Default value set by RCW configuration.
>>> This field must be 0 for SerDes 3 & 4
>>> All settings not shown are reserved
>>>
>>> 00 Disabled
>>> 01 x1 on Lane 3 to FM2 MAC 9
>>
>> And here is part of the documentation for PCCR2 on the LS1046A:
>>
>>> SATAa Configuration
>>> All others reserved
>>> NOTE: This field is not supported in every instance. The following table includes only
>>> supported registers.
>>> Field supported in Field not supported in
>>> SerDes1_PCCR2 —
>>> — SerDes2_PCCR2
>>>
>>> 000b - Disabled
>>> 001b - x1 on Lane 3 (SerDes #2 only)
>>
>> And here is part of the documentation for PCCRB on the LS1046A:
>>
>>> XFIa Configuration
>>> All others reserved Default value set by RCW configuration.
>>>
>>> 000b - Disabled
>>> 010b - x1 on Lane 1 to XGMIIa (Serdes #1 only)
>> You may notice that
>>
>> - For some SerDes on the same SoC, these fields are reserved
>
> That all sounds like quite different devices, which indeed usually is
> described with different compatibles. Still "xxx-1" and "xxx-2" are not
> valid compatibles. You need to come with some more reasonable name
> describing them. Maybe the block has revision or different model/vendor.
There is none AFAIK. Maybe someone from NXP can comment (since there are many
undocumented registers).
>> - Between different SoCs, different protocols may be configured in different registers
>> - The same registers may be used for different protocols in different SoCs (though
>> generally there are several general layouts)
>
> Different SoCs give you different compatibles, so problem is solved and
> that's not exactly argument for this case.
>
>> - Fields have particular values which must be programmed
>>
>> In addition, the documentation also says
>>
>>> Reserved registers and fields must be preserved on writes.
>>
>> All of these combined issues make it so that we need detailed, serdes-specific
>> configuration. The easiest way to store this configuration is in the driver. This
>> is consistent with *many* existing phy implementations. I would like to write a
>> standard phy driver, not one twisted by unusual device tree requirements.
>
> Sure.
>
>>
>>>>
>>>> There is, frankly, a large amount of variation between devices as implemented on different
>>>> SoCs.
>>>
>>> This I don't get. You mean different SoCs have entirely different
>>> Serdes? Sure, no problem. We talk here only about this SoC, this
>>> serdes-1 and serdes-2.
>>>
>>>> Especially because (AIUI) drivers must remain compatible with old devicetrees, I
>>>> think using a specific compatible string is especially appropriate here.
>>>
>>> This argument does not make any sense in case of new bindings and new
>>> drivers, unless you build on top of existing implementation. Anyway no
>>> one asks you to break existing bindings...
>>
>> When there is a bug in the bindings how do you fix it? If I were to follow your suggested method, it would be difficult to determine the particular devices
>>
>>>> It will give us
>>>> the ability to correct any implementation quirks as they are discovered (and I anticipate
>>>> that there will be) rather than having to determine everything up front.
>>>
>>> All the quirks can be also chosen by respective properties.
>>
>> Quirks are *exactly* the sort of implementation-specific details that you were opposed to above.
>>
>>> Anyway, "serdes-1" and "serdes-2" are not correct compatibles,
>>
>> The compatibles suggested were "fsl,ls1046-serdes-1" and -2. As noted above, these are separate
>> devices which, while having many similarities, have different register layouts and protocol
>> support. They are *not* 100% compatible with each other. Would you require that clock drivers
>> for different SoCs use the same compatibles just because they had the same registers, even though
>> the clocks themselves had different functions and hierarchy?
>
> You miss the point. Clock controllers on same SoC have different names
> used in compatibles. We do not describe them as "vendor,aa-clk-1" and
> "vendor,aa-clk-2".
>
> Come with proper naming and entire discussion might be not valid
> (although with not perfect naming Rob might come with questions). I
> cannot propose the name because I don't know these hardware blocks and I
> do not have access to datasheet.
>
> Other way, if any reasonable naming is not possible, could be also to
> describe the meaning of "-1" suffix, e.g. that it does not mean some
> index but a variant from specification.
The documentation refers to these devices as "SerDes1", "SerDes2", etc.
Wold you prefer something like
serdes0: phy@1ea0000 {
compatible = "fsl,ls1046a-serdes";
variant = <0>;
};
?
--Sean
next prev parent reply other threads:[~2022-06-20 18:51 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 [this message]
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
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=5d724f49-71c4-96ad-b756-06b5683fa112@seco.com \
--to=sean.anderson@seco.com \
--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=krzysztof.kozlowski@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®