linux/drivers/char/hw_random/cctrng.c

// SPDX-License-Identifier: GPL-2.0
/* Copyright (C) 2019-2020 ARM Limited or its affiliates. */

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/clk.h>
#include <linux/hw_random.h>
#include <linux/io.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/interrupt.h>
#include <linux/irqreturn.h>
#include <linux/workqueue.h>
#include <linux/circ_buf.h>
#include <linux/completion.h>
#include <linux/of.h>
#include <linux/bitfield.h>
#include <linux/fips.h>

#include "cctrng.h"

#define CC_REG_LOW(name)
#define CC_REG_HIGH(name)
#define CC_GENMASK(name)

#define CC_REG_FLD_GET(reg_name, fld_name, reg_val)

#define CC_HW_RESET_LOOP_COUNT
#define CC_TRNG_SUSPEND_TIMEOUT

/* data circular buffer in words must be:
 *  - of a power-of-2 size (limitation of circ_buf.h macros)
 *  - at least 6, the size generated in the EHR according to HW implementation
 */
#define CCTRNG_DATA_BUF_WORDS

/* The timeout for the TRNG operation should be calculated with the formula:
 * Timeout = EHR_NUM * VN_COEFF * EHR_LENGTH * SAMPLE_CNT * SCALE_VALUE
 * while:
 *  - SAMPLE_CNT is input value from the characterisation process
 *  - all the rest are constants
 */
#define EHR_NUM
#define VN_COEFF
#define EHR_LENGTH
#define SCALE_VALUE
#define CCTRNG_TIMEOUT(smpl_cnt)

struct cctrng_drvdata {};


/* functions for write/read CC registers */
static inline void cc_iowrite(struct cctrng_drvdata *drvdata, u32 reg, u32 val)
{}
static inline u32 cc_ioread(struct cctrng_drvdata *drvdata, u32 reg)
{}


static int cc_trng_pm_get(struct device *dev)
{}

static void cc_trng_pm_put_suspend(struct device *dev)
{}

static int cc_trng_pm_init(struct cctrng_drvdata *drvdata)
{}

static void cc_trng_pm_go(struct cctrng_drvdata *drvdata)
{}

static void cc_trng_pm_fini(struct cctrng_drvdata *drvdata)
{}


static inline int cc_trng_parse_sampling_ratio(struct cctrng_drvdata *drvdata)
{}

static int cc_trng_change_rosc(struct cctrng_drvdata *drvdata)
{}


static void cc_trng_enable_rnd_source(struct cctrng_drvdata *drvdata)
{}


/* increase circular data buffer index (head/tail) */
static inline void circ_idx_inc(int *idx, int bytes)
{}

static inline size_t circ_buf_space(struct cctrng_drvdata *drvdata)
{}

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

static void cc_trng_hw_trigger(struct cctrng_drvdata *drvdata)
{}

static void cc_trng_compwork_handler(struct work_struct *w)
{}

static irqreturn_t cc_isr(int irq, void *dev_id)
{}

static void cc_trng_startwork_handler(struct work_struct *w)
{}

static int cctrng_probe(struct platform_device *pdev)
{}

static void cctrng_remove(struct platform_device *pdev)
{}

static int __maybe_unused cctrng_suspend(struct device *dev)
{}

static bool cctrng_wait_for_reset_completion(struct cctrng_drvdata *drvdata)
{}

static int __maybe_unused cctrng_resume(struct device *dev)
{}

static UNIVERSAL_DEV_PM_OPS(cctrng_pm, cctrng_suspend, cctrng_resume, NULL);

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

static struct platform_driver cctrng_driver =;

module_platform_driver();

/* Module description */
MODULE_DESCRIPTION();
MODULE_AUTHOR();
MODULE_LICENSE();