hi Patrice, On Wed, 4 Dec 2019 at 18:54, Patrice CHOTARD <patrice.chot...@st.com> wrote:
> Hi Sughosh > > On 12/4/19 12:53 PM, Sughosh Ganu wrote: > > Add a driver for the rng device found on stm32mp1 platforms. The > > driver provides a routine for reading the random number seed from the > > hardware device. > > > > Signed-off-by: Sughosh Ganu <sughosh.g...@linaro.org> > > --- > > drivers/rng/Kconfig | 7 ++ > > drivers/rng/Makefile | 1 + > > drivers/rng/stm32mp1_rng.c | 164 > +++++++++++++++++++++++++++++++++++++++++++++ > > 3 files changed, 172 insertions(+) > > create mode 100644 drivers/rng/stm32mp1_rng.c > > > <snip> > > +static int stm32_rng_init(struct stm32_rng_platdata *pdata) > > +{ > > + int err; > > + > > + err = clk_enable(&pdata->clk); > > + if (err) > > + return err; > > + > > + /* Disable CED */ > > + writel(RNG_CR_RNGEN | RNG_CR_CED, pdata->base + RNG_CR); > > + > > + /* clear error indicators */ > > + writel(0, pdata->base + RNG_SR); > > + > > + pdata->inited = 1; > > + > > + return 0; > > +} > > + > > +static int stm32_rng_cleanup(struct stm32_rng_platdata *pdata) > > +{ > > + > > + writel(0, pdata->base + RNG_CR); > > + > > + return clk_disable(&pdata->clk); > > +} > > + > > +static int stm32_rng_probe(struct udevice *dev) > > +{ > > + struct stm32_rng_platdata *pdata = dev_get_platdata(dev); > > + > > + if (pdata->inited) > > + return 0; > > No need to protect stm32_rng_probe() for re-entrance, DM is taking care of > that, so pdata->inited field can be removed. > Thanks for your review. I will remove the member in the next version of the patchset. Will wait for some time before posting v2, to see if I get any other review comments. -sughosh