Skip to contentSkip to conversation

bus: moxtet: Mark the irq as shared

PATCH Superseded Sjoerd Simons 2 participants 4 messages Nov 23, 2023 – Dec 7, 2023 Arm/cz.nic turris support

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 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)

---

 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.42.0
#1 lore raw

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

The moxtet module was failing to auto-load on my system. Add a SPI id table to allow it to do so.

---

 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.42.0
maintainer Reviewed-by on v1 2/2
#2 lore raw

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

Quoted 28 lines · On Thu, 23 Nov 2023 15:23:38 +0100 Sjoerd Simons <[email protected]> wrote:

The moxtet module was failing to auto-load on my system. Add a SPI id table to allow it to do so.

---

 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,
 };
maintainer Reviewed-by on v1 1/2
#3 lore raw
In reply to Sjoerd Simons
Quoted 17 lines · On Thu, 23 Nov 2023 15:23:37 +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)

---

 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;