aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Boyer <jwboyer@linux.vnet.ibm.com>2011-06-27 03:39:07 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2011-06-29 19:44:05 -0400
commitc5697462ae94693764e468b701c616bbbd6f951c (patch)
tree806796e0e6052c4fddc56e5511d75b2bfd03e9bd
parent23457bc9566be64f33afdc159aadd42712673e0b (diff)
crypto: crypto4xx - Perform read/modify/write on device control register
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> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r--drivers/crypto/amcc/crypto4xx_core.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/crypto/amcc/crypto4xx_core.c b/drivers/crypto/amcc/crypto4xx_core.c
index 18912521a7a5..1d103f997dc2 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)
51 union ce_io_threshold io_threshold; 51 union ce_io_threshold io_threshold;
52 u32 rand_num; 52 u32 rand_num;
53 union ce_pe_dma_cfg pe_dma_cfg; 53 union ce_pe_dma_cfg pe_dma_cfg;
54 u32 device_ctrl;
54 55
55 writel(PPC4XX_BYTE_ORDER, dev->ce_base + CRYPTO4XX_BYTE_ORDER_CFG); 56 writel(PPC4XX_BYTE_ORDER, dev->ce_base + CRYPTO4XX_BYTE_ORDER_CFG);
56 /* setup pe dma, include reset sg, pdr and pe, then release reset */ 57 /* 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)
84 writel(ring_size.w, dev->ce_base + CRYPTO4XX_RING_SIZE); 85 writel(ring_size.w, dev->ce_base + CRYPTO4XX_RING_SIZE);
85 ring_ctrl.w = 0; 86 ring_ctrl.w = 0;
86 writel(ring_ctrl.w, dev->ce_base + CRYPTO4XX_RING_CTRL); 87 writel(ring_ctrl.w, dev->ce_base + CRYPTO4XX_RING_CTRL);
87 writel(PPC4XX_DC_3DES_EN, dev->ce_base + CRYPTO4XX_DEVICE_CTRL); 88 device_ctrl = readl(dev->ce_base + CRYPTO4XX_DEVICE_CTRL);
89 device_ctrl |= PPC4XX_DC_3DES_EN;
90 writel(device_ctrl, dev->ce_base + CRYPTO4XX_DEVICE_CTRL);
88 writel(dev->gdr_pa, dev->ce_base + CRYPTO4XX_GATH_RING_BASE); 91 writel(dev->gdr_pa, dev->ce_base + CRYPTO4XX_GATH_RING_BASE);
89 writel(dev->sdr_pa, dev->ce_base + CRYPTO4XX_SCAT_RING_BASE); 92 writel(dev->sdr_pa, dev->ce_base + CRYPTO4XX_SCAT_RING_BASE);
90 part_ring_size.w = 0; 93 part_ring_size.w = 0;