linux/drivers/char/hw_random/ks-sa-rng.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Random Number Generator driver for the Keystone SOC
 *
 * Copyright (C) 2016 Texas Instruments Incorporated - https://www.ti.com
 *
 * Authors:	Sandeep Nair
 *		Vitaly Andrianov
 */

#include <linux/hw_random.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/io.h>
#include <linux/platform_device.h>
#include <linux/clk.h>
#include <linux/pm_runtime.h>
#include <linux/err.h>
#include <linux/regmap.h>
#include <linux/mfd/syscon.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/delay.h>
#include <linux/timekeeping.h>

#define SA_CMD_STATUS_OFS

/* TRNG enable control in SA System module*/
#define SA_CMD_STATUS_REG_TRNG_ENABLE

/* TRNG start control in TRNG module */
#define TRNG_CNTL_REG_TRNG_ENABLE

/* Data ready indicator in STATUS register */
#define TRNG_STATUS_REG_READY

/* Data ready clear control in INTACK register */
#define TRNG_INTACK_REG_READY

/*
 * Number of samples taken to gather entropy during startup.
 * If value is 0, the number of samples is 2^24 else
 * equals value times 2^8.
 */
#define TRNG_DEF_STARTUP_CYCLES
#define TRNG_CNTL_REG_STARTUP_CYCLES_SHIFT

/*
 * Minimum number of samples taken to regenerate entropy
 * If value is 0, the number of samples is 2^24 else
 * equals value times 2^6.
 */
#define TRNG_DEF_MIN_REFILL_CYCLES
#define TRNG_CFG_REG_MIN_REFILL_CYCLES_SHIFT

/*
 * Maximum number of samples taken to regenerate entropy
 * If value is 0, the number of samples is 2^24 else
 * equals value times 2^8.
 */
#define TRNG_DEF_MAX_REFILL_CYCLES
#define TRNG_CFG_REG_MAX_REFILL_CYCLES_SHIFT

/* Number of CLK input cycles between samples */
#define TRNG_DEF_CLK_DIV_CYCLES
#define TRNG_CFG_REG_SAMPLE_DIV_SHIFT

/* Maximum retries to get rng data */
#define SA_MAX_RNG_DATA_RETRIES
/* Delay between retries (in usecs) */
#define SA_RNG_DATA_RETRY_DELAY

struct trng_regs {};

struct ks_sa_rng {};

static unsigned int cycles_to_ns(unsigned long clk_rate, unsigned int cycles)
{}

static unsigned int startup_delay_ns(unsigned long clk_rate)
{}

static unsigned int refill_delay_ns(unsigned long clk_rate)
{}

static int ks_sa_rng_init(struct hwrng *rng)
{}

static void ks_sa_rng_cleanup(struct hwrng *rng)
{}

static int ks_sa_rng_data_read(struct hwrng *rng, u32 *data)
{}

static int ks_sa_rng_data_present(struct hwrng *rng, int wait)
{}

static int ks_sa_rng_probe(struct platform_device *pdev)
{}

static void ks_sa_rng_remove(struct platform_device *pdev)
{}

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

static struct platform_driver ks_sa_rng_driver =;

module_platform_driver();

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