aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2007-10-17 02:26:46 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-17 11:42:51 -0400
commit7917ff9a4cefd0500aa4a1b1942da96dbce6999f (patch)
tree17141d98b96fae1e8fac2974c97d264c897cbf27
parent978550b828d1c29dfd65707f5d001053c3d2d610 (diff)
tpm: pay attention to IRQ info from PNP
If we discover the TIS TPM device via PNP, use the PNP IRQ information rather than probing for an IRQ. If PNP shows no IRQ, run the TPM in polling mode. Tested-by: <valdis.kletnieks@vt.edu> Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Cc: Kylene Hall <kjhall@us.ibm.com> Cc: <tpm@selhorst.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/char/tpm/tpm_tis.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
index 23fa18a6654c..a8e808461377 100644
--- a/drivers/char/tpm/tpm_tis.c
+++ b/drivers/char/tpm/tpm_tis.c
@@ -435,17 +435,12 @@ module_param(interrupts, bool, 0444);
435MODULE_PARM_DESC(interrupts, "Enable interrupts"); 435MODULE_PARM_DESC(interrupts, "Enable interrupts");
436 436
437static int tpm_tis_init(struct device *dev, resource_size_t start, 437static int tpm_tis_init(struct device *dev, resource_size_t start,
438 resource_size_t len) 438 resource_size_t len, unsigned int irq)
439{ 439{
440 u32 vendor, intfcaps, intmask; 440 u32 vendor, intfcaps, intmask;
441 int rc, i; 441 int rc, i;
442 struct tpm_chip *chip; 442 struct tpm_chip *chip;
443 443
444 if (!start)
445 start = TIS_MEM_BASE;
446 if (!len)
447 len = TIS_MEM_LEN;
448
449 if (!(chip = tpm_register_hardware(dev, &tpm_tis))) 444 if (!(chip = tpm_register_hardware(dev, &tpm_tis)))
450 return -ENODEV; 445 return -ENODEV;
451 446
@@ -512,7 +507,9 @@ static int tpm_tis_init(struct device *dev, resource_size_t start,
512 iowrite32(intmask, 507 iowrite32(intmask,
513 chip->vendor.iobase + 508 chip->vendor.iobase +
514 TPM_INT_ENABLE(chip->vendor.locality)); 509 TPM_INT_ENABLE(chip->vendor.locality));
515 if (interrupts) { 510 if (interrupts)
511 chip->vendor.irq = irq;
512 if (interrupts && !chip->vendor.irq) {
516 chip->vendor.irq = 513 chip->vendor.irq =
517 ioread8(chip->vendor.iobase + 514 ioread8(chip->vendor.iobase +
518 TPM_INT_VECTOR(chip->vendor.locality)); 515 TPM_INT_VECTOR(chip->vendor.locality));
@@ -597,10 +594,17 @@ static int __devinit tpm_tis_pnp_init(struct pnp_dev *pnp_dev,
597 const struct pnp_device_id *pnp_id) 594 const struct pnp_device_id *pnp_id)
598{ 595{
599 resource_size_t start, len; 596 resource_size_t start, len;
597 unsigned int irq = 0;
598
600 start = pnp_mem_start(pnp_dev, 0); 599 start = pnp_mem_start(pnp_dev, 0);
601 len = pnp_mem_len(pnp_dev, 0); 600 len = pnp_mem_len(pnp_dev, 0);
602 601
603 return tpm_tis_init(&pnp_dev->dev, start, len); 602 if (pnp_irq_valid(pnp_dev, 0))
603 irq = pnp_irq(pnp_dev, 0);
604 else
605 interrupts = 0;
606
607 return tpm_tis_init(&pnp_dev->dev, start, len, irq);
604} 608}
605 609
606static int tpm_tis_pnp_suspend(struct pnp_dev *dev, pm_message_t msg) 610static int tpm_tis_pnp_suspend(struct pnp_dev *dev, pm_message_t msg)
@@ -660,7 +664,7 @@ static int __init init_tis(void)
660 return rc; 664 return rc;
661 if (IS_ERR(pdev=platform_device_register_simple("tpm_tis", -1, NULL, 0))) 665 if (IS_ERR(pdev=platform_device_register_simple("tpm_tis", -1, NULL, 0)))
662 return PTR_ERR(pdev); 666 return PTR_ERR(pdev);
663 if((rc=tpm_tis_init(&pdev->dev, 0, 0)) != 0) { 667 if((rc=tpm_tis_init(&pdev->dev, TIS_MEM_BASE, TIS_MEM_LEN, 0)) != 0) {
664 platform_device_unregister(pdev); 668 platform_device_unregister(pdev);
665 driver_unregister(&tis_drv); 669 driver_unregister(&tis_drv);
666 } 670 }