blob: 1adf63456d5d698d639727b44649f122593167f7 [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001From 4269eb560ac34c5974559fe256811c1ac5d764ed Mon Sep 17 00:00:00 2001
2From: Franck LENORMAND <franck.lenormand@nxp.com>
3Date: Fri, 23 Nov 2018 16:06:45 +0100
4Subject: [PATCH] MLK-20204 crypto: caam - remove deadcode on 32-bit platforms
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9When building on a platform with a 32bit DMA address, taking the
10upper 32 bits makes no sense.
11
12Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>
13(cherry picked from commit d3346aaa3fbfaf9b7f827d8554f076e3fc82c35b)
14
15-replace ifdeffery with IS_ENABLED() macro
16-change commit headline prefix
17
18Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
19---
20 drivers/crypto/caam/regs.h | 11 ++++++++---
21 1 file changed, 8 insertions(+), 3 deletions(-)
22
23--- a/drivers/crypto/caam/regs.h
24+++ b/drivers/crypto/caam/regs.h
25@@ -173,9 +173,14 @@ static inline u64 rd_reg64(void __iomem
26
27 static inline u64 cpu_to_caam_dma64(dma_addr_t value)
28 {
29- if (caam_imx)
30- return (((u64)cpu_to_caam32(lower_32_bits(value)) << 32) |
31- (u64)cpu_to_caam32(upper_32_bits(value)));
32+ if (caam_imx) {
33+ u64 ret_val = (u64)cpu_to_caam32(lower_32_bits(value)) << 32;
34+
35+ if (IS_ENABLED(CONFIG_ARCH_DMA_ADDR_T_64BIT))
36+ ret_val |= (u64)cpu_to_caam32(upper_32_bits(value));
37+
38+ return ret_val;
39+ }
40
41 return cpu_to_caam64(value);
42 }