2020-09-17 05:50:17

by Anson Huang

[permalink] [raw]
Subject: [PATCH V3 1/4] gpio: mxc: Support module build

Change config to tristate, add module device table, module author,
description and license to support module build for i.MX GPIO driver.

As this is a SoC GPIO module, it provides common functions for most
of the peripheral devices, such as GPIO pins control, secondary
interrupt controller for GPIO pins IRQ etc., without GPIO driver, most
of the peripheral devices will NOT work properly, so GPIO module is
similar with clock, pinctrl driver that should be loaded ONCE and
never unloaded.

Since MXC GPIO driver needs to have init function to register syscore
ops once, here still use subsys_initcall(), NOT module_platform_driver().

Signed-off-by: Anson Huang <[email protected]>
---
no change.
---
drivers/gpio/Kconfig | 2 +-
drivers/gpio/gpio-mxc.c | 6 ++++++
2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 5cfdaf3..c7292a5 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -397,7 +397,7 @@ config GPIO_MVEBU
select REGMAP_MMIO

config GPIO_MXC
- def_bool y
+ tristate "i.MX GPIO support"
depends on ARCH_MXC || COMPILE_TEST
select GPIO_GENERIC
select GENERIC_IRQ_CHIP
diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c
index 64278a4..643f4c55 100644
--- a/drivers/gpio/gpio-mxc.c
+++ b/drivers/gpio/gpio-mxc.c
@@ -15,6 +15,7 @@
#include <linux/irq.h>
#include <linux/irqdomain.h>
#include <linux/irqchip/chained_irq.h>
+#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/syscore_ops.h>
@@ -158,6 +159,7 @@ static const struct of_device_id mxc_gpio_dt_ids[] = {
{ .compatible = "fsl,imx7d-gpio", .data = &mxc_gpio_devtype[IMX35_GPIO], },
{ /* sentinel */ }
};
+MODULE_DEVICE_TABLE(of, mxc_gpio_dt_ids);

/*
* MX2 has one interrupt *for all* gpio ports. The list is used
@@ -604,3 +606,7 @@ static int __init gpio_mxc_init(void)
return platform_driver_register(&mxc_gpio_driver);
}
subsys_initcall(gpio_mxc_init);
+
+MODULE_AUTHOR("Shawn Guo <[email protected]>");
+MODULE_DESCRIPTION("i.MX GPIO Driver");
+MODULE_LICENSE("GPL");
--
2.7.4


2020-09-17 05:50:24

by Anson Huang

[permalink] [raw]
Subject: [PATCH V3 2/4] arm64: defconfig: Build in CONFIG_GPIO_MXC by default

i.MX SoC GPIO driver provides the basic functions of GPIO pin operations
and IRQ operations, it is now changed from "def_bool y" to "tristate", so
it should be explicitly enabled to make sure all consumers work normally.

Signed-off-by: Anson Huang <[email protected]>
---
changes since V2:
- improve commit message to explain why CONFIG_GPIO_MXC needs to be enabled.
---
arch/arm64/configs/defconfig | 1 +
1 file changed, 1 insertion(+)

diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index 63003ec..c8fca1a 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -510,6 +510,7 @@ CONFIG_GPIO_PCA953X=y
CONFIG_GPIO_PCA953X_IRQ=y
CONFIG_GPIO_BD9571MWV=m
CONFIG_GPIO_MAX77620=y
+CONFIG_GPIO_MXC=y
CONFIG_POWER_AVS=y
CONFIG_QCOM_CPR=y
CONFIG_ROCKCHIP_IODOMAIN=y
--
2.7.4

2020-09-17 05:52:42

by Anson Huang

[permalink] [raw]
Subject: [PATCH V3 3/4] ARM: imx_v6_v7_defconfig: Build in CONFIG_GPIO_MXC by default

i.MX SoC GPIO driver provides the basic functions of GPIO pin operations
and IRQ operations, it is now changed from "def_bool y" to "tristate", so
it should be explicitly enabled to make sure all consumers work normally.

Signed-off-by: Anson Huang <[email protected]>
---
changes since V2:
- improve commit message to explain why CONFIG_GPIO_MXC needs to be enabled.
---
arch/arm/configs/imx_v6_v7_defconfig | 1 +
1 file changed, 1 insertion(+)

diff --git a/arch/arm/configs/imx_v6_v7_defconfig b/arch/arm/configs/imx_v6_v7_defconfig
index 0fa79bd..221f5c3 100644
--- a/arch/arm/configs/imx_v6_v7_defconfig
+++ b/arch/arm/configs/imx_v6_v7_defconfig
@@ -217,6 +217,7 @@ CONFIG_GPIO_PCA953X=y
CONFIG_GPIO_PCF857X=y
CONFIG_GPIO_STMPE=y
CONFIG_GPIO_74X164=y
+CONFIG_GPIO_MXC=y
CONFIG_POWER_RESET=y
CONFIG_POWER_RESET_SYSCON=y
CONFIG_POWER_RESET_SYSCON_POWEROFF=y
--
2.7.4

2020-09-17 05:52:47

by Anson Huang

[permalink] [raw]
Subject: [PATCH V3 4/4] ARM: multi_v7_defconfig: Build in CONFIG_GPIO_MXC by default

i.MX SoC GPIO driver provides the basic functions of GPIO pin operations
and IRQ operations, it is now changed from "def_bool y" to "tristate", so
it should be explicitly enabled to make sure all consumers work normally.

Signed-off-by: Anson Huang <[email protected]>
---
changes since V2:
- improve commit message to explain why CONFIG_GPIO_MXC needs to be enabled.
---
arch/arm/configs/multi_v7_defconfig | 1 +
1 file changed, 1 insertion(+)

diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig
index bfaa38c..d2744ff 100644
--- a/arch/arm/configs/multi_v7_defconfig
+++ b/arch/arm/configs/multi_v7_defconfig
@@ -465,6 +465,7 @@ CONFIG_GPIO_PALMAS=y
CONFIG_GPIO_TPS6586X=y
CONFIG_GPIO_TPS65910=y
CONFIG_GPIO_TWL4030=y
+CONFIG_GPIO_MXC=y
CONFIG_POWER_AVS=y
CONFIG_ROCKCHIP_IODOMAIN=y
CONFIG_POWER_RESET_AS3722=y
--
2.7.4

2020-09-29 13:09:42

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH V3 1/4] gpio: mxc: Support module build

On Thu, Sep 17, 2020 at 7:40 AM Anson Huang <[email protected]> wrote:

> Change config to tristate, add module device table, module author,
> description and license to support module build for i.MX GPIO driver.
>
> As this is a SoC GPIO module, it provides common functions for most
> of the peripheral devices, such as GPIO pins control, secondary
> interrupt controller for GPIO pins IRQ etc., without GPIO driver, most
> of the peripheral devices will NOT work properly, so GPIO module is
> similar with clock, pinctrl driver that should be loaded ONCE and
> never unloaded.
>
> Since MXC GPIO driver needs to have init function to register syscore
> ops once, here still use subsys_initcall(), NOT module_platform_driver().
>
> Signed-off-by: Anson Huang <[email protected]>

This patch (1) applied to the GPIO tree.
Please apply the rest through the ARM SoC tree!

Yours,
Linus Walleij

2020-10-12 02:11:20

by Guenter Roeck

[permalink] [raw]
Subject: Re: [PATCH V3 1/4] gpio: mxc: Support module build

On Thu, Sep 17, 2020 at 01:33:46PM +0800, Anson Huang wrote:
> Change config to tristate, add module device table, module author,
> description and license to support module build for i.MX GPIO driver.
>
> As this is a SoC GPIO module, it provides common functions for most
> of the peripheral devices, such as GPIO pins control, secondary
> interrupt controller for GPIO pins IRQ etc., without GPIO driver, most
> of the peripheral devices will NOT work properly, so GPIO module is
> similar with clock, pinctrl driver that should be loaded ONCE and
> never unloaded.
>
> Since MXC GPIO driver needs to have init function to register syscore
> ops once, here still use subsys_initcall(), NOT module_platform_driver().
>
> Signed-off-by: Anson Huang <[email protected]>

This patch made it into linux-next, but none of the other patches in
the series did. This results in a variety of boot failures in -next.

Not that it is my concern, but "without GPIO driver, most of the peripheral
devices will NOT work properly" makes me wonder if building this driver
as module is really expected to work anywhere.

Guenter

> ---
> no change.
> ---
> drivers/gpio/Kconfig | 2 +-
> drivers/gpio/gpio-mxc.c | 6 ++++++
> 2 files changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
> index 5cfdaf3..c7292a5 100644
> --- a/drivers/gpio/Kconfig
> +++ b/drivers/gpio/Kconfig
> @@ -397,7 +397,7 @@ config GPIO_MVEBU
> select REGMAP_MMIO
>
> config GPIO_MXC
> - def_bool y
> + tristate "i.MX GPIO support"
> depends on ARCH_MXC || COMPILE_TEST
> select GPIO_GENERIC
> select GENERIC_IRQ_CHIP
> diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c
> index 64278a4..643f4c55 100644
> --- a/drivers/gpio/gpio-mxc.c
> +++ b/drivers/gpio/gpio-mxc.c
> @@ -15,6 +15,7 @@
> #include <linux/irq.h>
> #include <linux/irqdomain.h>
> #include <linux/irqchip/chained_irq.h>
> +#include <linux/module.h>
> #include <linux/platform_device.h>
> #include <linux/slab.h>
> #include <linux/syscore_ops.h>
> @@ -158,6 +159,7 @@ static const struct of_device_id mxc_gpio_dt_ids[] = {
> { .compatible = "fsl,imx7d-gpio", .data = &mxc_gpio_devtype[IMX35_GPIO], },
> { /* sentinel */ }
> };
> +MODULE_DEVICE_TABLE(of, mxc_gpio_dt_ids);
>
> /*
> * MX2 has one interrupt *for all* gpio ports. The list is used
> @@ -604,3 +606,7 @@ static int __init gpio_mxc_init(void)
> return platform_driver_register(&mxc_gpio_driver);
> }
> subsys_initcall(gpio_mxc_init);
> +
> +MODULE_AUTHOR("Shawn Guo <[email protected]>");
> +MODULE_DESCRIPTION("i.MX GPIO Driver");
> +MODULE_LICENSE("GPL");

2020-10-12 11:37:54

by Anson Huang

[permalink] [raw]
Subject: RE: [PATCH V3 1/4] gpio: mxc: Support module build

Hi, Shawn

> Subject: Re: [PATCH V3 1/4] gpio: mxc: Support module build
>
> On Thu, Sep 17, 2020 at 7:40 AM Anson Huang <[email protected]>
> wrote:
>
> > Change config to tristate, add module device table, module author,
> > description and license to support module build for i.MX GPIO driver.
> >
> > As this is a SoC GPIO module, it provides common functions for most of
> > the peripheral devices, such as GPIO pins control, secondary interrupt
> > controller for GPIO pins IRQ etc., without GPIO driver, most of the
> > peripheral devices will NOT work properly, so GPIO module is similar
> > with clock, pinctrl driver that should be loaded ONCE and never
> > unloaded.
> >
> > Since MXC GPIO driver needs to have init function to register syscore
> > ops once, here still use subsys_initcall(), NOT module_platform_driver().
> >
> > Signed-off-by: Anson Huang <[email protected]>
>
> This patch (1) applied to the GPIO tree.
> Please apply the rest through the ARM SoC tree!
>

Could you please help pick the rest patch of this series? Otherwise, the i.MX GPIO driver will NOT
be enabled by default and it will block kernel boot.

Thanks,
Anson

2020-10-13 16:33:40

by Aisheng Dong

[permalink] [raw]
Subject: RE: [PATCH V3 1/4] gpio: mxc: Support module build

Hi Shawn,

> From: Anson Huang <[email protected]>
> Sent: Monday, October 12, 2020 7:36 PM
>
> Hi, Shawn
>
> > Subject: Re: [PATCH V3 1/4] gpio: mxc: Support module build
> >
> > On Thu, Sep 17, 2020 at 7:40 AM Anson Huang <[email protected]>
> > wrote:
> >
> > > Change config to tristate, add module device table, module author,
> > > description and license to support module build for i.MX GPIO driver.
> > >
> > > As this is a SoC GPIO module, it provides common functions for most
> > > of the peripheral devices, such as GPIO pins control, secondary
> > > interrupt controller for GPIO pins IRQ etc., without GPIO driver,
> > > most of the peripheral devices will NOT work properly, so GPIO
> > > module is similar with clock, pinctrl driver that should be loaded
> > > ONCE and never unloaded.
> > >
> > > Since MXC GPIO driver needs to have init function to register
> > > syscore ops once, here still use subsys_initcall(), NOT
> module_platform_driver().
> > >
> > > Signed-off-by: Anson Huang <[email protected]>
> >
> > This patch (1) applied to the GPIO tree.
> > Please apply the rest through the ARM SoC tree!
> >
>
> Could you please help pick the rest patch of this series? Otherwise, the i.MX
> GPIO driver will NOT be enabled by default and it will block kernel boot.

This blocked a huge number of i.MX boards booting with latest linux-next kernel.
Would you help pick it ASAP?

Regards
Aisheng

>
> Thanks,
> Anson

2020-10-26 08:42:39

by Shawn Guo

[permalink] [raw]
Subject: Re: [PATCH V3 2/4] arm64: defconfig: Build in CONFIG_GPIO_MXC by default

On Thu, Sep 17, 2020 at 01:33:47PM +0800, Anson Huang wrote:
> i.MX SoC GPIO driver provides the basic functions of GPIO pin operations
> and IRQ operations, it is now changed from "def_bool y" to "tristate", so
> it should be explicitly enabled to make sure all consumers work normally.
>
> Signed-off-by: Anson Huang <[email protected]>

Applied patch #2 ~ #4 as fixes.

Shawn