Linux-PHY Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Siddharth Vadapalli <s-vadapalli@ti.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: <vkoul@kernel.org>, <neil.armstrong@linaro.org>,
	<robh@kernel.org>, <krzk+dt@kernel.org>, <conor+dt@kernel.org>,
	<sjakhade@cadence.com>, <rogerq@kernel.org>, <krzk@kernel.org>,
	<linux-phy@lists.infradead.org>, <linux-kernel@vger.kernel.org>,
	<devicetree@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>, <srk@ti.com>,
	<s-vadapalli@ti.com>
Subject: Re: [PATCH v2 2/2] phy: cadence-torrent: Add PCIe + XAUI multilink configuration for 100MHz refclk
Date: Mon, 5 Jan 2026 20:47:35 +0530	[thread overview]
Message-ID: <81639035-8fc5-4ee6-b0c5-4cfdf5b2425a@ti.com> (raw)
In-Reply-To: <7fd42221-d602-4ce4-9f7f-6754ed91e7aa@lunn.ch>

On 05/01/26 3:27 AM, Andrew Lunn wrote:
> On Sun, Jan 04, 2026 at 05:14:18PM +0530, Siddharth Vadapalli wrote:
>> From: Swapnil Jakhade <sjakhade@cadence.com>
>>
>> Add register sequences for PCIe + XAUI multilink configuration for
>> 100MHz reference clock.
>>
>> Signed-off-by: Swapnil Jakhade <sjakhade@cadence.com>
>> Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com>
>> ---
>>
>> v1 of this patch is at:
>> https://lore.kernel.org/r/20251224054905.763399-3-s-vadapalli@ti.com/
>> No changes since v1.
>>
>> Regards,
>> Siddharth.
>>
>>   drivers/phy/cadence/phy-cadence-torrent.c | 143 ++++++++++++++++++++--
>>   1 file changed, 136 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/phy/cadence/phy-cadence-torrent.c b/drivers/phy/cadence/phy-cadence-torrent.c
>> index 37fa4bad6bd7..f0d870886cca 100644
>> --- a/drivers/phy/cadence/phy-cadence-torrent.c
>> +++ b/drivers/phy/cadence/phy-cadence-torrent.c
>> @@ -300,6 +300,7 @@ enum cdns_torrent_phy_type {
>>   	TYPE_USB,
>>   	TYPE_USXGMII,
>>   	TYPE_PCIE_ML,
>> +	TYPE_XAUI,
>>   };
>>   
>>   enum cdns_torrent_ref_clk {
>> @@ -320,14 +321,14 @@ enum cdns_torrent_ssc_mode {
>>   /* Unique key id for vals table entry
>>    * REFCLK0_RATE | REFCLK1_RATE | LINK0_TYPE | LINK1_TYPE | SSC_TYPE
>>    */
>> -#define REFCLK0_SHIFT	12
>> -#define REFCLK0_MASK	GENMASK(14, 12)
>> -#define REFCLK1_SHIFT	9
>> -#define REFCLK1_MASK	GENMASK(11, 9)
>> -#define LINK0_SHIFT	6
>> -#define LINK0_MASK	GENMASK(8, 6)
>> +#define REFCLK0_SHIFT	15
>> +#define REFCLK0_MASK	GENMASK(18, 15)
>> +#define REFCLK1_SHIFT	11
>> +#define REFCLK1_MASK	GENMASK(14, 11)
>> +#define LINK0_SHIFT	7
>> +#define LINK0_MASK	GENMASK(10, 7)
> 
> Why do these change? It would be good to add an explanation to the
> commit message about this, because it is not obvious why these need to
> change.

The 'key id' is supposed to be a unique value defined as the following 
Bitwise OR:
REFCLK0_RATE | REFCLK1_RATE | LINK0_TYPE | LINK1_TYPE | SSC_TYPE

The 'LINK_TYPE' parameter corresponds to the protocol (PHY Type). In the 
phy-cadence-torrent.c driver, the following enum describes the supported 
'LINK_TYPE's:
enum cdns_torrent_phy_type {
	TYPE_NONE,
	TYPE_DP,
	TYPE_PCIE,
	TYPE_SGMII,
	TYPE_QSGMII,
	TYPE_USB,
	TYPE_USXGMII,
	TYPE_PCIE_ML,
};
The last entry which is TYPE_PCIE_ML has the value of '7' (TYPE_NONE is 
'0'). Therefore, 'LINK_MASK' happened to be a 3-bit mask:
	#define LINK0_MASK	GENMASK(8, 6)
	#define LINK1_MASK	GENMASK(5, 3)
With the addition of TYPE_XAUI in the current patch, 'LINK_MASK' has to 
be extended to a 4-bit mask.

The 'REFCLK_RATE' parameter corresponds to the reference clock rates 
defined which are again described by the following enum in the driver:
enum cdns_torrent_ref_clk {
	CLK_19_2_MHZ,
	CLK_25_MHZ,
	CLK_100_MHZ,
	CLK_156_25_MHZ,
	CLK_ANY,
};
The last entry which is CLK_ANY has the value of '4' (CLK_19_2_MHZ is 
'0'). Although the existing macros defined as:
	#define REFCLK0_MASK	GENMASK(14, 12)
	#define REFCLK1_MASK	GENMASK(11, 9)
are 3-bit masks and can fit values until '7', for the sake of 
future-proofing the driver (the SERDES Hardware supports more reference 
clocks which are not yet enabled in the driver), 'REFCLK_MASK' has been 
extended to a 4-bit mask as well.

The shifts associated with the masks have been updated accordingly.

I shall include a summary of the above in the commit message of the v3 
series.

Thank you for reviewing the patch and providing feedback.

Regards,
Siddharth.

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

      reply	other threads:[~2026-01-05 15:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-04 11:44 [PATCH v2 0/2] Cadence: Torrent: Enable PCIe + XAUI multilink configuration Siddharth Vadapalli
2026-01-04 11:44 ` [PATCH v2 1/2] dt-bindings: phy: Add PHY_TYPE_XAUI definition Siddharth Vadapalli
2026-01-06 18:29   ` Rob Herring (Arm)
2026-01-04 11:44 ` [PATCH v2 2/2] phy: cadence-torrent: Add PCIe + XAUI multilink configuration for 100MHz refclk Siddharth Vadapalli
2026-01-04 21:57   ` Andrew Lunn
2026-01-05 15:17     ` Siddharth Vadapalli [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=81639035-8fc5-4ee6-b0c5-4cfdf5b2425a@ti.com \
    --to=s-vadapalli@ti.com \
    --cc=andrew@lunn.ch \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=krzk@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=neil.armstrong@linaro.org \
    --cc=robh@kernel.org \
    --cc=rogerq@kernel.org \
    --cc=sjakhade@cadence.com \
    --cc=srk@ti.com \
    --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