Skip to contentSkip to conversation

Moxtet bus fixes

PATCH In review Sjoerd Simons 3 participants 13 messages Nov 28, 2023 – Dec 20, 2023

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v2 cover Moxtet bus fixes

It seems the moxtet bus support was broken since 21aad8ba615e ("arm64:
dts: armada-3720-turris-mox: Add missing interrupt for RTC") for two reasons:
* The moxtet irq isn't marked as shared so the driver fails to load if the rtc driver gets set up first.
* The dts change didn't set the IRQ type, so in case the rtc driver got probed first irq setup ended up wrong (rising instead of falling edge).

On top of that the moxtet module isn't auto-loading due to a missing spi table

Changes in v2:
- Add cover letter
- Add patch to set the irq type

Sjoerd Simons (3):
bus: moxtet: Mark the irq as shared
bus: moxtet: Add spi device table
arm64: dts: armada-3720-turris-mox: set irq type for RTC

 arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts | 2 +-
 drivers/bus/moxtet.c                                   | 9 ++++++++-
 2 files changed, 9 insertions(+), 2 deletions(-)
Signature · 1 line
2.43.0
#1 lore raw

PATCH v2 1/3 bus: moxtet: Mark the irq as shared

The Turris Mox shares the moxtet IRQ with various devices on the board, so mark the IRQ as shared in the driver as well.

Without this loading the module will fail with:
genirq: Flags mismatch irq 40. 00002002 (moxtet) vs. 00002080 (mcp7940x)

---

(no changes since v1)

 drivers/bus/moxtet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bus/moxtet.c +1 -1
index 5eb0fe73ddc4..48c18f95660a 100644
@@ -755,7 +755,7 @@ static int moxtet_irq_setup(struct moxtet *moxtet)
 	moxtet->irq.masked = ~0;
 
 	ret = request_threaded_irq(moxtet->dev_irq, NULL, moxtet_irq_thread_fn,
-				   IRQF_ONESHOT, "moxtet", moxtet);
+				   IRQF_SHARED | IRQF_ONESHOT, "moxtet", moxtet);
 	if (ret < 0)
 		goto err_free;
 
Signature · 1 line
2.43.0
maintainer Reviewed-by on v2 1/3
#2 lore raw

Re: [PATCH v2 1/3] bus: moxtet: Mark the irq as shared

Quoted 20 lines · On Tue, 28 Nov 2023 22:35:04 +0100 Sjoerd Simons <[email protected]> wrote:

The Turris Mox shares the moxtet IRQ with various devices on the board, so mark the IRQ as shared in the driver as well.

Without this loading the module will fail with:
genirq: Flags mismatch irq 40. 00002002 (moxtet) vs. 00002080 (mcp7940x)

---

(no changes since v1)

 drivers/bus/moxtet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bus/moxtet.c +0 -0
index 5eb0fe73ddc4..48c18f95660a 100644

drivers/bus/moxtet.c static int moxtet_irq_setup(struct moxtet *moxtet) · line 761

Quoted 8 lines
drivers/bus/moxtet.c +1 -1
@@ -755,7 +755,7 @@ static int moxtet_irq_setup(struct moxtet *moxtet)
 	moxtet->irq.masked = ~0;
 
 	ret = request_threaded_irq(moxtet->dev_irq, NULL, moxtet_irq_thread_fn,
-				   IRQF_ONESHOT, "moxtet", moxtet);
+				   IRQF_SHARED | IRQF_ONESHOT, "moxtet", moxtet);
 	if (ret < 0)
 		goto err_free;
 
#3 lore raw

PATCH v2 2/3 bus: moxtet: Add spi device table

In reply to Sjoerd Simons

The moxtet module fails to auto-load on. Add a SPI id table to allow it to do so.

---

(no changes since v1)

 drivers/bus/moxtet.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/bus/moxtet.c +7 -0
index 48c18f95660a..e384fbc6c1d9 100644
@@ -830,6 +830,12 @@ static void moxtet_remove(struct spi_device *spi)
 	mutex_destroy(&moxtet->lock);
 }
 
+static const struct spi_device_id moxtet_spi_ids[] = {
+	{ "moxtet" },
+	{ },
+};
+MODULE_DEVICE_TABLE(spi, moxtet_spi_ids);
+
 static const struct of_device_id moxtet_dt_ids[] = {
 	{ .compatible = "cznic,moxtet" },
 	{},
@@ -841,6 +847,7 @@ static struct spi_driver moxtet_spi_driver = {
 		.name		= "moxtet",
 		.of_match_table = moxtet_dt_ids,
 	},
+	.id_table	= moxtet_spi_ids,
 	.probe		= moxtet_probe,
 	.remove		= moxtet_remove,
 };
Signature · 1 line
2.43.0
maintainer Reviewed-by on v2 2/3
#4 lore raw

Re: [PATCH v2 2/3] bus: moxtet: Add spi device table

Quoted 31 lines · On Tue, 28 Nov 2023 22:35:05 +0100 Sjoerd Simons <[email protected]> wrote:

The moxtet module fails to auto-load on. Add a SPI id table to allow it to do so.

---

(no changes since v1)

 drivers/bus/moxtet.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/bus/moxtet.c +6 -0
index 48c18f95660a..e384fbc6c1d9 100644
@@ -830,6 +830,12 @@ static void moxtet_remove(struct spi_device *spi)
 	mutex_destroy(&moxtet->lock);
 }
 
+static const struct spi_device_id moxtet_spi_ids[] = {
+	{ "moxtet" },
+	{ },
+};
+MODULE_DEVICE_TABLE(spi, moxtet_spi_ids);
+
 static const struct of_device_id moxtet_dt_ids[] = {
 	{ .compatible = "cznic,moxtet" },
 	{},

drivers/bus/moxtet.c static struct spi_driver moxtet_spi_driver = { · line 853

Quoted 7 lines
drivers/bus/moxtet.c +1 -0
@@ -841,6 +847,7 @@ static struct spi_driver moxtet_spi_driver = {
 		.name		= "moxtet",
 		.of_match_table = moxtet_dt_ids,
 	},
+	.id_table	= moxtet_spi_ids,
 	.probe		= moxtet_probe,
 	.remove		= moxtet_remove,
 };
#5 lore raw

PATCH v2 3/3 arm64: dts: armada-3720-turris-mox: set irq type for RTC

In reply to Sjoerd Simons

The rtc on the mox shares its interrupt line with the moxtet bus. Set the interrupt type to be consistent between both devices. This ensures correct setup of the interrupt line regardless of probing order.

Fixes 21aad8ba615e ("arm64: dts: armada-3720-turris-mox: Add missing interrupt for RTC")

---

(no changes since v1)

 arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts +1 -1
index 9eab2bb22134..805ef2d79b40 100644
@@ -130,7 +130,7 @@ rtc@6f {
 		compatible = "microchip,mcp7940x";
 		reg = <0x6f>;
 		interrupt-parent = <&gpiosb>;
-		interrupts = <5 0>; /* GPIO2_5 */
+		interrupts = <5 IRQ_TYPE_EDGE_FALLING>; /* GPIO2_5 */
 	};
 };
 
Signature · 1 line
2.43.0
maintainer Reviewed-by on v2 3/3
#6 lore raw

Re: [PATCH v2 3/3] arm64: dts: armada-3720-turris-mox: set irq type for RTC

Quoted 20 lines · On Tue, 28 Nov 2023 22:35:06 +0100 Sjoerd Simons <[email protected]> wrote:

The rtc on the mox shares its interrupt line with the moxtet bus. Set the interrupt type to be consistent between both devices. This ensures correct setup of the interrupt line regardless of probing order.

Fixes 21aad8ba615e ("arm64: dts: armada-3720-turris-mox: Add missing interrupt for RTC")

---

(no changes since v1)

 arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts +0 -0
index 9eab2bb22134..805ef2d79b40 100644

arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts rtc@6f { · line 136

Quoted 8 lines
arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts +1 -1
@@ -130,7 +130,7 @@ rtc@6f {
 		compatible = "microchip,mcp7940x";
 		reg = <0x6f>;
 		interrupt-parent = <&gpiosb>;
-		interrupts = <5 0>; /* GPIO2_5 */
+		interrupts = <5 IRQ_TYPE_EDGE_FALLING>; /* GPIO2_5 */
 	};
 };
 
maintainer
#7 lore raw
In reply to Sjoerd Simons

Hello Marek and Sjoerd,

Quoted 11 lines

It seems the moxtet bus support was broken since 21aad8ba615e ("arm64:
dts: armada-3720-turris-mox: Add missing interrupt for RTC") for two reasons:
* The moxtet irq isn't marked as shared so the driver fails to load if the rtc driver gets set up first.
* The dts change didn't set the IRQ type, so in case the rtc driver got probed first irq setup ended up wrong (rising instead of falling edge).

On top of that the moxtet module isn't auto-loading due to a missing spi table

Quoted 8 lines

Changes in v2:
- Add cover letter
- Add patch to set the irq type

Sjoerd Simons (3):
bus: moxtet: Mark the irq as shared
bus: moxtet: Add spi device table
arm64: dts: armada-3720-turris-mox: set irq type for RTC

I only received the previous patch in my inbox, I plan to apply it. But what about the 2 other patches ? Marek will you do a pull request with these 2 patches or do you expect that I take them also ?

Regards,

Gregory

Quoted 8 lines
 arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts | 2 +-
 drivers/bus/moxtet.c                                   | 9 ++++++++-
 2 files changed, 9 insertions(+), 2 deletions(-)
Signature · 1 line
2.43.0
Signature · 3 lines
Gregory Clement, Bootlin
Embedded Linux and Kernel engineering
http://bootlin.com
maintainer
#8 lore raw
Quoted 22 lines · On Fri, 08 Dec 2023 15:51:20 +0100 Gregory CLEMENT…

Hello Marek and Sjoerd,

Quoted 11 lines

It seems the moxtet bus support was broken since 21aad8ba615e ("arm64:
dts: armada-3720-turris-mox: Add missing interrupt for RTC") for two reasons:
* The moxtet irq isn't marked as shared so the driver fails to load if the rtc driver gets set up first.
* The dts change didn't set the IRQ type, so in case the rtc driver got probed first irq setup ended up wrong (rising instead of falling edge).

On top of that the moxtet module isn't auto-loading due to a missing spi table

Quoted 8 lines

Changes in v2:
- Add cover letter
- Add patch to set the irq type

Sjoerd Simons (3):
bus: moxtet: Mark the irq as shared
bus: moxtet: Add spi device table
arm64: dts: armada-3720-turris-mox: set irq type for RTC

Quoted 7 lines

I only received the previous patch in my inbox, I plan to apply it. But what about the 2 other patches ? Marek will you do a pull request with these 2 patches or do you expect that I take them also ?

Regards,

Gregory

Gregory, as of yet I've never done a pull request. If you are willing to take all 3 patches now, please do. In the future I would like to start doing it for Turris stuff, if you are OK with it.

Marek

maintainer
#9 lore raw
Quoted 29 lines · Marek Behún
Quoted 26 lines · On Fri, 08 Dec 2023 15:51:20 +0100 Gregory CLEMENT…

Hello Marek and Sjoerd,

Quoted 11 lines

It seems the moxtet bus support was broken since 21aad8ba615e ("arm64:
dts: armada-3720-turris-mox: Add missing interrupt for RTC") for two reasons:
* The moxtet irq isn't marked as shared so the driver fails to load if the rtc driver gets set up first.
* The dts change didn't set the IRQ type, so in case the rtc driver got probed first irq setup ended up wrong (rising instead of falling edge).

On top of that the moxtet module isn't auto-loading due to a missing spi table

Quoted 8 lines

Changes in v2:
- Add cover letter
- Add patch to set the irq type

Sjoerd Simons (3):
bus: moxtet: Mark the irq as shared
bus: moxtet: Add spi device table
arm64: dts: armada-3720-turris-mox: set irq type for RTC

I only received the previous patch in my inbox, I plan to apply it. But what about the 2 other patches ? Marek will you do a pull request with these 2 patches or do you expect that I take them also ?

Quoted 6 lines
Quoted 3 lines

Regards,

Gregory

Gregory, as of yet I've never done a pull request. If you are willing to take all 3 patches now, please do. In the future I would like to

OK I applied them on mvebu/driver.

Quoted 1 line

start doing it for Turris stuff, if you are OK with it.

No pb, just tell me when you are going to doing it.

Gregory

Quoted 2 lines

Marek

Signature · 3 lines
Gregory Clement, Bootlin
Embedded Linux and Kernel engineering
http://bootlin.com
#11 lore raw
In reply to Gregory CLEMENT
Quoted 10 lines · Gregory CLEMENT
Quoted 6 lines · Marek Behún

On Fri, 08 Dec 2023 15:51:20 +0100
Gregory CLEMENT <[email protected]> wrote:

Gregory, as of yet I've never done a pull request. If you are willing
to take all 3 patches now, please do. In the future I would like to

OK I applied them on mvebu/driver.

Thanks both for moving this patches forward; Gregory looks like you only applied two of the three patches (missing the dt patch), are you expect that to flow through a different tree or ?

Regards,

Signature · 2 lines
Sjoerd Simons
Collabora Ltd.
maintainer
#12 lore raw
Quoted 10 lines · Sjoerd Simons
Quoted 9 lines · Gregory CLEMENT
Quoted 6 lines · Marek Behún

On Fri, 08 Dec 2023 15:51:20 +0100
Gregory CLEMENT <[email protected]> wrote:

Gregory, as of yet I've never done a pull request. If you are willing
to take all 3 patches now, please do. In the future I would like to

Quoted 5 lines
Quoted 1 line

OK I applied them on mvebu/driver.

Thanks both for moving this patches forward; Gregory looks like you only applied two of the three patches (missing the dt patch), are you expect that to flow through a different tree or ?

The device tree patch is applied on mvebu/dt64, I've just pushed the updated branch, but it was already in the for-next branch.

Gregory

Quoted 6 lines

Regards,

Signature · 2 lines
Sjoerd Simons
Collabora Ltd.
Signature · 3 lines
Gregory Clement, Bootlin
Embedded Linux and Kernel engineering
http://bootlin.com