Lines Matching +full:locality +full:- +full:specific

1 // SPDX-License-Identifier: GPL-2.0-or-later
4 * Copyright (C) 2009 - 2016 STMicroelectronics
71 tpm_dev->ops->recv(tpm_dev->phy_id, TPM_INT_STATUS, &interrupt, 1); in clear_interruption()
72 tpm_dev->ops->send(tpm_dev->phy_id, TPM_INT_STATUS, &interrupt, 1); in clear_interruption()
81 struct st33zp24_dev *tpm_dev = dev_get_drvdata(&chip->dev); in st33zp24_cancel()
85 tpm_dev->ops->send(tpm_dev->phy_id, TPM_STS, &data, 1); in st33zp24_cancel()
93 struct st33zp24_dev *tpm_dev = dev_get_drvdata(&chip->dev); in st33zp24_status()
96 tpm_dev->ops->recv(tpm_dev->phy_id, TPM_STS, &data, 1); in st33zp24_status()
101 * if the locality is active
105 struct st33zp24_dev *tpm_dev = dev_get_drvdata(&chip->dev); in check_locality()
109 status = tpm_dev->ops->recv(tpm_dev->phy_id, TPM_ACCESS, &data, 1); in check_locality()
120 struct st33zp24_dev *tpm_dev = dev_get_drvdata(&chip->dev); in request_locality()
126 return tpm_dev->locality; in request_locality()
129 ret = tpm_dev->ops->send(tpm_dev->phy_id, TPM_ACCESS, &data, 1); in request_locality()
133 stop = jiffies + chip->timeout_a; in request_locality()
135 /* Request locality is usually effective after the request */ in request_locality()
138 return tpm_dev->locality; in request_locality()
142 /* could not get locality */ in request_locality()
143 return -EACCES; in request_locality()
148 struct st33zp24_dev *tpm_dev = dev_get_drvdata(&chip->dev); in release_locality()
153 tpm_dev->ops->send(tpm_dev->phy_id, TPM_ACCESS, &data, 1); in release_locality()
161 struct st33zp24_dev *tpm_dev = dev_get_drvdata(&chip->dev); in get_burstcount()
166 stop = jiffies + chip->timeout_d; in get_burstcount()
168 status = tpm_dev->ops->recv(tpm_dev->phy_id, TPM_STS + 1, in get_burstcount()
171 return -EBUSY; in get_burstcount()
174 status = tpm_dev->ops->recv(tpm_dev->phy_id, TPM_STS + 2, in get_burstcount()
177 return -EBUSY; in get_burstcount()
184 return -EBUSY; in get_burstcount()
190 u8 status = chip->ops->status(chip); in wait_for_tpm_stat_cond()
195 if (check_cancel && chip->ops->req_canceled(chip, status)) { in wait_for_tpm_stat_cond()
208 struct st33zp24_dev *tpm_dev = dev_get_drvdata(&chip->dev); in wait_for_stat()
223 if (chip->flags & TPM_CHIP_FLAG_IRQ) { in wait_for_stat()
224 cur_intrs = tpm_dev->intrs; in wait_for_stat()
226 enable_irq(tpm_dev->irq); in wait_for_stat()
229 if (ret == -ERESTARTSYS && freezing(current)) in wait_for_stat()
232 timeout = stop - jiffies; in wait_for_stat()
234 return -1; in wait_for_stat()
237 cur_intrs != tpm_dev->intrs, in wait_for_stat()
244 return -ECANCELED; in wait_for_stat()
247 } while (ret == -ERESTARTSYS && freezing(current)); in wait_for_stat()
249 disable_irq_nosync(tpm_dev->irq); in wait_for_stat()
254 status = chip->ops->status(chip); in wait_for_stat()
260 return -ETIME; in wait_for_stat()
265 struct st33zp24_dev *tpm_dev = dev_get_drvdata(&chip->dev); in recv_data()
271 chip->timeout_c, in recv_data()
272 &tpm_dev->read_queue, true) == 0) { in recv_data()
276 len = min_t(int, burstcnt, count - size); in recv_data()
277 ret = tpm_dev->ops->recv(tpm_dev->phy_id, TPM_DATA_FIFO, in recv_data()
290 struct st33zp24_dev *tpm_dev = dev_get_drvdata(&chip->dev); in tpm_ioserirq_handler()
292 tpm_dev->intrs++; in tpm_ioserirq_handler()
293 wake_up_interruptible(&tpm_dev->read_queue); in tpm_ioserirq_handler()
294 disable_irq_nosync(tpm_dev->irq); in tpm_ioserirq_handler()
305 struct st33zp24_dev *tpm_dev = dev_get_drvdata(&chip->dev); in st33zp24_send()
312 return -EBUSY; in st33zp24_send()
322 (chip, TPM_STS_COMMAND_READY, chip->timeout_b, in st33zp24_send()
323 &tpm_dev->read_queue, false) < 0) { in st33zp24_send()
324 ret = -ETIME; in st33zp24_send()
329 for (i = 0; i < len - 1;) { in st33zp24_send()
333 size = min_t(int, len - i - 1, burstcnt); in st33zp24_send()
334 ret = tpm_dev->ops->send(tpm_dev->phy_id, TPM_DATA_FIFO, in st33zp24_send()
344 ret = -EIO; in st33zp24_send()
348 ret = tpm_dev->ops->send(tpm_dev->phy_id, TPM_DATA_FIFO, in st33zp24_send()
349 buf + len - 1, 1); in st33zp24_send()
355 ret = -EIO; in st33zp24_send()
360 ret = tpm_dev->ops->send(tpm_dev->phy_id, TPM_STS, &data, 1); in st33zp24_send()
364 if (chip->flags & TPM_CHIP_FLAG_IRQ) { in st33zp24_send()
369 &tpm_dev->read_queue, false); in st33zp24_send()
388 return -EBUSY; in st33zp24_recv()
391 size = -EIO; in st33zp24_recv()
397 dev_err(&chip->dev, "Unable to read header\n"); in st33zp24_recv()
403 size = -EIO; in st33zp24_recv()
408 expected - TPM_HEADER_SIZE); in st33zp24_recv()
410 dev_err(&chip->dev, "Unable to read remainder of result\n"); in st33zp24_recv()
411 size = -ETIME; in st33zp24_recv()
439 { "lpcpd-gpios", &lpcpd_gpios, 1 },
461 return -ENOMEM; in st33zp24_probe()
463 tpm_dev->phy_id = phy_id; in st33zp24_probe()
464 tpm_dev->ops = ops; in st33zp24_probe()
465 dev_set_drvdata(&chip->dev, tpm_dev); in st33zp24_probe()
467 chip->timeout_a = msecs_to_jiffies(TIS_SHORT_TIMEOUT); in st33zp24_probe()
468 chip->timeout_b = msecs_to_jiffies(TIS_LONG_TIMEOUT); in st33zp24_probe()
469 chip->timeout_c = msecs_to_jiffies(TIS_SHORT_TIMEOUT); in st33zp24_probe()
470 chip->timeout_d = msecs_to_jiffies(TIS_SHORT_TIMEOUT); in st33zp24_probe()
472 tpm_dev->locality = LOCALITY0; in st33zp24_probe()
482 * issue as power management can be also managed by TPM specific in st33zp24_probe()
485 tpm_dev->io_lpcpd = devm_gpiod_get_optional(dev, "lpcpd", in st33zp24_probe()
487 ret = PTR_ERR_OR_ZERO(tpm_dev->io_lpcpd); in st33zp24_probe()
495 init_waitqueue_head(&tpm_dev->read_queue); in st33zp24_probe()
496 tpm_dev->intrs = 0; in st33zp24_probe()
499 ret = -ENODEV; in st33zp24_probe()
508 dev_err(&chip->dev, "TPM SERIRQ signals %d not available\n", in st33zp24_probe()
517 ret = tpm_dev->ops->send(tpm_dev->phy_id, TPM_INT_ENABLE, in st33zp24_probe()
523 ret = tpm_dev->ops->send(tpm_dev->phy_id, (TPM_INT_ENABLE + 3), in st33zp24_probe()
528 tpm_dev->irq = irq; in st33zp24_probe()
529 chip->flags |= TPM_CHIP_FLAG_IRQ; in st33zp24_probe()
531 disable_irq_nosync(tpm_dev->irq); in st33zp24_probe()
536 dev_info(&chip->dev, "TPM initialization fail\n"); in st33zp24_probe()
551 struct st33zp24_dev *tpm_dev = dev_get_drvdata(&chip->dev); in st33zp24_pm_suspend()
555 if (tpm_dev->io_lpcpd) in st33zp24_pm_suspend()
556 gpiod_set_value_cansleep(tpm_dev->io_lpcpd, 0); in st33zp24_pm_suspend()
567 struct st33zp24_dev *tpm_dev = dev_get_drvdata(&chip->dev); in st33zp24_pm_resume()
570 if (tpm_dev->io_lpcpd) { in st33zp24_pm_resume()
571 gpiod_set_value_cansleep(tpm_dev->io_lpcpd, 1); in st33zp24_pm_resume()
573 TPM_STS_VALID, chip->timeout_b, in st33zp24_pm_resume()
574 &tpm_dev->read_queue, false); in st33zp24_pm_resume()