Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

authored by

Andrew Lunn and committed by
Jason Cooper
f37fbd36 2eecb477

+47 -4
+20
Documentation/devicetree/bindings/crypto/mv_cesa.txt
··· 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 + };
+11 -1
arch/arm/boot/dts/kirkwood.dtsi
··· 14 14 15 15 ocp@f1000000 { 16 16 compatible = "simple-bus"; 17 - ranges = <0 0xf1000000 0x4000000>; 17 + ranges = <0x00000000 0xf1000000 0x4000000 18 + 0xf5000000 0xf5000000 0x0000400>; 18 19 #address-cells = <1>; 19 20 #size-cells = <1>; 20 21 ··· 105 104 interrupts = <29>; 106 105 clock-frequency = <100000>; 107 106 status = "disabled"; 107 + }; 108 + 109 + crypto@30000 { 110 + compatible = "marvell,orion-crypto"; 111 + reg = <0x30000 0x10000>, 112 + <0xf5000000 0x800>; 113 + reg-names = "regs", "sram"; 114 + interrupts = <22>; 115 + status = "okay"; 108 116 }; 109 117 }; 110 118 };
+1 -1
arch/arm/mach-kirkwood/board-dt.c
··· 33 33 OF_DEV_AUXDATA("marvell,orion-wdt", 0xf1020300, "orion_wdt", NULL), 34 34 OF_DEV_AUXDATA("marvell,orion-sata", 0xf1080000, "sata_mv.0", NULL), 35 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 ··· 61 60 /* internal devices that every board has */ 62 61 kirkwood_xor0_init(); 63 62 kirkwood_xor1_init(); 64 - kirkwood_crypto_init(); 65 63 66 64 #ifdef CONFIG_KEXEC 67 65 kexec_reinit = kirkwood_enable_pcie;
+15 -2
drivers/crypto/mv_cesa.c
··· 19 19 #include <linux/clk.h> 20 20 #include <crypto/internal/hash.h> 21 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 26 #include "mv_cesa.h" 24 27 ··· 1065 1062 goto err_unmap_reg; 1066 1063 } 1067 1064 1068 - irq = platform_get_irq(pdev, 0); 1065 + if (pdev->dev.of_node) 1066 + irq = irq_of_parse_and_map(pdev->dev.of_node, 0); 1067 + else 1068 + irq = platform_get_irq(pdev, 0); 1069 1069 if (irq < 0 || irq == NO_IRQ) { 1070 1070 ret = irq; 1071 1071 goto err_unmap_sram; ··· 1176 1170 return 0; 1177 1171 } 1178 1172 1173 + static const struct of_device_id mv_cesa_of_match_table[] = { 1174 + { .compatible = "marvell,orion-crypto", }, 1175 + {} 1176 + }; 1177 + MODULE_DEVICE_TABLE(of, mv_cesa_of_match_table); 1178 + 1179 1179 static struct platform_driver marvell_crypto = { 1180 1180 .probe = mv_probe, 1181 - .remove = mv_remove, 1181 + .remove = __devexit_p(mv_remove), 1182 1182 .driver = { 1183 1183 .owner = THIS_MODULE, 1184 1184 .name = "mv_crypto", 1185 + .of_match_table = of_match_ptr(mv_cesa_of_match_table), 1185 1186 }, 1186 1187 }; 1187 1188 MODULE_ALIAS("platform:mv_crypto");