Skip to contentSkip to conversation

spi: atmel-quadspi: Print the controller version and used irq

PATCH In review Mihai Sain 4 participants 6 messages Oct 8, 2024 – Jan 13, 2025

Subsystems (2)
lore
Share & tools
lore

Mihai Sain

author
#0 lore raw

PATCH 1/1 spi: atmel-quadspi: Print the controller version and used irq

Add support to print the controller version and used irq similar to other at91 drivers (spi, twi, usart).

---
 drivers/spi/atmel-quadspi.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/spi/atmel-quadspi.c +2 -0
index 95cdfc28361e..757f07132585 100644
@@ -687,6 +687,8 @@ static int atmel_qspi_probe(struct platform_device *pdev)
 	pm_runtime_mark_last_busy(&pdev->dev);
 	pm_runtime_put_autosuspend(&pdev->dev);
 
+	dev_info(&pdev->dev, "AT91 QSPI Controller version %#x (irq %d)\n",
+		 atmel_qspi_read(aq, QSPI_VERSION), irq);
 	return 0;
 
 disable_qspick:

base-commit: 87d6aab2389e5ce0197d8257d5f8ee965a67c4cd
prerequisite-patch-id: 5e1313094386b146c9180d72c15bae49aaffbfa8

Signature · 1 line
2.47.0
#1 lore raw

Hi, Mihai,

Quoted 13 lines · Mihai Sain

Add support to print the controller version and used irq similar to other at91 drivers (spi, twi, usart).

---
 drivers/spi/atmel-quadspi.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/spi/atmel-quadspi.c +0 -0
index 95cdfc28361e..757f07132585 100644

drivers/spi/atmel-quadspi.c static int atmel_qspi_probe(struct platform_device *pdev) · line 691

Quoted 5 lines
drivers/spi/atmel-quadspi.c +2 -0
@@ -687,6 +687,8 @@ static int atmel_qspi_probe(struct platform_device *pdev)
 	pm_runtime_mark_last_busy(&pdev->dev);
 	pm_runtime_put_autosuspend(&pdev->dev);
 
+	dev_info(&pdev->dev, "AT91 QSPI Controller version %#x (irq %d)\n",
+		 atmel_qspi_read(aq, QSPI_VERSION), irq);

This pollutes the console. Better to add a dev_dbg if you care. And irq number doesn't bring too much value as you can see it in dt, isn't it?

Cheers,
ta

maintainer
#2 lore raw
Quoted 11 lines · Tudor Ambarus

drivers/spi/atmel-quadspi.c static int atmel_qspi_probe(struct platform_device *pdev) · line 691

Quoted 5 lines · Mihai Sain

Add support to print the controller version and used irq similar to other at91 drivers (spi, twi, usart).

drivers/spi/atmel-quadspi.c +2 -0
+	dev_info(&pdev->dev, "AT91 QSPI Controller version %#x (irq %d)\n",
+		 atmel_qspi_read(aq, QSPI_VERSION), irq);

This pollutes the console. Better to add a dev_dbg if you care. And irq number doesn't bring too much value as you can see it in dt, isn't it?

The objective of bringing the various AT91 drivers into consistency does seem useful so if this isn't OK for this driver we should probably update the other drivers as well. Ensuring that people can get at the IP version does feel useful, I guess it could also be a sysfs thing?

#3 lore raw
Quoted 13 lines · Mark Brown
Quoted 11 lines · Tudor Ambarus

drivers/spi/atmel-quadspi.c static int atmel_qspi_probe(struct platform_device *pdev) · line 691

Quoted 5 lines · Mihai Sain

Add support to print the controller version and used irq similar to other at91 drivers (spi, twi, usart).

drivers/spi/atmel-quadspi.c +2 -0
+	dev_info(&pdev->dev, "AT91 QSPI Controller version %#x (irq %d)\n",
+		 atmel_qspi_read(aq, QSPI_VERSION), irq);

This pollutes the console. Better to add a dev_dbg if you care. And irq number doesn't bring too much value as you can see it in dt, isn't it?

Quoted 2 lines

The objective of bringing the various AT91 drivers into consistency does seem useful so if this isn't OK for this driver we should probably

right, consistency is good.

Quoted 1 line

update the other drivers as well. Ensuring that people can get at the

Can be a goal. My point was that printing too much info in the boot log may hide other more important information. Printing IP versions, irqs, dma channels acquired (or worse, that a driver probed successful) shall be part of debug prints if someone cares.

Quoted 1 line

IP version does feel useful, I guess it could also be a sysfs thing?

I'd also consider debugfs for IP version, it has less restrictions.

Mihai, do as you find best, it's just a suggestion.

#4 lore raw
In reply to Mihai Sain

Hello Mihai,

just saw I made a similar patch for myself lately, so regarding the discussion of the need of such a patch, I would opt for it. However, see below …

Am Tue, Oct 08, 2024 at 11:32:26AM +0300 schrieb Mihai Sain:

Quoted 13 lines

Add support to print the controller version and used irq similar to other at91 drivers (spi, twi, usart).

---
 drivers/spi/atmel-quadspi.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/spi/atmel-quadspi.c +0 -0
index 95cdfc28361e..757f07132585 100644

drivers/spi/atmel-quadspi.c static int atmel_qspi_probe(struct platform_device *pdev) · line 692

Quoted 6 lines
drivers/spi/atmel-quadspi.c +2 -0
@@ -687,6 +687,8 @@ static int atmel_qspi_probe(struct platform_device *pdev)
 	pm_runtime_mark_last_busy(&pdev->dev);
 	pm_runtime_put_autosuspend(&pdev->dev);
 
+	dev_info(&pdev->dev, "AT91 QSPI Controller version %#x (irq %d)\n",
+		 atmel_qspi_read(aq, QSPI_VERSION), irq);
 	return 0;

I think this should go above pm_runtime functions, because it does i/o on a register. This is how my diff looks like:

drivers/spi/atmel-quadspi.c +7 -0
index 3d95b887235e6..7405b66e14b30 100644
@@ -1356,6 +1356,7 @@ static int atmel_qspi_probe(struct platform_device *pdev)
         struct atmel_qspi *aq;
         struct resource *res;
         int irq, err = 0;
+        u32 version;
 
         ctrl = devm_spi_alloc_host(&pdev->dev, sizeof(*aq));
         if (!ctrl)
@@ -1470,6 +1471,12 @@ static int atmel_qspi_probe(struct platform_device *pdev)
                 pm_runtime_dont_use_autosuspend(&pdev->dev);
                 goto dma_release;
         }
+
+        version = atmel_qspi_read(aq, QSPI_VERSION) & 0x00000fff;
+        dev_info(&pdev->dev,
+                 "Atmel QSPI Controller version 0x%x at %pR (irq %d)\n",
+                 version, pdev->resource, irq);
+
         pm_runtime_mark_last_busy(&pdev->dev);
         pm_runtime_put_autosuspend(&pdev->dev);
 

Greets
Alex

#5 lore raw
Quoted 1 line

Hello Mihai,

Hi Alexander,

Quoted 21 lines

just saw I made a similar patch for myself lately, so regarding the discussion of the need of such a patch, I would opt for it. However, see below …

Am Tue, Oct 08, 2024 at 11:32:26AM +0300 schrieb Mihai Sain:

Quoted 16 lines

Add support to print the controller version and used irq similar to other at91 drivers (spi, twi, usart).

---
 drivers/spi/atmel-quadspi.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/spi/atmel-quadspi.c +0 -0
index 95cdfc28361e..757f07132585 100644
@@ -687,6 +687,8 @@ static int atmel_qspi_probe(struct platform_device *pdev)
      pm_runtime_mark_last_busy(&pdev->dev);
      pm_runtime_put_autosuspend(&pdev->dev);
 
Quoted 6 lines

drivers/spi/atmel-quadspi.c static int atmel_qspi_probe(struct platform_device *pdev) · line 692

Quoted 3 lines
drivers/spi/atmel-quadspi.c +2 -0
+     dev_info(&pdev->dev, "AT91 QSPI Controller version %#x (irq %d)\n",
+              atmel_qspi_read(aq, QSPI_VERSION), irq);
      return 0;

I think this should go above pm_runtime functions, because it does i/o on a register. This is how my diff looks like:

Yes, you're right 😊
I also think that this print should be done using dev_dbg().

Quoted 27 lines
drivers/spi/atmel-quadspi.c index renamed from drivers/spi/atmel-quadspi.c +0 -0

3d95b887235e6..7405b66e14b30 100644

drivers/spi/atmel-quadspi.c +7 -0
@@ -1356,6 +1356,7 @@ static int atmel_qspi_probe(struct platform_device *pdev)
         struct atmel_qspi *aq;
         struct resource *res;
         int irq, err = 0;
+        u32 version;
 
         ctrl = devm_spi_alloc_host(&pdev->dev, sizeof(*aq));
         if (!ctrl)
@@ -1470,6 +1471,12 @@ static int atmel_qspi_probe(struct platform_device
 *pdev)
                 pm_runtime_dont_use_autosuspend(&pdev->dev);
                 goto dma_release;
         }
+
+        version = atmel_qspi_read(aq, QSPI_VERSION) & 0x00000fff;
+        dev_info(&pdev->dev,
+                 "Atmel QSPI Controller version 0x%x at %pR (irq %d)\n",
+                 version, pdev->resource, irq);
+
         pm_runtime_mark_last_busy(&pdev->dev);
         pm_runtime_put_autosuspend(&pdev->dev);
Quoted 2 lines

Greets
Alex

Regards,
Mihai