ARM: ux500: add DB serial number to entropy pool
authorLinus Walleij <linus.walleij@linaro.org>
Wed, 3 Oct 2012 12:26:12 +0000 (14:26 +0200)
committerLinus Walleij <linus.walleij@linaro.org>
Mon, 15 Oct 2012 11:53:55 +0000 (13:53 +0200)
This throws the DB (digital baseband, ASIC) serial number, process
type etc into the entropy pool by way of the device_add_randomness()
call. This should make every device have a unique pool state upon
boot.

Cc: Theodore Tso <tytso@mit.edu>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
arch/arm/mach-ux500/cpu-db8500.c

index bcdfe6b1d4534e72dc952cfa989a98ac57d84b70..50202a163e5d39684134d56cdf8b5908882091af 100644 (file)
@@ -17,6 +17,8 @@
 #include <linux/platform_device.h>
 #include <linux/io.h>
 #include <linux/mfd/abx500/ab8500.h>
+#include <linux/platform_data/usb-musb-ux500.h>
+#include <linux/random.h>
 
 #include <asm/pmu.h>
 #include <asm/mach/map.h>
@@ -24,7 +26,6 @@
 #include <mach/hardware.h>
 #include <mach/setup.h>
 #include <mach/devices.h>
-#include <linux/platform_data/usb-musb-ux500.h>
 #include <mach/db8500-regs.h>
 
 #include "devices-db8500.h"
@@ -187,6 +188,8 @@ static const char *db8500_read_soc_id(void)
 {
        void __iomem *uid = __io_address(U8500_BB_UID_BASE);
 
+       /* Throw these device-specific numbers into the entropy pool */
+       add_device_randomness(uid, 0x14);
        return kasprintf(GFP_KERNEL, "%08x%08x%08x%08x%08x",
                         readl((u32 *)uid+1),
                         readl((u32 *)uid+1), readl((u32 *)uid+2),