Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

crypto: ux500 - Cleanup hardware identification

Don't use SOC specific functions to identify
which crypto hardware we are talking to and use
the ID provided in the module instead.

Signed-off-by: Andreas Westin <andreas.westin@stericsson.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Andreas Westin and committed by
Herbert Xu
d1cbb144 f7329e71

+4 -17
+4 -6
drivers/crypto/ux500/cryp/cryp.c
··· 37 37 if (NULL == device_data) 38 38 return -EINVAL; 39 39 40 - if (cpu_is_u8500()) 41 - peripheralid2 = CRYP_PERIPHERAL_ID2_DB8500; 42 - else if (cpu_is_u5500()) 43 - peripheralid2 = CRYP_PERIPHERAL_ID2_DB5500; 40 + peripheralid2 = readl_relaxed(&device_data->base->periphId2); 41 + 42 + if (peripheralid2 != CRYP_PERIPHERAL_ID2_DB8500) 43 + return -EPERM; 44 44 45 45 /* Check Peripheral and Pcell Id Register for CRYP */ 46 46 if ((CRYP_PERIPHERAL_ID0 == 47 47 readl_relaxed(&device_data->base->periphId0)) 48 48 && (CRYP_PERIPHERAL_ID1 == 49 49 readl_relaxed(&device_data->base->periphId1)) 50 - && (peripheralid2 == 51 - readl_relaxed(&device_data->base->periphId2)) 52 50 && (CRYP_PERIPHERAL_ID3 == 53 51 readl_relaxed(&device_data->base->periphId3)) 54 52 && (CRYP_PCELL_ID0 ==
-1
drivers/crypto/ux500/cryp/cryp_p.h
··· 41 41 #define CRYP_PERIPHERAL_ID1 0x05 42 42 43 43 #define CRYP_PERIPHERAL_ID2_DB8500 0x28 44 - #define CRYP_PERIPHERAL_ID2_DB5500 0x29 45 44 #define CRYP_PERIPHERAL_ID3 0x00 46 45 47 46 #define CRYP_PCELL_ID0 0x0D
-10
drivers/crypto/ux500/hash/hash_core.c
··· 574 574 memset(&req_ctx->state, 0, sizeof(struct hash_state)); 575 575 req_ctx->updated = 0; 576 576 if (hash_mode == HASH_MODE_DMA) { 577 - if ((ctx->config.oper_mode == HASH_OPER_MODE_HMAC) && 578 - cpu_is_u5500()) { 579 - pr_debug(DEV_DBG_NAME " [%s] HMAC and DMA not working " 580 - "on u5500, directing to CPU mode.", 581 - __func__); 582 - req_ctx->dma_mode = false; /* Don't use DMA */ 583 - goto out; 584 - } 585 - 586 577 if (req->nbytes < HASH_DMA_ALIGN_SIZE) { 587 578 req_ctx->dma_mode = false; /* Don't use DMA */ 588 579 ··· 595 604 } 596 605 } 597 606 } 598 - out: 599 607 return 0; 600 608 } 601 609