• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-WNDR4500v2-V1.0.0.60_1.0.38/src/linux/linux-2.6/drivers/char/tpm/

Lines Matching refs:chip

78 static int check_locality(struct tpm_chip *chip, int l)
80 if ((ioread8(chip->vendor.iobase + TPM_ACCESS(l)) &
83 return chip->vendor.locality = l;
88 static void release_locality(struct tpm_chip *chip, int l, int force)
90 if (force || (ioread8(chip->vendor.iobase + TPM_ACCESS(l)) &
94 chip->vendor.iobase + TPM_ACCESS(l));
97 static int request_locality(struct tpm_chip *chip, int l)
102 if (check_locality(chip, l) >= 0)
106 chip->vendor.iobase + TPM_ACCESS(l));
108 if (chip->vendor.irq) {
109 rc = wait_event_interruptible_timeout(chip->vendor.int_queue,
111 (chip, l) >= 0),
112 chip->vendor.timeout_a);
118 stop = jiffies + chip->vendor.timeout_a;
120 if (check_locality(chip, l) >= 0)
129 static u8 tpm_tis_status(struct tpm_chip *chip)
131 return ioread8(chip->vendor.iobase +
132 TPM_STS(chip->vendor.locality));
135 static void tpm_tis_ready(struct tpm_chip *chip)
139 chip->vendor.iobase + TPM_STS(chip->vendor.locality));
142 static int get_burstcount(struct tpm_chip *chip)
149 stop = jiffies + chip->vendor.timeout_d;
151 burstcnt = ioread8(chip->vendor.iobase +
152 TPM_STS(chip->vendor.locality) + 1);
153 burstcnt += ioread8(chip->vendor.iobase +
154 TPM_STS(chip->vendor.locality) +
163 static int wait_for_stat(struct tpm_chip *chip, u8 mask, unsigned long timeout,
171 status = tpm_tis_status(chip);
175 if (chip->vendor.irq) {
178 (chip) & mask) ==
186 status = tpm_tis_status(chip);
194 static int recv_data(struct tpm_chip *chip, u8 *buf, size_t count)
198 wait_for_stat(chip,
200 chip->vendor.timeout_c,
201 &chip->vendor.read_queue)
203 burstcnt = get_burstcount(chip);
205 buf[size++] = ioread8(chip->vendor.iobase +
206 TPM_DATA_FIFO(chip->vendor.
212 static int tpm_tis_recv(struct tpm_chip *chip, u8 *buf, size_t count)
224 recv_data(chip, buf, TPM_HEADER_SIZE)) < TPM_HEADER_SIZE) {
225 dev_err(chip->dev, "Unable to read header\n");
236 recv_data(chip, &buf[TPM_HEADER_SIZE],
238 dev_err(chip->dev, "Unable to read remainder of result\n");
243 wait_for_stat(chip, TPM_STS_VALID, chip->vendor.timeout_c,
244 &chip->vendor.int_queue);
245 status = tpm_tis_status(chip);
247 dev_err(chip->dev, "Error left over data\n");
253 tpm_tis_ready(chip);
254 release_locality(chip, chip->vendor.locality, 0);
263 static int tpm_tis_send(struct tpm_chip *chip, u8 *buf, size_t len)
269 if (request_locality(chip, 0) < 0)
272 status = tpm_tis_status(chip);
274 tpm_tis_ready(chip);
276 (chip, TPM_STS_COMMAND_READY, chip->vendor.timeout_b,
277 &chip->vendor.int_queue) < 0) {
284 burstcnt = get_burstcount(chip);
286 iowrite8(buf[count], chip->vendor.iobase +
287 TPM_DATA_FIFO(chip->vendor.locality));
291 wait_for_stat(chip, TPM_STS_VALID, chip->vendor.timeout_c,
292 &chip->vendor.int_queue);
293 status = tpm_tis_status(chip);
302 chip->vendor.iobase +
303 TPM_DATA_FIFO(chip->vendor.locality));
304 wait_for_stat(chip, TPM_STS_VALID, chip->vendor.timeout_c,
305 &chip->vendor.int_queue);
306 status = tpm_tis_status(chip);
314 chip->vendor.iobase + TPM_STS(chip->vendor.locality));
316 if (chip->vendor.irq) {
319 (chip, TPM_STS_DATA_AVAIL | TPM_STS_VALID,
320 tpm_calc_ordinal_duration(chip, ordinal),
321 &chip->vendor.read_queue) < 0) {
328 tpm_tis_ready(chip);
329 release_locality(chip, chip->vendor.locality, 0);
382 struct tpm_chip *chip = (struct tpm_chip *) dev_id;
385 interrupt = ioread32(chip->vendor.iobase +
386 TPM_INT_STATUS(chip->vendor.locality));
391 chip->vendor.irq = irq;
395 chip->vendor.iobase +
396 TPM_INT_STATUS(chip->vendor.locality));
402 struct tpm_chip *chip = (struct tpm_chip *) dev_id;
406 interrupt = ioread32(chip->vendor.iobase +
407 TPM_INT_STATUS(chip->vendor.locality));
413 wake_up_interruptible(&chip->vendor.read_queue);
416 if (check_locality(chip, i) >= 0)
421 wake_up_interruptible(&chip->vendor.int_queue);
425 chip->vendor.iobase +
426 TPM_INT_STATUS(chip->vendor.locality));
427 ioread32(chip->vendor.iobase + TPM_INT_STATUS(chip->vendor.locality));
440 struct tpm_chip *chip;
447 if (!(chip = tpm_register_hardware(dev, &tpm_tis)))
450 chip->vendor.iobase = ioremap(start, len);
451 if (!chip->vendor.iobase) {
456 vendor = ioread32(chip->vendor.iobase + TPM_DID_VID(0));
459 chip->vendor.timeout_a = msecs_to_jiffies(TIS_SHORT_TIMEOUT);
460 chip->vendor.timeout_b = msecs_to_jiffies(TIS_LONG_TIMEOUT);
461 chip->vendor.timeout_c = msecs_to_jiffies(TIS_SHORT_TIMEOUT);
462 chip->vendor.timeout_d = msecs_to_jiffies(TIS_SHORT_TIMEOUT);
466 vendor >> 16, ioread8(chip->vendor.iobase + TPM_RID(0)));
470 ioread32(chip->vendor.iobase +
471 TPM_INTF_CAPS(chip->vendor.locality));
493 if (request_locality(chip, 0) != 0) {
499 init_waitqueue_head(&chip->vendor.read_queue);
500 init_waitqueue_head(&chip->vendor.int_queue);
503 ioread32(chip->vendor.iobase +
504 TPM_INT_ENABLE(chip->vendor.locality));
511 chip->vendor.iobase +
512 TPM_INT_ENABLE(chip->vendor.locality));
514 chip->vendor.irq =
515 ioread8(chip->vendor.iobase +
516 TPM_INT_VECTOR(chip->vendor.locality));
518 for (i = 3; i < 16 && chip->vendor.irq == 0; i++) {
519 iowrite8(i, chip->vendor.iobase +
520 TPM_INT_VECTOR(chip->vendor.locality));
523 chip->vendor.miscdev.name, chip) != 0) {
524 dev_info(chip->dev,
532 (chip->vendor.iobase +
533 TPM_INT_STATUS(chip->vendor.locality)),
534 chip->vendor.iobase +
535 TPM_INT_STATUS(chip->vendor.locality));
539 chip->vendor.iobase +
540 TPM_INT_ENABLE(chip->vendor.locality));
543 tpm_gen_interrupt(chip);
547 chip->vendor.iobase +
548 TPM_INT_ENABLE(chip->vendor.locality));
549 free_irq(i, chip);
552 if (chip->vendor.irq) {
553 iowrite8(chip->vendor.irq,
554 chip->vendor.iobase +
555 TPM_INT_VECTOR(chip->vendor.locality));
557 (chip->vendor.irq, tis_int_handler, IRQF_SHARED,
558 chip->vendor.miscdev.name, chip) != 0) {
559 dev_info(chip->dev,
561 chip->vendor.irq);
562 chip->vendor.irq = 0;
566 (chip->vendor.iobase +
567 TPM_INT_STATUS(chip->vendor.locality)),
568 chip->vendor.iobase +
569 TPM_INT_STATUS(chip->vendor.locality));
573 chip->vendor.iobase +
574 TPM_INT_ENABLE(chip->vendor.locality));
578 INIT_LIST_HEAD(&chip->vendor.list);
580 list_add(&chip->vendor.list, &tis_chips);
583 tpm_get_timeouts(chip);
584 tpm_continue_selftest(chip);
588 if (chip->vendor.iobase)
589 iounmap(chip->vendor.iobase);
590 tpm_remove_hardware(chip->dev);
674 struct tpm_chip *chip;
677 chip = to_tpm_chip(i);
679 ioread32(chip->vendor.iobase +
680 TPM_INT_ENABLE(chip->vendor.
682 chip->vendor.iobase +
683 TPM_INT_ENABLE(chip->vendor.locality));
684 release_locality(chip, chip->vendor.locality, 1);
685 if (chip->vendor.irq)
686 free_irq(chip->vendor.irq, chip);
689 tpm_remove_hardware(chip->dev);