Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp6341885rwi; Sun, 23 Oct 2022 23:14:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6PzHgOWhOYPbbyvR1Nw3nh/avlRUci3uEmTuiR34r1NRl5PRzjprZvc4UOdItZTVE1fgZv X-Received: by 2002:a05:6402:510d:b0:45d:a888:d831 with SMTP id m13-20020a056402510d00b0045da888d831mr28693069edd.315.1666592093957; Sun, 23 Oct 2022 23:14:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666592093; cv=none; d=google.com; s=arc-20160816; b=mWDbiTFgyoZA7635ikQc7BldmGyXUco3gHeJztr9c+dVJQbYPT9A00GbVq8nTqG0tn yB2NIvp7DROoXxcfzvAETd6Kv8PJr9UepaY2QVzVvDXjaK7V8Lk65bqhhO/LTEkWfB8f BQyzOc/aGrnenHBqqfq4pxWUgjOGOzoYiOVaobRXNX4nxHYgQBtP+6YrVOPVbUl2eNBy Bgl9CFxvrRWWVzbeRBD4IYGxq3A1lK11ncnmScrp0MEzsiBMnBKUaRKt7ot42F6jEC+s xZL3aKRwTcLNlcoaFZlbCLg9qflh76bXmmdX701L1qVdFOCk9VPZruvrC6MdsKCzdc1i +ukw== 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 Return-Path: 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.14.28; Sun, 23 Oct 2022 23:14:53 -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 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; -- 2.25.1