1*4882a593Smuzhiyun /* 2*4882a593Smuzhiyun * This file is subject to the terms and conditions of the GNU General Public 3*4882a593Smuzhiyun * License. See the file "COPYING" in the main directory of this archive 4*4882a593Smuzhiyun * for more details. 5*4882a593Smuzhiyun * 6*4882a593Smuzhiyun * Copyright (C) 2011 Florian Fainelli <florian@openwrt.org> 7*4882a593Smuzhiyun */ 8*4882a593Smuzhiyun 9*4882a593Smuzhiyun #include <linux/init.h> 10*4882a593Smuzhiyun #include <linux/kernel.h> 11*4882a593Smuzhiyun #include <linux/platform_device.h> 12*4882a593Smuzhiyun #include <bcm63xx_cpu.h> 13*4882a593Smuzhiyun 14*4882a593Smuzhiyun static struct resource rng_resources[] = { 15*4882a593Smuzhiyun { 16*4882a593Smuzhiyun .start = -1, /* filled at runtime */ 17*4882a593Smuzhiyun .end = -1, /* filled at runtime */ 18*4882a593Smuzhiyun .flags = IORESOURCE_MEM, 19*4882a593Smuzhiyun }, 20*4882a593Smuzhiyun }; 21*4882a593Smuzhiyun 22*4882a593Smuzhiyun static struct platform_device bcm63xx_rng_device = { 23*4882a593Smuzhiyun .name = "bcm63xx-rng", 24*4882a593Smuzhiyun .id = -1, 25*4882a593Smuzhiyun .num_resources = ARRAY_SIZE(rng_resources), 26*4882a593Smuzhiyun .resource = rng_resources, 27*4882a593Smuzhiyun }; 28*4882a593Smuzhiyun bcm63xx_rng_register(void)29*4882a593Smuzhiyunint __init bcm63xx_rng_register(void) 30*4882a593Smuzhiyun { 31*4882a593Smuzhiyun if (!BCMCPU_IS_6368()) 32*4882a593Smuzhiyun return -ENODEV; 33*4882a593Smuzhiyun 34*4882a593Smuzhiyun rng_resources[0].start = bcm63xx_regset_address(RSET_RNG); 35*4882a593Smuzhiyun rng_resources[0].end = rng_resources[0].start; 36*4882a593Smuzhiyun rng_resources[0].end += RSET_RNG_SIZE - 1; 37*4882a593Smuzhiyun 38*4882a593Smuzhiyun return platform_device_register(&bcm63xx_rng_device); 39*4882a593Smuzhiyun } 40*4882a593Smuzhiyun arch_initcall(bcm63xx_rng_register); 41