linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] crypto: crypto4xx - Perform read/modify/write on device control register
@ 2011-06-21 12:13 Josh Boyer
  2011-06-27  7:33 ` Herbert Xu
  0 siblings, 1 reply; 2+ messages in thread
From: Josh Boyer @ 2011-06-21 12:13 UTC (permalink / raw)
  To: James Hsiao, linux-crypto; +Cc: linuxppc-dev, Herbert Xu

The Security function on the AMCC SoCs has multiple engines within a
single MMIO range.  The crypto driver currently enables the 3DES
functionality by doing a blind write to the device control register.
This can unintentionally disable other functions like the PKA or TRNG
when the driver is loaded.

Perform a read/modify/write to enable the 3DES function instead.

Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>

---

diff --git a/drivers/crypto/amcc/crypto4xx_core.c b/drivers/crypto/amcc/crypto4xx_core.c
index 1891252..1d103f9 100644
--- a/drivers/crypto/amcc/crypto4xx_core.c
+++ b/drivers/crypto/amcc/crypto4xx_core.c
@@ -51,6 +51,7 @@ static void crypto4xx_hw_init(struct crypto4xx_device *dev)
 	union ce_io_threshold io_threshold;
 	u32 rand_num;
 	union ce_pe_dma_cfg pe_dma_cfg;
+	u32 device_ctrl;
 
 	writel(PPC4XX_BYTE_ORDER, dev->ce_base + CRYPTO4XX_BYTE_ORDER_CFG);
 	/* setup pe dma, include reset sg, pdr and pe, then release reset */
@@ -84,7 +85,9 @@ static void crypto4xx_hw_init(struct crypto4xx_device *dev)
 	writel(ring_size.w, dev->ce_base + CRYPTO4XX_RING_SIZE);
 	ring_ctrl.w = 0;
 	writel(ring_ctrl.w, dev->ce_base + CRYPTO4XX_RING_CTRL);
-	writel(PPC4XX_DC_3DES_EN, dev->ce_base + CRYPTO4XX_DEVICE_CTRL);
+	device_ctrl = readl(dev->ce_base + CRYPTO4XX_DEVICE_CTRL);
+	device_ctrl |= PPC4XX_DC_3DES_EN;
+	writel(device_ctrl, dev->ce_base + CRYPTO4XX_DEVICE_CTRL);
 	writel(dev->gdr_pa, dev->ce_base + CRYPTO4XX_GATH_RING_BASE);
 	writel(dev->sdr_pa, dev->ce_base + CRYPTO4XX_SCAT_RING_BASE);
 	part_ring_size.w = 0;

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] crypto: crypto4xx - Perform read/modify/write on device control register
  2011-06-21 12:13 [PATCH] crypto: crypto4xx - Perform read/modify/write on device control register Josh Boyer
@ 2011-06-27  7:33 ` Herbert Xu
  0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2011-06-27  7:33 UTC (permalink / raw)
  To: Josh Boyer; +Cc: linuxppc-dev, James Hsiao, linux-crypto

On Tue, Jun 21, 2011 at 08:13:21AM -0400, Josh Boyer wrote:
> The Security function on the AMCC SoCs has multiple engines within a
> single MMIO range.  The crypto driver currently enables the 3DES
> functionality by doing a blind write to the device control register.
> This can unintentionally disable other functions like the PKA or TRNG
> when the driver is loaded.
> 
> Perform a read/modify/write to enable the 3DES function instead.
> 
> Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-06-27  7:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-21 12:13 [PATCH] crypto: crypto4xx - Perform read/modify/write on device control register Josh Boyer
2011-06-27  7:33 ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).