2020-06-09 14:34:33

by Anson Huang

[permalink] [raw]
Subject: [PATCH V3 0/9] Support i.MX8 SoCs pinctrl drivers built as module

There are more and mroe requirements that SoC specific modules should be built
as module in order to support generic kernel image, such as Android GKI concept.

This patch series supports i.MX8 SoCs pinctrl drivers to be built as module,
including i.MX8MQ/MM/MN/MP/QXP/QM/DXL SoCs, and it also supports building i.MX
common pinctrl driver and i.MX SCU common pinctrl driver as module.

Compared to V2, the changes are as below:
- add "depends on OF" to PINCTRL_IMX to fix build error using x86 randconfig;
- change the config dependency of PINCTRL_IMX_SCU to support scenario of
building in PINCTRL_IMX while building PINCTRL_IMX_SCU as module, no other
good choice in my mind, if you have better idea without changing the driver
code, please advise.

Anson Huang (9):
pinctrl: imx: Support building SCU pinctrl driver as module
pinctrl: imx: Support building i.MX pinctrl driver as module
pinctrl: imx8mm: Support building as module
pinctrl: imx8mn: Support building as module
pinctrl: imx8mq: Support building as module
pinctrl: imx8mp: Support building as module
pinctrl: imx8qxp: Support building as module
pinctrl: imx8qm: Support building as module
pinctrl: imx8dxl: Support building as module

drivers/pinctrl/freescale/Kconfig | 27 ++++++++++++++-------------
drivers/pinctrl/freescale/pinctrl-imx.c | 4 ++++
drivers/pinctrl/freescale/pinctrl-imx.h | 2 +-
drivers/pinctrl/freescale/pinctrl-imx8dxl.c | 9 +++------
drivers/pinctrl/freescale/pinctrl-imx8mm.c | 10 ++++------
drivers/pinctrl/freescale/pinctrl-imx8mn.c | 10 ++++------
drivers/pinctrl/freescale/pinctrl-imx8mp.c | 10 ++++------
drivers/pinctrl/freescale/pinctrl-imx8mq.c | 9 ++++-----
drivers/pinctrl/freescale/pinctrl-imx8qm.c | 9 +++------
drivers/pinctrl/freescale/pinctrl-imx8qxp.c | 9 +++------
drivers/pinctrl/freescale/pinctrl-scu.c | 6 ++++++
11 files changed, 50 insertions(+), 55 deletions(-)

--
2.7.4


2020-06-09 14:34:40

by Anson Huang

[permalink] [raw]
Subject: [PATCH V3 5/9] pinctrl: imx8mq: Support building as module

Support building i.MX8MQ pinctrl driver as module.

Signed-off-by: Anson Huang <[email protected]>
---
No change.
---
drivers/pinctrl/freescale/Kconfig | 2 +-
drivers/pinctrl/freescale/pinctrl-imx8mq.c | 9 ++++-----
2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/pinctrl/freescale/Kconfig b/drivers/pinctrl/freescale/Kconfig
index 18ef57e..a6c109e 100644
--- a/drivers/pinctrl/freescale/Kconfig
+++ b/drivers/pinctrl/freescale/Kconfig
@@ -146,7 +146,7 @@ config PINCTRL_IMX8MP
Say Y here to enable the imx8mp pinctrl driver

config PINCTRL_IMX8MQ
- bool "IMX8MQ pinctrl driver"
+ tristate "IMX8MQ pinctrl driver"
depends on ARCH_MXC
select PINCTRL_IMX
help
diff --git a/drivers/pinctrl/freescale/pinctrl-imx8mq.c b/drivers/pinctrl/freescale/pinctrl-imx8mq.c
index 50aa1c0..db5b41a 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx8mq.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx8mq.c
@@ -8,6 +8,7 @@
#include <linux/err.h>
#include <linux/init.h>
#include <linux/io.h>
+#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/pinctrl/pinctrl.h>
@@ -329,6 +330,7 @@ static const struct of_device_id imx8mq_pinctrl_of_match[] = {
{ .compatible = "fsl,imx8mq-iomuxc", .data = &imx8mq_pinctrl_info, },
{ /* sentinel */ }
};
+MODULE_DEVICE_TABLE(of, imx8mq_pinctrl_of_match);

static int imx8mq_pinctrl_probe(struct platform_device *pdev)
{
@@ -345,8 +347,5 @@ static struct platform_driver imx8mq_pinctrl_driver = {
.probe = imx8mq_pinctrl_probe,
};

-static int __init imx8mq_pinctrl_init(void)
-{
- return platform_driver_register(&imx8mq_pinctrl_driver);
-}
-arch_initcall(imx8mq_pinctrl_init);
+module_platform_driver(imx8mq_pinctrl_driver);
+MODULE_LICENSE("GPL v2");
--
2.7.4

2020-06-09 14:34:52

by Anson Huang

[permalink] [raw]
Subject: [PATCH V3 9/9] pinctrl: imx8dxl: Support building as module

Support building i.MX8DXL pinctrl driver as module.

Signed-off-by: Anson Huang <[email protected]>
---
No change.
---
drivers/pinctrl/freescale/Kconfig | 2 +-
drivers/pinctrl/freescale/pinctrl-imx8dxl.c | 9 +++------
2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/pinctrl/freescale/Kconfig b/drivers/pinctrl/freescale/Kconfig
index 4a9c19b..286bbbd 100644
--- a/drivers/pinctrl/freescale/Kconfig
+++ b/drivers/pinctrl/freescale/Kconfig
@@ -167,7 +167,7 @@ config PINCTRL_IMX8QXP
Say Y here to enable the imx8qxp pinctrl driver

config PINCTRL_IMX8DXL
- bool "IMX8DXL pinctrl driver"
+ tristate "IMX8DXL pinctrl driver"
depends on IMX_SCU && ARCH_MXC && ARM64
select PINCTRL_IMX
help
diff --git a/drivers/pinctrl/freescale/pinctrl-imx8dxl.c b/drivers/pinctrl/freescale/pinctrl-imx8dxl.c
index 7f32e57..c11fcfb 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx8dxl.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx8dxl.c
@@ -165,6 +165,7 @@ static const struct of_device_id imx8dxl_pinctrl_of_match[] = {
{ .compatible = "fsl,imx8dxl-iomuxc", },
{ /* sentinel */ }
};
+MODULE_DEVICE_TABLE(of, imx8dxl_pinctrl_of_match);

static int imx8dxl_pinctrl_probe(struct platform_device *pdev)
{
@@ -185,9 +186,5 @@ static struct platform_driver imx8dxl_pinctrl_driver = {
},
.probe = imx8dxl_pinctrl_probe,
};
-
-static int __init imx8dxl_pinctrl_init(void)
-{
- return platform_driver_register(&imx8dxl_pinctrl_driver);
-}
-arch_initcall(imx8dxl_pinctrl_init);
+module_platform_driver(imx8dxl_pinctrl_driver);
+MODULE_LICENSE("GPL v2");
--
2.7.4

2020-06-09 14:35:03

by Anson Huang

[permalink] [raw]
Subject: [PATCH V3 7/9] pinctrl: imx8qxp: Support building as module

Support building i.MX8QXP pinctrl driver as module.

Signed-off-by: Anson Huang <[email protected]>
---
No change.
---
drivers/pinctrl/freescale/Kconfig | 2 +-
drivers/pinctrl/freescale/pinctrl-imx8qxp.c | 9 +++------
2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/pinctrl/freescale/Kconfig b/drivers/pinctrl/freescale/Kconfig
index bd68af1..0751145 100644
--- a/drivers/pinctrl/freescale/Kconfig
+++ b/drivers/pinctrl/freescale/Kconfig
@@ -160,7 +160,7 @@ config PINCTRL_IMX8QM
Say Y here to enable the imx8qm pinctrl driver

config PINCTRL_IMX8QXP
- bool "IMX8QXP pinctrl driver"
+ tristate "IMX8QXP pinctrl driver"
depends on IMX_SCU && ARCH_MXC && ARM64
select PINCTRL_IMX
help
diff --git a/drivers/pinctrl/freescale/pinctrl-imx8qxp.c b/drivers/pinctrl/freescale/pinctrl-imx8qxp.c
index 1131dc3..0eaa36b 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx8qxp.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx8qxp.c
@@ -204,6 +204,7 @@ static const struct of_device_id imx8qxp_pinctrl_of_match[] = {
{ .compatible = "fsl,imx8qxp-iomuxc", },
{ /* sentinel */ }
};
+MODULE_DEVICE_TABLE(of, imx8qxp_pinctrl_of_match);

static int imx8qxp_pinctrl_probe(struct platform_device *pdev)
{
@@ -224,9 +225,5 @@ static struct platform_driver imx8qxp_pinctrl_driver = {
},
.probe = imx8qxp_pinctrl_probe,
};
-
-static int __init imx8qxp_pinctrl_init(void)
-{
- return platform_driver_register(&imx8qxp_pinctrl_driver);
-}
-arch_initcall(imx8qxp_pinctrl_init);
+module_platform_driver(imx8qxp_pinctrl_driver);
+MODULE_LICENSE("GPL v2");
--
2.7.4

2020-06-09 14:36:19

by Anson Huang

[permalink] [raw]
Subject: [PATCH V3 1/9] pinctrl: imx: Support building SCU pinctrl driver as module

Export necessary functions and use "IS_ENABLED" instead of "ifdef"
to support SCU pinctrl driver user and itself to be built as module.

And when PINCTRL_IMX_SCU can be built as module, if PINCTRL_IMX is
built in while PINCTRL_IMX_SCU is built as module, build will fail
due to SCU pinctrl driver's APIs are NOT implemented, to avoid such
common scenario, the config dependency needs to be changed to below:

- All i.MX platforms pinctrl driver will select PINCTRL_IMX;
- All i.MX ARM64 platforms will select PINCTRL_IMX_SCU;

However, it introduces a tiny side effect that, for i.MX8M platforms,
although PINCTRL_IMX_SCU is NOT needed, but it will be still selected.

Signed-off-by: Anson Huang <[email protected]>
---
Changes since V2:
- change the config dependency of PINCTRL_IMX_SCU to support
scenario of building in PINCTRL_IMX while building PINCTRL_IMX_SCU
as module.
---
drivers/pinctrl/freescale/Kconfig | 10 +++++-----
drivers/pinctrl/freescale/pinctrl-imx.h | 2 +-
drivers/pinctrl/freescale/pinctrl-scu.c | 6 ++++++
3 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/pinctrl/freescale/Kconfig b/drivers/pinctrl/freescale/Kconfig
index 4ca44dd..f6c00d5 100644
--- a/drivers/pinctrl/freescale/Kconfig
+++ b/drivers/pinctrl/freescale/Kconfig
@@ -5,11 +5,11 @@ config PINCTRL_IMX
select GENERIC_PINMUX_FUNCTIONS
select GENERIC_PINCONF
select REGMAP
+ select PINCTRL_IMX_SCU if (ARCH_MXC && ARM64)

config PINCTRL_IMX_SCU
- bool
+ tristate "IMX SCU pinctrl driver"
depends on IMX_SCU
- select PINCTRL_IMX

config PINCTRL_IMX1_CORE
bool
@@ -154,21 +154,21 @@ config PINCTRL_IMX8MQ
config PINCTRL_IMX8QM
bool "IMX8QM pinctrl driver"
depends on IMX_SCU && ARCH_MXC && ARM64
- select PINCTRL_IMX_SCU
+ select PINCTRL_IMX
help
Say Y here to enable the imx8qm pinctrl driver

config PINCTRL_IMX8QXP
bool "IMX8QXP pinctrl driver"
depends on IMX_SCU && ARCH_MXC && ARM64
- select PINCTRL_IMX_SCU
+ select PINCTRL_IMX
help
Say Y here to enable the imx8qxp pinctrl driver

config PINCTRL_IMX8DXL
bool "IMX8DXL pinctrl driver"
depends on IMX_SCU && ARCH_MXC && ARM64
- select PINCTRL_IMX_SCU
+ select PINCTRL_IMX
help
Say Y here to enable the imx8dxl pinctrl driver

diff --git a/drivers/pinctrl/freescale/pinctrl-imx.h b/drivers/pinctrl/freescale/pinctrl-imx.h
index 333d32b..4e93f12 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx.h
+++ b/drivers/pinctrl/freescale/pinctrl-imx.h
@@ -137,7 +137,7 @@ struct imx_pinctrl {
int imx_pinctrl_probe(struct platform_device *pdev,
const struct imx_pinctrl_soc_info *info);

-#ifdef CONFIG_PINCTRL_IMX_SCU
+#if IS_ENABLED(CONFIG_PINCTRL_IMX_SCU)
#define BM_PAD_CTL_GP_ENABLE BIT(30)
#define BM_PAD_CTL_IFMUX_ENABLE BIT(31)
#define BP_PAD_CTL_IFMUX 27
diff --git a/drivers/pinctrl/freescale/pinctrl-scu.c b/drivers/pinctrl/freescale/pinctrl-scu.c
index 23cf04b..35efd5c 100644
--- a/drivers/pinctrl/freescale/pinctrl-scu.c
+++ b/drivers/pinctrl/freescale/pinctrl-scu.c
@@ -7,6 +7,7 @@

#include <linux/err.h>
#include <linux/firmware/imx/sci.h>
+#include <linux/module.h>
#include <linux/of_address.h>
#include <linux/pinctrl/pinctrl.h>
#include <linux/platform_device.h>
@@ -41,6 +42,7 @@ int imx_pinctrl_sc_ipc_init(struct platform_device *pdev)
{
return imx_scu_get_handle(&pinctrl_ipc_handle);
}
+EXPORT_SYMBOL_GPL(imx_pinctrl_sc_ipc_init);

int imx_pinconf_get_scu(struct pinctrl_dev *pctldev, unsigned pin_id,
unsigned long *config)
@@ -66,6 +68,7 @@ int imx_pinconf_get_scu(struct pinctrl_dev *pctldev, unsigned pin_id,

return 0;
}
+EXPORT_SYMBOL_GPL(imx_pinconf_get_scu);

int imx_pinconf_set_scu(struct pinctrl_dev *pctldev, unsigned pin_id,
unsigned long *configs, unsigned num_configs)
@@ -101,6 +104,7 @@ int imx_pinconf_set_scu(struct pinctrl_dev *pctldev, unsigned pin_id,

return ret;
}
+EXPORT_SYMBOL_GPL(imx_pinconf_set_scu);

void imx_pinctrl_parse_pin_scu(struct imx_pinctrl *ipctl,
unsigned int *pin_id, struct imx_pin *pin,
@@ -119,3 +123,5 @@ void imx_pinctrl_parse_pin_scu(struct imx_pinctrl *ipctl,
dev_dbg(ipctl->dev, "%s: 0x%x 0x%08lx", info->pins[pin->pin].name,
pin_scu->mux_mode, pin_scu->config);
}
+EXPORT_SYMBOL_GPL(imx_pinctrl_parse_pin_scu);
+MODULE_LICENSE("GPL v2");
--
2.7.4

2020-06-09 14:36:39

by Anson Huang

[permalink] [raw]
Subject: [PATCH V3 6/9] pinctrl: imx8mp: Support building as module

Support building i.MX8MP pinctrl driver as module.

Signed-off-by: Anson Huang <[email protected]>
---
No change.
---
drivers/pinctrl/freescale/Kconfig | 2 +-
drivers/pinctrl/freescale/pinctrl-imx8mp.c | 10 ++++------
2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/pinctrl/freescale/Kconfig b/drivers/pinctrl/freescale/Kconfig
index a6c109e..bd68af1 100644
--- a/drivers/pinctrl/freescale/Kconfig
+++ b/drivers/pinctrl/freescale/Kconfig
@@ -139,7 +139,7 @@ config PINCTRL_IMX8MN
Say Y here to enable the imx8mn pinctrl driver

config PINCTRL_IMX8MP
- bool "IMX8MP pinctrl driver"
+ tristate "IMX8MP pinctrl driver"
depends on ARCH_MXC
select PINCTRL_IMX
help
diff --git a/drivers/pinctrl/freescale/pinctrl-imx8mp.c b/drivers/pinctrl/freescale/pinctrl-imx8mp.c
index e3f644c..f3f3bdd 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx8mp.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx8mp.c
@@ -5,6 +5,7 @@

#include <linux/err.h>
#include <linux/init.h>
+#include <linux/module.h>
#include <linux/of.h>
#include <linux/pinctrl/pinctrl.h>
#include <linux/platform_device.h>
@@ -324,6 +325,7 @@ static const struct of_device_id imx8mp_pinctrl_of_match[] = {
{ .compatible = "fsl,imx8mp-iomuxc", .data = &imx8mp_pinctrl_info, },
{ /* sentinel */ }
};
+MODULE_DEVICE_TABLE(of, imx8mp_pinctrl_of_match);

static int imx8mp_pinctrl_probe(struct platform_device *pdev)
{
@@ -337,9 +339,5 @@ static struct platform_driver imx8mp_pinctrl_driver = {
},
.probe = imx8mp_pinctrl_probe,
};
-
-static int __init imx8mp_pinctrl_init(void)
-{
- return platform_driver_register(&imx8mp_pinctrl_driver);
-}
-arch_initcall(imx8mp_pinctrl_init);
+module_platform_driver(imx8mp_pinctrl_driver);
+MODULE_LICENSE("GPL v2");
--
2.7.4

2020-06-09 14:38:16

by Anson Huang

[permalink] [raw]
Subject: [PATCH V3 3/9] pinctrl: imx8mm: Support building as module

Support building i.MX8MM pinctrl driver as module.

Signed-off-by: Anson Huang <[email protected]>
---
No change.
---
drivers/pinctrl/freescale/Kconfig | 2 +-
drivers/pinctrl/freescale/pinctrl-imx8mm.c | 10 ++++------
2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/pinctrl/freescale/Kconfig b/drivers/pinctrl/freescale/Kconfig
index 3383fc2..073f562 100644
--- a/drivers/pinctrl/freescale/Kconfig
+++ b/drivers/pinctrl/freescale/Kconfig
@@ -125,7 +125,7 @@ config PINCTRL_IMX7ULP
Say Y here to enable the imx7ulp pinctrl driver

config PINCTRL_IMX8MM
- bool "IMX8MM pinctrl driver"
+ tristate "IMX8MM pinctrl driver"
depends on ARCH_MXC
select PINCTRL_IMX
help
diff --git a/drivers/pinctrl/freescale/pinctrl-imx8mm.c b/drivers/pinctrl/freescale/pinctrl-imx8mm.c
index 6d1038a..eca1424 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx8mm.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx8mm.c
@@ -5,6 +5,7 @@

#include <linux/err.h>
#include <linux/init.h>
+#include <linux/module.h>
#include <linux/of_device.h>
#include <linux/pinctrl/pinctrl.h>
#include <linux/platform_device.h>
@@ -326,6 +327,7 @@ static const struct of_device_id imx8mm_pinctrl_of_match[] = {
{ .compatible = "fsl,imx8mm-iomuxc", .data = &imx8mm_pinctrl_info, },
{ /* sentinel */ }
};
+MODULE_DEVICE_TABLE(of, imx8mm_pinctrl_of_match);

static int imx8mm_pinctrl_probe(struct platform_device *pdev)
{
@@ -340,9 +342,5 @@ static struct platform_driver imx8mm_pinctrl_driver = {
},
.probe = imx8mm_pinctrl_probe,
};
-
-static int __init imx8mm_pinctrl_init(void)
-{
- return platform_driver_register(&imx8mm_pinctrl_driver);
-}
-arch_initcall(imx8mm_pinctrl_init);
+module_platform_driver(imx8mm_pinctrl_driver);
+MODULE_LICENSE("GPL v2");
--
2.7.4

2020-06-09 19:03:29

by Anson Huang

[permalink] [raw]
Subject: [PATCH V3 4/9] pinctrl: imx8mn: Support building as module

Support building i.MX8MN pinctrl driver as module.

Signed-off-by: Anson Huang <[email protected]>
---
No change.
---
drivers/pinctrl/freescale/Kconfig | 2 +-
drivers/pinctrl/freescale/pinctrl-imx8mn.c | 10 ++++------
2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/pinctrl/freescale/Kconfig b/drivers/pinctrl/freescale/Kconfig
index 073f562..18ef57e 100644
--- a/drivers/pinctrl/freescale/Kconfig
+++ b/drivers/pinctrl/freescale/Kconfig
@@ -132,7 +132,7 @@ config PINCTRL_IMX8MM
Say Y here to enable the imx8mm pinctrl driver

config PINCTRL_IMX8MN
- bool "IMX8MN pinctrl driver"
+ tristate "IMX8MN pinctrl driver"
depends on ARCH_MXC
select PINCTRL_IMX
help
diff --git a/drivers/pinctrl/freescale/pinctrl-imx8mn.c b/drivers/pinctrl/freescale/pinctrl-imx8mn.c
index 100ed8c..b6db780 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx8mn.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx8mn.c
@@ -5,6 +5,7 @@

#include <linux/err.h>
#include <linux/init.h>
+#include <linux/module.h>
#include <linux/of.h>
#include <linux/pinctrl/pinctrl.h>
#include <linux/platform_device.h>
@@ -326,6 +327,7 @@ static const struct of_device_id imx8mn_pinctrl_of_match[] = {
{ .compatible = "fsl,imx8mn-iomuxc", .data = &imx8mn_pinctrl_info, },
{ /* sentinel */ }
};
+MODULE_DEVICE_TABLE(of, imx8mn_pinctrl_of_match);

static int imx8mn_pinctrl_probe(struct platform_device *pdev)
{
@@ -340,9 +342,5 @@ static struct platform_driver imx8mn_pinctrl_driver = {
},
.probe = imx8mn_pinctrl_probe,
};
-
-static int __init imx8mn_pinctrl_init(void)
-{
- return platform_driver_register(&imx8mn_pinctrl_driver);
-}
-arch_initcall(imx8mn_pinctrl_init);
+module_platform_driver(imx8mn_pinctrl_driver);
+MODULE_LICENSE("GPL v2");
--
2.7.4

2020-06-09 19:10:36

by Anson Huang

[permalink] [raw]
Subject: [PATCH V3 8/9] pinctrl: imx8qm: Support building as module

Support building i.MX8QM pinctrl driver as module.

Signed-off-by: Anson Huang <[email protected]>
---
No change.
---
drivers/pinctrl/freescale/Kconfig | 2 +-
drivers/pinctrl/freescale/pinctrl-imx8qm.c | 9 +++------
2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/pinctrl/freescale/Kconfig b/drivers/pinctrl/freescale/Kconfig
index 0751145..4a9c19b 100644
--- a/drivers/pinctrl/freescale/Kconfig
+++ b/drivers/pinctrl/freescale/Kconfig
@@ -153,7 +153,7 @@ config PINCTRL_IMX8MQ
Say Y here to enable the imx8mq pinctrl driver

config PINCTRL_IMX8QM
- bool "IMX8QM pinctrl driver"
+ tristate "IMX8QM pinctrl driver"
depends on IMX_SCU && ARCH_MXC && ARM64
select PINCTRL_IMX
help
diff --git a/drivers/pinctrl/freescale/pinctrl-imx8qm.c b/drivers/pinctrl/freescale/pinctrl-imx8qm.c
index 0b6029b..905702a 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx8qm.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx8qm.c
@@ -298,6 +298,7 @@ static const struct of_device_id imx8qm_pinctrl_of_match[] = {
{ .compatible = "fsl,imx8qm-iomuxc", },
{ /* sentinel */ }
};
+MODULE_DEVICE_TABLE(of, imx8qm_pinctrl_of_match);

static int imx8qm_pinctrl_probe(struct platform_device *pdev)
{
@@ -318,9 +319,5 @@ static struct platform_driver imx8qm_pinctrl_driver = {
},
.probe = imx8qm_pinctrl_probe,
};
-
-static int __init imx8qm_pinctrl_init(void)
-{
- return platform_driver_register(&imx8qm_pinctrl_driver);
-}
-arch_initcall(imx8qm_pinctrl_init);
+module_platform_driver(imx8qm_pinctrl_driver);
+MODULE_LICENSE("GPL v2");
--
2.7.4

2020-06-09 19:10:43

by Anson Huang

[permalink] [raw]
Subject: [PATCH V3 2/9] pinctrl: imx: Support building i.MX pinctrl driver as module

Export necessary functions to support building i.MX common pinctrl
driver and its user to be built as module.

Signed-off-by: Anson Huang <[email protected]>
---
Changes since V2:
- add "depends on OF" to fix build error when using x86 randconfig.
---
drivers/pinctrl/freescale/Kconfig | 3 ++-
drivers/pinctrl/freescale/pinctrl-imx.c | 4 ++++
2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/freescale/Kconfig b/drivers/pinctrl/freescale/Kconfig
index f6c00d5..3383fc2 100644
--- a/drivers/pinctrl/freescale/Kconfig
+++ b/drivers/pinctrl/freescale/Kconfig
@@ -1,6 +1,7 @@
# SPDX-License-Identifier: GPL-2.0-only
config PINCTRL_IMX
- bool
+ tristate "IMX pinctrl driver"
+ depends on OF
select GENERIC_PINCTRL_GROUPS
select GENERIC_PINMUX_FUNCTIONS
select GENERIC_PINCONF
diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c b/drivers/pinctrl/freescale/pinctrl-imx.c
index cb7e0f0..116d808 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx.c
@@ -11,6 +11,7 @@
#include <linux/init.h>
#include <linux/io.h>
#include <linux/mfd/syscon.h>
+#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/of_address.h>
@@ -878,6 +879,7 @@ int imx_pinctrl_probe(struct platform_device *pdev,

return pinctrl_enable(ipctl->pctl);
}
+EXPORT_SYMBOL_GPL(imx_pinctrl_probe);

static int __maybe_unused imx_pinctrl_suspend(struct device *dev)
{
@@ -897,3 +899,5 @@ const struct dev_pm_ops imx_pinctrl_pm_ops = {
SET_LATE_SYSTEM_SLEEP_PM_OPS(imx_pinctrl_suspend,
imx_pinctrl_resume)
};
+EXPORT_SYMBOL_GPL(imx_pinctrl_pm_ops);
+MODULE_LICENSE("GPL v2");
--
2.7.4

2020-06-09 23:24:01

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH V3 1/9] pinctrl: imx: Support building SCU pinctrl driver as module

Hi Anson,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on pinctrl/devel]
[cannot apply to v5.7]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url: https://github.com/0day-ci/linux/commits/Anson-Huang/Support-i-MX8-SoCs-pinctrl-drivers-built-as-module/20200609-223423
base: https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git devel
config: arm64-randconfig-r004-20200607 (attached as .config)
compiler: aarch64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm64

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

All errors (new ones prefixed by >>, old ones prefixed by <<):

aarch64-linux-ld: drivers/pinctrl/freescale/pinctrl-scu.o: in function `imx_pinctrl_sc_ipc_init':
>> drivers/pinctrl/freescale/pinctrl-scu.c:43: undefined reference to `imx_scu_get_handle'
aarch64-linux-ld: drivers/pinctrl/freescale/pinctrl-scu.o: in function `imx_pinconf_get_scu':
>> drivers/pinctrl/freescale/pinctrl-scu.c:62: undefined reference to `imx_scu_call_rpc'
aarch64-linux-ld: drivers/pinctrl/freescale/pinctrl-scu.o: in function `imx_pinconf_set_scu':
drivers/pinctrl/freescale/pinctrl-scu.c:100: undefined reference to `imx_scu_call_rpc'

vim +43 drivers/pinctrl/freescale/pinctrl-scu.c

b96eea718bf697 A.s. Dong 2018-10-30 40
b96eea718bf697 A.s. Dong 2018-10-30 41 int imx_pinctrl_sc_ipc_init(struct platform_device *pdev)
b96eea718bf697 A.s. Dong 2018-10-30 42 {
b96eea718bf697 A.s. Dong 2018-10-30 @43 return imx_scu_get_handle(&pinctrl_ipc_handle);
b96eea718bf697 A.s. Dong 2018-10-30 44 }
3c8d42d4fdbf10 Anson Huang 2020-06-09 45 EXPORT_SYMBOL_GPL(imx_pinctrl_sc_ipc_init);
b96eea718bf697 A.s. Dong 2018-10-30 46
b96eea718bf697 A.s. Dong 2018-10-30 47 int imx_pinconf_get_scu(struct pinctrl_dev *pctldev, unsigned pin_id,
b96eea718bf697 A.s. Dong 2018-10-30 48 unsigned long *config)
b96eea718bf697 A.s. Dong 2018-10-30 49 {
b96eea718bf697 A.s. Dong 2018-10-30 50 struct imx_sc_msg_req_pad_get msg;
b96eea718bf697 A.s. Dong 2018-10-30 51 struct imx_sc_msg_resp_pad_get *resp;
b96eea718bf697 A.s. Dong 2018-10-30 52 struct imx_sc_rpc_msg *hdr = &msg.hdr;
b96eea718bf697 A.s. Dong 2018-10-30 53 int ret;
b96eea718bf697 A.s. Dong 2018-10-30 54
b96eea718bf697 A.s. Dong 2018-10-30 55 hdr->ver = IMX_SC_RPC_VERSION;
b96eea718bf697 A.s. Dong 2018-10-30 56 hdr->svc = IMX_SC_RPC_SVC_PAD;
b96eea718bf697 A.s. Dong 2018-10-30 57 hdr->func = IMX_SC_PAD_FUNC_GET;
b96eea718bf697 A.s. Dong 2018-10-30 58 hdr->size = 2;
b96eea718bf697 A.s. Dong 2018-10-30 59
b96eea718bf697 A.s. Dong 2018-10-30 60 msg.pad = pin_id;
b96eea718bf697 A.s. Dong 2018-10-30 61
b96eea718bf697 A.s. Dong 2018-10-30 @62 ret = imx_scu_call_rpc(pinctrl_ipc_handle, &msg, true);
b96eea718bf697 A.s. Dong 2018-10-30 63 if (ret)
b96eea718bf697 A.s. Dong 2018-10-30 64 return ret;
b96eea718bf697 A.s. Dong 2018-10-30 65
b96eea718bf697 A.s. Dong 2018-10-30 66 resp = (struct imx_sc_msg_resp_pad_get *)&msg;
b96eea718bf697 A.s. Dong 2018-10-30 67 *config = resp->val;
b96eea718bf697 A.s. Dong 2018-10-30 68
b96eea718bf697 A.s. Dong 2018-10-30 69 return 0;
b96eea718bf697 A.s. Dong 2018-10-30 70 }
3c8d42d4fdbf10 Anson Huang 2020-06-09 71 EXPORT_SYMBOL_GPL(imx_pinconf_get_scu);
b96eea718bf697 A.s. Dong 2018-10-30 72

:::::: The code at line 43 was first introduced by commit
:::::: b96eea718bf697e4a490c2fabfb89995b9193c21 pinctrl: fsl: add scu based pinctrl support

:::::: TO: A.s. Dong <[email protected]>
:::::: CC: Linus Walleij <[email protected]>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]


Attachments:
(No filename) (4.26 kB)
.config.gz (38.89 kB)
Download all attachments

2020-06-10 08:07:21

by Aisheng Dong

[permalink] [raw]
Subject: RE: [PATCH V3 0/9] Support i.MX8 SoCs pinctrl drivers built as module

> From: Anson Huang <[email protected]>
> Sent: Tuesday, June 9, 2020 10:21 PM
>
> There are more and mroe requirements that SoC specific modules should be
> built as module in order to support generic kernel image, such as Android GKI
> concept.
>
> This patch series supports i.MX8 SoCs pinctrl drivers to be built as module,
> including i.MX8MQ/MM/MN/MP/QXP/QM/DXL SoCs, and it also supports
> building i.MX common pinctrl driver and i.MX SCU common pinctrl driver as
> module.
>

This patch series also changed the driver initcall level from arch_initcall to module_init.
Maybe you could provide some test information to help the reviewer to better understand
the change impact.

Regards
Aisheng

> Compared to V2, the changes are as below:
> - add "depends on OF" to PINCTRL_IMX to fix build error using x86
> randconfig;
> - change the config dependency of PINCTRL_IMX_SCU to support scenario
> of
> building in PINCTRL_IMX while building PINCTRL_IMX_SCU as module,
> no other
> good choice in my mind, if you have better idea without changing the
> driver
> code, please advise.
>
> Anson Huang (9):
> pinctrl: imx: Support building SCU pinctrl driver as module
> pinctrl: imx: Support building i.MX pinctrl driver as module
> pinctrl: imx8mm: Support building as module
> pinctrl: imx8mn: Support building as module
> pinctrl: imx8mq: Support building as module
> pinctrl: imx8mp: Support building as module
> pinctrl: imx8qxp: Support building as module
> pinctrl: imx8qm: Support building as module
> pinctrl: imx8dxl: Support building as module
>
> drivers/pinctrl/freescale/Kconfig | 27 ++++++++++++++-------------
> drivers/pinctrl/freescale/pinctrl-imx.c | 4 ++++
> drivers/pinctrl/freescale/pinctrl-imx.h | 2 +-
> drivers/pinctrl/freescale/pinctrl-imx8dxl.c | 9 +++------
> drivers/pinctrl/freescale/pinctrl-imx8mm.c | 10 ++++------
> drivers/pinctrl/freescale/pinctrl-imx8mn.c | 10 ++++------
> drivers/pinctrl/freescale/pinctrl-imx8mp.c | 10 ++++------
> drivers/pinctrl/freescale/pinctrl-imx8mq.c | 9 ++++-----
> drivers/pinctrl/freescale/pinctrl-imx8qm.c | 9 +++------
> drivers/pinctrl/freescale/pinctrl-imx8qxp.c | 9 +++------
> drivers/pinctrl/freescale/pinctrl-scu.c | 6 ++++++
> 11 files changed, 50 insertions(+), 55 deletions(-)
>
> --
> 2.7.4

2020-06-10 08:16:08

by Anson Huang

[permalink] [raw]
Subject: RE: [PATCH V3 0/9] Support i.MX8 SoCs pinctrl drivers built as module




> Subject: RE: [PATCH V3 0/9] Support i.MX8 SoCs pinctrl drivers built as module
>
> > From: Anson Huang <[email protected]>
> > Sent: Tuesday, June 9, 2020 10:21 PM
> >
> > There are more and mroe requirements that SoC specific modules should
> > be built as module in order to support generic kernel image, such as
> > Android GKI concept.
> >
> > This patch series supports i.MX8 SoCs pinctrl drivers to be built as
> > module, including i.MX8MQ/MM/MN/MP/QXP/QM/DXL SoCs, and it also
> > supports building i.MX common pinctrl driver and i.MX SCU common
> > pinctrl driver as module.
> >
>
> This patch series also changed the driver initcall level from arch_initcall to
> module_init.
> Maybe you could provide some test information to help the reviewer to better
> understand the change impact.

There are still some more changes in V4 I just sent out, which is to cover various config combination,
will add test info in next version.

Anson

2020-06-11 08:36:30

by Anson Huang

[permalink] [raw]
Subject: RE: [PATCH V3 0/9] Support i.MX8 SoCs pinctrl drivers built as module


> Subject: RE: [PATCH V3 0/9] Support i.MX8 SoCs pinctrl drivers built as module
>
>
>
>
> > Subject: RE: [PATCH V3 0/9] Support i.MX8 SoCs pinctrl drivers built
> > as module
> >
> > > From: Anson Huang <[email protected]>
> > > Sent: Tuesday, June 9, 2020 10:21 PM
> > >
> > > There are more and mroe requirements that SoC specific modules
> > > should be built as module in order to support generic kernel image,
> > > such as Android GKI concept.
> > >
> > > This patch series supports i.MX8 SoCs pinctrl drivers to be built as
> > > module, including i.MX8MQ/MM/MN/MP/QXP/QM/DXL SoCs, and it also
> > > supports building i.MX common pinctrl driver and i.MX SCU common
> > > pinctrl driver as module.
> > >
> >
> > This patch series also changed the driver initcall level from
> > arch_initcall to module_init.
> > Maybe you could provide some test information to help the reviewer to
> > better understand the change impact.
>
> There are still some more changes in V4 I just sent out, which is to cover
> various config combination, will add test info in next version.

I will keep the arch_initcall() there in next version patch series, it can make sure the
change does NOT impact built-in config. For module build, the arch_initcall() will
be same as module_init(), user needs to insmod the .ko with correct sequence.

Anson