aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorChristophe Ricard <christophe.ricard@gmail.com>2016-03-31 16:56:58 -0400
committerJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>2016-06-25 10:26:35 -0400
commit56671c893e0e3ee237bc8e229923a9e6555c2fc9 (patch)
tree4691182cc215bbeec44b98e51641627149e9c373 /drivers
parent6e599f6f261fe61582e6bedcc0aff924ac5da614 (diff)
tpm: drop 'locality' from struct tpm_vendor_specific
Dropped the field 'locality' from struct tpm_vendor_specific migrated it to the private structures of st33zp24, tpm_i2c_infineon and tpm_tis. Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com> Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/tpm/st33zp24/st33zp24.c12
-rw-r--r--drivers/char/tpm/st33zp24/st33zp24.h1
-rw-r--r--drivers/char/tpm/tpm.h1
-rw-r--r--drivers/char/tpm/tpm_i2c_infineon.c25
-rw-r--r--drivers/char/tpm/tpm_tis.c71
5 files changed, 55 insertions, 55 deletions
diff --git a/drivers/char/tpm/st33zp24/st33zp24.c b/drivers/char/tpm/st33zp24/st33zp24.c
index d2e01754e1db..3802c5887090 100644
--- a/drivers/char/tpm/st33zp24/st33zp24.c
+++ b/drivers/char/tpm/st33zp24/st33zp24.c
@@ -136,7 +136,7 @@ static int check_locality(struct tpm_chip *chip)
136 if (status && (data & 136 if (status && (data &
137 (TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID)) == 137 (TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID)) ==
138 (TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID)) 138 (TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID))
139 return chip->vendor.locality; 139 return tpm_dev->locality;
140 140
141 return -EACCES; 141 return -EACCES;
142} /* check_locality() */ 142} /* check_locality() */
@@ -153,11 +153,11 @@ static int request_locality(struct tpm_chip *chip)
153 struct st33zp24_dev *tpm_dev; 153 struct st33zp24_dev *tpm_dev;
154 u8 data; 154 u8 data;
155 155
156 if (check_locality(chip) == chip->vendor.locality)
157 return chip->vendor.locality;
158
159 tpm_dev = (struct st33zp24_dev *)TPM_VPRIV(chip); 156 tpm_dev = (struct st33zp24_dev *)TPM_VPRIV(chip);
160 157
158 if (check_locality(chip) == tpm_dev->locality)
159 return tpm_dev->locality;
160
161 data = TPM_ACCESS_REQUEST_USE; 161 data = TPM_ACCESS_REQUEST_USE;
162 ret = tpm_dev->ops->send(tpm_dev->phy_id, TPM_ACCESS, &data, 1); 162 ret = tpm_dev->ops->send(tpm_dev->phy_id, TPM_ACCESS, &data, 1);
163 if (ret < 0) 163 if (ret < 0)
@@ -168,7 +168,7 @@ static int request_locality(struct tpm_chip *chip)
168 /* Request locality is usually effective after the request */ 168 /* Request locality is usually effective after the request */
169 do { 169 do {
170 if (check_locality(chip) >= 0) 170 if (check_locality(chip) >= 0)
171 return chip->vendor.locality; 171 return tpm_dev->locality;
172 msleep(TPM_TIMEOUT); 172 msleep(TPM_TIMEOUT);
173 } while (time_before(jiffies, stop)); 173 } while (time_before(jiffies, stop));
174 174
@@ -566,7 +566,7 @@ int st33zp24_probe(void *phy_id, const struct st33zp24_phy_ops *ops,
566 chip->vendor.timeout_c = msecs_to_jiffies(TIS_SHORT_TIMEOUT); 566 chip->vendor.timeout_c = msecs_to_jiffies(TIS_SHORT_TIMEOUT);
567 chip->vendor.timeout_d = msecs_to_jiffies(TIS_SHORT_TIMEOUT); 567 chip->vendor.timeout_d = msecs_to_jiffies(TIS_SHORT_TIMEOUT);
568 568
569 chip->vendor.locality = LOCALITY0; 569 tpm_dev->locality = LOCALITY0;
570 570
571 if (irq) { 571 if (irq) {
572 /* INTERRUPT Setup */ 572 /* INTERRUPT Setup */
diff --git a/drivers/char/tpm/st33zp24/st33zp24.h b/drivers/char/tpm/st33zp24/st33zp24.h
index 9b5cdc71b6a7..6f4a4198af6a 100644
--- a/drivers/char/tpm/st33zp24/st33zp24.h
+++ b/drivers/char/tpm/st33zp24/st33zp24.h
@@ -25,6 +25,7 @@ struct st33zp24_dev {
25 struct tpm_chip *chip; 25 struct tpm_chip *chip;
26 void *phy_id; 26 void *phy_id;
27 const struct st33zp24_phy_ops *ops; 27 const struct st33zp24_phy_ops *ops;
28 int locality;
28 int irq; 29 int irq;
29 u32 intrs; 30 u32 intrs;
30 int io_lpcpd; 31 int io_lpcpd;
diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
index 62e711bdc953..68a40c6405cf 100644
--- a/drivers/char/tpm/tpm.h
+++ b/drivers/char/tpm/tpm.h
@@ -131,7 +131,6 @@ enum tpm2_startup_types {
131struct tpm_chip; 131struct tpm_chip;
132 132
133struct tpm_vendor_specific { 133struct tpm_vendor_specific {
134 int locality;
135 unsigned long timeout_a, timeout_b, timeout_c, timeout_d; /* jiffies */ 134 unsigned long timeout_a, timeout_b, timeout_c, timeout_d; /* jiffies */
136 bool timeout_adjusted; 135 bool timeout_adjusted;
137 unsigned long duration[3]; /* jiffies */ 136 unsigned long duration[3]; /* jiffies */
diff --git a/drivers/char/tpm/tpm_i2c_infineon.c b/drivers/char/tpm/tpm_i2c_infineon.c
index 093daf955690..831894660d6a 100644
--- a/drivers/char/tpm/tpm_i2c_infineon.c
+++ b/drivers/char/tpm/tpm_i2c_infineon.c
@@ -66,6 +66,7 @@ enum i2c_chip_type {
66/* Structure to store I2C TPM specific stuff */ 66/* Structure to store I2C TPM specific stuff */
67struct tpm_inf_dev { 67struct tpm_inf_dev {
68 struct i2c_client *client; 68 struct i2c_client *client;
69 int locality;
69 u8 buf[TPM_BUFSIZE + sizeof(u8)]; /* max. buffer size + addr */ 70 u8 buf[TPM_BUFSIZE + sizeof(u8)]; /* max. buffer size + addr */
70 struct tpm_chip *chip; 71 struct tpm_chip *chip;
71 enum i2c_chip_type chip_type; 72 enum i2c_chip_type chip_type;
@@ -288,7 +289,7 @@ static int check_locality(struct tpm_chip *chip, int loc)
288 289
289 if ((buf & (TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID)) == 290 if ((buf & (TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID)) ==
290 (TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID)) { 291 (TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID)) {
291 chip->vendor.locality = loc; 292 tpm_dev.locality = loc;
292 return loc; 293 return loc;
293 } 294 }
294 295
@@ -337,7 +338,7 @@ static u8 tpm_tis_i2c_status(struct tpm_chip *chip)
337 u8 i = 0; 338 u8 i = 0;
338 339
339 do { 340 do {
340 if (iic_tpm_read(TPM_STS(chip->vendor.locality), &buf, 1) < 0) 341 if (iic_tpm_read(TPM_STS(tpm_dev.locality), &buf, 1) < 0)
341 return 0; 342 return 0;
342 343
343 i++; 344 i++;
@@ -351,7 +352,7 @@ static void tpm_tis_i2c_ready(struct tpm_chip *chip)
351{ 352{
352 /* this causes the current command to be aborted */ 353 /* this causes the current command to be aborted */
353 u8 buf = TPM_STS_COMMAND_READY; 354 u8 buf = TPM_STS_COMMAND_READY;
354 iic_tpm_write_long(TPM_STS(chip->vendor.locality), &buf, 1); 355 iic_tpm_write_long(TPM_STS(tpm_dev.locality), &buf, 1);
355} 356}
356 357
357static ssize_t get_burstcount(struct tpm_chip *chip) 358static ssize_t get_burstcount(struct tpm_chip *chip)
@@ -365,7 +366,7 @@ static ssize_t get_burstcount(struct tpm_chip *chip)
365 stop = jiffies + chip->vendor.timeout_d; 366 stop = jiffies + chip->vendor.timeout_d;
366 do { 367 do {
367 /* Note: STS is little endian */ 368 /* Note: STS is little endian */
368 if (iic_tpm_read(TPM_STS(chip->vendor.locality)+1, buf, 3) < 0) 369 if (iic_tpm_read(TPM_STS(tpm_dev.locality)+1, buf, 3) < 0)
369 burstcnt = 0; 370 burstcnt = 0;
370 else 371 else
371 burstcnt = (buf[2] << 16) + (buf[1] << 8) + buf[0]; 372 burstcnt = (buf[2] << 16) + (buf[1] << 8) + buf[0];
@@ -419,7 +420,7 @@ static int recv_data(struct tpm_chip *chip, u8 *buf, size_t count)
419 if (burstcnt > (count - size)) 420 if (burstcnt > (count - size))
420 burstcnt = count - size; 421 burstcnt = count - size;
421 422
422 rc = iic_tpm_read(TPM_DATA_FIFO(chip->vendor.locality), 423 rc = iic_tpm_read(TPM_DATA_FIFO(tpm_dev.locality),
423 &(buf[size]), burstcnt); 424 &(buf[size]), burstcnt);
424 if (rc == 0) 425 if (rc == 0)
425 size += burstcnt; 426 size += burstcnt;
@@ -477,7 +478,7 @@ out:
477 * so we sleep rather than keeping the bus busy 478 * so we sleep rather than keeping the bus busy
478 */ 479 */
479 usleep_range(SLEEP_DURATION_RESET_LOW, SLEEP_DURATION_RESET_HI); 480 usleep_range(SLEEP_DURATION_RESET_LOW, SLEEP_DURATION_RESET_HI);
480 release_locality(chip, chip->vendor.locality, 0); 481 release_locality(chip, tpm_dev.locality, 0);
481 return size; 482 return size;
482} 483}
483 484
@@ -516,7 +517,7 @@ static int tpm_tis_i2c_send(struct tpm_chip *chip, u8 *buf, size_t len)
516 if (burstcnt > (len - 1 - count)) 517 if (burstcnt > (len - 1 - count))
517 burstcnt = len - 1 - count; 518 burstcnt = len - 1 - count;
518 519
519 rc = iic_tpm_write(TPM_DATA_FIFO(chip->vendor.locality), 520 rc = iic_tpm_write(TPM_DATA_FIFO(tpm_dev.locality),
520 &(buf[count]), burstcnt); 521 &(buf[count]), burstcnt);
521 if (rc == 0) 522 if (rc == 0)
522 count += burstcnt; 523 count += burstcnt;
@@ -539,7 +540,7 @@ static int tpm_tis_i2c_send(struct tpm_chip *chip, u8 *buf, size_t len)
539 } 540 }
540 541
541 /* write last byte */ 542 /* write last byte */
542 iic_tpm_write(TPM_DATA_FIFO(chip->vendor.locality), &(buf[count]), 1); 543 iic_tpm_write(TPM_DATA_FIFO(tpm_dev.locality), &(buf[count]), 1);
543 wait_for_stat(chip, TPM_STS_VALID, chip->vendor.timeout_c, &status); 544 wait_for_stat(chip, TPM_STS_VALID, chip->vendor.timeout_c, &status);
544 if ((status & TPM_STS_DATA_EXPECT) != 0) { 545 if ((status & TPM_STS_DATA_EXPECT) != 0) {
545 rc = -EIO; 546 rc = -EIO;
@@ -547,7 +548,7 @@ static int tpm_tis_i2c_send(struct tpm_chip *chip, u8 *buf, size_t len)
547 } 548 }
548 549
549 /* go and do it */ 550 /* go and do it */
550 iic_tpm_write(TPM_STS(chip->vendor.locality), &sts, 1); 551 iic_tpm_write(TPM_STS(tpm_dev.locality), &sts, 1);
551 552
552 return len; 553 return len;
553out_err: 554out_err:
@@ -556,7 +557,7 @@ out_err:
556 * so we sleep rather than keeping the bus busy 557 * so we sleep rather than keeping the bus busy
557 */ 558 */
558 usleep_range(SLEEP_DURATION_RESET_LOW, SLEEP_DURATION_RESET_HI); 559 usleep_range(SLEEP_DURATION_RESET_LOW, SLEEP_DURATION_RESET_HI);
559 release_locality(chip, chip->vendor.locality, 0); 560 release_locality(chip, tpm_dev.locality, 0);
560 return rc; 561 return rc;
561} 562}
562 563
@@ -623,7 +624,7 @@ static int tpm_tis_i2c_init(struct device *dev)
623 624
624 return tpm_chip_register(chip); 625 return tpm_chip_register(chip);
625out_release: 626out_release:
626 release_locality(chip, chip->vendor.locality, 1); 627 release_locality(chip, tpm_dev.locality, 1);
627 tpm_dev.client = NULL; 628 tpm_dev.client = NULL;
628out_err: 629out_err:
629 return rc; 630 return rc;
@@ -695,7 +696,7 @@ static int tpm_tis_i2c_remove(struct i2c_client *client)
695 struct tpm_chip *chip = tpm_dev.chip; 696 struct tpm_chip *chip = tpm_dev.chip;
696 697
697 tpm_chip_unregister(chip); 698 tpm_chip_unregister(chip);
698 release_locality(chip, chip->vendor.locality, 1); 699 release_locality(chip, tpm_dev.locality, 1);
699 tpm_dev.client = NULL; 700 tpm_dev.client = NULL;
700 701
701 return 0; 702 return 0;
diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
index 38240acbfee6..9e2ba1d31469 100644
--- a/drivers/char/tpm/tpm_tis.c
+++ b/drivers/char/tpm/tpm_tis.c
@@ -96,6 +96,7 @@ struct tpm_info {
96struct priv_data { 96struct priv_data {
97 void __iomem *iobase; 97 void __iomem *iobase;
98 u16 manufacturer_id; 98 u16 manufacturer_id;
99 int locality;
99 int irq; 100 int irq;
100 bool irq_tested; 101 bool irq_tested;
101 wait_queue_head_t int_queue; 102 wait_queue_head_t int_queue;
@@ -149,7 +150,7 @@ static int check_locality(struct tpm_chip *chip, int l)
149 if ((ioread8(priv->iobase + TPM_ACCESS(l)) & 150 if ((ioread8(priv->iobase + TPM_ACCESS(l)) &
150 (TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID)) == 151 (TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID)) ==
151 (TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID)) 152 (TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID))
152 return chip->vendor.locality = l; 153 return priv->locality = l;
153 154
154 return -1; 155 return -1;
155} 156}
@@ -211,7 +212,7 @@ static u8 tpm_tis_status(struct tpm_chip *chip)
211 struct priv_data *priv = chip->vendor.priv; 212 struct priv_data *priv = chip->vendor.priv;
212 213
213 return ioread8(priv->iobase + 214 return ioread8(priv->iobase +
214 TPM_STS(chip->vendor.locality)); 215 TPM_STS(priv->locality));
215} 216}
216 217
217static void tpm_tis_ready(struct tpm_chip *chip) 218static void tpm_tis_ready(struct tpm_chip *chip)
@@ -220,7 +221,7 @@ static void tpm_tis_ready(struct tpm_chip *chip)
220 221
221 /* this causes the current command to be aborted */ 222 /* this causes the current command to be aborted */
222 iowrite8(TPM_STS_COMMAND_READY, 223 iowrite8(TPM_STS_COMMAND_READY,
223 priv->iobase + TPM_STS(chip->vendor.locality)); 224 priv->iobase + TPM_STS(priv->locality));
224} 225}
225 226
226static int get_burstcount(struct tpm_chip *chip) 227static int get_burstcount(struct tpm_chip *chip)
@@ -234,9 +235,9 @@ static int get_burstcount(struct tpm_chip *chip)
234 stop = jiffies + chip->vendor.timeout_d; 235 stop = jiffies + chip->vendor.timeout_d;
235 do { 236 do {
236 burstcnt = ioread8(priv->iobase + 237 burstcnt = ioread8(priv->iobase +
237 TPM_STS(chip->vendor.locality) + 1); 238 TPM_STS(priv->locality) + 1);
238 burstcnt += ioread8(priv->iobase + 239 burstcnt += ioread8(priv->iobase +
239 TPM_STS(chip->vendor.locality) + 240 TPM_STS(priv->locality) +
240 2) << 8; 241 2) << 8;
241 if (burstcnt) 242 if (burstcnt)
242 return burstcnt; 243 return burstcnt;
@@ -258,8 +259,7 @@ static int recv_data(struct tpm_chip *chip, u8 *buf, size_t count)
258 burstcnt = get_burstcount(chip); 259 burstcnt = get_burstcount(chip);
259 for (; burstcnt > 0 && size < count; burstcnt--) 260 for (; burstcnt > 0 && size < count; burstcnt--)
260 buf[size++] = ioread8(priv->iobase + 261 buf[size++] = ioread8(priv->iobase +
261 TPM_DATA_FIFO(chip->vendor. 262 TPM_DATA_FIFO(priv->locality));
262 locality));
263 } 263 }
264 return size; 264 return size;
265} 265}
@@ -307,7 +307,7 @@ static int tpm_tis_recv(struct tpm_chip *chip, u8 *buf, size_t count)
307 307
308out: 308out:
309 tpm_tis_ready(chip); 309 tpm_tis_ready(chip);
310 release_locality(chip, chip->vendor.locality, 0); 310 release_locality(chip, priv->locality, 0);
311 return size; 311 return size;
312} 312}
313 313
@@ -344,7 +344,7 @@ static int tpm_tis_send_data(struct tpm_chip *chip, u8 *buf, size_t len)
344 burstcnt = get_burstcount(chip); 344 burstcnt = get_burstcount(chip);
345 for (; burstcnt > 0 && count < len - 1; burstcnt--) { 345 for (; burstcnt > 0 && count < len - 1; burstcnt--) {
346 iowrite8(buf[count], priv->iobase + 346 iowrite8(buf[count], priv->iobase +
347 TPM_DATA_FIFO(chip->vendor.locality)); 347 TPM_DATA_FIFO(priv->locality));
348 count++; 348 count++;
349 } 349 }
350 350
@@ -359,7 +359,7 @@ static int tpm_tis_send_data(struct tpm_chip *chip, u8 *buf, size_t len)
359 359
360 /* write last byte */ 360 /* write last byte */
361 iowrite8(buf[count], 361 iowrite8(buf[count],
362 priv->iobase + TPM_DATA_FIFO(chip->vendor.locality)); 362 priv->iobase + TPM_DATA_FIFO(priv->locality));
363 wait_for_tpm_stat(chip, TPM_STS_VALID, chip->vendor.timeout_c, 363 wait_for_tpm_stat(chip, TPM_STS_VALID, chip->vendor.timeout_c,
364 &priv->int_queue, false); 364 &priv->int_queue, false);
365 status = tpm_tis_status(chip); 365 status = tpm_tis_status(chip);
@@ -372,7 +372,7 @@ static int tpm_tis_send_data(struct tpm_chip *chip, u8 *buf, size_t len)
372 372
373out_err: 373out_err:
374 tpm_tis_ready(chip); 374 tpm_tis_ready(chip);
375 release_locality(chip, chip->vendor.locality, 0); 375 release_locality(chip, priv->locality, 0);
376 return rc; 376 return rc;
377} 377}
378 378
@@ -383,10 +383,10 @@ static void disable_interrupts(struct tpm_chip *chip)
383 383
384 intmask = 384 intmask =
385 ioread32(priv->iobase + 385 ioread32(priv->iobase +
386 TPM_INT_ENABLE(chip->vendor.locality)); 386 TPM_INT_ENABLE(priv->locality));
387 intmask &= ~TPM_GLOBAL_INT_ENABLE; 387 intmask &= ~TPM_GLOBAL_INT_ENABLE;
388 iowrite32(intmask, 388 iowrite32(intmask,
389 priv->iobase + TPM_INT_ENABLE(chip->vendor.locality)); 389 priv->iobase + TPM_INT_ENABLE(priv->locality));
390 devm_free_irq(&chip->dev, priv->irq, chip); 390 devm_free_irq(&chip->dev, priv->irq, chip);
391 priv->irq = 0; 391 priv->irq = 0;
392 chip->flags &= ~TPM_CHIP_FLAG_IRQ; 392 chip->flags &= ~TPM_CHIP_FLAG_IRQ;
@@ -410,7 +410,7 @@ static int tpm_tis_send_main(struct tpm_chip *chip, u8 *buf, size_t len)
410 410
411 /* go and do it */ 411 /* go and do it */
412 iowrite8(TPM_STS_GO, 412 iowrite8(TPM_STS_GO,
413 priv->iobase + TPM_STS(chip->vendor.locality)); 413 priv->iobase + TPM_STS(priv->locality));
414 414
415 if (chip->flags & TPM_CHIP_FLAG_IRQ) { 415 if (chip->flags & TPM_CHIP_FLAG_IRQ) {
416 ordinal = be32_to_cpu(*((__be32 *) (buf + 6))); 416 ordinal = be32_to_cpu(*((__be32 *) (buf + 6)));
@@ -430,7 +430,7 @@ static int tpm_tis_send_main(struct tpm_chip *chip, u8 *buf, size_t len)
430 return len; 430 return len;
431out_err: 431out_err:
432 tpm_tis_ready(chip); 432 tpm_tis_ready(chip);
433 release_locality(chip, chip->vendor.locality, 0); 433 release_locality(chip, priv->locality, 0);
434 return rc; 434 return rc;
435} 435}
436 436
@@ -516,7 +516,7 @@ static int probe_itpm(struct tpm_chip *chip)
516 goto out; 516 goto out;
517 517
518 tpm_tis_ready(chip); 518 tpm_tis_ready(chip);
519 release_locality(chip, chip->vendor.locality, 0); 519 release_locality(chip, priv->locality, 0);
520 520
521 itpm = true; 521 itpm = true;
522 522
@@ -530,7 +530,7 @@ static int probe_itpm(struct tpm_chip *chip)
530out: 530out:
531 itpm = rem_itpm; 531 itpm = rem_itpm;
532 tpm_tis_ready(chip); 532 tpm_tis_ready(chip);
533 release_locality(chip, chip->vendor.locality, 0); 533 release_locality(chip, priv->locality, 0);
534 534
535 return rc; 535 return rc;
536} 536}
@@ -569,7 +569,7 @@ static irqreturn_t tis_int_handler(int dummy, void *dev_id)
569 int i; 569 int i;
570 570
571 interrupt = ioread32(priv->iobase + 571 interrupt = ioread32(priv->iobase +
572 TPM_INT_STATUS(chip->vendor.locality)); 572 TPM_INT_STATUS(priv->locality));
573 573
574 if (interrupt == 0) 574 if (interrupt == 0)
575 return IRQ_NONE; 575 return IRQ_NONE;
@@ -589,8 +589,8 @@ static irqreturn_t tis_int_handler(int dummy, void *dev_id)
589 /* Clear interrupts handled with TPM_EOI */ 589 /* Clear interrupts handled with TPM_EOI */
590 iowrite32(interrupt, 590 iowrite32(interrupt,
591 priv->iobase + 591 priv->iobase +
592 TPM_INT_STATUS(chip->vendor.locality)); 592 TPM_INT_STATUS(priv->locality));
593 ioread32(priv->iobase + TPM_INT_STATUS(chip->vendor.locality)); 593 ioread32(priv->iobase + TPM_INT_STATUS(priv->locality));
594 return IRQ_HANDLED; 594 return IRQ_HANDLED;
595} 595}
596 596
@@ -613,18 +613,18 @@ static int tpm_tis_probe_irq_single(struct tpm_chip *chip, u32 intmask,
613 priv->irq = irq; 613 priv->irq = irq;
614 614
615 original_int_vec = ioread8(priv->iobase + 615 original_int_vec = ioread8(priv->iobase +
616 TPM_INT_VECTOR(chip->vendor.locality)); 616 TPM_INT_VECTOR(priv->locality));
617 iowrite8(irq, 617 iowrite8(irq,
618 priv->iobase + TPM_INT_VECTOR(chip->vendor.locality)); 618 priv->iobase + TPM_INT_VECTOR(priv->locality));
619 619
620 /* Clear all existing */ 620 /* Clear all existing */
621 iowrite32(ioread32(priv->iobase + 621 iowrite32(ioread32(priv->iobase +
622 TPM_INT_STATUS(chip->vendor.locality)), 622 TPM_INT_STATUS(priv->locality)),
623 priv->iobase + TPM_INT_STATUS(chip->vendor.locality)); 623 priv->iobase + TPM_INT_STATUS(priv->locality));
624 624
625 /* Turn on */ 625 /* Turn on */
626 iowrite32(intmask | TPM_GLOBAL_INT_ENABLE, 626 iowrite32(intmask | TPM_GLOBAL_INT_ENABLE,
627 priv->iobase + TPM_INT_ENABLE(chip->vendor.locality)); 627 priv->iobase + TPM_INT_ENABLE(priv->locality));
628 628
629 priv->irq_tested = false; 629 priv->irq_tested = false;
630 630
@@ -641,7 +641,7 @@ static int tpm_tis_probe_irq_single(struct tpm_chip *chip, u32 intmask,
641 */ 641 */
642 if (!(chip->flags & TPM_CHIP_FLAG_IRQ)) { 642 if (!(chip->flags & TPM_CHIP_FLAG_IRQ)) {
643 iowrite8(original_int_vec, 643 iowrite8(original_int_vec,
644 priv->iobase + TPM_INT_VECTOR(chip->vendor.locality)); 644 priv->iobase + TPM_INT_VECTOR(priv->locality));
645 return 1; 645 return 1;
646 } 646 }
647 647
@@ -659,7 +659,7 @@ static void tpm_tis_probe_irq(struct tpm_chip *chip, u32 intmask)
659 int i; 659 int i;
660 660
661 original_int_vec = ioread8(priv->iobase + 661 original_int_vec = ioread8(priv->iobase +
662 TPM_INT_VECTOR(chip->vendor.locality)); 662 TPM_INT_VECTOR(priv->locality));
663 663
664 if (!original_int_vec) { 664 if (!original_int_vec) {
665 if (IS_ENABLED(CONFIG_X86)) 665 if (IS_ENABLED(CONFIG_X86))
@@ -679,11 +679,10 @@ MODULE_PARM_DESC(interrupts, "Enable interrupts");
679static void tpm_tis_remove(struct tpm_chip *chip) 679static void tpm_tis_remove(struct tpm_chip *chip)
680{ 680{
681 struct priv_data *priv = chip->vendor.priv; 681 struct priv_data *priv = chip->vendor.priv;
682 void __iomem *reg = priv->iobase + 682 void __iomem *reg = priv->iobase + TPM_INT_ENABLE(priv->locality);
683 TPM_INT_ENABLE(chip->vendor.locality);
684 683
685 iowrite32(~TPM_GLOBAL_INT_ENABLE & ioread32(reg), reg); 684 iowrite32(~TPM_GLOBAL_INT_ENABLE & ioread32(reg), reg);
686 release_locality(chip, chip->vendor.locality, 1); 685 release_locality(chip, priv->locality, 1);
687} 686}
688 687
689static int tpm_tis_init(struct device *dev, struct tpm_info *tpm_info, 688static int tpm_tis_init(struct device *dev, struct tpm_info *tpm_info,
@@ -724,12 +723,12 @@ static int tpm_tis_init(struct device *dev, struct tpm_info *tpm_info,
724 723
725 /* Take control of the TPM's interrupt hardware and shut it off */ 724 /* Take control of the TPM's interrupt hardware and shut it off */
726 intmask = ioread32(priv->iobase + 725 intmask = ioread32(priv->iobase +
727 TPM_INT_ENABLE(chip->vendor.locality)); 726 TPM_INT_ENABLE(priv->locality));
728 intmask |= TPM_INTF_CMD_READY_INT | TPM_INTF_LOCALITY_CHANGE_INT | 727 intmask |= TPM_INTF_CMD_READY_INT | TPM_INTF_LOCALITY_CHANGE_INT |
729 TPM_INTF_DATA_AVAIL_INT | TPM_INTF_STS_VALID_INT; 728 TPM_INTF_DATA_AVAIL_INT | TPM_INTF_STS_VALID_INT;
730 intmask &= ~TPM_GLOBAL_INT_ENABLE; 729 intmask &= ~TPM_GLOBAL_INT_ENABLE;
731 iowrite32(intmask, 730 iowrite32(intmask,
732 priv->iobase + TPM_INT_ENABLE(chip->vendor.locality)); 731 priv->iobase + TPM_INT_ENABLE(priv->locality));
733 732
734 if (request_locality(chip, 0) != 0) { 733 if (request_locality(chip, 0) != 0) {
735 rc = -ENODEV; 734 rc = -ENODEV;
@@ -763,7 +762,7 @@ static int tpm_tis_init(struct device *dev, struct tpm_info *tpm_info,
763 /* Figure out the capabilities */ 762 /* Figure out the capabilities */
764 intfcaps = 763 intfcaps =
765 ioread32(priv->iobase + 764 ioread32(priv->iobase +
766 TPM_INTF_CAPS(chip->vendor.locality)); 765 TPM_INTF_CAPS(priv->locality));
767 dev_dbg(dev, "TPM interface capabilities (0x%x):\n", 766 dev_dbg(dev, "TPM interface capabilities (0x%x):\n",
768 intfcaps); 767 intfcaps);
769 if (intfcaps & TPM_INTF_BURST_COUNT_STATIC) 768 if (intfcaps & TPM_INTF_BURST_COUNT_STATIC)
@@ -847,17 +846,17 @@ static void tpm_tis_reenable_interrupts(struct tpm_chip *chip)
847 /* reenable interrupts that device may have lost or 846 /* reenable interrupts that device may have lost or
848 BIOS/firmware may have disabled */ 847 BIOS/firmware may have disabled */
849 iowrite8(priv->irq, priv->iobase + 848 iowrite8(priv->irq, priv->iobase +
850 TPM_INT_VECTOR(chip->vendor.locality)); 849 TPM_INT_VECTOR(priv->locality));
851 850
852 intmask = 851 intmask =
853 ioread32(priv->iobase + TPM_INT_ENABLE(chip->vendor.locality)); 852 ioread32(priv->iobase + TPM_INT_ENABLE(priv->locality));
854 853
855 intmask |= TPM_INTF_CMD_READY_INT 854 intmask |= TPM_INTF_CMD_READY_INT
856 | TPM_INTF_LOCALITY_CHANGE_INT | TPM_INTF_DATA_AVAIL_INT 855 | TPM_INTF_LOCALITY_CHANGE_INT | TPM_INTF_DATA_AVAIL_INT
857 | TPM_INTF_STS_VALID_INT | TPM_GLOBAL_INT_ENABLE; 856 | TPM_INTF_STS_VALID_INT | TPM_GLOBAL_INT_ENABLE;
858 857
859 iowrite32(intmask, 858 iowrite32(intmask,
860 priv->iobase + TPM_INT_ENABLE(chip->vendor.locality)); 859 priv->iobase + TPM_INT_ENABLE(priv->locality));
861} 860}
862 861
863static int tpm_tis_resume(struct device *dev) 862static int tpm_tis_resume(struct device *dev)