tpm2_tis_spi.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Author:
  4. * Miquel Raynal <miquel.raynal@bootlin.com>
  5. *
  6. * Description:
  7. * SPI-level driver for TCG/TIS TPM (trusted platform module).
  8. * Specifications at www.trustedcomputinggroup.org
  9. *
  10. * This device driver implements the TPM interface as defined in
  11. * the TCG SPI protocol stack version 2.0.
  12. *
  13. * It is based on the U-Boot driver tpm_tis_infineon_i2c.c.
  14. */
  15. #include <common.h>
  16. #include <dm.h>
  17. #include <fdtdec.h>
  18. #include <log.h>
  19. #include <spi.h>
  20. #include <tpm-v2.h>
  21. #include <linux/errno.h>
  22. #include <linux/compiler.h>
  23. #include <linux/types.h>
  24. #include <linux/unaligned/be_byteshift.h>
  25. #include <asm-generic/gpio.h>
  26. #include "tpm_tis.h"
  27. #include "tpm_internal.h"
  28. DECLARE_GLOBAL_DATA_PTR;
  29. #define TPM_ACCESS(l) (0x0000 | ((l) << 12))
  30. #define TPM_INT_ENABLE(l) (0x0008 | ((l) << 12))
  31. #define TPM_STS(l) (0x0018 | ((l) << 12))
  32. #define TPM_DATA_FIFO(l) (0x0024 | ((l) << 12))
  33. #define TPM_DID_VID(l) (0x0F00 | ((l) << 12))
  34. #define TPM_RID(l) (0x0F04 | ((l) << 12))
  35. #define MAX_SPI_FRAMESIZE 64
  36. /* Number of wait states to wait for */
  37. #define TPM_WAIT_STATES 100
  38. /**
  39. * struct tpm_tis_chip_data - Non-discoverable TPM information
  40. *
  41. * @pcr_count: Number of PCR per bank
  42. * @pcr_select_min: Size in octets of the pcrSelect array
  43. */
  44. struct tpm_tis_chip_data {
  45. unsigned int pcr_count;
  46. unsigned int pcr_select_min;
  47. unsigned int time_before_first_cmd_ms;
  48. };
  49. /**
  50. * tpm_tis_spi_read() - Read from TPM register
  51. *
  52. * @addr: register address to read from
  53. * @buffer: provided by caller
  54. * @len: number of bytes to read
  55. *
  56. * Read len bytes from TPM register and put them into
  57. * buffer (little-endian format, i.e. first byte is put into buffer[0]).
  58. *
  59. * NOTE: TPM is big-endian for multi-byte values. Multi-byte
  60. * values have to be swapped.
  61. *
  62. * @return -EIO on error, 0 on success.
  63. */
  64. static int tpm_tis_spi_xfer(struct udevice *dev, u32 addr, const u8 *out,
  65. u8 *in, u16 len)
  66. {
  67. struct spi_slave *slave = dev_get_parent_priv(dev);
  68. int transfer_len, ret;
  69. u8 tx_buf[MAX_SPI_FRAMESIZE];
  70. u8 rx_buf[MAX_SPI_FRAMESIZE];
  71. if (in && out) {
  72. log(LOGC_NONE, LOGL_ERR, "%s: can't do full duplex\n",
  73. __func__);
  74. return -EINVAL;
  75. }
  76. ret = spi_claim_bus(slave);
  77. if (ret < 0) {
  78. log(LOGC_NONE, LOGL_ERR, "%s: could not claim bus\n", __func__);
  79. return ret;
  80. }
  81. while (len) {
  82. /* Request */
  83. transfer_len = min_t(u16, len, MAX_SPI_FRAMESIZE);
  84. tx_buf[0] = (in ? BIT(7) : 0) | (transfer_len - 1);
  85. tx_buf[1] = 0xD4;
  86. tx_buf[2] = addr >> 8;
  87. tx_buf[3] = addr;
  88. ret = spi_xfer(slave, 4 * 8, tx_buf, rx_buf, SPI_XFER_BEGIN);
  89. if (ret < 0) {
  90. log(LOGC_NONE, LOGL_ERR,
  91. "%s: spi request transfer failed (err: %d)\n",
  92. __func__, ret);
  93. goto release_bus;
  94. }
  95. /* Wait state */
  96. if (!(rx_buf[3] & 0x1)) {
  97. int i;
  98. for (i = 0; i < TPM_WAIT_STATES; i++) {
  99. ret = spi_xfer(slave, 1 * 8, NULL, rx_buf, 0);
  100. if (ret) {
  101. log(LOGC_NONE, LOGL_ERR,
  102. "%s: wait state failed: %d\n",
  103. __func__, ret);
  104. goto release_bus;
  105. }
  106. if (rx_buf[0] & 0x1)
  107. break;
  108. }
  109. if (i == TPM_WAIT_STATES) {
  110. log(LOGC_NONE, LOGL_ERR,
  111. "%s: timeout on wait state\n", __func__);
  112. ret = -ETIMEDOUT;
  113. goto release_bus;
  114. }
  115. }
  116. /* Read/Write */
  117. if (out) {
  118. memcpy(tx_buf, out, transfer_len);
  119. out += transfer_len;
  120. }
  121. ret = spi_xfer(slave, transfer_len * 8,
  122. out ? tx_buf : NULL,
  123. in ? rx_buf : NULL,
  124. SPI_XFER_END);
  125. if (ret) {
  126. log(LOGC_NONE, LOGL_ERR,
  127. "%s: spi read transfer failed (err: %d)\n",
  128. __func__, ret);
  129. goto release_bus;
  130. }
  131. if (in) {
  132. memcpy(in, rx_buf, transfer_len);
  133. in += transfer_len;
  134. }
  135. len -= transfer_len;
  136. }
  137. release_bus:
  138. /* If an error occurred, release the chip by deasserting the CS */
  139. if (ret < 0)
  140. spi_xfer(slave, 0, NULL, NULL, SPI_XFER_END);
  141. spi_release_bus(slave);
  142. return ret;
  143. }
  144. static int tpm_tis_spi_read(struct udevice *dev, u16 addr, u8 *in, u16 len)
  145. {
  146. return tpm_tis_spi_xfer(dev, addr, NULL, in, len);
  147. }
  148. static int tpm_tis_spi_read32(struct udevice *dev, u32 addr, u32 *result)
  149. {
  150. __le32 result_le;
  151. int ret;
  152. ret = tpm_tis_spi_read(dev, addr, (u8 *)&result_le, sizeof(u32));
  153. if (!ret)
  154. *result = le32_to_cpu(result_le);
  155. return ret;
  156. }
  157. static int tpm_tis_spi_write(struct udevice *dev, u16 addr, const u8 *out,
  158. u16 len)
  159. {
  160. return tpm_tis_spi_xfer(dev, addr, out, NULL, len);
  161. }
  162. static int tpm_tis_spi_check_locality(struct udevice *dev, int loc)
  163. {
  164. const u8 mask = TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID;
  165. struct tpm_chip *chip = dev_get_priv(dev);
  166. u8 buf;
  167. int ret;
  168. ret = tpm_tis_spi_read(dev, TPM_ACCESS(loc), &buf, 1);
  169. if (ret)
  170. return ret;
  171. if ((buf & mask) == mask) {
  172. chip->locality = loc;
  173. return 0;
  174. }
  175. return -ENOENT;
  176. }
  177. static void tpm_tis_spi_release_locality(struct udevice *dev, int loc,
  178. bool force)
  179. {
  180. const u8 mask = TPM_ACCESS_REQUEST_PENDING | TPM_ACCESS_VALID;
  181. u8 buf;
  182. if (tpm_tis_spi_read(dev, TPM_ACCESS(loc), &buf, 1) < 0)
  183. return;
  184. if (force || (buf & mask) == mask) {
  185. buf = TPM_ACCESS_ACTIVE_LOCALITY;
  186. tpm_tis_spi_write(dev, TPM_ACCESS(loc), &buf, 1);
  187. }
  188. }
  189. static int tpm_tis_spi_request_locality(struct udevice *dev, int loc)
  190. {
  191. struct tpm_chip *chip = dev_get_priv(dev);
  192. unsigned long start, stop;
  193. u8 buf = TPM_ACCESS_REQUEST_USE;
  194. int ret;
  195. ret = tpm_tis_spi_check_locality(dev, loc);
  196. if (!ret)
  197. return 0;
  198. if (ret != -ENOENT) {
  199. log(LOGC_NONE, LOGL_ERR, "%s: Failed to get locality: %d\n",
  200. __func__, ret);
  201. return ret;
  202. }
  203. ret = tpm_tis_spi_write(dev, TPM_ACCESS(loc), &buf, 1);
  204. if (ret) {
  205. log(LOGC_NONE, LOGL_ERR, "%s: Failed to write to TPM: %d\n",
  206. __func__, ret);
  207. return ret;
  208. }
  209. start = get_timer(0);
  210. stop = chip->timeout_a;
  211. do {
  212. ret = tpm_tis_spi_check_locality(dev, loc);
  213. if (!ret)
  214. return 0;
  215. if (ret != -ENOENT) {
  216. log(LOGC_NONE, LOGL_ERR,
  217. "%s: Failed to get locality: %d\n", __func__, ret);
  218. return ret;
  219. }
  220. mdelay(TPM_TIMEOUT_MS);
  221. } while (get_timer(start) < stop);
  222. log(LOGC_NONE, LOGL_ERR, "%s: Timeout getting locality: %d\n", __func__,
  223. ret);
  224. return ret;
  225. }
  226. static u8 tpm_tis_spi_status(struct udevice *dev, u8 *status)
  227. {
  228. struct tpm_chip *chip = dev_get_priv(dev);
  229. return tpm_tis_spi_read(dev, TPM_STS(chip->locality), status, 1);
  230. }
  231. static int tpm_tis_spi_wait_for_stat(struct udevice *dev, u8 mask,
  232. unsigned long timeout, u8 *status)
  233. {
  234. unsigned long start = get_timer(0);
  235. unsigned long stop = timeout;
  236. int ret;
  237. do {
  238. mdelay(TPM_TIMEOUT_MS);
  239. ret = tpm_tis_spi_status(dev, status);
  240. if (ret)
  241. return ret;
  242. if ((*status & mask) == mask)
  243. return 0;
  244. } while (get_timer(start) < stop);
  245. return -ETIMEDOUT;
  246. }
  247. static int tpm_tis_spi_get_burstcount(struct udevice *dev)
  248. {
  249. struct tpm_chip *chip = dev_get_priv(dev);
  250. unsigned long start, stop;
  251. u32 burstcount, ret;
  252. /* wait for burstcount */
  253. start = get_timer(0);
  254. stop = chip->timeout_d;
  255. do {
  256. ret = tpm_tis_spi_read32(dev, TPM_STS(chip->locality),
  257. &burstcount);
  258. if (ret)
  259. return -EBUSY;
  260. burstcount = (burstcount >> 8) & 0xFFFF;
  261. if (burstcount)
  262. return burstcount;
  263. mdelay(TPM_TIMEOUT_MS);
  264. } while (get_timer(start) < stop);
  265. return -EBUSY;
  266. }
  267. static int tpm_tis_spi_cancel(struct udevice *dev)
  268. {
  269. struct tpm_chip *chip = dev_get_priv(dev);
  270. u8 data = TPM_STS_COMMAND_READY;
  271. return tpm_tis_spi_write(dev, TPM_STS(chip->locality), &data, 1);
  272. }
  273. static int tpm_tis_spi_recv_data(struct udevice *dev, u8 *buf, size_t count)
  274. {
  275. struct tpm_chip *chip = dev_get_priv(dev);
  276. int size = 0, burstcnt, len, ret;
  277. u8 status;
  278. while (size < count &&
  279. tpm_tis_spi_wait_for_stat(dev,
  280. TPM_STS_DATA_AVAIL | TPM_STS_VALID,
  281. chip->timeout_c, &status) == 0) {
  282. burstcnt = tpm_tis_spi_get_burstcount(dev);
  283. if (burstcnt < 0)
  284. return burstcnt;
  285. len = min_t(int, burstcnt, count - size);
  286. ret = tpm_tis_spi_read(dev, TPM_DATA_FIFO(chip->locality),
  287. buf + size, len);
  288. if (ret < 0)
  289. return ret;
  290. size += len;
  291. }
  292. return size;
  293. }
  294. static int tpm_tis_spi_recv(struct udevice *dev, u8 *buf, size_t count)
  295. {
  296. struct tpm_chip *chip = dev_get_priv(dev);
  297. int size, expected;
  298. if (!chip)
  299. return -ENODEV;
  300. if (count < TPM_HEADER_SIZE) {
  301. size = -EIO;
  302. goto out;
  303. }
  304. size = tpm_tis_spi_recv_data(dev, buf, TPM_HEADER_SIZE);
  305. if (size < TPM_HEADER_SIZE) {
  306. log(LOGC_NONE, LOGL_ERR, "TPM error, unable to read header\n");
  307. goto out;
  308. }
  309. expected = get_unaligned_be32(buf + 2);
  310. if (expected > count) {
  311. size = -EIO;
  312. goto out;
  313. }
  314. size += tpm_tis_spi_recv_data(dev, &buf[TPM_HEADER_SIZE],
  315. expected - TPM_HEADER_SIZE);
  316. if (size < expected) {
  317. log(LOGC_NONE, LOGL_ERR,
  318. "TPM error, unable to read remaining bytes of result\n");
  319. size = -EIO;
  320. goto out;
  321. }
  322. out:
  323. tpm_tis_spi_cancel(dev);
  324. tpm_tis_spi_release_locality(dev, chip->locality, false);
  325. return size;
  326. }
  327. static int tpm_tis_spi_send(struct udevice *dev, const u8 *buf, size_t len)
  328. {
  329. struct tpm_chip *chip = dev_get_priv(dev);
  330. u32 i, size;
  331. u8 status;
  332. int burstcnt, ret;
  333. u8 data;
  334. if (!chip)
  335. return -ENODEV;
  336. if (len > TPM_DEV_BUFSIZE)
  337. return -E2BIG; /* Command is too long for our tpm, sorry */
  338. ret = tpm_tis_spi_request_locality(dev, 0);
  339. if (ret < 0)
  340. return -EBUSY;
  341. /*
  342. * Check if the TPM is ready. If not, if not, cancel the pending command
  343. * and poll on the status to be finally ready.
  344. */
  345. ret = tpm_tis_spi_status(dev, &status);
  346. if (ret)
  347. return ret;
  348. if (!(status & TPM_STS_COMMAND_READY)) {
  349. /* Force the transition, usually this will be done at startup */
  350. ret = tpm_tis_spi_cancel(dev);
  351. if (ret) {
  352. log(LOGC_NONE, LOGL_ERR,
  353. "%s: Could not cancel previous operation\n",
  354. __func__);
  355. goto out_err;
  356. }
  357. ret = tpm_tis_spi_wait_for_stat(dev, TPM_STS_COMMAND_READY,
  358. chip->timeout_b, &status);
  359. if (ret < 0 || !(status & TPM_STS_COMMAND_READY)) {
  360. log(LOGC_NONE, LOGL_ERR,
  361. "status %d after wait for stat returned %d\n",
  362. status, ret);
  363. goto out_err;
  364. }
  365. }
  366. for (i = 0; i < len - 1;) {
  367. burstcnt = tpm_tis_spi_get_burstcount(dev);
  368. if (burstcnt < 0)
  369. return burstcnt;
  370. size = min_t(int, len - i - 1, burstcnt);
  371. ret = tpm_tis_spi_write(dev, TPM_DATA_FIFO(chip->locality),
  372. buf + i, size);
  373. if (ret < 0)
  374. goto out_err;
  375. i += size;
  376. }
  377. ret = tpm_tis_spi_status(dev, &status);
  378. if (ret)
  379. goto out_err;
  380. if ((status & TPM_STS_DATA_EXPECT) == 0) {
  381. ret = -EIO;
  382. goto out_err;
  383. }
  384. ret = tpm_tis_spi_write(dev, TPM_DATA_FIFO(chip->locality),
  385. buf + len - 1, 1);
  386. if (ret)
  387. goto out_err;
  388. ret = tpm_tis_spi_status(dev, &status);
  389. if (ret)
  390. goto out_err;
  391. if ((status & TPM_STS_DATA_EXPECT) != 0) {
  392. ret = -EIO;
  393. goto out_err;
  394. }
  395. data = TPM_STS_GO;
  396. ret = tpm_tis_spi_write(dev, TPM_STS(chip->locality), &data, 1);
  397. if (ret)
  398. goto out_err;
  399. return len;
  400. out_err:
  401. tpm_tis_spi_cancel(dev);
  402. tpm_tis_spi_release_locality(dev, chip->locality, false);
  403. return ret;
  404. }
  405. static int tpm_tis_spi_cleanup(struct udevice *dev)
  406. {
  407. struct tpm_chip *chip = dev_get_priv(dev);
  408. tpm_tis_spi_cancel(dev);
  409. /*
  410. * The TPM needs some time to clean up here,
  411. * so we sleep rather than keeping the bus busy
  412. */
  413. mdelay(2);
  414. tpm_tis_spi_release_locality(dev, chip->locality, false);
  415. return 0;
  416. }
  417. static int tpm_tis_spi_open(struct udevice *dev)
  418. {
  419. struct tpm_chip *chip = dev_get_priv(dev);
  420. if (chip->is_open)
  421. return -EBUSY;
  422. chip->is_open = 1;
  423. return 0;
  424. }
  425. static int tpm_tis_spi_close(struct udevice *dev)
  426. {
  427. struct tpm_chip *chip = dev_get_priv(dev);
  428. if (chip->is_open) {
  429. tpm_tis_spi_release_locality(dev, chip->locality, true);
  430. chip->is_open = 0;
  431. }
  432. return 0;
  433. }
  434. static int tpm_tis_get_desc(struct udevice *dev, char *buf, int size)
  435. {
  436. struct tpm_chip *chip = dev_get_priv(dev);
  437. if (size < 80)
  438. return -ENOSPC;
  439. return snprintf(buf, size,
  440. "%s v2.0: VendorID 0x%04x, DeviceID 0x%04x, RevisionID 0x%02x [%s]",
  441. dev->name, chip->vend_dev & 0xFFFF,
  442. chip->vend_dev >> 16, chip->rid,
  443. (chip->is_open ? "open" : "closed"));
  444. }
  445. static int tpm_tis_wait_init(struct udevice *dev, int loc)
  446. {
  447. struct tpm_chip *chip = dev_get_priv(dev);
  448. unsigned long start, stop;
  449. u8 status;
  450. int ret;
  451. start = get_timer(0);
  452. stop = chip->timeout_b;
  453. do {
  454. mdelay(TPM_TIMEOUT_MS);
  455. ret = tpm_tis_spi_read(dev, TPM_ACCESS(loc), &status, 1);
  456. if (ret)
  457. break;
  458. if (status & TPM_ACCESS_VALID)
  459. return 0;
  460. } while (get_timer(start) < stop);
  461. return -EIO;
  462. }
  463. static int tpm_tis_spi_probe(struct udevice *dev)
  464. {
  465. struct tpm_tis_chip_data *drv_data = (void *)dev_get_driver_data(dev);
  466. struct tpm_chip_priv *priv = dev_get_uclass_priv(dev);
  467. struct tpm_chip *chip = dev_get_priv(dev);
  468. int ret;
  469. if (IS_ENABLED(CONFIG_DM_GPIO)) {
  470. struct gpio_desc reset_gpio;
  471. ret = gpio_request_by_name(dev, "gpio-reset", 0,
  472. &reset_gpio, GPIOD_IS_OUT);
  473. if (ret) {
  474. log(LOGC_NONE, LOGL_NOTICE, "%s: missing reset GPIO\n",
  475. __func__);
  476. } else {
  477. dm_gpio_set_value(&reset_gpio, 0);
  478. mdelay(1);
  479. dm_gpio_set_value(&reset_gpio, 1);
  480. }
  481. }
  482. /* Ensure a minimum amount of time elapsed since reset of the TPM */
  483. mdelay(drv_data->time_before_first_cmd_ms);
  484. chip->locality = 0;
  485. chip->timeout_a = TIS_SHORT_TIMEOUT_MS;
  486. chip->timeout_b = TIS_LONG_TIMEOUT_MS;
  487. chip->timeout_c = TIS_SHORT_TIMEOUT_MS;
  488. chip->timeout_d = TIS_SHORT_TIMEOUT_MS;
  489. priv->pcr_count = drv_data->pcr_count;
  490. priv->pcr_select_min = drv_data->pcr_select_min;
  491. ret = tpm_tis_wait_init(dev, chip->locality);
  492. if (ret) {
  493. log(LOGC_DM, LOGL_ERR, "%s: no device found\n", __func__);
  494. return ret;
  495. }
  496. ret = tpm_tis_spi_request_locality(dev, chip->locality);
  497. if (ret) {
  498. log(LOGC_NONE, LOGL_ERR, "%s: could not request locality %d\n",
  499. __func__, chip->locality);
  500. return ret;
  501. }
  502. ret = tpm_tis_spi_read32(dev, TPM_DID_VID(chip->locality),
  503. &chip->vend_dev);
  504. if (ret) {
  505. log(LOGC_NONE, LOGL_ERR,
  506. "%s: could not retrieve VendorID/DeviceID\n", __func__);
  507. return ret;
  508. }
  509. ret = tpm_tis_spi_read(dev, TPM_RID(chip->locality), &chip->rid, 1);
  510. if (ret) {
  511. log(LOGC_NONE, LOGL_ERR, "%s: could not retrieve RevisionID\n",
  512. __func__);
  513. return ret;
  514. }
  515. log(LOGC_NONE, LOGL_ERR,
  516. "SPI TPMv2.0 found (vid:%04x, did:%04x, rid:%02x)\n",
  517. chip->vend_dev & 0xFFFF, chip->vend_dev >> 16, chip->rid);
  518. return 0;
  519. }
  520. static int tpm_tis_spi_remove(struct udevice *dev)
  521. {
  522. struct tpm_chip *chip = dev_get_priv(dev);
  523. tpm_tis_spi_release_locality(dev, chip->locality, true);
  524. return 0;
  525. }
  526. static const struct tpm_ops tpm_tis_spi_ops = {
  527. .open = tpm_tis_spi_open,
  528. .close = tpm_tis_spi_close,
  529. .get_desc = tpm_tis_get_desc,
  530. .send = tpm_tis_spi_send,
  531. .recv = tpm_tis_spi_recv,
  532. .cleanup = tpm_tis_spi_cleanup,
  533. };
  534. static const struct tpm_tis_chip_data tpm_tis_std_chip_data = {
  535. .pcr_count = 24,
  536. .pcr_select_min = 3,
  537. .time_before_first_cmd_ms = 30,
  538. };
  539. static const struct udevice_id tpm_tis_spi_ids[] = {
  540. {
  541. .compatible = "tis,tpm2-spi",
  542. .data = (ulong)&tpm_tis_std_chip_data,
  543. },
  544. { }
  545. };
  546. U_BOOT_DRIVER(tpm_tis_spi) = {
  547. .name = "tpm_tis_spi",
  548. .id = UCLASS_TPM,
  549. .of_match = tpm_tis_spi_ids,
  550. .ops = &tpm_tis_spi_ops,
  551. .probe = tpm_tis_spi_probe,
  552. .remove = tpm_tis_spi_remove,
  553. .priv_auto_alloc_size = sizeof(struct tpm_chip),
  554. };