18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public 38c2ecf20Sopenharmony_ci * License. See the file "COPYING" in the main directory of this archive 48c2ecf20Sopenharmony_ci * for more details. 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * Copyright (C) 2011 Florian Fainelli <florian@openwrt.org> 78c2ecf20Sopenharmony_ci */ 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#include <linux/init.h> 108c2ecf20Sopenharmony_ci#include <linux/kernel.h> 118c2ecf20Sopenharmony_ci#include <linux/platform_device.h> 128c2ecf20Sopenharmony_ci#include <bcm63xx_cpu.h> 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_cistatic struct resource rng_resources[] = { 158c2ecf20Sopenharmony_ci { 168c2ecf20Sopenharmony_ci .start = -1, /* filled at runtime */ 178c2ecf20Sopenharmony_ci .end = -1, /* filled at runtime */ 188c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 198c2ecf20Sopenharmony_ci }, 208c2ecf20Sopenharmony_ci}; 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_cistatic struct platform_device bcm63xx_rng_device = { 238c2ecf20Sopenharmony_ci .name = "bcm63xx-rng", 248c2ecf20Sopenharmony_ci .id = -1, 258c2ecf20Sopenharmony_ci .num_resources = ARRAY_SIZE(rng_resources), 268c2ecf20Sopenharmony_ci .resource = rng_resources, 278c2ecf20Sopenharmony_ci}; 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ciint __init bcm63xx_rng_register(void) 308c2ecf20Sopenharmony_ci{ 318c2ecf20Sopenharmony_ci if (!BCMCPU_IS_6368()) 328c2ecf20Sopenharmony_ci return -ENODEV; 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ci rng_resources[0].start = bcm63xx_regset_address(RSET_RNG); 358c2ecf20Sopenharmony_ci rng_resources[0].end = rng_resources[0].start; 368c2ecf20Sopenharmony_ci rng_resources[0].end += RSET_RNG_SIZE - 1; 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ci return platform_device_register(&bcm63xx_rng_device); 398c2ecf20Sopenharmony_ci} 408c2ecf20Sopenharmony_ciarch_initcall(bcm63xx_rng_register); 41