* [PATCH] tpm_tis_spi: Pass the SPI IRQ down to the driver
@ 2018-06-08 7:02 Linus Walleij
2018-06-08 15:50 ` Jason Gunthorpe
0 siblings, 1 reply; 5+ messages in thread
From: Linus Walleij @ 2018-06-08 7:02 UTC (permalink / raw)
To: Peter Huewe, Jarkko Sakkinen, Jason Gunthorpe
Cc: linux-integrity, Linus Walleij, Mark Brown
An SPI TPM device managed directly on an embedded board using
the SPI bus and some GPIO or similar line as IRQ handler will
pass the IRQn from the TPM device associated with the SPI
device. This is already handled by the SPI core, so make sure
to pass this down to the core as well.
(The TPM core habit of using -1 to signal no IRQ is dubious
(as IRQ 0 is NO_IRQ) but I do not want to mess with that
semantic in this patch.)
Cc: Mark Brown <broonie@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
drivers/char/tpm/tpm_tis_spi.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/char/tpm/tpm_tis_spi.c b/drivers/char/tpm/tpm_tis_spi.c
index 424ff2fde1f2..9914f6973463 100644
--- a/drivers/char/tpm/tpm_tis_spi.c
+++ b/drivers/char/tpm/tpm_tis_spi.c
@@ -199,6 +199,7 @@ static const struct tpm_tis_phy_ops tpm_spi_phy_ops = {
static int tpm_tis_spi_probe(struct spi_device *dev)
{
struct tpm_tis_spi_phy *phy;
+ int irq;
phy = devm_kzalloc(&dev->dev, sizeof(struct tpm_tis_spi_phy),
GFP_KERNEL);
@@ -211,7 +212,13 @@ static int tpm_tis_spi_probe(struct spi_device *dev)
if (!phy->iobuf)
return -ENOMEM;
- return tpm_tis_core_init(&dev->dev, &phy->priv, -1, &tpm_spi_phy_ops,
+ /* If the SPI device has an IRQ then use that */
+ if (dev->irq > 0)
+ irq = dev->irq;
+ else
+ irq = -1;
+
+ return tpm_tis_core_init(&dev->dev, &phy->priv, irq, &tpm_spi_phy_ops,
NULL);
}
--
2.17.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] tpm_tis_spi: Pass the SPI IRQ down to the driver
2018-06-08 7:02 [PATCH] tpm_tis_spi: Pass the SPI IRQ down to the driver Linus Walleij
@ 2018-06-08 15:50 ` Jason Gunthorpe
2018-06-10 11:57 ` Linus Walleij
0 siblings, 1 reply; 5+ messages in thread
From: Jason Gunthorpe @ 2018-06-08 15:50 UTC (permalink / raw)
To: Linus Walleij; +Cc: Peter Huewe, Jarkko Sakkinen, linux-integrity, Mark Brown
On Fri, Jun 08, 2018 at 09:02:09AM +0200, Linus Walleij wrote:
> An SPI TPM device managed directly on an embedded board using
> the SPI bus and some GPIO or similar line as IRQ handler will
> pass the IRQn from the TPM device associated with the SPI
> device. This is already handled by the SPI core, so make sure
> to pass this down to the core as well.
>
> (The TPM core habit of using -1 to signal no IRQ is dubious
> (as IRQ 0 is NO_IRQ) but I do not want to mess with that
> semantic in this patch.)
Unless something has changed, there is no cross-arch constant called
NO_IRQ, and the few arches that do define it, tend to use -1..
Jason
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] tpm_tis_spi: Pass the SPI IRQ down to the driver
2018-06-08 15:50 ` Jason Gunthorpe
@ 2018-06-10 11:57 ` Linus Walleij
0 siblings, 0 replies; 5+ messages in thread
From: Linus Walleij @ 2018-06-10 11:57 UTC (permalink / raw)
To: Jason Gunthorpe; +Cc: Peter Huewe, Jarkko Sakkinen, linux-integrity, Mark Brown
On Fri, Jun 8, 2018 at 5:50 PM, Jason Gunthorpe <jgg@ziepe.ca> wrote:
> On Fri, Jun 08, 2018 at 09:02:09AM +0200, Linus Walleij wrote:
>> An SPI TPM device managed directly on an embedded board using
>> the SPI bus and some GPIO or similar line as IRQ handler will
>> pass the IRQn from the TPM device associated with the SPI
>> device. This is already handled by the SPI core, so make sure
>> to pass this down to the core as well.
>>
>> (The TPM core habit of using -1 to signal no IRQ is dubious
>> (as IRQ 0 is NO_IRQ) but I do not want to mess with that
>> semantic in this patch.)
>
> Unless something has changed, there is no cross-arch constant called
> NO_IRQ, and the few arches that do define it, tend to use -1..
AFAIU the idea is that for archs that don't define it, it is implicitly
0.
I just refer to this, albeit it's been 7 years:
https://lwn.net/Articles/470820/
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] tpm_tis_spi: Pass the SPI IRQ down to the driver
@ 2018-06-08 7:09 Linus Walleij
2018-06-18 18:08 ` Jarkko Sakkinen
0 siblings, 1 reply; 5+ messages in thread
From: Linus Walleij @ 2018-06-08 7:09 UTC (permalink / raw)
To: Peter Huewe, Jarkko Sakkinen, Jason Gunthorpe
Cc: linux-integrity, Linus Walleij, Mark Brown
An SPI TPM device managed directly on an embedded board using
the SPI bus and some GPIO or similar line as IRQ handler will
pass the IRQn from the TPM device associated with the SPI
device. This is already handled by the SPI core, so make sure
to pass this down to the core as well.
(The TPM core habit of using -1 to signal no IRQ is dubious
(as IRQ 0 is NO_IRQ) but I do not want to mess with that
semantic in this patch.)
Cc: Mark Brown <broonie@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
drivers/char/tpm/tpm_tis_spi.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/char/tpm/tpm_tis_spi.c b/drivers/char/tpm/tpm_tis_spi.c
index 424ff2fde1f2..9914f6973463 100644
--- a/drivers/char/tpm/tpm_tis_spi.c
+++ b/drivers/char/tpm/tpm_tis_spi.c
@@ -199,6 +199,7 @@ static const struct tpm_tis_phy_ops tpm_spi_phy_ops = {
static int tpm_tis_spi_probe(struct spi_device *dev)
{
struct tpm_tis_spi_phy *phy;
+ int irq;
phy = devm_kzalloc(&dev->dev, sizeof(struct tpm_tis_spi_phy),
GFP_KERNEL);
@@ -211,7 +212,13 @@ static int tpm_tis_spi_probe(struct spi_device *dev)
if (!phy->iobuf)
return -ENOMEM;
- return tpm_tis_core_init(&dev->dev, &phy->priv, -1, &tpm_spi_phy_ops,
+ /* If the SPI device has an IRQ then use that */
+ if (dev->irq > 0)
+ irq = dev->irq;
+ else
+ irq = -1;
+
+ return tpm_tis_core_init(&dev->dev, &phy->priv, irq, &tpm_spi_phy_ops,
NULL);
}
--
2.17.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] tpm_tis_spi: Pass the SPI IRQ down to the driver
2018-06-08 7:09 Linus Walleij
@ 2018-06-18 18:08 ` Jarkko Sakkinen
0 siblings, 0 replies; 5+ messages in thread
From: Jarkko Sakkinen @ 2018-06-18 18:08 UTC (permalink / raw)
To: Linus Walleij; +Cc: Peter Huewe, Jason Gunthorpe, linux-integrity, Mark Brown
On Fri, Jun 08, 2018 at 09:09:07AM +0200, Linus Walleij wrote:
> An SPI TPM device managed directly on an embedded board using
> the SPI bus and some GPIO or similar line as IRQ handler will
> pass the IRQn from the TPM device associated with the SPI
> device. This is already handled by the SPI core, so make sure
> to pass this down to the core as well.
>
> (The TPM core habit of using -1 to signal no IRQ is dubious
> (as IRQ 0 is NO_IRQ) but I do not want to mess with that
> semantic in this patch.)
>
> Cc: Mark Brown <broonie@kernel.org>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
/Jarkko
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-06-18 18:08 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-08 7:02 [PATCH] tpm_tis_spi: Pass the SPI IRQ down to the driver Linus Walleij
2018-06-08 15:50 ` Jason Gunthorpe
2018-06-10 11:57 ` Linus Walleij
-- strict thread matches above, loose matches on Subject: below --
2018-06-08 7:09 Linus Walleij
2018-06-18 18:08 ` Jarkko Sakkinen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox