aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-07-28 08:59:19 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-07-28 08:59:19 -0400
commit55f9c40ff632d03c527d6a6ceddcda0a224587a6 (patch)
tree215b843439f1d6b7620789ac6e919742db99b7a6 /drivers
parentd5eab9152a3b4ce962c02ad0a0e4d0ec94aadd92 (diff)
parenteb7caf35951b1a56aabee028c1b20727abccc34f (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc: n2_crypto: Attach on Niagara-T3. n2rng: Attach on Niagara-T3. sparc: Detect and handle UltraSPARC-T3 cpu types. sparc: Don't do expensive hypervisor PCR write unless necessary. sparc: Add T3 sun4v cpu type and hypervisor group defines. sparc: Don't leave sparc_pmu_type NULL on sun4v.
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/hw_random/n2-drv.c29
-rw-r--r--drivers/char/hw_random/n2rng.h2
-rw-r--r--drivers/crypto/n2_core.c33
3 files changed, 36 insertions, 28 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
28static char version[] __devinitdata = 28static 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[];
623static int __devinit n2rng_probe(struct platform_device *op) 623static 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};
756MODULE_DEVICE_TABLE(of, n2rng_match); 761MODULE_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 */
diff --git a/drivers/crypto/n2_core.c b/drivers/crypto/n2_core.c
index 2e5b2044c96f..d0183ddb3076 100644
--- a/drivers/crypto/n2_core.c
+++ b/drivers/crypto/n2_core.c
@@ -1,6 +1,6 @@
1/* n2_core.c: Niagara2 Stream Processing Unit (SPU) crypto support. 1/* n2_core.c: Niagara2 Stream Processing Unit (SPU) crypto support.
2 * 2 *
3 * Copyright (C) 2010 David S. Miller <davem@davemloft.net> 3 * Copyright (C) 2010, 2011 David S. Miller <davem@davemloft.net>
4 */ 4 */
5 5
6#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 6#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
@@ -31,8 +31,8 @@
31#include "n2_core.h" 31#include "n2_core.h"
32 32
33#define DRV_MODULE_NAME "n2_crypto" 33#define DRV_MODULE_NAME "n2_crypto"
34#define DRV_MODULE_VERSION "0.1" 34#define DRV_MODULE_VERSION "0.2"
35#define DRV_MODULE_RELDATE "April 29, 2010" 35#define DRV_MODULE_RELDATE "July 28, 2011"
36 36
37static char version[] __devinitdata = 37static char version[] __devinitdata =
38 DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; 38 DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n";
@@ -1823,22 +1823,17 @@ static int spu_mdesc_scan(struct mdesc_handle *mdesc, struct platform_device *de
1823static int __devinit get_irq_props(struct mdesc_handle *mdesc, u64 node, 1823static int __devinit get_irq_props(struct mdesc_handle *mdesc, u64 node,
1824 struct spu_mdesc_info *ip) 1824 struct spu_mdesc_info *ip)
1825{ 1825{
1826 const u64 *intr, *ino; 1826 const u64 *ino;
1827 int intr_len, ino_len; 1827 int ino_len;
1828 int i; 1828 int i;
1829 1829
1830 intr = mdesc_get_property(mdesc, node, "intr", &intr_len);
1831 if (!intr)
1832 return -ENODEV;
1833
1834 ino = mdesc_get_property(mdesc, node, "ino", &ino_len); 1830 ino = mdesc_get_property(mdesc, node, "ino", &ino_len);
1835 if (!ino) 1831 if (!ino) {
1832 printk("NO 'ino'\n");
1836 return -ENODEV; 1833 return -ENODEV;
1834 }
1837 1835
1838 if (intr_len != ino_len) 1836 ip->num_intrs = ino_len / sizeof(u64);
1839 return -EINVAL;
1840
1841 ip->num_intrs = intr_len / sizeof(u64);
1842 ip->ino_table = kzalloc((sizeof(struct ino_blob) * 1837 ip->ino_table = kzalloc((sizeof(struct ino_blob) *
1843 ip->num_intrs), 1838 ip->num_intrs),
1844 GFP_KERNEL); 1839 GFP_KERNEL);
@@ -1847,7 +1842,7 @@ static int __devinit get_irq_props(struct mdesc_handle *mdesc, u64 node,
1847 1842
1848 for (i = 0; i < ip->num_intrs; i++) { 1843 for (i = 0; i < ip->num_intrs; i++) {
1849 struct ino_blob *b = &ip->ino_table[i]; 1844 struct ino_blob *b = &ip->ino_table[i];
1850 b->intr = intr[i]; 1845 b->intr = i + 1;
1851 b->ino = ino[i]; 1846 b->ino = ino[i];
1852 } 1847 }
1853 1848
@@ -2204,6 +2199,10 @@ static struct of_device_id n2_crypto_match[] = {
2204 .name = "n2cp", 2199 .name = "n2cp",
2205 .compatible = "SUNW,vf-cwq", 2200 .compatible = "SUNW,vf-cwq",
2206 }, 2201 },
2202 {
2203 .name = "n2cp",
2204 .compatible = "SUNW,kt-cwq",
2205 },
2207 {}, 2206 {},
2208}; 2207};
2209 2208
@@ -2228,6 +2227,10 @@ static struct of_device_id n2_mau_match[] = {
2228 .name = "ncp", 2227 .name = "ncp",
2229 .compatible = "SUNW,vf-mau", 2228 .compatible = "SUNW,vf-mau",
2230 }, 2229 },
2230 {
2231 .name = "ncp",
2232 .compatible = "SUNW,kt-mau",
2233 },
2231 {}, 2234 {},
2232}; 2235};
2233 2236