Skip to contentSkip to conversation

spi_imx.c: CSPI3 irq is 0 on imx25

PATCH Applied Richard Genoud 3 participants 12 messages Dec 23, 2010 – Jan 7, 2011

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

PATCH 1/2 spi_imx.c: CSPI3 irq is 0 on imx25

On imx25 soc, MX25_INT_CSPI3 is 0
(cf arch/arm/plat-mxc/include/mach/mx25.h). So, the test (spi_imx->irq <= 0) returned an error for this platform.
This patch corrects this behaviour.

---
 drivers/spi/spi_imx.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/spi/spi_imx.c +1 -1
index 55a38e2..793ae99 100644
@@ -847,7 +847,7 @@ static int __devinit spi_imx_probe(struct platform_device *pdev)
 	}
 
 	spi_imx->irq = platform_get_irq(pdev, 0);
-	if (spi_imx->irq <= 0) {
+	if (spi_imx->irq < 0) {
 		ret = -EINVAL;
 		goto out_iounmap;
 	}
Signature · 1 line
1.7.1
#1 lore raw

PATCH 2/2 spi_imx.c: TRIVIAL mx25 & mx35 SPI_VER is 0.7

The check on cpu_is_mx25 and cpu_is_mx35 was made twice. This is obviously wrong.
Anyway, this patch won't change the previous behaviour which is SPI_IMX_VER_0_7 for mx25 and mx35.

---
 drivers/spi/spi_imx.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/spi/spi_imx.c +1 -1
index 793ae99..96be9d1 100644
@@ -806,7 +806,7 @@ static int __devinit spi_imx_probe(struct platform_device *pdev)
 		if (cpu_is_mx25() || cpu_is_mx35())
 			spi_imx->devtype_data =
 				spi_imx_devtype_data[SPI_IMX_VER_0_7];
-		else if (cpu_is_mx25() || cpu_is_mx31() || cpu_is_mx35())
+		else if (cpu_is_mx31())
 			spi_imx->devtype_data =
 				spi_imx_devtype_data[SPI_IMX_VER_0_4];
 		else if (cpu_is_mx27() || cpu_is_mx21())
Signature · 1 line
1.7.1
#2 lore raw

Re: [PATCH 2/2] spi_imx.c: TRIVIAL mx25 & mx35 SPI_VER is 0.7

Quoted 2 lines · Richard Genoud

The check on cpu_is_mx25 and cpu_is_mx35 was made twice. This is obviously wrong.

obviously wrong but no wrong behaviour. Your patch only makes the code consistent, but IMHO it doesn't qualify as a bugfix.

Quoted 2 lines

Anyway, this patch won't change the previous behaviour which is SPI_IMX_VER_0_7 for mx25 and mx35.

This conflicts with
http://mid.gmane.org/[email protected]

which I prefer. The platform IDs have it correct (i.e.

	imx25-cspi -> 0.7
	imx31-cspi -> 0.4
	imx35-cspi -> 0.7

)

Best regards
Uwe

Quoted 23 lines
---
 drivers/spi/spi_imx.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/spi/spi_imx.c +1 -1
index 793ae99..96be9d1 100644
@@ -806,7 +806,7 @@ static int __devinit spi_imx_probe(struct platform_device *pdev)
 		if (cpu_is_mx25() || cpu_is_mx35())
 			spi_imx->devtype_data =
 				spi_imx_devtype_data[SPI_IMX_VER_0_7];
-		else if (cpu_is_mx25() || cpu_is_mx31() || cpu_is_mx35())
+		else if (cpu_is_mx31())
 			spi_imx->devtype_data =
 				spi_imx_devtype_data[SPI_IMX_VER_0_4];
 		else if (cpu_is_mx27() || cpu_is_mx21())
Signature · 1 line
1.7.1
Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#3 lore raw

Re: [PATCH 2/2] spi_imx.c: TRIVIAL mx25 & mx35 SPI_VER is 0.7

2010/12/23 Uwe Kleine-König <[email protected]>:

Quoted 5 lines · Richard Genoud
Quoted 2 lines

The check on cpu_is_mx25 and cpu_is_mx35 was made twice. This is obviously wrong.

obviously wrong but no wrong behaviour.  Your patch only makes the code consistent, but IMHO it doesn't qualify as a bugfix.

yes, that's what I said, this patch doesn't change the behaviour, it's only janitoring (I could have CC the list by the way).

If the whole SPI_IMX_VER_AUTODETECT system is going to be trashed, sure, my patch is useless...

Quoted 23 lines
Quoted 3 lines

Anyway, this patch won't change the previous behaviour which is SPI_IMX_VER_0_7 for mx25 and mx35.

This conflicts with
http://mid.gmane.org/[email protected]

which I prefer.  The platform IDs have it correct (i.e.

       imx25-cspi -> 0.7
       imx31-cspi -> 0.4
       imx35-cspi -> 0.7

)

Best regards
Uwe

Quoted 6 lines

---
 drivers/spi/spi_imx.c |    2 +-

 1 files changed, 1 insertions(+), 1 deletions(-)
Quoted 16 lines
Quoted 7 lines
drivers/spi/spi_imx.c +0 -0
index 793ae99..96be9d1 100644
@@ -806,7 +806,7 @@ static int __devinit spi_imx_probe(struct platform_device *pdev)
               if (cpu_is_mx25() || cpu_is_mx35())

                      spi_imx->devtype_data =

Quoted 9 lines

                              spi_imx_devtype_data[SPI_IMX_VER_0_7];
-             else if (cpu_is_mx25() || cpu_is_mx31() || cpu_is_mx35())
+             else if (cpu_is_mx31())
                      spi_imx->devtype_data = spi_imx_devtype_data[SPI_IMX_VER_0_4]; else if (cpu_is_mx27() || cpu_is_mx21())
--
1.7.1

Richard.

#4 lore raw

Re: [PATCH 2/2] spi_imx.c: TRIVIAL mx25 & mx35 SPI_VER is 0.7

In reply to Uwe Kleine-König
Quoted 11 lines · Uwe Kleine-König
Quoted 2 lines · Richard Genoud

The check on cpu_is_mx25 and cpu_is_mx35 was made twice. This is obviously wrong.

obviously wrong but no wrong behaviour. Your patch only makes the code consistent, but IMHO it doesn't qualify as a bugfix.

Quoted 2 lines

Anyway, this patch won't change the previous behaviour which is SPI_IMX_VER_0_7 for mx25 and mx35.

This conflicts with
http://mid.gmane.org/[email protected]

Quoted 7 lines

which I prefer. The platform IDs have it correct (i.e.

	imx25-cspi -> 0.7
	imx31-cspi -> 0.4
	imx35-cspi -> 0.7

)

Oops, missed you're reply. Okay, I've dropped Richard's patch and will look at yours.

g.

Applied
#5 lore raw

Re: [PATCH 2/2] spi_imx.c: TRIVIAL mx25 & mx35 SPI_VER is 0.7

In reply to Richard Genoud
Quoted 6 lines · Richard Genoud

The check on cpu_is_mx25 and cpu_is_mx35 was made twice. This is obviously wrong.
Anyway, this patch won't change the previous behaviour which is SPI_IMX_VER_0_7 for mx25 and mx35.

applied, thanks.

g.

Quoted 20 lines
---
 drivers/spi/spi_imx.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/spi/spi_imx.c +1 -1
index 793ae99..96be9d1 100644
@@ -806,7 +806,7 @@ static int __devinit spi_imx_probe(struct platform_device *pdev)
 		if (cpu_is_mx25() || cpu_is_mx35())
 			spi_imx->devtype_data =
 				spi_imx_devtype_data[SPI_IMX_VER_0_7];
-		else if (cpu_is_mx25() || cpu_is_mx31() || cpu_is_mx35())
+		else if (cpu_is_mx31())
 			spi_imx->devtype_data =
 				spi_imx_devtype_data[SPI_IMX_VER_0_4];
 		else if (cpu_is_mx27() || cpu_is_mx21())
Signature · 1 line
1.7.1
#6 lore raw
In reply to Richard Genoud
Quoted 16 lines · Richard Genoud

On imx25 soc, MX25_INT_CSPI3 is 0
(cf arch/arm/plat-mxc/include/mach/mx25.h). So, the test (spi_imx->irq <= 0) returned an error for this platform.
This patch corrects this behaviour.

---
 drivers/spi/spi_imx.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/spi/spi_imx.c +0 -0
index 55a38e2..793ae99 100644

drivers/spi/spi_imx.c static int __devinit spi_imx_probe(struct platform_device *pdev) · line 850

Quoted 5 lines
drivers/spi/spi_imx.c +1 -1
@@ -847,7 +847,7 @@ static int __devinit spi_imx_probe(struct platform_device *pdev)
 	}
 
 	spi_imx->irq = platform_get_irq(pdev, 0);
-	if (spi_imx->irq <= 0) {
+	if (spi_imx->irq < 0) {

I *really* don't want to apply this. The kernel is slowly moving toward NO_IRQ == 0 for all architectures. This patch is a step in the wrong direction because it will break with ARM starts using 0 for NO_IRQ.

I would accept a change to spi_imx->irq == NO_IRQ however.

g.

#7 lore raw

2010/12/23 Grant Likely <[email protected]>:

Quoted 28 lines · Richard Genoud
Quoted 16 lines

On imx25 soc, MX25_INT_CSPI3 is 0
(cf arch/arm/plat-mxc/include/mach/mx25.h). So, the test (spi_imx->irq <= 0) returned an error for this platform.
This patch corrects this behaviour.

---
 drivers/spi/spi_imx.c |    2 +-

 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/spi/spi_imx.c +0 -0
index 55a38e2..793ae99 100644

drivers/spi/spi_imx.c static int __devinit spi_imx_probe(struct platform_device *pdev) · line 850

Quoted 5 lines
drivers/spi/spi_imx.c +1 -1
@@ -847,7 +847,7 @@ static int __devinit spi_imx_probe(struct platform_device *pdev)
       }
 
       spi_imx->irq = platform_get_irq(pdev, 0);
-     if (spi_imx->irq <= 0) {
+     if (spi_imx->irq < 0) {

I *really* don't want to apply this.  The kernel is slowly moving toward NO_IRQ == 0 for all architectures.  This patch is a step in the wrong direction because it will break with ARM starts using 0 for NO_IRQ.

Quoted 4 lines

I would accept a change to spi_imx->irq == NO_IRQ however.

g.

Actually, the description of the patch is wrong, but not the patch itself. The test "if (spi_imx->irq <= 0)" is not testing the IRQ value, but the return value of platform_get_irq().
And platform_get_irq() can return an error (-ENXIO) or the IRQ value it found. So, as we are testing if platform_get_irq() failed or not, the test should be "if (spi_imx->irq < 0)"

If you agree with that, I will resend the patch with a good description.

richard.

Signature · 1 line
for me, ck means con kolivas and not calvin klein... does it mean I'm a geek ?
#8 lore raw

PATCH 1/1 spi_imx.c: correct the test on platform_get_irq() return value

The test "if (spi_imx->irq <= 0)" is not testing the IRQ value, but the return value of platform_get_irq(). As platform_get_irq() can return an error (-ENXIO) or the IRQ value it found, the test should be "if (spi_imx->irq < 0)"

---
 drivers/spi/spi_imx.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/spi/spi_imx.c +1 -1
index 55a38e2..793ae99 100644
@@ -847,7 +847,7 @@ static int __devinit spi_imx_probe(struct platform_device *pdev)
 	}
 
 	spi_imx->irq = platform_get_irq(pdev, 0);
-	if (spi_imx->irq <= 0) {
+	if (spi_imx->irq < 0) {
 		ret = -EINVAL;
 		goto out_iounmap;
 	}
Signature · 1 line
1.7.1
#9 lore raw

Re: [PATCH] spi_imx.c: correct the test on platform_get_irq() return value

Quoted 4 lines · Richard Genoud

The test "if (spi_imx->irq <= 0)" is not testing the IRQ value, but the return value of platform_get_irq(). As platform_get_irq() can return an error (-ENXIO) or the IRQ value it found, the test should be "if (spi_imx->irq < 0)"

For the majority of architectures in Linux, 0 is not a valid IRQ for devices. Unless there is an actual imx platform that currently assigns linux irq 0 to the spi controller then I'd rather not apply this change.

g.

Quoted 21 lines

---
 drivers/spi/spi_imx.c |    2 +-

 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/spi/spi_imx.c +1 -2
index 55a38e2..793ae99 100644
@@ -847,7 +847,7 @@ static int __devinit spi_imx_probe(struct platform_device *pdev)
        }
 
        spi_imx->irq = platform_get_irq(pdev, 0);
-       if (spi_imx->irq <= 0) {
+       if (spi_imx->irq < 0) {
                ret = -EINVAL;
                goto out_iounmap;
        }
--

1.7.1

Signature · 2 lines
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
#10 lore raw

Re: [PATCH] spi_imx.c: correct the test on platform_get_irq() return value

2011/1/7 Grant Likely <[email protected]>:

Quoted 10 lines · Richard Genoud
Quoted 4 lines

The test "if (spi_imx->irq <= 0)" is not testing the IRQ value, but the return value of platform_get_irq(). As platform_get_irq() can return an error (-ENXIO) or the IRQ value it found, the test should be "if (spi_imx->irq < 0)"

For the majority of architectures in Linux, 0 is not a valid IRQ for devices.  Unless there is an actual imx platform that currently assigns linux irq 0 to the spi controller then I'd rather not apply this change.

actually, there is the imx25 platform:
in arch/arm/plat-mxc/include/mach/mx25.h
line 61 :
#define MX25_INT_CSPI3 0
this is the interrupt assigned for CSPI3.

I doubled check with the imx25 release manual chapter 3.1 (page 51):
http://cache.freescale.com/files/dsp/doc/ref_manual/IMX25RM.pdf
And I made some spi test on the imx25 3stack PDK, the CSPI3 is working with irq 0.

richard.

#11 lore raw

Re: [PATCH] spi_imx.c: correct the test on platform_get_irq() return value

In reply to Richard Genoud
Quoted 4 lines · Richard Genoud

The test "if (spi_imx->irq <= 0)" is not testing the IRQ value, but the return value of platform_get_irq(). As platform_get_irq() can return an error (-ENXIO) or the IRQ value it found, the test should be "if (spi_imx->irq < 0)"

Alright. Applied.

g.

Quoted 20 lines
---
 drivers/spi/spi_imx.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/spi/spi_imx.c +1 -1
index 55a38e2..793ae99 100644
@@ -847,7 +847,7 @@ static int __devinit spi_imx_probe(struct platform_device *pdev)
 	}
 
 	spi_imx->irq = platform_get_irq(pdev, 0);
-	if (spi_imx->irq <= 0) {
+	if (spi_imx->irq < 0) {
 		ret = -EINVAL;
 		goto out_iounmap;
 	}
Signature · 1 line
1.7.1