From patchwork Mon Oct 24 05:43:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Zhu X-Patchwork-Id: 8166 Return-Path: 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 + 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 ); 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 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 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: 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?= 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 ''. - Change 'clocks' to '<&clk IMX8MP_CLK_HSIO_ROOT>'. Signed-off-by: Richard Zhu --- 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(+) 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;