Skip to contentSkip to conversation

reset: imx7: Support module build

PATCH Applied Anson Huang 5 participants 13 messages Jul 20, 2020 – Jul 30, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/3 reset: imx7: Support module build

Use module_platform_driver(), add module device table, author, description and license to support module build, and CONFIG_RESET_IMX7 is changed to default 'y' ONLY for i.MX7D, other platforms need to select it in defconfig.

---
Changes since V2:
- use module_platform_driver() instead of builtin_platform_driver().

---
 drivers/reset/Kconfig      | 5 +++--
 drivers/reset/reset-imx7.c | 9 +++++++--
 2 files changed, 10 insertions(+), 4 deletions(-)
drivers/reset/Kconfig +3 -2
index d9efbfd..19f9773 100644
@@ -65,9 +65,10 @@ config RESET_HSDK
 	  This enables the reset controller driver for HSDK board.
 
 config RESET_IMX7
-	bool "i.MX7/8 Reset Driver" if COMPILE_TEST
+	tristate "i.MX7/8 Reset Driver"
 	depends on HAS_IOMEM
-	default SOC_IMX7D || (ARM64 && ARCH_MXC)
+	depends on SOC_IMX7D || (ARM64 && ARCH_MXC) || COMPILE_TEST
+	default y if SOC_IMX7D
 	select MFD_SYSCON
 	help
 	  This enables the reset controller driver for i.MX7 SoCs.
drivers/reset/reset-imx7.c +7 -2
index d170fe6..9832033 100644
@@ -8,7 +8,7 @@
  */
 
 #include <linux/mfd/syscon.h>
-#include <linux/mod_devicetable.h>
+#include <linux/module.h>
 #include <linux/of_device.h>
 #include <linux/platform_device.h>
 #include <linux/reset-controller.h>
@@ -386,6 +386,7 @@ static const struct of_device_id imx7_reset_dt_ids[] = {
 	{ .compatible = "fsl,imx8mp-src", .data = &variant_imx8mp },
 	{ /* sentinel */ },
 };
+MODULE_DEVICE_TABLE(of, imx7_reset_dt_ids);
 
 static struct platform_driver imx7_reset_driver = {
 	.probe	= imx7_reset_probe,
@@ -394,4 +395,8 @@ static struct platform_driver imx7_reset_driver = {
 		.of_match_table	= imx7_reset_dt_ids,
 	},
 };
-builtin_platform_driver(imx7_reset_driver);
+module_platform_driver(imx7_reset_driver);
+
+MODULE_AUTHOR("Andrey Smirnov <[email protected]>");
+MODULE_DESCRIPTION("NXP i.MX7 reset driver");
+MODULE_LICENSE("GPL v2");
Signature · 1 line
2.7.4
#1 lore raw

PATCH v3 2/3 arm64: defconfig: Select CONFIG_RESET_IMX7 as module by default

i.MX7 reset driver now supports module build, it is no longer enabled by default, need to select it explicitly.

---
No change.

---
 arch/arm64/configs/defconfig | 1 +
 1 file changed, 1 insertion(+)
arch/arm64/configs/defconfig +1 -0
index 39b3ac7..6c764bd 100644
@@ -921,6 +921,7 @@ CONFIG_PWM_SAMSUNG=y
 CONFIG_PWM_SUN4I=m
 CONFIG_PWM_TEGRA=m
 CONFIG_QCOM_PDC=y
+CONFIG_RESET_IMX7=m
 CONFIG_RESET_QCOM_AOSS=y
 CONFIG_RESET_QCOM_PDC=m
 CONFIG_RESET_TI_SCI=y
Signature · 1 line
2.7.4
#2 lore raw

PATCH v3 3/3 pci: imx: Select RESET_IMX7 by default

In reply to Anson Huang

i.MX7 reset driver now supports module build and it is no longer built in by default, so i.MX PCI driver needs to select it explicitly due to it is NOT supporting loadable module currently.

---
No change.

---
 drivers/pci/controller/dwc/Kconfig | 1 +
 1 file changed, 1 insertion(+)
drivers/pci/controller/dwc/Kconfig +1 -0
index 044a376..bcf63ce 100644
@@ -90,6 +90,7 @@ config PCI_EXYNOS
 
 config PCI_IMX6
 	bool "Freescale i.MX6/7/8 PCIe controller"
+	select RESET_IMX7
 	depends on ARCH_MXC || COMPILE_TEST
 	depends on PCI_MSI_IRQ_DOMAIN
 	select PCIE_DW_HOST
Signature · 1 line
2.7.4
#3 lore raw

Re: [PATCH V3 3/3] pci: imx: Select RESET_IMX7 by default

[CCing IMX6 maintainers]

Quoted 26 lines · Anson Huang

i.MX7 reset driver now supports module build and it is no longer built in by default, so i.MX PCI driver needs to select it explicitly due to it is NOT supporting loadable module currently.

---
No change.

---
 drivers/pci/controller/dwc/Kconfig | 1 +
 1 file changed, 1 insertion(+)
drivers/pci/controller/dwc/Kconfig +1 -0
index 044a376..bcf63ce 100644
@@ -90,6 +90,7 @@ config PCI_EXYNOS
 
 config PCI_IMX6
 	bool "Freescale i.MX6/7/8 PCIe controller"
+	select RESET_IMX7
 	depends on ARCH_MXC || COMPILE_TEST
 	depends on PCI_MSI_IRQ_DOMAIN
 	select PCIE_DW_HOST
Signature · 1 line
2.7.4
#4 lore raw

RE: [EXT] Re: [PATCH V3 3/3] pci: imx: Select RESET_IMX7 by default

Quoted 16 lines

-----Original Message-----
From: Lorenzo Pieralisi <[email protected]>
Sent: 2020年7月28日 18:51
To: Anson Huang <[email protected]>; Richard Zhu <[email protected]>; Lucas Stach <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Leo Li <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: [EXT] Re: [PATCH V3 3/3] pci: imx: Select RESET_IMX7 by default

Quoted 8 lines

[CCing IMX6 maintainers]

Quoted 5 lines · Anson Huang

i.MX7 reset driver now supports module build and it is no longer built in by default, so i.MX PCI driver needs to select it explicitly due to it is NOT supporting loadable module currently.

I'm okay with this change. Acked-by: Richard Zhu <[email protected]> Thanks.
Best Regards
Richard Zhu

Quoted 13 lines
Quoted 13 lines

---
No change.

---
 drivers/pci/controller/dwc/Kconfig | 1 +
 1 file changed, 1 insertion(+)
drivers/pci/controller/dwc/Kconfig +0 -0
index 044a376..bcf63ce 100644
@@ -90,6 +90,7 @@ config PCI_EXYNOS
 
Quoted 9 lines
Quoted 9 lines
drivers/pci/controller/dwc/Kconfig +1 -1
 config PCI_IMX6
      bool "Freescale i.MX6/7/8 PCIe controller"
+     select RESET_IMX7
      depends on ARCH_MXC || COMPILE_TEST
      depends on PCI_MSI_IRQ_DOMAIN
      select PCIE_DW_HOST
--

2.7.4

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

reviewer
#5 lore raw

Re: [PATCH V3 3/3] pci: imx: Select RESET_IMX7 by default

In reply to Anson Huang
Quoted 17 lines · Anson Huang

i.MX7 reset driver now supports module build and it is no longer built in by default, so i.MX PCI driver needs to select it explicitly due to it is NOT supporting loadable module currently.

---
No change.

---
 drivers/pci/controller/dwc/Kconfig | 1 +
 1 file changed, 1 insertion(+)
drivers/pci/controller/dwc/Kconfig +0 -0
index 044a376..bcf63ce 100644

drivers/pci/controller/dwc/Kconfig config PCI_EXYNOS · line 93

Quoted 4 lines
drivers/pci/controller/dwc/Kconfig +1 -0
@@ -90,6 +90,7 @@ config PCI_EXYNOS
 
 config PCI_IMX6
        bool "Freescale i.MX6/7/8 PCIe controller"
+       select RESET_IMX7

This will break as select will not cause all of RESET_IMX7's dependencies to be met. It also doesn't scale. Are you going to do the same thing for clocks, pinctrl, gpio, etc.?

You should make the PCI driver work as a module.

Rob

Quoted 6 lines
drivers/pci/controller/dwc/Kconfig +0 -1
        depends on ARCH_MXC || COMPILE_TEST
        depends on PCI_MSI_IRQ_DOMAIN
        select PCIE_DW_HOST
--

2.7.4

maintainer
#6 lore raw

Re: [PATCH V3 3/3] pci: imx: Select RESET_IMX7 by default

Quoted 26 lines · Rob Herring
Quoted 16 lines · Anson Huang

i.MX7 reset driver now supports module build and it is no longer built in by default, so i.MX PCI driver needs to select it explicitly due to it is NOT supporting loadable module currently.

---
No change.

---
 drivers/pci/controller/dwc/Kconfig | 1 +
 1 file changed, 1 insertion(+)
drivers/pci/controller/dwc/Kconfig +0 -0
index 044a376..bcf63ce 100644

drivers/pci/controller/dwc/Kconfig config PCI_EXYNOS · line 93

Quoted 4 lines
drivers/pci/controller/dwc/Kconfig +1 -0
@@ -90,6 +90,7 @@ config PCI_EXYNOS
 
 config PCI_IMX6
        bool "Freescale i.MX6/7/8 PCIe controller"
+       select RESET_IMX7

This will break as select will not cause all of RESET_IMX7's dependencies to be met. It also doesn't scale. Are you going to do the same thing for clocks, pinctrl, gpio, etc.?

Quoted 1 line

You should make the PCI driver work as a module.

Oh, also PCI_IMX6 is used on (surprise) i.MX6, which doesn't need RESET_IMX7 at all.

How about hiding the RESET_IMX7 option and setting it default y if PCI_IMX6 is enabled, as an interim solution?

regards
Philipp

#7 lore raw

RE: [PATCH V3 3/3] pci: imx: Select RESET_IMX7 by default

Hi, Philipp/Rob

Quoted 31 lines

Subject: Re: [PATCH V3 3/3] pci: imx: Select RESET_IMX7 by default

Quoted 1 line · Rob Herring

On Mon, Jul 20, 2020 at 8:26 AM Anson Huang <[email protected]>

Quoted 26 lines · wrote:
Quoted 17 lines

i.MX7 reset driver now supports module build and it is no longer built in by default, so i.MX PCI driver needs to select it explicitly due to it is NOT supporting loadable module currently.

---
No change.

---
 drivers/pci/controller/dwc/Kconfig | 1 +
 1 file changed, 1 insertion(+)
drivers/pci/controller/dwc/Kconfig +0 -0
index 044a376..bcf63ce 100644

drivers/pci/controller/dwc/Kconfig config PCI_EXYNOS · line 93

Quoted 4 lines
drivers/pci/controller/dwc/Kconfig +1 -0
@@ -90,6 +90,7 @@ config PCI_EXYNOS
 
 config PCI_IMX6
        bool "Freescale i.MX6/7/8 PCIe controller"
+       select RESET_IMX7

This will break as select will not cause all of RESET_IMX7's dependencies to be met. It also doesn't scale. Are you going to do the same thing for clocks, pinctrl, gpio, etc.?

Quoted 7 lines
Quoted 1 line

You should make the PCI driver work as a module.

Oh, also PCI_IMX6 is used on (surprise) i.MX6, which doesn't need RESET_IMX7 at all.

How about hiding the RESET_IMX7 option and setting it default y if PCI_IMX6 is enabled, as an interim solution?

Like below, RESET_IMX7 is already default y when SOC_IMX7D, now added PCI_IMX6, let me know if it is OK for you, then I will send new patch for review.

+++ b/drivers/reset/Kconfig
@@ -68,7 +68,7 @@ config RESET_IMX7
tristate "i.MX7/8 Reset Driver"
depends on HAS_IOMEM
depends on SOC_IMX7D || (ARM64 && ARCH_MXC) || COMPILE_TEST
- default y if SOC_IMX7D
+ default y if (SOC_IMX7D || PCI_IMX6)

Thanks,
Anson

maintainer
#8 lore raw

Re: [PATCH V3 3/3] pci: imx: Select RESET_IMX7 by default

Hi Anson,

Quoted 46 lines · Anson Huang

Hi, Philipp/Rob

Quoted 31 lines

Subject: Re: [PATCH V3 3/3] pci: imx: Select RESET_IMX7 by default

Quoted 1 line · Rob Herring

On Mon, Jul 20, 2020 at 8:26 AM Anson Huang <[email protected]>

Quoted 26 lines · wrote:
Quoted 17 lines

i.MX7 reset driver now supports module build and it is no longer built in by default, so i.MX PCI driver needs to select it explicitly due to it is NOT supporting loadable module currently.

---
No change.

---
 drivers/pci/controller/dwc/Kconfig | 1 +
 1 file changed, 1 insertion(+)
drivers/pci/controller/dwc/Kconfig +0 -0
index 044a376..bcf63ce 100644

drivers/pci/controller/dwc/Kconfig config PCI_EXYNOS · line 93

Quoted 4 lines
drivers/pci/controller/dwc/Kconfig +1 -0
@@ -90,6 +90,7 @@ config PCI_EXYNOS
 
 config PCI_IMX6
        bool "Freescale i.MX6/7/8 PCIe controller"
+       select RESET_IMX7

This will break as select will not cause all of RESET_IMX7's dependencies to be met. It also doesn't scale. Are you going to do the same thing for clocks, pinctrl, gpio, etc.?

Quoted 7 lines
Quoted 1 line

You should make the PCI driver work as a module.

Oh, also PCI_IMX6 is used on (surprise) i.MX6, which doesn't need RESET_IMX7 at all.

How about hiding the RESET_IMX7 option and setting it default y if PCI_IMX6 is enabled, as an interim solution?

Like below, RESET_IMX7 is already default y when SOC_IMX7D, now added PCI_IMX6, let me know if it is OK for you, then I will send new patch for review.

+++ b/drivers/reset/Kconfig

Review config RESET_IMX7 · line 68

Quoted 1 line
(quoted diff) +0 -0
@@ -68,7 +68,7 @@ config RESET_IMX7
        tristate "i.MX7/8 Reset Driver"

I was thinking something like

	tristate "i.MX7/8 Reset Driver" if COMPILE_TEST || !PCI_IMX6

Review config RESET_IMX7 · line 71

Quoted 4 lines
(quoted diff) +1 -1
        depends on HAS_IOMEM
        depends on SOC_IMX7D || (ARM64 && ARCH_MXC) || COMPILE_TEST
-       default y if SOC_IMX7D
+       default y if (SOC_IMX7D || PCI_IMX6)

Yes, although without the above I think it could still be disabled manually or via oldconfig.

regards
Philipp

#9 lore raw

RE: [PATCH V3 3/3] pci: imx: Select RESET_IMX7 by default

Hi, Philipp

Quoted 59 lines

Subject: Re: [PATCH V3 3/3] pci: imx: Select RESET_IMX7 by default

Hi Anson,

Quoted 6 lines · Anson Huang

Hi, Philipp/Rob

Quoted 4 lines

Subject: Re: [PATCH V3 3/3] pci: imx: Select RESET_IMX7 by default

Quoted 1 line · Rob Herring

On Mon, Jul 20, 2020 at 8:26 AM Anson Huang

<[email protected]>

Quoted 29 lines
Quoted 29 lines
Quoted 27 lines · wrote:
Quoted 17 lines

i.MX7 reset driver now supports module build and it is no longer built in by default, so i.MX PCI driver needs to select it explicitly due to it is NOT supporting loadable module currently.

---
No change.

---
 drivers/pci/controller/dwc/Kconfig | 1 +
 1 file changed, 1 insertion(+)
drivers/pci/controller/dwc/Kconfig +0 -0
index 044a376..bcf63ce 100644

drivers/pci/controller/dwc/Kconfig config PCI_EXYNOS · line 93

Quoted 4 lines
drivers/pci/controller/dwc/Kconfig +1 -0
@@ -90,6 +90,7 @@ config PCI_EXYNOS
 
 config PCI_IMX6
        bool "Freescale i.MX6/7/8 PCIe controller"
+       select RESET_IMX7

This will break as select will not cause all of RESET_IMX7's dependencies to be met. It also doesn't scale. Are you going to do the same thing for clocks, pinctrl, gpio, etc.?

You should make the PCI driver work as a module.

Quoted 8 lines
Quoted 5 lines

Oh, also PCI_IMX6 is used on (surprise) i.MX6, which doesn't need RESET_IMX7 at all.

How about hiding the RESET_IMX7 option and setting it default y if PCI_IMX6 is enabled, as an interim solution?

Like below, RESET_IMX7 is already default y when SOC_IMX7D, now added PCI_IMX6, let me know if it is OK for you, then I will send new patch for

review.

Review config RESET_IMX7 · line 68

Quoted 4 lines

+++ b/drivers/reset/Kconfig

(quoted diff) +0 -0
@@ -68,7 +68,7 @@ config RESET_IMX7
        tristate "i.MX7/8 Reset Driver"

I was thinking something like

	tristate "i.MX7/8 Reset Driver" if COMPILE_TEST || !PCI_IMX6
Quoted 8 lines

Review config RESET_IMX7 · line 70

Quoted 2 lines
(quoted diff) +0 -0
        depends on HAS_IOMEM
        depends on SOC_IMX7D || (ARM64 && ARCH_MXC) ||

COMPILE_TEST

Review config RESET_IMX7 · line 71

Quoted 2 lines
(quoted diff) +1 -1
-       default y if SOC_IMX7D
+       default y if (SOC_IMX7D || PCI_IMX6)

Yes, although without the above I think it could still be disabled manually or via oldconfig.

Then should I send a new version with below? As we already did it this way for i.MX7D, adding it for i.MX6 makes more sense?

+ default y if (SOC_IMX7D || PCI_IMX6)

Thanks,
Anson

maintainer Applied
#10 lore raw
In reply to Anson Huang
Quoted 9 lines · Anson Huang

Use module_platform_driver(), add module device table, author, description and license to support module build, and CONFIG_RESET_IMX7 is changed to default 'y' ONLY for i.MX7D, other platforms need to select it in defconfig.

---
Changes since V2:
- use module_platform_driver() instead of builtin_platform_driver().

Thank you, applied to reset/next.

regards
Philipp

#11 lore raw
Quoted 6 lines · Philipp Zabel
Quoted 5 lines · Anson Huang

Use module_platform_driver(), add module device table, author, description and license to support module build, and CONFIG_RESET_IMX7 is changed to default 'y' ONLY for i.MX7D, other platforms need to select it in defconfig.

Quoted 6 lines
Quoted 4 lines

---
Changes since V2:
- use module_platform_driver() instead of builtin_platform_driver().

Thank you, applied to reset/next.

I think you should pick up patch (3) as well please if PCI_IMX6 maintainers ACK it - merging just patch(1) will trigger regressions AFAICS.

Lorenzo

maintainer
#12 lore raw
Quoted 12 lines · Lorenzo Pieralisi
Quoted 11 lines · Philipp Zabel
Quoted 9 lines · Anson Huang

Use module_platform_driver(), add module device table, author, description and license to support module build, and CONFIG_RESET_IMX7 is changed to default 'y' ONLY for i.MX7D, other platforms need to select it in defconfig.

---
Changes since V2:
- use module_platform_driver() instead of builtin_platform_driver().

Quoted 5 lines
Quoted 1 line

Thank you, applied to reset/next.

I think you should pick up patch (3) as well please if PCI_IMX6 maintainers ACK it - merging just patch(1) will trigger regressions AFAICS.

Thank you for raising this, I'll put these patches on hold until the PCI_IMX6 issue is resolved.

regards
Philipp