From nobody Wed Oct 8 17:35:00 2025 Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E589F1BD9D3 for ; Thu, 26 Jun 2025 02:37:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.254.224.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750905435; cv=none; b=JyQsE7/heQKbNs0hQa8kWUSvCk0Xa9AhyOmJ/lBWqMPMP9JEiYtW67ahASL4nwOUbV0uF6O9CViaez9gVJnmItys+FRZlINKKJfqaTFgzb+Sr35KgNihBUo/B6yL186yxtzguWWbB68tTyhdbpENi0R9NOsWqFI6teOCvK2mE08= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750905435; c=relaxed/simple; bh=z2sOcS2GEXQg3M6WCfaMtB/l8eYFe3q4w1BRHq+Az2Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:MIME-Version: Content-Type:References; b=QQZrGtFR+QMTMqKcgKFHf3ulsELMHuxRKDoUl+zwrnk+96egt7NozM4uSitsCkXwbKpRfO/Az/y9abKKd2CTjTloLYn4dBQBxWJn16+14OauSEaXNItnHOUI9+P5FYfXSm7yBjyufH1rIff8UejhDab/SPUlHYcH0dM1faDlH+s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=T/Suh72r; arc=none smtp.client-ip=203.254.224.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="T/Suh72r" Received: from epcas5p2.samsung.com (unknown [182.195.41.40]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20250626023711epoutp0367437668b92cd1986af94204feb1f55e~MdzaNCYTH1712717127epoutp03k for ; Thu, 26 Jun 2025 02:37:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20250626023711epoutp0367437668b92cd1986af94204feb1f55e~MdzaNCYTH1712717127epoutp03k DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1750905431; bh=3KKeY/NRtUPjv7gxdOOKLkL/mtVywZDtNKn8DXvJJT0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T/Suh72rNRMdN/m7/Trdq4p0hqwoQegpnlJVMlU9P3w6ocmuPbi2ts9YCZLcPw1tg 6t/biCSwhfmgm1+B4fxeZljwctkaEL7DDDrO03J6fIsrv1dhHawWqAJMkBpQdyFGfA TtHuozUenW56VIXojOSU3u9MY40V0+pxhHY9Oihk= Received: from epsnrtp02.localdomain (unknown [182.195.42.154]) by epcas5p3.samsung.com (KnoxPortal) with ESMTPS id 20250626023710epcas5p39d882046df964a98f0d8b617fd5ee19b~MdzZVCw8l0375103751epcas5p3P; Thu, 26 Jun 2025 02:37:10 +0000 (GMT) Received: from epcas5p3.samsung.com (unknown [182.195.38.174]) by epsnrtp02.localdomain (Postfix) with ESMTP id 4bSNBD4NG5z2SSKp; Thu, 26 Jun 2025 02:37:08 +0000 (GMT) Received: from epsmtip2.samsung.com (unknown [182.195.34.31]) by epcas5p1.samsung.com (KnoxPortal) with ESMTPA id 20250625165248epcas5p10eefe9e1f1a89806793c86decc63f232~MV1LrOioV0885408854epcas5p1q; Wed, 25 Jun 2025 16:52:48 +0000 (GMT) Received: from cheetah.samsungds.net (unknown [107.109.115.53]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20250625165245epsmtip2600318736a6844f4c5dc7f7cecffc09a~MV1I11UW71750817508epsmtip2G; Wed, 25 Jun 2025 16:52:45 +0000 (GMT) From: Shradha Todi To: linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-fsd@tesla.com Cc: manivannan.sadhasivam@linaro.org, lpieralisi@kernel.org, kw@linux.com, robh@kernel.org, bhelgaas@google.com, jingoohan1@gmail.com, krzk+dt@kernel.org, conor+dt@kernel.org, alim.akhtar@samsung.com, vkoul@kernel.org, kishon@kernel.org, arnd@arndb.de, m.szyprowski@samsung.com, jh80.chung@samsung.com, pankaj.dubey@samsung.com, Shradha Todi , Hrishikesh Dileep Subject: [PATCH v2 01/10] PCI: exynos: Remove unused MACROs in exynos PCI file Date: Wed, 25 Jun 2025 22:22:20 +0530 Message-ID: <20250625165229.3458-2-shradha.t@samsung.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250625165229.3458-1-shradha.t@samsung.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CMS-MailID: 20250625165248epcas5p10eefe9e1f1a89806793c86decc63f232 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P cpgsPolicy: CPGSC10-541,Y X-CFilter-Loop: Reflected X-CMS-RootMailID: 20250625165248epcas5p10eefe9e1f1a89806793c86decc63f232 References: <20250625165229.3458-1-shradha.t@samsung.com> Some MACROs are defined in the exynos PCI file but are not used anywhere within the file. Remove such unused MACROs. Suggested-by: Hrishikesh Dileep Signed-off-by: Shradha Todi --- drivers/pci/controller/dwc/pci-exynos.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-exynos.c b/drivers/pci/controll= er/dwc/pci-exynos.c index 1f0e98d07109..f9140d1f1d19 100644 --- a/drivers/pci/controller/dwc/pci-exynos.c +++ b/drivers/pci/controller/dwc/pci-exynos.c @@ -31,8 +31,6 @@ #define IRQ_INTB_ASSERT BIT(2) #define IRQ_INTC_ASSERT BIT(4) #define IRQ_INTD_ASSERT BIT(6) -#define PCIE_IRQ_LEVEL 0x004 -#define PCIE_IRQ_SPECIAL 0x008 #define PCIE_IRQ_EN_PULSE 0x00c #define PCIE_IRQ_EN_LEVEL 0x010 #define PCIE_IRQ_EN_SPECIAL 0x014 --=20 2.49.0 From nobody Wed Oct 8 17:35:00 2025 Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 30AA220DD49 for ; Thu, 26 Jun 2025 02:37:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.254.224.25 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750905442; cv=none; b=F2tvrCzLak9+2ekSBG1cx1E7VcWJx/P2P4R5JRJWovMJON4EHMlir1qMs98/J2P2tiL0jeMM6h3AkuzmV3ds8Pebh/ADMCOxB5kKu0cpWhlkiq5ebiLM7ghgnEvutPzj0k5B5P5GiQOYmx9x11aFb4/zLuPFyru7O6H3z9CGfkU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750905442; c=relaxed/simple; bh=6GNeoJ86xp9/K5fVFW+3oK5Y3XHOLyG/PGdbDUgut3Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:MIME-Version: Content-Type:References; b=gAw0UEol0FbhUomufMPpQx3ru/rbR2ymAzkgUIkvdsA+ESzcF4sfd5otXYAQN8TkK7DthMeMZLuCXX1YjLbS+PDcGhsE2nPwn6klgu7g9aGenBp7ZGmMHnltDOzFeTycksr1YaST9KMToR4Z59xmz1Q9ZItqOFvW2kyKHbbfhXI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=VXNMenJI; arc=none smtp.client-ip=203.254.224.25 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="VXNMenJI" Received: from epcas5p1.samsung.com (unknown [182.195.41.39]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20250626023718epoutp02cc6c774f50c8c2cc85a38c16167984ce~MdzgthzFO2347023470epoutp02f for ; Thu, 26 Jun 2025 02:37:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20250626023718epoutp02cc6c774f50c8c2cc85a38c16167984ce~MdzgthzFO2347023470epoutp02f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1750905438; bh=g+OIPYfZeep00nAL2s8vJenk/L6kOEW7w/EsYvIr9eI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VXNMenJIMx5+xG8NohxrpSAO33aVtNRRHrIcquS+8z7MAUHvHM/bFaZDWZ8nfUl1V tC0ALnjLAQknWAu0XGJ9ZzC1FXjhAmp61GwDd/rMt3y8ZH1ydLDFr3mDhft1IOSRrU i8Nb/hjnwg80KdLCBF0ecWu9eYlfcCugmGqvlaYw= Received: from epsnrtp01.localdomain (unknown [182.195.42.153]) by epcas5p3.samsung.com (KnoxPortal) with ESMTPS id 20250626023716epcas5p36f90d0072dc6d12c4fd023939252fae1~MdzfSeBX_2141821418epcas5p3J; Thu, 26 Jun 2025 02:37:16 +0000 (GMT) Received: from epcas5p2.samsung.com (unknown [182.195.38.182]) by epsnrtp01.localdomain (Postfix) with ESMTP id 4bSNBL6g1Jz6B9m5; Thu, 26 Jun 2025 02:37:14 +0000 (GMT) Received: from epsmtip2.samsung.com (unknown [182.195.34.31]) by epcas5p1.samsung.com (KnoxPortal) with ESMTPA id 20250625165253epcas5p1339d784e500ad629a64fb4aad792e79b~MV1QRhrYl1882518825epcas5p1G; Wed, 25 Jun 2025 16:52:53 +0000 (GMT) Received: from cheetah.samsungds.net (unknown [107.109.115.53]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20250625165250epsmtip25b5a4bc922868c6b29c076fe0c85e2a5~MV1NiL1kB1237712377epsmtip2e; Wed, 25 Jun 2025 16:52:50 +0000 (GMT) From: Shradha Todi To: linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-fsd@tesla.com Cc: manivannan.sadhasivam@linaro.org, lpieralisi@kernel.org, kw@linux.com, robh@kernel.org, bhelgaas@google.com, jingoohan1@gmail.com, krzk+dt@kernel.org, conor+dt@kernel.org, alim.akhtar@samsung.com, vkoul@kernel.org, kishon@kernel.org, arnd@arndb.de, m.szyprowski@samsung.com, jh80.chung@samsung.com, pankaj.dubey@samsung.com, Shradha Todi Subject: [PATCH v2 02/10] PCI: exynos: Change macro names to exynos specific Date: Wed, 25 Jun 2025 22:22:21 +0530 Message-ID: <20250625165229.3458-3-shradha.t@samsung.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250625165229.3458-1-shradha.t@samsung.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CMS-MailID: 20250625165253epcas5p1339d784e500ad629a64fb4aad792e79b X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P cpgsPolicy: CPGSC10-541,Y X-CFilter-Loop: Reflected X-CMS-RootMailID: 20250625165253epcas5p1339d784e500ad629a64fb4aad792e79b References: <20250625165229.3458-1-shradha.t@samsung.com> Prefix macro names in exynos file with the term "EXYNOS" as the current macro names seem to be generic to PCIe. Signed-off-by: Shradha Todi --- drivers/pci/controller/dwc/pci-exynos.c | 112 ++++++++++++------------ 1 file changed, 56 insertions(+), 56 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-exynos.c b/drivers/pci/controll= er/dwc/pci-exynos.c index f9140d1f1d19..30d12ff9b0c6 100644 --- a/drivers/pci/controller/dwc/pci-exynos.c +++ b/drivers/pci/controller/dwc/pci-exynos.c @@ -26,28 +26,28 @@ #define to_exynos_pcie(x) dev_get_drvdata((x)->dev) =20 /* PCIe ELBI registers */ -#define PCIE_IRQ_PULSE 0x000 -#define IRQ_INTA_ASSERT BIT(0) -#define IRQ_INTB_ASSERT BIT(2) -#define IRQ_INTC_ASSERT BIT(4) -#define IRQ_INTD_ASSERT BIT(6) -#define PCIE_IRQ_EN_PULSE 0x00c -#define PCIE_IRQ_EN_LEVEL 0x010 -#define PCIE_IRQ_EN_SPECIAL 0x014 -#define PCIE_SW_WAKE 0x018 -#define PCIE_BUS_EN BIT(1) -#define PCIE_CORE_RESET 0x01c -#define PCIE_CORE_RESET_ENABLE BIT(0) -#define PCIE_STICKY_RESET 0x020 -#define PCIE_NONSTICKY_RESET 0x024 -#define PCIE_APP_INIT_RESET 0x028 -#define PCIE_APP_LTSSM_ENABLE 0x02c -#define PCIE_ELBI_RDLH_LINKUP 0x074 -#define PCIE_ELBI_XMLH_LINKUP BIT(4) -#define PCIE_ELBI_LTSSM_ENABLE 0x1 -#define PCIE_ELBI_SLV_AWMISC 0x11c -#define PCIE_ELBI_SLV_ARMISC 0x120 -#define PCIE_ELBI_SLV_DBI_ENABLE BIT(21) +#define EXYNOS_PCIE_IRQ_PULSE 0x000 +#define EXYNOS_IRQ_INTA_ASSERT BIT(0) +#define EXYNOS_IRQ_INTB_ASSERT BIT(2) +#define EXYNOS_IRQ_INTC_ASSERT BIT(4) +#define EXYNOS_IRQ_INTD_ASSERT BIT(6) +#define EXYNOS_PCIE_IRQ_EN_PULSE 0x00c +#define EXYNOS_PCIE_IRQ_EN_LEVEL 0x010 +#define EXYNOS_PCIE_IRQ_EN_SPECIAL 0x014 +#define EXYNOS_PCIE_SW_WAKE 0x018 +#define EXYNOS_PCIE_BUS_EN BIT(1) +#define EXYNOS_PCIE_CORE_RESET 0x01c +#define EXYNOS_PCIE_CORE_RESET_ENABLE BIT(0) +#define EXYNOS_PCIE_STICKY_RESET 0x020 +#define EXYNOS_PCIE_NONSTICKY_RESET 0x024 +#define EXYNOS_PCIE_APP_INIT_RESET 0x028 +#define EXYNOS_PCIE_APP_LTSSM_ENABLE 0x02c +#define EXYNOS_PCIE_ELBI_RDLH_LINKUP 0x074 +#define EXYNOS_PCIE_ELBI_XMLH_LINKUP BIT(4) +#define EXYNOS_PCIE_ELBI_LTSSM_ENABLE 0x1 +#define EXYNOS_PCIE_ELBI_SLV_AWMISC 0x11c +#define EXYNOS_PCIE_ELBI_SLV_ARMISC 0x120 +#define EXYNOS_PCIE_ELBI_SLV_DBI_ENABLE BIT(21) =20 struct exynos_pcie { struct dw_pcie pci; @@ -71,49 +71,49 @@ static void exynos_pcie_sideband_dbi_w_mode(struct exyn= os_pcie *ep, bool on) { u32 val; =20 - val =3D exynos_pcie_readl(ep->elbi_base, PCIE_ELBI_SLV_AWMISC); + val =3D exynos_pcie_readl(ep->elbi_base, EXYNOS_PCIE_ELBI_SLV_AWMISC); if (on) - val |=3D PCIE_ELBI_SLV_DBI_ENABLE; + val |=3D EXYNOS_PCIE_ELBI_SLV_DBI_ENABLE; else - val &=3D ~PCIE_ELBI_SLV_DBI_ENABLE; - exynos_pcie_writel(ep->elbi_base, val, PCIE_ELBI_SLV_AWMISC); + val &=3D ~EXYNOS_PCIE_ELBI_SLV_DBI_ENABLE; + exynos_pcie_writel(ep->elbi_base, val, EXYNOS_PCIE_ELBI_SLV_AWMISC); } =20 static void exynos_pcie_sideband_dbi_r_mode(struct exynos_pcie *ep, bool o= n) { u32 val; =20 - val =3D exynos_pcie_readl(ep->elbi_base, PCIE_ELBI_SLV_ARMISC); + val =3D exynos_pcie_readl(ep->elbi_base, EXYNOS_PCIE_ELBI_SLV_ARMISC); if (on) - val |=3D PCIE_ELBI_SLV_DBI_ENABLE; + val |=3D EXYNOS_PCIE_ELBI_SLV_DBI_ENABLE; else - val &=3D ~PCIE_ELBI_SLV_DBI_ENABLE; - exynos_pcie_writel(ep->elbi_base, val, PCIE_ELBI_SLV_ARMISC); + val &=3D ~EXYNOS_PCIE_ELBI_SLV_DBI_ENABLE; + exynos_pcie_writel(ep->elbi_base, val, EXYNOS_PCIE_ELBI_SLV_ARMISC); } =20 static void exynos_pcie_assert_core_reset(struct exynos_pcie *ep) { u32 val; =20 - val =3D exynos_pcie_readl(ep->elbi_base, PCIE_CORE_RESET); - val &=3D ~PCIE_CORE_RESET_ENABLE; - exynos_pcie_writel(ep->elbi_base, val, PCIE_CORE_RESET); - exynos_pcie_writel(ep->elbi_base, 0, PCIE_STICKY_RESET); - exynos_pcie_writel(ep->elbi_base, 0, PCIE_NONSTICKY_RESET); + val =3D exynos_pcie_readl(ep->elbi_base, EXYNOS_PCIE_CORE_RESET); + val &=3D ~EXYNOS_PCIE_CORE_RESET_ENABLE; + exynos_pcie_writel(ep->elbi_base, val, EXYNOS_PCIE_CORE_RESET); + exynos_pcie_writel(ep->elbi_base, 0, EXYNOS_PCIE_STICKY_RESET); + exynos_pcie_writel(ep->elbi_base, 0, EXYNOS_PCIE_NONSTICKY_RESET); } =20 static void exynos_pcie_deassert_core_reset(struct exynos_pcie *ep) { u32 val; =20 - val =3D exynos_pcie_readl(ep->elbi_base, PCIE_CORE_RESET); - val |=3D PCIE_CORE_RESET_ENABLE; + val =3D exynos_pcie_readl(ep->elbi_base, EXYNOS_PCIE_CORE_RESET); + val |=3D EXYNOS_PCIE_CORE_RESET_ENABLE; =20 - exynos_pcie_writel(ep->elbi_base, val, PCIE_CORE_RESET); - exynos_pcie_writel(ep->elbi_base, 1, PCIE_STICKY_RESET); - exynos_pcie_writel(ep->elbi_base, 1, PCIE_NONSTICKY_RESET); - exynos_pcie_writel(ep->elbi_base, 1, PCIE_APP_INIT_RESET); - exynos_pcie_writel(ep->elbi_base, 0, PCIE_APP_INIT_RESET); + exynos_pcie_writel(ep->elbi_base, val, EXYNOS_PCIE_CORE_RESET); + exynos_pcie_writel(ep->elbi_base, 1, EXYNOS_PCIE_STICKY_RESET); + exynos_pcie_writel(ep->elbi_base, 1, EXYNOS_PCIE_NONSTICKY_RESET); + exynos_pcie_writel(ep->elbi_base, 1, EXYNOS_PCIE_APP_INIT_RESET); + exynos_pcie_writel(ep->elbi_base, 0, EXYNOS_PCIE_APP_INIT_RESET); } =20 static int exynos_pcie_start_link(struct dw_pcie *pci) @@ -121,21 +121,21 @@ static int exynos_pcie_start_link(struct dw_pcie *pci) struct exynos_pcie *ep =3D to_exynos_pcie(pci); u32 val; =20 - val =3D exynos_pcie_readl(ep->elbi_base, PCIE_SW_WAKE); - val &=3D ~PCIE_BUS_EN; - exynos_pcie_writel(ep->elbi_base, val, PCIE_SW_WAKE); + val =3D exynos_pcie_readl(ep->elbi_base, EXYNOS_PCIE_SW_WAKE); + val &=3D ~EXYNOS_PCIE_BUS_EN; + exynos_pcie_writel(ep->elbi_base, val, EXYNOS_PCIE_SW_WAKE); =20 /* assert LTSSM enable */ - exynos_pcie_writel(ep->elbi_base, PCIE_ELBI_LTSSM_ENABLE, - PCIE_APP_LTSSM_ENABLE); + exynos_pcie_writel(ep->elbi_base, EXYNOS_PCIE_ELBI_LTSSM_ENABLE, + EXYNOS_PCIE_APP_LTSSM_ENABLE); return 0; } =20 static void exynos_pcie_clear_irq_pulse(struct exynos_pcie *ep) { - u32 val =3D exynos_pcie_readl(ep->elbi_base, PCIE_IRQ_PULSE); + u32 val =3D exynos_pcie_readl(ep->elbi_base, EXYNOS_PCIE_IRQ_PULSE); =20 - exynos_pcie_writel(ep->elbi_base, val, PCIE_IRQ_PULSE); + exynos_pcie_writel(ep->elbi_base, val, EXYNOS_PCIE_IRQ_PULSE); } =20 static irqreturn_t exynos_pcie_irq_handler(int irq, void *arg) @@ -148,12 +148,12 @@ static irqreturn_t exynos_pcie_irq_handler(int irq, v= oid *arg) =20 static void exynos_pcie_enable_irq_pulse(struct exynos_pcie *ep) { - u32 val =3D IRQ_INTA_ASSERT | IRQ_INTB_ASSERT | - IRQ_INTC_ASSERT | IRQ_INTD_ASSERT; + u32 val =3D EXYNOS_IRQ_INTA_ASSERT | EXYNOS_IRQ_INTB_ASSERT | + EXYNOS_IRQ_INTC_ASSERT | EXYNOS_IRQ_INTD_ASSERT; =20 - exynos_pcie_writel(ep->elbi_base, val, PCIE_IRQ_EN_PULSE); - exynos_pcie_writel(ep->elbi_base, 0, PCIE_IRQ_EN_LEVEL); - exynos_pcie_writel(ep->elbi_base, 0, PCIE_IRQ_EN_SPECIAL); + exynos_pcie_writel(ep->elbi_base, val, EXYNOS_PCIE_IRQ_EN_PULSE); + exynos_pcie_writel(ep->elbi_base, 0, EXYNOS_PCIE_IRQ_EN_LEVEL); + exynos_pcie_writel(ep->elbi_base, 0, EXYNOS_PCIE_IRQ_EN_SPECIAL); } =20 static u32 exynos_pcie_read_dbi(struct dw_pcie *pci, void __iomem *base, @@ -210,9 +210,9 @@ static struct pci_ops exynos_pci_ops =3D { static bool exynos_pcie_link_up(struct dw_pcie *pci) { struct exynos_pcie *ep =3D to_exynos_pcie(pci); - u32 val =3D exynos_pcie_readl(ep->elbi_base, PCIE_ELBI_RDLH_LINKUP); + u32 val =3D exynos_pcie_readl(ep->elbi_base, EXYNOS_PCIE_ELBI_RDLH_LINKUP= ); =20 - return val & PCIE_ELBI_XMLH_LINKUP; + return val & EXYNOS_PCIE_ELBI_XMLH_LINKUP; } =20 static int exynos_pcie_host_init(struct dw_pcie_rp *pp) --=20 2.49.0 From nobody Wed Oct 8 17:35:00 2025 Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E72AB202F87 for ; Thu, 26 Jun 2025 02:37:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.254.224.25 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750905451; cv=none; b=rD5UKkJh27IoSMSGfwEi34ORlNr278l01GJkTriY2pfKftZ6NL7AURqMFC+ZNKFOmxdujn72RSqPk/AsMMlY/RkVa0l7oW78uaqQUfdZ1pu4tuhQ8RlCNDc8Ll4cvYgjSriY+pTSHlEnjxtGlCoYpLYYiEGdgWwoJp1Wbn+Jet8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750905451; c=relaxed/simple; bh=yWtCCxpMNPD3uS3Bi7H/Hp18Cho/E9Z77Yln+Cm21OE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:MIME-Version: Content-Type:References; b=qApU/TleyUw74cRWKnxnLj+hwDsKh7OXgT4y8QizjcboW/brXLvf2B7dXSNq3zlbGP/EJjOHKQ5gYWqJElzQuZnvd2BWZxJs91yWR80pA5sxoClaacZBcTDuCo0UWhf2zwyPrBMAYccDAUpC1KhQh6TBz1GMYFgaZh9As81uwYM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=XFthsoYh; arc=none smtp.client-ip=203.254.224.25 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="XFthsoYh" Received: from epcas5p4.samsung.com (unknown [182.195.41.42]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20250626023723epoutp02a5d951bf4ef34e4c61129c81cd51d319~MdzlGUFdT2366123661epoutp02S for ; Thu, 26 Jun 2025 02:37:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20250626023723epoutp02a5d951bf4ef34e4c61129c81cd51d319~MdzlGUFdT2366123661epoutp02S DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1750905443; bh=9jzUBK4rfaWiMXa828Ff+bfipS/KVj9eyi+oP2TMhHY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XFthsoYhxPVBZGIn4ijlvQNek8TKNJelMJMeyFEhhavzpoDc6kfiWhcdk6fyYZD8Q Ytevyj9Q2Codlab+gL6zX33Mizb1yq3jMlSvBZrNK9pHUC4063pb/9XAznWFoLVELO vfr4QYNoAkg4dkU7UMdM+3pUAKdb7EYwajTNg0hM= Received: from epsnrtp04.localdomain (unknown [182.195.42.156]) by epcas5p3.samsung.com (KnoxPortal) with ESMTPS id 20250626023722epcas5p36a5140741b9bd88cc7b90a44f9c9d3a8~MdzkMXEq-0375103751epcas5p34; Thu, 26 Jun 2025 02:37:22 +0000 (GMT) Received: from epcas5p4.samsung.com (unknown [182.195.38.179]) by epsnrtp04.localdomain (Postfix) with ESMTP id 4bSNBR5LsWz6B9m7; Thu, 26 Jun 2025 02:37:19 +0000 (GMT) Received: from epsmtip2.samsung.com (unknown [182.195.34.31]) by epcas5p4.samsung.com (KnoxPortal) with ESMTPA id 20250625165258epcas5p4ddbbcfa60703f3682b94ae4eb814da7e~MV1UxW_BP0913509135epcas5p4s; Wed, 25 Jun 2025 16:52:58 +0000 (GMT) Received: from cheetah.samsungds.net (unknown [107.109.115.53]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20250625165255epsmtip289f7380990344ec0cb7618be15119205~MV1R5dbAo1750917509epsmtip2I; Wed, 25 Jun 2025 16:52:55 +0000 (GMT) From: Shradha Todi To: linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-fsd@tesla.com Cc: manivannan.sadhasivam@linaro.org, lpieralisi@kernel.org, kw@linux.com, robh@kernel.org, bhelgaas@google.com, jingoohan1@gmail.com, krzk+dt@kernel.org, conor+dt@kernel.org, alim.akhtar@samsung.com, vkoul@kernel.org, kishon@kernel.org, arnd@arndb.de, m.szyprowski@samsung.com, jh80.chung@samsung.com, pankaj.dubey@samsung.com, Shradha Todi , Hrishikesh Dileep Subject: [PATCH v2 03/10] PCI: exynos: Reorder MACROs to maintain consistency Date: Wed, 25 Jun 2025 22:22:22 +0530 Message-ID: <20250625165229.3458-4-shradha.t@samsung.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250625165229.3458-1-shradha.t@samsung.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CMS-MailID: 20250625165258epcas5p4ddbbcfa60703f3682b94ae4eb814da7e X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P cpgsPolicy: CPGSC10-541,Y X-CFilter-Loop: Reflected X-CMS-RootMailID: 20250625165258epcas5p4ddbbcfa60703f3682b94ae4eb814da7e References: <20250625165229.3458-1-shradha.t@samsung.com> Exynos PCI file follows MACRO definition order where register offset is defined in ascending order and each bit field within the offset is defined right after offset definition. Some MACROs are out of order and so reorder those MACROs to maintain consistency. Suggested-by: Hrishikesh Dileep Signed-off-by: Shradha Todi --- drivers/pci/controller/dwc/pci-exynos.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-exynos.c b/drivers/pci/controll= er/dwc/pci-exynos.c index 30d12ff9b0c6..b4ec167b0583 100644 --- a/drivers/pci/controller/dwc/pci-exynos.c +++ b/drivers/pci/controller/dwc/pci-exynos.c @@ -27,11 +27,11 @@ =20 /* PCIe ELBI registers */ #define EXYNOS_PCIE_IRQ_PULSE 0x000 +#define EXYNOS_PCIE_IRQ_EN_PULSE 0x00c #define EXYNOS_IRQ_INTA_ASSERT BIT(0) #define EXYNOS_IRQ_INTB_ASSERT BIT(2) #define EXYNOS_IRQ_INTC_ASSERT BIT(4) #define EXYNOS_IRQ_INTD_ASSERT BIT(6) -#define EXYNOS_PCIE_IRQ_EN_PULSE 0x00c #define EXYNOS_PCIE_IRQ_EN_LEVEL 0x010 #define EXYNOS_PCIE_IRQ_EN_SPECIAL 0x014 #define EXYNOS_PCIE_SW_WAKE 0x018 @@ -42,9 +42,9 @@ #define EXYNOS_PCIE_NONSTICKY_RESET 0x024 #define EXYNOS_PCIE_APP_INIT_RESET 0x028 #define EXYNOS_PCIE_APP_LTSSM_ENABLE 0x02c +#define EXYNOS_PCIE_ELBI_LTSSM_ENABLE 0x1 #define EXYNOS_PCIE_ELBI_RDLH_LINKUP 0x074 #define EXYNOS_PCIE_ELBI_XMLH_LINKUP BIT(4) -#define EXYNOS_PCIE_ELBI_LTSSM_ENABLE 0x1 #define EXYNOS_PCIE_ELBI_SLV_AWMISC 0x11c #define EXYNOS_PCIE_ELBI_SLV_ARMISC 0x120 #define EXYNOS_PCIE_ELBI_SLV_DBI_ENABLE BIT(21) --=20 2.49.0 From nobody Wed Oct 8 17:35:00 2025 Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 59492202C5D for ; Thu, 26 Jun 2025 02:37:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.254.224.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750905451; cv=none; b=QFAehLqkXap5EwjD5l+J5X525VsJkmllAvTpZDv75slKKAMnwHXnZGodACEAwiaap/5XTD90YyFpL//LJY9eCNJBEU3B6AMYq5Z8SP0A+qn3x3cxoL+zVS4wEVOJ862iwCmnXi8Zea+Fbv/ijBuv8mDyYTbCN77d77DxdK3YP04= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750905451; c=relaxed/simple; bh=4E/O2MffaVbZtLs8LTBh1jaRthJzsoiP+MZapckqc4Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:MIME-Version: Content-Type:References; b=Uyif421l8LQBozFGFGEEFpm2xnPvA6LiNZAdiOvqk/e/yYvUMqyvjOCISMJX2FBZN+OQs5nEEH3T6PtTjl0pX2xs/C/D7Px/NXGd012C51EBdG3tNBj1vQptghvkS1BBKmC7imsgfy4rnDomO17k80YGb7KvRVlGl7/sX8S6o60= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=GKoFCgME; arc=none smtp.client-ip=203.254.224.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="GKoFCgME" Received: from epcas5p4.samsung.com (unknown [182.195.41.42]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20250626023727epoutp0417a6b5ccc6e17f5e9ed25c8d053bc374~Mdzpgwkje2534825348epoutp04i for ; Thu, 26 Jun 2025 02:37:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20250626023727epoutp0417a6b5ccc6e17f5e9ed25c8d053bc374~Mdzpgwkje2534825348epoutp04i DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1750905447; bh=oCjJPMBrsTZ0lEVw44tKYRd0FGCL7YY4EZJtpYnUOU8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GKoFCgMExCp/ExtL6ZnZ6QOuaMr0cMoKy0Dt/N29oM7zDG93zhnTcDf7cCaz15quv X1Vr30+qBqpmwqgpC48+ZGURg4F+3Knt0MUCgPr2GnCTj8+LXaMtVNNQ6y/hSQglEA QFZhsKPurwyxVdMcuMkoiEgTyRmBcgw1pkPJqZ5A= Received: from epsnrtp03.localdomain (unknown [182.195.42.155]) by epcas5p4.samsung.com (KnoxPortal) with ESMTPS id 20250626023726epcas5p4afb783bf2def49582295a91ff5c3983c~MdzozS-At0277702777epcas5p4R; Thu, 26 Jun 2025 02:37:26 +0000 (GMT) Received: from epcas5p1.samsung.com (unknown [182.195.38.183]) by epsnrtp03.localdomain (Postfix) with ESMTP id 4bSNBY0kQTz3hhT9; Thu, 26 Jun 2025 02:37:25 +0000 (GMT) Received: from epsmtip2.samsung.com (unknown [182.195.34.31]) by epcas5p3.samsung.com (KnoxPortal) with ESMTPA id 20250625165305epcas5p31ee49285a57e2fb88a005ec1dfed4199~MV1bs_I-z0056800568epcas5p3N; Wed, 25 Jun 2025 16:53:05 +0000 (GMT) Received: from cheetah.samsungds.net (unknown [107.109.115.53]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20250625165303epsmtip25d7b64d4dc2f8317a860099aa1b13b66~MV1Y9u-jp1746917469epsmtip2O; Wed, 25 Jun 2025 16:53:02 +0000 (GMT) From: Shradha Todi To: linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-fsd@tesla.com Cc: manivannan.sadhasivam@linaro.org, lpieralisi@kernel.org, kw@linux.com, robh@kernel.org, bhelgaas@google.com, jingoohan1@gmail.com, krzk+dt@kernel.org, conor+dt@kernel.org, alim.akhtar@samsung.com, vkoul@kernel.org, kishon@kernel.org, arnd@arndb.de, m.szyprowski@samsung.com, jh80.chung@samsung.com, pankaj.dubey@samsung.com, Shradha Todi Subject: [PATCH v2 04/10] PCI: exynos: Add platform device private data Date: Wed, 25 Jun 2025 22:22:23 +0530 Message-ID: <20250625165229.3458-5-shradha.t@samsung.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250625165229.3458-1-shradha.t@samsung.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CMS-MailID: 20250625165305epcas5p31ee49285a57e2fb88a005ec1dfed4199 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P cpgsPolicy: CPGSC10-541,Y X-CFilter-Loop: Reflected X-CMS-RootMailID: 20250625165305epcas5p31ee49285a57e2fb88a005ec1dfed4199 References: <20250625165229.3458-1-shradha.t@samsung.com> In order to extend this driver to all Samsung manufactured SoCs having DWC PCIe controller, add private data structure which will hold platform device specific information. It holds function ops like DWC host ops, DWC generic ops, and PCI read/write ops which will be used as driver data for different compatibles. Suggested-by: Pankaj Dubey Signed-off-by: Shradha Todi --- drivers/pci/controller/dwc/pci-exynos.c | 32 ++++++++++++++++++++----- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-exynos.c b/drivers/pci/controll= er/dwc/pci-exynos.c index b4ec167b0583..c830b20d54f0 100644 --- a/drivers/pci/controller/dwc/pci-exynos.c +++ b/drivers/pci/controller/dwc/pci-exynos.c @@ -49,9 +49,16 @@ #define EXYNOS_PCIE_ELBI_SLV_ARMISC 0x120 #define EXYNOS_PCIE_ELBI_SLV_DBI_ENABLE BIT(21) =20 +struct samsung_pcie_pdata { + struct pci_ops *pci_ops; + const struct dw_pcie_ops *dwc_ops; + const struct dw_pcie_host_ops *host_ops; +}; + struct exynos_pcie { struct dw_pcie pci; void __iomem *elbi_base; + const struct samsung_pcie_pdata *pdata; struct clk_bulk_data *clks; struct phy *phy; struct regulator_bulk_data supplies[2]; @@ -220,7 +227,7 @@ static int exynos_pcie_host_init(struct dw_pcie_rp *pp) struct dw_pcie *pci =3D to_dw_pcie_from_pp(pp); struct exynos_pcie *ep =3D to_exynos_pcie(pci); =20 - pp->bridge->ops =3D &exynos_pci_ops; + pp->bridge->ops =3D ep->pdata->pci_ops; =20 exynos_pcie_assert_core_reset(ep); =20 @@ -268,7 +275,7 @@ static int exynos_add_pcie_port(struct exynos_pcie *ep, return 0; } =20 -static const struct dw_pcie_ops dw_pcie_ops =3D { +static const struct dw_pcie_ops exynos_dw_pcie_ops =3D { .read_dbi =3D exynos_pcie_read_dbi, .write_dbi =3D exynos_pcie_write_dbi, .link_up =3D exynos_pcie_link_up, @@ -279,6 +286,7 @@ static int exynos_pcie_probe(struct platform_device *pd= ev) { struct device *dev =3D &pdev->dev; struct exynos_pcie *ep; + const struct samsung_pcie_pdata *pdata; struct device_node *np =3D dev->of_node; int ret; =20 @@ -286,8 +294,11 @@ static int exynos_pcie_probe(struct platform_device *p= dev) if (!ep) return -ENOMEM; =20 + pdata =3D of_device_get_match_data(dev); + + ep->pdata =3D pdata; ep->pci.dev =3D dev; - ep->pci.ops =3D &dw_pcie_ops; + ep->pci.ops =3D pdata->dwc_ops; =20 ep->phy =3D devm_of_phy_get(dev, np, NULL); if (IS_ERR(ep->phy)) @@ -363,9 +374,9 @@ static int exynos_pcie_resume_noirq(struct device *dev) return ret; =20 /* exynos_pcie_host_init controls ep->phy */ - exynos_pcie_host_init(pp); + ep->pdata->host_ops->init(pp); dw_pcie_setup_rc(pp); - exynos_pcie_start_link(pci); + ep->pdata->dwc_ops->start_link(pci); return dw_pcie_wait_for_link(pci); } =20 @@ -374,8 +385,17 @@ static const struct dev_pm_ops exynos_pcie_pm_ops =3D { exynos_pcie_resume_noirq) }; =20 +static const struct samsung_pcie_pdata exynos_5433_pcie_rc_pdata =3D { + .dwc_ops =3D &exynos_dw_pcie_ops, + .pci_ops =3D &exynos_pci_ops, + .host_ops =3D &exynos_pcie_host_ops, +}; + static const struct of_device_id exynos_pcie_of_match[] =3D { - { .compatible =3D "samsung,exynos5433-pcie", }, + { + .compatible =3D "samsung,exynos5433-pcie", + .data =3D (void *) &exynos_5433_pcie_rc_pdata, + }, { }, }; =20 --=20 2.49.0 From nobody Wed Oct 8 17:35:00 2025 Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C899F205502 for ; Thu, 26 Jun 2025 02:37:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.254.224.24 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750905455; cv=none; b=UHPOBIGjGIePFgPXuQwsT7uKrGV/zVZ86CxPTmRaDPFVtXUAf9eXcr5JrQIoiB41Vgpx9owihDSoww1JaSN95CIskdpeJYoQn4nj1sOZTlKRdJUA7PHcFXcLlw65OCJFx7SoE20BhkWHRH8YtalnDhH4uFAYB0myMeLVZFegLP4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750905455; c=relaxed/simple; bh=WSPPML++0eSSbjEMvDjG3YKUv1CCcpHHMn+xrzrL/Us=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:MIME-Version: Content-Type:References; b=uz2L1zzlABMPTpFIO2iEMbsown+c26zlh2GTapUfSDZkqL/KjEUH1CFEsRyCm7CS6/lGPVbbYURGwR3lPeGN5UQTNTuGPkI/bgN9cjyChPDnInTRzobL4daYIAJfhtKbttRYPTgN3pYq2XJoppf115UzgVxcWMxTHZ+O5SaLOGM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=A9lB/oBD; arc=none smtp.client-ip=203.254.224.24 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="A9lB/oBD" Received: from epcas5p3.samsung.com (unknown [182.195.41.41]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20250626023732epoutp01bea1d978544c08aadad22fcff2019de8~Mdzth4C_P0838208382epoutp013 for ; Thu, 26 Jun 2025 02:37:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20250626023732epoutp01bea1d978544c08aadad22fcff2019de8~Mdzth4C_P0838208382epoutp013 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1750905452; bh=l9qGtfCAfqVE0WOKa7kAuDvMc4B1ZagJkSejcEl/C5s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A9lB/oBD6QzzQ0gHMWOcUsIEz70ZdG5AZW4BOL+fqHo6oFfidH6U6zMVOtvOKqzZ4 cUVjYiyu/np18lwn7Ej0N7d4EO6KPe7j/Ukk4IoS35VUaLwBS/A1Shfo7xAvuOIzl+ EPsA/mFZVkAW50ZxD7Phv17zmEQz15yToZ6a5v7k= Received: from epsnrtp01.localdomain (unknown [182.195.42.153]) by epcas5p2.samsung.com (KnoxPortal) with ESMTPS id 20250626023731epcas5p2090032a1aeead99bcf840008f9ccbc08~MdzszrYwu2492224922epcas5p2A; Thu, 26 Jun 2025 02:37:31 +0000 (GMT) Received: from epcas5p2.samsung.com (unknown [182.195.38.183]) by epsnrtp01.localdomain (Postfix) with ESMTP id 4bSNBd2NPVz6B9m5; Thu, 26 Jun 2025 02:37:29 +0000 (GMT) Received: from epsmtip2.samsung.com (unknown [182.195.34.31]) by epcas5p3.samsung.com (KnoxPortal) with ESMTPA id 20250625165310epcas5p309194787ad2c6ac45da32240a8c86c28~MV1gUhs2x0056800568epcas5p3Q; Wed, 25 Jun 2025 16:53:10 +0000 (GMT) Received: from cheetah.samsungds.net (unknown [107.109.115.53]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20250625165308epsmtip20f234903c48f742692610415b04810e6~MV1dlnG6T1741117411epsmtip2V; Wed, 25 Jun 2025 16:53:07 +0000 (GMT) From: Shradha Todi To: linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-fsd@tesla.com Cc: manivannan.sadhasivam@linaro.org, lpieralisi@kernel.org, kw@linux.com, robh@kernel.org, bhelgaas@google.com, jingoohan1@gmail.com, krzk+dt@kernel.org, conor+dt@kernel.org, alim.akhtar@samsung.com, vkoul@kernel.org, kishon@kernel.org, arnd@arndb.de, m.szyprowski@samsung.com, jh80.chung@samsung.com, pankaj.dubey@samsung.com, Shradha Todi Subject: [PATCH v2 05/10] PCI: exynos: Add structure to hold resource operations Date: Wed, 25 Jun 2025 22:22:24 +0530 Message-ID: <20250625165229.3458-6-shradha.t@samsung.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250625165229.3458-1-shradha.t@samsung.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CMS-MailID: 20250625165310epcas5p309194787ad2c6ac45da32240a8c86c28 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P cpgsPolicy: CPGSC10-541,Y X-CFilter-Loop: Reflected X-CMS-RootMailID: 20250625165310epcas5p309194787ad2c6ac45da32240a8c86c28 References: <20250625165229.3458-1-shradha.t@samsung.com> Some resources might differ based on platforms and we need platform specific functions to initialize or alter them. For better code re-usability, making a separate res_ops which will hold all such function pointers or other resource specific data. Also move common operations for host init into the probe sequence. Suggested-by: Pankaj Dubey Signed-off-by: Shradha Todi --- drivers/pci/controller/dwc/pci-exynos.c | 103 ++++++++++++++++++------ 1 file changed, 78 insertions(+), 25 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-exynos.c b/drivers/pci/controll= er/dwc/pci-exynos.c index c830b20d54f0..dff23cf648f5 100644 --- a/drivers/pci/controller/dwc/pci-exynos.c +++ b/drivers/pci/controller/dwc/pci-exynos.c @@ -53,6 +53,7 @@ struct samsung_pcie_pdata { struct pci_ops *pci_ops; const struct dw_pcie_ops *dwc_ops; const struct dw_pcie_host_ops *host_ops; + const struct samsung_res_ops *res_ops; }; =20 struct exynos_pcie { @@ -61,7 +62,13 @@ struct exynos_pcie { const struct samsung_pcie_pdata *pdata; struct clk_bulk_data *clks; struct phy *phy; - struct regulator_bulk_data supplies[2]; + struct regulator_bulk_data *supplies; + int supplies_cnt; +}; + +struct samsung_res_ops { + int (*init_regulator)(struct exynos_pcie *ep); + irqreturn_t (*pcie_irq_handler)(int irq, void *arg); }; =20 static void exynos_pcie_writel(void __iomem *base, u32 val, u32 reg) @@ -74,6 +81,31 @@ static u32 exynos_pcie_readl(void __iomem *base, u32 reg) return readl(base + reg); } =20 +static int samsung_regulator_enable(struct exynos_pcie *ep) +{ + int ret; + + if (ep->supplies_cnt =3D=3D 0) + return 0; + + ret =3D regulator_bulk_enable(ep->supplies_cnt, ep->supplies); + + return ret; +} + +static void samsung_regulator_disable(struct exynos_pcie *ep) +{ + struct device *dev =3D ep->pci.dev; + int ret; + + if (ep->supplies_cnt =3D=3D 0) + return; + + ret =3D regulator_bulk_disable(ep->supplies_cnt, ep->supplies); + if (ret) + dev_warn(dev, "failed to disable regulators: %d\n", ret); +} + static void exynos_pcie_sideband_dbi_w_mode(struct exynos_pcie *ep, bool o= n) { u32 val; @@ -244,7 +276,26 @@ static const struct dw_pcie_host_ops exynos_pcie_host_= ops =3D { .init =3D exynos_pcie_host_init, }; =20 -static int exynos_add_pcie_port(struct exynos_pcie *ep, +static int exynos_init_regulator(struct exynos_pcie *ep) +{ + struct device *dev =3D ep->pci.dev; + int ret =3D 0; + + ep->supplies_cnt =3D 2; + + ep->supplies =3D devm_kcalloc(dev, ep->supplies_cnt, sizeof(*ep->supplies= ), GFP_KERNEL); + if (!ep->supplies) + return -ENOMEM; + + ep->supplies[0].supply =3D "vdd18"; + ep->supplies[1].supply =3D "vdd10"; + + ret =3D devm_regulator_bulk_get(dev, ep->supplies_cnt, ep->supplies); + + return ret; +} + +static int samsung_irq_init(struct exynos_pcie *ep, struct platform_device *pdev) { struct dw_pcie *pci =3D &ep->pci; @@ -256,22 +307,15 @@ static int exynos_add_pcie_port(struct exynos_pcie *e= p, if (pp->irq < 0) return pp->irq; =20 - ret =3D devm_request_irq(dev, pp->irq, exynos_pcie_irq_handler, + ret =3D devm_request_irq(dev, pp->irq, ep->pdata->res_ops->pcie_irq_handl= er, IRQF_SHARED, "exynos-pcie", ep); if (ret) { dev_err(dev, "failed to request irq\n"); return ret; } =20 - pp->ops =3D &exynos_pcie_host_ops; pp->msi_irq[0] =3D -ENODEV; =20 - ret =3D dw_pcie_host_init(pp); - if (ret) { - dev_err(dev, "failed to initialize host\n"); - return ret; - } - return 0; } =20 @@ -282,6 +326,11 @@ static const struct dw_pcie_ops exynos_dw_pcie_ops =3D= { .start_link =3D exynos_pcie_start_link, }; =20 +static const struct samsung_res_ops exynos_res_ops_data =3D { + .init_regulator =3D exynos_init_regulator, + .pcie_irq_handler =3D exynos_pcie_irq_handler, +}; + static int exynos_pcie_probe(struct platform_device *pdev) { struct device *dev =3D &pdev->dev; @@ -313,28 +362,31 @@ static int exynos_pcie_probe(struct platform_device *= pdev) if (ret < 0) return ret; =20 - ep->supplies[0].supply =3D "vdd18"; - ep->supplies[1].supply =3D "vdd10"; - ret =3D devm_regulator_bulk_get(dev, ARRAY_SIZE(ep->supplies), - ep->supplies); - if (ret) - return ret; + if (pdata->res_ops && pdata->res_ops->init_regulator) { + ret =3D ep->pdata->res_ops->init_regulator(ep); + if (ret) + return ret; + } =20 - ret =3D regulator_bulk_enable(ARRAY_SIZE(ep->supplies), ep->supplies); + ret =3D samsung_regulator_enable(ep); if (ret) return ret; =20 platform_set_drvdata(pdev, ep); - - ret =3D exynos_add_pcie_port(ep, pdev); + ret =3D samsung_irq_init(ep, pdev); + if (ret) + goto fail_regulator; + ep->pci.pp.ops =3D pdata->host_ops; + ret =3D dw_pcie_host_init(&ep->pci.pp); if (ret < 0) - goto fail_probe; + goto fail_phy_init; =20 return 0; =20 -fail_probe: +fail_phy_init: phy_exit(ep->phy); - regulator_bulk_disable(ARRAY_SIZE(ep->supplies), ep->supplies); +fail_regulator: + samsung_regulator_disable(ep); =20 return ret; } @@ -347,7 +399,7 @@ static void exynos_pcie_remove(struct platform_device *= pdev) exynos_pcie_assert_core_reset(ep); phy_power_off(ep->phy); phy_exit(ep->phy); - regulator_bulk_disable(ARRAY_SIZE(ep->supplies), ep->supplies); + samsung_regulator_disable(ep); } =20 static int exynos_pcie_suspend_noirq(struct device *dev) @@ -357,7 +409,7 @@ static int exynos_pcie_suspend_noirq(struct device *dev) exynos_pcie_assert_core_reset(ep); phy_power_off(ep->phy); phy_exit(ep->phy); - regulator_bulk_disable(ARRAY_SIZE(ep->supplies), ep->supplies); + samsung_regulator_disable(ep); =20 return 0; } @@ -369,7 +421,7 @@ static int exynos_pcie_resume_noirq(struct device *dev) struct dw_pcie_rp *pp =3D &pci->pp; int ret; =20 - ret =3D regulator_bulk_enable(ARRAY_SIZE(ep->supplies), ep->supplies); + ret =3D samsung_regulator_enable(ep); if (ret) return ret; =20 @@ -389,6 +441,7 @@ static const struct samsung_pcie_pdata exynos_5433_pcie= _rc_pdata =3D { .dwc_ops =3D &exynos_dw_pcie_ops, .pci_ops =3D &exynos_pci_ops, .host_ops =3D &exynos_pcie_host_ops, + .res_ops =3D &exynos_res_ops_data, }; =20 static const struct of_device_id exynos_pcie_of_match[] =3D { --=20 2.49.0 From nobody Wed Oct 8 17:35:00 2025 Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 26FD822331C for ; Thu, 26 Jun 2025 02:37:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.254.224.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750905462; cv=none; b=T/j4qVFu7Dn11a0/OiL4euEUfuHTsnEHETehoqURzW/PhkBrw9FtBvS0C0NiZKj9o5jjtEHoWEKvroG269SpdRLID/HEc+4dZTESQepPrxBxJDvST6jTr6f2Ygg8WMlxbe/aJKmz+W/R7fIXnq5Y6WAASbQ0esWEQ+giVqL5zws= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750905462; c=relaxed/simple; bh=ckoT+BAsDnesgMAyQLZgXD6OEaDPUBN9XuHucBgLCfM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:MIME-Version: Content-Type:References; b=Vr1KhwcZCqaoc+8REYOAhHvu+Sq/yBaA8iVUhsGViGWTjzcm9xuZoX/zp6puNyKKSiwOvQgCJ1y0XrsfPuFVfc3/B0KtMrSgpqUleI60JgcBX7rX4qGN1ePaEhPcjD5QVQqn+jqDA9hsvGQ5oM2St4eoHsdSZmitSBc4Rl27kmo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=NQI2GrfH; arc=none smtp.client-ip=203.254.224.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="NQI2GrfH" Received: from epcas5p2.samsung.com (unknown [182.195.41.40]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20250626023738epoutp033b6c7d294d9be4e2369a6a44a6ebc29f~MdzzUEneD1784917849epoutp03P for ; Thu, 26 Jun 2025 02:37:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20250626023738epoutp033b6c7d294d9be4e2369a6a44a6ebc29f~MdzzUEneD1784917849epoutp03P DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1750905458; bh=GpGKFLRj3xJyZP39aLIHsF6XUTrUyDMCZLKHf9N0NXs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NQI2GrfH+ugdo2+SQjb4Xv9WFFbOOCF6WC8fiUZdKoUA+bESN5NMMe8xyxLmjw5KW fH8W1gWNFKcJIAkkQBkzUz0TmihufnPjmd+8iV/miE402XAHuzodzVHprgCNxE6se0 GcY363reFu4YpLudcf/cVEVG/DVo96n5cLwRaaf0= Received: from epsnrtp03.localdomain (unknown [182.195.42.155]) by epcas5p1.samsung.com (KnoxPortal) with ESMTPS id 20250626023737epcas5p15fd06f0fa7ae9bf46ed8b50e2fa87799~MdzyjXME42161521615epcas5p1I; Thu, 26 Jun 2025 02:37:37 +0000 (GMT) Received: from epcas5p4.samsung.com (unknown [182.195.38.179]) by epsnrtp03.localdomain (Postfix) with ESMTP id 4bSNBl2WwVz3hhT7; Thu, 26 Jun 2025 02:37:35 +0000 (GMT) Received: from epsmtip2.samsung.com (unknown [182.195.34.31]) by epcas5p1.samsung.com (KnoxPortal) with ESMTPA id 20250625165315epcas5p19f081c8a0e2e7dc87698577cc2d460ca~MV1kUqxpO1882618826epcas5p1Y; Wed, 25 Jun 2025 16:53:15 +0000 (GMT) Received: from cheetah.samsungds.net (unknown [107.109.115.53]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20250625165312epsmtip2751afed46e11b808e69c2a78a34ac3c0~MV1hjobbZ1750917509epsmtip2T; Wed, 25 Jun 2025 16:53:12 +0000 (GMT) From: Shradha Todi To: linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-fsd@tesla.com Cc: manivannan.sadhasivam@linaro.org, lpieralisi@kernel.org, kw@linux.com, robh@kernel.org, bhelgaas@google.com, jingoohan1@gmail.com, krzk+dt@kernel.org, conor+dt@kernel.org, alim.akhtar@samsung.com, vkoul@kernel.org, kishon@kernel.org, arnd@arndb.de, m.szyprowski@samsung.com, jh80.chung@samsung.com, pankaj.dubey@samsung.com, Shradha Todi Subject: [PATCH v2 06/10] dt-bindings: PCI: Add bindings support for Tesla FSD SoC Date: Wed, 25 Jun 2025 22:22:25 +0530 Message-ID: <20250625165229.3458-7-shradha.t@samsung.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250625165229.3458-1-shradha.t@samsung.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CMS-MailID: 20250625165315epcas5p19f081c8a0e2e7dc87698577cc2d460ca X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P cpgsPolicy: CPGSC10-541,Y X-CFilter-Loop: Reflected X-CMS-RootMailID: 20250625165315epcas5p19f081c8a0e2e7dc87698577cc2d460ca References: <20250625165229.3458-1-shradha.t@samsung.com> Document the PCIe controller device tree bindings for Tesla FSD SoC for both RC and EP. Signed-off-by: Shradha Todi --- .../bindings/pci/samsung,exynos-pcie.yaml | 121 ++++++++++++------ .../bindings/pci/tesla,fsd-pcie-ep.yaml | 91 +++++++++++++ 2 files changed, 176 insertions(+), 36 deletions(-) create mode 100644 Documentation/devicetree/bindings/pci/tesla,fsd-pcie-ep= .yaml diff --git a/Documentation/devicetree/bindings/pci/samsung,exynos-pcie.yaml= b/Documentation/devicetree/bindings/pci/samsung,exynos-pcie.yaml index f20ed7e709f7..595156759b06 100644 --- a/Documentation/devicetree/bindings/pci/samsung,exynos-pcie.yaml +++ b/Documentation/devicetree/bindings/pci/samsung,exynos-pcie.yaml @@ -11,16 +11,15 @@ maintainers: - Jaehoon Chung =20 description: |+ - Exynos5433 SoC PCIe host controller is based on the Synopsys DesignWare + Samsung SoCs PCIe host controller is based on the Synopsys DesignWare PCIe IP and thus inherits all the common properties defined in snps,dw-pcie.yaml. =20 -allOf: - - $ref: /schemas/pci/snps,dw-pcie.yaml# - properties: compatible: - const: samsung,exynos5433-pcie + enum: + - samsung,exynos5433-pcie + - tesla,fsd-pcie =20 reg: items: @@ -37,52 +36,102 @@ properties: interrupts: maxItems: 1 =20 - clocks: - items: - - description: PCIe bridge clock - - description: PCIe bus clock - - clock-names: - items: - - const: pcie - - const: pcie_bus - phys: maxItems: 1 =20 - vdd10-supply: - description: - Phandle to a regulator that provides 1.0V power to the PCIe block. - - vdd18-supply: - description: - Phandle to a regulator that provides 1.8V power to the PCIe block. - - num-lanes: - const: 1 - - num-viewport: - const: 3 - required: - reg - reg-names - interrupts - "#address-cells" - "#size-cells" - - "#interrupt-cells" - - interrupt-map - - interrupt-map-mask - ranges - - bus-range - device_type - num-lanes - - num-viewport - clocks - clock-names - phys - - vdd10-supply - - vdd18-supply + +allOf: + - $ref: /schemas/pci/snps,dw-pcie.yaml# + - if: + properties: + compatible: + contains: + enum: + - tesla,fsd-pcie + then: + properties: + clocks: + maxItems: 4 + + clock-names: + items: + - const: aux + - const: dbi + - const: mstr + - const: slv + + samsung,syscon-pcie: + $ref: /schemas/types.yaml#/definitions/phandle-array + description: phandle for system control registers, used to + control signals at system level + + num-lanes: + maximum: 4 + + required: + - samsung,syscon-pcie + + - if: + properties: + compatible: + contains: + enum: + - samsung,exynos5433-pcie + then: + properties: + clocks: + items: + - description: pcie bridge clock + - description: pcie bus clock + + clock-names: + items: + - const: pcie + - const: pcie_bus + + vdd10-supply: + description: + phandle to a regulator that provides 1.0v power to the pcie bl= ock. + + vdd18-supply: + description: + phandle to a regulator that provides 1.8v power to the pcie bl= ock. + + num-lanes: + const: 1 + + num-viewport: + const: 3 + + assigned-clocks: + maxItems: 2 + + assigned-clock-parents: + maxItems: 2 + + assigned-clock-rates: + maxItems: 2 + + required: + - "#interrupt-cells" + - interrupt-map + - interrupt-map-mask + - bus-range + - num-viewport + - vdd10-supply + - vdd18-supply =20 unevaluatedProperties: false =20 diff --git a/Documentation/devicetree/bindings/pci/tesla,fsd-pcie-ep.yaml b= /Documentation/devicetree/bindings/pci/tesla,fsd-pcie-ep.yaml new file mode 100644 index 000000000000..f85615a0225d --- /dev/null +++ b/Documentation/devicetree/bindings/pci/tesla,fsd-pcie-ep.yaml @@ -0,0 +1,91 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/pci/tesla,fsd-pcie-ep.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Samsung SoC series PCIe Endpoint Controller + +maintainers: + - Shradha Todi + +description: |+ + Samsung SoCs PCIe endpoint controller is based on the Synopsys DesignWare + PCIe IP and thus inherits all the common properties defined in + snps,dw-pcie-ep.yaml. + +allOf: + - $ref: /schemas/pci/snps,dw-pcie-ep.yaml# + +properties: + compatible: + const: tesla,fsd-pcie-ep + + reg: + maxItems: 4 + + reg-names: + items: + - const: elbi + - const: dbi + - const: dbi2 + - const: addr_space + + clocks: + maxItems: 4 + + clock-names: + items: + - const: aux + - const: dbi + - const: mstr + - const: slv + + num-lanes: + maximum: 4 + + samsung,syscon-pcie: + $ref: /schemas/types.yaml#/definitions/phandle-array + description: phandle for system control registers, used to + control signals at system level + + phys: + maxItems: 1 + +required: + - compatible + - reg + - reg-names + - clocks + - clock-names + - num-lanes + - samsung,syscon-pcie + - phys + +unevaluatedProperties: false + +examples: + - | + #include + #include + bus { + #address-cells =3D <2>; + #size-cells =3D <2>; + pcieep0: pcie-ep@16a00000 { + compatible =3D "tesla,fsd-pcie-ep"; + reg =3D <0x0 0x168b0000 0x0 0x1000>, + <0x0 0x16a00000 0x0 0x2000>, + <0x0 0x16a01000 0x0 0x80>, + <0x0 0x17000000 0x0 0xff0000>; + reg-names =3D "elbi", "dbi", "dbi2", "addr_space"; + clocks =3D <&clock_fsys1 PCIE_LINK0_IPCLKPORT_AUX_ACLK>, + <&clock_fsys1 PCIE_LINK0_IPCLKPORT_DBI_ACLK>, + <&clock_fsys1 PCIE_LINK0_IPCLKPORT_MSTR_ACLK>, + <&clock_fsys1 PCIE_LINK0_IPCLKPORT_SLV_ACLK>; + clock-names =3D "aux", "dbi", "mstr", "slv"; + num-lanes =3D <4>; + samsung,syscon-pcie =3D <&sysreg_fsys1 0x50c>; + phys =3D <&pciephy1>; + }; + }; +... --=20 2.49.0 From nobody Wed Oct 8 17:35:00 2025 Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9D3EA2264C5 for ; Thu, 26 Jun 2025 02:37:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.254.224.25 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750905465; cv=none; b=t5CNcgVUDjpugwvsS0jWiXr8Cs2/2KrpaKgqrev1A1RBbSPvhWIF6sRV29Txe+CLzGFedhjpvqPEIDGbQFHc/MhR7GOi/+385yCABewcY930UHM+e9ugo2Xbbj+v2O6z3TAHWm0bWDvF9DonMTnAr+4Z6dsAfOnMwkGvboVTPo4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750905465; c=relaxed/simple; bh=LrU4wRIkHrX3QPVfUgQqz2szQ8/0JFdxMkj+VmYkUn8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:MIME-Version: Content-Type:References; b=j/Zm7xUDM6DnrKT+Tw4FKg2e2wjemvOq2tGi7NphBO3/6aKjT720zduDtEIJ1aPRGZoe0AzqwMTeZiTuvpFGYG9FYHJRFzeT9LBOOYbMyHJ79OdyPJzi8UjHlq67qVcnxR6na5FBYOwxq/RGmRrQ9GsNpWtFQVqyoTWzvHoUwz4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=bYcxi80B; arc=none smtp.client-ip=203.254.224.25 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="bYcxi80B" Received: from epcas5p3.samsung.com (unknown [182.195.41.41]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20250626023741epoutp023676a3678d7ff7dbcdbb07a9cb952b5a~Mdz2xIoTC2366123661epoutp02g for ; Thu, 26 Jun 2025 02:37:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20250626023741epoutp023676a3678d7ff7dbcdbb07a9cb952b5a~Mdz2xIoTC2366123661epoutp02g DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1750905462; bh=ujct3ldDGWWQEWKX47buqf1vYrAR4bu4IG0VwJz4Ea4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bYcxi80BxCBz048ruk+HNpUOCbjxEHjY7a/OpEZO3LA2MXux52q+xXPWZZWNmP8hT sPVuPdi3MDF4yRlfdOo3uEEYP9y2qHE+qo3J24s6TdTxVnLl0nKPRvK0s3QDYrYre1 pQleNyKzOuWC0WBlJQpLOPt6R9hW1QnYEqeES2HM= Received: from epsnrtp02.localdomain (unknown [182.195.42.154]) by epcas5p4.samsung.com (KnoxPortal) with ESMTPS id 20250626023741epcas5p496162c0bb4cf12950d4bace903c720f4~Mdz2BkYUA1443814438epcas5p4M; Thu, 26 Jun 2025 02:37:41 +0000 (GMT) Received: from epcas5p1.samsung.com (unknown [182.195.38.183]) by epsnrtp02.localdomain (Postfix) with ESMTP id 4bSNBq32X1z2SSKf; Thu, 26 Jun 2025 02:37:39 +0000 (GMT) Received: from epsmtip2.samsung.com (unknown [182.195.34.31]) by epcas5p3.samsung.com (KnoxPortal) with ESMTPA id 20250625165319epcas5p3721c19f6e6b482438c62dd1ef784de03~MV1oJTTWu0056800568epcas5p3W; Wed, 25 Jun 2025 16:53:19 +0000 (GMT) Received: from cheetah.samsungds.net (unknown [107.109.115.53]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20250625165316epsmtip2a6224bb8663ab3eedbccc0797d0ad7bf~MV1lZ_oLN1750817508epsmtip2W; Wed, 25 Jun 2025 16:53:16 +0000 (GMT) From: Shradha Todi To: linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-fsd@tesla.com Cc: manivannan.sadhasivam@linaro.org, lpieralisi@kernel.org, kw@linux.com, robh@kernel.org, bhelgaas@google.com, jingoohan1@gmail.com, krzk+dt@kernel.org, conor+dt@kernel.org, alim.akhtar@samsung.com, vkoul@kernel.org, kishon@kernel.org, arnd@arndb.de, m.szyprowski@samsung.com, jh80.chung@samsung.com, pankaj.dubey@samsung.com, Shradha Todi Subject: [PATCH v2 07/10] dt-bindings: phy: Add PHY bindings support for FSD SoC Date: Wed, 25 Jun 2025 22:22:26 +0530 Message-ID: <20250625165229.3458-8-shradha.t@samsung.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250625165229.3458-1-shradha.t@samsung.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CMS-MailID: 20250625165319epcas5p3721c19f6e6b482438c62dd1ef784de03 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P cpgsPolicy: CPGSC10-541,Y X-CFilter-Loop: Reflected X-CMS-RootMailID: 20250625165319epcas5p3721c19f6e6b482438c62dd1ef784de03 References: <20250625165229.3458-1-shradha.t@samsung.com> Document PHY device tree bindings for Tesla FSD SoCs. Signed-off-by: Shradha Todi --- .../bindings/phy/samsung,exynos-pcie-phy.yaml | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/phy/samsung,exynos-pcie-phy.= yaml b/Documentation/devicetree/bindings/phy/samsung,exynos-pcie-phy.yaml index 41df8bb08ff7..4dc20156cdde 100644 --- a/Documentation/devicetree/bindings/phy/samsung,exynos-pcie-phy.yaml +++ b/Documentation/devicetree/bindings/phy/samsung,exynos-pcie-phy.yaml @@ -15,10 +15,13 @@ properties: const: 0 =20 compatible: - const: samsung,exynos5433-pcie-phy + enum: + - samsung,exynos5433-pcie-phy + - tesla,fsd-pcie-phy =20 reg: - maxItems: 1 + minItems: 1 + maxItems: 2 =20 samsung,pmu-syscon: $ref: /schemas/types.yaml#/definitions/phandle @@ -30,6 +33,24 @@ properties: description: phandle for FSYS sysreg interface, used to control sysreg registers bits for PCIe PHY =20 +allOf: + - if: + properties: + compatible: + contains: + enum: + - tesla,fsd-pcie-phy + then: + description: + The PHY controller nodes are represented in the aliases node + using the following format 'pciephy{n}'. Depending on whether + n is 0 or 1, the phy init sequence is chosen. + properties: + reg: + items: + - description: PHY + - description: PCS + required: - "#phy-cells" - compatible --=20 2.49.0 From nobody Wed Oct 8 17:35:00 2025 Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0FD5522F74A for ; Thu, 26 Jun 2025 02:37:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.254.224.25 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750905472; cv=none; b=oFvToY2zWL+r9Sv4k4bpNmTMBpxpbbFBd6UP5IVKF3BO3mLcc8slTv54a6wm2ReCgdYxE07pADOFb3Htl6ecx8o/O1y/N7B9Ak7TX6wvTcx7hf4DpUASZw9+1JPGkQP91kQK13kO6R+lwXd5UwsuFcRgf6+y4hrT7g4L1hC09QM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750905472; c=relaxed/simple; bh=Wbc2+RfHeqtmOeNADPHwurzKqcvE/S8J8bwJ7a+PLJA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:MIME-Version: Content-Type:References; b=sruLi/KVsEgepptBsKAI8LrYJAR4X3gNu1eBKHd3YDski0uOhg6nLOCrd93JLp9heLUCN/affRH884jiFDJI7VYEVTK9rpPPHmWY+vheyld3CN02virfx4mXWWrg7M2QG0Sv2iB3ZvcC+PKVAoSyvT1cSaQXAQf3CwoKovRBjHk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=KalJDQIK; arc=none smtp.client-ip=203.254.224.25 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="KalJDQIK" Received: from epcas5p2.samsung.com (unknown [182.195.41.40]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20250626023748epoutp022398415d9bd9fc50edb8c1125d16d739~Mdz822k4v2402724027epoutp02d for ; Thu, 26 Jun 2025 02:37:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20250626023748epoutp022398415d9bd9fc50edb8c1125d16d739~Mdz822k4v2402724027epoutp02d DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1750905468; bh=hypIB6EeD7SA8ky1sUTiu7LEMiY1BgdF3951Sy1jLbo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KalJDQIKs0mkAjI9/GLSiQTCM/NIYI06ARc5vL3yxHORVarCpWSKjBF7QHL+lFMCd AZ5xSRu9dzSFo9Gg3IVdUA1SP1zy91F5GqdDmSQpBgZB9leVXAO8spwnG2b14dx8fc EKASEqBUh9YiHTfDsAU8JFHQ7FZ6gMEK8TeInJUc= Received: from epsnrtp02.localdomain (unknown [182.195.42.154]) by epcas5p3.samsung.com (KnoxPortal) with ESMTPS id 20250626023747epcas5p39892427826074d8057a24e5353deb00a~Mdz8CAyNL2141821418epcas5p3s; Thu, 26 Jun 2025 02:37:47 +0000 (GMT) Received: from epcas5p3.samsung.com (unknown [182.195.38.181]) by epsnrtp02.localdomain (Postfix) with ESMTP id 4bSNBx75T8z2SSKd; Thu, 26 Jun 2025 02:37:45 +0000 (GMT) Received: from epsmtip2.samsung.com (unknown [182.195.34.31]) by epcas5p4.samsung.com (KnoxPortal) with ESMTPA id 20250625165323epcas5p44d291cb0b46df7e015907e4c2903447f~MV1sCqbbU2145921459epcas5p4T; Wed, 25 Jun 2025 16:53:23 +0000 (GMT) Received: from cheetah.samsungds.net (unknown [107.109.115.53]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20250625165320epsmtip2624f6329040ec6dc48d1bd48c57e56c9~MV1pSM69W1746917469epsmtip2Y; Wed, 25 Jun 2025 16:53:20 +0000 (GMT) From: Shradha Todi To: linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-fsd@tesla.com Cc: manivannan.sadhasivam@linaro.org, lpieralisi@kernel.org, kw@linux.com, robh@kernel.org, bhelgaas@google.com, jingoohan1@gmail.com, krzk+dt@kernel.org, conor+dt@kernel.org, alim.akhtar@samsung.com, vkoul@kernel.org, kishon@kernel.org, arnd@arndb.de, m.szyprowski@samsung.com, jh80.chung@samsung.com, pankaj.dubey@samsung.com, Shradha Todi Subject: [PATCH v2 08/10] phy: exynos: Add PCIe PHY support for FSD SoC Date: Wed, 25 Jun 2025 22:22:27 +0530 Message-ID: <20250625165229.3458-9-shradha.t@samsung.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250625165229.3458-1-shradha.t@samsung.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CMS-MailID: 20250625165323epcas5p44d291cb0b46df7e015907e4c2903447f X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P cpgsPolicy: CPGSC10-541,Y X-CFilter-Loop: Reflected X-CMS-RootMailID: 20250625165323epcas5p44d291cb0b46df7e015907e4c2903447f References: <20250625165229.3458-1-shradha.t@samsung.com> Add PCIe PHY support for Tesla FSD SoC. Signed-off-by: Shradha Todi --- drivers/phy/samsung/phy-exynos-pcie.c | 317 +++++++++++++++++++++++++- 1 file changed, 316 insertions(+), 1 deletion(-) diff --git a/drivers/phy/samsung/phy-exynos-pcie.c b/drivers/phy/samsung/ph= y-exynos-pcie.c index 53c9230c2907..001a49bde2f4 100644 --- a/drivers/phy/samsung/phy-exynos-pcie.c +++ b/drivers/phy/samsung/phy-exynos-pcie.c @@ -34,11 +34,113 @@ /* PMU PCIE PHY isolation control */ #define EXYNOS5433_PMU_PCIE_PHY_OFFSET 0x730 =20 +/* FSD: PCIe PHY common registers */ +#define FSD_PCIE_PHY_TRSV_CMN_REG03 0x000c +#define FSD_PCIE_PHY_TRSV_CMN_REG01E 0x0078 +#define FSD_PCIE_PHY_TRSV_CMN_REG02D 0x00b4 +#define FSD_PCIE_PHY_TRSV_CMN_REG031 0x00c4 +#define FSD_PCIE_PHY_TRSV_CMN_REG036 0x00d8 +#define FSD_PCIE_PHY_TRSV_CMN_REG05F 0x017c +#define FSD_PCIE_PHY_TRSV_CMN_REG060 0x0180 +#define FSD_PCIE_PHY_TRSV_CMN_REG062 0x0188 +#define FSD_PCIE_PHY_TRSV_CMN_REG061 0x0184 +#define FSD_PCIE_PHY_AGG_BIF_RESET 0x0200 +#define FSD_PCIE_PHY_AGG_BIF_CLOCK 0x0208 +#define FSD_PCIE_PHY_CMN_RESET 0x0228 + +/* FSD: PCIe PHY lane registers */ +#define FSD_PCIE_LANE_OFFSET 0x0400 +#define FSD_PCIE_NUM_LANES 0x4 + +#define FSD_PCIE_PHY_TRSV_REG001_LN_N 0x0404 +#define FSD_PCIE_PHY_TRSV_REG002_LN_N 0x0408 +#define FSD_PCIE_PHY_TRSV_REG005_LN_N 0x0414 +#define FSD_PCIE_PHY_TRSV_REG006_LN_N 0x0418 +#define FSD_PCIE_PHY_TRSV_REG007_LN_N 0x041c +#define FSD_PCIE_PHY_TRSV_REG009_LN_N 0x0424 +#define FSD_PCIE_PHY_TRSV_REG00A_LN_N 0x0428 +#define FSD_PCIE_PHY_TRSV_REG00C_LN_N 0x0430 +#define FSD_PCIE_PHY_TRSV_REG012_LN_N 0x0448 +#define FSD_PCIE_PHY_TRSV_REG013_LN_N 0x044c +#define FSD_PCIE_PHY_TRSV_REG014_LN_N 0x0450 +#define FSD_PCIE_PHY_TRSV_REG015_LN_N 0x0454 +#define FSD_PCIE_PHY_TRSV_REG016_LN_N 0x0458 +#define FSD_PCIE_PHY_TRSV_REG018_LN_N 0x0460 +#define FSD_PCIE_PHY_TRSV_REG020_LN_N 0x0480 +#define FSD_PCIE_PHY_TRSV_REG026_LN_N 0x0498 +#define FSD_PCIE_PHY_TRSV_REG029_LN_N 0x04a4 +#define FSD_PCIE_PHY_TRSV_REG031_LN_N 0x04c4 +#define FSD_PCIE_PHY_TRSV_REG036_LN_N 0x04d8 +#define FSD_PCIE_PHY_TRSV_REG039_LN_N 0x04e4 +#define FSD_PCIE_PHY_TRSV_REG03B_LN_N 0x04ec +#define FSD_PCIE_PHY_TRSV_REG03C_LN_N 0x04f0 +#define FSD_PCIE_PHY_TRSV_REG03E_LN_N 0x04f8 +#define FSD_PCIE_PHY_TRSV_REG03F_LN_N 0x04fc +#define FSD_PCIE_PHY_TRSV_REG043_LN_N 0x050c +#define FSD_PCIE_PHY_TRSV_REG044_LN_N 0x0510 +#define FSD_PCIE_PHY_TRSV_REG046_LN_N 0x0518 +#define FSD_PCIE_PHY_TRSV_REG048_LN_N 0x0520 +#define FSD_PCIE_PHY_TRSV_REG049_LN_N 0x0524 +#define FSD_PCIE_PHY_TRSV_REG04E_LN_N 0x0538 +#define FSD_PCIE_PHY_TRSV_REG052_LN_N 0x0548 +#define FSD_PCIE_PHY_TRSV_REG068_LN_N 0x05a0 +#define FSD_PCIE_PHY_TRSV_REG069_LN_N 0x05a4 +#define FSD_PCIE_PHY_TRSV_REG06A_LN_N 0x05a8 +#define FSD_PCIE_PHY_TRSV_REG06B_LN_N 0x05ac +#define FSD_PCIE_PHY_TRSV_REG07B_LN_N 0x05ec +#define FSD_PCIE_PHY_TRSV_REG083_LN_N 0x060c +#define FSD_PCIE_PHY_TRSV_REG084_LN_N 0x0610 +#define FSD_PCIE_PHY_TRSV_REG086_LN_N 0x0618 +#define FSD_PCIE_PHY_TRSV_REG087_LN_N 0x061c +#define FSD_PCIE_PHY_TRSV_REG08B_LN_N 0x062c +#define FSD_PCIE_PHY_TRSV_REG09C_LN_N 0x0670 +#define FSD_PCIE_PHY_TRSV_REG09D_LN_N 0x0674 +#define FSD_PCIE_PHY_TRSV_REG09E_LN_N 0x0678 +#define FSD_PCIE_PHY_TRSV_REG09F_LN_N 0x067c +#define FSD_PCIE_PHY_TRSV_REG0A2_LN_N 0x0688 +#define FSD_PCIE_PHY_TRSV_REG0A4_LN_N 0x0690 +#define FSD_PCIE_PHY_TRSV_REG0CE_LN_N 0x0738 +#define FSD_PCIE_PHY_TRSV_REG0FC_LN_N 0x07f0 +#define FSD_PCIE_PHY_TRSV_REG0FD_LN_N 0x07f4 +#define FSD_PCIE_PHY_TRSV_REG0FE_LN_N 0x07f8 +#define FSD_PCIE_PHY_TRSV_REG0CE_LN_1 0x0b38 +#define FSD_PCIE_PHY_TRSV_REG0CE_LN_2 0x0f38 +#define FSD_PCIE_PHY_TRSV_REG0CE_LN_3 0x1338 + +/* FSD: PCIe PCS registers */ +#define FSD_PCIE_PCS_BRF_0 0x0004 +#define FSD_PCIE_PCS_BRF_1 0x0804 +#define FSD_PCIE_PCS_CLK 0x0180 + +/* FSD: PCIe SYSREG registers */ +#define FSD_PCIE_SYSREG_PHY_0_CON 0x042c +#define FSD_PCIE_SYSREG_PHY_0_CON_MASK 0x03ff +#define FSD_PCIE_SYSREG_PHY_0_REF_SEL (0x2 << 0) +#define FSD_PCIE_SYSREG_PHY_0_REF_SEL_MASK 0x3 +#define FSD_PCIE_SYSREG_PHY_0_AUX_EN BIT(4) +#define FSD_PCIE_SYSREG_PHY_0_CMN_RSTN BIT(8) +#define FSD_PCIE_SYSREG_PHY_0_INIT_RSTN BIT(9) + +#define FSD_PCIE_SYSREG_PHY_1_CON 0x0500 +#define FSD_PCIE_SYSREG_PHY_1_CON_MASK 0x01ff +#define FSD_PCIE_SYSREG_PHY_1_REF_SEL (0x2 << 4) +#define FSD_PCIE_SYSREG_PHY_1_REF_SEL_MASK 0x30 +#define FSD_PCIE_SYSREG_PHY_1_AUX_EN BIT(0) +#define FSD_PCIE_SYSREG_PHY_1_CMN_RSTN BIT(1) +#define FSD_PCIE_SYSREG_PHY_1_INIT_RSTN BIT(3) + /* For Exynos pcie phy */ struct exynos_pcie_phy { void __iomem *base; + void __iomem *pcs_base; struct regmap *pmureg; struct regmap *fsysreg; + int phy_id; + const struct samsung_drv_data *drv_data; +}; + +struct samsung_drv_data { + const struct phy_ops *phy_ops; }; =20 static void exynos_pcie_phy_writel(void __iomem *base, u32 val, u32 offset) @@ -133,9 +235,212 @@ static const struct phy_ops exynos5433_phy_ops =3D { .owner =3D THIS_MODULE, }; =20 +static void fsd_pcie_phy_writel(struct exynos_pcie_phy *phy_ctrl, u32 offs= et, u32 val) +{ + void __iomem *phy_base =3D phy_ctrl->base; + u32 i; + + for (i =3D 0; i < FSD_PCIE_NUM_LANES; i++) + writel(val, phy_base + (offset + i * FSD_PCIE_LANE_OFFSET)); +} + +struct fsd_pcie_phy_pdata { + u32 phy_con_offset; + u32 phy_con_mask; + u32 phy_ref_sel; + u32 phy_ref_sel_mask; + u32 phy_aux_en; + u32 phy_cmn_rstn; + u32 phy_init_rstn; +}; + +static const struct fsd_pcie_phy_pdata fsd_phy_con[] =3D { +{ + .phy_con_offset =3D FSD_PCIE_SYSREG_PHY_0_CON, + .phy_con_mask =3D FSD_PCIE_SYSREG_PHY_0_CON_MASK, + .phy_ref_sel =3D FSD_PCIE_SYSREG_PHY_0_REF_SEL, + .phy_ref_sel_mask =3D FSD_PCIE_SYSREG_PHY_0_REF_SEL_MASK, + .phy_aux_en =3D FSD_PCIE_SYSREG_PHY_0_AUX_EN, + .phy_cmn_rstn =3D FSD_PCIE_SYSREG_PHY_0_CMN_RSTN, + .phy_init_rstn =3D FSD_PCIE_SYSREG_PHY_0_INIT_RSTN, + }, + { + .phy_con_offset =3D FSD_PCIE_SYSREG_PHY_1_CON, + .phy_con_mask =3D FSD_PCIE_SYSREG_PHY_1_CON_MASK, + .phy_ref_sel =3D FSD_PCIE_SYSREG_PHY_1_REF_SEL, + .phy_ref_sel_mask =3D FSD_PCIE_SYSREG_PHY_1_REF_SEL_MASK, + .phy_aux_en =3D FSD_PCIE_SYSREG_PHY_1_AUX_EN, + .phy_cmn_rstn =3D FSD_PCIE_SYSREG_PHY_1_CMN_RSTN, + .phy_init_rstn =3D FSD_PCIE_SYSREG_PHY_1_INIT_RSTN, + }, + { }, +}; + +static int fsd_pcie_phy_reset(struct phy *phy) +{ + struct exynos_pcie_phy *phy_ctrl =3D phy_get_drvdata(phy); + const struct fsd_pcie_phy_pdata *pdata =3D &fsd_phy_con[phy_ctrl->phy_id]; + + writel(0x1, phy_ctrl->pcs_base + FSD_PCIE_PCS_CLK); + + regmap_update_bits(phy_ctrl->fsysreg, pdata->phy_con_offset, + pdata->phy_con_mask, 0x0); + regmap_update_bits(phy_ctrl->fsysreg, pdata->phy_con_offset, + pdata->phy_aux_en, pdata->phy_aux_en); + regmap_update_bits(phy_ctrl->fsysreg, pdata->phy_con_offset, + pdata->phy_ref_sel_mask, pdata->phy_ref_sel); + /* perform init reset release */ + regmap_update_bits(phy_ctrl->fsysreg, pdata->phy_con_offset, + pdata->phy_init_rstn, pdata->phy_init_rstn); + + return 0; +} + +static void fsd_pcie_phy1_init(struct exynos_pcie_phy *phy_ctrl) +{ + void __iomem *pbase =3D phy_ctrl->base; + + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG07B_LN_N, 0x20); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG052_LN_N, 0x00); + writel(0xaa, pbase + FSD_PCIE_PHY_TRSV_CMN_REG01E); + writel(0x28, pbase + FSD_PCIE_PHY_TRSV_CMN_REG02D); + writel(0x28, pbase + FSD_PCIE_PHY_TRSV_CMN_REG031); + writel(0x21, pbase + FSD_PCIE_PHY_TRSV_CMN_REG036); + writel(0x12, pbase + FSD_PCIE_PHY_TRSV_CMN_REG05F); + writel(0x23, pbase + FSD_PCIE_PHY_TRSV_CMN_REG060); + writel(0x0, pbase + FSD_PCIE_PHY_TRSV_CMN_REG061); + writel(0x0, pbase + FSD_PCIE_PHY_TRSV_CMN_REG062); + writel(0x15, pbase + FSD_PCIE_PHY_TRSV_CMN_REG03); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG039_LN_N, 0xf); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG03B_LN_N, 0x13); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG03C_LN_N, 0x66); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG044_LN_N, 0x57); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG03E_LN_N, 0x10); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG03F_LN_N, 0x44); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG043_LN_N, 0x11); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG046_LN_N, 0xef); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG048_LN_N, 0x06); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG049_LN_N, 0xaf); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG04E_LN_N, 0x28); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG068_LN_N, 0x1f); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG069_LN_N, 0xc); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG06A_LN_N, 0x8); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG06B_LN_N, 0x78); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG083_LN_N, 0xa); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG084_LN_N, 0x80); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG087_LN_N, 0x30); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG08B_LN_N, 0xa0); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG09C_LN_N, 0xf7); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG09E_LN_N, 0x33); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG0A2_LN_N, 0xfa); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG0A4_LN_N, 0xf2); + writel(0x8, pbase + FSD_PCIE_PHY_TRSV_REG0CE_LN_N); + writel(0x9, pbase + FSD_PCIE_PHY_TRSV_REG0CE_LN_1); + writel(0x9, pbase + FSD_PCIE_PHY_TRSV_REG0CE_LN_2); + writel(0x9, pbase + FSD_PCIE_PHY_TRSV_REG0CE_LN_3); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG0FE_LN_N, 0x33); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG001_LN_N, 0x3f); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG005_LN_N, 0x2b); +} + +static void fsd_pcie_phy0_init(struct exynos_pcie_phy *phy_ctrl) +{ + void __iomem *pbase =3D phy_ctrl->base; + + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG07B_LN_N, 0x20); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG052_LN_N, 0x00); + writel(0x11, pbase + FSD_PCIE_PHY_TRSV_CMN_REG05F); + writel(0x23, pbase + FSD_PCIE_PHY_TRSV_CMN_REG060); + writel(0x0, pbase + FSD_PCIE_PHY_TRSV_CMN_REG062); + writel(0x15, pbase + FSD_PCIE_PHY_TRSV_CMN_REG03); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG0CE_LN_N, 0x8); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG039_LN_N, 0xf); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG03B_LN_N, 0x13); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG03C_LN_N, 0xf6); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG044_LN_N, 0x57); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG03E_LN_N, 0x10); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG03F_LN_N, 0x04); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG043_LN_N, 0x11); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG049_LN_N, 0x6f); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG04E_LN_N, 0x18); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG068_LN_N, 0x1f); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG069_LN_N, 0xc); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG06B_LN_N, 0x78); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG083_LN_N, 0xa); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG084_LN_N, 0x80); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG086_LN_N, 0xff); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG087_LN_N, 0x3c); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG09D_LN_N, 0x7c); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG09E_LN_N, 0x33); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG09F_LN_N, 0x33); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG001_LN_N, 0x3f); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG002_LN_N, 0x1c); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG005_LN_N, 0x2b); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG006_LN_N, 0x3); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG007_LN_N, 0x0c); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG009_LN_N, 0x10); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG00A_LN_N, 0x1); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG00C_LN_N, 0x93); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG012_LN_N, 0x1); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG013_LN_N, 0x0); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG014_LN_N, 0x70); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG015_LN_N, 0x0); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG016_LN_N, 0x70); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG0FC_LN_N, 0x80); + fsd_pcie_phy_writel(phy_ctrl, FSD_PCIE_PHY_TRSV_REG0FD_LN_N, 0x0); +} + +static int fsd_pcie_phy_init(struct phy *phy) +{ + struct exynos_pcie_phy *phy_ctrl =3D phy_get_drvdata(phy); + void __iomem *phy_base =3D phy_ctrl->base; + const struct fsd_pcie_phy_pdata *pdata =3D &fsd_phy_con[phy_ctrl->phy_id]; + + fsd_pcie_phy_reset(phy); + + if (phy_ctrl->phy_id =3D=3D 1) + writel(0x2, phy_base + FSD_PCIE_PHY_CMN_RESET); + + writel(0x00, phy_ctrl->pcs_base + FSD_PCIE_PCS_BRF_0); + writel(0x00, phy_ctrl->pcs_base + FSD_PCIE_PCS_BRF_1); + writel(0x00, phy_base + FSD_PCIE_PHY_AGG_BIF_RESET); + writel(0x00, phy_base + FSD_PCIE_PHY_AGG_BIF_CLOCK); + + if (phy_ctrl->phy_id =3D=3D 1) { + fsd_pcie_phy1_init(phy_ctrl); + writel(0x3, phy_base + FSD_PCIE_PHY_CMN_RESET); + } else { + fsd_pcie_phy0_init(phy_ctrl); + } + + regmap_update_bits(phy_ctrl->fsysreg, pdata->phy_con_offset, + pdata->phy_cmn_rstn, pdata->phy_cmn_rstn); + + return 0; +} + +static const struct phy_ops fsd_phy_ops =3D { + .init =3D fsd_pcie_phy_init, + .reset =3D fsd_pcie_phy_reset, + .owner =3D THIS_MODULE, +}; + +static const struct samsung_drv_data exynos5433_drv_data =3D { + .phy_ops =3D &exynos5433_phy_ops, +}; + +static const struct samsung_drv_data fsd_drv_data =3D { + .phy_ops =3D &fsd_phy_ops, +}; + static const struct of_device_id exynos_pcie_phy_match[] =3D { { .compatible =3D "samsung,exynos5433-pcie-phy", + .data =3D &exynos5433_drv_data, + }, + { + .compatible =3D "tesla,fsd-pcie-phy", + .data =3D &fsd_drv_data, }, {}, }; @@ -146,11 +451,18 @@ static int exynos_pcie_phy_probe(struct platform_devi= ce *pdev) struct exynos_pcie_phy *exynos_phy; struct phy *generic_phy; struct phy_provider *phy_provider; + const struct samsung_drv_data *drv_data; + + drv_data =3D of_device_get_match_data(dev); + if (!drv_data) + return -ENODEV; =20 exynos_phy =3D devm_kzalloc(dev, sizeof(*exynos_phy), GFP_KERNEL); if (!exynos_phy) return -ENOMEM; =20 + exynos_phy->drv_data =3D drv_data; + exynos_phy->base =3D devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(exynos_phy->base)) return PTR_ERR(exynos_phy->base); @@ -169,12 +481,15 @@ static int exynos_pcie_phy_probe(struct platform_devi= ce *pdev) return PTR_ERR(exynos_phy->fsysreg); } =20 - generic_phy =3D devm_phy_create(dev, dev->of_node, &exynos5433_phy_ops); + generic_phy =3D devm_phy_create(dev, dev->of_node, drv_data->phy_ops); if (IS_ERR(generic_phy)) { dev_err(dev, "failed to create PHY\n"); return PTR_ERR(generic_phy); } =20 + exynos_phy->pcs_base =3D devm_platform_ioremap_resource(pdev, 1); + + exynos_phy->phy_id =3D of_alias_get_id(dev->of_node, "pciephy"); phy_set_drvdata(generic_phy, exynos_phy); phy_provider =3D devm_of_phy_provider_register(dev, of_phy_simple_xlate); =20 --=20 2.49.0 From nobody Wed Oct 8 17:35:00 2025 Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0F934233727 for ; Thu, 26 Jun 2025 02:37:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.254.224.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750905478; cv=none; b=eryPRGiKuArpi1Yr6QXlmDbbi/Vyf//hd5N1GZnIHCewE9VQrr+ucpWxbZbojsD4BLhrSYbu+Uk8zU62svWBDx6+P4h0QKKTnCRB3G11g1ldqV0dphRYM0rqyxLOmp6HLQ6RkOgaF5LCqu26Y/WeOLVAcJHLWVFoWCe3Dc1H6xM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750905478; c=relaxed/simple; bh=MGUuk1VWqmy4wKoxbhUg19YNy5HOWgcKMRuk/3Bp89c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:MIME-Version: Content-Type:References; b=dI+SjWi3PrflpOxtcRjsfQoYV7oyAQM6i3y6vBZ5nGxHQc7VF3TC54gEbZ8zseYVIaKwkihXDctaA3kjL2ndL7abRMEZh+JznIucn51PtC/unQ4X3+iTNDJ96DtWTo1fDqeMhqYt+puMJr9TIoN1U7J8j0S/Q61GeaLShneskdQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=klTNCORw; arc=none smtp.client-ip=203.254.224.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="klTNCORw" Received: from epcas5p3.samsung.com (unknown [182.195.41.41]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20250626023754epoutp03dbc97d7c03d05057d1b5e9fdb3256673~Md0CcPD7U2056320563epoutp03J for ; Thu, 26 Jun 2025 02:37:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20250626023754epoutp03dbc97d7c03d05057d1b5e9fdb3256673~Md0CcPD7U2056320563epoutp03J DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1750905474; bh=z0KBGm2Z9iLRXAIDe5VoGTTaKpckXActfWq12mD0U20=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=klTNCORwMgow+itX6xFE6Az9oyh3P5GJ4Qm5ERkWR7jpzWABJu1pjbpKXWoA8Ozpi mSTgbL1XXfR0H10n97ptalIE8Q/lYXWNLbkWGul7qJXw5VuVxYSW4h0isJpSlLy1Qy 2Zy3p0ka/lk+2SACL2WXVffDXU9DdQfB5Flwp0WY= Received: from epsnrtp04.localdomain (unknown [182.195.42.156]) by epcas5p2.samsung.com (KnoxPortal) with ESMTPS id 20250626023753epcas5p24213f30c5d8fe7065b5ef595c4d66640~Md0Bxd52J3175331753epcas5p2t; Thu, 26 Jun 2025 02:37:53 +0000 (GMT) Received: from epcas5p2.samsung.com (unknown [182.195.38.180]) by epsnrtp04.localdomain (Postfix) with ESMTP id 4bSNC34p2Xz6B9mF; Thu, 26 Jun 2025 02:37:51 +0000 (GMT) Received: from epsmtip2.samsung.com (unknown [182.195.34.31]) by epcas5p2.samsung.com (KnoxPortal) with ESMTPA id 20250625165327epcas5p2c51b6032a6439cd1a7a884b360be1354~MV1wB36CA0634006340epcas5p2J; Wed, 25 Jun 2025 16:53:27 +0000 (GMT) Received: from cheetah.samsungds.net (unknown [107.109.115.53]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20250625165324epsmtip298c2ff07671bc186e195912ba4e23ca2~MV1tSs9zM1750917509epsmtip2X; Wed, 25 Jun 2025 16:53:24 +0000 (GMT) From: Shradha Todi To: linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-fsd@tesla.com Cc: manivannan.sadhasivam@linaro.org, lpieralisi@kernel.org, kw@linux.com, robh@kernel.org, bhelgaas@google.com, jingoohan1@gmail.com, krzk+dt@kernel.org, conor+dt@kernel.org, alim.akhtar@samsung.com, vkoul@kernel.org, kishon@kernel.org, arnd@arndb.de, m.szyprowski@samsung.com, jh80.chung@samsung.com, pankaj.dubey@samsung.com, Shradha Todi Subject: [PATCH v2 09/10] PCI: exynos: Add support for Tesla FSD SoC Date: Wed, 25 Jun 2025 22:22:28 +0530 Message-ID: <20250625165229.3458-10-shradha.t@samsung.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250625165229.3458-1-shradha.t@samsung.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CMS-MailID: 20250625165327epcas5p2c51b6032a6439cd1a7a884b360be1354 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P cpgsPolicy: CPGSC10-541,Y X-CFilter-Loop: Reflected X-CMS-RootMailID: 20250625165327epcas5p2c51b6032a6439cd1a7a884b360be1354 References: <20250625165229.3458-1-shradha.t@samsung.com> Add host and endpoint controller driver support for FSD SoC. Signed-off-by: Shradha Todi --- drivers/pci/controller/dwc/pci-exynos.c | 331 +++++++++++++++++++++++- 1 file changed, 323 insertions(+), 8 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-exynos.c b/drivers/pci/controll= er/dwc/pci-exynos.c index dff23cf648f5..5b525156b9f5 100644 --- a/drivers/pci/controller/dwc/pci-exynos.c +++ b/drivers/pci/controller/dwc/pci-exynos.c @@ -20,6 +20,8 @@ #include #include #include +#include +#include =20 #include "pcie-designware.h" =20 @@ -49,17 +51,46 @@ #define EXYNOS_PCIE_ELBI_SLV_ARMISC 0x120 #define EXYNOS_PCIE_ELBI_SLV_DBI_ENABLE BIT(21) =20 +#define FSD_IRQ2_STS 0x008 +#define FSD_IRQ_MSI_ENABLE BIT(17) +#define FSD_IRQ2_EN 0x018 +#define FSD_PCIE_APP_LTSSM_ENABLE 0x054 +#define FSD_PCIE_LTSSM_ENABLE 0x1 +#define FSD_PCIE_DEVICE_TYPE 0x080 +#define FSD_DEVICE_TYPE_RC 0x4 +#define FSD_DEVICE_TYPE_EP 0x0 +#define FSD_PCIE_CXPL_DEBUG_00_31 0x2C8 + +/* to store different SoC variants of Samsung */ +enum samsung_pcie_variants { + FSD, + EXYNOS_5433, +}; + +/* Values to be written to SYSREG to view DBI space as CDM/DBI2/IATU/DMA */ +enum fsd_pcie_addr_type { + ADDR_TYPE_DBI =3D 0x0, + ADDR_TYPE_DBI2 =3D 0x12, + ADDR_TYPE_ATU =3D 0x36, + ADDR_TYPE_DMA =3D 0x3f, +}; + struct samsung_pcie_pdata { struct pci_ops *pci_ops; const struct dw_pcie_ops *dwc_ops; const struct dw_pcie_host_ops *host_ops; + const struct dw_pcie_ep_ops *ep_ops; const struct samsung_res_ops *res_ops; + unsigned int soc_variant; + enum dw_pcie_device_mode device_mode; }; =20 struct exynos_pcie { struct dw_pcie pci; void __iomem *elbi_base; const struct samsung_pcie_pdata *pdata; + struct regmap *sysreg; + unsigned int sysreg_offset; struct clk_bulk_data *clks; struct phy *phy; struct regulator_bulk_data *supplies; @@ -69,6 +100,7 @@ struct exynos_pcie { struct samsung_res_ops { int (*init_regulator)(struct exynos_pcie *ep); irqreturn_t (*pcie_irq_handler)(int irq, void *arg); + void (*set_device_mode)(struct exynos_pcie *ep); }; =20 static void exynos_pcie_writel(void __iomem *base, u32 val, u32 reg) @@ -326,11 +358,203 @@ static const struct dw_pcie_ops exynos_dw_pcie_ops = =3D { .start_link =3D exynos_pcie_start_link, }; =20 +static void fsd_pcie_stop_link(struct dw_pcie *pci) +{ + u32 val; + struct exynos_pcie *ep =3D to_exynos_pcie(pci); + + val =3D readl(ep->elbi_base + FSD_PCIE_APP_LTSSM_ENABLE); + val &=3D ~FSD_PCIE_LTSSM_ENABLE; + writel(val, ep->elbi_base + FSD_PCIE_APP_LTSSM_ENABLE); +} + +static int fsd_pcie_start_link(struct dw_pcie *pci) +{ + struct exynos_pcie *ep =3D to_exynos_pcie(pci); + struct dw_pcie_ep *dw_ep =3D &pci->ep; + + if (dw_pcie_link_up(pci)) + return 0; + + writel(FSD_PCIE_LTSSM_ENABLE, ep->elbi_base + FSD_PCIE_APP_LTSSM_ENABLE); + + /* no need to wait for link in case of host as core files take care */ + if (ep->pdata->device_mode =3D=3D DW_PCIE_RC_TYPE) + return 0; + + /* check if the link is up or not in case of EP */ + if (!dw_pcie_wait_for_link(pci)) { + dw_pcie_ep_linkup(dw_ep); + return 0; + } + + return -ETIMEDOUT; +} + +static irqreturn_t fsd_pcie_irq_handler(int irq, void *arg) +{ + u32 val; + struct exynos_pcie *ep =3D arg; + struct dw_pcie *pci =3D &ep->pci; + struct dw_pcie_rp *pp =3D &pci->pp; + + val =3D readl(ep->elbi_base + FSD_IRQ2_STS); + if ((val & FSD_IRQ_MSI_ENABLE) =3D=3D FSD_IRQ_MSI_ENABLE) { + val &=3D FSD_IRQ_MSI_ENABLE; + writel(val, ep->elbi_base + FSD_IRQ2_STS); + dw_handle_msi_irq(pp); + } + + return IRQ_HANDLED; +} + +static void fsd_pcie_msi_init(struct exynos_pcie *ep) +{ + int val; + + val =3D readl(ep->elbi_base + FSD_IRQ2_EN); + val |=3D FSD_IRQ_MSI_ENABLE; + writel(val, ep->elbi_base + FSD_IRQ2_EN); +} + +static void __iomem *fsd_atu_setting(struct dw_pcie *pci, void __iomem *ba= se) +{ + struct exynos_pcie *ep =3D to_exynos_pcie(pci); + + if (base >=3D pci->atu_base) { + regmap_write(ep->sysreg, ep->sysreg_offset, ADDR_TYPE_ATU); + return (base - DEFAULT_DBI_ATU_OFFSET); + } else if (base =3D=3D pci->dbi_base) { + regmap_write(ep->sysreg, ep->sysreg_offset, ADDR_TYPE_DBI); + } else if (base =3D=3D pci->dbi_base2) { + regmap_write(ep->sysreg, ep->sysreg_offset, ADDR_TYPE_DBI2); + } + + return base; +} + +static u32 fsd_pcie_read_dbi(struct dw_pcie *pci, void __iomem *base, + u32 reg, size_t size) +{ + void __iomem *addr; + u32 val; + + addr =3D fsd_atu_setting(pci, base); + + dw_pcie_read(addr + reg, size, &val); + + return val; +} + +static void fsd_pcie_write_dbi(struct dw_pcie *pci, void __iomem *base, + u32 reg, size_t size, u32 val) +{ + void __iomem *addr; + + addr =3D fsd_atu_setting(pci, base); + + dw_pcie_write(addr + reg, size, val); +} + +static void fsd_pcie_write_dbi2(struct dw_pcie *pci, void __iomem *base, + u32 reg, size_t size, u32 val) +{ + struct exynos_pcie *ep =3D to_exynos_pcie(pci); + + fsd_atu_setting(pci, base); + dw_pcie_write(pci->dbi_base + reg, size, val); + regmap_write(ep->sysreg, ep->sysreg_offset, ADDR_TYPE_DBI); +} + +static bool fsd_pcie_link_up(struct dw_pcie *pci) +{ + u32 val; + struct exynos_pcie *ep =3D to_exynos_pcie(pci); + + val =3D readl(ep->elbi_base + FSD_PCIE_CXPL_DEBUG_00_31); + val &=3D PORT_LOGIC_LTSSM_STATE_MASK; + + return (val =3D=3D PORT_LOGIC_LTSSM_STATE_L0); +} + +static int fsd_pcie_host_init(struct dw_pcie_rp *pp) +{ + struct dw_pcie *pci =3D to_dw_pcie_from_pp(pp); + struct exynos_pcie *ep =3D to_exynos_pcie(pci); + + phy_init(ep->phy); + fsd_pcie_msi_init(ep); + + return 0; +} + +static const struct dw_pcie_host_ops fsd_pcie_host_ops =3D { + .init =3D fsd_pcie_host_init, +}; + +static int fsd_pcie_raise_irq(struct dw_pcie_ep *ep, u8 func_no, + unsigned int type, u16 interrupt_num) +{ + struct dw_pcie *pci =3D to_dw_pcie_from_ep(ep); + + switch (type) { + case PCI_IRQ_INTX: + return dw_pcie_ep_raise_intx_irq(ep, func_no); + case PCI_IRQ_MSIX: + dev_err(pci->dev, "EP does not support MSIX\n"); + return -EINVAL; + case PCI_IRQ_MSI: + return dw_pcie_ep_raise_msi_irq(ep, func_no, interrupt_num); + default: + dev_err(pci->dev, "UNKNOWN IRQ type\n"); + } + + return 0; +} + +static const struct pci_epc_features fsd_pcie_epc_features =3D { + .linkup_notifier =3D false, + .msi_capable =3D true, + .msix_capable =3D false, +}; + +static const struct pci_epc_features *fsd_pcie_get_features(struct dw_pcie= _ep *ep) +{ + return &fsd_pcie_epc_features; +} + +static const struct dw_pcie_ep_ops fsd_ep_ops =3D { + .raise_irq =3D fsd_pcie_raise_irq, + .get_features =3D fsd_pcie_get_features, +}; + +static void fsd_set_device_mode(struct exynos_pcie *ep) +{ + if (ep->pdata->device_mode =3D=3D DW_PCIE_RC_TYPE) + writel(FSD_DEVICE_TYPE_RC, ep->elbi_base + FSD_PCIE_DEVICE_TYPE); + else + writel(FSD_DEVICE_TYPE_EP, ep->elbi_base + FSD_PCIE_DEVICE_TYPE); +} + +static const struct dw_pcie_ops fsd_dw_pcie_ops =3D { + .read_dbi =3D fsd_pcie_read_dbi, + .write_dbi =3D fsd_pcie_write_dbi, + .write_dbi2 =3D fsd_pcie_write_dbi2, + .start_link =3D fsd_pcie_start_link, + .stop_link =3D fsd_pcie_stop_link, + .link_up =3D fsd_pcie_link_up, +}; + static const struct samsung_res_ops exynos_res_ops_data =3D { .init_regulator =3D exynos_init_regulator, .pcie_irq_handler =3D exynos_pcie_irq_handler, }; =20 +static const struct samsung_res_ops fsd_res_ops_data =3D { + .pcie_irq_handler =3D fsd_pcie_irq_handler, + .set_device_mode =3D fsd_set_device_mode, +}; + static int exynos_pcie_probe(struct platform_device *pdev) { struct device *dev =3D &pdev->dev; @@ -353,6 +577,26 @@ static int exynos_pcie_probe(struct platform_device *p= dev) if (IS_ERR(ep->phy)) return PTR_ERR(ep->phy); =20 + if (ep->pdata->soc_variant =3D=3D FSD) { + ret =3D dma_set_mask_and_coherent(dev, DMA_BIT_MASK(36)); + if (ret) + return ret; + + ep->sysreg =3D syscon_regmap_lookup_by_phandle(dev->of_node, + "samsung,syscon-pcie"); + if (IS_ERR(ep->sysreg)) { + dev_err(dev, "sysreg regmap lookup failed.\n"); + return PTR_ERR(ep->sysreg); + } + + ret =3D of_property_read_u32_index(dev->of_node, "samsung,syscon-pcie", = 1, + &ep->sysreg_offset); + if (ret) { + dev_err(dev, "couldn't get the register offset for syscon!\n"); + return ret; + } + } + /* External Local Bus interface (ELBI) registers */ ep->elbi_base =3D devm_platform_ioremap_resource_byname(pdev, "elbi"); if (IS_ERR(ep->elbi_base)) @@ -373,13 +617,43 @@ static int exynos_pcie_probe(struct platform_device *= pdev) return ret; =20 platform_set_drvdata(pdev, ep); - ret =3D samsung_irq_init(ep, pdev); - if (ret) - goto fail_regulator; - ep->pci.pp.ops =3D pdata->host_ops; - ret =3D dw_pcie_host_init(&ep->pci.pp); - if (ret < 0) + + if (pdata->res_ops->set_device_mode) + pdata->res_ops->set_device_mode(ep); + + switch (ep->pdata->device_mode) { + case DW_PCIE_RC_TYPE: + ret =3D samsung_irq_init(ep, pdev); + if (ret) + goto fail_regulator; + + ep->pci.pp.ops =3D pdata->host_ops; + + ret =3D dw_pcie_host_init(&ep->pci.pp); + if (ret < 0) + goto fail_phy_init; + + break; + case DW_PCIE_EP_TYPE: + phy_init(ep->phy); + + ep->pci.ep.ops =3D pdata->ep_ops; + + ret =3D dw_pcie_ep_init(&ep->pci.ep); + if (ret < 0) + goto fail_phy_init; + + ret =3D dw_pcie_ep_init_registers(&ep->pci.ep); + if (ret) + goto fail_phy_init; + + pci_epc_init_notify(ep->pci.ep.epc); + + break; + default: + dev_err(dev, "invalid device type\n"); goto fail_phy_init; + } =20 return 0; =20 @@ -395,8 +669,11 @@ static void exynos_pcie_remove(struct platform_device = *pdev) { struct exynos_pcie *ep =3D platform_get_drvdata(pdev); =20 + if (ep->pdata->device_mode =3D=3D DW_PCIE_EP_TYPE) + return; dw_pcie_host_deinit(&ep->pci.pp); - exynos_pcie_assert_core_reset(ep); + if (ep->pdata->soc_variant =3D=3D EXYNOS_5433) + exynos_pcie_assert_core_reset(ep); phy_power_off(ep->phy); phy_exit(ep->phy); samsung_regulator_disable(ep); @@ -405,8 +682,16 @@ static void exynos_pcie_remove(struct platform_device = *pdev) static int exynos_pcie_suspend_noirq(struct device *dev) { struct exynos_pcie *ep =3D dev_get_drvdata(dev); + struct dw_pcie *pci =3D &ep->pci; =20 - exynos_pcie_assert_core_reset(ep); + if (ep->pdata->device_mode =3D=3D DW_PCIE_EP_TYPE) + return 0; + + if (ep->pdata->dwc_ops->stop_link) + ep->pdata->dwc_ops->stop_link(pci); + + if (ep->pdata->soc_variant =3D=3D EXYNOS_5433) + exynos_pcie_assert_core_reset(ep); phy_power_off(ep->phy); phy_exit(ep->phy); samsung_regulator_disable(ep); @@ -421,6 +706,9 @@ static int exynos_pcie_resume_noirq(struct device *dev) struct dw_pcie_rp *pp =3D &pci->pp; int ret; =20 + if (ep->pdata->device_mode =3D=3D DW_PCIE_EP_TYPE) + return 0; + ret =3D samsung_regulator_enable(ep); if (ret) return ret; @@ -437,11 +725,30 @@ static const struct dev_pm_ops exynos_pcie_pm_ops =3D= { exynos_pcie_resume_noirq) }; =20 + +static const struct samsung_pcie_pdata fsd_hw3_pcie_rc_pdata =3D { + .dwc_ops =3D &fsd_dw_pcie_ops, + .host_ops =3D &fsd_pcie_host_ops, + .res_ops =3D &fsd_res_ops_data, + .soc_variant =3D FSD, + .device_mode =3D DW_PCIE_RC_TYPE, +}; + +static const struct samsung_pcie_pdata fsd_hw3_pcie_ep_pdata =3D { + .dwc_ops =3D &fsd_dw_pcie_ops, + .ep_ops =3D &fsd_ep_ops, + .res_ops =3D &fsd_res_ops_data, + .soc_variant =3D FSD, + .device_mode =3D DW_PCIE_EP_TYPE, +}; + static const struct samsung_pcie_pdata exynos_5433_pcie_rc_pdata =3D { .dwc_ops =3D &exynos_dw_pcie_ops, .pci_ops =3D &exynos_pci_ops, .host_ops =3D &exynos_pcie_host_ops, .res_ops =3D &exynos_res_ops_data, + .soc_variant =3D EXYNOS_5433, + .device_mode =3D DW_PCIE_RC_TYPE, }; =20 static const struct of_device_id exynos_pcie_of_match[] =3D { @@ -449,6 +756,14 @@ static const struct of_device_id exynos_pcie_of_match[= ] =3D { .compatible =3D "samsung,exynos5433-pcie", .data =3D (void *) &exynos_5433_pcie_rc_pdata, }, + { + .compatible =3D "tesla,fsd-pcie", + .data =3D (void *) &fsd_hw3_pcie_rc_pdata, + }, + { + .compatible =3D "tesla,fsd-pcie-ep", + .data =3D (void *) &fsd_hw3_pcie_ep_pdata, + }, { }, }; =20 --=20 2.49.0 From nobody Wed Oct 8 17:35:00 2025 Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C7A77237180 for ; Thu, 26 Jun 2025 02:38:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.254.224.24 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750905482; cv=none; b=sNgzCctPrN/bTOxk4wbzZ67SV+fZCK3YVUrrxIrJPp889VHtPH2ArA0q7QEVF7qmashLhQvW6i0CWim1cvEkJqRkQmnzOcQiqSC/E0hWAmoQRfN9x0vEg1oXVNR3793p64Vco9Xen2EdzCQHjZIpqEQ1omkthYcWyB/tZzc1Un8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750905482; c=relaxed/simple; bh=FKLQu0+uWVlKGUZ1wJN/GzcsmbKVFDMojnxvBYfT7v8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:MIME-Version: Content-Type:References; b=X09784v/NqpZwOXP6gKRoBHmS7GqWWzM0LRog01KSdj8GUf8p090byhbtrEvv79EhFidM6n3Knm2as+Y6LLJdxrNJwIJiiUtEWcpWPBg4lk3PraMi9x92Yi+rdV36+a1B3p5dFc5myohdPbjNVYhV85xmFipFQoIW1dCpqlfQJo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=QjzfzeDz; arc=none smtp.client-ip=203.254.224.24 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="QjzfzeDz" Received: from epcas5p4.samsung.com (unknown [182.195.41.42]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20250626023759epoutp01edfaa9d7dea67416b8a7f01a8517fb3f~Md0GyF6zF0837608376epoutp014 for ; Thu, 26 Jun 2025 02:37:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20250626023759epoutp01edfaa9d7dea67416b8a7f01a8517fb3f~Md0GyF6zF0837608376epoutp014 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1750905479; bh=g/dIw6y8kcmo8LyyHZHnCh5ijJd2K5kh6Hh1rXMgcz4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QjzfzeDzSu11dJtU03IFmwks7HTQtYobUEFeMtWjMBlywO7uzes2YYd8QVLSOtzNb xV3gy+hvjB0DJKC2xaOC5CiHMR0USNCj4my89vu8oW/lGZV6DXFJOcx5t/xV0GagR1 Cv6i/jA1JK+cEm5e/HubiGjbaefCAAWMcli237Uw= Received: from epsnrtp01.localdomain (unknown [182.195.42.153]) by epcas5p4.samsung.com (KnoxPortal) with ESMTPS id 20250626023758epcas5p4b32b1be235660e5c1f067356e4728958~Md0GSjQ4W0510205102epcas5p44; Thu, 26 Jun 2025 02:37:58 +0000 (GMT) Received: from epcas5p1.samsung.com (unknown [182.195.38.179]) by epsnrtp01.localdomain (Postfix) with ESMTP id 4bSNC838BWz6B9m5; Thu, 26 Jun 2025 02:37:56 +0000 (GMT) Received: from epsmtip2.samsung.com (unknown [182.195.34.31]) by epcas5p4.samsung.com (KnoxPortal) with ESMTPA id 20250625165332epcas5p4e138b7f7c8ebb938dc526c5dc29412bb~MV1z_GoE62849628496epcas5p4H; Wed, 25 Jun 2025 16:53:32 +0000 (GMT) Received: from cheetah.samsungds.net (unknown [107.109.115.53]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20250625165329epsmtip2fc6e559e500702fdd2b1ad06ee61e433~MV1xNmFnm1255612556epsmtip2e; Wed, 25 Jun 2025 16:53:28 +0000 (GMT) From: Shradha Todi To: linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-fsd@tesla.com Cc: manivannan.sadhasivam@linaro.org, lpieralisi@kernel.org, kw@linux.com, robh@kernel.org, bhelgaas@google.com, jingoohan1@gmail.com, krzk+dt@kernel.org, conor+dt@kernel.org, alim.akhtar@samsung.com, vkoul@kernel.org, kishon@kernel.org, arnd@arndb.de, m.szyprowski@samsung.com, jh80.chung@samsung.com, pankaj.dubey@samsung.com, Shradha Todi Subject: [PATCH v2 10/10] arm64: dts: fsd: Add PCIe support for Tesla FSD SoC Date: Wed, 25 Jun 2025 22:22:29 +0530 Message-ID: <20250625165229.3458-11-shradha.t@samsung.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250625165229.3458-1-shradha.t@samsung.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CMS-MailID: 20250625165332epcas5p4e138b7f7c8ebb938dc526c5dc29412bb X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P cpgsPolicy: CPGSC10-541,Y X-CFilter-Loop: Reflected X-CMS-RootMailID: 20250625165332epcas5p4e138b7f7c8ebb938dc526c5dc29412bb References: <20250625165229.3458-1-shradha.t@samsung.com> Add the support for PCIe controller driver and phy driver for Tesla FSD. It includes support for both RC and EP. Signed-off-by: Pankaj Dubey Signed-off-by: Shradha Todi --- arch/arm64/boot/dts/tesla/fsd-evb.dts | 36 +++++ arch/arm64/boot/dts/tesla/fsd-pinctrl.dtsi | 65 +++++++++ arch/arm64/boot/dts/tesla/fsd.dtsi | 147 +++++++++++++++++++++ 3 files changed, 248 insertions(+) diff --git a/arch/arm64/boot/dts/tesla/fsd-evb.dts b/arch/arm64/boot/dts/te= sla/fsd-evb.dts index 9ff22e1c8723..c8f2019e6abf 100644 --- a/arch/arm64/boot/dts/tesla/fsd-evb.dts +++ b/arch/arm64/boot/dts/tesla/fsd-evb.dts @@ -19,6 +19,8 @@ / { aliases { serial0 =3D &serial_0; serial1 =3D &serial_1; + pciephy0 =3D &pciephy0; + pciephy1 =3D &pciephy1; }; =20 chosen { @@ -130,3 +132,37 @@ &serial_0 { &ufs { status =3D "okay"; }; + +&pcierc2 { + pinctrl-names =3D "default"; + pinctrl-0 =3D <&pcie1_clkreq>, <&pcie1_wake>, <&pcie1_preset>, + <&pcie0_slot1>; +}; + +&pcieep2 { + pinctrl-names =3D "default"; + pinctrl-0 =3D <&pcie1_clkreq>, <&pcie1_wake>, <&pcie1_preset>, + <&pcie0_slot1>; +}; + +&pcierc0 { + pinctrl-names =3D "default"; + pinctrl-0 =3D <&pcie0_clkreq>, <&pcie0_wake0>, <&pcie0_preset0>, + <&pcie0_slot0>; +}; + +&pcieep0 { + pinctrl-names =3D "default"; + pinctrl-0 =3D <&pcie0_clkreq>, <&pcie0_wake0>, <&pcie0_preset0>, + <&pcie0_slot0>; +}; + +&pcierc1 { + pinctrl-names =3D "default"; + pinctrl-0 =3D <&pcie0_clkreq>, <&pcie0_wake1>, <&pcie0_preset0>; +}; + +&pcieep1 { + pinctrl-names =3D "default"; + pinctrl-0 =3D <&pcie0_clkreq>, <&pcie0_wake1>, <&pcie0_preset0>; +}; diff --git a/arch/arm64/boot/dts/tesla/fsd-pinctrl.dtsi b/arch/arm64/boot/d= ts/tesla/fsd-pinctrl.dtsi index 6f4658f57453..fa99aa4b9906 100644 --- a/arch/arm64/boot/dts/tesla/fsd-pinctrl.dtsi +++ b/arch/arm64/boot/dts/tesla/fsd-pinctrl.dtsi @@ -120,6 +120,27 @@ eth0_mdio: eth0-mdio-pins { samsung,pin-pud =3D ; samsung,pin-drv =3D ; }; + + pcie1_clkreq: pcie1-clkreq-pins { + samsung,pins =3D "gpf6-0"; + samsung,pin-function =3D ; + samsung,pin-pud =3D ; + samsung,pin-drv =3D ; + }; + + pcie1_wake: pcie1-wake-pins { + samsung,pins =3D "gpf6-1"; + samsung,pin-function =3D ; + samsung,pin-pud =3D ; + samsung,pin-drv =3D ; + }; + + pcie1_preset: pcie1-preset-pins { + samsung,pins =3D "gpf6-2"; + samsung,pin-function =3D ; + samsung,pin-pud =3D ; + samsung,pin-drv =3D ; + }; }; =20 &pinctrl_peric { @@ -493,6 +514,50 @@ eth1_mdio: eth1-mdio-pins { samsung,pin-pud =3D ; samsung,pin-drv =3D ; }; + + pcie0_clkreq: pcie0-clkreq-pins { + samsung,pins =3D "gpc8-0"; + samsung,pin-function =3D ; + samsung,pin-pud =3D ; + samsung,pin-drv =3D ; + }; + + pcie0_wake0: pcie0-wake0-pins { + samsung,pins =3D "gpc8-1"; + samsung,pin-function =3D ; + samsung,pin-pud =3D ; + samsung,pin-drv =3D ; + }; + + pcie0_preset0: pcie0-preset0-pins { + samsung,pins =3D "gpc8-2"; + samsung,pin-function =3D ; + samsung,pin-pud =3D ; + samsung,pin-drv =3D ; + }; + + pcie0_wake1: pcie0-wake1-pins { + samsung,pins =3D "gpc8-3"; + samsung,pin-function =3D ; + samsung,pin-pud =3D ; + samsung,pin-drv =3D ; + }; + + pcie0_slot0: pcie0-gpio22-pins { + samsung,pins =3D "gpg2-6"; + samsung,pin-function =3D ; + samsung,pin-pud =3D ; + samsung,pin-drv =3D ; + samsung,pin-val =3D <1>; + }; + + pcie0_slot1: pcie0-gpio23-pins { + samsung,pins =3D "gpg2-7"; + samsung,pin-function =3D ; + samsung,pin-pud =3D ; + samsung,pin-drv =3D ; + samsung,pin-val =3D <1>; + }; }; =20 &pinctrl_pmu { diff --git a/arch/arm64/boot/dts/tesla/fsd.dtsi b/arch/arm64/boot/dts/tesla= /fsd.dtsi index a5ebb3f9b18f..9e2d095546fa 100644 --- a/arch/arm64/boot/dts/tesla/fsd.dtsi +++ b/arch/arm64/boot/dts/tesla/fsd.dtsi @@ -1009,6 +1009,16 @@ ethernet1: ethernet@14300000 { status =3D "disabled"; }; =20 + pciephy0: pcie-phy@15080000 { + compatible =3D "tesla,fsd-pcie-phy"; + #phy-cells =3D <0>; + reg =3D <0x0 0x15080000 0x0 0x2000>, + <0x0 0x150a0000 0x0 0x1000>; + samsung,pmu-syscon =3D <&pmu_system_controller>; + samsung,fsys-sysreg =3D <&sysreg_fsys0>; + status =3D "disabled"; + }; + ufs: ufs@15120000 { compatible =3D "tesla,fsd-ufs"; reg =3D <0x0 0x15120000 0x0 0x200>, /* 0: HCI standard */ @@ -1057,6 +1067,143 @@ ethernet0: ethernet@15300000 { iommus =3D <&smmu_fsys0 0x0 0x1>; status =3D "disabled"; }; + + pcierc2: pcie@15400000 { + compatible =3D "tesla,fsd-pcie"; + reg =3D <0x0 0x15400000 0x0 0x2000>, + <0x0 0x15090000 0x0 0x1000>, + <0x0 0x15800000 0x0 0x1000>; + reg-names =3D "dbi", "elbi", "config"; + ranges =3D <0x82000000 0 0x15801000 0 0x15801000 0 0xffefff>; + clocks =3D <&clock_fsys0 PCIE_SUBCTRL_INST0_AUX_CLK_SOC>, + <&clock_fsys0 PCIE_SUBCTRL_INST0_DBI_ACLK_SOC>, + <&clock_fsys0 PCIE_SUBCTRL_INST0_MSTR_ACLK_SOC>, + <&clock_fsys0 PCIE_SUBCTRL_INST0_SLV_ACLK_SOC>; + clock-names =3D "aux", "dbi", "mstr", "slv"; + #address-cells =3D <3>; + #size-cells =3D <2>; + dma-coherent; + device_type =3D "pci"; + interrupts =3D ; + num-lanes =3D <4>; + samsung,syscon-pcie =3D <&sysreg_fsys0 0x434>; + phys =3D <&pciephy0>; + iommu-map =3D <0x0 &smmu_fsys0 0x4 0x10000>; + iommu-map-mask =3D <0x0>; + status =3D "disabled"; + }; + + pcieep2: pcie-ep@15400000 { + compatible =3D "tesla,fsd-pcie-ep"; + reg =3D <0x0 0x15090000 0x0 0x1000>, + <0x0 0x15400000 0x0 0x2000>, + <0x0 0x15402000 0x0 0x80>, + <0x0 0x15800000 0x0 0xff0000>; + reg-names =3D "elbi", "dbi", "dbi2", "addr_space"; + clocks =3D <&clock_fsys0 PCIE_SUBCTRL_INST0_AUX_CLK_SOC>, + <&clock_fsys0 PCIE_SUBCTRL_INST0_DBI_ACLK_SOC>, + <&clock_fsys0 PCIE_SUBCTRL_INST0_MSTR_ACLK_SOC>, + <&clock_fsys0 PCIE_SUBCTRL_INST0_SLV_ACLK_SOC>; + clock-names =3D "aux", "dbi", "mstr", "slv"; + num-lanes =3D <4>; + samsung,syscon-pcie =3D <&sysreg_fsys0 0x434>; + phys =3D <&pciephy0>; + status =3D "disabled"; + }; + + pciephy1: pcie-phy@16880000 { + compatible =3D "tesla,fsd-pcie-phy"; + #phy-cells =3D <0>; + reg =3D <0x0 0x16880000 0x0 0x2000>, + <0x0 0x16860000 0x0 0x1000>; + samsung,pmu-syscon =3D <&pmu_system_controller>; + samsung,fsys-sysreg =3D <&sysreg_fsys1>; + status =3D "disabled"; + }; + + pcierc0: pcie@16a00000 { + compatible =3D "tesla,fsd-pcie"; + reg =3D <0x0 0x16a00000 0x0 0x2000>, + <0x0 0x168b0000 0x0 0x1000>, + <0x0 0x17000000 0x0 0x1000>; + reg-names =3D "dbi", "elbi", "config"; + ranges =3D <0x82000000 0 0x17001000 0 0x17001000 0 0xffefff>; + clocks =3D <&clock_fsys1 PCIE_LINK0_IPCLKPORT_AUX_ACLK>, + <&clock_fsys1 PCIE_LINK0_IPCLKPORT_DBI_ACLK>, + <&clock_fsys1 PCIE_LINK0_IPCLKPORT_MSTR_ACLK>, + <&clock_fsys1 PCIE_LINK0_IPCLKPORT_SLV_ACLK>; + clock-names =3D "aux", "dbi", "mstr", "slv"; + #address-cells =3D <3>; + #size-cells =3D <2>; + dma-coherent; + device_type =3D "pci"; + interrupts =3D ; + num-lanes =3D <4>; + samsung,syscon-pcie =3D <&sysreg_fsys1 0x50c>; + phys =3D <&pciephy1>; + iommu-map =3D <0x0 &smmu_imem 0x0 0x10000>; + iommu-map-mask =3D <0x0>; + status =3D "disabled"; + }; + + pcieep0: pcie-ep@16a00000 { + compatible =3D "tesla,fsd-pcie-ep"; + reg =3D <0x0 0x168b0000 0x0 0x1000>, + <0x0 0x16a00000 0x0 0x2000>, + <0x0 0x16a02000 0x0 0x80>, + <0x0 0x17000000 0x0 0xff0000>; + reg-names =3D "elbi", "dbi", "dbi2", "addr_space"; + clocks =3D <&clock_fsys1 PCIE_LINK0_IPCLKPORT_AUX_ACLK>, + <&clock_fsys1 PCIE_LINK0_IPCLKPORT_DBI_ACLK>, + <&clock_fsys1 PCIE_LINK0_IPCLKPORT_MSTR_ACLK>, + <&clock_fsys1 PCIE_LINK0_IPCLKPORT_SLV_ACLK>; + clock-names =3D "aux", "dbi", "mstr", "slv"; + num-lanes =3D <4>; + samsung,syscon-pcie =3D <&sysreg_fsys1 0x50c>; + phys =3D <&pciephy1>; + status =3D "disabled"; + }; + + pcierc1: pcie@16b00000 { + compatible =3D "tesla,fsd-pcie"; + reg =3D <0x0 0x16b00000 0x0 0x2000>, + <0x0 0x168c0000 0x0 0x1000>, + <0x0 0x18000000 0x0 0x1000>; + reg-names =3D "dbi", "elbi", "config"; + ranges =3D <0x82000000 0 0x18001000 0 0x18001000 0 0xffefff>; + clocks =3D <&clock_fsys1 PCIE_LINK1_IPCLKPORT_AUX_ACLK>, + <&clock_fsys1 PCIE_LINK1_IPCLKPORT_DBI_ACLK>, + <&clock_fsys1 PCIE_LINK1_IPCLKPORT_MSTR_ACLK>, + <&clock_fsys1 PCIE_LINK1_IPCLKPORT_SLV_ACLK>; + clock-names =3D "aux", "dbi", "mstr", "slv"; + #address-cells =3D <3>; + #size-cells =3D <2>; + dma-coherent; + device_type =3D "pci"; + interrupts =3D ; + num-lanes =3D <4>; + samsung,syscon-pcie =3D <&sysreg_fsys1 0x510>; + phys =3D <&pciephy1>; + status =3D "disabled"; + }; + + pcieep1: pcie-ep@16b00000 { + compatible =3D "tesla,fsd-pcie-ep"; + reg =3D <0x0 0x168c0000 0x0 0x1000>, + <0x0 0x16b00000 0x0 0x2000>, + <0x0 0x16b02000 0x0 0x80>, + <0x0 0x18000000 0x0 0xff0000>; + reg-names =3D "elbi", "dbi", "dbi2", "addr_space"; + clocks =3D <&clock_fsys1 PCIE_LINK1_IPCLKPORT_AUX_ACLK>, + <&clock_fsys1 PCIE_LINK1_IPCLKPORT_DBI_ACLK>, + <&clock_fsys1 PCIE_LINK1_IPCLKPORT_MSTR_ACLK>, + <&clock_fsys1 PCIE_LINK1_IPCLKPORT_SLV_ACLK>; + clock-names =3D "aux", "dbi", "mstr", "slv"; + num-lanes =3D <4>; + samsung,syscon-pcie =3D <&sysreg_fsys1 0x510>; + phys =3D <&pciephy1>; + status =3D "disabled"; + }; }; }; =20 --=20 2.49.0