stm32-rng.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. /*
  3. * Copyright (c) 2015, Daniel Thompson
  4. */
  5. #include <linux/clk.h>
  6. #include <linux/clk-provider.h>
  7. #include <linux/delay.h>
  8. #include <linux/hw_random.h>
  9. #include <linux/io.h>
  10. #include <linux/iopoll.h>
  11. #include <linux/kernel.h>
  12. #include <linux/module.h>
  13. #include <linux/of.h>
  14. #include <linux/of_address.h>
  15. #include <linux/platform_device.h>
  16. #include <linux/pm_runtime.h>
  17. #include <linux/reset.h>
  18. #include <linux/slab.h>
  19. #define RNG_CR 0x00
  20. #define RNG_CR_RNGEN BIT(2)
  21. #define RNG_CR_CED BIT(5)
  22. #define RNG_CR_CONFIG1 GENMASK(11, 8)
  23. #define RNG_CR_NISTC BIT(12)
  24. #define RNG_CR_CONFIG2 GENMASK(15, 13)
  25. #define RNG_CR_CLKDIV_SHIFT 16
  26. #define RNG_CR_CLKDIV GENMASK(19, 16)
  27. #define RNG_CR_CONFIG3 GENMASK(25, 20)
  28. #define RNG_CR_CONDRST BIT(30)
  29. #define RNG_CR_CONFLOCK BIT(31)
  30. #define RNG_CR_ENTROPY_SRC_MASK (RNG_CR_CONFIG1 | RNG_CR_NISTC | RNG_CR_CONFIG2 | RNG_CR_CONFIG3)
  31. #define RNG_CR_CONFIG_MASK (RNG_CR_ENTROPY_SRC_MASK | RNG_CR_CED | RNG_CR_CLKDIV)
  32. #define RNG_SR 0x04
  33. #define RNG_SR_DRDY BIT(0)
  34. #define RNG_SR_CECS BIT(1)
  35. #define RNG_SR_SECS BIT(2)
  36. #define RNG_SR_CEIS BIT(5)
  37. #define RNG_SR_SEIS BIT(6)
  38. #define RNG_DR 0x08
  39. #define RNG_NSCR 0x0C
  40. #define RNG_NSCR_MASK GENMASK(17, 0)
  41. #define RNG_HTCR 0x10
  42. #define RNG_NB_RECOVER_TRIES 3
  43. struct stm32_rng_data {
  44. uint max_clock_rate;
  45. uint nb_clock;
  46. u32 cr;
  47. u32 nscr;
  48. u32 htcr;
  49. bool has_cond_reset;
  50. };
  51. /**
  52. * struct stm32_rng_config - RNG configuration data
  53. *
  54. * @cr: RNG configuration. 0 means default hardware RNG configuration
  55. * @nscr: Noise sources control configuration.
  56. * @htcr: Health tests configuration.
  57. */
  58. struct stm32_rng_config {
  59. u32 cr;
  60. u32 nscr;
  61. u32 htcr;
  62. };
  63. struct stm32_rng_private {
  64. struct hwrng rng;
  65. struct device *dev;
  66. void __iomem *base;
  67. struct clk_bulk_data *clk_bulk;
  68. struct reset_control *rst;
  69. struct stm32_rng_config pm_conf;
  70. const struct stm32_rng_data *data;
  71. bool ced;
  72. bool lock_conf;
  73. };
  74. /*
  75. * Extracts from the STM32 RNG specification when RNG supports CONDRST.
  76. *
  77. * When a noise source (or seed) error occurs, the RNG stops generating
  78. * random numbers and sets to “1” both SEIS and SECS bits to indicate
  79. * that a seed error occurred. (...)
  80. *
  81. * 1. Software reset by writing CONDRST at 1 and at 0 (see bitfield
  82. * description for details). This step is needed only if SECS is set.
  83. * Indeed, when SEIS is set and SECS is cleared it means RNG performed
  84. * the reset automatically (auto-reset).
  85. * 2. If SECS was set in step 1 (no auto-reset) wait for CONDRST
  86. * to be cleared in the RNG_CR register, then confirm that SEIS is
  87. * cleared in the RNG_SR register. Otherwise just clear SEIS bit in
  88. * the RNG_SR register.
  89. * 3. If SECS was set in step 1 (no auto-reset) wait for SECS to be
  90. * cleared by RNG. The random number generation is now back to normal.
  91. */
  92. static int stm32_rng_conceal_seed_error_cond_reset(struct stm32_rng_private *priv)
  93. {
  94. struct device *dev = priv->dev;
  95. u32 sr = readl_relaxed(priv->base + RNG_SR);
  96. u32 cr = readl_relaxed(priv->base + RNG_CR);
  97. int err;
  98. if (sr & RNG_SR_SECS) {
  99. /* Conceal by resetting the subsystem (step 1.) */
  100. writel_relaxed(cr | RNG_CR_CONDRST, priv->base + RNG_CR);
  101. writel_relaxed(cr & ~RNG_CR_CONDRST, priv->base + RNG_CR);
  102. } else {
  103. /* RNG auto-reset (step 2.) */
  104. writel_relaxed(sr & ~RNG_SR_SEIS, priv->base + RNG_SR);
  105. goto end;
  106. }
  107. err = readl_relaxed_poll_timeout_atomic(priv->base + RNG_CR, cr, !(cr & RNG_CR_CONDRST), 10,
  108. 100000);
  109. if (err) {
  110. dev_err(dev, "%s: timeout %x\n", __func__, sr);
  111. return err;
  112. }
  113. /* Check SEIS is cleared (step 2.) */
  114. if (readl_relaxed(priv->base + RNG_SR) & RNG_SR_SEIS)
  115. return -EINVAL;
  116. err = readl_relaxed_poll_timeout_atomic(priv->base + RNG_SR, sr, !(sr & RNG_SR_SECS), 10,
  117. 100000);
  118. if (err) {
  119. dev_err(dev, "%s: timeout %x\n", __func__, sr);
  120. return err;
  121. }
  122. end:
  123. return 0;
  124. }
  125. /*
  126. * Extracts from the STM32 RNG specification, when CONDRST is not supported
  127. *
  128. * When a noise source (or seed) error occurs, the RNG stops generating
  129. * random numbers and sets to “1” both SEIS and SECS bits to indicate
  130. * that a seed error occurred. (...)
  131. *
  132. * The following sequence shall be used to fully recover from a seed
  133. * error after the RNG initialization:
  134. * 1. Clear the SEIS bit by writing it to “0”.
  135. * 2. Read out 12 words from the RNG_DR register, and discard each of
  136. * them in order to clean the pipeline.
  137. * 3. Confirm that SEIS is still cleared. Random number generation is
  138. * back to normal.
  139. */
  140. static int stm32_rng_conceal_seed_error_sw_reset(struct stm32_rng_private *priv)
  141. {
  142. unsigned int i = 0;
  143. u32 sr = readl_relaxed(priv->base + RNG_SR);
  144. writel_relaxed(sr & ~RNG_SR_SEIS, priv->base + RNG_SR);
  145. for (i = 12; i != 0; i--)
  146. (void)readl_relaxed(priv->base + RNG_DR);
  147. if (readl_relaxed(priv->base + RNG_SR) & RNG_SR_SEIS)
  148. return -EINVAL;
  149. return 0;
  150. }
  151. static int stm32_rng_conceal_seed_error(struct hwrng *rng)
  152. {
  153. struct stm32_rng_private *priv = container_of(rng, struct stm32_rng_private, rng);
  154. dev_dbg(priv->dev, "Concealing seed error\n");
  155. if (priv->data->has_cond_reset)
  156. return stm32_rng_conceal_seed_error_cond_reset(priv);
  157. else
  158. return stm32_rng_conceal_seed_error_sw_reset(priv);
  159. };
  160. static int stm32_rng_read(struct hwrng *rng, void *data, size_t max, bool wait)
  161. {
  162. struct stm32_rng_private *priv = container_of(rng, struct stm32_rng_private, rng);
  163. unsigned int i = 0;
  164. int retval = 0, err = 0;
  165. u32 sr;
  166. retval = pm_runtime_resume_and_get(priv->dev);
  167. if (retval)
  168. return retval;
  169. if (readl_relaxed(priv->base + RNG_SR) & RNG_SR_SEIS)
  170. stm32_rng_conceal_seed_error(rng);
  171. while (max >= sizeof(u32)) {
  172. sr = readl_relaxed(priv->base + RNG_SR);
  173. /*
  174. * Manage timeout which is based on timer and take
  175. * care of initial delay time when enabling the RNG.
  176. */
  177. if (!sr && wait) {
  178. err = readl_relaxed_poll_timeout_atomic(priv->base
  179. + RNG_SR,
  180. sr, sr,
  181. 10, 50000);
  182. if (err) {
  183. dev_err(priv->dev, "%s: timeout %x!\n", __func__, sr);
  184. break;
  185. }
  186. } else if (!sr) {
  187. /* The FIFO is being filled up */
  188. break;
  189. }
  190. if (sr != RNG_SR_DRDY) {
  191. if (sr & RNG_SR_SEIS) {
  192. err = stm32_rng_conceal_seed_error(rng);
  193. i++;
  194. if (err && i > RNG_NB_RECOVER_TRIES) {
  195. dev_err(priv->dev, "Couldn't recover from seed error\n");
  196. retval = -ENOTRECOVERABLE;
  197. goto exit_rpm;
  198. }
  199. continue;
  200. }
  201. if (WARN_ONCE((sr & RNG_SR_CEIS), "RNG clock too slow - %x\n", sr))
  202. writel_relaxed(0, priv->base + RNG_SR);
  203. }
  204. /* Late seed error case: DR being 0 is an error status */
  205. *(u32 *)data = readl_relaxed(priv->base + RNG_DR);
  206. if (!*(u32 *)data) {
  207. err = stm32_rng_conceal_seed_error(rng);
  208. i++;
  209. if (err && i > RNG_NB_RECOVER_TRIES) {
  210. dev_err(priv->dev, "Couldn't recover from seed error");
  211. retval = -ENOTRECOVERABLE;
  212. goto exit_rpm;
  213. }
  214. continue;
  215. }
  216. i = 0;
  217. retval += sizeof(u32);
  218. data += sizeof(u32);
  219. max -= sizeof(u32);
  220. }
  221. exit_rpm:
  222. pm_runtime_put_sync_autosuspend(priv->dev);
  223. return retval || !wait ? retval : -EIO;
  224. }
  225. static uint stm32_rng_clock_freq_restrain(struct hwrng *rng)
  226. {
  227. struct stm32_rng_private *priv =
  228. container_of(rng, struct stm32_rng_private, rng);
  229. unsigned long clock_rate = 0;
  230. uint clock_div = 0;
  231. clock_rate = clk_get_rate(priv->clk_bulk[0].clk);
  232. /*
  233. * Get the exponent to apply on the CLKDIV field in RNG_CR register
  234. * No need to handle the case when clock-div > 0xF as it is physically
  235. * impossible
  236. */
  237. while ((clock_rate >> clock_div) > priv->data->max_clock_rate)
  238. clock_div++;
  239. pr_debug("RNG clk rate : %lu\n", clk_get_rate(priv->clk_bulk[0].clk) >> clock_div);
  240. return clock_div;
  241. }
  242. static int stm32_rng_init(struct hwrng *rng)
  243. {
  244. struct stm32_rng_private *priv =
  245. container_of(rng, struct stm32_rng_private, rng);
  246. int err;
  247. u32 reg;
  248. err = clk_bulk_prepare_enable(priv->data->nb_clock, priv->clk_bulk);
  249. if (err)
  250. return err;
  251. /* clear error indicators */
  252. writel_relaxed(0, priv->base + RNG_SR);
  253. reg = readl_relaxed(priv->base + RNG_CR);
  254. /*
  255. * Keep default RNG configuration if none was specified.
  256. * 0 is an invalid value as it disables all entropy sources.
  257. */
  258. if (priv->data->has_cond_reset && priv->data->cr) {
  259. uint clock_div = stm32_rng_clock_freq_restrain(rng);
  260. reg &= ~RNG_CR_CONFIG_MASK;
  261. reg |= RNG_CR_CONDRST | (priv->data->cr & RNG_CR_ENTROPY_SRC_MASK) |
  262. (clock_div << RNG_CR_CLKDIV_SHIFT);
  263. if (priv->ced)
  264. reg &= ~RNG_CR_CED;
  265. else
  266. reg |= RNG_CR_CED;
  267. writel_relaxed(reg, priv->base + RNG_CR);
  268. /* Health tests and noise control registers */
  269. writel_relaxed(priv->data->htcr, priv->base + RNG_HTCR);
  270. writel_relaxed(priv->data->nscr & RNG_NSCR_MASK, priv->base + RNG_NSCR);
  271. reg &= ~RNG_CR_CONDRST;
  272. reg |= RNG_CR_RNGEN;
  273. if (priv->lock_conf)
  274. reg |= RNG_CR_CONFLOCK;
  275. writel_relaxed(reg, priv->base + RNG_CR);
  276. err = readl_relaxed_poll_timeout_atomic(priv->base + RNG_CR, reg,
  277. (!(reg & RNG_CR_CONDRST)),
  278. 10, 50000);
  279. if (err) {
  280. clk_bulk_disable_unprepare(priv->data->nb_clock, priv->clk_bulk);
  281. dev_err(priv->dev, "%s: timeout %x!\n", __func__, reg);
  282. return -EINVAL;
  283. }
  284. } else {
  285. /* Handle all RNG versions by checking if conditional reset should be set */
  286. if (priv->data->has_cond_reset)
  287. reg |= RNG_CR_CONDRST;
  288. if (priv->ced)
  289. reg &= ~RNG_CR_CED;
  290. else
  291. reg |= RNG_CR_CED;
  292. writel_relaxed(reg, priv->base + RNG_CR);
  293. if (priv->data->has_cond_reset)
  294. reg &= ~RNG_CR_CONDRST;
  295. reg |= RNG_CR_RNGEN;
  296. writel_relaxed(reg, priv->base + RNG_CR);
  297. }
  298. err = readl_relaxed_poll_timeout_atomic(priv->base + RNG_SR, reg,
  299. reg & RNG_SR_DRDY,
  300. 10, 100000);
  301. if (err || (reg & ~RNG_SR_DRDY)) {
  302. clk_bulk_disable_unprepare(priv->data->nb_clock, priv->clk_bulk);
  303. dev_err(priv->dev, "%s: timeout:%x SR: %x!\n", __func__, err, reg);
  304. return -EINVAL;
  305. }
  306. clk_bulk_disable_unprepare(priv->data->nb_clock, priv->clk_bulk);
  307. return 0;
  308. }
  309. static void stm32_rng_remove(struct platform_device *ofdev)
  310. {
  311. pm_runtime_disable(&ofdev->dev);
  312. }
  313. static int __maybe_unused stm32_rng_runtime_suspend(struct device *dev)
  314. {
  315. struct stm32_rng_private *priv = dev_get_drvdata(dev);
  316. u32 reg;
  317. reg = readl_relaxed(priv->base + RNG_CR);
  318. reg &= ~RNG_CR_RNGEN;
  319. writel_relaxed(reg, priv->base + RNG_CR);
  320. clk_bulk_disable_unprepare(priv->data->nb_clock, priv->clk_bulk);
  321. return 0;
  322. }
  323. static int __maybe_unused stm32_rng_suspend(struct device *dev)
  324. {
  325. struct stm32_rng_private *priv = dev_get_drvdata(dev);
  326. int err;
  327. err = clk_bulk_prepare_enable(priv->data->nb_clock, priv->clk_bulk);
  328. if (err)
  329. return err;
  330. if (priv->data->has_cond_reset) {
  331. priv->pm_conf.nscr = readl_relaxed(priv->base + RNG_NSCR);
  332. priv->pm_conf.htcr = readl_relaxed(priv->base + RNG_HTCR);
  333. }
  334. /* Do not save that RNG is enabled as it will be handled at resume */
  335. priv->pm_conf.cr = readl_relaxed(priv->base + RNG_CR) & ~RNG_CR_RNGEN;
  336. writel_relaxed(priv->pm_conf.cr, priv->base + RNG_CR);
  337. clk_bulk_disable_unprepare(priv->data->nb_clock, priv->clk_bulk);
  338. return 0;
  339. }
  340. static int __maybe_unused stm32_rng_runtime_resume(struct device *dev)
  341. {
  342. struct stm32_rng_private *priv = dev_get_drvdata(dev);
  343. int err;
  344. u32 reg;
  345. err = clk_bulk_prepare_enable(priv->data->nb_clock, priv->clk_bulk);
  346. if (err)
  347. return err;
  348. /* Clean error indications */
  349. writel_relaxed(0, priv->base + RNG_SR);
  350. reg = readl_relaxed(priv->base + RNG_CR);
  351. reg |= RNG_CR_RNGEN;
  352. writel_relaxed(reg, priv->base + RNG_CR);
  353. return 0;
  354. }
  355. static int __maybe_unused stm32_rng_resume(struct device *dev)
  356. {
  357. struct stm32_rng_private *priv = dev_get_drvdata(dev);
  358. int err;
  359. u32 reg;
  360. err = clk_bulk_prepare_enable(priv->data->nb_clock, priv->clk_bulk);
  361. if (err)
  362. return err;
  363. /* Clean error indications */
  364. writel_relaxed(0, priv->base + RNG_SR);
  365. if (priv->data->has_cond_reset) {
  366. /*
  367. * Correct configuration in bits [29:4] must be set in the same
  368. * access that set RNG_CR_CONDRST bit. Else config setting is
  369. * not taken into account. CONFIGLOCK bit must also be unset but
  370. * it is not handled at the moment.
  371. */
  372. writel_relaxed(priv->pm_conf.cr | RNG_CR_CONDRST, priv->base + RNG_CR);
  373. writel_relaxed(priv->pm_conf.nscr, priv->base + RNG_NSCR);
  374. writel_relaxed(priv->pm_conf.htcr, priv->base + RNG_HTCR);
  375. reg = readl_relaxed(priv->base + RNG_CR);
  376. reg |= RNG_CR_RNGEN;
  377. reg &= ~RNG_CR_CONDRST;
  378. writel_relaxed(reg, priv->base + RNG_CR);
  379. err = readl_relaxed_poll_timeout_atomic(priv->base + RNG_CR, reg,
  380. reg & ~RNG_CR_CONDRST, 10, 100000);
  381. if (err) {
  382. clk_bulk_disable_unprepare(priv->data->nb_clock, priv->clk_bulk);
  383. dev_err(priv->dev, "%s: timeout:%x CR: %x!\n", __func__, err, reg);
  384. return -EINVAL;
  385. }
  386. } else {
  387. reg = priv->pm_conf.cr;
  388. reg |= RNG_CR_RNGEN;
  389. writel_relaxed(reg, priv->base + RNG_CR);
  390. }
  391. clk_bulk_disable_unprepare(priv->data->nb_clock, priv->clk_bulk);
  392. return 0;
  393. }
  394. static const struct dev_pm_ops __maybe_unused stm32_rng_pm_ops = {
  395. SET_RUNTIME_PM_OPS(stm32_rng_runtime_suspend,
  396. stm32_rng_runtime_resume, NULL)
  397. SET_SYSTEM_SLEEP_PM_OPS(stm32_rng_suspend,
  398. stm32_rng_resume)
  399. };
  400. static const struct stm32_rng_data stm32mp25_rng_data = {
  401. .has_cond_reset = true,
  402. .max_clock_rate = 48000000,
  403. .nb_clock = 2,
  404. .cr = 0x00F00D00,
  405. .nscr = 0x2B5BB,
  406. .htcr = 0x969D,
  407. };
  408. static const struct stm32_rng_data stm32mp13_rng_data = {
  409. .has_cond_reset = true,
  410. .max_clock_rate = 48000000,
  411. .nb_clock = 1,
  412. .cr = 0x00F00D00,
  413. .nscr = 0x2B5BB,
  414. .htcr = 0x969D,
  415. };
  416. static const struct stm32_rng_data stm32_rng_data = {
  417. .has_cond_reset = false,
  418. .max_clock_rate = 48000000,
  419. .nb_clock = 1,
  420. };
  421. static const struct of_device_id stm32_rng_match[] = {
  422. {
  423. .compatible = "st,stm32mp25-rng",
  424. .data = &stm32mp25_rng_data,
  425. },
  426. {
  427. .compatible = "st,stm32mp13-rng",
  428. .data = &stm32mp13_rng_data,
  429. },
  430. {
  431. .compatible = "st,stm32-rng",
  432. .data = &stm32_rng_data,
  433. },
  434. {},
  435. };
  436. MODULE_DEVICE_TABLE(of, stm32_rng_match);
  437. static int stm32_rng_probe(struct platform_device *ofdev)
  438. {
  439. struct device *dev = &ofdev->dev;
  440. struct device_node *np = ofdev->dev.of_node;
  441. struct stm32_rng_private *priv;
  442. struct resource *res;
  443. int ret;
  444. priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
  445. if (!priv)
  446. return -ENOMEM;
  447. priv->base = devm_platform_get_and_ioremap_resource(ofdev, 0, &res);
  448. if (IS_ERR(priv->base))
  449. return PTR_ERR(priv->base);
  450. priv->rst = devm_reset_control_get(&ofdev->dev, NULL);
  451. if (!IS_ERR(priv->rst)) {
  452. reset_control_assert(priv->rst);
  453. udelay(2);
  454. reset_control_deassert(priv->rst);
  455. }
  456. priv->ced = of_property_read_bool(np, "clock-error-detect");
  457. priv->lock_conf = of_property_read_bool(np, "st,rng-lock-conf");
  458. priv->dev = dev;
  459. priv->data = of_device_get_match_data(dev);
  460. if (!priv->data)
  461. return -ENODEV;
  462. dev_set_drvdata(dev, priv);
  463. priv->rng.name = dev_driver_string(dev);
  464. priv->rng.init = stm32_rng_init;
  465. priv->rng.read = stm32_rng_read;
  466. priv->rng.quality = 900;
  467. if (!priv->data->nb_clock || priv->data->nb_clock > 2)
  468. return -EINVAL;
  469. ret = devm_clk_bulk_get_all(dev, &priv->clk_bulk);
  470. if (ret != priv->data->nb_clock)
  471. return dev_err_probe(dev, -EINVAL, "Failed to get clocks: %d\n", ret);
  472. if (priv->data->nb_clock == 2) {
  473. const char *id = priv->clk_bulk[1].id;
  474. struct clk *clk = priv->clk_bulk[1].clk;
  475. if (!priv->clk_bulk[0].id || !priv->clk_bulk[1].id)
  476. return dev_err_probe(dev, -EINVAL, "Missing clock name\n");
  477. if (strcmp(priv->clk_bulk[0].id, "core")) {
  478. priv->clk_bulk[1].id = priv->clk_bulk[0].id;
  479. priv->clk_bulk[1].clk = priv->clk_bulk[0].clk;
  480. priv->clk_bulk[0].id = id;
  481. priv->clk_bulk[0].clk = clk;
  482. }
  483. }
  484. pm_runtime_set_autosuspend_delay(dev, 100);
  485. pm_runtime_use_autosuspend(dev);
  486. pm_runtime_enable(dev);
  487. return devm_hwrng_register(dev, &priv->rng);
  488. }
  489. static struct platform_driver stm32_rng_driver = {
  490. .driver = {
  491. .name = "stm32-rng",
  492. .pm = pm_ptr(&stm32_rng_pm_ops),
  493. .of_match_table = stm32_rng_match,
  494. },
  495. .probe = stm32_rng_probe,
  496. .remove = stm32_rng_remove,
  497. };
  498. module_platform_driver(stm32_rng_driver);
  499. MODULE_LICENSE("GPL");
  500. MODULE_AUTHOR("Daniel Thompson <daniel.thompson@linaro.org>");
  501. MODULE_DESCRIPTION("STMicroelectronics STM32 RNG device driver");