summaryrefslogtreecommitdiffstats
path: root/drivers/crypto/img-hash.c
Commit message (Collapse)AuthorAgeFilesLines
* crypto: img-hash - remove unnecessary static in img_hash_remove()Gustavo A. R. Silva2017-08-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Remove unnecessary static on local variable hdev. Such variable is initialized before being used, on every execution path throughout the function. The static has no benefit and, removing it reduces the object file size. This issue was detected using Coccinelle and the following semantic patch: https://github.com/GustavoARSilva/coccinelle/blob/master/static/static_unused.cocci In the following log you can see a significant difference in the object file size. This log is the output of the size command, before and after the code change: before: text data bss dec hex filename 14842 6464 128 21434 53ba drivers/crypto/img-hash.o after: text data bss dec hex filename 14789 6376 64 21229 52ed drivers/crypto/img-hash.o Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: img-hash - Handle return value of clk_prepare_enableArvind Yadav2017-05-231-2/+10
| | | | | | | | Here, Clock enable can failed. So adding an error check for clk_prepare_enable. Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: img-hash - use dma_data_direction when calling dma_map_sgNicolas Iooss2017-01-231-2/+2
| | | | | | | | | | | | | The fourth argument of dma_map_sg() and dma_unmap_sg() is an item of dma_data_direction enum. Function img_hash_xmit_dma() wrongly used DMA_MEM_TO_DEV, which is an item of dma_transfer_direction enum. Replace DMA_MEM_TO_DEV (which value is 1) with DMA_TO_DEVICE (which value is fortunately also 1) when calling dma_map_sg() and dma_unmap_sg(). Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: img-hash - Fix set_reqsize callWill Thomas2016-08-091-0/+1
| | | | | | | Properly allocate enough memory to respect the fallback. Signed-off-by: Will Thomas <will.thomas@imgtec.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: img-hash - log a successful probeJames Hartley2016-08-091-1/+1
| | | | | | | | | | Currently the probe function only emits an output on success when debug is specifically enabled. It would be more useful if this happens by default. Signed-off-by: James Hartley <james.hartley@imgtec.com> Reviewed-by: Will Thomas <will.thomas@imgtec.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: img-hash - Add support for export and importJames Hartley2016-08-091-6/+63
| | | | | | | | | | | | Currently the img-hash accelerator does not probe successfully due to a change in the checks made during registration with the crypto framework. This is due to import and export functions not being defined. Correct this. Signed-off-by: James Hartley <james.hartley@imgtec.com> Signed-off-by: Will Thomas <will.thomas@imgtec.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: img-hash - Add suspend resume hooks for img hashGovindraj Raja2016-08-091-0/+27
| | | | | | | | | | | | Current img hash claims sys and periph gate clocks and this can be gated in system suspend scenarios. Add support for Device pm ops for img hash to gate the clocks claimed by img hash. Signed-off-by: Govindraj Raja <Govindraj.Raja@imgtec.com> Reviewed-by: Will Thomas <will.thomas@imgtec.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: img-hash - Reconfigure DMA Burst lengthWill Thomas2016-08-091-1/+2
| | | | | | | | | | Burst length of 16 drives the hash accelerator out of spec and causes stability issues in some cases. Reduce this to stop data being lost. Signed-off-by: Will Thomas <will.thomas@imgtec.com> Reviewed-by: James Hartley <james.hartley@imgtec.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: img-hash - Fix hash request contextWill Thomas2016-08-091-1/+3
| | | | | | | | | | | Move 0 length buffer to end of structure to stop overwriting fallback request data. This doesn't cause a bug itself as the buffer is never used alongside the fallback but should be changed. Signed-off-by: Will Thomas <will.thomas@imgtec.com> Reviewed-by: James Hartley <james.hartley@imgtec.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: img-hash - Fix null pointer exceptionWill Thomas2016-08-091-1/+1
| | | | | | | | Sporadic null pointer exceptions came from here. Fix them. Signed-off-by: Will Thomas <will.thomas@imgtec.com> Reviewed-by: James Hartley <james.hartley@imgtec.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: img-hash - fix spelling mistake in dev_err error messageColin Ian King2015-08-041-1/+1
| | | | | | | | Trival change, fix spelling mistake 'aquire' -> 'acquire' in dev_err message. Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: img-hash - shift wrapping bug in img_hash_hw_init()Dan Carpenter2015-03-231-1/+1
| | | | | | | | "hdev->req->nbytes" is an unsigned int so we so we lose the upper 3 bits to the shift wrap bug. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: img-hash - fix some compile warningsDan Carpenter2015-03-231-2/+1
| | | | | | | | GCC complains about that %u is the wrong format string for size_t and also that "ret" is unused. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* linux-next: build failure after merge of the crypto treeHerbert Xu2015-03-171-1/+1
| | | | | | | | | crypto: img-hash - Add missing semicolon to fix build error There is a missing semicolon after MODULE_DEVICE_TABLE. Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: img-hash - Add Imagination Technologies hw hash acceleratorJames Hartley2015-03-161-0/+1030
This adds support for the Imagination Technologies hash accelerator which provides hardware acceleration for SHA1 SHA224 SHA256 and MD5 hashes. Signed-off-by: James Hartley <james.hartley@imgtec.com> Reviewed-by: Andrew Bresticker <abrestic@chromium.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>