Skip to contentSkip to conversation

phy: freescale: imx8m-pcie: Handle IMX8_PCIE_REFCLK_PAD_UNUSED

PATCH Superseded Marek Vasut 3 participants 8 messages Mar 12, 2022 – Apr 13, 2022

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 phy: freescale: imx8m-pcie: Handle IMX8_PCIE_REFCLK_PAD_UNUSED

The 'fsl,refclk-pad-mode' DT property used to select clock source for PCIe PHY can have either of three values, IMX8_PCIE_REFCLK_PAD_INPUT, IMX8_PCIE_REFCLK_PAD_OUTPUT, IMX8_PCIE_REFCLK_PAD_UNUSED. The first two options are handled correctly by the driver, the last one is not, this patch implements support for the last option.

The IMX8_PCIE_REFCLK_PAD_INPUT means PCIE_RESREF is PHY clock input, the IMX8_PCIE_REFCLK_PAD_OUTPUT means PHY clock are sourced from SoC internal PLL and output to PCIE_RESREF external IO pin. The last IMX8_PCIE_REFCLK_PAD_UNUSED is a combination of previous two, PHY clock are sourced from SoC internal PLL and not output anywhere.

Cc Fabio Estevam <[email protected]>
Cc Kishon Vijay Abraham I <[email protected]>
Cc Marcel Ziswiler <[email protected]>
Cc NXP Linux Team <[email protected]>
Cc Peng Fan <[email protected]>
Cc Richard Zhu <[email protected]>
Cc Shawn Guo <[email protected]>
Cc Vinod Koul <[email protected]>

To: [email protected]

---
 drivers/phy/freescale/phy-fsl-imx8m-pcie.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/phy/freescale/phy-fsl-imx8m-pcie.c +8 -2
index e56954063108c..7d8e6991279f4 100644
@@ -156,15 +156,21 @@ static int imx8_pcie_phy_init(struct phy *phy)
 		break;
 	}
 
-	if (pad_mode == IMX8_PCIE_REFCLK_PAD_INPUT) {
+	if (pad_mode == IMX8_PCIE_REFCLK_PAD_INPUT ||
+	    pad_mode == IMX8_PCIE_REFCLK_PAD_UNUSED) {
 		/* Configure the pad as input */
 		val = readl(imx8_phy->base + IMX8MM_PCIE_PHY_CMN_REG061);
 		writel(val & ~ANA_PLL_CLK_OUT_TO_EXT_IO_EN,
 		       imx8_phy->base + IMX8MM_PCIE_PHY_CMN_REG061);
-	} else if (pad_mode == IMX8_PCIE_REFCLK_PAD_OUTPUT) {
+	} else {
 		/* Configure the PHY to output the refclock via pad */
 		writel(ANA_PLL_CLK_OUT_TO_EXT_IO_EN,
 		       imx8_phy->base + IMX8MM_PCIE_PHY_CMN_REG061);
+	}
+
+	if (pad_mode == IMX8_PCIE_REFCLK_PAD_OUTPUT ||
+	    pad_mode == IMX8_PCIE_REFCLK_PAD_UNUSED) {
+		/* Source clock from SoC internal PLL */
 		writel(ANA_PLL_CLK_OUT_TO_EXT_IO_SEL,
 		       imx8_phy->base + IMX8MM_PCIE_PHY_CMN_REG062);
 		writel(AUX_PLL_REFCLK_SEL_SYS_PLL,
Signature · 7 lines
2.34.1


-- 
linux-phy mailing list
[email protected]
https://lists.infradead.org/mailman/listinfo/linux-phy
#1 lore raw
Quoted 19 lines

-----Original Message-----
From: Marek Vasut <[email protected]>
Sent: 2022年3月12日 9:38
To: [email protected]
Cc: Marek Vasut <[email protected]>; Fabio Estevam <[email protected]>; Kishon Vijay Abraham I <[email protected]>; Marcel Ziswiler <[email protected]>; dl-linux-imx <[email protected]>; Peng Fan <[email protected]>; Hongxing Zhu <[email protected]>; Shawn Guo <[email protected]>; Vinod Koul <[email protected]>; [email protected]
Subject: [PATCH] phy: freescale: imx8m-pcie: Handle IMX8_PCIE_REFCLK_PAD_UNUSED

The 'fsl,refclk-pad-mode' DT property used to select clock source for PCIe PHY can have either of three values, IMX8_PCIE_REFCLK_PAD_INPUT, IMX8_PCIE_REFCLK_PAD_OUTPUT, IMX8_PCIE_REFCLK_PAD_UNUSED. The first two options are handled correctly by the driver, the last one is not, this patch implements support for the last option.

Quoted 7 lines

The IMX8_PCIE_REFCLK_PAD_INPUT means PCIE_RESREF is PHY clock input, the IMX8_PCIE_REFCLK_PAD_OUTPUT means PHY clock are sourced from SoC internal PLL and output to PCIE_RESREF external IO pin. The last IMX8_PCIE_REFCLK_PAD_UNUSED is a combination of previous two, PHY clock are sourced from SoC internal PLL and not output anywhere.

Hi Marek:
Thanks for your patch.
I assume that you had tested this IMX8_PCIE_REFCLK_PAD_UNUSED option. The CLK_N/P pads are not connected on the tested board, right? BTW, it's better to add the Fixes tag into the commit log.

Best Regards
Richard Zhu

Quoted 45 lines

Cc: Fabio Estevam <[email protected]>
Cc: Kishon Vijay Abraham I <[email protected]>
Cc: Marcel Ziswiler <[email protected]>
Cc: NXP Linux Team <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Richard Zhu <[email protected]>
Cc: Shawn Guo <[email protected]>
Cc: Vinod Koul <[email protected]>
Cc: [email protected]
To: [email protected]

---
 drivers/phy/freescale/phy-fsl-imx8m-pcie.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/phy/freescale/phy-fsl-imx8m-pcie.c +8 -3
index e56954063108c..7d8e6991279f4 100644
@@ -156,15 +156,21 @@ static int imx8_pcie_phy_init(struct phy *phy)
 		break;
 	}
 
-	if (pad_mode == IMX8_PCIE_REFCLK_PAD_INPUT) {
+	if (pad_mode == IMX8_PCIE_REFCLK_PAD_INPUT ||
+	    pad_mode == IMX8_PCIE_REFCLK_PAD_UNUSED) {
 		/* Configure the pad as input */
 		val = readl(imx8_phy->base + IMX8MM_PCIE_PHY_CMN_REG061);
 		writel(val & ~ANA_PLL_CLK_OUT_TO_EXT_IO_EN,
 		       imx8_phy->base + IMX8MM_PCIE_PHY_CMN_REG061);
-	} else if (pad_mode == IMX8_PCIE_REFCLK_PAD_OUTPUT) {
+	} else {
 		/* Configure the PHY to output the refclock via pad */
 		writel(ANA_PLL_CLK_OUT_TO_EXT_IO_EN,
 		       imx8_phy->base + IMX8MM_PCIE_PHY_CMN_REG061);
+	}
+
+	if (pad_mode == IMX8_PCIE_REFCLK_PAD_OUTPUT ||
+	    pad_mode == IMX8_PCIE_REFCLK_PAD_UNUSED) {
+		/* Source clock from SoC internal PLL */
 		writel(ANA_PLL_CLK_OUT_TO_EXT_IO_SEL,
 		       imx8_phy->base + IMX8MM_PCIE_PHY_CMN_REG062);
 		writel(AUX_PLL_REFCLK_SEL_SYS_PLL,
--

2.34.1

Signature · 3 lines
linux-phy mailing list
[email protected]
https://lists.infradead.org/mailman/listinfo/linux-phy
#2 lore raw
Quoted 25 lines · Hongxing Zhu
Quoted 25 lines

-----Original Message-----
From: Marek Vasut <[email protected]>
Sent: 2022年3月12日 9:38
To: [email protected]
Cc: Marek Vasut <[email protected]>; Fabio Estevam <[email protected]>; Kishon Vijay Abraham I <[email protected]>; Marcel Ziswiler <[email protected]>; dl-linux-imx <[email protected]>; Peng Fan <[email protected]>; Hongxing Zhu <[email protected]>; Shawn Guo <[email protected]>; Vinod Koul <[email protected]>; [email protected]
Subject: [PATCH] phy: freescale: imx8m-pcie: Handle IMX8_PCIE_REFCLK_PAD_UNUSED

The 'fsl,refclk-pad-mode' DT property used to select clock source for PCIe PHY can have either of three values, IMX8_PCIE_REFCLK_PAD_INPUT, IMX8_PCIE_REFCLK_PAD_OUTPUT, IMX8_PCIE_REFCLK_PAD_UNUSED. The first two options are handled correctly by the driver, the last one is not, this patch implements support for the last option.

The IMX8_PCIE_REFCLK_PAD_INPUT means PCIE_RESREF is PHY clock input, the IMX8_PCIE_REFCLK_PAD_OUTPUT means PHY clock are sourced from SoC internal PLL and output to PCIE_RESREF external IO pin. The last IMX8_PCIE_REFCLK_PAD_UNUSED is a combination of previous two, PHY clock are sourced from SoC internal PLL and not output anywhere.

Quoted 4 lines
Quoted 1 line

Hi Marek:
Thanks for your patch.
I assume that you had tested this IMX8_PCIE_REFCLK_PAD_UNUSED option.

Yes

Quoted 1 line

The CLK_N/P pads are not connected on the tested board, right?

They are connected from MX8MP SoC to MiniPCIe slot.
There is no external clock source like on the EVK, the MX8MP internal PLL is the clock source.

Quoted 1 line

BTW, it's better to add the Fixes tag into the commit log.

Do you think this should be considered a bugfix ?

Signature · 3 lines
linux-phy mailing list
[email protected]
https://lists.infradead.org/mailman/listinfo/linux-phy
Reviewed-by
#3 lore raw
Quoted 45 lines

-----Original Message-----
From: Marek Vasut <[email protected]>
Sent: 2022年3月14日 10:51
To: Hongxing Zhu <[email protected]>; [email protected]
Cc: Fabio Estevam <[email protected]>; Kishon Vijay Abraham I <[email protected]>; Marcel Ziswiler <[email protected]>; dl-linux-imx <[email protected]>; Peng Fan <[email protected]>; Shawn Guo <[email protected]>; Vinod Koul <[email protected]>; [email protected]
Subject: Re: [PATCH] phy: freescale: imx8m-pcie: Handle IMX8_PCIE_REFCLK_PAD_UNUSED

Quoted 13 lines · Hongxing Zhu
Quoted 13 lines

-----Original Message-----
From: Marek Vasut <[email protected]>
Sent: 2022年3月12日 9:38
To: [email protected]
Cc: Marek Vasut <[email protected]>; Fabio Estevam <[email protected]>; Kishon Vijay Abraham I <[email protected]>; Marcel Ziswiler <[email protected]>; dl-linux-imx <[email protected]>; Peng Fan <[email protected]>; Hongxing Zhu <[email protected]>; Shawn Guo <[email protected]>; Vinod Koul <[email protected]>; [email protected]
Subject: [PATCH] phy: freescale: imx8m-pcie: Handle IMX8_PCIE_REFCLK_PAD_UNUSED

Quoted 3 lines
Quoted 3 lines

The 'fsl,refclk-pad-mode' DT property used to select clock source for PCIe PHY can have either of three values, IMX8_PCIE_REFCLK_PAD_INPUT, IMX8_PCIE_REFCLK_PAD_OUTPUT, IMX8_PCIE_REFCLK_PAD_UNUSED. The

first

Quoted 5 lines
Quoted 5 lines

two options are handled correctly by the driver, the last one is not, this patch implements support for the last option.

The IMX8_PCIE_REFCLK_PAD_INPUT means PCIE_RESREF is PHY clock input, the IMX8_PCIE_REFCLK_PAD_OUTPUT means PHY clock are sourced from

SoC

Quoted 8 lines
Quoted 5 lines

internal PLL and output to PCIE_RESREF external IO pin. The last IMX8_PCIE_REFCLK_PAD_UNUSED is a combination of previous two, PHY clock are sourced from SoC internal PLL and not output anywhere.

Hi Marek:
Thanks for your patch.
I assume that you had tested this IMX8_PCIE_REFCLK_PAD_UNUSED option.

Quoted 8 lines

Yes

Quoted 1 line

The CLK_N/P pads are not connected on the tested board, right?

They are connected from MX8MP SoC to MiniPCIe slot.
There is no external clock source like on the EVK, the MX8MP internal PLL is the clock source.

Got that, thanks.

Quoted 3 lines
Quoted 1 line

BTW, it's better to add the Fixes tag into the commit log.

Do you think this should be considered a bugfix ?

Emm...
It's reasonable to consider it as new added. Okay, I'm fine with it. Thanks again for your patch.

Best Regards
Richard Zhu

Signature · 3 lines
linux-phy mailing list
[email protected]
https://lists.infradead.org/mailman/listinfo/linux-phy
#4 lore raw

On 3/14/22 04:29, Hongxing Zhu wrote:

[...]

Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Hi Marek:
Thanks for your patch.
I assume that you had tested this IMX8_PCIE_REFCLK_PAD_UNUSED option.

Yes

Quoted 7 lines
Quoted 6 lines
Quoted 1 line

The CLK_N/P pads are not connected on the tested board, right?

They are connected from MX8MP SoC to MiniPCIe slot.
There is no external clock source like on the EVK, the MX8MP internal PLL is the clock source.

Got that, thanks.

btw. if you plan to resend the MX8MP PCIe patches (assuming they didn't get applied yet), CC me, I can provide a Tested-by .

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

BTW, it's better to add the Fixes tag into the commit log.

Do you think this should be considered a bugfix ?

Emm...
It's reasonable to consider it as new added. Okay, I'm fine with it. Thanks again for your patch.

Let's wait for others' opinion, I'm really unsure whether this is a Fixes: or not.

Signature · 3 lines
linux-phy mailing list
[email protected]
https://lists.infradead.org/mailman/listinfo/linux-phy
#5 lore raw
Quoted 26 lines

-----Original Message-----
From: Marek Vasut <[email protected]>
Sent: 2022年3月14日 18:53
To: Hongxing Zhu <[email protected]>; [email protected]
Cc: Fabio Estevam <[email protected]>; Kishon Vijay Abraham I <[email protected]>; Marcel Ziswiler <[email protected]>; dl-linux-imx <[email protected]>; Peng Fan <[email protected]>; Shawn Guo <[email protected]>; Vinod Koul <[email protected]>; [email protected]
Subject: Re: [PATCH] phy: freescale: imx8m-pcie: Handle IMX8_PCIE_REFCLK_PAD_UNUSED

On 3/14/22 04:29, Hongxing Zhu wrote:

[...]

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 1 line

Hi Marek:
Thanks for your patch.
I assume that you had tested this IMX8_PCIE_REFCLK_PAD_UNUSED

option.

Quoted 5 lines
Quoted 5 lines

Yes

Quoted 1 line

The CLK_N/P pads are not connected on the tested board, right?

Quoted 8 lines
Quoted 5 lines
Quoted 4 lines

They are connected from MX8MP SoC to MiniPCIe slot.
There is no external clock source like on the EVK, the MX8MP internal PLL is the clock source.

Got that, thanks.

btw. if you plan to resend the MX8MP PCIe patches (assuming they didn't get applied yet), CC me, I can provide a Tested-by .

Sure, I would CC you from next review cycle.
It's great that you can help. Thanks.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

BTW, it's better to add the Fixes tag into the commit log.

Do you think this should be considered a bugfix ?

Quoted 8 lines
Quoted 5 lines

Emm...
It's reasonable to consider it as new added. Okay, I'm fine with it. Thanks again for your patch.

Let's wait for others' opinion, I'm really unsure whether this is a
Fixes: or not.

Okay.

Best Regards
Richard Zhu

Signature · 3 lines
linux-phy mailing list
[email protected]
https://lists.infradead.org/mailman/listinfo/linux-phy
maintainer
#6 lore raw
In reply to Marek Vasut
Quoted 11 lines · Marek Vasut

The 'fsl,refclk-pad-mode' DT property used to select clock source for PCIe PHY can have either of three values, IMX8_PCIE_REFCLK_PAD_INPUT, IMX8_PCIE_REFCLK_PAD_OUTPUT, IMX8_PCIE_REFCLK_PAD_UNUSED. The first two options are handled correctly by the driver, the last one is not, this patch implements support for the last option.

The IMX8_PCIE_REFCLK_PAD_INPUT means PCIE_RESREF is PHY clock input, the IMX8_PCIE_REFCLK_PAD_OUTPUT means PHY clock are sourced from SoC internal PLL and output to PCIE_RESREF external IO pin. The last IMX8_PCIE_REFCLK_PAD_UNUSED is a combination of previous two, PHY clock are sourced from SoC internal PLL and not output anywhere.

This does not apply on phy-next, please rebase

Signature · 6 lines
~Vinod

-- 
linux-phy mailing list
[email protected]
https://lists.infradead.org/mailman/listinfo/linux-phy
#7 lore raw
Quoted 7 lines · Vinod Koul
Quoted 6 lines · Marek Vasut

The 'fsl,refclk-pad-mode' DT property used to select clock source for PCIe PHY can have either of three values, IMX8_PCIE_REFCLK_PAD_INPUT, IMX8_PCIE_REFCLK_PAD_OUTPUT, IMX8_PCIE_REFCLK_PAD_UNUSED. The first two options are handled correctly by the driver, the last one is not, this patch implements support for the last option.

Quoted 7 lines
Quoted 5 lines

The IMX8_PCIE_REFCLK_PAD_INPUT means PCIE_RESREF is PHY clock input, the IMX8_PCIE_REFCLK_PAD_OUTPUT means PHY clock are sourced from SoC internal PLL and output to PCIE_RESREF external IO pin. The last IMX8_PCIE_REFCLK_PAD_UNUSED is a combination of previous two, PHY clock are sourced from SoC internal PLL and not output anywhere.

This does not apply on phy-next, please rebase

Done, V2 is out

Signature · 3 lines
linux-phy mailing list
[email protected]
https://lists.infradead.org/mailman/listinfo/linux-phy