Lines Matching full:rng

59  * struct stm32_rng_config - RNG configuration data
61 * @cr: RNG configuration. 0 means default hardware RNG configuration
72 struct hwrng rng; member
84 * Extracts from the STM32 RNG specification when RNG supports CONDRST.
86 * When a noise source (or seed) error occurs, the RNG stops generating
92 * Indeed, when SEIS is set and SECS is cleared it means RNG performed
99 * cleared by RNG. The random number generation is now back to normal.
113 /* RNG auto-reset (step 2.) */ in stm32_rng_conceal_seed_error_cond_reset()
141 * Extracts from the STM32 RNG specification, when CONDRST is not supported
143 * When a noise source (or seed) error occurs, the RNG stops generating
148 * error after the RNG initialization:
171 static int stm32_rng_conceal_seed_error(struct hwrng *rng) in stm32_rng_conceal_seed_error() argument
173 struct stm32_rng_private *priv = container_of(rng, struct stm32_rng_private, rng); in stm32_rng_conceal_seed_error()
184 static int stm32_rng_read(struct hwrng *rng, void *data, size_t max, bool wait) in stm32_rng_read() argument
186 struct stm32_rng_private *priv = container_of(rng, struct stm32_rng_private, rng); in stm32_rng_read()
196 stm32_rng_conceal_seed_error(rng); in stm32_rng_read()
202 * care of initial delay time when enabling the RNG. in stm32_rng_read()
220 err = stm32_rng_conceal_seed_error(rng); in stm32_rng_read()
231 if (WARN_ONCE((sr & RNG_SR_CEIS), "RNG clock too slow - %x\n", sr)) in stm32_rng_read()
238 err = stm32_rng_conceal_seed_error(rng); in stm32_rng_read()
262 static uint stm32_rng_clock_freq_restrain(struct hwrng *rng) in stm32_rng_clock_freq_restrain() argument
265 container_of(rng, struct stm32_rng_private, rng); in stm32_rng_clock_freq_restrain()
279 pr_debug("RNG clk rate : %lu\n", clk_get_rate(priv->clk) >> clock_div); in stm32_rng_clock_freq_restrain()
284 static int stm32_rng_init(struct hwrng *rng) in stm32_rng_init() argument
287 container_of(rng, struct stm32_rng_private, rng); in stm32_rng_init()
301 * Keep default RNG configuration if none was specified. in stm32_rng_init()
305 uint clock_div = stm32_rng_clock_freq_restrain(rng); in stm32_rng_init()
336 /* Handle all RNG versions by checking if conditional reset should be set */ in stm32_rng_init()
401 /* Do not save that RNG is enabled as it will be handled at resume */ in stm32_rng_suspend()
502 .compatible = "st,stm32mp13-rng",
506 .compatible = "st,stm32-rng",
540 priv->lock_conf = of_property_read_bool(np, "st,rng-lock-conf"); in stm32_rng_probe()
549 priv->rng.name = dev_driver_string(dev); in stm32_rng_probe()
550 priv->rng.init = stm32_rng_init; in stm32_rng_probe()
551 priv->rng.read = stm32_rng_read; in stm32_rng_probe()
552 priv->rng.quality = 900; in stm32_rng_probe()
558 return devm_hwrng_register(dev, &priv->rng); in stm32_rng_probe()
563 .name = "stm32-rng",
575 MODULE_DESCRIPTION("STMicroelectronics STM32 RNG device driver");