diff options
Diffstat (limited to 'drivers/char/hw_random')
-rw-r--r-- | drivers/char/hw_random/n2-drv.c | 29 | ||||
-rw-r--r-- | drivers/char/hw_random/n2rng.h | 2 |
2 files changed, 18 insertions, 13 deletions
diff --git a/drivers/char/hw_random/n2-drv.c b/drivers/char/hw_random/n2-drv.c index ac6739e085e3..c3de70de00d4 100644 --- a/drivers/char/hw_random/n2-drv.c +++ b/drivers/char/hw_random/n2-drv.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* n2-drv.c: Niagara-2 RNG driver. | 1 | /* n2-drv.c: Niagara-2 RNG driver. |
2 | * | 2 | * |
3 | * Copyright (C) 2008 David S. Miller <davem@davemloft.net> | 3 | * Copyright (C) 2008, 2011 David S. Miller <davem@davemloft.net> |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <linux/kernel.h> | 6 | #include <linux/kernel.h> |
@@ -22,8 +22,8 @@ | |||
22 | 22 | ||
23 | #define DRV_MODULE_NAME "n2rng" | 23 | #define DRV_MODULE_NAME "n2rng" |
24 | #define PFX DRV_MODULE_NAME ": " | 24 | #define PFX DRV_MODULE_NAME ": " |
25 | #define DRV_MODULE_VERSION "0.1" | 25 | #define DRV_MODULE_VERSION "0.2" |
26 | #define DRV_MODULE_RELDATE "May 15, 2008" | 26 | #define DRV_MODULE_RELDATE "July 27, 2011" |
27 | 27 | ||
28 | static char version[] __devinitdata = | 28 | static char version[] __devinitdata = |
29 | DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; | 29 | DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; |
@@ -623,14 +623,14 @@ static const struct of_device_id n2rng_match[]; | |||
623 | static int __devinit n2rng_probe(struct platform_device *op) | 623 | static int __devinit n2rng_probe(struct platform_device *op) |
624 | { | 624 | { |
625 | const struct of_device_id *match; | 625 | const struct of_device_id *match; |
626 | int victoria_falls; | 626 | int multi_capable; |
627 | int err = -ENOMEM; | 627 | int err = -ENOMEM; |
628 | struct n2rng *np; | 628 | struct n2rng *np; |
629 | 629 | ||
630 | match = of_match_device(n2rng_match, &op->dev); | 630 | match = of_match_device(n2rng_match, &op->dev); |
631 | if (!match) | 631 | if (!match) |
632 | return -EINVAL; | 632 | return -EINVAL; |
633 | victoria_falls = (match->data != NULL); | 633 | multi_capable = (match->data != NULL); |
634 | 634 | ||
635 | n2rng_driver_version(); | 635 | n2rng_driver_version(); |
636 | np = kzalloc(sizeof(*np), GFP_KERNEL); | 636 | np = kzalloc(sizeof(*np), GFP_KERNEL); |
@@ -640,8 +640,8 @@ static int __devinit n2rng_probe(struct platform_device *op) | |||
640 | 640 | ||
641 | INIT_DELAYED_WORK(&np->work, n2rng_work); | 641 | INIT_DELAYED_WORK(&np->work, n2rng_work); |
642 | 642 | ||
643 | if (victoria_falls) | 643 | if (multi_capable) |
644 | np->flags |= N2RNG_FLAG_VF; | 644 | np->flags |= N2RNG_FLAG_MULTI; |
645 | 645 | ||
646 | err = -ENODEV; | 646 | err = -ENODEV; |
647 | np->hvapi_major = 2; | 647 | np->hvapi_major = 2; |
@@ -658,10 +658,10 @@ static int __devinit n2rng_probe(struct platform_device *op) | |||
658 | } | 658 | } |
659 | } | 659 | } |
660 | 660 | ||
661 | if (np->flags & N2RNG_FLAG_VF) { | 661 | if (np->flags & N2RNG_FLAG_MULTI) { |
662 | if (np->hvapi_major < 2) { | 662 | if (np->hvapi_major < 2) { |
663 | dev_err(&op->dev, "VF RNG requires HVAPI major " | 663 | dev_err(&op->dev, "multi-unit-capable RNG requires " |
664 | "version 2 or later, got %lu\n", | 664 | "HVAPI major version 2 or later, got %lu\n", |
665 | np->hvapi_major); | 665 | np->hvapi_major); |
666 | goto out_hvapi_unregister; | 666 | goto out_hvapi_unregister; |
667 | } | 667 | } |
@@ -688,8 +688,8 @@ static int __devinit n2rng_probe(struct platform_device *op) | |||
688 | goto out_free_units; | 688 | goto out_free_units; |
689 | 689 | ||
690 | dev_info(&op->dev, "Found %s RNG, units: %d\n", | 690 | dev_info(&op->dev, "Found %s RNG, units: %d\n", |
691 | ((np->flags & N2RNG_FLAG_VF) ? | 691 | ((np->flags & N2RNG_FLAG_MULTI) ? |
692 | "Victoria Falls" : "Niagara2"), | 692 | "multi-unit-capable" : "single-unit"), |
693 | np->num_units); | 693 | np->num_units); |
694 | 694 | ||
695 | np->hwrng.name = "n2rng"; | 695 | np->hwrng.name = "n2rng"; |
@@ -751,6 +751,11 @@ static const struct of_device_id n2rng_match[] = { | |||
751 | .compatible = "SUNW,vf-rng", | 751 | .compatible = "SUNW,vf-rng", |
752 | .data = (void *) 1, | 752 | .data = (void *) 1, |
753 | }, | 753 | }, |
754 | { | ||
755 | .name = "random-number-generator", | ||
756 | .compatible = "SUNW,kt-rng", | ||
757 | .data = (void *) 1, | ||
758 | }, | ||
754 | {}, | 759 | {}, |
755 | }; | 760 | }; |
756 | MODULE_DEVICE_TABLE(of, n2rng_match); | 761 | MODULE_DEVICE_TABLE(of, n2rng_match); |
diff --git a/drivers/char/hw_random/n2rng.h b/drivers/char/hw_random/n2rng.h index 4bea07f30978..f244ac89087f 100644 --- a/drivers/char/hw_random/n2rng.h +++ b/drivers/char/hw_random/n2rng.h | |||
@@ -68,7 +68,7 @@ struct n2rng { | |||
68 | struct platform_device *op; | 68 | struct platform_device *op; |
69 | 69 | ||
70 | unsigned long flags; | 70 | unsigned long flags; |
71 | #define N2RNG_FLAG_VF 0x00000001 /* Victoria Falls RNG, else N2 */ | 71 | #define N2RNG_FLAG_MULTI 0x00000001 /* Multi-unit capable RNG */ |
72 | #define N2RNG_FLAG_CONTROL 0x00000002 /* Operating in control domain */ | 72 | #define N2RNG_FLAG_CONTROL 0x00000002 /* Operating in control domain */ |
73 | #define N2RNG_FLAG_READY 0x00000008 /* Ready for hw-rng layer */ | 73 | #define N2RNG_FLAG_READY 0x00000008 /* Ready for hw-rng layer */ |
74 | #define N2RNG_FLAG_SHUTDOWN 0x00000010 /* Driver unregistering */ | 74 | #define N2RNG_FLAG_SHUTDOWN 0x00000010 /* Driver unregistering */ |