From: James Hartley Subject: RE: [PATCH 1/2] crypto: Add Imagination Technologies hw hash accelerator Date: Tue, 11 Nov 2014 14:59:24 +0000 Message-ID: <72BC0C8BD7BB6F45988A99382E5FBAE54433BAC5@hhmail02.hh.imgtec.org> References: <1415621455-10468-1-git-send-email-james.hartley@imgtec.com> <1415621455-10468-2-git-send-email-james.hartley@imgtec.com> <5460D540.6070205@mentor.com> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Cc: "devicetree@vger.kernel.org" , "pawel.moll@arm.com" , "mark.rutland@arm.com" , "ijc+devicetree@hellion.org.uk" , "galak@codeaurora.org" , "abrestic@chromium.org" , Ezequiel Garcia To: Vladimir Zapolskiy , "herbert@gondor.apana.org.au" , "davem@davemloft.net" , "grant.likely@linaro.org" , "robh+dt@kernel.org" , "akpm@linux-foundation.org" , "gregkh@linuxfoundation.org" , "joe@perches.com" , "mchehab@osg.samsung.com" , "crope@iki.fi" , "jg1.han@samsung.com" , "linux-crypto@vger.kernel.org" Return-path: Received: from mailapp01.imgtec.com ([195.59.15.196]:44552 "EHLO mailapp01.imgtec.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751193AbaKKO7a (ORCPT ); Tue, 11 Nov 2014 09:59:30 -0500 In-Reply-To: <5460D540.6070205@mentor.com> Content-Language: en-US Sender: linux-crypto-owner@vger.kernel.org List-ID: SGkgVmxhZGltaXIsIHRoYW5rcyBmb3IgdGhlIHJldmlldyEgDQoNCj4gLS0tLS1PcmlnaW5hbCBN ZXNzYWdlLS0tLS0NCj4gRnJvbTogVmxhZGltaXIgWmFwb2xza2l5IFttYWlsdG86dmxhZGltaXJf emFwb2xza2l5QG1lbnRvci5jb21dDQo+IFNlbnQ6IDEwIE5vdmVtYmVyIDIwMTQgMTU6MTANCj4g VG86IEphbWVzIEhhcnRsZXk7IGhlcmJlcnRAZ29uZG9yLmFwYW5hLm9yZy5hdTsgZGF2ZW1AZGF2 ZW1sb2Z0L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