aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/tpm/tpm_tis.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/tpm/tpm_tis.c')
-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 }