Skip to contentSkip to conversation

reset: imx7: Support module build

PATCH Superseded Anson Huang 3 participants 6 messages Jun 29, 2020 – Jul 20, 2020

Subsystems (4)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

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

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 V1:
- make it default 'y' for SOC_IMX7D;
- add module author, description;
- use device_initcall instead of builtin_platform_driver() to support module unload.

---
 drivers/reset/Kconfig      |  5 +++--
 drivers/reset/reset-imx7.c | 14 ++++++++++++--
 2 files changed, 15 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 +12 -2
index d170fe6..c710f789 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,13 @@ static struct platform_driver imx7_reset_driver = {
 		.of_match_table	= imx7_reset_dt_ids,
 	},
 };
-builtin_platform_driver(imx7_reset_driver);
+
+static int __init imx7_reset_init(void)
+{
+	return platform_driver_register(&imx7_reset_driver);
+}
+device_initcall(imx7_reset_init);
+
+MODULE_AUTHOR("Andrey Smirnov <[email protected]>");
+MODULE_DESCRIPTION("NXP i.MX7 reset driver");
+MODULE_LICENSE("GPL v2");
Signature · 7 lines
2.7.4


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

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

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.

---
New patch.

---
 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 · 7 lines
2.7.4


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

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

In reply to Anson Huang

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

---
Changes since V1:
- use module build by default.

---
 arch/arm64/configs/defconfig | 1 +
 1 file changed, 1 insertion(+)
arch/arm64/configs/defconfig +1 -0
index 35f037f..454a1f2 100644
@@ -909,6 +909,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 · 7 lines
2.7.4


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

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

In reply to Anson Huang

If you post a V3, "git log --oneline drivers/pci/controller/dwc/pci-imx6.c" says the subject line could be:

PCI: imx6: Select CONFIG_RESET_IMX7

If you don't need a V3 for any other reason, whoever applies this series might adjust that for you.

Quoted 31 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.

---
New patch.

---
 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 · 7 lines
2.7.4


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
maintainer
#4 lore raw
In reply to Anson Huang
Quoted 55 lines · Anson Huang

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 V1:
- make it default 'y' for SOC_IMX7D;
- add module author, description;
- use device_initcall instead of builtin_platform_driver() to support module unload.

---
 drivers/reset/Kconfig      |  5 +++--
 drivers/reset/reset-imx7.c | 14 ++++++++++++--
 2 files changed, 15 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 +2 -1
index d170fe6..c710f789 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,

drivers/reset/reset-imx7.c static struct platform_driver imx7_reset_driver = { · line 403

Quoted 10 lines
drivers/reset/reset-imx7.c +6 -1
@@ -394,4 +395,13 @@ static struct platform_driver imx7_reset_driver = {
 		.of_match_table	= imx7_reset_dt_ids,
 	},
 };
-builtin_platform_driver(imx7_reset_driver);
+
+static int __init imx7_reset_init(void)
+{
+	return platform_driver_register(&imx7_reset_driver);
+}
+device_initcall(imx7_reset_init);

Shouldn't this use module_platform_driver instead?

regards
Philipp

#5 lore raw

Hi, Philipp

Quoted 56 lines

Subject: Re: [PATCH V2 1/3] reset: imx7: Support module build

drivers/reset/reset-imx7.c static const struct of_device_id imx7_reset_dt_ids[]

Quoted 47 lines · Anson Huang

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 V1:
- make it default 'y' for SOC_IMX7D;
- add module author, description;
- use device_initcall instead of builtin_platform_driver() to support module unload.

---
 drivers/reset/Kconfig      |  5 +++--
 drivers/reset/reset-imx7.c | 14 ++++++++++++--
 2 files changed, 15 insertions(+), 4 deletions(-)
drivers/reset/Kconfig index renamed from drivers/reset/Kconfig +0 -0

d9efbfd..19f9773 100644

drivers/reset/Kconfig +3 -2
@@ -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 +1 -1
index d170fe6..c710f789 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[]

= {

Quoted 5 lines
drivers/reset/reset-imx7.c +1 -0
 	{ .compatible = "fsl,imx8mp-src", .data = &variant_imx8mp },
 	{ /* sentinel */ },
 };
+MODULE_DEVICE_TABLE(of, imx7_reset_dt_ids);
 
Quoted 14 lines

drivers/reset/reset-imx7.c static struct platform_driver imx7_reset_driver = { · line 402

Quoted 12 lines
drivers/reset/reset-imx7.c +5 -1
 static struct platform_driver imx7_reset_driver = {
 	.probe	= imx7_reset_probe,
@@ -394,4 +395,13 @@ static struct platform_driver imx7_reset_driver = {
 		.of_match_table	= imx7_reset_dt_ids,
 	},
 };
-builtin_platform_driver(imx7_reset_driver);
+
+static int __init imx7_reset_init(void) {
+	return platform_driver_register(&imx7_reset_driver);
+}
+device_initcall(imx7_reset_init);

Shouldn't this use module_platform_driver instead?

Agreed, module_platform_driver() is better, will improve it in V3.

Thanks,
Anson