mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Marcel Ziswiler <marcel.ziswiler@toradex.com>
To: "alexander.stein@ew.tq-group.com"
	<alexander.stein@ew.tq-group.com>,
	"lorenzo.pieralisi@arm.com" <lorenzo.pieralisi@arm.com>,
	"l.stach@pengutronix.de" <l.stach@pengutronix.de>,
	"hongxing.zhu@nxp.com" <hongxing.zhu@nxp.com>,
	"marex@denx.de" <marex@denx.de>,
	"shawnguo@kernel.org" <shawnguo@kernel.org>,
	"tharvey@gateworks.com" <tharvey@gateworks.com>,
	"bhelgaas@google.com" <bhelgaas@google.com>,
	"richard.leitner@linux.dev" <richard.leitner@linux.dev>
Cc: "linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	"kernel@pengutronix.de" <kernel@pengutronix.de>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-imx@nxp.com" <linux-imx@nxp.com>
Subject: Re: [PATCH v2] soc: imx: imx8mp-blk-ctrl: Add PCIe SYSPLL configurations
Date: Fri, 18 Nov 2022 10:47:52 +0000	[thread overview]
Message-ID: <aacc40f4d8f727a8e1be97c094d1e391a8f72012.camel@toradex.com> (raw)
In-Reply-To: <1668740199-31956-1-git-send-email-hongxing.zhu@nxp.com>

Hi Richard

On Fri, 2022-11-18 at 10:56 +0800, Richard Zhu wrote:
> Add PCIe SYSPLL configurations, thus the internal SYSPLL can be used as
> i.MX8MP PCIe reference clock.
> 
> The following properties of PHY dts node should be changed accordingly.
>   - Set 'fsl,refclk-pad-mode' as '<IMX8_PCIE_REFCLK_PAD_OUTPUT>'.
>   - Change 'clocks' to '<&clk IMX8MP_CLK_HSIO_AXI>'.
> 
> Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>

Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

This works perfectly fine on Verdin iMX8M Plus as well. I will update my previous PCIe-enablement commit
(device tree part) in that respect and (re-)submit it.

Thanks!

Cheers

Marcel

> ---
> v1->v2:
> Refer to Lucas' comments, don't expose IMX8MP_CLK_HSIO_ROOT to dts node.
> https://patchwork.ozlabs.org/project/linux-pci/patch/1666590189-1364-1-git-send-email-hongxing.zhu@nxp.com/
> 
> Use <&clk IMX8MP_CLK_HSIO_AXI> as referrence clock source when internal
> clock mode is used by i.MX8MP PCIe module.
> 
> Verified on i.MX8MP EVK board with removing R131/R132/R137/R138, and
> populating R135/R136.
> ---
>  drivers/soc/imx/imx8mp-blk-ctrl.c | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
> 
> diff --git a/drivers/soc/imx/imx8mp-blk-ctrl.c b/drivers/soc/imx/imx8mp-blk-ctrl.c
> index 0e3b6ba22f94..5ad20a8ea25e 100644
> --- a/drivers/soc/imx/imx8mp-blk-ctrl.c
> +++ b/drivers/soc/imx/imx8mp-blk-ctrl.c
> @@ -21,6 +21,16 @@
>  #define  USB_CLOCK_MODULE_EN   BIT(1)
>  #define  PCIE_PHY_APB_RST      BIT(4)
>  #define  PCIE_PHY_INIT_RST     BIT(5)
> +#define GPR_REG2               0x8
> +#define  P_PLL_MASK            GENMASK(5, 0)
> +#define  M_PLL_MASK            GENMASK(15, 6)
> +#define  S_PLL_MASK            GENMASK(18, 16)
> +#define  P_PLL                 (0xc << 0)
> +#define  M_PLL                 (0x320 << 6)
> +#define  S_PLL                 (0x4 << 16)
> +#define GPR_REG3               0xc
> +#define  PLL_CKE               BIT(17)
> +#define  PLL_RST               BIT(31)
>  
>  struct imx8mp_blk_ctrl_domain;
>  
> @@ -86,6 +96,18 @@ static void imx8mp_hsio_blk_ctrl_power_on(struct imx8mp_blk_ctrl *bc,
>         case IMX8MP_HSIOBLK_PD_PCIE_PHY:
>                 regmap_set_bits(bc->regmap, GPR_REG0,
>                                 PCIE_PHY_APB_RST | PCIE_PHY_INIT_RST);
> +
> +               /* Set the PLL configurations, P = 12, M = 800, S = 4. */
> +               regmap_update_bits(bc->regmap, GPR_REG2,
> +                                  P_PLL_MASK | M_PLL_MASK | S_PLL_MASK,
> +                                  P_PLL | M_PLL | S_PLL);
> +               udelay(1);
> +
> +               regmap_update_bits(bc->regmap, GPR_REG3, PLL_RST, PLL_RST);
> +               udelay(10);
> +
> +               /* Set 1b'1 to pll_cke of GPR_REG3 */
> +               regmap_update_bits(bc->regmap, GPR_REG3, PLL_CKE, PLL_CKE);
>                 break;
>         default:
>                 break;

  reply	other threads:[~2022-11-18 10:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-18  2:56 Richard Zhu
2022-11-18 10:47 ` Marcel Ziswiler [this message]
2022-11-18 11:02 ` Lucas Stach
2022-11-21  2:24   ` Hongxing Zhu

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=aacc40f4d8f727a8e1be97c094d1e391a8f72012.camel@toradex.com \
    --to=marcel.ziswiler@toradex.com \
    --cc=alexander.stein@ew.tq-group.com \
    --cc=bhelgaas@google.com \
    --cc=devicetree@vger.kernel.org \
    --cc=hongxing.zhu@nxp.com \
    --cc=kernel@pengutronix.de \
    --cc=l.stach@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=marex@denx.de \
    --cc=richard.leitner@linux.dev \
    --cc=shawnguo@kernel.org \
    --cc=tharvey@gateworks.com \
    /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®