162306a36Sopenharmony_ci/* 262306a36Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public 362306a36Sopenharmony_ci * License. See the file "COPYING" in the main directory of this archive 462306a36Sopenharmony_ci * for more details. 562306a36Sopenharmony_ci * 662306a36Sopenharmony_ci * Copyright (C) 2011 Florian Fainelli <florian@openwrt.org> 762306a36Sopenharmony_ci */ 862306a36Sopenharmony_ci 962306a36Sopenharmony_ci#include <linux/init.h> 1062306a36Sopenharmony_ci#include <linux/kernel.h> 1162306a36Sopenharmony_ci#include <linux/platform_device.h> 1262306a36Sopenharmony_ci#include <bcm63xx_cpu.h> 1362306a36Sopenharmony_ci 1462306a36Sopenharmony_cistatic struct resource rng_resources[] = { 1562306a36Sopenharmony_ci { 1662306a36Sopenharmony_ci .start = -1, /* filled at runtime */ 1762306a36Sopenharmony_ci .end = -1, /* filled at runtime */ 1862306a36Sopenharmony_ci .flags = IORESOURCE_MEM, 1962306a36Sopenharmony_ci }, 2062306a36Sopenharmony_ci}; 2162306a36Sopenharmony_ci 2262306a36Sopenharmony_cistatic struct platform_device bcm63xx_rng_device = { 2362306a36Sopenharmony_ci .name = "bcm63xx-rng", 2462306a36Sopenharmony_ci .id = -1, 2562306a36Sopenharmony_ci .num_resources = ARRAY_SIZE(rng_resources), 2662306a36Sopenharmony_ci .resource = rng_resources, 2762306a36Sopenharmony_ci}; 2862306a36Sopenharmony_ci 2962306a36Sopenharmony_ciint __init bcm63xx_rng_register(void) 3062306a36Sopenharmony_ci{ 3162306a36Sopenharmony_ci if (!BCMCPU_IS_6368()) 3262306a36Sopenharmony_ci return -ENODEV; 3362306a36Sopenharmony_ci 3462306a36Sopenharmony_ci rng_resources[0].start = bcm63xx_regset_address(RSET_RNG); 3562306a36Sopenharmony_ci rng_resources[0].end = rng_resources[0].start; 3662306a36Sopenharmony_ci rng_resources[0].end += RSET_RNG_SIZE - 1; 3762306a36Sopenharmony_ci 3862306a36Sopenharmony_ci return platform_device_register(&bcm63xx_rng_device); 3962306a36Sopenharmony_ci} 4062306a36Sopenharmony_ciarch_initcall(bcm63xx_rng_register); 41