Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 260953
b: refs/heads/master
c: a7b6682
h: refs/heads/master
i:
  260951: 5c636bc
v: v3
  • Loading branch information
Stefan Berger authored and Rajiv Andrade committed Jul 12, 2011
1 parent 22f60db commit 186e89c
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 20b87bbfada971ae917cc2ff9dbc9dae05b94d25
refs/heads/master: a7b66822b20f67f106690d0acee3d0ba667fd9bb
1 change: 1 addition & 0 deletions trunk/drivers/char/tpm/tpm.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ struct tpm_vendor_specific {
unsigned long base; /* TPM base address */

int irq;
int probed_irq;

int region_size;
int have_region;
Expand Down
33 changes: 27 additions & 6 deletions trunk/drivers/char/tpm/tpm_tis.c
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ static irqreturn_t tis_int_probe(int irq, void *dev_id)
if (interrupt == 0)
return IRQ_NONE;

chip->vendor.irq = irq;
chip->vendor.probed_irq = irq;

/* Clear interrupts handled with TPM_EOI */
iowrite32(interrupt,
Expand Down Expand Up @@ -486,7 +486,7 @@ static int tpm_tis_init(struct device *dev, resource_size_t start,
resource_size_t len, unsigned int irq)
{
u32 vendor, intfcaps, intmask;
int rc, i;
int rc, i, irq_s, irq_e;
struct tpm_chip *chip;

if (!(chip = tpm_register_hardware(dev, &tpm_tis)))
Expand Down Expand Up @@ -544,6 +544,9 @@ static int tpm_tis_init(struct device *dev, resource_size_t start,
if (intfcaps & TPM_INTF_DATA_AVAIL_INT)
dev_dbg(dev, "\tData Avail Int Support\n");

/* get the timeouts before testing for irqs */
tpm_get_timeouts(chip);

/* INTERRUPT Setup */
init_waitqueue_head(&chip->vendor.read_queue);
init_waitqueue_head(&chip->vendor.int_queue);
Expand All @@ -562,13 +565,19 @@ static int tpm_tis_init(struct device *dev, resource_size_t start,
if (interrupts)
chip->vendor.irq = irq;
if (interrupts && !chip->vendor.irq) {
chip->vendor.irq =
irq_s =
ioread8(chip->vendor.iobase +
TPM_INT_VECTOR(chip->vendor.locality));
if (irq_s) {
irq_e = irq_s;
} else {
irq_s = 3;
irq_e = 15;
}

for (i = 3; i < 16 && chip->vendor.irq == 0; i++) {
for (i = irq_s; i <= irq_e && chip->vendor.irq == 0; i++) {
iowrite8(i, chip->vendor.iobase +
TPM_INT_VECTOR(chip->vendor.locality));
TPM_INT_VECTOR(chip->vendor.locality));
if (request_irq
(i, tis_int_probe, IRQF_SHARED,
chip->vendor.miscdev.name, chip) != 0) {
Expand All @@ -590,9 +599,22 @@ static int tpm_tis_init(struct device *dev, resource_size_t start,
chip->vendor.iobase +
TPM_INT_ENABLE(chip->vendor.locality));

chip->vendor.probed_irq = 0;

/* Generate Interrupts */
tpm_gen_interrupt(chip);

chip->vendor.irq = chip->vendor.probed_irq;

/* free_irq will call into tis_int_probe;
clear all irqs we haven't seen while doing
tpm_gen_interrupt */
iowrite32(ioread32
(chip->vendor.iobase +
TPM_INT_STATUS(chip->vendor.locality)),
chip->vendor.iobase +
TPM_INT_STATUS(chip->vendor.locality));

/* Turn off */
iowrite32(intmask,
chip->vendor.iobase +
Expand Down Expand Up @@ -631,7 +653,6 @@ static int tpm_tis_init(struct device *dev, resource_size_t start,
list_add(&chip->vendor.list, &tis_chips);
spin_unlock(&tis_lock);

tpm_get_timeouts(chip);
tpm_continue_selftest(chip);

return 0;
Expand Down

0 comments on commit 186e89c

Please sign in to comment.