Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit abefd674 authored by Gilad Ben-Yossef's avatar Gilad Ben-Yossef Committed by Greg Kroah-Hartman
Browse files

staging: ccree: introduce CryptoCell HW driver



Introduce basic low level Arm TrustZone CryptoCell HW support.
This first patch doesn't actually register any Crypto API
transformations, these will follow up in the next patch.

This first revision supports the CC 712 REE component.

Signed-off-by: default avatarGilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f55a6d45
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -104,4 +104,6 @@ source "drivers/staging/greybus/Kconfig"

source "drivers/staging/vc04_services/Kconfig"

source "drivers/staging/ccree/Kconfig"

endif # STAGING
+1 −0
Original line number Diff line number Diff line
@@ -41,4 +41,5 @@ obj-$(CONFIG_MOST) += most/
obj-$(CONFIG_KS7010)		+= ks7010/
obj-$(CONFIG_GREYBUS)		+= greybus/
obj-$(CONFIG_BCM2835_VCHIQ)	+= vc04_services/
obj-$(CONFIG_CRYPTO_DEV_CCREE)	+= ccree/
+19 −0
Original line number Diff line number Diff line
config CRYPTO_DEV_CCREE
	tristate "Support for ARM TrustZone CryptoCell C7XX family of Crypto accelerators"
	depends on CRYPTO_HW && OF && HAS_DMA
	default n
	help
	  Say 'Y' to enable a driver for the Arm TrustZone CryptoCell 
	  C7xx. Currently only the CryptoCell 712 REE is supported.
	  Choose this if you wish to use hardware acceleration of
	  cryptographic operations on the system REE.
	  If unsure say Y.

config CCREE_DISABLE_COHERENT_DMA_OPS
	bool "Disable Coherent DMA operations for the CCREE driver"
	depends on CRYPTO_DEV_CCREE
	default n
	help
	  Say 'Y' to disable the use of coherent DMA operations by the
	  CCREE driver for debugging purposes.  
	  If unsure say N.
+2 −0
Original line number Diff line number Diff line
obj-$(CONFIG_CRYPTO_DEV_CCREE) := ccree.o
ccree-y := ssi_driver.o ssi_sysfs.o ssi_buffer_mgr.o ssi_request_mgr.o ssi_sram_mgr.o ssi_pm.o ssi_pm_ext.o
+62 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2012-2017 ARM Limited or its affiliates.
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, see <http://www.gnu.org/licenses/>.
 */

/*!
 * \file cc_bitops.h
 * Bit fields operations macros.
 */
#ifndef _CC_BITOPS_H_
#define _CC_BITOPS_H_

#define BITMASK(mask_size) (((mask_size) < 32) ?	\
	((1UL << (mask_size)) - 1) : 0xFFFFFFFFUL)
#define BITMASK_AT(mask_size, mask_offset) (BITMASK(mask_size) << (mask_offset))

#define BITFIELD_GET(word, bit_offset, bit_size) \
	(((word) >> (bit_offset)) & BITMASK(bit_size))
#define BITFIELD_SET(word, bit_offset, bit_size, new_val)   do {    \
	word = ((word) & ~BITMASK_AT(bit_size, bit_offset)) |	    \
		(((new_val) & BITMASK(bit_size)) << (bit_offset));  \
} while (0)

/* Is val aligned to "align" ("align" must be power of 2) */
#ifndef IS_ALIGNED
#define IS_ALIGNED(val, align)		\
	(((uintptr_t)(val) & ((align) - 1)) == 0)
#endif

#define SWAP_ENDIAN(word)		\
	(((word) >> 24) | (((word) & 0x00FF0000) >> 8) | \
	(((word) & 0x0000FF00) << 8) | (((word) & 0x000000FF) << 24))

#ifdef BIG__ENDIAN
#define SWAP_TO_LE(word) SWAP_ENDIAN(word)
#define SWAP_TO_BE(word) word
#else
#define SWAP_TO_LE(word) word
#define SWAP_TO_BE(word) SWAP_ENDIAN(word)
#endif



/* Is val a multiple of "mult" ("mult" must be power of 2) */
#define IS_MULT(val, mult)              \
	(((val) & ((mult) - 1)) == 0)

#define IS_NULL_ADDR(adr)		\
	(!(adr))

#endif /*_CC_BITOPS_H_*/
Loading