diff options
author | Vegard Nossum <vegard.nossum@gmail.com> | 2009-06-15 09:50:49 -0400 |
---|---|---|
committer | Vegard Nossum <vegard.nossum@gmail.com> | 2009-06-15 09:50:49 -0400 |
commit | 722f2a6c87f34ee0fd0130a8cf45f81e0705594a (patch) | |
tree | 50b054df34d2731eb0ba0cf1a6c27e43e7eed428 /arch/arm/mach-orion5x/ts78xx-setup.c | |
parent | 7a0aeb14e18ad59394bd9bbc6e57fb345819e748 (diff) | |
parent | 45e3e1935e2857c54783291107d33323b3ef33c8 (diff) |
Merge commit 'linus/master' into HEAD
Conflicts:
MAINTAINERS
Signed-off-by: Vegard Nossum <vegard.nossum@gmail.com>
Diffstat (limited to 'arch/arm/mach-orion5x/ts78xx-setup.c')
-rw-r--r-- | arch/arm/mach-orion5x/ts78xx-setup.c | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/arch/arm/mach-orion5x/ts78xx-setup.c b/arch/arm/mach-orion5x/ts78xx-setup.c index 9a6b397f972d..5041d1bc26b1 100644 --- a/arch/arm/mach-orion5x/ts78xx-setup.c +++ b/arch/arm/mach-orion5x/ts78xx-setup.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/m48t86.h> | 17 | #include <linux/m48t86.h> |
18 | #include <linux/mtd/nand.h> | 18 | #include <linux/mtd/nand.h> |
19 | #include <linux/mtd/partitions.h> | 19 | #include <linux/mtd/partitions.h> |
20 | #include <linux/timeriomem-rng.h> | ||
20 | #include <asm/mach-types.h> | 21 | #include <asm/mach-types.h> |
21 | #include <asm/mach/arch.h> | 22 | #include <asm/mach/arch.h> |
22 | #include <asm/mach/map.h> | 23 | #include <asm/mach/map.h> |
@@ -270,12 +271,57 @@ static void ts78xx_ts_nand_unload(void) | |||
270 | } | 271 | } |
271 | 272 | ||
272 | /***************************************************************************** | 273 | /***************************************************************************** |
274 | * HW RNG | ||
275 | ****************************************************************************/ | ||
276 | #define TS_RNG_DATA (TS78XX_FPGA_REGS_PHYS_BASE | 0x044) | ||
277 | |||
278 | static struct resource ts78xx_ts_rng_resource = { | ||
279 | .flags = IORESOURCE_MEM, | ||
280 | .start = TS_RNG_DATA, | ||
281 | .end = TS_RNG_DATA + 4 - 1, | ||
282 | }; | ||
283 | |||
284 | static struct timeriomem_rng_data ts78xx_ts_rng_data = { | ||
285 | .period = 1000000, /* one second */ | ||
286 | }; | ||
287 | |||
288 | static struct platform_device ts78xx_ts_rng_device = { | ||
289 | .name = "timeriomem_rng", | ||
290 | .id = -1, | ||
291 | .dev = { | ||
292 | .platform_data = &ts78xx_ts_rng_data, | ||
293 | }, | ||
294 | .resource = &ts78xx_ts_rng_resource, | ||
295 | .num_resources = 1, | ||
296 | }; | ||
297 | |||
298 | static int ts78xx_ts_rng_load(void) | ||
299 | { | ||
300 | int rc; | ||
301 | |||
302 | if (ts78xx_fpga.supports.ts_rng.init == 0) { | ||
303 | rc = platform_device_register(&ts78xx_ts_rng_device); | ||
304 | if (!rc) | ||
305 | ts78xx_fpga.supports.ts_rng.init = 1; | ||
306 | } else | ||
307 | rc = platform_device_add(&ts78xx_ts_rng_device); | ||
308 | |||
309 | return rc; | ||
310 | }; | ||
311 | |||
312 | static void ts78xx_ts_rng_unload(void) | ||
313 | { | ||
314 | platform_device_del(&ts78xx_ts_rng_device); | ||
315 | } | ||
316 | |||
317 | /***************************************************************************** | ||
273 | * FPGA 'hotplug' support code | 318 | * FPGA 'hotplug' support code |
274 | ****************************************************************************/ | 319 | ****************************************************************************/ |
275 | static void ts78xx_fpga_devices_zero_init(void) | 320 | static void ts78xx_fpga_devices_zero_init(void) |
276 | { | 321 | { |
277 | ts78xx_fpga.supports.ts_rtc.init = 0; | 322 | ts78xx_fpga.supports.ts_rtc.init = 0; |
278 | ts78xx_fpga.supports.ts_nand.init = 0; | 323 | ts78xx_fpga.supports.ts_nand.init = 0; |
324 | ts78xx_fpga.supports.ts_rng.init = 0; | ||
279 | } | 325 | } |
280 | 326 | ||
281 | static void ts78xx_fpga_supports(void) | 327 | static void ts78xx_fpga_supports(void) |
@@ -289,10 +335,12 @@ static void ts78xx_fpga_supports(void) | |||
289 | case TS7800_REV_5: | 335 | case TS7800_REV_5: |
290 | ts78xx_fpga.supports.ts_rtc.present = 1; | 336 | ts78xx_fpga.supports.ts_rtc.present = 1; |
291 | ts78xx_fpga.supports.ts_nand.present = 1; | 337 | ts78xx_fpga.supports.ts_nand.present = 1; |
338 | ts78xx_fpga.supports.ts_rng.present = 1; | ||
292 | break; | 339 | break; |
293 | default: | 340 | default: |
294 | ts78xx_fpga.supports.ts_rtc.present = 0; | 341 | ts78xx_fpga.supports.ts_rtc.present = 0; |
295 | ts78xx_fpga.supports.ts_nand.present = 0; | 342 | ts78xx_fpga.supports.ts_nand.present = 0; |
343 | ts78xx_fpga.supports.ts_rng.present = 0; | ||
296 | } | 344 | } |
297 | } | 345 | } |
298 | 346 | ||
@@ -316,6 +364,14 @@ static int ts78xx_fpga_load_devices(void) | |||
316 | } | 364 | } |
317 | ret |= tmp; | 365 | ret |= tmp; |
318 | } | 366 | } |
367 | if (ts78xx_fpga.supports.ts_rng.present == 1) { | ||
368 | tmp = ts78xx_ts_rng_load(); | ||
369 | if (tmp) { | ||
370 | printk(KERN_INFO "TS-78xx: RNG not registered\n"); | ||
371 | ts78xx_fpga.supports.ts_rng.present = 0; | ||
372 | } | ||
373 | ret |= tmp; | ||
374 | } | ||
319 | 375 | ||
320 | return ret; | 376 | return ret; |
321 | } | 377 | } |
@@ -328,6 +384,8 @@ static int ts78xx_fpga_unload_devices(void) | |||
328 | ts78xx_ts_rtc_unload(); | 384 | ts78xx_ts_rtc_unload(); |
329 | if (ts78xx_fpga.supports.ts_nand.present == 1) | 385 | if (ts78xx_fpga.supports.ts_nand.present == 1) |
330 | ts78xx_ts_nand_unload(); | 386 | ts78xx_ts_nand_unload(); |
387 | if (ts78xx_fpga.supports.ts_rng.present == 1) | ||
388 | ts78xx_ts_rng_unload(); | ||
331 | 389 | ||
332 | return ret; | 390 | return ret; |
333 | } | 391 | } |