aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/tpm/tpm_nsc.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_nsc.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_nsc.c')
-rw-r--r--drivers/char/tpm/tpm_nsc.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/drivers/char/tpm/tpm_nsc.c b/drivers/char/tpm/tpm_nsc.c
index bf3e774c4dce..10202d0bc1c7 100644
--- a/drivers/char/tpm/tpm_nsc.c
+++ b/drivers/char/tpm/tpm_nsc.c
@@ -111,7 +111,7 @@ static int nsc_wait_for_ready(struct tpm_chip *chip)
111 } 111 }
112 while (time_before(jiffies, stop)); 112 while (time_before(jiffies, stop));
113 113
114 dev_info(&chip->pci_dev->dev, "wait for ready failed\n"); 114 dev_info(chip->dev, "wait for ready failed\n");
115 return -EBUSY; 115 return -EBUSY;
116} 116}
117 117
@@ -127,12 +127,12 @@ static int tpm_nsc_recv(struct tpm_chip *chip, u8 * buf, size_t count)
127 return -EIO; 127 return -EIO;
128 128
129 if (wait_for_stat(chip, NSC_STATUS_F0, NSC_STATUS_F0, &data) < 0) { 129 if (wait_for_stat(chip, NSC_STATUS_F0, NSC_STATUS_F0, &data) < 0) {
130 dev_err(&chip->pci_dev->dev, "F0 timeout\n"); 130 dev_err(chip->dev, "F0 timeout\n");
131 return -EIO; 131 return -EIO;
132 } 132 }
133 if ((data = 133 if ((data =
134 inb(chip->vendor->base + NSC_DATA)) != NSC_COMMAND_NORMAL) { 134 inb(chip->vendor->base + NSC_DATA)) != NSC_COMMAND_NORMAL) {
135 dev_err(&chip->pci_dev->dev, "not in normal mode (0x%x)\n", 135 dev_err(chip->dev, "not in normal mode (0x%x)\n",
136 data); 136 data);
137 return -EIO; 137 return -EIO;
138 } 138 }
@@ -141,7 +141,7 @@ static int tpm_nsc_recv(struct tpm_chip *chip, u8 * buf, size_t count)
141 for (p = buffer; p < &buffer[count]; p++) { 141 for (p = buffer; p < &buffer[count]; p++) {
142 if (wait_for_stat 142 if (wait_for_stat
143 (chip, NSC_STATUS_OBF, NSC_STATUS_OBF, &data) < 0) { 143 (chip, NSC_STATUS_OBF, NSC_STATUS_OBF, &data) < 0) {
144 dev_err(&chip->pci_dev->dev, 144 dev_err(chip->dev,
145 "OBF timeout (while reading data)\n"); 145 "OBF timeout (while reading data)\n");
146 return -EIO; 146 return -EIO;
147 } 147 }
@@ -152,11 +152,11 @@ static int tpm_nsc_recv(struct tpm_chip *chip, u8 * buf, size_t count)
152 152
153 if ((data & NSC_STATUS_F0) == 0 && 153 if ((data & NSC_STATUS_F0) == 0 &&
154 (wait_for_stat(chip, NSC_STATUS_F0, NSC_STATUS_F0, &data) < 0)) { 154 (wait_for_stat(chip, NSC_STATUS_F0, NSC_STATUS_F0, &data) < 0)) {
155 dev_err(&chip->pci_dev->dev, "F0 not set\n"); 155 dev_err(chip->dev, "F0 not set\n");
156 return -EIO; 156 return -EIO;
157 } 157 }
158 if ((data = inb(chip->vendor->base + NSC_DATA)) != NSC_COMMAND_EOC) { 158 if ((data = inb(chip->vendor->base + NSC_DATA)) != NSC_COMMAND_EOC) {
159 dev_err(&chip->pci_dev->dev, 159 dev_err(chip->dev,
160 "expected end of command(0x%x)\n", data); 160 "expected end of command(0x%x)\n", data);
161 return -EIO; 161 return -EIO;
162 } 162 }
@@ -187,19 +187,19 @@ static int tpm_nsc_send(struct tpm_chip *chip, u8 * buf, size_t count)
187 return -EIO; 187 return -EIO;
188 188
189 if (wait_for_stat(chip, NSC_STATUS_IBF, 0, &data) < 0) { 189 if (wait_for_stat(chip, NSC_STATUS_IBF, 0, &data) < 0) {
190 dev_err(&chip->pci_dev->dev, "IBF timeout\n"); 190 dev_err(chip->dev, "IBF timeout\n");
191 return -EIO; 191 return -EIO;
192 } 192 }
193 193
194 outb(NSC_COMMAND_NORMAL, chip->vendor->base + NSC_COMMAND); 194 outb(NSC_COMMAND_NORMAL, chip->vendor->base + NSC_COMMAND);
195 if (wait_for_stat(chip, NSC_STATUS_IBR, NSC_STATUS_IBR, &data) < 0) { 195 if (wait_for_stat(chip, NSC_STATUS_IBR, NSC_STATUS_IBR, &data) < 0) {
196 dev_err(&chip->pci_dev->dev, "IBR timeout\n"); 196 dev_err(chip->dev, "IBR timeout\n");
197 return -EIO; 197 return -EIO;
198 } 198 }
199 199
200 for (i = 0; i < count; i++) { 200 for (i = 0; i < count; i++) {
201 if (wait_for_stat(chip, NSC_STATUS_IBF, 0, &data) < 0) { 201 if (wait_for_stat(chip, NSC_STATUS_IBF, 0, &data) < 0) {
202 dev_err(&chip->pci_dev->dev, 202 dev_err(chip->dev,
203 "IBF timeout (while writing data)\n"); 203 "IBF timeout (while writing data)\n");
204 return -EIO; 204 return -EIO;
205 } 205 }
@@ -207,7 +207,7 @@ static int tpm_nsc_send(struct tpm_chip *chip, u8 * buf, size_t count)
207 } 207 }
208 208
209 if (wait_for_stat(chip, NSC_STATUS_IBF, 0, &data) < 0) { 209 if (wait_for_stat(chip, NSC_STATUS_IBF, 0, &data) < 0) {
210 dev_err(&chip->pci_dev->dev, "IBF timeout\n"); 210 dev_err(chip->dev, "IBF timeout\n");
211 return -EIO; 211 return -EIO;
212 } 212 }
213 outb(NSC_COMMAND_EOC, chip->vendor->base + NSC_COMMAND); 213 outb(NSC_COMMAND_EOC, chip->vendor->base + NSC_COMMAND);
@@ -325,7 +325,7 @@ static int __devinit tpm_nsc_init(struct pci_dev *pci_dev,
325 /* enable the DPM module */ 325 /* enable the DPM module */
326 tpm_write_index(nscAddrBase, NSC_LDC_INDEX, 0x01); 326 tpm_write_index(nscAddrBase, NSC_LDC_INDEX, 0x01);
327 327
328 if ((rc = tpm_register_hardware(pci_dev, &tpm_nsc)) < 0) 328 if ((rc = tpm_register_hardware(&pci_dev->dev, &tpm_nsc)) < 0)
329 goto out_err; 329 goto out_err;
330 330
331 return 0; 331 return 0;
@@ -335,6 +335,14 @@ out_err:
335 return rc; 335 return rc;
336} 336}
337 337
338static void __devexit tpm_nsc_remove(struct pci_dev *pci_dev)
339{
340 struct tpm_chip *chip = pci_get_drvdata(pci_dev);
341
342 if ( chip )
343 tpm_remove_hardware(chip->dev);
344}
345
338static struct pci_device_id tpm_pci_tbl[] __devinitdata = { 346static struct pci_device_id tpm_pci_tbl[] __devinitdata = {
339 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_0)}, 347 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_0)},
340 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_12)}, 348 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_12)},
@@ -354,7 +362,7 @@ static struct pci_driver nsc_pci_driver = {
354 .name = "tpm_nsc", 362 .name = "tpm_nsc",
355 .id_table = tpm_pci_tbl, 363 .id_table = tpm_pci_tbl,
356 .probe = tpm_nsc_init, 364 .probe = tpm_nsc_init,
357 .remove = __devexit_p(tpm_remove), 365 .remove = __devexit_p(tpm_nsc_remove),
358 .suspend = tpm_pm_suspend, 366 .suspend = tpm_pm_suspend,
359 .resume = tpm_pm_resume, 367 .resume = tpm_pm_resume,
360}; 368};