linux/drivers/char/hw_random/st-rng.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * ST Random Number Generator Driver ST's Platforms
 *
 * Author: Pankaj Dev: <[email protected]>
 *         Lee Jones <[email protected]>
 *
 * Copyright (C) 2015 STMicroelectronics (R&D) Limited
 */

#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/hw_random.h>
#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/slab.h>

/* Registers */
#define ST_RNG_STATUS_REG
#define ST_RNG_DATA_REG

/* Registers fields */
#define ST_RNG_STATUS_BAD_SEQUENCE
#define ST_RNG_STATUS_BAD_ALTERNANCE
#define ST_RNG_STATUS_FIFO_FULL

#define ST_RNG_SAMPLE_SIZE
#define ST_RNG_FIFO_DEPTH
#define ST_RNG_FIFO_SIZE

/*
 * Samples are documented to be available every 0.667us, so in theory
 * the 4 sample deep FIFO should take 2.668us to fill.  However, during
 * thorough testing, it became apparent that filling the FIFO actually
 * takes closer to 12us.  We then multiply by 2 in order to account for
 * the lack of udelay()'s reliability, suggested by Russell King.
 */
#define ST_RNG_FILL_FIFO_TIMEOUT

struct st_rng_data {};

static int st_rng_read(struct hwrng *rng, void *data, size_t max, bool wait)
{}

static int st_rng_probe(struct platform_device *pdev)
{}

static const struct of_device_id st_rng_match[] __maybe_unused =;
MODULE_DEVICE_TABLE(of, st_rng_match);

static struct platform_driver st_rng_driver =;

module_platform_driver();

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();