* [PATCH v2] phy: airoha: adjust initialization delay in airoha_pcie_phy_init()
@ 2024-08-05 19:57 Lorenzo Bianconi
2024-08-06 8:17 ` AngeloGioacchino Del Regno
0 siblings, 1 reply; 3+ messages in thread
From: Lorenzo Bianconi @ 2024-08-05 19:57 UTC (permalink / raw)
To: linux-phy
Cc: vkoul, kishon, linux-arm-kernel, lorenzo.bianconi83, nbd, john,
dd, upstream, angelogioacchino.delregno
Align phy-pcie initialization delay to the vendor sdk in
airoha_pcie_phy_init routine and allow the hw to complete required
configuration before proceeding
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
Changes since v1:
- use msleep() instead of mdelay()
---
drivers/phy/phy-airoha-pcie.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/phy/phy-airoha-pcie.c b/drivers/phy/phy-airoha-pcie.c
index bd3edaa986c8..6d61e6486a03 100644
--- a/drivers/phy/phy-airoha-pcie.c
+++ b/drivers/phy/phy-airoha-pcie.c
@@ -18,6 +18,9 @@
#define LEQ_LEN_CTRL_MAX_VAL 7
#define FREQ_LOCK_MAX_ATTEMPT 10
+/* PCIe-PHY initialization time in ms needed by the hw to complete */
+#define PHY_HW_INIT_TIME_MS 30
+
enum airoha_pcie_port_gen {
PCIE_PORT_GEN1 = 1,
PCIE_PORT_GEN2,
@@ -1180,8 +1183,11 @@ static int airoha_pcie_phy_init(struct phy *phy)
PCIE_DA_XPON_CDR_PR_PWDB);
airoha_phy_pma1_set_bits(pcie_phy, REG_PCIE_PMA_SS_DA_XPON_PWDB0,
PCIE_DA_XPON_CDR_PR_PWDB);
-
- usleep_range(100, 200);
+ /*
+ * Wait for the time in ms needed by the hw to complete the PCIe-PHY
+ * initialization
+ */
+ msleep(PHY_HW_INIT_TIME_MS);
return 0;
}
--
2.45.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] phy: airoha: adjust initialization delay in airoha_pcie_phy_init()
2024-08-05 19:57 [PATCH v2] phy: airoha: adjust initialization delay in airoha_pcie_phy_init() Lorenzo Bianconi
@ 2024-08-06 8:17 ` AngeloGioacchino Del Regno
2024-08-06 15:56 ` Lorenzo Bianconi
0 siblings, 1 reply; 3+ messages in thread
From: AngeloGioacchino Del Regno @ 2024-08-06 8:17 UTC (permalink / raw)
To: Lorenzo Bianconi, linux-phy
Cc: vkoul, kishon, linux-arm-kernel, lorenzo.bianconi83, nbd, john,
dd, upstream
Il 05/08/24 21:57, Lorenzo Bianconi ha scritto:
> Align phy-pcie initialization delay to the vendor sdk in
> airoha_pcie_phy_init routine and allow the hw to complete required
> configuration before proceeding
>
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
> Changes since v1:
> - use msleep() instead of mdelay()
> ---
> drivers/phy/phy-airoha-pcie.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/phy/phy-airoha-pcie.c b/drivers/phy/phy-airoha-pcie.c
> index bd3edaa986c8..6d61e6486a03 100644
> --- a/drivers/phy/phy-airoha-pcie.c
> +++ b/drivers/phy/phy-airoha-pcie.c
> @@ -18,6 +18,9 @@
> #define LEQ_LEN_CTRL_MAX_VAL 7
> #define FREQ_LOCK_MAX_ATTEMPT 10
>
> +/* PCIe-PHY initialization time in ms needed by the hw to complete */
> +#define PHY_HW_INIT_TIME_MS 30
> +
> enum airoha_pcie_port_gen {
> PCIE_PORT_GEN1 = 1,
> PCIE_PORT_GEN2,
> @@ -1180,8 +1183,11 @@ static int airoha_pcie_phy_init(struct phy *phy)
> PCIE_DA_XPON_CDR_PR_PWDB);
> airoha_phy_pma1_set_bits(pcie_phy, REG_PCIE_PMA_SS_DA_XPON_PWDB0,
> PCIE_DA_XPON_CDR_PR_PWDB);
> -
> - usleep_range(100, 200);
> + /*
> + * Wait for the time in ms needed by the hw to complete the PCIe-PHY
> + * initialization
...but regardless, I have a nit here (not a blocker for me, hence the R-b tag):
there's no need to say that we're waiting for milliseconds, so this comment can
be just one line:
/* Wait for the PCIe PHY to complete initialization before returning */
Cheers,
Angelo
> + */
> + msleep(PHY_HW_INIT_TIME_MS);
>
> return 0;
> }
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] phy: airoha: adjust initialization delay in airoha_pcie_phy_init()
2024-08-06 8:17 ` AngeloGioacchino Del Regno
@ 2024-08-06 15:56 ` Lorenzo Bianconi
0 siblings, 0 replies; 3+ messages in thread
From: Lorenzo Bianconi @ 2024-08-06 15:56 UTC (permalink / raw)
To: AngeloGioacchino Del Regno
Cc: linux-phy, vkoul, kishon, linux-arm-kernel, lorenzo.bianconi83,
nbd, john, dd, upstream
[-- Attachment #1: Type: text/plain, Size: 1913 bytes --]
> Il 05/08/24 21:57, Lorenzo Bianconi ha scritto:
> > Align phy-pcie initialization delay to the vendor sdk in
> > airoha_pcie_phy_init routine and allow the hw to complete required
> > configuration before proceeding
> >
> > Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
>
> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
>
> > ---
> > Changes since v1:
> > - use msleep() instead of mdelay()
> > ---
> > drivers/phy/phy-airoha-pcie.c | 10 ++++++++--
> > 1 file changed, 8 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/phy/phy-airoha-pcie.c b/drivers/phy/phy-airoha-pcie.c
> > index bd3edaa986c8..6d61e6486a03 100644
> > --- a/drivers/phy/phy-airoha-pcie.c
> > +++ b/drivers/phy/phy-airoha-pcie.c
> > @@ -18,6 +18,9 @@
> > #define LEQ_LEN_CTRL_MAX_VAL 7
> > #define FREQ_LOCK_MAX_ATTEMPT 10
> > +/* PCIe-PHY initialization time in ms needed by the hw to complete */
> > +#define PHY_HW_INIT_TIME_MS 30
> > +
> > enum airoha_pcie_port_gen {
> > PCIE_PORT_GEN1 = 1,
> > PCIE_PORT_GEN2,
> > @@ -1180,8 +1183,11 @@ static int airoha_pcie_phy_init(struct phy *phy)
> > PCIE_DA_XPON_CDR_PR_PWDB);
> > airoha_phy_pma1_set_bits(pcie_phy, REG_PCIE_PMA_SS_DA_XPON_PWDB0,
> > PCIE_DA_XPON_CDR_PR_PWDB);
> > -
> > - usleep_range(100, 200);
> > + /*
> > + * Wait for the time in ms needed by the hw to complete the PCIe-PHY
> > + * initialization
>
> ...but regardless, I have a nit here (not a blocker for me, hence the R-b tag):
> there's no need to say that we're waiting for milliseconds, so this comment can
> be just one line:
>
> /* Wait for the PCIe PHY to complete initialization before returning */
>
> Cheers,
> Angelo
ack, no worries, already fixed in v3.
Regards,
Lorenzo
>
> > + */
> > + msleep(PHY_HW_INIT_TIME_MS);
> > return 0;
> > }
>
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-08-06 15:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-05 19:57 [PATCH v2] phy: airoha: adjust initialization delay in airoha_pcie_phy_init() Lorenzo Bianconi
2024-08-06 8:17 ` AngeloGioacchino Del Regno
2024-08-06 15:56 ` Lorenzo Bianconi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox