blob: 1a5e9e2e4b4d5e44fbce175c3052ef96da0742e6 [file] [log] [blame]
Sughosh Ganue67ffb52022-07-22 21:32:04 +05301// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * Copyright (c) 2022, Linaro Limited
4 */
5
6#include <dm.h>
7#include <rng.h>
8#include <tpm_api.h>
9
10static int rng_tpm_random_read(struct udevice *dev, void *data, size_t count)
11{
12 return tpm_get_random(dev_get_parent(dev), data, count);
13}
14
15static const struct dm_rng_ops tpm_rng_ops = {
16 .read = rng_tpm_random_read,
17};
18
19U_BOOT_DRIVER(tpm_rng) = {
20 .name = "tpm-rng",
21 .id = UCLASS_RNG,
22 .ops = &tpm_rng_ops,
23};