aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorJason Gunthorpe <jgunthorpe@obsidianresearch.com>2015-11-25 16:05:31 -0500
committerJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>2015-12-20 08:23:46 -0500
commit036bb38ffb3e4c92361108f324364b0341cd9e31 (patch)
tree941cc20949152fee1cc2c2f7b73a8da479f23356 /drivers/char
parent727f28b8ca24a581c7bd868326b8cea1058c720a (diff)
tpm_tis: Ensure interrupts are disabled when the driver starts
This should be done very early, before anything could possibly cause the TPM to generate an interrupt. If the IRQ line is shared with another driver causing an interrupt before setting up our handler will be very bad. Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com> Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Tested-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Tested-by: Martin Wilck <Martin.Wilck@ts.fujitsu.com> Tested-by: Scot Doyle <lkml14@scotdoyle.com> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Acked-by: Peter Huewe <peterhuewe@gmx.de>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/tpm/tpm_tis.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
index f10a107614b4..513f30efd9d3 100644
--- a/drivers/char/tpm/tpm_tis.c
+++ b/drivers/char/tpm/tpm_tis.c
@@ -677,6 +677,15 @@ static int tpm_tis_init(struct device *dev, struct tpm_info *tpm_info,
677 goto out_err; 677 goto out_err;
678 } 678 }
679 679
680 /* Take control of the TPM's interrupt hardware and shut it off */
681 intmask = ioread32(chip->vendor.iobase +
682 TPM_INT_ENABLE(chip->vendor.locality));
683 intmask |= TPM_INTF_CMD_READY_INT | TPM_INTF_LOCALITY_CHANGE_INT |
684 TPM_INTF_DATA_AVAIL_INT | TPM_INTF_STS_VALID_INT;
685 intmask &= ~TPM_GLOBAL_INT_ENABLE;
686 iowrite32(intmask,
687 chip->vendor.iobase + TPM_INT_ENABLE(chip->vendor.locality));
688
680 if (request_locality(chip, 0) != 0) { 689 if (request_locality(chip, 0) != 0) {
681 rc = -ENODEV; 690 rc = -ENODEV;
682 goto out_err; 691 goto out_err;
@@ -735,17 +744,6 @@ static int tpm_tis_init(struct device *dev, struct tpm_info *tpm_info,
735 init_waitqueue_head(&chip->vendor.read_queue); 744 init_waitqueue_head(&chip->vendor.read_queue);
736 init_waitqueue_head(&chip->vendor.int_queue); 745 init_waitqueue_head(&chip->vendor.int_queue);
737 746
738 intmask =
739 ioread32(chip->vendor.iobase +
740 TPM_INT_ENABLE(chip->vendor.locality));
741
742 intmask |= TPM_INTF_CMD_READY_INT
743 | TPM_INTF_LOCALITY_CHANGE_INT | TPM_INTF_DATA_AVAIL_INT
744 | TPM_INTF_STS_VALID_INT;
745
746 iowrite32(intmask,
747 chip->vendor.iobase +
748 TPM_INT_ENABLE(chip->vendor.locality));
749 if (interrupts) 747 if (interrupts)
750 chip->vendor.irq = tpm_info->irq; 748 chip->vendor.irq = tpm_info->irq;
751 if (interrupts && !chip->vendor.irq) { 749 if (interrupts && !chip->vendor.irq) {