* [PATCH v5 01/10] dt-bindings: imx6q-pcie: Add ref clock for i.MX95 PCIe RC
2024-10-31 8:06 [PATCH v5 0/10] A bunch of changes to refine i.MX PCIe driver Richard Zhu
@ 2024-10-31 8:06 ` Richard Zhu
2024-10-31 8:06 ` [PATCH v5 02/10] PCI: imx6: Add ref clock for i.MX95 PCIe Richard Zhu
` (8 subsequent siblings)
9 siblings, 0 replies; 16+ messages in thread
From: Richard Zhu @ 2024-10-31 8:06 UTC (permalink / raw)
To: l.stach, bhelgaas, lpieralisi, kw, manivannan.sadhasivam, robh,
krzk+dt, conor+dt, shawnguo, frank.li, s.hauer, festevam
Cc: imx, kernel, linux-pci, linux-arm-kernel, devicetree,
linux-kernel, Richard Zhu, Krzysztof Kozlowski
Previous reference clock of i.MX95 PCIe RC is on when system boot to
kernel. But boot firmware change the behavor, it is off when boot. So it
needs be turn on when it is used. Also it needs be turn off/on when suspend
and resume.
Add one ref clock for i.MX95 PCIe RC. Increase clocks' maxItems to 5 and
keep the same restriction with other compatible string.
Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
.../bindings/pci/fsl,imx6q-pcie-common.yaml | 4 +--
.../bindings/pci/fsl,imx6q-pcie-ep.yaml | 1 +
.../bindings/pci/fsl,imx6q-pcie.yaml | 25 ++++++++++++++++---
3 files changed, 24 insertions(+), 6 deletions(-)
diff --git a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-common.yaml b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-common.yaml
index a8b34f58f8f4..cddbe21f99f2 100644
--- a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-common.yaml
+++ b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-common.yaml
@@ -17,11 +17,11 @@ description:
properties:
clocks:
minItems: 3
- maxItems: 4
+ maxItems: 5
clock-names:
minItems: 3
- maxItems: 4
+ maxItems: 5
num-lanes:
const: 1
diff --git a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-ep.yaml b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-ep.yaml
index 84ca12e8b25b..f41f704c6729 100644
--- a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-ep.yaml
+++ b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-ep.yaml
@@ -103,6 +103,7 @@ allOf:
properties:
clocks:
minItems: 4
+ maxItems: 4
clock-names:
items:
- const: pcie
diff --git a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml
index 1e05c560d797..4c76cd3f98a9 100644
--- a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml
+++ b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml
@@ -40,10 +40,11 @@ properties:
- description: PCIe PHY clock.
- description: Additional required clock entry for imx6sx-pcie,
imx6sx-pcie-ep, imx8mq-pcie, imx8mq-pcie-ep.
+ - description: PCIe reference clock.
clock-names:
minItems: 3
- maxItems: 4
+ maxItems: 5
interrupts:
items:
@@ -127,7 +128,7 @@ allOf:
then:
properties:
clocks:
- minItems: 4
+ maxItems: 4
clock-names:
items:
- const: pcie
@@ -140,11 +141,10 @@ allOf:
compatible:
enum:
- fsl,imx8mq-pcie
- - fsl,imx95-pcie
then:
properties:
clocks:
- minItems: 4
+ maxItems: 4
clock-names:
items:
- const: pcie
@@ -200,6 +200,23 @@ allOf:
- const: mstr
- const: slv
+ - if:
+ properties:
+ compatible:
+ enum:
+ - fsl,imx95-pcie
+ then:
+ properties:
+ clocks:
+ maxItems: 5
+ clock-names:
+ items:
+ - const: pcie
+ - const: pcie_bus
+ - const: pcie_phy
+ - const: pcie_aux
+ - const: ref
+
unevaluatedProperties: false
examples:
--
2.37.1
^ permalink raw reply related [flat|nested] 16+ messages in thread* [PATCH v5 02/10] PCI: imx6: Add ref clock for i.MX95 PCIe
2024-10-31 8:06 [PATCH v5 0/10] A bunch of changes to refine i.MX PCIe driver Richard Zhu
2024-10-31 8:06 ` [PATCH v5 01/10] dt-bindings: imx6q-pcie: Add ref clock for i.MX95 PCIe RC Richard Zhu
@ 2024-10-31 8:06 ` Richard Zhu
2024-10-31 16:04 ` Frank Li
2024-10-31 22:39 ` kernel test robot
2024-10-31 8:06 ` [PATCH v5 03/10] PCI: imx6: Fetch dbi2 and iATU base addesses from DT Richard Zhu
` (7 subsequent siblings)
9 siblings, 2 replies; 16+ messages in thread
From: Richard Zhu @ 2024-10-31 8:06 UTC (permalink / raw)
To: l.stach, bhelgaas, lpieralisi, kw, manivannan.sadhasivam, robh,
krzk+dt, conor+dt, shawnguo, frank.li, s.hauer, festevam
Cc: imx, kernel, linux-pci, linux-arm-kernel, devicetree,
linux-kernel, Richard Zhu, Frank Li
Add "ref" clock to enable reference clock. To avoid the DT
compatibility, i.MX95 REF clock might be optional. Replace the
devm_clk_bulk_get() by devm_clk_bulk_get_optional() to fetch
i.MX95 PCIe clocks in driver.
If use external clock, ref clock should point to external reference.
If use internal clock, CREF_EN in LAST_TO_REG controls reference output,
which implement in drivers/clk/imx/clk-imx95-blk-ctl.c.
Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
---
drivers/pci/controller/dwc/pci-imx6.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
index 808d1f105417..73cb69ba8933 100644
--- a/drivers/pci/controller/dwc/pci-imx6.c
+++ b/drivers/pci/controller/dwc/pci-imx6.c
@@ -82,6 +82,7 @@ enum imx_pcie_variants {
#define IMX_PCIE_FLAG_HAS_SERDES BIT(6)
#define IMX_PCIE_FLAG_SUPPORT_64BIT BIT(7)
#define IMX_PCIE_FLAG_CPU_ADDR_FIXUP BIT(8)
+#define IMX_PCIE_FLAG_CLOCKS_OPTIONAL BIT(9)
#define imx_check_flag(pci, val) (pci->drvdata->flags & val)
@@ -1330,7 +1331,12 @@ static int imx_pcie_probe(struct platform_device *pdev)
imx_pcie->clks[i].id = imx_pcie->drvdata->clk_names[i];
/* Fetch clocks */
- ret = devm_clk_bulk_get(dev, imx_pcie->drvdata->clks_cnt, imx_pcie->clks);
+ if (imx_check_flag(imx_pcie, IMX_PCIE_FLAG_CLOCKS_OPTIONAL))
+ ret = devm_clk_bulk_get_optional(dev, imx_pcie->drvdata->clks_cnt,
+ imx_pcie->clks);
+ else
+ ret = devm_clk_bulk_get(dev, imx_pcie->drvdata->clks_cnt,
+ imx_pcie->clks);
if (ret)
return ret;
@@ -1480,6 +1486,8 @@ static const char * const imx8mm_clks[] = {"pcie_bus", "pcie", "pcie_aux"};
static const char * const imx8mq_clks[] = {"pcie_bus", "pcie", "pcie_phy", "pcie_aux"};
static const char * const imx6sx_clks[] = {"pcie_bus", "pcie", "pcie_phy", "pcie_inbound_axi"};
static const char * const imx8q_clks[] = {"mstr", "slv", "dbi"};
+static const char * const imx95_clks[] = {"pcie_bus", "pcie", "pcie_phy", "pcie_aux", "ref"};
+static const char * const imx95_ext_osc_clks[] = {"pcie_bus", "pcie", "pcie_phy", "pcie_aux"};
static const struct imx_pcie_drvdata drvdata[] = {
[IMX6Q] = {
@@ -1592,9 +1600,10 @@ static const struct imx_pcie_drvdata drvdata[] = {
},
[IMX95] = {
.variant = IMX95,
- .flags = IMX_PCIE_FLAG_HAS_SERDES,
- .clk_names = imx8mq_clks,
- .clks_cnt = ARRAY_SIZE(imx8mq_clks),
+ .flags = IMX_PCIE_FLAG_HAS_SERDES |
+ IMX_PCIE_FLAG_CLOCKS_OPTIONAL,
+ .clk_names = imx95_clks,
+ .clks_cnt = ARRAY_SIZE(imx95_clks),
.ltssm_off = IMX95_PE0_GEN_CTRL_3,
.ltssm_mask = IMX95_PCIE_LTSSM_EN,
.mode_off[0] = IMX95_PE0_GEN_CTRL_1,
--
2.37.1
^ permalink raw reply related [flat|nested] 16+ messages in thread* Re: [PATCH v5 02/10] PCI: imx6: Add ref clock for i.MX95 PCIe
2024-10-31 8:06 ` [PATCH v5 02/10] PCI: imx6: Add ref clock for i.MX95 PCIe Richard Zhu
@ 2024-10-31 16:04 ` Frank Li
2024-10-31 22:39 ` kernel test robot
1 sibling, 0 replies; 16+ messages in thread
From: Frank Li @ 2024-10-31 16:04 UTC (permalink / raw)
To: Richard Zhu
Cc: l.stach, bhelgaas, lpieralisi, kw, manivannan.sadhasivam, robh,
krzk+dt, conor+dt, shawnguo, s.hauer, festevam, imx, kernel,
linux-pci, linux-arm-kernel, devicetree, linux-kernel
On Thu, Oct 31, 2024 at 04:06:47PM +0800, Richard Zhu wrote:
> Add "ref" clock to enable reference clock. To avoid the DT
> compatibility, i.MX95 REF clock might be optional. Replace the
> devm_clk_bulk_get() by devm_clk_bulk_get_optional() to fetch
> i.MX95 PCIe clocks in driver.
>
> If use external clock, ref clock should point to external reference.
>
> If use internal clock, CREF_EN in LAST_TO_REG controls reference output,
> which implement in drivers/clk/imx/clk-imx95-blk-ctl.c.
>
> Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
> Reviewed-by: Frank Li <Frank.Li@nxp.com>
> ---
> drivers/pci/controller/dwc/pci-imx6.c | 17 +++++++++++++----
> 1 file changed, 13 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
> index 808d1f105417..73cb69ba8933 100644
> --- a/drivers/pci/controller/dwc/pci-imx6.c
> +++ b/drivers/pci/controller/dwc/pci-imx6.c
> @@ -82,6 +82,7 @@ enum imx_pcie_variants {
> #define IMX_PCIE_FLAG_HAS_SERDES BIT(6)
> #define IMX_PCIE_FLAG_SUPPORT_64BIT BIT(7)
> #define IMX_PCIE_FLAG_CPU_ADDR_FIXUP BIT(8)
> +#define IMX_PCIE_FLAG_CLOCKS_OPTIONAL BIT(9)
>
> #define imx_check_flag(pci, val) (pci->drvdata->flags & val)
>
> @@ -1330,7 +1331,12 @@ static int imx_pcie_probe(struct platform_device *pdev)
> imx_pcie->clks[i].id = imx_pcie->drvdata->clk_names[i];
>
> /* Fetch clocks */
> - ret = devm_clk_bulk_get(dev, imx_pcie->drvdata->clks_cnt, imx_pcie->clks);
> + if (imx_check_flag(imx_pcie, IMX_PCIE_FLAG_CLOCKS_OPTIONAL))
> + ret = devm_clk_bulk_get_optional(dev, imx_pcie->drvdata->clks_cnt,
> + imx_pcie->clks);
> + else
> + ret = devm_clk_bulk_get(dev, imx_pcie->drvdata->clks_cnt,
> + imx_pcie->clks);
int require_cnt = imx_pcie->drvdata->clks_cnt - imx_pcie->drvdata->clks_optional_cnt;
devm_clk_bulk_get(dev, require_cnt, imx_pcie->clks);
devm_clk_bulk_get_optional(dev, imx_pcie->drvdata->clks_optional_cnt,
imx_pcie->clks + require_cnt);
So we easy to add more optional clks in future and without lost required
clocks safty checks.
> if (ret)
> return ret;
>
> @@ -1480,6 +1486,8 @@ static const char * const imx8mm_clks[] = {"pcie_bus", "pcie", "pcie_aux"};
> static const char * const imx8mq_clks[] = {"pcie_bus", "pcie", "pcie_phy", "pcie_aux"};
> static const char * const imx6sx_clks[] = {"pcie_bus", "pcie", "pcie_phy", "pcie_inbound_axi"};
> static const char * const imx8q_clks[] = {"mstr", "slv", "dbi"};
> +static const char * const imx95_clks[] = {"pcie_bus", "pcie", "pcie_phy", "pcie_aux", "ref"};
> +static const char * const imx95_ext_osc_clks[] = {"pcie_bus", "pcie", "pcie_phy", "pcie_aux"};
>
> static const struct imx_pcie_drvdata drvdata[] = {
> [IMX6Q] = {
> @@ -1592,9 +1600,10 @@ static const struct imx_pcie_drvdata drvdata[] = {
> },
> [IMX95] = {
> .variant = IMX95,
> - .flags = IMX_PCIE_FLAG_HAS_SERDES,
> - .clk_names = imx8mq_clks,
> - .clks_cnt = ARRAY_SIZE(imx8mq_clks),
> + .flags = IMX_PCIE_FLAG_HAS_SERDES |
> + IMX_PCIE_FLAG_CLOCKS_OPTIONAL,
> + .clk_names = imx95_clks,
> + .clks_cnt = ARRAY_SIZE(imx95_clks),
Suggest add .clks_optional_cnt = 1,
> .ltssm_off = IMX95_PE0_GEN_CTRL_3,
> .ltssm_mask = IMX95_PCIE_LTSSM_EN,
> .mode_off[0] = IMX95_PE0_GEN_CTRL_1,
> --
> 2.37.1
>
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [PATCH v5 02/10] PCI: imx6: Add ref clock for i.MX95 PCIe
2024-10-31 8:06 ` [PATCH v5 02/10] PCI: imx6: Add ref clock for i.MX95 PCIe Richard Zhu
2024-10-31 16:04 ` Frank Li
@ 2024-10-31 22:39 ` kernel test robot
1 sibling, 0 replies; 16+ messages in thread
From: kernel test robot @ 2024-10-31 22:39 UTC (permalink / raw)
To: Richard Zhu, l.stach, bhelgaas, lpieralisi, kw,
manivannan.sadhasivam, robh, krzk+dt, conor+dt, shawnguo,
frank.li, s.hauer, festevam
Cc: llvm, oe-kbuild-all, imx, kernel, linux-pci, linux-arm-kernel,
devicetree, linux-kernel, Richard Zhu, Frank Li
Hi Richard,
kernel test robot noticed the following build warnings:
[auto build test WARNING on pci/next]
[also build test WARNING on pci/for-linus shawnguo/for-next mani-mhi/mhi-next linus/master v6.12-rc5 next-20241031]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Richard-Zhu/dt-bindings-imx6q-pcie-Add-ref-clock-for-i-MX95-PCIe-RC/20241031-160000
base: https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git next
patch link: https://lore.kernel.org/r/20241031080655.3879139-3-hongxing.zhu%40nxp.com
patch subject: [PATCH v5 02/10] PCI: imx6: Add ref clock for i.MX95 PCIe
config: um-allmodconfig (https://download.01.org/0day-ci/archive/20241101/202411010605.6YPlxVeu-lkp@intel.com/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 639a7ac648f1e50ccd2556e17d401c04f9cce625)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241101/202411010605.6YPlxVeu-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202411010605.6YPlxVeu-lkp@intel.com/
All warnings (new ones prefixed by >>):
In file included from drivers/pci/controller/dwc/pci-imx6.c:21:
In file included from include/linux/of_address.h:7:
In file included from include/linux/io.h:14:
In file included from arch/um/include/asm/io.h:24:
include/asm-generic/io.h:548:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
548 | val = __raw_readb(PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:561:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
561 | val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
| ~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu'
37 | #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
| ^
In file included from drivers/pci/controller/dwc/pci-imx6.c:21:
In file included from include/linux/of_address.h:7:
In file included from include/linux/io.h:14:
In file included from arch/um/include/asm/io.h:24:
include/asm-generic/io.h:574:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
574 | val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
| ~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu'
35 | #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
| ^
In file included from drivers/pci/controller/dwc/pci-imx6.c:21:
In file included from include/linux/of_address.h:7:
In file included from include/linux/io.h:14:
In file included from arch/um/include/asm/io.h:24:
include/asm-generic/io.h:585:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
585 | __raw_writeb(value, PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:595:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
595 | __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:605:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
605 | __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:693:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
693 | readsb(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:701:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
701 | readsw(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:709:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
709 | readsl(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:718:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
718 | writesb(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:727:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
727 | writesw(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:736:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
736 | writesl(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
In file included from drivers/pci/controller/dwc/pci-imx6.c:22:
In file included from include/linux/pci.h:1645:
In file included from include/linux/dmapool.h:14:
In file included from include/linux/scatterlist.h:8:
In file included from include/linux/mm.h:2213:
include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
518 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
>> drivers/pci/controller/dwc/pci-imx6.c:1490:27: warning: unused variable 'imx95_ext_osc_clks' [-Wunused-const-variable]
1490 | static const char * const imx95_ext_osc_clks[] = {"pcie_bus", "pcie", "pcie_phy", "pcie_aux"};
| ^~~~~~~~~~~~~~~~~~
14 warnings generated.
Kconfig warnings: (for reference only)
WARNING: unmet direct dependencies detected for MODVERSIONS
Depends on [n]: MODULES [=y] && !COMPILE_TEST [=y]
Selected by [y]:
- RANDSTRUCT_FULL [=y] && (CC_HAS_RANDSTRUCT [=y] || GCC_PLUGINS [=n]) && MODULES [=y]
WARNING: unmet direct dependencies detected for GET_FREE_REGION
Depends on [n]: SPARSEMEM [=n]
Selected by [m]:
- RESOURCE_KUNIT_TEST [=m] && RUNTIME_TESTING_MENU [=y] && KUNIT [=m]
vim +/imx95_ext_osc_clks +1490 drivers/pci/controller/dwc/pci-imx6.c
1483
1484 static const char * const imx6q_clks[] = {"pcie_bus", "pcie", "pcie_phy"};
1485 static const char * const imx8mm_clks[] = {"pcie_bus", "pcie", "pcie_aux"};
1486 static const char * const imx8mq_clks[] = {"pcie_bus", "pcie", "pcie_phy", "pcie_aux"};
1487 static const char * const imx6sx_clks[] = {"pcie_bus", "pcie", "pcie_phy", "pcie_inbound_axi"};
1488 static const char * const imx8q_clks[] = {"mstr", "slv", "dbi"};
1489 static const char * const imx95_clks[] = {"pcie_bus", "pcie", "pcie_phy", "pcie_aux", "ref"};
> 1490 static const char * const imx95_ext_osc_clks[] = {"pcie_bus", "pcie", "pcie_phy", "pcie_aux"};
1491
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v5 03/10] PCI: imx6: Fetch dbi2 and iATU base addesses from DT
2024-10-31 8:06 [PATCH v5 0/10] A bunch of changes to refine i.MX PCIe driver Richard Zhu
2024-10-31 8:06 ` [PATCH v5 01/10] dt-bindings: imx6q-pcie: Add ref clock for i.MX95 PCIe RC Richard Zhu
2024-10-31 8:06 ` [PATCH v5 02/10] PCI: imx6: Add ref clock for i.MX95 PCIe Richard Zhu
@ 2024-10-31 8:06 ` Richard Zhu
2024-10-31 16:06 ` Frank Li
2024-10-31 8:06 ` [PATCH v5 04/10] PCI: imx6: Correct controller_id generation logic for i.MX7D Richard Zhu
` (6 subsequent siblings)
9 siblings, 1 reply; 16+ messages in thread
From: Richard Zhu @ 2024-10-31 8:06 UTC (permalink / raw)
To: l.stach, bhelgaas, lpieralisi, kw, manivannan.sadhasivam, robh,
krzk+dt, conor+dt, shawnguo, frank.li, s.hauer, festevam
Cc: imx, kernel, linux-pci, linux-arm-kernel, devicetree,
linux-kernel, Richard Zhu
Since dbi2 and atu regs are added for i.MX8M PCIes. Fetch the dbi2 and iATU
base addresses from DT directly, and remove the useless codes.
Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
---
drivers/pci/controller/dwc/pci-imx6.c | 20 --------------------
1 file changed, 20 deletions(-)
diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
index 73cb69ba8933..d21f7d2e79dc 100644
--- a/drivers/pci/controller/dwc/pci-imx6.c
+++ b/drivers/pci/controller/dwc/pci-imx6.c
@@ -1114,7 +1114,6 @@ static int imx_add_pcie_ep(struct imx_pcie *imx_pcie,
struct platform_device *pdev)
{
int ret;
- unsigned int pcie_dbi2_offset;
struct dw_pcie_ep *ep;
struct dw_pcie *pci = imx_pcie->pci;
struct dw_pcie_rp *pp = &pci->pp;
@@ -1124,25 +1123,6 @@ static int imx_add_pcie_ep(struct imx_pcie *imx_pcie,
ep = &pci->ep;
ep->ops = &pcie_ep_ops;
- switch (imx_pcie->drvdata->variant) {
- case IMX8MQ_EP:
- case IMX8MM_EP:
- case IMX8MP_EP:
- pcie_dbi2_offset = SZ_1M;
- break;
- default:
- pcie_dbi2_offset = SZ_4K;
- break;
- }
-
- pci->dbi_base2 = pci->dbi_base + pcie_dbi2_offset;
-
- /*
- * FIXME: Ideally, dbi2 base address should come from DT. But since only IMX95 is defining
- * "dbi2" in DT, "dbi_base2" is set to NULL here for that platform alone so that the DWC
- * core code can fetch that from DT. But once all platform DTs were fixed, this and the
- * above "dbi_base2" setting should be removed.
- */
if (device_property_match_string(dev, "reg-names", "dbi2") >= 0)
pci->dbi_base2 = NULL;
--
2.37.1
^ permalink raw reply related [flat|nested] 16+ messages in thread* Re: [PATCH v5 03/10] PCI: imx6: Fetch dbi2 and iATU base addesses from DT
2024-10-31 8:06 ` [PATCH v5 03/10] PCI: imx6: Fetch dbi2 and iATU base addesses from DT Richard Zhu
@ 2024-10-31 16:06 ` Frank Li
0 siblings, 0 replies; 16+ messages in thread
From: Frank Li @ 2024-10-31 16:06 UTC (permalink / raw)
To: Richard Zhu
Cc: l.stach, bhelgaas, lpieralisi, kw, manivannan.sadhasivam, robh,
krzk+dt, conor+dt, shawnguo, s.hauer, festevam, imx, kernel,
linux-pci, linux-arm-kernel, devicetree, linux-kernel
On Thu, Oct 31, 2024 at 04:06:48PM +0800, Richard Zhu wrote:
> Since dbi2 and atu regs are added for i.MX8M PCIes. Fetch the dbi2 and iATU
> base addresses from DT directly, and remove the useless codes.
>
> Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
> ---
Need declear not compatible broken for upstreams' dts because not dts
enable EP function in upstream tree.
> drivers/pci/controller/dwc/pci-imx6.c | 20 --------------------
> 1 file changed, 20 deletions(-)
>
> diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
> index 73cb69ba8933..d21f7d2e79dc 100644
> --- a/drivers/pci/controller/dwc/pci-imx6.c
> +++ b/drivers/pci/controller/dwc/pci-imx6.c
> @@ -1114,7 +1114,6 @@ static int imx_add_pcie_ep(struct imx_pcie *imx_pcie,
> struct platform_device *pdev)
> {
> int ret;
> - unsigned int pcie_dbi2_offset;
> struct dw_pcie_ep *ep;
> struct dw_pcie *pci = imx_pcie->pci;
> struct dw_pcie_rp *pp = &pci->pp;
> @@ -1124,25 +1123,6 @@ static int imx_add_pcie_ep(struct imx_pcie *imx_pcie,
> ep = &pci->ep;
> ep->ops = &pcie_ep_ops;
>
> - switch (imx_pcie->drvdata->variant) {
> - case IMX8MQ_EP:
> - case IMX8MM_EP:
> - case IMX8MP_EP:
> - pcie_dbi2_offset = SZ_1M;
> - break;
> - default:
> - pcie_dbi2_offset = SZ_4K;
> - break;
> - }
> -
> - pci->dbi_base2 = pci->dbi_base + pcie_dbi2_offset;
> -
> - /*
> - * FIXME: Ideally, dbi2 base address should come from DT. But since only IMX95 is defining
> - * "dbi2" in DT, "dbi_base2" is set to NULL here for that platform alone so that the DWC
> - * core code can fetch that from DT. But once all platform DTs were fixed, this and the
> - * above "dbi_base2" setting should be removed.
> - */
> if (device_property_match_string(dev, "reg-names", "dbi2") >= 0)
> pci->dbi_base2 = NULL;
>
> --
> 2.37.1
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v5 04/10] PCI: imx6: Correct controller_id generation logic for i.MX7D
2024-10-31 8:06 [PATCH v5 0/10] A bunch of changes to refine i.MX PCIe driver Richard Zhu
` (2 preceding siblings ...)
2024-10-31 8:06 ` [PATCH v5 03/10] PCI: imx6: Fetch dbi2 and iATU base addesses from DT Richard Zhu
@ 2024-10-31 8:06 ` Richard Zhu
2024-10-31 16:17 ` Frank Li
2024-10-31 8:06 ` [PATCH v5 05/10] PCI: imx6: Make core reset assertion deassertion symmetric Richard Zhu
` (5 subsequent siblings)
9 siblings, 1 reply; 16+ messages in thread
From: Richard Zhu @ 2024-10-31 8:06 UTC (permalink / raw)
To: l.stach, bhelgaas, lpieralisi, kw, manivannan.sadhasivam, robh,
krzk+dt, conor+dt, shawnguo, frank.li, s.hauer, festevam
Cc: imx, kernel, linux-pci, linux-arm-kernel, devicetree,
linux-kernel, Richard Zhu, Frank Li
i.MX7D only has one PCIe controller, so controller_id should always be 0.
The previous code is incorrect although yielding the correct result. Fix by
removing IMX7D from the switch case branch.
Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
---
drivers/pci/controller/dwc/pci-imx6.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
index d21f7d2e79dc..7479d3253f20 100644
--- a/drivers/pci/controller/dwc/pci-imx6.c
+++ b/drivers/pci/controller/dwc/pci-imx6.c
@@ -1344,7 +1344,6 @@ static int imx_pcie_probe(struct platform_device *pdev)
switch (imx_pcie->drvdata->variant) {
case IMX8MQ:
case IMX8MQ_EP:
- case IMX7D:
if (dbi_base->start == IMX8MQ_PCIE2_BASE_ADDR)
imx_pcie->controller_id = 1;
break;
--
2.37.1
^ permalink raw reply related [flat|nested] 16+ messages in thread* Re: [PATCH v5 04/10] PCI: imx6: Correct controller_id generation logic for i.MX7D
2024-10-31 8:06 ` [PATCH v5 04/10] PCI: imx6: Correct controller_id generation logic for i.MX7D Richard Zhu
@ 2024-10-31 16:17 ` Frank Li
0 siblings, 0 replies; 16+ messages in thread
From: Frank Li @ 2024-10-31 16:17 UTC (permalink / raw)
To: Richard Zhu
Cc: l.stach, bhelgaas, lpieralisi, kw, manivannan.sadhasivam, robh,
krzk+dt, conor+dt, shawnguo, s.hauer, festevam, imx, kernel,
linux-pci, linux-arm-kernel, devicetree, linux-kernel
On Thu, Oct 31, 2024 at 04:06:49PM +0800, Richard Zhu wrote:
> i.MX7D only has one PCIe controller, so controller_id should always be 0.
> The previous code is incorrect although yielding the correct result. Fix by
> removing IMX7D from the switch case branch.
>
> Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
> Reviewed-by: Frank Li <Frank.Li@nxp.com>
> ---
You can simple mention previous discussion here.
Converience for reviewer, and past previous discission here.
"This is just *wrong*. You cannot hardcode the MMIO address in the driver. Even
though this code is old, you should fix it instead of building on top of it.
- Mani"
IMX7D here is wrong athough check IMX8MQ_PCIE2_BASE_ADDR is not good
method. Previously try to use 'linux,pci-domain' to replace this check
logic. Need more discussion to improve it and keep old compatiblity. Let's
fix this code error firstly.
Frank
> drivers/pci/controller/dwc/pci-imx6.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
> index d21f7d2e79dc..7479d3253f20 100644
> --- a/drivers/pci/controller/dwc/pci-imx6.c
> +++ b/drivers/pci/controller/dwc/pci-imx6.c
> @@ -1344,7 +1344,6 @@ static int imx_pcie_probe(struct platform_device *pdev)
> switch (imx_pcie->drvdata->variant) {
> case IMX8MQ:
> case IMX8MQ_EP:
> - case IMX7D:
> if (dbi_base->start == IMX8MQ_PCIE2_BASE_ADDR)
> imx_pcie->controller_id = 1;
> break;
> --
> 2.37.1
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v5 05/10] PCI: imx6: Make core reset assertion deassertion symmetric
2024-10-31 8:06 [PATCH v5 0/10] A bunch of changes to refine i.MX PCIe driver Richard Zhu
` (3 preceding siblings ...)
2024-10-31 8:06 ` [PATCH v5 04/10] PCI: imx6: Correct controller_id generation logic for i.MX7D Richard Zhu
@ 2024-10-31 8:06 ` Richard Zhu
2024-10-31 8:06 ` [PATCH v5 06/10] PCI: imx6: Fix the missing reference clock disable logic Richard Zhu
` (4 subsequent siblings)
9 siblings, 0 replies; 16+ messages in thread
From: Richard Zhu @ 2024-10-31 8:06 UTC (permalink / raw)
To: l.stach, bhelgaas, lpieralisi, kw, manivannan.sadhasivam, robh,
krzk+dt, conor+dt, shawnguo, frank.li, s.hauer, festevam
Cc: imx, kernel, linux-pci, linux-arm-kernel, devicetree,
linux-kernel, Richard Zhu, Frank Li
Add apps_reset deassertion in the imx_pcie_deassert_core_reset(). Let it be
symmetric with imx_pcie_assert_core_reset().
In the commit first introduced apps_reset, apps_reset is asserted in
imx6_pcie_assert_core_reset(), but it is de-asserted in another place, in
stead of the according symmetric function imx6_pcie_deassert_core_reset().
Use this patch to fix it, and make core reset assertion deasertion
symmetric.
Fixes: 9b3fe6796d7c ("PCI: imx6: Add code to support i.MX7D")
Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
---
drivers/pci/controller/dwc/pci-imx6.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
index 7479d3253f20..92f2d2536ffc 100644
--- a/drivers/pci/controller/dwc/pci-imx6.c
+++ b/drivers/pci/controller/dwc/pci-imx6.c
@@ -771,6 +771,7 @@ static void imx_pcie_assert_core_reset(struct imx_pcie *imx_pcie)
static int imx_pcie_deassert_core_reset(struct imx_pcie *imx_pcie)
{
reset_control_deassert(imx_pcie->pciephy_reset);
+ reset_control_deassert(imx_pcie->apps_reset);
if (imx_pcie->drvdata->core_reset)
imx_pcie->drvdata->core_reset(imx_pcie, false);
--
2.37.1
^ permalink raw reply related [flat|nested] 16+ messages in thread* [PATCH v5 06/10] PCI: imx6: Fix the missing reference clock disable logic
2024-10-31 8:06 [PATCH v5 0/10] A bunch of changes to refine i.MX PCIe driver Richard Zhu
` (4 preceding siblings ...)
2024-10-31 8:06 ` [PATCH v5 05/10] PCI: imx6: Make core reset assertion deassertion symmetric Richard Zhu
@ 2024-10-31 8:06 ` Richard Zhu
2024-10-31 8:06 ` [PATCH v5 07/10] PCI: imx6: Clean up codes by removing imx7d_pcie_init_phy() Richard Zhu
` (3 subsequent siblings)
9 siblings, 0 replies; 16+ messages in thread
From: Richard Zhu @ 2024-10-31 8:06 UTC (permalink / raw)
To: l.stach, bhelgaas, lpieralisi, kw, manivannan.sadhasivam, robh,
krzk+dt, conor+dt, shawnguo, frank.li, s.hauer, festevam
Cc: imx, kernel, linux-pci, linux-arm-kernel, devicetree,
linux-kernel, Richard Zhu, Frank Li
Ensure the *_enable_ref_clk() function is symmetric by addressing missing
disable parts on some platforms.
Fixes: d0a75c791f98 ("PCI: imx6: Factor out ref clock disable to match enable")
Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
---
drivers/pci/controller/dwc/pci-imx6.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
index 92f2d2536ffc..e696dc9381cd 100644
--- a/drivers/pci/controller/dwc/pci-imx6.c
+++ b/drivers/pci/controller/dwc/pci-imx6.c
@@ -594,10 +594,9 @@ static int imx_pcie_attach_pd(struct device *dev)
static int imx6sx_pcie_enable_ref_clk(struct imx_pcie *imx_pcie, bool enable)
{
- if (enable)
- regmap_clear_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12,
- IMX6SX_GPR12_PCIE_TEST_POWERDOWN);
-
+ regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12,
+ IMX6SX_GPR12_PCIE_TEST_POWERDOWN,
+ enable ? 0 : IMX6SX_GPR12_PCIE_TEST_POWERDOWN);
return 0;
}
@@ -626,19 +625,20 @@ static int imx8mm_pcie_enable_ref_clk(struct imx_pcie *imx_pcie, bool enable)
{
int offset = imx_pcie_grp_offset(imx_pcie);
- if (enable) {
- regmap_clear_bits(imx_pcie->iomuxc_gpr, offset, IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE);
- regmap_set_bits(imx_pcie->iomuxc_gpr, offset, IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE_EN);
- }
-
+ regmap_update_bits(imx_pcie->iomuxc_gpr, offset,
+ IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE,
+ enable ? 0 : IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE);
+ regmap_update_bits(imx_pcie->iomuxc_gpr, offset,
+ IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE_EN,
+ enable ? IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE_EN : 0);
return 0;
}
static int imx7d_pcie_enable_ref_clk(struct imx_pcie *imx_pcie, bool enable)
{
- if (!enable)
- regmap_set_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12,
- IMX7D_GPR12_PCIE_PHY_REFCLK_SEL);
+ regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12,
+ IMX7D_GPR12_PCIE_PHY_REFCLK_SEL,
+ enable ? 0 : IMX7D_GPR12_PCIE_PHY_REFCLK_SEL);
return 0;
}
--
2.37.1
^ permalink raw reply related [flat|nested] 16+ messages in thread* [PATCH v5 07/10] PCI: imx6: Clean up codes by removing imx7d_pcie_init_phy()
2024-10-31 8:06 [PATCH v5 0/10] A bunch of changes to refine i.MX PCIe driver Richard Zhu
` (5 preceding siblings ...)
2024-10-31 8:06 ` [PATCH v5 06/10] PCI: imx6: Fix the missing reference clock disable logic Richard Zhu
@ 2024-10-31 8:06 ` Richard Zhu
2024-10-31 8:06 ` [PATCH v5 08/10] PCI: imx6: Use dwc common suspend resume method Richard Zhu
` (2 subsequent siblings)
9 siblings, 0 replies; 16+ messages in thread
From: Richard Zhu @ 2024-10-31 8:06 UTC (permalink / raw)
To: l.stach, bhelgaas, lpieralisi, kw, manivannan.sadhasivam, robh,
krzk+dt, conor+dt, shawnguo, frank.li, s.hauer, festevam
Cc: imx, kernel, linux-pci, linux-arm-kernel, devicetree,
linux-kernel, Richard Zhu, Frank Li
Remove the duplicate imx7d_pcie_init_phy() function as it is the same as
imx7d_pcie_enable_ref_clk().
Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
---
drivers/pci/controller/dwc/pci-imx6.c | 8 --------
1 file changed, 8 deletions(-)
diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
index e696dc9381cd..dbcf22e440e2 100644
--- a/drivers/pci/controller/dwc/pci-imx6.c
+++ b/drivers/pci/controller/dwc/pci-imx6.c
@@ -389,13 +389,6 @@ static int imx8mq_pcie_init_phy(struct imx_pcie *imx_pcie)
return 0;
}
-static int imx7d_pcie_init_phy(struct imx_pcie *imx_pcie)
-{
- regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX7D_GPR12_PCIE_PHY_REFCLK_SEL, 0);
-
- return 0;
-}
-
static int imx_pcie_init_phy(struct imx_pcie *imx_pcie)
{
regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12,
@@ -1529,7 +1522,6 @@ static const struct imx_pcie_drvdata drvdata[] = {
.clks_cnt = ARRAY_SIZE(imx6q_clks),
.mode_off[0] = IOMUXC_GPR12,
.mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE,
- .init_phy = imx7d_pcie_init_phy,
.enable_ref_clk = imx7d_pcie_enable_ref_clk,
.core_reset = imx7d_pcie_core_reset,
},
--
2.37.1
^ permalink raw reply related [flat|nested] 16+ messages in thread* [PATCH v5 08/10] PCI: imx6: Use dwc common suspend resume method
2024-10-31 8:06 [PATCH v5 0/10] A bunch of changes to refine i.MX PCIe driver Richard Zhu
` (6 preceding siblings ...)
2024-10-31 8:06 ` [PATCH v5 07/10] PCI: imx6: Clean up codes by removing imx7d_pcie_init_phy() Richard Zhu
@ 2024-10-31 8:06 ` Richard Zhu
2024-10-31 16:21 ` Frank Li
2024-10-31 8:06 ` [PATCH v5 09/10] PCI: imx6: Add i.MX8MQ i.MX8Q and i.MX95 PCIe PM support Richard Zhu
2024-10-31 8:06 ` [PATCH v5 10/10] arm64: dts: imx95: Add ref clock for i.MX95 PCIe Richard Zhu
9 siblings, 1 reply; 16+ messages in thread
From: Richard Zhu @ 2024-10-31 8:06 UTC (permalink / raw)
To: l.stach, bhelgaas, lpieralisi, kw, manivannan.sadhasivam, robh,
krzk+dt, conor+dt, shawnguo, frank.li, s.hauer, festevam
Cc: imx, kernel, linux-pci, linux-arm-kernel, devicetree,
linux-kernel, Frank Li, Richard Zhu
From: Frank Li <Frank.Li@nxp.com>
Call common dwc suspend/resume function. Use dwc common iATU method to
send out PME_TURN_OFF message. In Old DWC implementations,
PCIE_ATU_INHIBIT_PAYLOAD bit in iATU Ctrl2 register is reserved. So the
generic DWC implementation of sending the PME_Turn_Off message using a
dummy MMIO write cannot be used. Use previouse method to kick off
PME_TURN_OFF MSG for these platforms.
Replace the imx_pcie_stop_link() and imx_pcie_host_exit() by
dw_pcie_suspend_noirq() in imx_pcie_suspend_noirq().
dw_pcie_suspend_noirq()
dw_pcie_stop_link();
pci->pp.ops->deinit();
imx_pcie_host_exit();
Replace the imx_pcie_host_init(), dw_pcie_setup_rc() and
imx_pcie_start_link() by dw_pcie_resume_noirq() in
imx_pcie_resume_noirq().
dw_pcie_resume_noirq()
pci->pp.ops->init();
imx_pcie_host_init();
dw_pcie_setup_rc();
dw_pcie_start_link();
imx_pcie_start_link();
Signed-off-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
---
drivers/pci/controller/dwc/pci-imx6.c | 96 ++++++++++-----------------
1 file changed, 35 insertions(+), 61 deletions(-)
diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
index dbcf22e440e2..410a31e5f82a 100644
--- a/drivers/pci/controller/dwc/pci-imx6.c
+++ b/drivers/pci/controller/dwc/pci-imx6.c
@@ -33,6 +33,7 @@
#include <linux/pm_domain.h>
#include <linux/pm_runtime.h>
+#include "../../pci.h"
#include "pcie-designware.h"
#define IMX8MQ_GPR_PCIE_REF_USE_PAD BIT(9)
@@ -83,6 +84,7 @@ enum imx_pcie_variants {
#define IMX_PCIE_FLAG_SUPPORT_64BIT BIT(7)
#define IMX_PCIE_FLAG_CPU_ADDR_FIXUP BIT(8)
#define IMX_PCIE_FLAG_CLOCKS_OPTIONAL BIT(9)
+#define IMX_PCIE_FLAG_CUSTOM_PME_TURNOFF BIT(10)
#define imx_check_flag(pci, val) (pci->drvdata->flags & val)
@@ -107,19 +109,18 @@ struct imx_pcie_drvdata {
int (*init_phy)(struct imx_pcie *pcie);
int (*enable_ref_clk)(struct imx_pcie *pcie, bool enable);
int (*core_reset)(struct imx_pcie *pcie, bool assert);
+ const struct dw_pcie_host_ops *ops;
};
struct imx_pcie {
struct dw_pcie *pci;
struct gpio_desc *reset_gpiod;
- bool link_is_up;
struct clk_bulk_data clks[IMX_PCIE_MAX_CLKS];
struct regmap *iomuxc_gpr;
u16 msi_ctrl;
u32 controller_id;
struct reset_control *pciephy_reset;
struct reset_control *apps_reset;
- struct reset_control *turnoff_reset;
u32 tx_deemph_gen1;
u32 tx_deemph_gen2_3p5db;
u32 tx_deemph_gen2_6db;
@@ -898,13 +899,11 @@ static int imx_pcie_start_link(struct dw_pcie *pci)
dev_info(dev, "Link: Only Gen1 is enabled\n");
}
- imx_pcie->link_is_up = true;
tmp = dw_pcie_readw_dbi(pci, offset + PCI_EXP_LNKSTA);
dev_info(dev, "Link up, Gen%i\n", tmp & PCI_EXP_LNKSTA_CLS);
return 0;
err_reset_phy:
- imx_pcie->link_is_up = false;
dev_dbg(dev, "PHY DEBUG_R0=0x%08x DEBUG_R1=0x%08x\n",
dw_pcie_readl_dbi(pci, PCIE_PORT_DEBUG0),
dw_pcie_readl_dbi(pci, PCIE_PORT_DEBUG1));
@@ -1023,9 +1022,32 @@ static u64 imx_pcie_cpu_addr_fixup(struct dw_pcie *pcie, u64 cpu_addr)
return cpu_addr - entry->offset;
}
+/*
+ * In Old DWC implementations, PCIE_ATU_INHIBIT_PAYLOAD bit in iATU Ctrl2
+ * register is reserved. So the generic DWC implementation of sending the
+ * PME_Turn_Off message using a dummy MMIO write cannot be used.
+ */
+static void imx_pcie_pme_turn_off(struct dw_pcie_rp *pp)
+{
+ struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
+ struct imx_pcie *imx_pcie = to_imx_pcie(pci);
+
+ regmap_set_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX6SX_GPR12_PCIE_PM_TURN_OFF);
+ regmap_clear_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX6SX_GPR12_PCIE_PM_TURN_OFF);
+
+ usleep_range(PCIE_PME_TO_L2_TIMEOUT_US/10, PCIE_PME_TO_L2_TIMEOUT_US);
+}
+
+
static const struct dw_pcie_host_ops imx_pcie_host_ops = {
.init = imx_pcie_host_init,
.deinit = imx_pcie_host_exit,
+ .pme_turn_off = imx_pcie_pme_turn_off,
+};
+
+static const struct dw_pcie_host_ops imx_pcie_host_dw_pme_ops = {
+ .init = imx_pcie_host_init,
+ .deinit = imx_pcie_host_exit,
};
static const struct dw_pcie_ops dw_pcie_ops = {
@@ -1146,43 +1168,6 @@ static int imx_add_pcie_ep(struct imx_pcie *imx_pcie,
return 0;
}
-static void imx_pcie_pm_turnoff(struct imx_pcie *imx_pcie)
-{
- struct device *dev = imx_pcie->pci->dev;
-
- /* Some variants have a turnoff reset in DT */
- if (imx_pcie->turnoff_reset) {
- reset_control_assert(imx_pcie->turnoff_reset);
- reset_control_deassert(imx_pcie->turnoff_reset);
- goto pm_turnoff_sleep;
- }
-
- /* Others poke directly at IOMUXC registers */
- switch (imx_pcie->drvdata->variant) {
- case IMX6SX:
- case IMX6QP:
- regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12,
- IMX6SX_GPR12_PCIE_PM_TURN_OFF,
- IMX6SX_GPR12_PCIE_PM_TURN_OFF);
- regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12,
- IMX6SX_GPR12_PCIE_PM_TURN_OFF, 0);
- break;
- default:
- dev_err(dev, "PME_Turn_Off not implemented\n");
- return;
- }
-
- /*
- * Components with an upstream port must respond to
- * PME_Turn_Off with PME_TO_Ack but we can't check.
- *
- * The standard recommends a 1-10ms timeout after which to
- * proceed anyway as if acks were received.
- */
-pm_turnoff_sleep:
- usleep_range(1000, 10000);
-}
-
static void imx_pcie_msi_save_restore(struct imx_pcie *imx_pcie, bool save)
{
u8 offset;
@@ -1206,36 +1191,26 @@ static void imx_pcie_msi_save_restore(struct imx_pcie *imx_pcie, bool save)
static int imx_pcie_suspend_noirq(struct device *dev)
{
struct imx_pcie *imx_pcie = dev_get_drvdata(dev);
- struct dw_pcie_rp *pp = &imx_pcie->pci->pp;
if (!(imx_pcie->drvdata->flags & IMX_PCIE_FLAG_SUPPORTS_SUSPEND))
return 0;
imx_pcie_msi_save_restore(imx_pcie, true);
- imx_pcie_pm_turnoff(imx_pcie);
- imx_pcie_stop_link(imx_pcie->pci);
- imx_pcie_host_exit(pp);
-
- return 0;
+ return dw_pcie_suspend_noirq(imx_pcie->pci);
}
static int imx_pcie_resume_noirq(struct device *dev)
{
int ret;
struct imx_pcie *imx_pcie = dev_get_drvdata(dev);
- struct dw_pcie_rp *pp = &imx_pcie->pci->pp;
if (!(imx_pcie->drvdata->flags & IMX_PCIE_FLAG_SUPPORTS_SUSPEND))
return 0;
- ret = imx_pcie_host_init(pp);
+ ret = dw_pcie_resume_noirq(imx_pcie->pci);
if (ret)
return ret;
imx_pcie_msi_save_restore(imx_pcie, false);
- dw_pcie_setup_rc(pp);
-
- if (imx_pcie->link_is_up)
- imx_pcie_start_link(imx_pcie->pci);
return 0;
}
@@ -1267,11 +1242,14 @@ static int imx_pcie_probe(struct platform_device *pdev)
pci->dev = dev;
pci->ops = &dw_pcie_ops;
- pci->pp.ops = &imx_pcie_host_ops;
imx_pcie->pci = pci;
imx_pcie->drvdata = of_device_get_match_data(dev);
+ pci->pp.ops = &imx_pcie_host_dw_pme_ops;
+ if (imx_pcie->drvdata->ops)
+ pci->pp.ops = imx_pcie->drvdata->ops;
+
/* Find the PHY if one is defined, only imx7d uses it */
np = of_parse_phandle(node, "fsl,imx7d-pcie-phy", 0);
if (np) {
@@ -1345,13 +1323,6 @@ static int imx_pcie_probe(struct platform_device *pdev)
break;
}
- /* Grab turnoff reset */
- imx_pcie->turnoff_reset = devm_reset_control_get_optional_exclusive(dev, "turnoff");
- if (IS_ERR(imx_pcie->turnoff_reset)) {
- dev_err(dev, "Failed to get TURNOFF reset control\n");
- return PTR_ERR(imx_pcie->turnoff_reset);
- }
-
if (imx_pcie->drvdata->gpr) {
/* Grab GPR config register range */
imx_pcie->iomuxc_gpr =
@@ -1430,6 +1401,7 @@ static int imx_pcie_probe(struct platform_device *pdev)
if (ret < 0)
return ret;
} else {
+ pci->pp.use_atu_msg = true;
ret = dw_pcie_host_init(&pci->pp);
if (ret < 0)
return ret;
@@ -1494,6 +1466,7 @@ static const struct imx_pcie_drvdata drvdata[] = {
.init_phy = imx6sx_pcie_init_phy,
.enable_ref_clk = imx6sx_pcie_enable_ref_clk,
.core_reset = imx6sx_pcie_core_reset,
+ .ops = &imx_pcie_host_ops,
},
[IMX6QP] = {
.variant = IMX6QP,
@@ -1511,6 +1484,7 @@ static const struct imx_pcie_drvdata drvdata[] = {
.init_phy = imx_pcie_init_phy,
.enable_ref_clk = imx6q_pcie_enable_ref_clk,
.core_reset = imx6qp_pcie_core_reset,
+ .ops = &imx_pcie_host_ops,
},
[IMX7D] = {
.variant = IMX7D,
--
2.37.1
^ permalink raw reply related [flat|nested] 16+ messages in thread* Re: [PATCH v5 08/10] PCI: imx6: Use dwc common suspend resume method
2024-10-31 8:06 ` [PATCH v5 08/10] PCI: imx6: Use dwc common suspend resume method Richard Zhu
@ 2024-10-31 16:21 ` Frank Li
0 siblings, 0 replies; 16+ messages in thread
From: Frank Li @ 2024-10-31 16:21 UTC (permalink / raw)
To: Richard Zhu
Cc: l.stach, bhelgaas, lpieralisi, kw, manivannan.sadhasivam, robh,
krzk+dt, conor+dt, shawnguo, s.hauer, festevam, imx, kernel,
linux-pci, linux-arm-kernel, devicetree, linux-kernel
On Thu, Oct 31, 2024 at 04:06:53PM +0800, Richard Zhu wrote:
> From: Frank Li <Frank.Li@nxp.com>
>
> Call common dwc suspend/resume function. Use dwc common iATU method to
> send out PME_TURN_OFF message. In Old DWC implementations,
> PCIE_ATU_INHIBIT_PAYLOAD bit in iATU Ctrl2 register is reserved. So the
> generic DWC implementation of sending the PME_Turn_Off message using a
> dummy MMIO write cannot be used. Use previouse method to kick off
> PME_TURN_OFF MSG for these platforms.
>
> Replace the imx_pcie_stop_link() and imx_pcie_host_exit() by
> dw_pcie_suspend_noirq() in imx_pcie_suspend_noirq().
because dw_pcie_suspend_noirq() already do these, see below call stack:
>
> dw_pcie_suspend_noirq()
> dw_pcie_stop_link();
> pci->pp.ops->deinit();
> imx_pcie_host_exit();
>
> Replace the imx_pcie_host_init(), dw_pcie_setup_rc() and
> imx_pcie_start_link() by dw_pcie_resume_noirq() in
> imx_pcie_resume_noirq().
because it dw_pcie_resume_noirq() already do these, see below call stack:
>
> dw_pcie_resume_noirq()
> pci->pp.ops->init();
> imx_pcie_host_init();
> dw_pcie_setup_rc();
> dw_pcie_start_link();
> imx_pcie_start_link();
>
> Signed-off-by: Frank Li <Frank.Li@nxp.com>
> Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
> ---
> drivers/pci/controller/dwc/pci-imx6.c | 96 ++++++++++-----------------
> 1 file changed, 35 insertions(+), 61 deletions(-)
>
> diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
> index dbcf22e440e2..410a31e5f82a 100644
> --- a/drivers/pci/controller/dwc/pci-imx6.c
> +++ b/drivers/pci/controller/dwc/pci-imx6.c
> @@ -33,6 +33,7 @@
> #include <linux/pm_domain.h>
> #include <linux/pm_runtime.h>
>
> +#include "../../pci.h"
> #include "pcie-designware.h"
>
> #define IMX8MQ_GPR_PCIE_REF_USE_PAD BIT(9)
> @@ -83,6 +84,7 @@ enum imx_pcie_variants {
> #define IMX_PCIE_FLAG_SUPPORT_64BIT BIT(7)
> #define IMX_PCIE_FLAG_CPU_ADDR_FIXUP BIT(8)
> #define IMX_PCIE_FLAG_CLOCKS_OPTIONAL BIT(9)
> +#define IMX_PCIE_FLAG_CUSTOM_PME_TURNOFF BIT(10)
>
> #define imx_check_flag(pci, val) (pci->drvdata->flags & val)
>
> @@ -107,19 +109,18 @@ struct imx_pcie_drvdata {
> int (*init_phy)(struct imx_pcie *pcie);
> int (*enable_ref_clk)(struct imx_pcie *pcie, bool enable);
> int (*core_reset)(struct imx_pcie *pcie, bool assert);
> + const struct dw_pcie_host_ops *ops;
> };
>
> struct imx_pcie {
> struct dw_pcie *pci;
> struct gpio_desc *reset_gpiod;
> - bool link_is_up;
> struct clk_bulk_data clks[IMX_PCIE_MAX_CLKS];
> struct regmap *iomuxc_gpr;
> u16 msi_ctrl;
> u32 controller_id;
> struct reset_control *pciephy_reset;
> struct reset_control *apps_reset;
> - struct reset_control *turnoff_reset;
> u32 tx_deemph_gen1;
> u32 tx_deemph_gen2_3p5db;
> u32 tx_deemph_gen2_6db;
> @@ -898,13 +899,11 @@ static int imx_pcie_start_link(struct dw_pcie *pci)
> dev_info(dev, "Link: Only Gen1 is enabled\n");
> }
>
> - imx_pcie->link_is_up = true;
> tmp = dw_pcie_readw_dbi(pci, offset + PCI_EXP_LNKSTA);
> dev_info(dev, "Link up, Gen%i\n", tmp & PCI_EXP_LNKSTA_CLS);
> return 0;
>
> err_reset_phy:
> - imx_pcie->link_is_up = false;
> dev_dbg(dev, "PHY DEBUG_R0=0x%08x DEBUG_R1=0x%08x\n",
> dw_pcie_readl_dbi(pci, PCIE_PORT_DEBUG0),
> dw_pcie_readl_dbi(pci, PCIE_PORT_DEBUG1));
> @@ -1023,9 +1022,32 @@ static u64 imx_pcie_cpu_addr_fixup(struct dw_pcie *pcie, u64 cpu_addr)
> return cpu_addr - entry->offset;
> }
>
> +/*
> + * In Old DWC implementations, PCIE_ATU_INHIBIT_PAYLOAD bit in iATU Ctrl2
> + * register is reserved. So the generic DWC implementation of sending the
> + * PME_Turn_Off message using a dummy MMIO write cannot be used.
> + */
> +static void imx_pcie_pme_turn_off(struct dw_pcie_rp *pp)
> +{
> + struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
> + struct imx_pcie *imx_pcie = to_imx_pcie(pci);
> +
> + regmap_set_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX6SX_GPR12_PCIE_PM_TURN_OFF);
> + regmap_clear_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX6SX_GPR12_PCIE_PM_TURN_OFF);
> +
> + usleep_range(PCIE_PME_TO_L2_TIMEOUT_US/10, PCIE_PME_TO_L2_TIMEOUT_US);
> +}
> +
> +
> static const struct dw_pcie_host_ops imx_pcie_host_ops = {
> .init = imx_pcie_host_init,
> .deinit = imx_pcie_host_exit,
> + .pme_turn_off = imx_pcie_pme_turn_off,
> +};
> +
> +static const struct dw_pcie_host_ops imx_pcie_host_dw_pme_ops = {
> + .init = imx_pcie_host_init,
> + .deinit = imx_pcie_host_exit,
> };
>
> static const struct dw_pcie_ops dw_pcie_ops = {
> @@ -1146,43 +1168,6 @@ static int imx_add_pcie_ep(struct imx_pcie *imx_pcie,
> return 0;
> }
>
> -static void imx_pcie_pm_turnoff(struct imx_pcie *imx_pcie)
> -{
> - struct device *dev = imx_pcie->pci->dev;
> -
> - /* Some variants have a turnoff reset in DT */
> - if (imx_pcie->turnoff_reset) {
> - reset_control_assert(imx_pcie->turnoff_reset);
> - reset_control_deassert(imx_pcie->turnoff_reset);
> - goto pm_turnoff_sleep;
> - }
> -
> - /* Others poke directly at IOMUXC registers */
> - switch (imx_pcie->drvdata->variant) {
> - case IMX6SX:
> - case IMX6QP:
> - regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12,
> - IMX6SX_GPR12_PCIE_PM_TURN_OFF,
> - IMX6SX_GPR12_PCIE_PM_TURN_OFF);
> - regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12,
> - IMX6SX_GPR12_PCIE_PM_TURN_OFF, 0);
> - break;
> - default:
> - dev_err(dev, "PME_Turn_Off not implemented\n");
> - return;
> - }
> -
> - /*
> - * Components with an upstream port must respond to
> - * PME_Turn_Off with PME_TO_Ack but we can't check.
> - *
> - * The standard recommends a 1-10ms timeout after which to
> - * proceed anyway as if acks were received.
> - */
> -pm_turnoff_sleep:
> - usleep_range(1000, 10000);
> -}
> -
> static void imx_pcie_msi_save_restore(struct imx_pcie *imx_pcie, bool save)
> {
> u8 offset;
> @@ -1206,36 +1191,26 @@ static void imx_pcie_msi_save_restore(struct imx_pcie *imx_pcie, bool save)
> static int imx_pcie_suspend_noirq(struct device *dev)
> {
> struct imx_pcie *imx_pcie = dev_get_drvdata(dev);
> - struct dw_pcie_rp *pp = &imx_pcie->pci->pp;
>
> if (!(imx_pcie->drvdata->flags & IMX_PCIE_FLAG_SUPPORTS_SUSPEND))
> return 0;
>
> imx_pcie_msi_save_restore(imx_pcie, true);
> - imx_pcie_pm_turnoff(imx_pcie);
> - imx_pcie_stop_link(imx_pcie->pci);
> - imx_pcie_host_exit(pp);
> -
> - return 0;
> + return dw_pcie_suspend_noirq(imx_pcie->pci);
> }
>
> static int imx_pcie_resume_noirq(struct device *dev)
> {
> int ret;
> struct imx_pcie *imx_pcie = dev_get_drvdata(dev);
> - struct dw_pcie_rp *pp = &imx_pcie->pci->pp;
>
> if (!(imx_pcie->drvdata->flags & IMX_PCIE_FLAG_SUPPORTS_SUSPEND))
> return 0;
>
> - ret = imx_pcie_host_init(pp);
> + ret = dw_pcie_resume_noirq(imx_pcie->pci);
> if (ret)
> return ret;
> imx_pcie_msi_save_restore(imx_pcie, false);
> - dw_pcie_setup_rc(pp);
> -
> - if (imx_pcie->link_is_up)
> - imx_pcie_start_link(imx_pcie->pci);
>
> return 0;
> }
> @@ -1267,11 +1242,14 @@ static int imx_pcie_probe(struct platform_device *pdev)
>
> pci->dev = dev;
> pci->ops = &dw_pcie_ops;
> - pci->pp.ops = &imx_pcie_host_ops;
>
> imx_pcie->pci = pci;
> imx_pcie->drvdata = of_device_get_match_data(dev);
>
> + pci->pp.ops = &imx_pcie_host_dw_pme_ops;
> + if (imx_pcie->drvdata->ops)
> + pci->pp.ops = imx_pcie->drvdata->ops;
> +
> /* Find the PHY if one is defined, only imx7d uses it */
> np = of_parse_phandle(node, "fsl,imx7d-pcie-phy", 0);
> if (np) {
> @@ -1345,13 +1323,6 @@ static int imx_pcie_probe(struct platform_device *pdev)
> break;
> }
>
> - /* Grab turnoff reset */
> - imx_pcie->turnoff_reset = devm_reset_control_get_optional_exclusive(dev, "turnoff");
> - if (IS_ERR(imx_pcie->turnoff_reset)) {
> - dev_err(dev, "Failed to get TURNOFF reset control\n");
> - return PTR_ERR(imx_pcie->turnoff_reset);
> - }
> -
> if (imx_pcie->drvdata->gpr) {
> /* Grab GPR config register range */
> imx_pcie->iomuxc_gpr =
> @@ -1430,6 +1401,7 @@ static int imx_pcie_probe(struct platform_device *pdev)
> if (ret < 0)
> return ret;
> } else {
> + pci->pp.use_atu_msg = true;
> ret = dw_pcie_host_init(&pci->pp);
> if (ret < 0)
> return ret;
> @@ -1494,6 +1466,7 @@ static const struct imx_pcie_drvdata drvdata[] = {
> .init_phy = imx6sx_pcie_init_phy,
> .enable_ref_clk = imx6sx_pcie_enable_ref_clk,
> .core_reset = imx6sx_pcie_core_reset,
> + .ops = &imx_pcie_host_ops,
> },
> [IMX6QP] = {
> .variant = IMX6QP,
> @@ -1511,6 +1484,7 @@ static const struct imx_pcie_drvdata drvdata[] = {
> .init_phy = imx_pcie_init_phy,
> .enable_ref_clk = imx6q_pcie_enable_ref_clk,
> .core_reset = imx6qp_pcie_core_reset,
> + .ops = &imx_pcie_host_ops,
> },
> [IMX7D] = {
> .variant = IMX7D,
> --
> 2.37.1
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v5 09/10] PCI: imx6: Add i.MX8MQ i.MX8Q and i.MX95 PCIe PM support
2024-10-31 8:06 [PATCH v5 0/10] A bunch of changes to refine i.MX PCIe driver Richard Zhu
` (7 preceding siblings ...)
2024-10-31 8:06 ` [PATCH v5 08/10] PCI: imx6: Use dwc common suspend resume method Richard Zhu
@ 2024-10-31 8:06 ` Richard Zhu
2024-10-31 8:06 ` [PATCH v5 10/10] arm64: dts: imx95: Add ref clock for i.MX95 PCIe Richard Zhu
9 siblings, 0 replies; 16+ messages in thread
From: Richard Zhu @ 2024-10-31 8:06 UTC (permalink / raw)
To: l.stach, bhelgaas, lpieralisi, kw, manivannan.sadhasivam, robh,
krzk+dt, conor+dt, shawnguo, frank.li, s.hauer, festevam
Cc: imx, kernel, linux-pci, linux-arm-kernel, devicetree,
linux-kernel, Richard Zhu, Frank Li
Add iMX8MQ i.MX8Q and i.MX95 PCIe suspend/resume support.
Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
---
drivers/pci/controller/dwc/pci-imx6.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
index 410a31e5f82a..f662fbb45626 100644
--- a/drivers/pci/controller/dwc/pci-imx6.c
+++ b/drivers/pci/controller/dwc/pci-imx6.c
@@ -1502,7 +1502,8 @@ static const struct imx_pcie_drvdata drvdata[] = {
[IMX8MQ] = {
.variant = IMX8MQ,
.flags = IMX_PCIE_FLAG_HAS_APP_RESET |
- IMX_PCIE_FLAG_HAS_PHY_RESET,
+ IMX_PCIE_FLAG_HAS_PHY_RESET |
+ IMX_PCIE_FLAG_SUPPORTS_SUSPEND,
.gpr = "fsl,imx8mq-iomuxc-gpr",
.clk_names = imx8mq_clks,
.clks_cnt = ARRAY_SIZE(imx8mq_clks),
@@ -1540,14 +1541,16 @@ static const struct imx_pcie_drvdata drvdata[] = {
[IMX8Q] = {
.variant = IMX8Q,
.flags = IMX_PCIE_FLAG_HAS_PHYDRV |
- IMX_PCIE_FLAG_CPU_ADDR_FIXUP,
+ IMX_PCIE_FLAG_CPU_ADDR_FIXUP |
+ IMX_PCIE_FLAG_SUPPORTS_SUSPEND,
.clk_names = imx8q_clks,
.clks_cnt = ARRAY_SIZE(imx8q_clks),
},
[IMX95] = {
.variant = IMX95,
.flags = IMX_PCIE_FLAG_HAS_SERDES |
- IMX_PCIE_FLAG_CLOCKS_OPTIONAL,
+ IMX_PCIE_FLAG_CLOCKS_OPTIONAL |
+ IMX_PCIE_FLAG_SUPPORTS_SUSPEND,
.clk_names = imx95_clks,
.clks_cnt = ARRAY_SIZE(imx95_clks),
.ltssm_off = IMX95_PE0_GEN_CTRL_3,
--
2.37.1
^ permalink raw reply related [flat|nested] 16+ messages in thread* [PATCH v5 10/10] arm64: dts: imx95: Add ref clock for i.MX95 PCIe
2024-10-31 8:06 [PATCH v5 0/10] A bunch of changes to refine i.MX PCIe driver Richard Zhu
` (8 preceding siblings ...)
2024-10-31 8:06 ` [PATCH v5 09/10] PCI: imx6: Add i.MX8MQ i.MX8Q and i.MX95 PCIe PM support Richard Zhu
@ 2024-10-31 8:06 ` Richard Zhu
9 siblings, 0 replies; 16+ messages in thread
From: Richard Zhu @ 2024-10-31 8:06 UTC (permalink / raw)
To: l.stach, bhelgaas, lpieralisi, kw, manivannan.sadhasivam, robh,
krzk+dt, conor+dt, shawnguo, frank.li, s.hauer, festevam
Cc: imx, kernel, linux-pci, linux-arm-kernel, devicetree,
linux-kernel, Richard Zhu, Frank Li
Add ref clock for i.MX95 PCIe here, when the internal PLL is used as
PCIe reference clock.
Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
---
arch/arm64/boot/dts/freescale/imx95.dtsi | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/arch/arm64/boot/dts/freescale/imx95.dtsi b/arch/arm64/boot/dts/freescale/imx95.dtsi
index 03661e76550f..5cb504b5f851 100644
--- a/arch/arm64/boot/dts/freescale/imx95.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx95.dtsi
@@ -1473,6 +1473,14 @@ smmu: iommu@490d0000 {
};
};
+ hsio_blk_ctl: syscon@4c0100c0 {
+ compatible = "nxp,imx95-hsio-blk-ctl", "syscon";
+ reg = <0x0 0x4c0100c0 0x0 0x4>;
+ #clock-cells = <1>;
+ clocks = <&dummy>;
+ power-domains = <&scmi_devpd IMX95_PD_HSIO_TOP>;
+ };
+
pcie0: pcie@4c300000 {
compatible = "fsl,imx95-pcie";
reg = <0 0x4c300000 0 0x10000>,
@@ -1500,8 +1508,9 @@ pcie0: pcie@4c300000 {
clocks = <&scmi_clk IMX95_CLK_HSIO>,
<&scmi_clk IMX95_CLK_HSIOPLL>,
<&scmi_clk IMX95_CLK_HSIOPLL_VCO>,
- <&scmi_clk IMX95_CLK_HSIOPCIEAUX>;
- clock-names = "pcie", "pcie_bus", "pcie_phy", "pcie_aux";
+ <&scmi_clk IMX95_CLK_HSIOPCIEAUX>,
+ <&hsio_blk_ctl 0>;
+ clock-names = "pcie", "pcie_bus", "pcie_phy", "pcie_aux", "ref";
assigned-clocks =<&scmi_clk IMX95_CLK_HSIOPLL_VCO>,
<&scmi_clk IMX95_CLK_HSIOPLL>,
<&scmi_clk IMX95_CLK_HSIOPCIEAUX>;
@@ -1528,8 +1537,9 @@ pcie0_ep: pcie-ep@4c300000 {
clocks = <&scmi_clk IMX95_CLK_HSIO>,
<&scmi_clk IMX95_CLK_HSIOPLL>,
<&scmi_clk IMX95_CLK_HSIOPLL_VCO>,
- <&scmi_clk IMX95_CLK_HSIOPCIEAUX>;
- clock-names = "pcie", "pcie_bus", "pcie_phy", "pcie_aux";
+ <&scmi_clk IMX95_CLK_HSIOPCIEAUX>,
+ <&hsio_blk_ctl 0>;
+ clock-names = "pcie", "pcie_bus", "pcie_phy", "pcie_aux", "ref";
assigned-clocks =<&scmi_clk IMX95_CLK_HSIOPLL_VCO>,
<&scmi_clk IMX95_CLK_HSIOPLL>,
<&scmi_clk IMX95_CLK_HSIOPCIEAUX>;
--
2.37.1
^ permalink raw reply related [flat|nested] 16+ messages in thread