How to Enable Hardware Random Number Generator(HRNG) in Uboot?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to Enable Hardware Random Number Generator(HRNG) in Uboot?

Jump to solution
1,146 Views
ChesterZ
Contributor I

Hi Community, 

I am try to use hardware random number generator in Uboot?

I enable DCP_RNG and FSL RNG which are all UCLASS_RNG.

But it seems that DM tree did not generate any RNG driver.

Does anyone know go how to enable RNG driver in Uboot?

 

 

0 Kudos
1 Solution
819 Views
Dhruvit
NXP TechSupport
NXP TechSupport

Hi @ChesterZ,

I hope you are doing well
 
It is not necessary to have a device binded to the driver in U-boot UCLASS_RNG.
caam-rng driver will be probed when the 'rng' command or 'dm_rng_read' is executed. 
RNG is included in the CAAM module so it is not necessary to have a separate device for RNG. 
 
One can try putting print in the probe function of the "drivers/crypto/fsl/rng.c"  and executing the 'rng' command in the U-boot console.
 
Thanks & Regards,
Dhruvit Vasavada

View solution in original post

0 Kudos
7 Replies
983 Views
ChesterZ
Contributor I

Hi @Dhruvit

I try to enable caam-rng, but it fail to get device.

Not sure if it also need to add caam-rng to device tree.

Driver uid uclass Devices
----------------------------------------------------------
caam_jr 058 misc crypto@30900000
caam-rng 086 rng <none>
dcp_rng 086 rng <none>
fecmxc 036 ethernet ethernet@30be0000
fsl_esdhc 059 mmc mmc@30b40000
mmc@30b50000
gpio_hog 063 nop <none>
gpio_mxc 040 gpio gpio@30200000
gpio@30210000
gpio@30220000
gpio@30230000
gpio@30240000
gpio regulator 083 regulator <none>
i2c_generic_chip_drv 045 i2c_generic generic_54
i2c_mxc 043 i2c i2c@30a20000
i2c@30a30000
i2c@30a40000
i2c@30a50000
imx7_reset 085 reset reset-controller@30390000
imx8m_power_domain 077 power_domain gpc@303a0000
pgc
power-domain@0
power-domain@1
power-domain@2
power-domain@3
power-domain@4
power-domain@5
power-domain@6
power-domain@7
power-domain@8
power-domain@9
power-domain@a
imx8mq-pinctrl 075 pinctrl pinctrl@30330000
imx_tmu 103 thermal tmu@30260000
cpu-thermal
mmc_blk 022 blk mmc@30b40000.blk
mmc@30b50000.blk
nxp_imx8mq_usb_phy 073 phy usb-phy@381f0040
usb-phy@382f0040
pinconfig 074 pinconfig fec1grp
i2c1grp
i2c1grp-gpio
usdhc1grp
usdhc1-100grp
usdhc1-200grp
wdog1grp
hdmigrp
i2c2grp
i2c3grp
i2c4grp
i2c2grp-gpio
i2c3grp-gpio
i2c4grp-gpio
regusdhc2gpiogrp
uart1grp
usdhc2grp
usdhc2-100grp
usdhc2-200grp
psci 038 firmware psci
psci-sysreset 101 sysreset psci-sysreset
regulator_fixed 083 regulator eth_phy
regulator-vsd-3v3
root_driver 000 root root_driver
rtc_emul 087 rtc rtc_emul
simple_bus 091 simple_bus soc@0
bus@30000000
syscon@30340000
snvs@30370000
bus@30400000
bus@30800000
bus@32c00000
simple_panel 067 panel <none>
spi_generic_drv 097 spi_generic <none>
usb_dev_generic_drv 108 usb_dev_generic <none>
usb_hub 109 usb_hub <none>
usb_mass_storage 055 usb_mass_storage <none>
usb_storage_blk 022 blk <none>
vidconsole0 113 vidconsole0 <none>
xhci-dwc3 107 usb <none>
xhci_imx8m 107 usb usb@38100000
usb@38200000
xhci_imx8mp_misc 058 misc <none>

0 Kudos
948 Views
Dhruvit
NXP TechSupport
NXP TechSupport

Hi @ChesterZ,

I hope you are doing well.

It doesn't show the device because it doesn't have of match implementation for the device tree node.

rng driver will call a function from caam_jr for reading. (uboot-imx/drivers/crypto/fsl/rng.c)

Thanks & Regards,
Dhruvit Vasavada

0 Kudos
882 Views
ChesterZ
Contributor I

Hi @Dhruvit

I try to use uboot command to get the RNG.

It seems that caam_rng are defined in UCLASS_RNG.

Not sure it could get correct RNG if it did not get udvice from UCLASS_RNG?

 

Thanks 

0 Kudos
820 Views
Dhruvit
NXP TechSupport
NXP TechSupport

Hi @ChesterZ,

I hope you are doing well
 
It is not necessary to have a device binded to the driver in U-boot UCLASS_RNG.
caam-rng driver will be probed when the 'rng' command or 'dm_rng_read' is executed. 
RNG is included in the CAAM module so it is not necessary to have a separate device for RNG. 
 
One can try putting print in the probe function of the "drivers/crypto/fsl/rng.c"  and executing the 'rng' command in the U-boot console.
 
Thanks & Regards,
Dhruvit Vasavada

0 Kudos
1,119 Views
Dhruvit
NXP TechSupport
NXP TechSupport

Hi @ChesterZ,

I hope you are doing well
 
can you please share the SoC part number that you are using?
 
Thanks & Regards,
Dhruvit Vasavada

0 Kudos
1,111 Views
ChesterZ
Contributor I

Hi @Dhruvit,

The SOC number is NXP i.MX8M.

 

Thanks, 

Chester

Tags (1)
0 Kudos
1,082 Views
Dhruvit
NXP TechSupport
NXP TechSupport

Hi @ChesterZ,

I hope you are doing well
 
It is the RNG driver for NXP BSP. Please find the same in the U-boot source code drivers/crypto/fsl/rng.c.
 
Thanks & Regards,
Dhruvit Vasavada

0 Kudos