Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp4465256rwb; Tue, 8 Aug 2023 08:54:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGudNaVauIhaVfpk9YL7KZUHKZ7jZ8jVNaRrlhmJ76dDw8VvVdaz4DgXUaRqdoOv+ljickV X-Received: by 2002:a05:6a20:96ce:b0:12f:1f1f:b506 with SMTP id hq14-20020a056a2096ce00b0012f1f1fb506mr10765304pzc.21.1691510070563; Tue, 08 Aug 2023 08:54:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691510070; cv=none; d=google.com; s=arc-20160816; b=ksW4OMg9yX3Nq5Lff78eCGkVvmDzJa0VsdbeXD3lq+1/Pkxu08mkp2eCBH3/ROiPwd 91IqEnezvDuKbBvTU8HSYfyfC/q5kRWdxpPLAbQ2e5Q4SrzZalRemt4ajmPLFW15++LY PKkzfkq3LEcNSm72Q6v/urL258V6F+AHYGo5Cq7jofoW41aqdodrbjNGZNR/VqHiWIya KqyXa26nPjVMmKQTd6i+XkLj2X8dAOTZOmSXyVIOrV2kEz0PIajMZfr+GbncXqOt+qO5 L9tZQt5GvkYHfcvtpoh1p0vzsRf6FEQm0zVw2T02b2HBo1QTGg/SZEsnUdEkc5gpBgeP 8yIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=cmwDSbltQ7BTRqbK4mfZS3e3461DYx9Yn3UKrJpR8D8=; fh=cRb0aB90SbQyVFNPpVcxERgDOlz7nc5zFh0bRYzMTlo=; b=zx/DEcCYqTLps3PgnlosfQf25fujrP3qTzML6QduUAdoHuW/u/j+v/8SanV6ymSj7/ 95+mAPnUJXz/gN8T2kHpvz+O/yF0f4+h1mjLei6lx8eCIwhgPqx/ymb7fgsWqGKTTF5J Vw9tHmeFEeXEAPoodzcbvPyvzT2FDe3qko6iAewYblTjmi5b9HtJ62Vl2dk3nWcwM+gZ YwFKoiZBvvfAkwVYlEZOjgKr72LTleCY6+gXUUgn7NTzywLL5ZVJDJmrbxIUoELyXiRr ZGQ+ovZ8PemTUy0ohM16zY1XxnNrDWnq/aoIJHHIXheunIidp69dkeUe/HOsuJqxiQAn MksA== 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 cp17-20020a056a00349100b00686bef2c7c5si7218603pfb.322.2023.08.08.08.54.17; Tue, 08 Aug 2023 08:54:30 -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 S230211AbjHHPu7 (ORCPT + 99 others); Tue, 8 Aug 2023 11:50:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229470AbjHHPtA (ORCPT ); Tue, 8 Aug 2023 11:49:00 -0400 Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C896C10CF; Tue, 8 Aug 2023 08:42:02 -0700 (PDT) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 6D2E41A11D5; Tue, 8 Aug 2023 08:09:03 +0200 (CEST) Received: from aprdc01srsp001v.ap-rdc01.nxp.com (aprdc01srsp001v.ap-rdc01.nxp.com [165.114.16.16]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 007941A11C8; Tue, 8 Aug 2023 08:09:03 +0200 (CEST) Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by aprdc01srsp001v.ap-rdc01.nxp.com (Postfix) with ESMTP id 481F91800318; Tue, 8 Aug 2023 14:09:01 +0800 (+08) From: Richard Zhu To: frank.li@nxp.com, l.stach@pengutronix.de, shawnguo@kernel.org, lpieralisi@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org Cc: hongxing.zhu@nxp.com, linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de, linux-imx@nxp.com Subject: [PATCH v3 8/9] PCI: imx6: Add i.MX6SX PCIe EP support Date: Tue, 8 Aug 2023 13:34:17 +0800 Message-Id: <1691472858-9383-9-git-send-email-hongxing.zhu@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1691472858-9383-1-git-send-email-hongxing.zhu@nxp.com> References: <1691472858-9383-1-git-send-email-hongxing.zhu@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,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 the i.MX6SX PCIe EP support. Signed-off-by: Richard Zhu --- drivers/pci/controller/dwc/pci-imx6.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 9a6531ddfef2..43c5251f5160 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -48,6 +48,7 @@ enum imx6_pcie_variants { IMX6Q, IMX6Q_EP, IMX6SX, + IMX6SX_EP, IMX6QP, IMX6QP_EP, IMX7D, @@ -362,6 +363,7 @@ static void imx6_pcie_init_phy(struct imx6_pcie *imx6_pcie) IMX7D_GPR12_PCIE_PHY_REFCLK_SEL, 0); break; case IMX6SX: + case IMX6SX_EP: regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX6SX_GPR12_PCIE_RX_EQ_MASK, IMX6SX_GPR12_PCIE_RX_EQ_2); @@ -560,6 +562,7 @@ static int imx6_pcie_enable_ref_clk(struct imx6_pcie *imx6_pcie) switch (imx6_pcie->drvdata->variant) { case IMX6SX: + case IMX6SX_EP: ret = clk_prepare_enable(imx6_pcie->pcie_inbound_axi); if (ret) { dev_err(dev, "unable to enable pcie_axi clock\n"); @@ -621,6 +624,7 @@ static void imx6_pcie_disable_ref_clk(struct imx6_pcie *imx6_pcie) { switch (imx6_pcie->drvdata->variant) { case IMX6SX: + case IMX6SX_EP: clk_disable_unprepare(imx6_pcie->pcie_inbound_axi); break; case IMX6QP: @@ -718,6 +722,7 @@ static void imx6_pcie_assert_core_reset(struct imx6_pcie *imx6_pcie) reset_control_assert(imx6_pcie->apps_reset); break; case IMX6SX: + case IMX6SX_EP: regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX6SX_GPR12_PCIE_TEST_POWERDOWN, IMX6SX_GPR12_PCIE_TEST_POWERDOWN); @@ -782,6 +787,7 @@ static int imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie) imx7d_pcie_wait_for_phy_pll_lock(imx6_pcie); break; case IMX6SX: + case IMX6SX_EP: regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR5, IMX6SX_GPR5_PCIE_BTNRST_RESET, 0); break; @@ -840,6 +846,7 @@ static void imx6_pcie_ltssm_enable(struct device *dev) case IMX6Q: case IMX6Q_EP: case IMX6SX: + case IMX6SX_EP: case IMX6QP: case IMX6QP_EP: regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, @@ -866,6 +873,7 @@ static void imx6_pcie_ltssm_disable(struct device *dev) case IMX6Q: case IMX6Q_EP: case IMX6SX: + case IMX6SX_EP: case IMX6QP: case IMX6QP_EP: regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, @@ -1198,6 +1206,7 @@ static void imx6_pcie_pm_turnoff(struct imx6_pcie *imx6_pcie) /* Others poke directly at IOMUXC registers */ switch (imx6_pcie->drvdata->variant) { case IMX6SX: + case IMX6SX_EP: case IMX6QP: case IMX6QP_EP: regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, @@ -1361,6 +1370,7 @@ static int imx6_pcie_probe(struct platform_device *pdev) switch (imx6_pcie->drvdata->variant) { case IMX6SX: + case IMX6SX_EP: imx6_pcie->pcie_inbound_axi = devm_clk_get(dev, "pcie_inbound_axi"); if (IS_ERR(imx6_pcie->pcie_inbound_axi)) @@ -1535,6 +1545,13 @@ static const struct imx6_pcie_drvdata drvdata[] = { IMX6_PCIE_FLAG_SUPPORTS_SUSPEND, .gpr = "fsl,imx6q-iomuxc-gpr", }, + [IMX6SX_EP] = { + .variant = IMX6SX_EP, + .mode = DW_PCIE_EP_TYPE, + .flags = IMX6_PCIE_FLAG_IMX6_PHY, + .gpr = "fsl,imx6q-iomuxc-gpr", + .epc_features = &imx6q_pcie_epc_features, + }, [IMX6QP] = { .variant = IMX6QP, .flags = IMX6_PCIE_FLAG_IMX6_PHY | @@ -1590,6 +1607,7 @@ static const struct of_device_id imx6_pcie_of_match[] = { { .compatible = "fsl,imx6q-pcie", .data = &drvdata[IMX6Q], }, { .compatible = "fsl,imx6q-pcie-ep", .data = &drvdata[IMX6Q_EP], }, { .compatible = "fsl,imx6sx-pcie", .data = &drvdata[IMX6SX], }, + { .compatible = "fsl,imx6sx-pcie-ep", .data = &drvdata[IMX6SX_EP], }, { .compatible = "fsl,imx6qp-pcie", .data = &drvdata[IMX6QP], }, { .compatible = "fsl,imx6qp-pcie-ep", .data = &drvdata[IMX6QP_EP], }, { .compatible = "fsl,imx7d-pcie", .data = &drvdata[IMX7D], }, -- 2.34.1