From 44920da28cde32f352e76a4220b068c8f623c60d Mon Sep 17 00:00:00 2001 From: zbb Date: Thu, 2 Jun 2016 18:41:33 +0000 Subject: [PATCH] Add support for CESA on Armada38x Changes: - added new SoC ID in CESA attach - allowed crypto driver IDs other than 0 - added CESA nodes to Armada38x .dts files - enabled required devices in kernconf Submitted by: Michal Stanek Obtained from: Semihalf Sponsored by: Stormshield Differential revision: https://reviews.freebsd.org/D6220 --- sys/arm/conf/ARMADA38X | 5 +++++ sys/boot/fdt/dts/arm/armada-388-gp.dts | 7 ++++++ sys/boot/fdt/dts/arm/armada-38x.dtsi | 31 ++++++++++++++++++++++++++ sys/dev/cesa/cesa.c | 3 ++- 4 files changed, 45 insertions(+), 1 deletion(-) diff --git a/sys/arm/conf/ARMADA38X b/sys/arm/conf/ARMADA38X index 1903e62d961f..519127b76440 100644 --- a/sys/arm/conf/ARMADA38X +++ b/sys/arm/conf/ARMADA38X @@ -81,6 +81,11 @@ device iic device iicbus device twsi +# CESA +device cesa +device crypto +device cryptodev + #FDT options FDT options FDT_DTB_STATIC diff --git a/sys/boot/fdt/dts/arm/armada-388-gp.dts b/sys/boot/fdt/dts/arm/armada-388-gp.dts index 1d03ced98f44..44ff1cc87925 100644 --- a/sys/boot/fdt/dts/arm/armada-388-gp.dts +++ b/sys/boot/fdt/dts/arm/armada-388-gp.dts @@ -62,6 +62,13 @@ ranges = ; internal-regs { + crypto@90000 { + status = "okay"; + }; + crypto@92000 { + status = "okay"; + }; + spi@10600 { pinctrl-names = "default"; pinctrl-0 = <&spi0_pins>; diff --git a/sys/boot/fdt/dts/arm/armada-38x.dtsi b/sys/boot/fdt/dts/arm/armada-38x.dtsi index d93dab28c444..736d41ae8aba 100644 --- a/sys/boot/fdt/dts/arm/armada-38x.dtsi +++ b/sys/boot/fdt/dts/arm/armada-38x.dtsi @@ -63,6 +63,8 @@ gpio1 = &gpio1; serial0 = &uart0; serial1 = &uart1; + sram0 = &SRAM0; + sram1 = &SRAM1; }; pmu { @@ -70,6 +72,16 @@ interrupts-extended = <&mpic 3>; }; + SRAM0: sram@f1100000 { + compatible = "mrvl,cesa-sram"; + reg = <0xf1100000 0x0010000>; + }; + + SRAM1: sram@f1110000 { + compatible = "mrvl,cesa-sram"; + reg = <0xf1110000 0x0010000>; + }; + soc { compatible = "marvell,armada380-mbus", "simple-bus"; #address-cells = <2>; @@ -140,6 +152,25 @@ #size-cells = <1>; ranges = <0 MBUS_ID(0xf0, 0x01) 0 0x100000>; + crypto@90000 { + compatible = "mrvl,cesa"; + reg = <0x90000 0x10000>; + interrupts = ; + interrupt-parent = <&gic>; + sram-handle = <&SRAM0>; + status = "disabled"; + }; + + crypto@92000 { + compatible = "mrvl,cesa"; + reg = <0x92000 0x1000 /* tdma base reg chan 1 */ + 0x9F000 0x1000>; /* cesa base reg chan 1 */ + interrupts = ; + interrupt-parent = <&gic>; + sram-handle = <&SRAM1>; + status = "disabled"; + }; + L2: cache-controller@8000 { compatible = "arm,pl310-cache"; reg = <0x8000 0x1000>; diff --git a/sys/dev/cesa/cesa.c b/sys/dev/cesa/cesa.c index ea35ae7d39fe..ec5a973d77b2 100644 --- a/sys/dev/cesa/cesa.c +++ b/sys/dev/cesa/cesa.c @@ -1043,6 +1043,7 @@ cesa_attach(device_t dev) switch (d) { case MV_DEV_88F6281: case MV_DEV_88F6282: + case MV_DEV_88F6828: sc->sc_tperr = 0; break; case MV_DEV_MV78100: @@ -1214,7 +1215,7 @@ cesa_attach(device_t dev) /* Register in OCF */ sc->sc_cid = crypto_get_driverid(dev, CRYPTOCAP_F_HARDWARE); - if (sc->sc_cid) { + if (sc->sc_cid < 0) { device_printf(dev, "could not get crypto driver id\n"); goto err8; }