v3:
- Removed Fixes tag from patch 3 again
v2:
- A number of new patches (more hardware support and a few fixes)
- Patches 1-3 have gained Fixes tags
- Patch 2 depends on 1, so maybe we can push the GPIO patch through the
MFD tree to keep them together?
- The change in patch 7 was somewhat controversial. I've added a
warning, but it is the last patch of the series, so it doesn't affect
the rest of the series if it is rejected.
Matthias Schiffer (7):
gpio: tqmx86: really make IRQ optional
mfd: tqmx86: clear GPIO IRQ resource when no IRQ is set
mfd: tqmx86: remove incorrect TQMx90UC board ID
mfd: tqmx86: fix typo in "platform"
mfd: tqmx86: add support for TQMx110EB and TQMxE40x
mfd: tqmx86: add support for TQ-Systems DMI IDs
mfd: tqmx86: assume 24MHz LPC clock for unknown boards
drivers/gpio/gpio-tqmx86.c | 6 ++---
drivers/mfd/tqmx86.c | 48 ++++++++++++++++++++++++++++++--------
2 files changed, 41 insertions(+), 13 deletions(-)
--
2.17.1
Newer TQMx86 modules use TQ-Systems instead of TQ-Group as their vendor
ID.
Signed-off-by: Matthias Schiffer <[email protected]>
Reviewed-by: Andrew Lunn <[email protected]>
---
v2: new patch
v3: no changes
drivers/mfd/tqmx86.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/mfd/tqmx86.c b/drivers/mfd/tqmx86.c
index 9eb05b3ef573..58f35c8b5a45 100644
--- a/drivers/mfd/tqmx86.c
+++ b/drivers/mfd/tqmx86.c
@@ -271,6 +271,14 @@ static const struct dmi_system_id tqmx86_dmi_table[] __initconst = {
},
.callback = tqmx86_create_platform_device,
},
+ {
+ .ident = "TQMX86",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "TQ-Systems"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "TQMx"),
+ },
+ .callback = tqmx86_create_platform_device,
+ },
{}
};
MODULE_DEVICE_TABLE(dmi, tqmx86_dmi_table);
--
2.17.1
All future TQMx86 modules should use a 24MHz LPC clock. Warn about
unknown boards, but assume this is the case.
Signed-off-by: Matthias Schiffer <[email protected]>
Reviewed-by: Andrew Lunn <[email protected]>
---
v2:
- Separated from TQMxE40M support patch
- Add warning for unknown boards
v3: no changes
drivers/mfd/tqmx86.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/mfd/tqmx86.c b/drivers/mfd/tqmx86.c
index 58f35c8b5a45..7ae906ff8e35 100644
--- a/drivers/mfd/tqmx86.c
+++ b/drivers/mfd/tqmx86.c
@@ -147,7 +147,7 @@ static const char *tqmx86_board_id_to_name(u8 board_id)
}
}
-static int tqmx86_board_id_to_clk_rate(u8 board_id)
+static int tqmx86_board_id_to_clk_rate(struct device *dev, u8 board_id)
{
switch (board_id) {
case TQMX86_REG_BOARD_ID_50UC:
@@ -168,7 +168,9 @@ static int tqmx86_board_id_to_clk_rate(u8 board_id)
case TQMX86_REG_BOARD_ID_E38C:
return 33000;
default:
- return 0;
+ dev_warn(dev, "unknown board %d, assuming 24MHz LPC clock\n",
+ board_id);
+ return 24000;
}
}
@@ -229,7 +231,7 @@ static int tqmx86_probe(struct platform_device *pdev)
tqmx_gpio_resources[0].flags = 0;
}
- ocores_platform_data.clock_khz = tqmx86_board_id_to_clk_rate(board_id);
+ ocores_platform_data.clock_khz = tqmx86_board_id_to_clk_rate(dev, board_id);
if (i2c_det == TQMX86_REG_I2C_DETECT_SOFT) {
err = devm_mfd_add_devices(dev, PLATFORM_DEVID_NONE,
--
2.17.1
The driver was registering IRQ 0 when no IRQ was set. This leads to
warnings with newer kernels.
Clear the resource flags, so no resource is registered at all in this
case.
Fixes: 2f17dd34ffed ("mfd: tqmx86: IO controller with I2C, Wachdog and GPIO")
Signed-off-by: Matthias Schiffer <[email protected]>
Reviewed-by: Andrew Lunn <[email protected]>
---
v2: add Fixes line
v3: no changes
drivers/mfd/tqmx86.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/mfd/tqmx86.c b/drivers/mfd/tqmx86.c
index ddddf08b6a4c..732013f40e4e 100644
--- a/drivers/mfd/tqmx86.c
+++ b/drivers/mfd/tqmx86.c
@@ -209,6 +209,8 @@ static int tqmx86_probe(struct platform_device *pdev)
/* Assumes the IRQ resource is first. */
tqmx_gpio_resources[0].start = gpio_irq;
+ } else {
+ tqmx_gpio_resources[0].flags = 0;
}
ocores_platfom_data.clock_khz = tqmx86_board_id_to_clk_rate(board_id);
--
2.17.1
On Fri, 16 Jul 2021, Matthias Schiffer wrote:
> The driver was registering IRQ 0 when no IRQ was set. This leads to
> warnings with newer kernels.
>
> Clear the resource flags, so no resource is registered at all in this
> case.
>
> Fixes: 2f17dd34ffed ("mfd: tqmx86: IO controller with I2C, Wachdog and GPIO")
> Signed-off-by: Matthias Schiffer <[email protected]>
> Reviewed-by: Andrew Lunn <[email protected]>
> ---
>
> v2: add Fixes line
> v3: no changes
>
> drivers/mfd/tqmx86.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/mfd/tqmx86.c b/drivers/mfd/tqmx86.c
> index ddddf08b6a4c..732013f40e4e 100644
> --- a/drivers/mfd/tqmx86.c
> +++ b/drivers/mfd/tqmx86.c
> @@ -209,6 +209,8 @@ static int tqmx86_probe(struct platform_device *pdev)
>
> /* Assumes the IRQ resource is first. */
> tqmx_gpio_resources[0].start = gpio_irq;
> + } else {
> + tqmx_gpio_resources[0].flags = 0;
Strange - why is this !0 in the first place?
> }
>
> ocores_platfom_data.clock_khz = tqmx86_board_id_to_clk_rate(board_id);
--
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
On Thu, Aug 5, 2021 at 4:40 PM Matthias Schiffer
<[email protected]> wrote:
> On Thu, 2021-08-05 at 14:30 +0100, Lee Jones wrote:
> > On Fri, 16 Jul 2021, Matthias Schiffer wrote:
...
> > Strange - why is this !0 in the first place?
>
> I don't see anything strange here. DEFINE_RES_IRQ() sets flags to
> IORESOURCE_IRQ. We reset it to 0 when there is no IRQ to clear that
> resource entry.
>
> An alternative would be to start with an empty entry and only fill in
> the fields when an IRQ is used, but that seems more cumbersome than the
> current code to me.
Another alternative is to start using the IRQ DISABLED resource flag,
but I'm afraid that OF code is not ready for that.
https://elixir.bootlin.com/linux/latest/source/include/linux/ioport.h#L331
--
With Best Regards,
Andy Shevchenko
On Thu, 2021-08-05 at 14:30 +0100, Lee Jones wrote:
> On Fri, 16 Jul 2021, Matthias Schiffer wrote:
>
> > The driver was registering IRQ 0 when no IRQ was set. This leads to
> > warnings with newer kernels.
> >
> > Clear the resource flags, so no resource is registered at all in this
> > case.
> >
> > Fixes: 2f17dd34ffed ("mfd: tqmx86: IO controller with I2C, Wachdog and GPIO")
> > Signed-off-by: Matthias Schiffer <[email protected]>
> > Reviewed-by: Andrew Lunn <[email protected]>
> > ---
> >
> > v2: add Fixes line
> > v3: no changes
> >
> > drivers/mfd/tqmx86.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/mfd/tqmx86.c b/drivers/mfd/tqmx86.c
> > index ddddf08b6a4c..732013f40e4e 100644
> > --- a/drivers/mfd/tqmx86.c
> > +++ b/drivers/mfd/tqmx86.c
> > @@ -209,6 +209,8 @@ static int tqmx86_probe(struct platform_device *pdev)
> >
> > /* Assumes the IRQ resource is first. */
> > tqmx_gpio_resources[0].start = gpio_irq;
> > + } else {
> > + tqmx_gpio_resources[0].flags = 0;
>
> Strange - why is this !0 in the first place?
I don't see anything strange here. DEFINE_RES_IRQ() sets flags to
IORESOURCE_IRQ. We reset it to 0 when there is no IRQ to clear that
resource entry.
An alternative would be to start with an empty entry and only fill in
the fields when an IRQ is used, but that seems more cumbersome than the
current code to me.
>
> > }
> >
> > ocores_platfom_data.clock_khz = tqmx86_board_id_to_clk_rate(board_id);
>
>
On Thu, 2021-08-05 at 16:42 +0300, Andy Shevchenko wrote:
> On Thu, Aug 5, 2021 at 4:40 PM Matthias Schiffer
> <[email protected]> wrote:
> > On Thu, 2021-08-05 at 14:30 +0100, Lee Jones wrote:
> > > On Fri, 16 Jul 2021, Matthias Schiffer wrote:
>
> ...
>
> > > Strange - why is this !0 in the first place?
> >
> > I don't see anything strange here. DEFINE_RES_IRQ() sets flags to
> > IORESOURCE_IRQ. We reset it to 0 when there is no IRQ to clear that
> > resource entry.
> >
> > An alternative would be to start with an empty entry and only fill in
> > the fields when an IRQ is used, but that seems more cumbersome than the
> > current code to me.
>
> Another alternative is to start using the IRQ DISABLED resource flag,
> but I'm afraid that OF code is not ready for that.
> https://elixir.bootlin.com/linux/latest/source/include/linux/ioport.h#L331
>
As this patch is a fairly simple bugfix, I'd prefer to get it (or a
similar fix) applied without having to wait for improvements of the
core code - also for the sake of stable backports.
On Fri, 16 Jul 2021, Matthias Schiffer wrote:
> v3:
> - Removed Fixes tag from patch 3 again
>
> v2:
> - A number of new patches (more hardware support and a few fixes)
> - Patches 1-3 have gained Fixes tags
> - Patch 2 depends on 1, so maybe we can push the GPIO patch through the
> MFD tree to keep them together?
> - The change in patch 7 was somewhat controversial. I've added a
> warning, but it is the last patch of the series, so it doesn't affect
> the rest of the series if it is rejected.
>
> Matthias Schiffer (7):
> gpio: tqmx86: really make IRQ optional
> mfd: tqmx86: clear GPIO IRQ resource when no IRQ is set
> mfd: tqmx86: remove incorrect TQMx90UC board ID
> mfd: tqmx86: fix typo in "platform"
> mfd: tqmx86: add support for TQMx110EB and TQMxE40x
> mfd: tqmx86: add support for TQ-Systems DMI IDs
> mfd: tqmx86: assume 24MHz LPC clock for unknown boards
Applied, thanks.
--
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog