diff options
author | Andrew Lunn <andrew@lunn.ch> | 2012-09-03 14:29:34 -0400 |
---|---|---|
committer | Jason Cooper <jason@lakedaemon.net> | 2012-09-22 10:40:00 -0400 |
commit | f37fbd36c5f9fe716ddf783415a67de03fb0dc3d (patch) | |
tree | ad911d76e1c4f3b66b7831b6beca4f3d4859be73 | |
parent | 2eecb477765840c175133117010a789e58824680 (diff) |
Crypto: CESA: Add support for DT based instantiation.
Based on work by Michael Walle and Jason Cooper.
Added support for getting the interrupt number and address of SRAM
from DT.
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Tested-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
Conflicts:
arch/arm/mach-kirkwood/board-dt.c
-rw-r--r-- | Documentation/devicetree/bindings/crypto/mv_cesa.txt | 20 | ||||
-rw-r--r-- | arch/arm/boot/dts/kirkwood.dtsi | 12 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/board-dt.c | 2 | ||||
-rw-r--r-- | drivers/crypto/mv_cesa.c | 17 |
4 files changed, 47 insertions, 4 deletions
diff --git a/Documentation/devicetree/bindings/crypto/mv_cesa.txt b/Documentation/devicetree/bindings/crypto/mv_cesa.txt new file mode 100644 index 000000000000..47229b1a594b --- /dev/null +++ b/Documentation/devicetree/bindings/crypto/mv_cesa.txt | |||
@@ -0,0 +1,20 @@ | |||
1 | Marvell Cryptographic Engines And Security Accelerator | ||
2 | |||
3 | Required properties: | ||
4 | - compatible : should be "marvell,orion-crypto" | ||
5 | - reg : base physical address of the engine and length of memory mapped | ||
6 | region, followed by base physical address of sram and its memory | ||
7 | length | ||
8 | - reg-names : "regs" , "sram"; | ||
9 | - interrupts : interrupt number | ||
10 | |||
11 | Examples: | ||
12 | |||
13 | crypto@30000 { | ||
14 | compatible = "marvell,orion-crypto"; | ||
15 | reg = <0x30000 0x10000>, | ||
16 | <0x4000000 0x800>; | ||
17 | reg-names = "regs" , "sram"; | ||
18 | interrupts = <22>; | ||
19 | status = "okay"; | ||
20 | }; | ||
diff --git a/arch/arm/boot/dts/kirkwood.dtsi b/arch/arm/boot/dts/kirkwood.dtsi index cef9616f330a..4e5b8154a5be 100644 --- a/arch/arm/boot/dts/kirkwood.dtsi +++ b/arch/arm/boot/dts/kirkwood.dtsi | |||
@@ -14,7 +14,8 @@ | |||
14 | 14 | ||
15 | ocp@f1000000 { | 15 | ocp@f1000000 { |
16 | compatible = "simple-bus"; | 16 | compatible = "simple-bus"; |
17 | ranges = <0 0xf1000000 0x4000000>; | 17 | ranges = <0x00000000 0xf1000000 0x4000000 |
18 | 0xf5000000 0xf5000000 0x0000400>; | ||
18 | #address-cells = <1>; | 19 | #address-cells = <1>; |
19 | #size-cells = <1>; | 20 | #size-cells = <1>; |
20 | 21 | ||
@@ -105,5 +106,14 @@ | |||
105 | clock-frequency = <100000>; | 106 | clock-frequency = <100000>; |
106 | status = "disabled"; | 107 | status = "disabled"; |
107 | }; | 108 | }; |
109 | |||
110 | crypto@30000 { | ||
111 | compatible = "marvell,orion-crypto"; | ||
112 | reg = <0x30000 0x10000>, | ||
113 | <0xf5000000 0x800>; | ||
114 | reg-names = "regs", "sram"; | ||
115 | interrupts = <22>; | ||
116 | status = "okay"; | ||
117 | }; | ||
108 | }; | 118 | }; |
109 | }; | 119 | }; |
diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c index e4eb450de301..0d5190177651 100644 --- a/arch/arm/mach-kirkwood/board-dt.c +++ b/arch/arm/mach-kirkwood/board-dt.c | |||
@@ -33,6 +33,7 @@ struct of_dev_auxdata kirkwood_auxdata_lookup[] __initdata = { | |||
33 | OF_DEV_AUXDATA("marvell,orion-wdt", 0xf1020300, "orion_wdt", NULL), | 33 | OF_DEV_AUXDATA("marvell,orion-wdt", 0xf1020300, "orion_wdt", NULL), |
34 | OF_DEV_AUXDATA("marvell,orion-sata", 0xf1080000, "sata_mv.0", NULL), | 34 | OF_DEV_AUXDATA("marvell,orion-sata", 0xf1080000, "sata_mv.0", NULL), |
35 | OF_DEV_AUXDATA("marvell,orion-nand", 0xf4000000, "orion_nand", NULL), | 35 | OF_DEV_AUXDATA("marvell,orion-nand", 0xf4000000, "orion_nand", NULL), |
36 | OF_DEV_AUXDATA("marvell,orion-crypto", 0xf1030000, "mv_crypto", NULL), | ||
36 | {}, | 37 | {}, |
37 | }; | 38 | }; |
38 | 39 | ||
@@ -60,7 +61,6 @@ static void __init kirkwood_dt_init(void) | |||
60 | /* internal devices that every board has */ | 61 | /* internal devices that every board has */ |
61 | kirkwood_xor0_init(); | 62 | kirkwood_xor0_init(); |
62 | kirkwood_xor1_init(); | 63 | kirkwood_xor1_init(); |
63 | kirkwood_crypto_init(); | ||
64 | 64 | ||
65 | #ifdef CONFIG_KEXEC | 65 | #ifdef CONFIG_KEXEC |
66 | kexec_reinit = kirkwood_enable_pcie; | 66 | kexec_reinit = kirkwood_enable_pcie; |
diff --git a/drivers/crypto/mv_cesa.c b/drivers/crypto/mv_cesa.c index 21c1a87032b7..24ccae453e79 100644 --- a/drivers/crypto/mv_cesa.c +++ b/drivers/crypto/mv_cesa.c | |||
@@ -19,6 +19,9 @@ | |||
19 | #include <linux/clk.h> | 19 | #include <linux/clk.h> |
20 | #include <crypto/internal/hash.h> | 20 | #include <crypto/internal/hash.h> |
21 | #include <crypto/sha.h> | 21 | #include <crypto/sha.h> |
22 | #include <linux/of.h> | ||
23 | #include <linux/of_platform.h> | ||
24 | #include <linux/of_irq.h> | ||
22 | 25 | ||
23 | #include "mv_cesa.h" | 26 | #include "mv_cesa.h" |
24 | 27 | ||
@@ -1062,7 +1065,10 @@ static int mv_probe(struct platform_device *pdev) | |||
1062 | goto err_unmap_reg; | 1065 | goto err_unmap_reg; |
1063 | } | 1066 | } |
1064 | 1067 | ||
1065 | irq = platform_get_irq(pdev, 0); | 1068 | if (pdev->dev.of_node) |
1069 | irq = irq_of_parse_and_map(pdev->dev.of_node, 0); | ||
1070 | else | ||
1071 | irq = platform_get_irq(pdev, 0); | ||
1066 | if (irq < 0 || irq == NO_IRQ) { | 1072 | if (irq < 0 || irq == NO_IRQ) { |
1067 | ret = irq; | 1073 | ret = irq; |
1068 | goto err_unmap_sram; | 1074 | goto err_unmap_sram; |
@@ -1170,12 +1176,19 @@ static int mv_remove(struct platform_device *pdev) | |||
1170 | return 0; | 1176 | return 0; |
1171 | } | 1177 | } |
1172 | 1178 | ||
1179 | static const struct of_device_id mv_cesa_of_match_table[] = { | ||
1180 | { .compatible = "marvell,orion-crypto", }, | ||
1181 | {} | ||
1182 | }; | ||
1183 | MODULE_DEVICE_TABLE(of, mv_cesa_of_match_table); | ||
1184 | |||
1173 | static struct platform_driver marvell_crypto = { | 1185 | static struct platform_driver marvell_crypto = { |
1174 | .probe = mv_probe, | 1186 | .probe = mv_probe, |
1175 | .remove = mv_remove, | 1187 | .remove = __devexit_p(mv_remove), |
1176 | .driver = { | 1188 | .driver = { |
1177 | .owner = THIS_MODULE, | 1189 | .owner = THIS_MODULE, |
1178 | .name = "mv_crypto", | 1190 | .name = "mv_crypto", |
1191 | .of_match_table = of_match_ptr(mv_cesa_of_match_table), | ||
1179 | }, | 1192 | }, |
1180 | }; | 1193 | }; |
1181 | MODULE_ALIAS("platform:mv_crypto"); | 1194 | MODULE_ALIAS("platform:mv_crypto"); |