Message ID | 1666590189-1364-1-git-send-email-hongxing.zhu@nxp.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp277653wru; Sun, 23 Oct 2022 23:14:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4xcoJI8F0IiaXRjX51O7CfYQVAmT3OeptFY/XF5Q5RTqlajfYM0X4bRCtI+uC/8dnT483V X-Received: by 2002:a05:6402:518b:b0:45d:9a19:66d2 with SMTP id q11-20020a056402518b00b0045d9a1966d2mr28809805edd.43.1666592041616; Sun, 23 Oct 2022 23:14:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666592041; cv=none; d=google.com; s=arc-20160816; b=F21ZnfF2qCRMIBm7HRAr3DvYr47QLgFdN/FmwP0FCV+pYzHBZJbQEgWA+5XjFcc9wg ez++t28MDpZz4TYpB8E7lvle3+VBbWfpq+gGAb6POEyz/Cc2jDdDOKNkL7c2m0s0Eb40 /hreO13ANyncA1AE+P3u9pGPNDIkBN4BWuOKhjaoFLdsyOvn4dT+3SeRFrSooEabNI8N p7x1Y5dSa9kN/ii1GVyWkwg5bETQTb4Epe67iBLZL67eu4hOVOeISivt0T39BacSHXXP pdRzL9/eDXPeFWEvAVGdeOAqO8VkhlaFj2N7W8yAiJOUIu7BGBpvsWQnl4FaqU8Joljs pRFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=S9zBlYlj9hdzrluG00Eb2GJTUPK4wRL6J12XEb4jxJ4=; b=I5+q+2rbOvheboXmWEN63yyUjlrRyr+1n7OtEupnEsl8rHdPQEsFVCSdPETPLzRKWq 7HywvoR7ZAKK0OEzVB2OhEMX+mysBcGDs+8MqAfBj6FSqjnnzMcM2yWxuaEVCppzW6+r FqSiCiEJv4qJlTH9aTgIA8rtGR3k/1UPXVQgJKKoGBA7jHjkX8p1wVUy53MUdkdLizvM iIwVYYsBVidExDBtFKt7VLV5c92AeNhFDqmg99l1xL4CCN+oAyJtHvW15jXcWfRqyrKM 3wB53kh8sIr7gTApvXrp9YDtleR1VXsi3kYSyhUwAqVjuiT1ldk/OfwVpuHmPlshLQXC VSTA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q6-20020a1709064cc600b0078fcfc5d24esi18859260ejt.618.2022.10.23.23.13.34; Sun, 23 Oct 2022 23:14:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230200AbiJXGDh (ORCPT <rfc822;pwkd43@gmail.com> + 99 others); Mon, 24 Oct 2022 02:03:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230183AbiJXGDf (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 24 Oct 2022 02:03:35 -0400 Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2C8C5AC48; Sun, 23 Oct 2022 23:03:34 -0700 (PDT) Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id A2CDD217410; Mon, 24 Oct 2022 08:03:32 +0200 (CEST) Received: from aprdc01srsp001v.ap-rdc01.nxp.com (aprdc01srsp001v.ap-rdc01.nxp.com [165.114.16.16]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 6AA9E21740F; Mon, 24 Oct 2022 08:03:32 +0200 (CEST) Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by aprdc01srsp001v.ap-rdc01.nxp.com (Postfix) with ESMTP id 91BFA180226C; Mon, 24 Oct 2022 14:03:30 +0800 (+08) From: Richard Zhu <hongxing.zhu@nxp.com> To: l.stach@pengutronix.de, marex@denx.de, tharvey@gateworks.com, vkoul@kernel.org, bhelgaas@google.com, lorenzo.pieralisi@arm.com, shawnguo@kernel.org, alexander.stein@ew.tq-group.com, richard.leitner@linux.dev Cc: devicetree@vger.kernel.org, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de, linux-imx@nxp.com, Richard Zhu <hongxing.zhu@nxp.com> Subject: [PATCH v1] soc: imx: imx8mp-blk-ctrl: Add PCIe SYSPLL configurations Date: Mon, 24 Oct 2022 13:43:09 +0800 Message-Id: <1666590189-1364-1-git-send-email-hongxing.zhu@nxp.com> X-Mailer: git-send-email 2.7.4 X-Virus-Scanned: ClamAV using ClamSMTP X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747548416672234866?= X-GMAIL-MSGID: =?utf-8?q?1747548416672234866?= |
Series |
[v1] soc: imx: imx8mp-blk-ctrl: Add PCIe SYSPLL configurations
|
|
Commit Message
Richard Zhu
Oct. 24, 2022, 5:43 a.m. UTC
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_ROOT>'.
Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
---
Base on 6.1-rc1, and the following PHY changes [1],
the PCIe works fine when SYSPLL is used as reference clock on i.MX8MP
EVK board(schematic-46370) after removing R131/R132/R137/R138, and
populating R135/R136.
[1] https://patchwork.kernel.org/project/linux-pci/cover/1665625622-20551-1-git-send-email-hongxing.zhu@nxp.com/
---
drivers/soc/imx/imx8mp-blk-ctrl.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
Comments
On Mon, Oct 24, 2022 at 01:43:09PM +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_ROOT>'. > > Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com> Applied, thanks!
Hi Shawn, Richard, Am Samstag, dem 29.10.2022 um 16:45 +0800 schrieb Shawn Guo: > On Mon, Oct 24, 2022 at 01:43:09PM +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_ROOT>'. > > > > Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com> > > Applied, thanks! Sorry for the late reply, but I'm not really happy with the fact that the PLL is now unconditionally enabled, even though it is only needed when there is no external reference clock source. I fear that this will be hard to correct later on as the DT abstraction is wrong, as IMX8MP_CLK_HSIO_ROOT is NOT the reference clock for the PHY, but the PLL generated clock, which isn't properly exposed with this series. I'm not happy to see this going in in the current state and if not too late would like to ask Shawn to remove it from the tree again. Regards, Lucas
> -----Original Message----- > From: Lucas Stach <l.stach@pengutronix.de> > Sent: 2022年11月1日 16:45 > To: Shawn Guo <shawnguo@kernel.org>; Hongxing Zhu > <hongxing.zhu@nxp.com> > Cc: marex@denx.de; tharvey@gateworks.com; vkoul@kernel.org; > bhelgaas@google.com; lorenzo.pieralisi@arm.com; > alexander.stein@ew.tq-group.com; richard.leitner@linux.dev; > devicetree@vger.kernel.org; linux-pci@vger.kernel.org; > linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org; > kernel@pengutronix.de; dl-linux-imx <linux-imx@nxp.com> > Subject: Re: [PATCH v1] soc: imx: imx8mp-blk-ctrl: Add PCIe SYSPLL > configurations > > Hi Shawn, Richard, > > Am Samstag, dem 29.10.2022 um 16:45 +0800 schrieb Shawn Guo: > > On Mon, Oct 24, 2022 at 01:43:09PM +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_ROOT>'. > > > > > > Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com> > > > > Applied, thanks! > > Sorry for the late reply, but I'm not really happy with the fact that the PLL is > now unconditionally enabled, even though it is only needed when there is no > external reference clock source. > I fear that this will be hard to correct later on as the DT abstraction is wrong, as > IMX8MP_CLK_HSIO_ROOT is NOT the reference clock for the PHY, but the PLL > generated clock, which isn't properly exposed with this series. Hi Lucas: First of all, thanks for your comments. IMHO, I'm not sure it's proper or not to describe the hardware logic in the PHY node when internal SYSPLL is used as PCIe PHY reference clock. So, I'm trying to get some suggestions and used to send out an email to you and Marcel on Sep20. Okay, if you think it's not correct to expose IMX8MP_CLK_HSIO_ROOT clock out. Which clock you are prefer to use as PHY reference clock here? Thanks. Best Regards Richard Zhu > > I'm not happy to see this going in in the current state and if not too late would > like to ask Shawn to remove it from the tree again. > > Regards, > Lucas
On Tue, Nov 01, 2022 at 09:44:41AM +0100, Lucas Stach wrote: > Hi Shawn, Richard, > > Am Samstag, dem 29.10.2022 um 16:45 +0800 schrieb Shawn Guo: > > On Mon, Oct 24, 2022 at 01:43:09PM +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_ROOT>'. > > > > > > Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com> > > > > Applied, thanks! > > Sorry for the late reply, but I'm not really happy with the fact that > the PLL is now unconditionally enabled, even though it is only needed > when there is no external reference clock source. > I fear that this will be hard to correct later on as the DT abstraction > is wrong, as IMX8MP_CLK_HSIO_ROOT is NOT the reference clock for the > PHY, but the PLL generated clock, which isn't properly exposed with > this series. > > I'm not happy to see this going in in the current state and if not too > late would like to ask Shawn to remove it from the tree again. Removed. Shawn
> -----Original Message----- > From: Hongxing Zhu > Sent: 2022年11月2日 9:46 > To: Lucas Stach <l.stach@pengutronix.de>; Shawn Guo <shawnguo@kernel.org> > Cc: marex@denx.de; tharvey@gateworks.com; vkoul@kernel.org; > bhelgaas@google.com; lorenzo.pieralisi@arm.com; > alexander.stein@ew.tq-group.com; richard.leitner@linux.dev; > devicetree@vger.kernel.org; linux-pci@vger.kernel.org; > linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org; > kernel@pengutronix.de; dl-linux-imx <linux-imx@nxp.com>; > marcel.ziswiler@toradex.com > Subject: RE: [PATCH v1] soc: imx: imx8mp-blk-ctrl: Add PCIe SYSPLL > configurations > > > -----Original Message----- > > From: Lucas Stach <l.stach@pengutronix.de> > > Sent: 2022年11月1日 16:45 > > To: Shawn Guo <shawnguo@kernel.org>; Hongxing Zhu > > <hongxing.zhu@nxp.com> > > Cc: marex@denx.de; tharvey@gateworks.com; vkoul@kernel.org; > > bhelgaas@google.com; lorenzo.pieralisi@arm.com; > > alexander.stein@ew.tq-group.com; richard.leitner@linux.dev; > > devicetree@vger.kernel.org; linux-pci@vger.kernel.org; > > linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org; > > kernel@pengutronix.de; dl-linux-imx <linux-imx@nxp.com> > > Subject: Re: [PATCH v1] soc: imx: imx8mp-blk-ctrl: Add PCIe SYSPLL > > configurations > > > > Hi Shawn, Richard, > > > > Am Samstag, dem 29.10.2022 um 16:45 +0800 schrieb Shawn Guo: > > > On Mon, Oct 24, 2022 at 01:43:09PM +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_ROOT>'. > > > > > > > > Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com> > > > > > > Applied, thanks! > > > > Sorry for the late reply, but I'm not really happy with the fact that > > the PLL is now unconditionally enabled, even though it is only needed > > when there is no external reference clock source. > > I fear that this will be hard to correct later on as the DT > > abstraction is wrong, as IMX8MP_CLK_HSIO_ROOT is NOT the reference > > clock for the PHY, but the PLL generated clock, which isn't properly exposed > with this series. > Hi Lucas: > First of all, thanks for your comments. > > IMHO, I'm not sure it's proper or not to describe the hardware logic in the > PHY node when internal SYSPLL is used as PCIe PHY reference clock. > So, I'm trying to get some suggestions and used to send out an email to you > and Marcel on Sep20. > > Okay, if you think it's not correct to expose IMX8MP_CLK_HSIO_ROOT clock > out. > Which clock you are prefer to use as PHY reference clock here? > > Thanks. > > Best Regards > Richard Zhu > > > > I'm not happy to see this going in in the current state and if not too > > late would like to ask Shawn to remove it from the tree again. Hi Lucas: Refer to the "Reference Clock Section" of i.MX8MP PCIe PHY document. I_pll_refclk_from_syspll clock is used as reference clock when Inner chip clock mode is used. In the current codes, IMX8MP_CLK_HSIO_AXI is source from sys_pll2 clock. is it reasonable that use it as PCIe reference clock in this scenario here? Best Regards Richard Zhu > > > > Regards, > > Lucas
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;