TQMx86: TQMx110EB and TQMxE40x MFD/GPIO support
Subsystems (3)
v3 cover TQMx86: TQMx110EB and TQMxE40x MFD/GPIO support
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(-)
Signature · 1 line
2.17.1
PATCH v3 1/7 gpio: tqmx86: really make IRQ optional
The tqmx86 MFD driver was passing IRQ 0 for "no IRQ" in the past. This causes warnings with newer kernels.
Prepare the gpio-tqmx86 driver for the fixed MFD driver by handling a missing IRQ properly.
---
v2: add Fixes line
v3: no changes
drivers/gpio/gpio-tqmx86.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpio/gpio-tqmx86.c +3 -3
@@ -238,8 +238,8 @@ static int tqmx86_gpio_probe(struct platform_device *pdev)struct resource *res;int ret, irq; - irq =platform_get_irq (pdev,0 ); -if (irq <0 ) + irq =platform_get_irq_optional (pdev,0 ); +if (irq <0 && irq != -ENXIO )return irq; res =platform_get_resource (pdev,IORESOURCE_IO ,0 );
@@ -278,7 +278,7 @@ static int tqmx86_gpio_probe(struct platform_device *pdev)pm_runtime_enable (&pdev->dev); -if (irq) { +if (irq >0 ) {struct irq_chip *irq_chip = &gpio->irq_chip;u8 irq_status;
Signature · 1 line
2.17.1
Re: [PATCH v3 1/7] gpio: tqmx86: really make IRQ optional
Quoted 6 lines · Matthias Schiffer
The tqmx86 MFD driver was passing IRQ 0 for "no IRQ" in the past. This causes warnings with newer kernels.
Prepare the gpio-tqmx86 driver for the fixed MFD driver by handling a missing IRQ properly.
Quoted 7 lines
Fixes b868db94a6a7 ("gpio: tqmx86: Add GPIO from for this IO controller")Signed-off-by Matthias Schiffer <[email protected]>Reviewed-by Andrew Lunn <[email protected]>---
v2: add Fixes line
v3: no changes
I suppose Lee will merge this into MFD with the rest of the patches? I don't see anything stopping Bart from just merging this one patch into the GPIO tree though. Only runtime dependencies.
Yours,
Linus Walleij
Re: [PATCH v3 1/7] gpio: tqmx86: really make IRQ optional
Quoted 18 lines · Linus Walleij
Quoted 6 lines · Matthias Schiffer
The tqmx86 MFD driver was passing IRQ 0 for "no IRQ" in the past. This causes warnings with newer kernels.
Prepare the gpio-tqmx86 driver for the fixed MFD driver by handling a missing IRQ properly.
Quoted 7 lines
Fixes b868db94a6a7 ("gpio: tqmx86: Add GPIO from for this IO controller")Signed-off-by Matthias Schiffer <[email protected]>Reviewed-by Andrew Lunn <[email protected]>---
v2: add Fixes line
v3: no changes
Quoted 8 lines
Acked-by Linus Walleij <[email protected]>I suppose Lee will merge this into MFD with the rest of the patches? I don't see anything stopping Bart from just merging this one patch into the GPIO tree though. Only runtime dependencies.
Yours,
Linus Walleij
I applied this patch for fixes and will shortly send a PR with some other fixes to Linus.
Bart
PATCH v3 2/7 mfd: tqmx86: clear GPIO IRQ resource when no IRQ is set
In reply to Matthias SchifferThe 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.
---
v2: add Fixes line
v3: no changes
drivers/mfd/tqmx86.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/mfd/tqmx86.c +2 -0
@@ -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);
Signature · 1 line
2.17.1
Re: [PATCH v3 2/7] mfd: tqmx86: clear GPIO IRQ resource when no IRQ is set
Quoted 22 lines · Matthias Schiffer
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 changesdrivers/mfd/tqmx86.c | 2 ++ 1 file changed, 2 insertions(+)drivers/mfd/tqmx86.c +0
-0
drivers/mfd/tqmx86.c static int tqmx86_probe(struct platform_device *pdev) · line 213
Quoted 5 lines
drivers/mfd/tqmx86.c +2
-0@@ -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?
Quoted 3 lines
drivers/mfd/tqmx86.c +0
-0} ocores_platfom_data.clock_khz =tqmx86_board_id_to_clk_rate (board_id);
Signature · 4 lines
Lee Jones [李琼斯] Senior Technical Lead - Developer Services Linaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog
Re: [PATCH v3 2/7] mfd: tqmx86: clear GPIO IRQ resource when no IRQ is set
Quoted 25 lines · Lee Jones
Quoted 23 lines · Matthias Schiffer
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 changesdrivers/mfd/tqmx86.c | 2 ++ 1 file changed, 2 insertions(+)drivers/mfd/tqmx86.c +0
-0@@ -209,6 +209,8 @@ static int tqmx86_probe(struct platform_device *pdev)
Quoted 6 lines
drivers/mfd/tqmx86.c static int tqmx86_probe(struct platform_device *pdev) · line 213
Quoted 4 lines
drivers/mfd/tqmx86.c +2
-0/* 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.
Quoted 6 lines
Quoted 4 lines
drivers/mfd/tqmx86.c +0
-0} ocores_platfom_data.clock_khz =tqmx86_board_id_to_clk_rate (board_id);
Re: [PATCH v3 2/7] mfd: tqmx86: clear GPIO IRQ resource when no IRQ is set
Quoted 2 lines · Matthias Schiffer
Quoted 1 line · Lee Jones
On Fri, 16 Jul 2021, Matthias Schiffer wrote:
...
Quoted 9 lines
Quoted 1 line
Strange - why is this !0 in the first place?
I don't see anything strange here.
DEFINE_RES_IRQ()sets flags toIORESOURCE_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
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v3 2/7] mfd: tqmx86: clear GPIO IRQ resource when no IRQ is set
Quoted 13 lines · Andy Shevchenko
Quoted 2 lines · Matthias Schiffer
Quoted 1 line · Lee Jones
On Fri, 16 Jul 2021, Matthias Schiffer wrote:
...
Quoted 6 lines
Quoted 1 line
Strange - why is this !0 in the first place?
I don't see anything strange here.
DEFINE_RES_IRQ()sets flags toIORESOURCE_IRQ. We reset it to 0 when there is no IRQ to clear that resource entry.
Quoted 8 lines
Quoted 3 lines
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.
PATCH v3 3/7 mfd: tqmx86: remove incorrect TQMx90UC board ID
In reply to Matthias SchifferNo TQMx90UC exists at the moment, and it is undecided whether ID 10 will be used eventually (and if it is, how that SoM will be named).
---
v2: new patch
v3: remove Fixes line
drivers/mfd/tqmx86.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/mfd/tqmx86.c +0 -4
@@ -35,7 +35,6 @@#define TQMX86_REG_BOARD_ID_E39x 7#define TQMX86_REG_BOARD_ID_70EB 8#define TQMX86_REG_BOARD_ID_80UC 9 -#define TQMX86_REG_BOARD_ID_90UC 10#define TQMX86_REG_BOARD_REV 0x21#define TQMX86_REG_IO_EXT_INT 0x26#define TQMX86_REG_IO_EXT_INT_NONE 0
@@ -128,8 +127,6 @@ static const char *tqmx86_board_id_to_name(u8 board_id)return "TQMx70EB" ;case TQMX86_REG_BOARD_ID_80UC :return "TQMx80UC" ; -case TQMX86_REG_BOARD_ID_90UC : -return "TQMx90UC" ;default :return "Unknown" ; }
@@ -142,7 +139,6 @@ static int tqmx86_board_id_to_clk_rate(u8 board_id)case TQMX86_REG_BOARD_ID_60EB :case TQMX86_REG_BOARD_ID_70EB :case TQMX86_REG_BOARD_ID_80UC : -case TQMX86_REG_BOARD_ID_90UC :return 24000 ;case TQMX86_REG_BOARD_ID_E39M :case TQMX86_REG_BOARD_ID_E39C :
Signature · 1 line
2.17.1
Re: [PATCH v3 3/7] mfd: tqmx86: remove incorrect TQMx90UC board ID
Quoted 5 lines · Matthias Schiffer
No TQMx90UC exists at the moment, and it is undecided whether ID 10 will be used eventually (and if it is, how that SoM will be named).
Signed-off-by Matthias Schiffer <[email protected]>Reviewed-by Andrew Lunn <[email protected]>
Quoted 7 lines
---
v2: new patch
v3: remove Fixes linedrivers/mfd/tqmx86.c | 4 ---- 1 file changed, 4 deletions(-)
For my own reference (apply this as-is to your sign-off block):
Signature · 4 lines
Lee Jones [李琼斯] Senior Technical Lead - Developer Services Linaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog
PATCH v3 4/7 mfd: tqmx86: fix typo in "platform"
In reply to Matthias SchifferRename variable from "ocores_platfom_data" to "ocores_platform_data".
---
v2: new patch
v3: new patch
drivers/mfd/tqmx86.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/mfd/tqmx86.c +4 -4
@@ -76,7 +76,7 @@ static struct i2c_board_info tqmx86_i2c_devices[] = { }, }; -static struct ocores_i2c_platform_data ocores_platfom_data = { +static struct ocores_i2c_platform_data ocores_platform_data = { .num_devices =ARRAY_SIZE (tqmx86_i2c_devices), .devices = tqmx86_i2c_devices, };
@@ -84,8 +84,8 @@ static struct ocores_i2c_platform_data ocores_platfom_data = {static const struct mfd_cell tqmx86_i2c_soft_dev[] = { { .name ="ocores-i2c" , - .platform_data = &ocores_platfom_data, - .pdata_size =sizeof (ocores_platfom_data), + .platform_data = &ocores_platform_data, + .pdata_size =sizeof (ocores_platform_data), .resources = tqmx_i2c_soft_resources, .num_resources =ARRAY_SIZE (tqmx_i2c_soft_resources), },
@@ -209,7 +209,7 @@ static int tqmx86_probe(struct platform_device *pdev) tqmx_gpio_resources[0 ].flags =0 ; } - ocores_platfom_data.clock_khz =tqmx86_board_id_to_clk_rate (board_id); + ocores_platform_data.clock_khz =tqmx86_board_id_to_clk_rate (board_id);if (i2c_det ==TQMX86_REG_I2C_DETECT_SOFT ) { err = devm_mfd_add_devices(dev, PLATFORM_DEVID_NONE,
Signature · 1 line
2.17.1
Re: [PATCH v3 4/7] mfd: tqmx86: fix typo in "platform"
Quoted 8 lines · Matthias Schiffer
Rename variable from "
ocores_platfom_data" to "ocores_platform_data".Signed-off-by Matthias Schiffer <[email protected]>Reviewed-by Andrew Lunn <[email protected]>---
v2: new patch
v3: new patch
Heh?
Quoted 2 lines
drivers/mfd/tqmx86.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
For my own reference (apply this as-is to your sign-off block):
Signature · 4 lines
Lee Jones [李琼斯] Senior Technical Lead - Developer Services Linaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog
PATCH v3 5/7 mfd: tqmx86: add support for TQMx110EB and TQMxE40x
In reply to Matthias SchifferAdd the board IDs for the TQMx110EB and the TQMxE40x family. All use a 24MHz LPC clock.
---
v2:
- add more new modules
- explicitly list each module for LPC clock
v3: no changes
drivers/mfd/tqmx86.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
drivers/mfd/tqmx86.c +20 -0
@@ -35,6 +35,11 @@#define TQMX86_REG_BOARD_ID_E39x 7#define TQMX86_REG_BOARD_ID_70EB 8#define TQMX86_REG_BOARD_ID_80UC 9 +#define TQMX86_REG_BOARD_ID_110EB 11 +#define TQMX86_REG_BOARD_ID_E40M 12 +#define TQMX86_REG_BOARD_ID_E40S 13 +#define TQMX86_REG_BOARD_ID_E40C1 14 +#define TQMX86_REG_BOARD_ID_E40C2 15#define TQMX86_REG_BOARD_REV 0x21#define TQMX86_REG_IO_EXT_INT 0x26#define TQMX86_REG_IO_EXT_INT_NONE 0
@@ -127,6 +132,16 @@ static const char *tqmx86_board_id_to_name(u8 board_id)return "TQMx70EB" ;case TQMX86_REG_BOARD_ID_80UC :return "TQMx80UC" ; +case TQMX86_REG_BOARD_ID_110EB : +return "TQMx110EB" ; +case TQMX86_REG_BOARD_ID_E40M : +return "TQMxE40M" ; +case TQMX86_REG_BOARD_ID_E40S : +return "TQMxE40S" ; +case TQMX86_REG_BOARD_ID_E40C1 : +return "TQMxE40C1" ; +case TQMX86_REG_BOARD_ID_E40C2 : +return "TQMxE40C2" ;default :return "Unknown" ; }
@@ -139,6 +154,11 @@ static int tqmx86_board_id_to_clk_rate(u8 board_id)case TQMX86_REG_BOARD_ID_60EB :case TQMX86_REG_BOARD_ID_70EB :case TQMX86_REG_BOARD_ID_80UC : +case TQMX86_REG_BOARD_ID_110EB : +case TQMX86_REG_BOARD_ID_E40M : +case TQMX86_REG_BOARD_ID_E40S : +case TQMX86_REG_BOARD_ID_E40C1 : +case TQMX86_REG_BOARD_ID_E40C2 :return 24000 ;case TQMX86_REG_BOARD_ID_E39M :case TQMX86_REG_BOARD_ID_E39C :
Signature · 1 line
2.17.1
PATCH v3 6/7 mfd: tqmx86: add support for TQ-Systems DMI IDs
In reply to Matthias SchifferNewer TQMx86 modules use TQ-Systems instead of TQ-Group as their vendor ID.
---
v2: new patch
v3: no changes
drivers/mfd/tqmx86.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/mfd/tqmx86.c +8 -0
@@ -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);
Signature · 1 line
2.17.1
PATCH v3 7/7 mfd: tqmx86: assume 24MHz LPC clock for unknown boards
In reply to Matthias SchifferAll future TQMx86 modules should use a 24MHz LPC clock. Warn about unknown boards, but assume this is the case.
---
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(-)
drivers/mfd/tqmx86.c +5 -3
@@ -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,
Signature · 1 line
2.17.1
Lee Jones
AppliedQuoted 15 lines · Matthias Schiffer
v3:
- Removed Fixes tag from patch 3 againv2:
- 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
Quoted 6 lines
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.
Signature · 4 lines
Lee Jones [李琼斯] Senior Technical Lead - Developer Services Linaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog