Lines Matching +full:turris +full:- +full:omnia +full:- +full:mcu
1 // SPDX-License-Identifier: GPL-2.0
3 * CZ.NIC's Turris Omnia MCU TRNG driver
21 #include <linux/turris-omnia-mcu-interface.h>
22 #include "turris-omnia-mcu.h"
28 struct omnia_mcu *mcu = dev_id; in omnia_trng_irq_handler() local
30 complete(&mcu->trng_entropy_ready); in omnia_trng_irq_handler()
37 struct omnia_mcu *mcu = container_of(rng, struct omnia_mcu, trng); in omnia_trng_read() local
41 if (!wait && !completion_done(&mcu->trng_entropy_ready)) in omnia_trng_read()
45 if (wait_for_completion_interruptible(&mcu->trng_entropy_ready)) in omnia_trng_read()
46 return -ERESTARTSYS; in omnia_trng_read()
48 err = omnia_cmd_read(mcu->client, in omnia_trng_read()
62 int omnia_mcu_register_trng(struct omnia_mcu *mcu) in omnia_mcu_register_trng() argument
64 struct device *dev = &mcu->client->dev; in omnia_mcu_register_trng()
68 if (!(mcu->features & OMNIA_FEAT_TRNG)) in omnia_mcu_register_trng()
72 irq = gpiod_to_irq(gpio_device_get_desc(mcu->gc.gpiodev, irq_idx)); in omnia_mcu_register_trng()
82 err = omnia_cmd_read(mcu->client, OMNIA_CMD_TRNG_COLLECT_ENTROPY, in omnia_mcu_register_trng()
87 init_completion(&mcu->trng_entropy_ready); in omnia_mcu_register_trng()
90 IRQF_ONESHOT, "turris-omnia-mcu-trng", in omnia_mcu_register_trng()
91 mcu); in omnia_mcu_register_trng()
95 mcu->trng.name = "turris-omnia-mcu-trng"; in omnia_mcu_register_trng()
96 mcu->trng.read = omnia_trng_read; in omnia_mcu_register_trng()
98 err = devm_hwrng_register(dev, &mcu->trng); in omnia_mcu_register_trng()