aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/tpm/tpm_infineon.c
diff options
context:
space:
mode:
authorKylene Jo Hall <kjhall@us.ibm.com>2005-10-30 18:03:24 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-10-30 20:37:28 -0500
commite659a3fe2027b19ecd8abb7ad79253672763454b (patch)
treec9759f75695a19742693c9719e92253e2cd52b7e /drivers/char/tpm/tpm_infineon.c
parentb4ed3e3cbb312869929cf4528d71e52629a6cacb (diff)
[PATCH] tpm: remove pci dependency
Since the tpm does not have it's own pci id we have been consuming the lpc bus. This is not correct and causes problems to support non lpc bus chips. This patch removes the dependency on pci_dev from tpm.c The subsequent patches will stop the supported chips from registering as pci drivers. Signed-off-by: Kylene Hall <kjhall@us.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/char/tpm/tpm_infineon.c')
-rw-r--r--drivers/char/tpm/tpm_infineon.c34
1 files changed, 21 insertions, 13 deletions
diff --git a/drivers/char/tpm/tpm_infineon.c b/drivers/char/tpm/tpm_infineon.c
index 5b2ed539c26f..5c3aeaffaf88 100644
--- a/drivers/char/tpm/tpm_infineon.c
+++ b/drivers/char/tpm/tpm_infineon.c
@@ -143,10 +143,10 @@ static int wait(struct tpm_chip *chip, int wait_for_bit)
143 } 143 }
144 if (i == TPM_MAX_TRIES) { /* timeout occurs */ 144 if (i == TPM_MAX_TRIES) { /* timeout occurs */
145 if (wait_for_bit == STAT_XFE) 145 if (wait_for_bit == STAT_XFE)
146 dev_err(&chip->pci_dev->dev, 146 dev_err(chip->dev,
147 "Timeout in wait(STAT_XFE)\n"); 147 "Timeout in wait(STAT_XFE)\n");
148 if (wait_for_bit == STAT_RDA) 148 if (wait_for_bit == STAT_RDA)
149 dev_err(&chip->pci_dev->dev, 149 dev_err(chip->dev,
150 "Timeout in wait(STAT_RDA)\n"); 150 "Timeout in wait(STAT_RDA)\n");
151 return -EIO; 151 return -EIO;
152 } 152 }
@@ -170,7 +170,7 @@ static void wait_and_send(struct tpm_chip *chip, u8 sendbyte)
170static void tpm_wtx(struct tpm_chip *chip) 170static void tpm_wtx(struct tpm_chip *chip)
171{ 171{
172 number_of_wtx++; 172 number_of_wtx++;
173 dev_info(&chip->pci_dev->dev, "Granting WTX (%02d / %02d)\n", 173 dev_info(chip->dev, "Granting WTX (%02d / %02d)\n",
174 number_of_wtx, TPM_MAX_WTX_PACKAGES); 174 number_of_wtx, TPM_MAX_WTX_PACKAGES);
175 wait_and_send(chip, TPM_VL_VER); 175 wait_and_send(chip, TPM_VL_VER);
176 wait_and_send(chip, TPM_CTRL_WTX); 176 wait_and_send(chip, TPM_CTRL_WTX);
@@ -181,7 +181,7 @@ static void tpm_wtx(struct tpm_chip *chip)
181 181
182static void tpm_wtx_abort(struct tpm_chip *chip) 182static void tpm_wtx_abort(struct tpm_chip *chip)
183{ 183{
184 dev_info(&chip->pci_dev->dev, "Aborting WTX\n"); 184 dev_info(chip->dev, "Aborting WTX\n");
185 wait_and_send(chip, TPM_VL_VER); 185 wait_and_send(chip, TPM_VL_VER);
186 wait_and_send(chip, TPM_CTRL_WTX_ABORT); 186 wait_and_send(chip, TPM_CTRL_WTX_ABORT);
187 wait_and_send(chip, 0x00); 187 wait_and_send(chip, 0x00);
@@ -206,7 +206,7 @@ recv_begin:
206 } 206 }
207 207
208 if (buf[0] != TPM_VL_VER) { 208 if (buf[0] != TPM_VL_VER) {
209 dev_err(&chip->pci_dev->dev, 209 dev_err(chip->dev,
210 "Wrong transport protocol implementation!\n"); 210 "Wrong transport protocol implementation!\n");
211 return -EIO; 211 return -EIO;
212 } 212 }
@@ -221,7 +221,7 @@ recv_begin:
221 } 221 }
222 222
223 if ((size == 0x6D00) && (buf[1] == 0x80)) { 223 if ((size == 0x6D00) && (buf[1] == 0x80)) {
224 dev_err(&chip->pci_dev->dev, 224 dev_err(chip->dev,
225 "Error handling on vendor layer!\n"); 225 "Error handling on vendor layer!\n");
226 return -EIO; 226 return -EIO;
227 } 227 }
@@ -234,7 +234,7 @@ recv_begin:
234 } 234 }
235 235
236 if (buf[1] == TPM_CTRL_WTX) { 236 if (buf[1] == TPM_CTRL_WTX) {
237 dev_info(&chip->pci_dev->dev, "WTX-package received\n"); 237 dev_info(chip->dev, "WTX-package received\n");
238 if (number_of_wtx < TPM_MAX_WTX_PACKAGES) { 238 if (number_of_wtx < TPM_MAX_WTX_PACKAGES) {
239 tpm_wtx(chip); 239 tpm_wtx(chip);
240 goto recv_begin; 240 goto recv_begin;
@@ -245,14 +245,14 @@ recv_begin:
245 } 245 }
246 246
247 if (buf[1] == TPM_CTRL_WTX_ABORT_ACK) { 247 if (buf[1] == TPM_CTRL_WTX_ABORT_ACK) {
248 dev_info(&chip->pci_dev->dev, "WTX-abort acknowledged\n"); 248 dev_info(chip->dev, "WTX-abort acknowledged\n");
249 return size; 249 return size;
250 } 250 }
251 251
252 if (buf[1] == TPM_CTRL_ERROR) { 252 if (buf[1] == TPM_CTRL_ERROR) {
253 dev_err(&chip->pci_dev->dev, "ERROR-package received:\n"); 253 dev_err(chip->dev, "ERROR-package received:\n");
254 if (buf[4] == TPM_INF_NAK) 254 if (buf[4] == TPM_INF_NAK)
255 dev_err(&chip->pci_dev->dev, 255 dev_err(chip->dev,
256 "-> Negative acknowledgement" 256 "-> Negative acknowledgement"
257 " - retransmit command!\n"); 257 " - retransmit command!\n");
258 return -EIO; 258 return -EIO;
@@ -271,7 +271,7 @@ static int tpm_inf_send(struct tpm_chip *chip, u8 * buf, size_t count)
271 271
272 ret = empty_fifo(chip, 1); 272 ret = empty_fifo(chip, 1);
273 if (ret) { 273 if (ret) {
274 dev_err(&chip->pci_dev->dev, "Timeout while clearing FIFO\n"); 274 dev_err(chip->dev, "Timeout while clearing FIFO\n");
275 return -EIO; 275 return -EIO;
276 } 276 }
277 277
@@ -494,7 +494,7 @@ static int __devinit tpm_inf_probe(struct pci_dev *pci_dev,
494 vendorid[0], vendorid[1], 494 vendorid[0], vendorid[1],
495 productid[0], productid[1], chipname); 495 productid[0], productid[1], chipname);
496 496
497 rc = tpm_register_hardware(pci_dev, &tpm_inf); 497 rc = tpm_register_hardware(&pci_dev->dev, &tpm_inf);
498 if (rc < 0) 498 if (rc < 0)
499 goto error; 499 goto error;
500 return 0; 500 return 0;
@@ -509,6 +509,14 @@ error2:
509 } 509 }
510} 510}
511 511
512static __devexit void tpm_inf_remove(struct pci_dev* pci_dev)
513{
514 struct tpm_chip* chip = pci_get_drvdata(pci_dev);
515
516 if( chip )
517 tpm_remove_hardware(chip->dev);
518}
519
512static struct pci_device_id tpm_pci_tbl[] __devinitdata = { 520static struct pci_device_id tpm_pci_tbl[] __devinitdata = {
513 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_0)}, 521 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_0)},
514 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_12)}, 522 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_12)},
@@ -527,7 +535,7 @@ static struct pci_driver inf_pci_driver = {
527 .name = "tpm_inf", 535 .name = "tpm_inf",
528 .id_table = tpm_pci_tbl, 536 .id_table = tpm_pci_tbl,
529 .probe = tpm_inf_probe, 537 .probe = tpm_inf_probe,
530 .remove = __devexit_p(tpm_remove), 538 .remove = __devexit_p(tpm_inf_remove),
531 .suspend = tpm_pm_suspend, 539 .suspend = tpm_pm_suspend,
532 .resume = tpm_pm_resume, 540 .resume = tpm_pm_resume,
533}; 541};