From patchwork Fri Aug 4 02:09:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Zhu X-Patchwork-Id: 130948 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:419:b0:139:fa0d:b2d with SMTP id 25csp773533rwd; Thu, 3 Aug 2023 20:38:06 -0700 (PDT) X-Google-Smtp-Source: APBJJlGqv3erwUHQlBI6wUrKKeja6f3UzmIoodDrU4nUk8WjAS2CkNtdt7WO8x+pSGcUXpsPpsVW X-Received: by 2002:a05:6a20:8f13:b0:137:4fd0:e2e6 with SMTP id b19-20020a056a208f1300b001374fd0e2e6mr24187526pzk.6.1691120286594; Thu, 03 Aug 2023 20:38:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691120286; cv=none; d=google.com; s=arc-20160816; b=Ze16tA5nELO2udJGIu47sIvpzosZ3kJMIjz1u3fhvjYieASfIJ+PgvoJEAUpxummDE qIu2WHOwaJZsFE+MjBi1Ry4l9f2c5qTnMwt2TUn4+gMe1Dgzmo3dbP+8w8NaHDoiMf4x MYpbvkIlSCM2kMjc9eEmMOhcvUZ4relKDCzqqkWRt3WGeW2epqy6B1RnhTpmxJaMEb15 Q55VGFhCLe7fZbLvqa7vrZElszBtKVRQOwfFBYXE68vyHXk0Qvb4zMO8hngJoOSHfcIh tXGgtm8Xakj/M2lT1odqdZv9GT8TtgNk+Ed5/lY4ulUwJqfrljqFP0m7osfavXIavq1A D5FA== 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=XUeM3zdd7IXrSaN9UWnargbOt4hG6l9tQQOrmd5ca/8=; fh=cRb0aB90SbQyVFNPpVcxERgDOlz7nc5zFh0bRYzMTlo=; b=t6u9GbyelCjt8Tyfd2X3tVTXS4URF6pD93dtHkrEUih6gUzU5B9wOVoVrxhNbSXQOK QvZCd86ZxymsRVDliU1NpnTG02PUOQ1ZySm5ZyE6iSyvK9PfyGEN34f3dgXrEMe/lx31 vHzbE8izJ0cAOjujrs1m5zmQk9yVkvcYF2Vzto9ggIJbH6b0tIwTQ7pXZs6rthIX1e+a bTjm0WiD5gNxv4FA7SrxZSD+5eCMwybCWq4WJ+WPVeGBn2yGdfo3bg7YCo+xk4InLe6R CyEPVW7cck9r1a2oIKJK0YWnAZQo0yMP2bLKoLXDcXC1mw4MHmDVyUQqPs24qkNiNZTI 3dqA== 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 o17-20020a635d51000000b00543c84bf588si1022228pgm.473.2023.08.03.20.37.52; Thu, 03 Aug 2023 20:38:06 -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 S233979AbjHDCoa (ORCPT + 99 others); Thu, 3 Aug 2023 22:44:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233884AbjHDCoN (ORCPT ); Thu, 3 Aug 2023 22:44:13 -0400 Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B19D173C; Thu, 3 Aug 2023 19:44:11 -0700 (PDT) Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id B7977201F22; Fri, 4 Aug 2023 04:44:09 +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 51E5B201F1D; Fri, 4 Aug 2023 04:44:09 +0200 (CEST) Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by aprdc01srsp001v.ap-rdc01.nxp.com (Postfix) with ESMTP id ACFB31802200; Fri, 4 Aug 2023 10:44:07 +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 v2 9/9] PCI: imx6: Add i.MX7D PCIe EP support Date: Fri, 4 Aug 2023 10:09:35 +0800 Message-Id: <1691114975-4750-10-git-send-email-hongxing.zhu@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1691114975-4750-1-git-send-email-hongxing.zhu@nxp.com> References: <1691114975-4750-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,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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: INBOX X-GMAIL-THRID: 1773268145404657652 X-GMAIL-MSGID: 1773268145404657652 Add the i.MX7D PCIe EP mode support. Signed-off-by: Richard Zhu --- drivers/pci/controller/dwc/pci-imx6.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 43c5251f5160..af7659712537 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -52,6 +52,7 @@ enum imx6_pcie_variants { IMX6QP, IMX6QP_EP, IMX7D, + IMX7D_EP, IMX8MQ, IMX8MM, IMX8MP, @@ -359,6 +360,7 @@ static void imx6_pcie_init_phy(struct imx6_pcie *imx6_pcie) 0); break; case IMX7D: + case IMX7D_EP: regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX7D_GPR12_PCIE_PHY_REFCLK_SEL, 0); break; @@ -590,6 +592,7 @@ static int imx6_pcie_enable_ref_clk(struct imx6_pcie *imx6_pcie) IMX6Q_GPR1_PCIE_REF_CLK_EN, 1 << 16); break; case IMX7D: + case IMX7D_EP: break; case IMX8MM: case IMX8MM_EP: @@ -638,6 +641,7 @@ static void imx6_pcie_disable_ref_clk(struct imx6_pcie *imx6_pcie) IMX6Q_GPR1_PCIE_TEST_PD); break; case IMX7D: + case IMX7D_EP: regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX7D_GPR12_PCIE_PHY_REFCLK_SEL, IMX7D_GPR12_PCIE_PHY_REFCLK_SEL); @@ -711,6 +715,7 @@ static void imx6_pcie_assert_core_reset(struct imx6_pcie *imx6_pcie) { switch (imx6_pcie->drvdata->variant) { case IMX7D: + case IMX7D_EP: case IMX8MQ: case IMX8MQ_EP: reset_control_assert(imx6_pcie->pciephy_reset); @@ -763,6 +768,7 @@ static int imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie) reset_control_deassert(imx6_pcie->pciephy_reset); break; case IMX7D: + case IMX7D_EP: reset_control_deassert(imx6_pcie->pciephy_reset); /* Workaround for ERR010728, failure of PCI-e PLL VCO to @@ -854,6 +860,7 @@ static void imx6_pcie_ltssm_enable(struct device *dev) IMX6Q_GPR12_PCIE_CTL_2); break; case IMX7D: + case IMX7D_EP: case IMX8MQ: case IMX8MQ_EP: case IMX8MM: @@ -880,6 +887,7 @@ static void imx6_pcie_ltssm_disable(struct device *dev) IMX6Q_GPR12_PCIE_CTL_2, 0); break; case IMX7D: + case IMX7D_EP: case IMX8MQ: case IMX8MQ_EP: case IMX8MM: @@ -1385,6 +1393,7 @@ static int imx6_pcie_probe(struct platform_device *pdev) "pcie_aux clock source missing or invalid\n"); fallthrough; case IMX7D: + case IMX7D_EP: if (dbi_base->start == IMX8MQ_PCIE2_BASE_ADDR) imx6_pcie->controller_id = 1; @@ -1572,6 +1581,12 @@ static const struct imx6_pcie_drvdata drvdata[] = { .flags = IMX6_PCIE_FLAG_SUPPORTS_SUSPEND, .gpr = "fsl,imx7d-iomuxc-gpr", }, + [IMX7D_EP] = { + .variant = IMX7D_EP, + .mode = DW_PCIE_EP_TYPE, + .gpr = "fsl,imx7d-iomuxc-gpr", + .epc_features = &imx6q_pcie_epc_features, + }, [IMX8MQ] = { .variant = IMX8MQ, .gpr = "fsl,imx8mq-iomuxc-gpr", @@ -1611,6 +1626,7 @@ static const struct of_device_id imx6_pcie_of_match[] = { { .compatible = "fsl,imx6qp-pcie", .data = &drvdata[IMX6QP], }, { .compatible = "fsl,imx6qp-pcie-ep", .data = &drvdata[IMX6QP_EP], }, { .compatible = "fsl,imx7d-pcie", .data = &drvdata[IMX7D], }, + { .compatible = "fsl,imx7d-pcie-ep", .data = &drvdata[IMX7D_EP], }, { .compatible = "fsl,imx8mq-pcie", .data = &drvdata[IMX8MQ], }, { .compatible = "fsl,imx8mm-pcie", .data = &drvdata[IMX8MM], }, { .compatible = "fsl,imx8mp-pcie", .data = &drvdata[IMX8MP], },