]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
karo: tx28: improve random init code
authorLothar Waßmann <LW@KARO-electronics.de>
Fri, 9 Jan 2015 10:49:49 +0000 (11:49 +0100)
committerLothar Waßmann <LW@KARO-electronics.de>
Fri, 9 Jan 2015 12:08:01 +0000 (13:08 +0100)
board/karo/tx28/tx28.c

index c64755ecb6c2bb120f897b0a11d79bd2fea4ab1a..cf64c5392f51cc67df0680aff91536cfad329b31 100644 (file)
@@ -109,9 +109,11 @@ static inline void random_init(void)
        int i;
 
        for (i = 0; i < MAX_LOOPS; i++) {
-               unsigned int usec = readl(&digctl_regs->hw_digctl_microseconds);
+               u32 hclk = readl(&digctl_regs->hw_digctl_hclkcount);
+               u32 entropy = readl(&digctl_regs->hw_digctl_entropy);
+               u32 usec = readl(&digctl_regs->hw_digctl_microseconds);
 
-               seed = get_timer(usec + random + seed);
+               seed = get_timer(hclk ^ entropy ^ usec ^ random ^ seed);
                srand(seed);
                random = rand();
        }