Skip to content

Commit f109674

Browse files
horiagherbertx
authored andcommitted
crypto: caam - fix snooping for write transactions
HW coherency won't work properly for CAAM write transactions if AWCACHE is left to default (POR) value - 4'b0001. It has to be programmed to 4'b0010, i.e. AXI3 Cacheable bit set. For platforms that have HW coherency support: -PPC-based: the update has no effect; CAAM coherency already works due to the IOMMU (PAMU) driver setting the correct memory coherency attributes -ARM-based: the update fixes cache coherency issues, since IOMMU (SMMU) driver is not programmed to behave similar to PAMU Signed-off-by: Horia Geant? <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent e27513e commit f109674

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

drivers/crypto/caam/ctrl.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -444,8 +444,9 @@ static int caam_probe(struct platform_device *pdev)
444444
* Enable DECO watchdogs and, if this is a PHYS_ADDR_T_64BIT kernel,
445445
* long pointers in master configuration register
446446
*/
447-
setbits32(&ctrl->mcr, MCFGR_WDENABLE |
448-
(sizeof(dma_addr_t) == sizeof(u64) ? MCFGR_LONG_PTR : 0));
447+
clrsetbits_be32(&ctrl->mcr, MCFGR_AWCACHE_MASK, MCFGR_AWCACHE_CACH |
448+
MCFGR_WDENABLE | (sizeof(dma_addr_t) == sizeof(u64) ?
449+
MCFGR_LONG_PTR : 0));
449450

450451
/*
451452
* Read the Compile Time paramters and SCFGR to determine

drivers/crypto/caam/regs.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,10 +395,16 @@ struct caam_ctrl {
395395
/* AXI read cache control */
396396
#define MCFGR_ARCACHE_SHIFT 12
397397
#define MCFGR_ARCACHE_MASK (0xf << MCFGR_ARCACHE_SHIFT)
398+
#define MCFGR_ARCACHE_BUFF (0x1 << MCFGR_ARCACHE_SHIFT)
399+
#define MCFGR_ARCACHE_CACH (0x2 << MCFGR_ARCACHE_SHIFT)
400+
#define MCFGR_ARCACHE_RALL (0x4 << MCFGR_ARCACHE_SHIFT)
398401

399402
/* AXI write cache control */
400403
#define MCFGR_AWCACHE_SHIFT 8
401404
#define MCFGR_AWCACHE_MASK (0xf << MCFGR_AWCACHE_SHIFT)
405+
#define MCFGR_AWCACHE_BUFF (0x1 << MCFGR_AWCACHE_SHIFT)
406+
#define MCFGR_AWCACHE_CACH (0x2 << MCFGR_AWCACHE_SHIFT)
407+
#define MCFGR_AWCACHE_WALL (0x8 << MCFGR_AWCACHE_SHIFT)
402408

403409
/* AXI pipeline depth */
404410
#define MCFGR_AXIPIPE_SHIFT 4

0 commit comments

Comments
 (0)